answer stringlengths 15 1.25M |
|---|
#!perl
use strict;
use warnings;
# Compares qx entries.
if ($#ARGV != 1)
{
print "Usage: perl sameq.pl no1 no2\n";
exit;
}
my $lin1 = $ARGV[0];
my $lin2 = $ARGV[1];
my $DIR;
if (`uname -a` =~ /CDD/)
{
# Laptop
$DIR = "../../../bridgedata/BBOVG";
}
else
{
$DIR = "../../../bridgedata/hands/BBOVG";
}
my $file1 = no2file($lin1);
my $file2 = no2file($lin2);
my (%list1, %list2);
file2list($file1, \%list1);
file2list($file2, \%list2);
my (@only1, @only2);
my $overlap1 = 0;
my $overlap2 = 0;
for my $k (keys %list1)
{
if (defined $list2{$k})
{
$overlap1++;
}
else
{
push @only1, $k;
}
}
for my $k (keys %list2)
{
if (defined $list1{$k})
{
$overlap2++;
}
else
{
push @only2, $k;
}
}
die "Odd overlaps" unless $overlap1 == $overlap2;
if ($#only1 == -1 && $#only2 == -1)
{
print "Complete qx overlap\n";
}
elsif ($#only1 == -1)
{
print "$lin1 qx's are completely contained in $lin2\n";
}
elsif ($#only2 == -1)
{
print "$lin2 qx's are completely contained in $lin1\n";
}
else
{
print "$lin1 ($overlap1):";
print " $_" for (sort @only1);
print "\n";
print "$lin2 ($overlap2):";
print " $_" for (sort @only2);
print "\n";
}
sub no2file
{
my $no = pop;
return "" unless $no =~ /^\d+$/;
return "$DIR/000000/$no.lin" if $no < 1000;
my $t = int($no/1000);
return "$DIR/00${t}000/$no.lin" if $no < 10000;
return "$DIR/0${t}000/$no.lin";
}
sub file2list
{
my ($file, $list_ref) = @_;
open my $fr, '<', $file or die "Can't open $file $!";
while (my $line = <$fr>)
{
if ($line =~ /^qx\|([^,\|]+)/ || $line =~ /\|qx\|([^,\|]+)/)
{
$list_ref->{$1} = 1;
}
}
close $fr;
} |
/**
* Definition for binary tree
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class Solution {
public boolean isBalanced(TreeNode root) {
boolean []flag = new boolean[1];
flag[0] = true;
if (root == null)
return true;
else {
int leftDepth = getDepth(root.left, flag);
if (!flag[0])
return false;
int rightDepth = getDepth(root.right, flag);
if (!flag[0])
return false;
if (Math.abs(leftDepth - rightDepth) > 1)
return false;
else {
return true;
}
}
}
int getDepth(TreeNode root, boolean[] flag) {
if (root == null)
return 0;
else {
int leftDepth = getDepth(root.left, flag);
int rightDepth = getDepth(root.right, flag);
if (Math.abs(leftDepth - rightDepth) > 1) {
flag[0] = false;
return -1;
}
return Math.max(leftDepth, rightDepth)+1;
}
}
} |
package org.librairy.modeler.w2v.tasks;
import org.librairy.boot.model.domain.resources.Resource;
import org.librairy.boot.storage.generator.URIGenerator;
import org.librairy.computing.cluster.ComputingContext;
import org.librairy.modeler.w2v.helper.ModelingHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Optional;
public class PairingTask implements Runnable{
private static final Logger LOG = LoggerFactory.getLogger(PairingTask.class);
private final ModelingHelper helper;
private final String domainUri;
private final String wordUri;
public PairingTask(String wordUri, String domainUri, ModelingHelper modelingHelper) {
this.wordUri = wordUri;
this.domainUri = domainUri;
this.helper = modelingHelper;
}
@Override
public void run() {
try{
final ComputingContext context = helper.getComputingHelper().newContext("w2v.pairing."+ URIGenerator.retrieveId(domainUri));
try{
LOG.info("Pairing word: " + wordUri + " to similar words in domain: " + domainUri);
// Reading word
Optional<Resource> word = helper.getUdm().read(Resource.Type.WORD).byUri(wordUri);
if (!word.isPresent()){
LOG.warn("No word found by uri: " + wordUri);
return;
}
helper.getPairing().relateWord(context, word.get().asWord(), domainUri);
}catch (RuntimeException e){
LOG.warn(e.getMessage(),e);
} catch (Exception e) {
LOG.warn(e.getMessage(), e);
} finally {
helper.getComputingHelper().close(context);
}
}catch (<API key> e){
LOG.info("Execution interrupted.");
}
}
} |
define({
PUSH: 'PUSH',
DONT_PUSH: 'DONT_PUSH',
getIconClass: function (pushStatus) {
var defaultClass = 'mapping-rule-icon',
additionalClass = '';
switch (pushStatus) {
case this.PUSH:
additionalClass = '<API key>';
break;
case this.DONT_PUSH:
additionalClass = '<API key>';
break;
default:
additionalClass = '<API key>';
}
return defaultClass + ' ' + additionalClass;
},
<API key>: function (pushStatus) {
switch (pushStatus) {
case this.PUSH:
return '<API key>';
case this.DONT_PUSH:
return '<API key>';
default:
return '<API key>';
}
}
}); |
#include <vector>
#include "src/arguments-inl.h"
#include "src/compiler.h"
#include "src/debug/debug-coverage.h"
#include "src/debug/debug-evaluate.h"
#include "src/debug/debug-frames.h"
#include "src/debug/debug-scopes.h"
#include "src/debug/debug.h"
#include "src/debug/liveedit.h"
#include "src/frames-inl.h"
#include "src/globals.h"
#include "src/interpreter/<API key>.h"
#include "src/interpreter/bytecodes.h"
#include "src/interpreter/interpreter.h"
#include "src/isolate-inl.h"
#include "src/objects/debug-objects-inl.h"
#include "src/objects/js-collection-inl.h"
#include "src/objects/js-generator-inl.h"
#include "src/objects/js-promise-inl.h"
#include "src/runtime/runtime-utils.h"
#include "src/runtime/runtime.h"
#include "src/snapshot/snapshot.h"
#include "src/wasm/wasm-objects-inl.h"
namespace v8 {
namespace internal {
<API key>(<API key>) {
using interpreter::Bytecode;
using interpreter::Bytecodes;
using interpreter::OperandScale;
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
<API key>(Object, value, 0);
HandleScope scope(isolate);
// Return value can be changed by debugger. Last set value will be used as
// return value.
ReturnValueScope result_scope(isolate->debug());
isolate->debug()->set_return_value(*value);
// Get the top-most JavaScript frame.
<API key> it(isolate);
if (isolate-><API key>() == DebugInfo::kBreakpoints) {
isolate->debug()->Break(it.frame(),
handle(it.frame()->function(), isolate));
}
// Return the handler from the original bytecode array.
DCHECK(it.frame()->is_interpreted());
InterpretedFrame* interpreted_frame =
reinterpret_cast<InterpretedFrame*>(it.frame());
SharedFunctionInfo* shared = interpreted_frame->function()->shared();
BytecodeArray* bytecode_array = shared->GetBytecodeArray();
int bytecode_offset = interpreted_frame->GetBytecodeOffset();
Bytecode bytecode = Bytecodes::FromByte(bytecode_array->get(bytecode_offset));
bool <API key> = false;
if (isolate-><API key>() == DebugInfo::kSideEffects) {
<API key> =
!isolate->debug()-><API key>(interpreted_frame);
}
if (Bytecodes::Returns(bytecode)) {
// If we are returning (or suspending), reset the bytecode array on the
// interpreted stack frame to the non-debug variant so that the interpreter
// entry trampoline sees the return/suspend bytecode rather than the
// DebugBreak.
interpreted_frame->PatchBytecodeArray(bytecode_array);
}
// We do not have to deal with operand scale here. If the bytecode at the
// break is prefixed by operand scaling, we would have patched over the
// scaling prefix. We now simply dispatch to the handler for the prefix.
// We need to deserialize now to ensure we don't hit the debug break again
// after deserializing.
OperandScale operand_scale = OperandScale::kSingle;
isolate->interpreter()-><API key>(bytecode,
operand_scale);
if (<API key>) {
return MakePair(ReadOnlyRoots(isolate).exception(),
Smi::FromInt(static_cast<uint8_t>(bytecode)));
}
Object* interrupt_object = isolate->stack_guard()->HandleInterrupts();
if (interrupt_object->IsException(isolate)) {
return MakePair(interrupt_object,
Smi::FromInt(static_cast<uint8_t>(bytecode)));
}
return MakePair(isolate->debug()->return_value(),
Smi::FromInt(static_cast<uint8_t>(bytecode)));
}
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
<API key>(JSFunction, function, 0);
USE(function);
DCHECK(function->shared()->HasDebugInfo());
DCHECK(function->shared()->GetDebugInfo()->BreakAtEntry());
// Get the top-most JavaScript frame.
<API key> it(isolate);
DCHECK_EQ(*function, it.frame()->function());
isolate->debug()->Break(it.frame(), function);
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(<API key>) {
SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length());
if (isolate->debug()->break_points_active()) {
isolate->debug()->HandleDebugBreak(<API key>);
}
return isolate->stack_guard()->HandleInterrupts();
}
RUNTIME_FUNCTION(<API key>) {
SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length());
isolate->RequestInterrupt(
[](v8::Isolate* isolate, void*) { v8::debug::BreakRightNow(isolate); },
nullptr);
return ReadOnlyRoots(isolate).undefined_value();
}
template <class IteratorType>
static MaybeHandle<JSArray> <API key>(
Isolate* isolate, Handle<IteratorType> object) {
Factory* factory = isolate->factory();
Handle<IteratorType> iterator = Handle<IteratorType>::cast(object);
const char* kind = nullptr;
switch (iterator->map()->instance_type()) {
case <API key>:
kind = "keys";
break;
case <API key>:
case <API key>:
kind = "entries";
break;
case <API key>:
case <API key>:
kind = "values";
break;
default:
UNREACHABLE();
}
Handle<FixedArray> result = factory->NewFixedArray(2 * 3);
Handle<String> has_more =
factory-><API key>("[[IteratorHasMore]]");
result->set(0, *has_more);
result->set(1, isolate->heap()->ToBoolean(iterator->HasMore()));
Handle<String> index =
factory-><API key>("[[IteratorIndex]]");
result->set(2, *index);
result->set(3, iterator->index());
Handle<String> iterator_kind =
factory-><API key>("[[IteratorKind]]");
result->set(4, *iterator_kind);
Handle<String> kind_str = factory-><API key>(kind);
result->set(5, *kind_str);
return factory-><API key>(result);
}
MaybeHandle<JSArray> Runtime::<API key>(Isolate* isolate,
Handle<Object> object) {
Factory* factory = isolate->factory();
if (object->IsJSBoundFunction()) {
Handle<JSBoundFunction> function = Handle<JSBoundFunction>::cast(object);
Handle<FixedArray> result = factory->NewFixedArray(2 * 3);
Handle<String> target =
factory-><API key>("[[TargetFunction]]");
result->set(0, *target);
result->set(1, function-><API key>());
Handle<String> bound_this =
factory-><API key>("[[BoundThis]]");
result->set(2, *bound_this);
result->set(3, function->bound_this());
Handle<String> bound_args =
factory-><API key>("[[BoundArgs]]");
result->set(4, *bound_args);
Handle<FixedArray> bound_arguments =
factory->CopyFixedArray(handle(function->bound_arguments(), isolate));
Handle<JSArray> arguments_array =
factory-><API key>(bound_arguments);
result->set(5, *arguments_array);
return factory-><API key>(result);
} else if (object->IsJSMapIterator()) {
Handle<JSMapIterator> iterator = Handle<JSMapIterator>::cast(object);
return <API key>(isolate, iterator);
} else if (object->IsJSSetIterator()) {
Handle<JSSetIterator> iterator = Handle<JSSetIterator>::cast(object);
return <API key>(isolate, iterator);
} else if (object->IsJSGeneratorObject()) {
Handle<JSGeneratorObject> generator =
Handle<JSGeneratorObject>::cast(object);
const char* status = "suspended";
if (generator->is_closed()) {
status = "closed";
} else if (generator->is_executing()) {
status = "running";
} else {
DCHECK(generator->is_suspended());
}
Handle<FixedArray> result = factory->NewFixedArray(2 * 3);
Handle<String> generator_status =
factory-><API key>("[[GeneratorStatus]]");
result->set(0, *generator_status);
Handle<String> status_str = factory-><API key>(status);
result->set(1, *status_str);
Handle<String> function =
factory-><API key>("[[GeneratorFunction]]");
result->set(2, *function);
result->set(3, generator->function());
Handle<String> receiver =
factory-><API key>("[[GeneratorReceiver]]");
result->set(4, *receiver);
result->set(5, generator->receiver());
return factory-><API key>(result);
} else if (object->IsJSPromise()) {
Handle<JSPromise> promise = Handle<JSPromise>::cast(object);
const char* status = JSPromise::Status(promise->status());
Handle<FixedArray> result = factory->NewFixedArray(2 * 2);
Handle<String> promise_status =
factory-><API key>("[[PromiseStatus]]");
result->set(0, *promise_status);
Handle<String> status_str = factory-><API key>(status);
result->set(1, *status_str);
Handle<Object> value_obj(promise->status() == Promise::kPending
? ReadOnlyRoots(isolate).undefined_value()
: promise->result(),
isolate);
Handle<String> promise_value =
factory-><API key>("[[PromiseValue]]");
result->set(2, *promise_value);
result->set(3, *value_obj);
return factory-><API key>(result);
} else if (object->IsJSProxy()) {
Handle<JSProxy> js_proxy = Handle<JSProxy>::cast(object);
Handle<FixedArray> result = factory->NewFixedArray(3 * 2);
Handle<String> handler_str =
factory-><API key>("[[Handler]]");
result->set(0, *handler_str);
result->set(1, js_proxy->handler());
Handle<String> target_str =
factory-><API key>("[[Target]]");
result->set(2, *target_str);
result->set(3, js_proxy->target());
Handle<String> is_revoked_str =
factory-><API key>("[[IsRevoked]]");
result->set(4, *is_revoked_str);
result->set(5, isolate->heap()->ToBoolean(js_proxy->IsRevoked()));
return factory-><API key>(result);
} else if (object->IsJSValue()) {
Handle<JSValue> js_value = Handle<JSValue>::cast(object);
Handle<FixedArray> result = factory->NewFixedArray(2);
Handle<String> primitive_value =
factory-><API key>("[[PrimitiveValue]]");
result->set(0, *primitive_value);
result->set(1, js_value->value());
return factory-><API key>(result);
}
return factory->NewJSArray(0);
}
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
if (!args[0]->IsJSGeneratorObject()) return Smi::kZero;
// Check arguments.
<API key>(JSGeneratorObject, gen, 0);
// Only inspect suspended generator scopes.
if (!gen->is_suspended()) {
return Smi::kZero;
}
// Count the visible scopes.
int n = 0;
for (ScopeIterator it(isolate, gen); !it.Done(); it.Next()) {
n++;
}
return Smi::FromInt(n);
}
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
if (!args[0]->IsJSGeneratorObject()) {
return ReadOnlyRoots(isolate).undefined_value();
}
// Check arguments.
<API key>(JSGeneratorObject, gen, 0);
<API key>(int, index, Int32, args[1]);
// Only inspect suspended generator scopes.
if (!gen->is_suspended()) {
return ReadOnlyRoots(isolate).undefined_value();
}
// Find the requested scope.
int n = 0;
ScopeIterator it(isolate, gen);
for (; !it.Done() && n < index; it.Next()) {
n++;
}
if (it.Done()) {
return ReadOnlyRoots(isolate).undefined_value();
}
return *it.<API key>();
}
static bool <API key>(ScopeIterator* it, int index,
Handle<String> variable_name,
Handle<Object> new_value) {
for (int n = 0; !it->Done() && n < index; it->Next()) {
n++;
}
if (it->Done()) {
return false;
}
return it->SetVariableValue(variable_name, new_value);
}
// Change variable value in closure or local scope
// args[0]: number or JsFunction: break id or function
// args[1]: number: scope index
// args[2]: string: variable name
// args[3]: object: new value
// Return true if success and false otherwise
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(4, args.length());
<API key>(JSGeneratorObject, gen, 0);
<API key>(int, index, Int32, args[1]);
<API key>(String, variable_name, 2);
<API key>(Object, new_value, 3);
ScopeIterator it(isolate, gen);
bool res = <API key>(&it, index, variable_name, new_value);
return isolate->heap()->ToBoolean(res);
}
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CHECK(isolate->debug()->is_active());
<API key>(JSFunction, fun, 0);
Handle<SharedFunctionInfo> shared(fun->shared(), isolate);
// Find the number of break points
Handle<Object> break_locations =
Debug::<API key>(isolate, shared);
if (break_locations->IsUndefined(isolate)) {
return ReadOnlyRoots(isolate).undefined_value();
}
// Return array as JS array
return *isolate->factory()-><API key>(
Handle<FixedArray>::cast(break_locations));
}
// Returns the state of break on exceptions
// args[0]: boolean indicating uncaught exceptions
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
<API key>(uint32_t, type_arg, Uint32, args[0]);
ExceptionBreakType type = static_cast<ExceptionBreakType>(type_arg);
bool result = isolate->debug()->IsBreakOnException(type);
return Smi::FromInt(result);
}
// Clear all stepping set by PrepareStep.
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(0, args.length());
CHECK(isolate->debug()->is_active());
isolate->debug()->ClearStepping();
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(0, args.length());
Handle<FixedArray> instances;
{
DebugScope debug_scope(isolate->debug());
// Fill the script objects.
instances = isolate->debug()->GetLoadedScripts();
}
// Convert the script objects to proper JS objects.
for (int i = 0; i < instances->length(); i++) {
Handle<Script> script(Script::cast(instances->get(i)), isolate);
instances->set(i, Smi::FromInt(script->id()));
}
// Return result as a JS array.
return *isolate->factory()-><API key>(instances);
}
RUNTIME_FUNCTION(<API key>) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(Object, f, 0);
if (f->IsJSFunction()) {
return JSFunction::cast(f)->shared()->inferred_name();
}
return ReadOnlyRoots(isolate).empty_string();
}
// Performs a GC.
// Presently, it only does a full GC.
RUNTIME_FUNCTION(<API key>) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
isolate->heap()-><API key>(Heap::kNoGCFlags,
<API key>::kRuntime);
return ReadOnlyRoots(isolate).undefined_value();
}
// Gets the current heap usage.
RUNTIME_FUNCTION(<API key>) {
SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length());
int usage = static_cast<int>(isolate->heap()->SizeOfObjects());
if (!Smi::IsValid(usage)) {
return *isolate->factory()->NewNumberFromInt(usage);
}
return Smi::FromInt(usage);
}
namespace {
int ScriptLinePosition(Handle<Script> script, int line) {
if (line < 0) return -1;
if (script->type() == Script::TYPE_WASM) {
return WasmModuleObject::cast(script->wasm_module_object())
->GetFunctionOffset(line);
}
Script::InitLineEnds(script);
FixedArray* line_ends_array = FixedArray::cast(script->line_ends());
const int line_count = line_ends_array->length();
DCHECK_LT(0, line_count);
if (line == 0) return 0;
// If line == line_count, we return the first position beyond the last line.
if (line > line_count) return -1;
return Smi::ToInt(line_ends_array->get(line - 1)) + 1;
}
int <API key>(Handle<Script> script, int line, int offset) {
if (line < 0 || offset < 0) return -1;
if (line == 0 || offset == 0)
return ScriptLinePosition(script, line) + offset;
Script::PositionInfo info;
if (!Script::GetPositionInfo(script, offset, &info, Script::NO_OFFSET)) {
return -1;
}
const int total_line = info.line + line;
return ScriptLinePosition(script, total_line);
}
Handle<Object> GetJSPositionInfo(Handle<Script> script, int position,
Script::OffsetFlag offset_flag,
Isolate* isolate) {
Script::PositionInfo info;
if (!Script::GetPositionInfo(script, position, &info, offset_flag)) {
return isolate->factory()->null_value();
}
Handle<String> source = handle(String::cast(script->source()), isolate);
Handle<String> sourceText = script->type() == Script::TYPE_WASM
? isolate->factory()->empty_string()
: isolate->factory()->NewSubString(
source, info.line_start, info.line_end);
Handle<JSObject> jsinfo =
isolate->factory()->NewJSObject(isolate->object_function());
JSObject::AddProperty(isolate, jsinfo, isolate->factory()->script_string(),
script, NONE);
JSObject::AddProperty(isolate, jsinfo, isolate->factory()->position_string(),
handle(Smi::FromInt(position), isolate), NONE);
JSObject::AddProperty(isolate, jsinfo, isolate->factory()->line_string(),
handle(Smi::FromInt(info.line), isolate), NONE);
JSObject::AddProperty(isolate, jsinfo, isolate->factory()->column_string(),
handle(Smi::FromInt(info.column), isolate), NONE);
JSObject::AddProperty(isolate, jsinfo,
isolate->factory()->sourceText_string(), sourceText,
NONE);
return jsinfo;
}
Handle<Object> <API key>(Isolate* isolate, Handle<Script> script,
Handle<Object> opt_line,
Handle<Object> opt_column,
int32_t offset) {
// Line and column are possibly undefined and we need to handle these cases,
// additionally subtracting corresponding offsets.
int32_t line = 0;
if (!opt_line->IsNullOrUndefined(isolate)) {
CHECK(opt_line->IsNumber());
line = NumberToInt32(*opt_line) - script->line_offset();
}
int32_t column = 0;
if (!opt_column->IsNullOrUndefined(isolate)) {
CHECK(opt_column->IsNumber());
column = NumberToInt32(*opt_column);
if (line == 0) column -= script->column_offset();
}
int line_position = <API key>(script, line, offset);
if (line_position < 0 || column < 0) return isolate->factory()->null_value();
return GetJSPositionInfo(script, line_position + column, Script::NO_OFFSET,
isolate);
}
// Slow traversal over all scripts on the heap.
bool GetScriptById(Isolate* isolate, int needle, Handle<Script>* result) {
Script::Iterator iterator(isolate);
Script* script = nullptr;
while ((script = iterator.Next()) != nullptr) {
if (script->id() == needle) {
*result = handle(script, isolate);
return true;
}
}
return false;
}
} // namespace
// TODO(5530): Rename once conflicting function has been deleted.
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(4, args.length());
<API key>(int32_t, scriptid, Int32, args[0]);
<API key>(Object, opt_line, 1);
<API key>(Object, opt_column, 2);
<API key>(int32_t, offset, Int32, args[3]);
Handle<Script> script;
CHECK(GetScriptById(isolate, scriptid, &script));
return *<API key>(isolate, script, opt_line, opt_column, offset);
}
// On function call, depending on circumstances, prepare for stepping in,
// or perform a side effect check.
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
<API key>(JSFunction, fun, 0);
<API key>(Object, receiver, 1);
if (isolate->debug()-><API key>()) {
// Ensure that the callee will perform debug check on function call too.
Deoptimizer::DeoptimizeFunction(*fun);
if (isolate->debug()->last_step_action() >= StepIn ||
isolate->debug()-><API key>()) {
DCHECK_EQ(isolate-><API key>(), DebugInfo::kBreakpoints);
isolate->debug()->PrepareStepIn(fun);
}
if (isolate-><API key>() == DebugInfo::kSideEffects &&
!isolate->debug()-><API key>(fun, receiver)) {
return ReadOnlyRoots(isolate).exception();
}
}
return ReadOnlyRoots(isolate).undefined_value();
}
// Set one shot breakpoints for the suspended generator object.
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(0, args.length());
isolate->debug()-><API key>();
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(<API key>) {
DCHECK_EQ(1, args.length());
HandleScope scope(isolate);
<API key>(JSObject, promise, 0);
isolate->PushPromise(promise);
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(<API key>) {
DCHECK_EQ(0, args.length());
SealHandleScope shs(isolate);
isolate->PopPromise();
return ReadOnlyRoots(isolate).undefined_value();
}
namespace {
Handle<JSObject> MakeRangeObject(Isolate* isolate, const CoverageBlock& range) {
Factory* factory = isolate->factory();
Handle<String> start_string = factory-><API key>("start");
Handle<String> end_string = factory-><API key>("end");
Handle<String> count_string = factory-><API key>("count");
Handle<JSObject> range_obj = factory-><API key>();
JSObject::AddProperty(isolate, range_obj, start_string,
factory->NewNumberFromInt(range.start), NONE);
JSObject::AddProperty(isolate, range_obj, end_string,
factory->NewNumberFromInt(range.end), NONE);
JSObject::AddProperty(isolate, range_obj, count_string,
factory->NewNumberFromUint(range.count), NONE);
return range_obj;
}
} // namespace
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(0, args.length());
// Collect coverage data.
std::unique_ptr<Coverage> coverage;
if (isolate-><API key>()) {
coverage = Coverage::CollectBestEffort(isolate);
} else {
coverage = Coverage::CollectPrecise(isolate);
}
Factory* factory = isolate->factory();
// Turn the returned data structure into JavaScript.
// Create an array of scripts.
int num_scripts = static_cast<int>(coverage->size());
// Prepare property keys.
Handle<FixedArray> scripts_array = factory->NewFixedArray(num_scripts);
Handle<String> script_string = factory-><API key>("script");
for (int i = 0; i < num_scripts; i++) {
const auto& script_data = coverage->at(i);
HandleScope inner_scope(isolate);
std::vector<CoverageBlock> ranges;
int num_functions = static_cast<int>(script_data.functions.size());
for (int j = 0; j < num_functions; j++) {
const auto& function_data = script_data.functions[j];
ranges.emplace_back(function_data.start, function_data.end,
function_data.count);
for (size_t k = 0; k < function_data.blocks.size(); k++) {
const auto& block_data = function_data.blocks[k];
ranges.emplace_back(block_data.start, block_data.end, block_data.count);
}
}
int num_ranges = static_cast<int>(ranges.size());
Handle<FixedArray> ranges_array = factory->NewFixedArray(num_ranges);
for (int j = 0; j < num_ranges; j++) {
Handle<JSObject> range_object = MakeRangeObject(isolate, ranges[j]);
ranges_array->set(j, *range_object);
}
Handle<JSArray> script_obj =
factory-><API key>(ranges_array, PACKED_ELEMENTS);
JSObject::AddProperty(isolate, script_obj, script_string,
handle(script_data.script->source(), isolate), NONE);
scripts_array->set(i, *script_obj);
}
return *factory-><API key>(scripts_array, PACKED_ELEMENTS);
}
RUNTIME_FUNCTION(<API key>) {
SealHandleScope shs(isolate);
<API key>(enable, 0);
Coverage::SelectMode(isolate, enable ? debug::Coverage::kPreciseCount
: debug::Coverage::kBestEffort);
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(<API key>) {
SealHandleScope shs(isolate);
<API key>(enable, 0);
Coverage::SelectMode(isolate, enable ? debug::Coverage::kBlockCount
: debug::Coverage::kBestEffort);
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(<API key>) {
SealHandleScope scope(isolate);
DCHECK_EQ(2, args.length());
CONVERT_ARG_CHECKED(JSFunction, function, 0);
<API key>(<API key>, 1);
// It's quite possible that a function contains IncBlockCounter bytecodes, but
// no coverage info exists. This happens e.g. by selecting the best-effort
// coverage collection mode, which triggers deletion of all coverage infos in
// order to avoid memory leaks.
SharedFunctionInfo* shared = function->shared();
if (shared->HasCoverageInfo()) {
CoverageInfo* coverage_info = shared->GetCoverageInfo();
coverage_info->IncrementBlockCount(<API key>);
}
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(<API key>) {
DCHECK_EQ(1, args.length());
HandleScope scope(isolate);
<API key>(JSPromise, promise, 0);
isolate-><API key>(promise, debug::<API key>);
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(<API key>) {
DCHECK_EQ(2, args.length());
HandleScope scope(isolate);
<API key>(has_suspend, 0);
<API key>(JSPromise, promise, 1);
isolate->PopPromise();
if (has_suspend) {
isolate-><API key>(promise,
debug::<API key>);
}
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
<API key>(JSFunction, script_function, 0);
<API key>(String, new_source, 1);
Handle<Script> script(Script::cast(script_function->shared()->script()),
isolate);
v8::debug::LiveEditResult result;
LiveEdit::PatchScript(isolate, script, new_source, false, &result);
switch (result.status) {
case v8::debug::LiveEditResult::COMPILE_ERROR:
return isolate->Throw(*isolate->factory()-><API key>(
"LiveEdit failed: COMPILE_ERROR"));
case v8::debug::LiveEditResult::<API key>:
return isolate->Throw(*isolate->factory()-><API key>(
"LiveEdit failed: <API key>"));
case v8::debug::LiveEditResult::<API key>:
return isolate->Throw(*isolate->factory()-><API key>(
"LiveEdit failed: <API key>"));
case v8::debug::LiveEditResult::
<API key>:
return isolate->Throw(*isolate->factory()-><API key>(
"LiveEdit failed: <API key>"));
case v8::debug::LiveEditResult::<API key>:
return isolate->Throw(*isolate->factory()-><API key>(
"LiveEdit failed: <API key>"));
case v8::debug::LiveEditResult::<API key>:
return isolate->Throw(*isolate->factory()-><API key>(
"LiveEdit failed: <API key>"));
case v8::debug::LiveEditResult::<API key>:
return isolate->Throw(*isolate->factory()-><API key>(
"LiveEdit failed: <API key>"));
case v8::debug::LiveEditResult::OK:
return ReadOnlyRoots(isolate).undefined_value();
}
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(<API key>) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
<API key>(JSReceiver, object, 0);
DCHECK_EQ(isolate-><API key>(), DebugInfo::kSideEffects);
if (!isolate->debug()-><API key>(object)) {
DCHECK(isolate-><API key>());
return ReadOnlyRoots(isolate).exception();
}
return ReadOnlyRoots(isolate).undefined_value();
}
} // namespace internal
} // namespace v8 |
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Lurchsoft.FileData;
using Lurchsoft.FileData.Lines;
namespace Lurchsoft.ParallelWorkshop.Ex02LineCount
{
public class CountedTextFile : ICountedTextFile
{
private readonly ITextFile textFile;
private int numberOfFileReads;
public CountedTextFile(ITextFile textFile)
{
this.textFile = textFile;
}
public IEnumerable<string> ReadLines()
{
return textFile.ReadLines();
}
public int LineCount
{
get
{
// This is inefficient, if called multiple times.
// How can we ensure that the file is only read once?
// In this example, make sure it is read only a total of once, on all calling threads.
// Try at least the following solutions: -
// - Lazy<T>
// - LazyInitializer<T>
return CountLines();
}
}
public int <API key>
{
get { return numberOfFileReads; }
}
private int CountLines()
{
Interlocked.Increment(ref numberOfFileReads);
return ReadLines().Count();
}
}
} |
<?php
/*
* <auto-generated>
* This code was generated by a Codezu.
*
* Changes to this file may cause incorrect behavior and will be lost if
* the code is regenerated.
* </auto-generated>
*/
namespace Mozu\Api\Urls\Commerce\Settings\General;
use Mozu\Api\MozuUrl;
use Mozu\Api\UrlLocation;
class TaxableTerritoryUrl {
/**
* Get Resource Url for <API key>
* @return string Resource Url
*/
public static function <API key>()
{
$url = "/api/commerce/settings/general/taxableterritories";
$mozuUrl = new MozuUrl($url, UrlLocation::TENANT_POD,"GET", false) ;
return $mozuUrl;
}
/**
* Get Resource Url for AddTaxableTerritory
* @param string $responseFields Use this field to include those fields which are not included by default.
* @return string Resource Url
*/
public static function <API key>($responseFields)
{
$url = "/api/commerce/settings/general/taxableterritories?responseFields={responseFields}";
$mozuUrl = new MozuUrl($url, UrlLocation::TENANT_POD,"POST", false) ;
$url = $mozuUrl->formatUrl("responseFields", $responseFields);
return $mozuUrl;
}
/**
* Get Resource Url for <API key>
* @return string Resource Url
*/
public static function <API key>()
{
$url = "/api/commerce/settings/general/taxableterritories";
$mozuUrl = new MozuUrl($url, UrlLocation::TENANT_POD,"PUT", false) ;
return $mozuUrl;
}
}
?> |
package com.reece.spring.exception;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.<API key>;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.json.<API key>;
public class MyException extends RuntimeException implements <API key>{
private static final long serialVersionUID = <API key>;
private String code;
private String message;
public MyException(){
super();
}
public MyException(String message) {
super();
this.message = message;
}
public MyException(String code, String message) {
super();
this.code = code;
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public ModelAndView resolveException(HttpServletRequest req,
HttpServletResponse res, Object obj,
Exception exception) {
ModelAndView mav = new ModelAndView(new <API key>());
mav.addObject("returnCode", this.code);
mav.addObject("returnMsg", this.message);
return mav;
}
} |
package pro.kornev.kcar.client.base;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* This is template for view. It is exists for copy-paste new view object
* because I can't make base abstract class for view.
*/
public class BaseView extends Composite {
interface ThisUiBinder extends UiBinder<Widget, BaseView> {}
private static ThisUiBinder uiBinder = GWT.create(ThisUiBinder.class);
public BaseView() {
initWidget(uiBinder.createAndBindUi(this));
}
} |
body,
html {
width: 100%;
height: 100%;
}
body,
h4,
h5,
h6,
p {
font-family: 'Open Sans', sans-serif;
font-weight: 700;
}
h1,
h2,
h3 {
font-family: 'Dosis', sans-serif;
}
h3 {
font-size: 3em;
}
a {
color: #565656;
-webkit-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
a:hover {
color: #FFA500;
text-decoration: none;
}
.sublink {
color: #FFA500;
margin-left: 2px;
}
blockquote {
border-left: 10px solid #FFA500;
margin: 1.5em 10px;
padding: 0.5em 10px;
quotes: "\201C""\201D""\2018""\2019";
font-weight: 700;
}
blockquote:before {
color: #FFA500;
content: open-quote;
font-size: 4em;
line-height: 0.1em;
margin-right: 0.25em;
vertical-align: -0.4em;
}
blockquote p {
display: inline;
}
.topnav {
font-size: 2rem;
height: 3em;
}
.lead {
font-size: 18px;
font-weight: 400;
}
.navbar-brand {
border-top: 4px solid #f8f8f8;
}
.navbar-default .navbar-nav > li > a:hover {
border-top: 4px solid #e7e7e7;
background: #f2f2f2;
transition: all 0.5s;
}
.navbar-default .navbar-nav > li > a:active {
border-top: 4px solid #d3d3d3;
background: #e7e7e7;
transition: all 0.5s;
}
.navbar-default .navbar-nav > li > a {
border-top: 4px solid #f8f8f8;
transition: all 0.5s;
}
.navbar-default .navbar-nav > li > a.currentpage {
border-top: 4px solid #FFA500;
transition: all 0.5s;
}
.intro-header {
padding-top: 50px;
/* If you're making other pages, make sure there is 50px of padding to make sure the navbar doesn't overlap content! */
padding-bottom: 50px;
text-align: center;
color: #f8f8f8;
background: url(../img/intro-bg-2.jpg) no-repeat center center;
background-size: cover;
}
.intro-message {
position: relative;
padding-top: 20%;
padding-bottom: 20%;
}
.intro-message > h1 {
margin: 0;
text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.6);
font-size: 3em;
}
.intro-message > .row > h4 {
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
line-height: 1.3em;
}
.intro-divider {
width: 400px;
border-top: 1px solid #f8f8f8;
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}
.intro-message > h3 {
text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.6);
}
@media(max-width:767px) {
.intro-message {
padding-bottom: 15%;
}
.intro-message > h1 {
font-size: 1.5em;
}
ul.<API key> > li {
display: block;
margin-bottom: 20px;
padding: 0;
}
ul.<API key> > li:last-child {
margin-bottom: 0;
}
.intro-divider {
width: 100%;
}
}
.network-name {
text-transform: uppercase;
font-size: 14px;
font-weight: 400;
letter-spacing: 2px;
}
.content-section-a {
padding: 50px 0;
background-color: #f8f8f8;
}
.content-section-b {
padding: 50px 0;
border-top: 1px solid #e7e7e7;
border-bottom: 1px solid #e7e7e7;
}
.section-heading {
margin-bottom: 30px;
}
.<API key> {
float: left;
width: 200px;
border-top: 3px solid #e7e7e7;
}
.banner {
padding: 100px 0;
color: #fff !important;
background: url(../img/intro-bg-2.jpg) no-repeat center center;
background-size: cover;
}
.banner h2 {
margin: 0;
text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.6);
font-size: 3em;
}
.banner ul {
margin-bottom: 0;
}
.<API key> {
float: right;
margin-top: 0;
}
@media(max-width:1199px) {
ul.<API key> {
float: left;
margin-top: 15px;
}
}
@media(max-width:767px) {
.banner h2 {
margin: 0;
text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.6);
font-size: 3em;
}
ul.<API key> > li {
display: block;
margin-bottom: 20px;
padding: 0;
}
ul.<API key> > li:last-child {
margin-bottom: 0;
}
}
footer {
padding: 50px 0;
background-color: #f8f8f8;
}
p.copyright {
margin: 15px 0 0;
}
.<API key> > h2 {
color: white;
}
.btn {
-webkit-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
.btn:hover {
background: #FFA500;
color: white;
border: 1px solid #FFA500;
}
.modal-header {
background: #FFA500;
color: white;
<API key>: 6px !important;
<API key>: 6px !important;
}
.close {
color: white;
opacity: 1;
-webkit-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
.close:hover {
color: white;
opacity: 0.8;
}
.modal-footer {
background-color: #f8f8f8;
} |
package com.et.api.controllers.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.et.api.controllers.<API key>;
@Controller
public class <API key> implements <API key> {
@Override
@RequestMapping(method = RequestMethod.GET, value = "/user")
public @ResponseBody List<String> getUsers() {
List<String> userList = new ArrayList<String>();
userList.add("Arun");
userList.add("John");
userList.add("Jane");
return userList;
}
} |
# Cookbook Name:: nginx_unicorn
# Recipe:: default
[ "nginx", "monit" ].each do |p|
package p do
action :install
end
end
[ "nginx", "monit" ].each do |s|
service s do
action [:start, :enable]
end
cookbook_file "/etc/monit/monitrc" do
source "monitrc"
mode '0440'
owner 'root'
group 'root'
end
end |
/* OTB patches: replace "f2c.h" by "otb_6S_f2c.h" */
/*#include "f2c.h"*/
#include "otb_6S_f2c.h"
#ifdef KR_headers
double sqrt();
double d_sqrt(x) doublereal *x;
#else
#undef abs
#include "math.h"
#ifdef __cplusplus
extern "C" {
#endif
double d_sqrt(doublereal *x)
#endif
{
return( sqrt(*x) );
}
#ifdef __cplusplus
}
#endif |
#!/bin/bash
NOTE: This function will check if the Arch Linux image is present on the disk
function <API key> {
FILE="<API key>.tar.gz"
if [ -f "$FILE" ];
then
echo "File $FILE exist."
else
echo "File $FILE does not exist" >&2
fi
} |
# options
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fpermissive -g")
set(<API key> "${CMAKE_CXX_FLAGS} -L/opt/vc/lib/ -lGLESv2 -lEGL -lbcm_host -lvchiq_arm -lvcos -lrt -lpthread")
set(CXX_FLAGS_DEBUG "-g -O0")
set(EXECUTABLE_NAME "tangram")
add_definitions(-DPLATFORM_RPI)
<API key>()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
# add sources and include headers
<API key>( |
ALTER PROCEDURE [dbo].[mp_Sites_Delete]
@SiteID int
AS
DELETE FROM mp_UserProperties
WHERE UserGuid IN (SELECT UserGuid FROM mp_Users WHERE SiteID = @SiteID)
DELETE FROM mp_UserRoles
WHERE UserID IN (SELECT UserID FROM mp_Users WHERE SiteID = @SiteID)
DELETE FROM mp_UserLocation
WHERE UserGuid IN (SELECT UserGuid FROM mp_Users WHERE SiteID = @SiteID)
DELETE FROM mp_Users WHERE SiteID = @SiteID
DELETE FROM mp_Roles WHERE SiteID = @SiteID
DELETE FROM mp_SiteHosts WHERE SiteID = @SiteID
DELETE FROM mp_SiteSettingsEx WHERE SiteID = @SiteID
DELETE FROM mp_SiteFolders
WHERE SiteGuid IN (SELECT SiteGuid FROM mp_Sites WHERE SiteID = @SiteID)
DELETE FROM mp_RedirectList
WHERE SiteGuid IN (SELECT SiteGuid FROM mp_Sites WHERE SiteID = @SiteID)
DELETE FROM mp_TaskQueue
WHERE SiteGuid IN (SELECT SiteGuid FROM mp_Sites WHERE SiteID = @SiteID)
DELETE FROM [dbo].[mp_Sites]
WHERE
[SiteID] = @SiteID
GO
CREATE PROCEDURE [dbo].[<API key>]
@FolderName nvarchar(255)
AS
SELECT *
FROM
[dbo].[mp_SiteFolders]
WHERE
[FolderName] = @FolderName
GO
CREATE PROCEDURE [dbo].[<API key>]
@HostName nvarchar(255)
AS
SELECT *
FROM
[dbo].[mp_SiteHosts]
WHERE
[HostName] = @HostName
GO
CREATE PROCEDURE [dbo].[<API key>]
@Query nvarchar(255),
@RowsToGet int
AS
SET ROWCOUNT @RowsToGet
SELECT *
FROM [dbo].mp_GeoCountry
WHERE (
([Name] LIKE @Query + '%')
OR ([ISOCode2] LIKE @Query + '%')
)
ORDER BY [ISOCode2]
GO
CREATE PROCEDURE [dbo].[<API key>]
@CountryGuid uniqueidentifier,
@Query nvarchar(255),
@RowsToGet int
AS
SET ROWCOUNT @RowsToGet
SELECT *
FROM [dbo].mp_GeoZone
WHERE CountryGuid = @CountryGuid
AND (
([Name] LIKE @Query + '%')
OR ([Code] LIKE @Query + '%')
)
ORDER BY [Code]
GO |
import "./SvgIcon.css";
import { ReactNode } from "react";
interface Props {
children?: ReactNode;
className?: string;
title?: string;
}
export function SvgIcon({ children, className, title }: Props) {
return <div className={"svg-icon" + (className ? ' ' + className : '')} title={title}>
<div>{children}</div>
</div>;
} |
using System.Collections.Immutable;
using Microsoft.IdentityModel.Tokens;
namespace OpenIddict.Client;
public static partial class <API key>
{
public static class Discovery
{
public static ImmutableArray<<API key>> DefaultHandlers { get; } = ImmutableArray.Create(
/*
* Configuration response handling:
*/
HandleErrorResponse<<API key>>.Descriptor,
ValidateIssuer.Descriptor,
Extract<API key>.Descriptor,
<API key>.Descriptor,
<API key>.Descriptor,
<API key>.Descriptor,
ExtractGrantTypes.Descriptor,
<API key>.Descriptor,
<API key>.Descriptor,
<API key>.Descriptor,
ExtractScopes.Descriptor,
<API key>.Descriptor,
Extract<API key>.Descriptor,
/*
* Cryptography response handling:
*/
HandleErrorResponse<<API key>>.Descriptor,
ExtractSigningKeys.Descriptor);
<summary>
Contains the logic responsible of extracting the issuer from the discovery document.
</summary>
public class ValidateIssuer : <API key><<API key>>
{
<summary>
Gets the default descriptor definition assigned to this handler.
</summary>
public static <API key> Descriptor { get; }
= <API key>.CreateBuilder<<API key>>()
.UseSingletonHandler<ValidateIssuer>()
.SetOrder(HandleErrorResponse<<API key>>.Descriptor.Order + 1_000)
.SetType(<API key>.BuiltIn)
.Build();
<inheritdoc/>
public ValueTask HandleAsync(<API key> context)
{
if (context is null)
{
throw new <API key>(nameof(context));
}
// The issuer returned in the discovery document must exactly match the URL used to access it.
// See https://openid.net/specs/<API key>.html#<API key>.
var issuer = (string?) context.Response[Metadata.Issuer];
if (string.IsNullOrEmpty(issuer))
{
context.Reject(
error: Errors.ServerError,
description: SR.GetResourceString(SR.ID2096),
uri: SR.FormatID8000(SR.ID2096));
return default;
}
if (!Uri.TryCreate(issuer, UriKind.Absolute, out Uri? address))
{
context.Reject(
error: Errors.ServerError,
description: SR.GetResourceString(SR.ID2097),
uri: SR.FormatID8000(SR.ID2097));
return default;
}
context.Configuration.Issuer = address;
return default;
}
}
<summary>
Contains the logic responsible of extracting the authorization endpoint address from the discovery document.
</summary>
public class Extract<API key> : <API key><<API key>>
{
<summary>
Gets the default descriptor definition assigned to this handler.
</summary>
public static <API key> Descriptor { get; }
= <API key>.CreateBuilder<<API key>>()
.UseSingletonHandler<Extract<API key>>()
.SetOrder(ValidateIssuer.Descriptor.Order + 1_000)
.SetType(<API key>.BuiltIn)
.Build();
<inheritdoc/>
public ValueTask HandleAsync(<API key> context)
{
if (context is null)
{
throw new <API key>(nameof(context));
}
// Note: the <API key> node is required by the OpenID Connect discovery specification
// but is optional in the OAuth 2.0 authorization server metadata specification. To make OpenIddict
// compatible with the newer OAuth 2.0 specification, null/empty and missing values are allowed here.
// Handlers that require a non-null authorization endpoint URL are expected to return an error
// if the authorization endpoint URL couldn't be resolved from the authorization server metadata.
// See https://openid.net/specs/<API key>.html#<API key>
// and https://datatracker.ietf.org/doc/html/rfc8414#section-2 for more information.
var address = (string?) context.Response[Metadata.<API key>];
if (!string.IsNullOrEmpty(address))
{
if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.<API key>())
{
context.Reject(
error: Errors.ServerError,
description: SR.FormatID2100(Metadata.<API key>),
uri: SR.FormatID8000(SR.ID2100));
return default;
}
context.Configuration.<API key> = uri;
}
return default;
}
}
<summary>
Contains the logic responsible of extracting the JWKS endpoint address from the discovery document.
</summary>
public class <API key> : <API key><<API key>>
{
<summary>
Gets the default descriptor definition assigned to this handler.
</summary>
public static <API key> Descriptor { get; }
= <API key>.CreateBuilder<<API key>>()
.UseSingletonHandler<<API key>>()
.SetOrder(Extract<API key>.Descriptor.Order + 1_000)
.SetType(<API key>.BuiltIn)
.Build();
<inheritdoc/>
public ValueTask HandleAsync(<API key> context)
{
if (context is null)
{
throw new <API key>(nameof(context));
}
// Note: the jwks_uri node is required by the OpenID Connect discovery specification.
// See https://openid.net/specs/<API key>.html#<API key>.
var address = (string?) context.Response[Metadata.JwksUri];
if (string.IsNullOrEmpty(address))
{
context.Reject(
error: Errors.ServerError,
description: SR.GetResourceString(SR.ID2099),
uri: SR.FormatID8000(SR.ID2099));
return default;
}
if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.<API key>())
{
context.Reject(
error: Errors.ServerError,
description: SR.FormatID2100(Metadata.JwksUri),
uri: SR.FormatID8000(SR.ID2100));
return default;
}
context.Configuration.JwksUri = uri;
return default;
}
}
<summary>
Contains the logic responsible of extracting the token endpoint address from the discovery document.
</summary>
public class <API key> : <API key><<API key>>
{
<summary>
Gets the default descriptor definition assigned to this handler.
</summary>
public static <API key> Descriptor { get; }
= <API key>.CreateBuilder<<API key>>()
.UseSingletonHandler<<API key>>()
.SetOrder(<API key>.Descriptor.Order + 1_000)
.SetType(<API key>.BuiltIn)
.Build();
<inheritdoc/>
public ValueTask HandleAsync(<API key> context)
{
if (context is null)
{
throw new <API key>(nameof(context));
}
var address = (string?) context.Response[Metadata.TokenEndpoint];
if (!string.IsNullOrEmpty(address))
{
if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.<API key>())
{
context.Reject(
error: Errors.ServerError,
description: SR.FormatID2100(Metadata.TokenEndpoint),
uri: SR.FormatID8000(SR.ID2100));
return default;
}
context.Configuration.TokenEndpoint = uri;
}
return default;
}
}
<summary>
Contains the logic responsible of extracting the userinfo endpoint address from the discovery document.
</summary>
public class <API key> : <API key><<API key>>
{
<summary>
Gets the default descriptor definition assigned to this handler.
</summary>
public static <API key> Descriptor { get; }
= <API key>.CreateBuilder<<API key>>()
.UseSingletonHandler<<API key>>()
.SetOrder(<API key>.Descriptor.Order + 1_000)
.SetType(<API key>.BuiltIn)
.Build();
<inheritdoc/>
public ValueTask HandleAsync(<API key> context)
{
if (context is null)
{
throw new <API key>(nameof(context));
}
var address = (string?) context.Response[Metadata.UserinfoEndpoint];
if (!string.IsNullOrEmpty(address))
{
if (!Uri.TryCreate(address, UriKind.Absolute, out Uri? uri) || !uri.<API key>())
{
context.Reject(
error: Errors.ServerError,
description: SR.FormatID2100(Metadata.UserinfoEndpoint),
uri: SR.FormatID8000(SR.ID2100));
return default;
}
context.Configuration.UserinfoEndpoint = uri;
}
return default;
}
}
<summary>
Contains the logic responsible of extracting the supported grant types from the discovery document.
</summary>
public class ExtractGrantTypes : <API key><<API key>>
{
<summary>
Gets the default descriptor definition assigned to this handler.
</summary>
public static <API key> Descriptor { get; }
= <API key>.CreateBuilder<<API key>>()
.UseSingletonHandler<ExtractGrantTypes>()
.SetOrder(Extract<API key>.Descriptor.Order + 1_000)
.SetType(<API key>.BuiltIn)
.Build();
<inheritdoc/>
public ValueTask HandleAsync(<API key> context)
{
if (context is null)
{
throw new <API key>(nameof(context));
}
// Resolve the grant types supported by the authorization endpoint, if available.
var types = context.Response[Metadata.GrantTypesSupported]?.<API key>();
if (types is { Count: > 0 })
{
for (var index = 0; index < types.Count; index++)
{
// Note: custom values are allowed in this case.
var type = (string?) types[index];
if (!string.IsNullOrEmpty(type))
{
context.Configuration.GrantTypesSupported.Add(type);
}
}
}
return default;
}
}
<summary>
Contains the logic responsible of extracting the supported response types from the discovery document.
</summary>
public class <API key> : <API key><<API key>>
{
<summary>
Gets the default descriptor definition assigned to this handler.
</summary>
public static <API key> Descriptor { get; }
= <API key>.CreateBuilder<<API key>>()
.UseSingletonHandler<<API key>>()
.SetOrder(Extract<API key>.Descriptor.Order + 1_000)
.SetType(<API key>.BuiltIn)
.Build();
<inheritdoc/>
public ValueTask HandleAsync(<API key> context)
{
if (context is null)
{
throw new <API key>(nameof(context));
}
// Resolve the response modes supported by the authorization endpoint, if available.
var modes = context.Response[Metadata.<API key>]?.<API key>();
if (modes is { Count: > 0 })
{
for (var index = 0; index < modes.Count; index++)
{
// Note: custom values are allowed in this case.
var mode = (string?) modes[index];
if (!string.IsNullOrEmpty(mode))
{
context.Configuration.<API key>.Add(mode);
}
}
}
return default;
}
}
<summary>
Contains the logic responsible of extracting the supported response types from the discovery document.
</summary>
public class <API key> : <API key><<API key>>
{
<summary>
Gets the default descriptor definition assigned to this handler.
</summary>
public static <API key> Descriptor { get; }
= <API key>.CreateBuilder<<API key>>()
.UseSingletonHandler<<API key>>()
.SetOrder(<API key>.Descriptor.Order + 1_000)
.SetType(<API key>.BuiltIn)
.Build();
<inheritdoc/>
public ValueTask HandleAsync(<API key> context)
{
if (context is null)
{
throw new <API key>(nameof(context));
}
// Resolve the response types supported by the authorization endpoint, if available.
var types = context.Response[Metadata.<API key>]?.<API key>();
if (types is { Count: > 0 })
{
for (var index = 0; index < types.Count; index++)
{
// Note: custom values are allowed in this case.
var type = (string?) types[index];
if (!string.IsNullOrEmpty(type))
{
context.Configuration.<API key>.Add(type);
}
}
}
return default;
}
}
<summary>
Contains the logic responsible of extracting the supported code challenge methods from the discovery document.
</summary>
public class <API key> : <API key><<API key>>
{
<summary>
Gets the default descriptor definition assigned to this handler.
</summary>
public static <API key> Descriptor { get; }
= <API key>.CreateBuilder<<API key>>()
.UseSingletonHandler<<API key>>()
.SetOrder(<API key>.Descriptor.Order + 1_000)
.SetType(<API key>.BuiltIn)
.Build();
<inheritdoc/>
public ValueTask HandleAsync(<API key> context)
{
if (context is null)
{
throw new <API key>(nameof(context));
}
// Resolve the code challenge methods supported by the authorization endpoint, if available.
var methods = context.Response[Metadata.<API key>]?.<API key>();
if (methods is { Count: > 0 })
{
for (var index = 0; index < methods.Count; index++)
{
// Note: custom values are allowed in this case.
var method = (string?) methods[index];
if (!string.IsNullOrEmpty(method))
{
context.Configuration.<API key>.Add(method);
}
}
}
return default;
}
}
<summary>
Contains the logic responsible of extracting the supported scopes from the discovery document.
</summary>
public class ExtractScopes : <API key><<API key>>
{
<summary>
Gets the default descriptor definition assigned to this handler.
</summary>
public static <API key> Descriptor { get; }
= <API key>.CreateBuilder<<API key>>()
.UseSingletonHandler<ExtractScopes>()
.SetOrder(<API key>.Descriptor.Order + 1_000)
.SetType(<API key>.BuiltIn)
.Build();
<inheritdoc/>
public ValueTask HandleAsync(<API key> context)
{
if (context is null)
{
throw new <API key>(nameof(context));
}
// Resolve the scopes supported by the remote server, if available.
var scopes = context.Response[Metadata.ScopesSupported]?.<API key>();
if (scopes is { Count: > 0 })
{
for (var index = 0; index < scopes.Count; index++)
{
// Note: custom values are allowed in this case.
var scope = (string?) scopes[index];
if (!string.IsNullOrEmpty(scope))
{
context.Configuration.ScopesSupported.Add(scope);
}
}
}
return default;
}
}
<summary>
Contains the logic responsible of extracting the flag indicating
whether the "iss" parameter is supported from the discovery document.
</summary>
public class <API key> : <API key><<API key>>
{
<summary>
Gets the default descriptor definition assigned to this handler.
</summary>
public static <API key> Descriptor { get; }
= <API key>.CreateBuilder<<API key>>()
.UseSingletonHandler<<API key>>()
.SetOrder(ExtractScopes.Descriptor.Order + 1_000)
.SetType(<API key>.BuiltIn)
.Build();
<inheritdoc/>
public ValueTask HandleAsync(<API key> context)
{
if (context is null)
{
throw new <API key>(nameof(context));
}
context.Configuration.<API key> = (bool?)
context.Response[Metadata.<API key>];
return default;
}
}
<summary>
Contains the logic responsible of extracting the authentication methods
supported by the token endpoint from the discovery document.
</summary>
public class Extract<API key> : <API key><<API key>>
{
<summary>
Gets the default descriptor definition assigned to this handler.
</summary>
public static <API key> Descriptor { get; }
= <API key>.CreateBuilder<<API key>>()
.UseSingletonHandler<<API key>>()
.SetOrder(<API key>.Descriptor.Order + 1_000)
.SetType(<API key>.BuiltIn)
.Build();
<inheritdoc/>
public ValueTask HandleAsync(<API key> context)
{
if (context is null)
{
throw new <API key>(nameof(context));
}
// Resolve the client authentication methods supported by the token endpoint, if available.
var methods = context.Response[Metadata.<API key>]?.<API key>();
if (methods is { Count: > 0 })
{
for (var index = 0; index < methods.Count; index++)
{
// Note: custom values are allowed in this case.
var method = (string?) methods[index];
if (!string.IsNullOrEmpty(method))
{
context.Configuration.<API key>.Add(method);
}
}
}
return default;
}
}
<summary>
Contains the logic responsible of extracting the signing keys from the JWKS document.
</summary>
public class ExtractSigningKeys : <API key><<API key>>
{
<summary>
Gets the default descriptor definition assigned to this handler.
</summary>
public static <API key> Descriptor { get; }
= <API key>.CreateBuilder<<API key>>()
.UseSingletonHandler<ExtractSigningKeys>()
.SetOrder(HandleErrorResponse<<API key>>.Descriptor.Order + 1_000)
.SetType(<API key>.BuiltIn)
.Build();
<inheritdoc/>
public ValueTask HandleAsync(<API key> context)
{
if (context is null)
{
throw new <API key>(nameof(context));
}
var keys = context.Response[<API key>.Keys]?.<API key>();
if (keys is not { Count: > 0 })
{
context.Reject(
error: Errors.ServerError,
description: SR.FormatID2102(<API key>.Keys),
uri: SR.FormatID8000(SR.ID2102));
return default;
}
for (var index = 0; index < keys.Count; index++)
{
// Note: the "use" parameter is defined as optional by the specification.
// To prevent key swapping attacks, OpenIddict requires that this parameter
// be present and will ignore keys that don't include a "use" parameter.
var use = (string?) keys[index][<API key>.Use];
if (string.IsNullOrEmpty(use))
{
continue;
}
// Ignore security keys that are not used for signing.
if (!string.Equals(use, JsonWebKeyUseNames.Sig, StringComparison.Ordinal))
{
continue;
}
var key = (string?) keys[index][<API key>.Kty] switch
{
<API key>.RSA => new JsonWebKey
{
Kty = <API key>.RSA,
E = (string?) keys[index][<API key>.E],
N = (string?) keys[index][<API key>.N]
},
<API key>.EllipticCurve => new JsonWebKey
{
Kty = <API key>.EllipticCurve,
Crv = (string?) keys[index][<API key>.Crv],
X = (string?) keys[index][<API key>.X],
Y = (string?) keys[index][<API key>.Y]
},
_ => null
};
if (key is null)
{
context.Reject(
error: Errors.ServerError,
description: SR.GetResourceString(SR.ID2103),
uri: SR.FormatID8000(SR.ID2103));
return default;
}
// If the key is a RSA key, ensure the mandatory parameters are all present.
if (string.Equals(key.Kty, <API key>.RSA, StringComparison.Ordinal) &&
(string.IsNullOrEmpty(key.E) || string.IsNullOrEmpty(key.N)))
{
context.Reject(
error: Errors.ServerError,
description: SR.GetResourceString(SR.ID2104),
uri: SR.FormatID8000(SR.ID2104));
return default;
}
// If the key is an EC key, ensure the mandatory parameters are all present.
if (string.Equals(key.Kty, <API key>.EllipticCurve, StringComparison.Ordinal) &&
(string.IsNullOrEmpty(key.Crv) || string.IsNullOrEmpty(key.X) || string.IsNullOrEmpty(key.Y)))
{
context.Reject(
error: Errors.ServerError,
description: SR.GetResourceString(SR.ID2104),
uri: SR.FormatID8000(SR.ID2104));
return default;
}
key.KeyId = (string?) keys[index][<API key>.Kid];
key.X5t = (string?) keys[index][<API key>.X5t];
key.X5tS256 = (string?) keys[index][<API key>.X5tS256];
if (keys[index].<API key>(<API key>.X5c, out var chain))
{
foreach (string? certificate in chain.<API key>())
{
if (string.IsNullOrEmpty(certificate))
{
continue;
}
key.X5c.Add(certificate);
}
}
context.SecurityKeys.Keys.Add(key);
}
return default;
}
}
}
} |
package ODEsolver.interpreter;
// Written 2002 by Juergen Arndt.
// File Fac9.java
// Use semantische funktion fuer anfang des Tangens
class Fac9 implements SemFuncPointer
{
public int exec (double a)
{
return 1;
}
public int exec (String str)
{
return 1;
}
public int exec ()
{
Node TangensNode = new Node();
Node MaxTopNode;
Node K;
TangensNode.SetInfoString ("Tangens-anfang");
TangensNode.SetRang (tan);
MaxTopNode = (Node)stack.peek();
K = TangensNode.DiveToAttachPoint (MaxTopNode);
TangensNode.AttachToTree (K);
stack.push (TangensNode);
return 1;
}
} |
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_02) on Thu Sep 01 16:38:10 CEST 2005 -->
<TITLE>
<API key>
</TITLE>
<META NAME="keywords" CONTENT="net.sf.j2ep.servers.<API key> class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="<API key>";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../net/sf/j2ep/servers/<API key>.html" title="class in net.sf.j2ep.servers"><B>PREV CLASS</B></A>
<A HREF="../../../../net/sf/j2ep/servers/RoundRobinCluster.html" title="class in net.sf.j2ep.servers"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?net/sf/j2ep/servers/<API key>.html" target="_top"><B>FRAMES</B></A>
<A HREF="<API key>.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<H2>
<FONT SIZE="-1">
net.sf.j2ep.servers</FONT>
<BR>
Class <API key></H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><API key>
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>net.sf.j2ep.servers.<API key></B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B><API key></B><DT>extends <API key></DL>
</PRE>
<P>
A wrapper that will make sure sessions are rewritten so
that the server can be derived from the session.
<P>
<P>
<DL>
<DT><B>Author:</B></DT>
<DD>Anders Nyman</DD>
</DL>
<HR>
<P>
<A NAME="constructor_summary"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../net/sf/j2ep/servers/<API key>.html#<API key>(HttpServletResponse, java.lang.String)"><API key></A></B>(HttpServletResponse response,
java.lang.String serverId)</CODE>
<BR>
Basic constructor, will set the id that we should add to add
the sessions to make sure that the session is tracked to a specific
server.</TD>
</TR>
</TABLE>
<A NAME="method_summary"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sf/j2ep/servers/<API key>.html#addHeader(java.lang.String, java.lang.String)">addHeader</A></B>(java.lang.String name,
java.lang.String originalValue)</CODE>
<BR>
Checks for the set-cookie header.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sf/j2ep/servers/<API key>.html#setHeader(java.lang.String, java.lang.String)">setHeader</A></B>(java.lang.String name,
java.lang.String originalValue)</CODE>
<BR>
Checks for the set-cookie header.</TD>
</TR>
</TABLE>
<A NAME="<API key>.lang.Object"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="<API key>">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<A NAME="constructor_detail"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="<API key>(HttpServletResponse, java.lang.String)"></A><H3>
<API key></H3>
<PRE>
public <B><API key></B>(HttpServletResponse response,
java.lang.String serverId)</PRE>
<DL>
<DD>Basic constructor, will set the id that we should add to add
the sessions to make sure that the session is tracked to a specific
server.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>response</CODE> - The response we wrapp<DD><CODE>serverId</CODE> - The id of the server</DL>
</DL>
<A NAME="method_detail"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="addHeader(java.lang.String, java.lang.String)"></A><H3>
addHeader</H3>
<PRE>
public void <B>addHeader</B>(java.lang.String name,
java.lang.String originalValue)</PRE>
<DL>
<DD>Checks for the set-cookie header. This header will have to be
rewritten (if it is marking a session)
<P>
<DD><DL>
<DT><B>See Also:</B><DD><CODE>javax.servlet.http.HttpServletResponse#addHeader(java.lang.String, java.lang.String)</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="setHeader(java.lang.String, java.lang.String)"></A><H3>
setHeader</H3>
<PRE>
public void <B>setHeader</B>(java.lang.String name,
java.lang.String originalValue)</PRE>
<DL>
<DD>Checks for the set-cookie header. This header will have to be
rewritten (if it is marking a session)
<P>
<DD><DL>
<DT><B>See Also:</B><DD><CODE>javax.servlet.http.HttpServletResponse#setHeader(java.lang.String, java.lang.String)</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../net/sf/j2ep/servers/<API key>.html" title="class in net.sf.j2ep.servers"><B>PREV CLASS</B></A>
<A HREF="../../../../net/sf/j2ep/servers/RoundRobinCluster.html" title="class in net.sf.j2ep.servers"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?net/sf/j2ep/servers/<API key>.html" target="_top"><B>FRAMES</B></A>
<A HREF="<API key>.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
</BODY>
</HTML> |
package org.jetbrains.kotlin.idea.actions;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.<API key>;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TestMetadata;
import org.jetbrains.kotlin.test.TestRoot;
import org.junit.runner.RunWith;
/**
* This class is generated by {@link org.jetbrains.kotlin.testGenerator.generator.TestGenerator}.
* DO NOT MODIFY MANUALLY.
*/
@SuppressWarnings("all")
@TestRoot("idea/tests")
@TestDataPath("$CONTENT_ROOT")
@RunWith(<API key>.class)
@TestMetadata("testData/navigation/gotoTestOrCode")
public class <API key> extends <API key> {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("fromJavaClassToTest.main.java")
public void <API key>() throws Exception {
runTest("testData/navigation/gotoTestOrCode/fromJavaClassToTest.main.java");
}
@TestMetadata("<API key>.main.java")
public void <API key>() throws Exception {
runTest("testData/navigation/gotoTestOrCode/<API key>.main.java");
}
@TestMetadata("<API key>.main.java")
public void <API key>() throws Exception {
runTest("testData/navigation/gotoTestOrCode/<API key>.main.java");
}
@TestMetadata("<API key>.main.kt")
public void <API key>() throws Exception {
runTest("testData/navigation/gotoTestOrCode/<API key>.main.kt");
}
@TestMetadata("<API key>.main.kt")
public void <API key>() throws Exception {
runTest("testData/navigation/gotoTestOrCode/<API key>.main.kt");
}
@TestMetadata("<API key>.main.kt")
public void <API key>() throws Exception {
runTest("testData/navigation/gotoTestOrCode/<API key>.main.kt");
}
@TestMetadata("<API key>.main.kt")
public void <API key>() throws Exception {
runTest("testData/navigation/gotoTestOrCode/<API key>.main.kt");
}
@TestMetadata("<API key>.main.kt")
public void <API key>() throws Exception {
runTest("testData/navigation/gotoTestOrCode/<API key>.main.kt");
}
} |
layout: post
title: Scalar - The Alliance for Networking Visual Culture
date: '2013-03-31T22:36:59-04:00'
tags:
- digital
- academics
redirect_from: /post/46814883822/<API key>/
redirect_to: http://fieldnoise.com/03-31-2013/<API key>/ |
package com.camunda.consulting.gregXMLCalendarJson;
import java.util.logging.Logger;
import javax.inject.Named;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
/**
* This is an empty service implementation illustrating how to use a plain Java
* class as a BPMN 2.0 Service Task delegate.
*/
@Named("logger")
public class LoggerDelegate implements JavaDelegate {
private final Logger LOGGER = Logger.getLogger(LoggerDelegate.class.getName());
public void execute(DelegateExecution execution) throws Exception {
LOGGER.info("\n\n ... LoggerDelegate invoked by "
+ "processDefinitionId=" + execution.<API key>()
+ ", activtyId=" + execution.<API key>()
+ ", activtyName='" + execution.<API key>() + "'"
+ ", processInstanceId=" + execution.<API key>()
+ ", businessKey=" + execution.<API key>()
+ ", executionId=" + execution.getId()
+ " \n\n");
}
} |
package com.wjx.coolweather.db;
import org.litepal.crud.DataSupport;
public class City extends DataSupport {
private int id;
private String cityName;
private int cityCode;
private int provinceId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public int getCityCode() {
return cityCode;
}
public void setCityCode(int cityCode) {
this.cityCode = cityCode;
}
public int getProvinceId() {
return provinceId;
}
public void setProvinceId(int provinceId) {
this.provinceId = provinceId;
}
} |
#ifndef CONST
#define CONST
#include <cmath>
inline double max(double a, double b){ if (a > b) return a; else return b;}
const int NZ = 100; // Z dimension
const int a = 3;
const int NX = NZ*a;
const int NMAX = 50; // Resolution for FFT
const double DT = 1; // DTemperature
const double DZ = 1.0/(NZ-1); // Vertical step
const double DX = 1.0/(NX-1); // Vertical step
const double OODZ_2 = 1.0/(DZ*DZ);
const double PI = 4.0*atan(1);
const double c = PI/a;
#endif |
package channelserver
import (
"context"
"encoding/json"
"os"
"os/exec"
"strconv"
"strings"
"time"
"github.com/rancher/rancher/pkg/catalog/utils"
"github.com/rancher/rancher/pkg/settings"
"github.com/rancher/wrangler/pkg/data"
"github.com/sirupsen/logrus"
"k8s.io/client-go/util/flowcontrol"
)
var (
prog = "channelserver"
channelserverCmd *exec.Cmd
backoff = flowcontrol.NewBackOff(5*time.Second, 15*time.Minute)
)
func GetURLAndInterval() (string, string) {
val := map[string]interface{}{}
if err := json.Unmarshal([]byte(settings.RkeMetadataConfig.Get()), &val); err != nil {
logrus.Errorf("failed to parse %s value: %v", settings.RkeMetadataConfig.Name, err)
return "", ""
}
url := data.Object(val).String("url")
minutes, _ := strconv.Atoi(data.Object(val).String("<API key>"))
if minutes <= 0 {
minutes = 1440
}
return url, (time.Duration(minutes) * time.Minute).String()
}
func run() chan error {
done := make(chan error, 1)
go func() {
defer close(done)
url, interval := GetURLAndInterval()
cmd := exec.Command(
prog,
"--config-key=k3s",
"--url", url,
"--url=/var/lib/rancher-data/driver-metadata/data.json",
"--refresh-interval", interval,
"--listen-address=0.0.0.0:8115",
"--<API key>", getChannelServerArg(),
getChannelServerArg())
channelserverCmd = cmd
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
done <- cmd.Run()
}()
return done
}
func Start(ctx context.Context) error {
if _, err := exec.LookPath(prog); err != nil {
logrus.Errorf("Failed to find %s, will not run /v1-release API: %v", prog, err)
return nil
}
for {
select {
case <-ctx.Done():
if err := Shutdown(); err != nil {
logrus.Errorf("error terminating channelserver: %v", err)
}
return ctx.Err()
case err := <-run():
logrus.Infof("failed to run channelserver: %v", err)
}
backoff.Next("next", time.Now())
select {
case <-time.After(backoff.Get("next")):
case <-ctx.Done():
return ctx.Err()
}
}
}
// getChannelServerArg will return with an argument to pass to channel server
// to indicate the server version that is running. If the current version is
// not a proper release version, the argument will be empty.
func getChannelServerArg() string {
serverVersion := settings.ServerVersion.Get()
if !utils.<API key>(serverVersion) {
return ""
}
return serverVersion
}
// Shutdown ends the channelserver process and resets backoff
func Shutdown() error {
backoff.Reset("next")
if channelserverCmd == nil {
return nil
}
if err := channelserverCmd.Process.Kill(); err != nil {
if !strings.Contains(err.Error(), "process already finished") {
return err
}
}
channelserverCmd = nil
return nil
} |
<html>
<body>
<footer class="w3-container w3-padding-64 w3-center w3-opacity">
<div class="w3-xlarge w3-padding-32">
<i class="fa <API key> w3-hover-opacity"></i>
<i class="fa fa-instagram w3-hover-opacity"></i>
<i class="fa fa-snapchat w3-hover-opacity"></i>
<i class="fa fa-pinterest-p w3-hover-opacity"></i>
<i class="fa fa-<TwitterConsumerkey>"></i>
<i class="fa fa-linkedin w3-hover-opacity"></i>
</div>
<p>Powered by <a href="https:
</footer>
<script>
// Used to toggle the menu on small screens when clicking on the menu button
function myFunction() {
var x = document.getElementById("navDemo");
if (x.className.indexOf("w3-show") == -1) {
x.className += " w3-show";
} else {
x.className = x.className.replace(" w3-show", "");
}
}
</script>
</body>
</html> |
from __future__ import unicode_literals
import logging
import hashlib
from mopidy.backends import base
from mopidy.models import Artist, Album, Track, SearchResult
logger = logging.getLogger('mopidy.backends.gmusic')
class <API key>(base.BaseLibraryProvider):
def find_exact(self, query=None, uris=None):
if query is None:
query = {}
self._validate_query(query)
result_tracks = self.tracks.values()
for (field, values) in query.iteritems():
if not hasattr(values, '__iter__'):
values = [values]
# FIXME this is bound to be slow for large libraries
for value in values:
if field == 'track_no':
q = self._convert_to_int(value)
else:
q = value.strip()
uri_filter = lambda t: q == t.uri
track_name_filter = lambda t: q == t.name
album_filter = lambda t: q == getattr(t, 'album', Album()).name
artist_filter = lambda t: filter(
lambda a: q == a.name, t.artists) or filter(
lambda a: q == a.name, getattr(t, 'album',
Album()).artists)
albumartist_filter = lambda t: any([
q == a.name
for a in getattr(t.album, 'artists', [])])
track_no_filter = lambda t: q == t.track_no
date_filter = lambda t: q == t.date
any_filter = lambda t: (
uri_filter(t) or
track_name_filter(t) or
album_filter(t) or
artist_filter(t) or
albumartist_filter(t) or
date_filter(t))
if field == 'uri':
result_tracks = filter(uri_filter, result_tracks)
elif field == 'track_name':
result_tracks = filter(track_name_filter, result_tracks)
elif field == 'album':
result_tracks = filter(album_filter, result_tracks)
elif field == 'artist':
result_tracks = filter(artist_filter, result_tracks)
elif field == 'albumartist':
result_tracks = filter(albumartist_filter, result_tracks)
elif field == 'track_no':
result_tracks = filter(track_no_filter, result_tracks)
elif field == 'date':
result_tracks = filter(date_filter, result_tracks)
elif field == 'any':
result_tracks = filter(any_filter, result_tracks)
else:
raise LookupError('Invalid lookup field: %s' % field)
return SearchResult(uri='gmusic:search', tracks=result_tracks)
def lookup(self, uri):
if uri.startswith('gmusic:track:'):
return self._lookup_track(uri)
elif uri.startswith('gmusic:album:'):
return self._lookup_album(uri)
elif uri.startswith('gmusic:artist:'):
return self._lookup_artist(uri)
else:
return []
def _lookup_track(self, uri):
if uri.startswith('gmusic:track:T'):
song = self.backend.session.get_track_info(uri.split(':')[2])
if song is None:
return []
return [self._aa_to_mopidy_track(song)]
try:
return [self.tracks[uri]]
except KeyError:
logger.debug('Failed to lookup %r', uri)
return []
def _lookup_album(self, uri):
try:
album = self.albums[uri]
except KeyError:
logger.debug('Failed to lookup %r', uri)
return []
tracks = self.find_exact(
dict(album=album.name,
artist=[artist.name for artist in album.artists],
date=album.date)).tracks
return sorted(tracks, key=lambda t: (t.disc_no,
t.track_no))
def _lookup_artist(self, uri):
try:
artist = self.artists[uri]
except KeyError:
logger.debug('Failed to lookup %r', uri)
return []
tracks = self.find_exact(
dict(artist=artist.name)).tracks
return sorted(tracks, key=lambda t: (t.album.date,
t.album.name,
t.disc_no,
t.track_no))
def refresh(self, uri=None):
self.tracks = {}
self.albums = {}
self.artists = {}
for song in self.backend.session.get_all_songs():
self._to_mopidy_track(song)
def search(self, query=None, uris=None):
if query is None:
query = {}
self._validate_query(query)
result_tracks = self.tracks.values()
for (field, values) in query.iteritems():
if not hasattr(values, '__iter__'):
values = [values]
# FIXME this is bound to be slow for large libraries
for value in values:
if field == 'track_no':
q = self._convert_to_int(value)
else:
q = value.strip().lower()
uri_filter = lambda t: q in t.uri.lower()
track_name_filter = lambda t: q in t.name.lower()
album_filter = lambda t: q in getattr(
t, 'album', Album()).name.lower()
artist_filter = lambda t: filter(
lambda a: q in a.name.lower(), t.artists) or filter(
lambda a: q in a.name, getattr(t, 'album',
Album()).artists)
albumartist_filter = lambda t: any([
q in a.name.lower()
for a in getattr(t.album, 'artists', [])])
track_no_filter = lambda t: q == t.track_no
date_filter = lambda t: t.date and t.date.startswith(q)
any_filter = lambda t: (
uri_filter(t) or
track_name_filter(t) or
album_filter(t) or
artist_filter(t) or
albumartist_filter(t) or
date_filter(t))
if field == 'uri':
result_tracks = filter(uri_filter, result_tracks)
elif field == 'track_name':
result_tracks = filter(track_name_filter, result_tracks)
elif field == 'album':
result_tracks = filter(album_filter, result_tracks)
elif field == 'artist':
result_tracks = filter(artist_filter, result_tracks)
elif field == 'albumartist':
result_tracks = filter(albumartist_filter, result_tracks)
elif field == 'track_no':
result_tracks = filter(track_no_filter, result_tracks)
elif field == 'date':
result_tracks = filter(date_filter, result_tracks)
elif field == 'any':
result_tracks = filter(any_filter, result_tracks)
else:
raise LookupError('Invalid lookup field: %s' % field)
result_artists = set()
result_albums = set()
for track in result_tracks:
result_artists |= track.artists
result_albums.add(track.album)
return SearchResult(uri='gmusic:search',
tracks=result_tracks,
artists=result_artists,
albums=result_albums)
def _validate_query(self, query):
for (_, values) in query.iteritems():
if not values:
raise LookupError('Missing query')
for value in values:
if not value:
raise LookupError('Missing query')
def _to_mopidy_track(self, song):
uri = 'gmusic:track:' + song['id']
track = Track(
uri=uri,
name=song['title'],
artists=[self._to_mopidy_artist(song)],
album=self._to_mopidy_album(song),
track_no=song.get('trackNumber', 1),
disc_no=song.get('discNumber', 1),
date=unicode(song.get('year', 0)),
length=int(song['durationMillis']),
bitrate=320)
self.tracks[uri] = track
return track
def _to_mopidy_album(self, song):
name = song['album']
artist = self.<API key>(song)
date = unicode(song.get('year', 0))
uri = 'gmusic:album:' + self._create_id(artist.name + name + date)
album = Album(
uri=uri,
name=name,
artists=[artist],
num_tracks=song.get('totalTrackCount', 1),
num_discs=song.get('totalDiscCount', song.get('discNumber', 1)),
date=date)
self.albums[uri] = album
return album
def _to_mopidy_artist(self, song):
name = song['artist']
uri = 'gmusic:artist:' + self._create_id(name)
artist = Artist(
uri=uri,
name=name)
self.artists[uri] = artist
return artist
def <API key>(self, song):
name = song.get('albumArtist', '')
if name.strip() == '':
name = song['artist']
uri = 'gmusic:artist:' + self._create_id(name)
artist = Artist(
uri=uri,
name=name)
self.artists[uri] = artist
return artist
def _aa_to_mopidy_track(self, song):
uri = 'gmusic:track:' + song['storeId']
album = self._aa_to_mopidy_album(song)
artist = self.<API key>(song)
return Track(
uri=uri,
name=song['title'],
artists=[artist],
album=album,
track_no=song.get('trackNumber', 1),
disc_no=song.get('discNumber', 1),
date=album.date,
length=int(song['durationMillis']),
bitrate=320)
def _aa_to_mopidy_album(self, song):
album_info = self.backend.session.get_album_info(song['albumId'],
include_tracks=False)
if album_info is None:
return None
name = album_info['name']
artist = self.<API key>(album_info)
date = unicode(album_info.get('year', 0))
return Album(
name=name,
artists=[artist],
date=date)
def <API key>(self, song):
name = song['artist']
return Artist(
name=name)
def <API key>(self, album_info):
name = album_info.get('albumArtist', '')
if name.strip() == '':
name = album_info['artist']
return Artist(
name=name)
def _create_id(self, u):
return hashlib.md5(u.encode('utf-8')).hexdigest()
def _convert_to_int(self, string):
try:
return int(string)
except ValueError:
return object() |
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_12-ea) on Fri Mar 29 10:37:21 MDT 2013 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Package com.thinkaurelius.titan.diskstorage.locking.consistentkey (Titan: Distributed Graph Database 0.3.0 API)</title>
<meta name="date" content="2013-03-29">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Package com.thinkaurelius.titan.diskstorage.locking.consistentkey (Titan: Distributed Graph Database 0.3.0 API)";
}
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<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</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?com/thinkaurelius/titan/diskstorage/locking/consistentkey/package-use.html" target="_top">Frames</a></li>
<li><a href="package-use.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip-navbar_top">
</a></div>
<div class="header">
<h1 title="Uses of Package com.thinkaurelius.titan.diskstorage.locking.consistentkey" class="title">Uses of Package<br>com.thinkaurelius.titan.diskstorage.locking.consistentkey</h1>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../com/thinkaurelius/titan/diskstorage/locking/consistentkey/package-summary.html">com.thinkaurelius.titan.diskstorage.locking.consistentkey</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.thinkaurelius.titan.diskstorage.locking.consistentkey">com.thinkaurelius.titan.diskstorage.locking.consistentkey</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="com.thinkaurelius.titan.diskstorage.locking.consistentkey">
</a>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../../../com/thinkaurelius/titan/diskstorage/locking/consistentkey/package-summary.html">com.thinkaurelius.titan.diskstorage.locking.consistentkey</a> used by <a href="../../../../../../com/thinkaurelius/titan/diskstorage/locking/consistentkey/package-summary.html">com.thinkaurelius.titan.diskstorage.locking.consistentkey</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Class and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colOne"><a href="../../../../../../com/thinkaurelius/titan/diskstorage/locking/consistentkey/class-use/<API key>.html#com.thinkaurelius.titan.diskstorage.locking.consistentkey"><API key></a>
<div class="block">(c) Matthias Broecheler (me@matthiasb.com)</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><a href="../../../../../../com/thinkaurelius/titan/diskstorage/locking/consistentkey/class-use/<API key>.html#com.thinkaurelius.titan.diskstorage.locking.consistentkey"><API key></a> </td>
</tr>
<tr class="altColor">
<td class="colOne"><a href="../../../../../../com/thinkaurelius/titan/diskstorage/locking/consistentkey/class-use/<API key>.html#com.thinkaurelius.titan.diskstorage.locking.consistentkey"><API key></a>
<div class="block">This class implements locking according to the Titan <API key>
protocol.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><a href="../../../../../../com/thinkaurelius/titan/diskstorage/locking/consistentkey/class-use/LocalLockMediator.html#com.thinkaurelius.titan.diskstorage.locking.consistentkey">LocalLockMediator</a>
<div class="block">This class resolves lock contention between two transactions on the same JVM.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><a href="../../../../../../com/thinkaurelius/titan/diskstorage/locking/consistentkey/class-use/<API key>.html#com.thinkaurelius.titan.diskstorage.locking.consistentkey"><API key></a> </td>
</tr>
<tr class="rowColor">
<td class="colOne"><a href="../../../../../../com/thinkaurelius/titan/diskstorage/locking/consistentkey/class-use/LocalLockMediators.html#com.thinkaurelius.titan.diskstorage.locking.consistentkey">LocalLockMediators</a>
<div class="block">A singleton maintaining a globally unique map of locking-namespaces to <a href="../../../../../../com/thinkaurelius/titan/diskstorage/locking/consistentkey/LocalLockMediator.html" title="class in com.thinkaurelius.titan.diskstorage.locking.consistentkey"><code>LocalLockMediator</code></a> instances.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</div>
<div class="bottomNav"><a name="navbar_bottom">
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>">
</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">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?com/thinkaurelius/titan/diskstorage/locking/consistentkey/package-use.html" target="_top">Frames</a></li>
<li><a href="package-use.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip-navbar_bottom">
</a></div>
<p class="legalCopy"><small>Copyright &
</body>
</html> |
package com.tuohang.framework.jfinal.demo.common;
import com.jfinal.config.Constants;
import com.jfinal.config.Handlers;
import com.jfinal.config.Interceptors;
import com.jfinal.config.JFinalConfig;
import com.jfinal.config.Plugins;
import com.jfinal.config.Routes;
import com.jfinal.core.JFinal;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.jfinal.plugin.activerecord.dialect.MysqlDialect;
import com.jfinal.plugin.druid.DruidPlugin;
import com.jfinal.plugin.druid.<API key>;
import com.jfinal.render.ViewType;
import com.tuohang.framework.jfinal.ext.plugin.tablebind.AutoTableBindPlugin;
import com.tuohang.framework.jfinal.ext.plugin.tablebind.SimpleNameStyles;
import com.tuohang.framework.jfinal.ext.route.AutoBindRoutes;
/**
* API
*
* @author Lims
* @date 2015914
* @version 1.0
*/
public class MainConfig extends JFinalConfig {
@Override
public void configConstant(Constants me) {
// JfinalJSP
me.setDevMode(true);
me.setViewType(ViewType.JSP);
}
@Override
public void configRoute(Routes me) {
// me.add("/weixin", WeiXinController.class);
// me.add("/user", UserController.class);
me.add(new AdminRoutes());
me.add(new FrontRoutes());
me.add(new AutoBindRoutes().autoScan(false));
}
@Override
public void configPlugin(Plugins me) {
// druid
loadPropertyFile("jdbc.properties");
DruidPlugin druidPlugin = new DruidPlugin(getProperty("jdbcUrl"),
getProperty("user"), getProperty("password"));
druidPlugin.setFilters(getProperty("filters"));
druidPlugin.setInitialSize(getPropertyToInt("initialSize"));
druidPlugin.setMaxActive(getPropertyToInt("maxActive"));
druidPlugin.setMaxWait(getPropertyToInt("maxWait"));
druidPlugin
.<API key>(getPropertyToLong("<API key>"));
druidPlugin
.<API key>(getPropertyToLong("<API key>"));
druidPlugin.setValidationQuery(getProperty("validationQuery"));
druidPlugin.setTestWhileIdle(<API key>("testWhileIdle"));
druidPlugin.setTestOnBorrow(<API key>("testOnBorrow"));
druidPlugin.setTestOnReturn(<API key>("testOnReturn"));
druidPlugin
.<API key>(getPropertyToInt("<API key>"));
me.add(druidPlugin);
// ActiveRecord
ActiveRecordPlugin arp = new ActiveRecordPlugin("mysql", druidPlugin);
me.add(arp);
// mysql
// arp.setDialect(new MysqlDialect());
// model
// arp.addMapping("t_user", User.class);
// @TableBind
AutoTableBindPlugin atbp = new AutoTableBindPlugin(druidPlugin,
SimpleNameStyles.LOWER);
atbp.autoScan(false);
atbp.setShowSql(true);
atbp.setDialect(new MysqlDialect());// MySql
me.add(atbp);
}
@Override
public void configInterceptor(Interceptors me) {
// TODO Auto-generated method stub
}
@Override
public void configHandler(Handlers me) {
// Handlerweb
<API key> dvh = new <API key>("/druid");
me.add(dvh);
}
/**
* JFinal main
* mainClass
*/
public static void main(String[] args) {
JFinal.start("webapp", 80, "/", 5);
}
} |
package ru.quect.sweetdiary;
import android.app.Fragment;
import android.view.MenuItem;
public class MainActivityImpl extends MainActivity {
@Override
public Fragment getFragment(MenuItem menuItem) {
Fragment fragment;
Class fragmentClass;
switch(menuItem.getItemId()) {
case R.id.drawer_diary:
fragmentClass = DiaryFragment.class;
break;
case R.id.drawer_reports:
fragmentClass = ReportsFragment.class;
break;
case R.id.drawer_settings:
fragmentClass = SettingsFragment.class;
break;
default:
fragmentClass = DiaryFragment.class;
break;
}
try {
fragment = (Fragment) fragmentClass.newInstance();
} catch (Exception e) {
e.printStackTrace();
return null;
}
return fragment;
}
} |
<?php
include_once(dirname(__FILE__).'/../../classes/controllers/FrontController.php');
class <API key> extends <API key>
{
public $ssl = false;
public function init()
{
parent::init();
}
public function initContent()
{
parent::initContent();
$rer = SmartBlogPost::tagsPost('asd');
$blogcomment = new Blogcomment();
$result = '';
$keyword = Tools::getValue('smartsearch');
Hook::exec('actionsbsearch', array('keyword' => Tools::getValue('smartsearch')));
$id_lang = (int)$this->context->language->id;
$title_category = '';
$posts_per_page = Configuration::get('smartpostperpage');
$limit_start = 0;
$limit = $posts_per_page;
if ((boolean)Tools::getValue('page')) {
$c = (int)Tools::getValue('page');
$limit_start = $posts_per_page * ($c - 1);
}
$keyword = Tools::getValue('smartsearch');
$id_lang = (int)$this->context->language->id;
$result = SmartBlogPost::SmartBlogSearchPost($keyword,$id_lang,$limit_start,$limit);
$total = SmartBlogPost::<API key>($keyword,$id_lang);
$totalpages = ceil($total/$posts_per_page);
$i = 0;
if (!empty($result)) {
foreach ($result as $item) {
$to[$i] = $blogcomment->getToltalComment($item['id_post']);
$i++;
}
$j = 0;
foreach ($to as $item) {
if ($item == '') {
$result[$j]['totalcomment'] = 0;
} else {
$result[$j]['totalcomment'] = $item;
}
$j++;
}
}
$this->context->smarty->assign( array(
'postcategory'=>$result,
'title_category'=>$title_category,
'<API key>'=>Configuration::get('<API key>'),
'limit'=>isset($limit) ? $limit : 0,
'limit_start'=>isset($limit_start) ? $limit_start : 0,
'c'=>isset($c) ? $c : 1,
'total'=>$total,
'smartshowviewed' => Configuration::get('smartshowviewed'),
'smartcustomcss' => Configuration::get('smartcustomcss'),
'smartshownoimg' => Configuration::get('smartshownoimg'),
'smartshowauthor'=>Configuration::get('smartshowauthor'),
'smartblogliststyle' => Configuration::get('smartblogliststyle'),
'post_per_page'=>$posts_per_page,
'smartsearch'=>Tools::getValue('smartsearch'),
'pagenums' => $totalpages - 1,
'totalpages' =>$totalpages
));
$template_name = 'searchresult.tpl';
$this->setTemplate($template_name);
}
} |
layout: base
title: 'Features'
generated: 'true'
permalink: mr/feat/all.html
# Features
{% include mr-feat-table.html %}
{% assign sorted = site.mr-feat | sort: 'title' %}{% for p in sorted %}
<a id="al-mr-feat/{{ p.title }}" class="al-dest"/>
<h2><code>{{ p.title }}</code>: {{ p.shortdef }}</h2>
{% if p.content contains "<!--details
{{ p.content | split:"<!--details-->" | first }}
<a href="{{ p.title }}" class="al-doc">See details</a>
{% else %}
{{ p.content }}
{% endif %}
<a href="{{ site.git_edit }}/{% if p.collection %}{{ p.relative_path }}{% else %}{{ p.path }}{% endif %}" target="#">edit {{ p.title }}</a>
{% endfor %} |
var baseTransfom = function (v2DataRecord) {
var v3DataRecord = {};
v3DataRecord.repository = {};
v3DataRecord.repository.name = v2DataRecord.CustodianName;
v3DataRecord.repository.id = [{
"assigningAuthority": v2DataRecord.RepositoryId
}];
v3DataRecord.recordId = {};
v3DataRecord.recordId.id = v2DataRecord.EventId;
v3DataRecord.enteredBy = <API key>(v2DataRecord.EnteredBy, "name")
v3DataRecord.enteredDate = <API key>(v2DataRecord.EnteredByDate);
v3DataRecord.dataDomain = [{
"system": "2.16.840.1.113883.6.1",
"primary": true,
"display": null,
"code": v2DataRecord.LoincCode
}];
//v3DataRecord.facility = {};
//v3DataRecord.facility.name = v2DataRecord.Facility;
v3DataRecord.facility = <API key>(v2DataRecord.Facility, "name");
return v3DataRecord;
};
// if the string is an empty string returns a null, otherwise just return the string
var <API key> = function(theString) {
if (!theString) {
return null;
}
return theString;
}
// if the string is an empty string returns a null, otherwise return an object that has the
// string as a value with the given key
// for example
// <API key>("yes", "notEmpty") = {"notEmpty": "yes"}
// <API key>("", "notEmpty") = null
var <API key> = function(theString, key) {
if (!theString) {
return null;
}
var returnObject = {};
returnObject[key] = theString;
return returnObject;
}
// if the string is an empty string returns a null, otherwise return an object that has the
// string as a value with the given key
// for example
// <API key>("yes", "notEmpty") = {"notEmpty": "yes"}
// <API key>("", "notEmpty") = null
var <API key> = function(theString, key) {
if (!theString) {
return null;
}
var returnObject = {};
returnObject[key] = theString;
return [returnObject];
}
module.exports.baseTransform = baseTransfom;
module.exports.<API key> = <API key>;
module.exports.<API key> = <API key>;
module.exports.<API key> = <API key>; |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>DESCRIBE AS JSON INDEX</title>
<link rel="stylesheet" href="gettingStarted.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
<link rel="start" href="index.html" title="Getting Started with Oracle NoSQL Database Tables" />
<link rel="up" href="ddl_overview.html" title="Appendix A. Table Data Definition Language Overview" />
<link rel="prev" href="describetable.html" title="DESCRIBE AS JSON TABLE" />
<link rel="next" href="showtables.html" title="SHOW TABLES" />
</head>
<body>
<div xmlns="" class="navheader">
<div class="libver">
<p>Library Version 12.1.3.5</p>
</div>
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">DESCRIBE AS JSON INDEX</th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="describetable.html">Prev</a> </td>
<th width="60%" align="center">Appendix A. Table Data Definition Language Overview</th>
<td width="20%" align="right"> <a accesskey="n" href="showtables.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="sect1" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a id="describeindex"></a>DESCRIBE AS JSON INDEX</h2>
</div>
</div>
</div>
<p>
You can retrieve a JSON representation of an index by using the
<code class="literal">DESCRIBE AS JSON INDEX</code> statement:
</p>
<pre class="programlisting">DESCRIBE AS JSON INDEX <span class="emphasis"><em>index_name</em></span> ON <span class="emphasis"><em>table_name</em></span></pre>
<p>
where:
</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>
<span class="emphasis"><em>index_name</em></span> is the name of the
index you want to describe.
</p>
</li>
<li>
<p>
<span class="emphasis"><em>table_name</em></span> is the name of the
table to which the index is applied.
</p>
</li>
</ul>
</div>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="describetable.html">Prev</a> </td>
<td width="20%" align="center">
<a accesskey="u" href="ddl_overview.html">Up</a>
</td>
<td width="40%" align="right"> <a accesskey="n" href="showtables.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">DESCRIBE AS JSON TABLE </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> SHOW TABLES</td>
</tr>
</table>
</div>
</body>
</html> |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta content="width=device-width, height=device-height, user-scalable=no" name="viewport">
<title>{:PHPSayConfig.sitename}</title>
<link rel="stylesheet" type="text/css" media="screen" href="mobile_static/flat.css" />
<script type="text/javascript" src="static/jquery.js"></script>
<script type="text/javascript" src="mobile_static/mobile.js"></script>
<!-- INCLUDE _analytics.html -->
</head>
<body>
<!-- INCLUDE mobile_header.html -->
<div id="wrapper">
<div class="content">
<div class="box">
<div class="cell">
<a class="tab<!-- IF settingType == "avatar" --> current<!-- ENDIF -->" href="./settings.php"></a>
<a class="tab<!-- IF settingType == "email" --> current<!-- ENDIF -->" href="./settings.php?with=email"></a>
<a class="tab<!-- IF settingType == "password" --> current<!-- ENDIF -->" href="./settings.php?with=password"></a>
</div>
<div class="inner">
<!-- IF settingType == "avatar" -->
<form name="uploadForm" id="uploadForm" action="post.php" method="post" enctype="multipart/form-data">
<div class="current-avatar">
<img src="{:loginInfo.avatar}">
<input class="file-select" type="file" name="avatar">
</div>
<input type="hidden" name="do" value="settingAvatar">
<input class="submit-button" type="submit" value="">
</form>
<script type="text/javascript">checkSettingResult();$("#uploadForm").submit(uploadAvatar);</script>
<!-- ELSEIF settingType == "email" -->
<!-- IF userInfo.password == "" -->
<strong></strong>
<!-- ELSE -->
<form name="emailForm" id="emailForm" action="post.php" method="post">
<div class="user-input">
<input type="password" maxlength="26" placeholder="" name="password" autocorrect="off" autocapitalize="off">
</div>
<div class="user-input">
<input type="text" maxlength="36" placeholder="" name="email" value="{:userInfo.email}" autocorrect="off" autocapitalize="off">
</div>
<input class="submit-button" type="submit" value=" ">
</form>
<script type="text/javascript">$("#emailForm").submit(settingEmail);</script>
<!-- ENDIF -->
<!-- ELSEIF settingType == "password" -->
<form name="passwordForm" id="passwordForm" action="post.php" method="post">
<div class="user-input<!-- IF userInfo.password == "" --> hidden<!-- ENDIF -->">
<input type="password" maxlength="26" placeholder="" name="password_current" autocorrect="off" autocapitalize="off">
</div>
<div class="user-input">
<input type="password" maxlength="26" placeholder="<!-- IF userInfo.password != "" --><!-- ENDIF -->" name="password" autocorrect="off" autocapitalize="off">
</div>
<div class="user-input">
<input type="password" maxlength="26" placeholder="" name="password_confirm" autocorrect="off" autocapitalize="off">
</div>
<input class="submit-button" type="submit" value=" ">
</form>
<script type="text/javascript">$("#passwordForm").submit(settingPassword);</script>
<!-- ENDIF -->
</div>
</div>
</div>
</div>
<!-- INCLUDE mobile_footer.html -->
</body>
</html> |
package mytesting;
import com.alibaba.fastjson.JSON;
import com.cloud.core.session.redis.JedisUtil;
import com.cloudibpm.core.session.utils.SessionUtils;
import com.cloudibpm.core.user.Login;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.<API key>;
import org.apache.http.client.methods.<API key>;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.<API key>;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.CharsetUtils;
import org.apache.http.util.EntityUtils;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
/**
* Servlet implementation class <API key>
*/
@WebServlet("/FileServices")
@MultipartConfig
public class FileServices extends HttpServlet {
private static final long serialVersionUID = 1L;
private Login loggedinstaff = null;
private static String API_DomainName = null;
/**
* @see HttpServlet#service(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
API_DomainName=request.getScheme() + "://" + request.getServerName() + ":8088/api";
String sessionId= SessionUtils.getInstance().getSessionId(request);
if(sessionId!=null){
loggedinstaff= JSON.parseObject(JedisUtil.getInstance().get(sessionId),Login.class);
}
if(loggedinstaff==null){
returnErrorMsg(response);
}
super.service(request, response);
}
private void returnErrorMsg(HttpServletResponse response) throws IOException {
String responseJson = "{\"status\": \"-5\" }";
response.<API key>("utf8");
response.setContentType("application/json");
PrintWriter out = response.getWriter();
out.print(responseJson);
out.close();
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
<API key> response1 = null;
String api = request.getParameter("api");
String responseJson = null;
if (api.equals("0")) { // upload a file
String oid = request.getParameter("oid");
String pid = request.getParameter("pid");
String vid = request.getParameter("vid");
String fid = request.getParameter("fid");
String fname = request.getParameter("fname");
String flen = request.getParameter("flen");
String fname2 = URLDecoder.decode(fname, "utf-8");
<API key> <API key> = <API key>.create();
<API key>.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
<API key>.addTextBody("oid", oid, ContentType.DEFAULT_TEXT);
<API key>.addTextBody("pid", pid, ContentType.DEFAULT_TEXT);
<API key>.addTextBody("vid", vid, ContentType.DEFAULT_TEXT);
<API key>.addTextBody("fid", fid == null ? "" : fid, ContentType.DEFAULT_TEXT);
<API key>.addTextBody("fname", URLEncoder.encode(fname2, "utf-8"), ContentType.DEFAULT_TEXT);
<API key>.addTextBody("flen", flen, ContentType.DEFAULT_TEXT);
for (Part filePart : request.getParts()) {
<API key>.addBinaryBody("uploadFile", filePart.getInputStream(),
ContentType.DEFAULT_BINARY, fname);
}
<API key>.setCharset(CharsetUtils.get("UTF-8"));
HttpEntity httpEntity = <API key>.build();
HttpPost httpPost = new HttpPost(API_DomainName + "/service1/api18");
httpPost.setEntity(httpEntity);
response1 = httpClient.execute(httpPost);
HttpEntity entity = response1.getEntity();
responseJson = EntityUtils.toString(entity, Charset.forName("UTF-8")).trim();
httpClient.close();
httpPost.abort();
} else if (api.equals("1")) {
// remove one or more file objects on one variable
HttpPost httpPost = new HttpPost(API_DomainName + "/service1/api19");
List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
String oid = request.getParameter("oid");
String pid = request.getParameter("pid");
String vid = request.getParameter("vid");
String fid = request.getParameter("fid");
urlParameters.add(new BasicNameValuePair("oid", oid));
urlParameters.add(new BasicNameValuePair("pid", pid));
urlParameters.add(new BasicNameValuePair("vid", vid));
urlParameters.add(new BasicNameValuePair("fid", fid));
HttpEntity postParams = new <API key>(urlParameters, "UTF-8");
httpPost.setEntity(postParams);
response1 = httpClient.execute(httpPost);
HttpEntity entity = response1.getEntity();
responseJson = EntityUtils.toString(entity, "UTF-8").trim();
httpClient.close();
httpPost.abort();
} else if (api.equals("2")) { // remove one file object on one variable
HttpPost httpPost = new HttpPost(API_DomainName + "/service1/api20");
List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
String oid = request.getParameter("oid");
String pid = request.getParameter("pid");
String vid = request.getParameter("vid");
urlParameters.add(new BasicNameValuePair("oid", oid));
urlParameters.add(new BasicNameValuePair("pid", pid));
urlParameters.add(new BasicNameValuePair("vid", vid));
HttpEntity postParams = new <API key>(urlParameters, "UTF-8");
httpPost.setEntity(postParams);
response1 = httpClient.execute(httpPost);
HttpEntity entity = response1.getEntity();
responseJson = EntityUtils.toString(entity, "UTF-8").trim();
httpClient.close();
httpPost.abort();
}
response.<API key>("utf8");
response.setContentType("application/json");
PrintWriter out = response.getWriter();
out.print(responseJson);
out.close();
}
} |
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd ${DIR}
pidfile=quota.pid
if [ ! -f ${pidfile} ]; then
echo "Pid file does not exist, check if the quota is running please."
exit 1
fi
pid=`cat ${pidfile}`
ps -ef | grep $pid | grep -v grep | grep mysqlQuota.py > /dev/null
if [ $? -eq 0 ]; then
echo "run command: kill $pid"
`kill $pid`
rm $pidfile
else
echo "The pid does not exist."
fi
exit 0 |
package com.orctom.trest.domain;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* @author CH
* @since Oct 10, 2013
*/
@Entity
@Table
public class TestResult extends BaseEntity {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "resttest_id", nullable = false)
private RestTest restTest;
private boolean success;
private String logs;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "build_id", nullable = false)
private Build build;
public TestResult() {
super();
}
public TestResult(RestTest restTest, Build build, boolean success, String logs) {
this.restTest = restTest;
this.build = build;
this.success = success;
this.logs = logs;
}
public RestTest getRestTest() {
return restTest;
}
public void setRestTest(RestTest restTest) {
this.restTest = restTest;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getLogs() {
return logs;
}
public void setLogs(String logs) {
this.logs = logs;
}
} |
# Gijefa (M. Roem.) Post & Kuntze GENUS
# Status
SYNONYM
# According to
GRIN Taxonomy for Plants
# Published in
null
# Original name
null
Remarks
null |
<?php
namespace Dkd\PhpCmis\Test\Unit\DataObjects;
use Dkd\PhpCmis\DataObjects\ChangeEventInfo;
use Dkd\PhpCmis\Enum\ChangeType;
/**
* Class ChangeEventInfoTest
*/
class ChangeEventInfoTest extends \<API key>
{
/**
* @var ChangeEventInfo
*/
protected $changeEventInfo;
public function setUp()
{
$this->changeEventInfo = new ChangeEventInfo();
}
public function <API key>()
{
$dateTime = new \DateTime();
$this->changeEventInfo->setChangeTime($dateTime);
$this->assertAttributeSame($dateTime, 'changeTime', $this->changeEventInfo);
}
/**
* @depends <API key>
*/
public function <API key>()
{
$dateTime = new \DateTime();
$this->changeEventInfo->setChangeTime($dateTime);
$this->assertSame($dateTime, $this->changeEventInfo->getChangeTime());
}
public function <API key>()
{
$changeType = ChangeType::cast(ChangeType::CREATED);
$this->changeEventInfo->setchangeType($changeType);
$this->assertAttributeSame($changeType, 'changeType', $this->changeEventInfo);
}
/**
* @depends <API key>
*/
public function <API key>()
{
$changeType = ChangeType::cast(ChangeType::CREATED);
$this->changeEventInfo->setchangeType($changeType);
$this->assertSame($changeType, $this->changeEventInfo->getchangeType());
}
} |
"""Theia CLI entrypoint.
"""
from theia.cli.parser import get_parent_parser
from theia.cli.watcher import get_parser as get_watcher_parser, run_watcher
from theia.cli.collector import get_parser as <API key>, run_collector
from theia.cli.query import get_parser as get_query_parser, run_query
def run_cli():
"""Run theia CLI.
"""
parser = get_parent_parser('theia', 'Theia CLI')
subparsers = parser.add_subparsers(dest='command', title='command', help='CLI commands')
get_watcher_parser(subparsers)
<API key>(subparsers)
get_query_parser(subparsers)
args = parser.parse_args()
if args.version:
from theia.metadata import version
import sys
print('theia', version)
sys.exit(0)
if args.verbose:
from logging import basicConfig, DEBUG
basicConfig(level=DEBUG)
if args.command == 'watch':
run_watcher(args)
elif args.command == 'collect':
run_collector(args)
elif args.command == 'query':
run_query(args)
run_cli() |
#!/usr/bin/env python
"""
Problem Definition :
"""
__author__ = 'vivek'
import time
startTime = time.clock()
special_cards = ['T','J','Q','K','A']
<API key> = {'T':'10','J':'11', 'Q':'12', 'K':'13', 'A':'14'}
def divide_cards(data) :
cards = data.split(' ')
p1 = {}
p2 = {}
for i in xrange(0,5):
p1[cards[i][:-1]] = cards[i][-1:]
#print(p1)
with open("poker.txt") as f:
data = f.read()
for ch in special_cards:
data = data.replace(ch,<API key>[ch])
numbers = data.split('\n')
for number in numbers:
#print(number)
if(number):
divide_cards(number)
#print(numbers)
print "Run time...{} secs \n".format(round(time.clock() - startTime, 5)) |
using System;
namespace AIMP.SDK.Interfaces
{
<summary>
</summary>
<param name="id">The identifier.</param>
public delegate void <API key>(int id);
<summary>
</summary>
public interface <API key>
{
<summary>
Gets the name.
</summary>
<returns></returns>
string GetName();
<summary>
Creates the frame.
</summary>
<param name="parentWindow">The parent window.</param>
<returns></returns>
IntPtr CreateFrame(IntPtr parentWindow);
<summary>
Destroys the frame.
</summary>
void DestroyFrame();
<summary>
Occurs when [notification].
</summary>
event <API key> Notification;
}
} |
package com.fibrobook;
import android.app.Activity;
import android.os.Bundle;
public class AboutFibrobook extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.about_fibrobook);
}
} |
<?php $serveur = "localhost";
$nom_base = "tuto_db";
$login = "root";
$pwd= "";
mysql_connect ($serveur,$login,$pwd) or die ('ERREUR '.mysql_error());
mysql_select_db ($nom_base) or die ('ERREUR '.mysql_error());
mysql_query("SET NAMES UTF8");
$req="select * from categorie ";
$res = mysql_query ($req);
echo '<h3>Tout Catégories et leurs cours ';
echo '</h3>';
?>
<div id="accordion">
<?php
while ($data=mysql_fetch_array($res))
{ ?>
<h3>
<?php
echo $data['nom_cat'];
?>
</h3>
<?php
$req2='select * from tutoriel where nom_cat="'.$data['nom_cat'].'"';
$res2 = mysql_query ($req2);
while ($data2=mysql_fetch_array($res2))
{
?>
<div><p>
<?php
echo $data2['nom'];
?>
</p></div>
<?php
}
}
?> |
'use strict';
// App Configuration
const app = require('jovo-framework').Jovo;
const webhook = require('jovo-framework').Webhook;
const config = require('config');
const handlers = require("./logic/MainLogic").getHandlers();
const Logger = require('./logic/Logger');
const path = require('path');
let FILE = path.basename(__filename);
let <API key> = [
'FUNsoundIntent',
'HelperStatusIntent',
'FUNcreditsIntent',
'ChangeCityIntent',
'Default Welcome Intent',
'CancelIntent'
];
app.<API key>(<API key>);
app.setConfig({
<API key>: <API key>,
// Other configurations
});
// Listen for post requests
webhook.listen(config.get("port"), function() {
Logger.log(FILE, 'Local development server listening on port.'+ config.get("port"));
});
webhook.post('/webhook', function(req, res) {
app.handleRequest(req, res, handlers);
app.execute();
});
webhook.get('/hans', function(req, res) {
res.json({hans:"hansoihkj00c"});
}); |
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_25) on Thu Jan 01 17:43:59 PST 2015 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class com.fasterxml.jackson.databind.ser.std.StdArraySerializers.<API key> (jackson-databind 2.5.0 API)</title>
<meta name="date" content="2015-01-01">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class com.fasterxml.jackson.databind.ser.std.StdArraySerializers.<API key> (jackson-databind 2.5.0 API)";
}
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar_top">
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../com/fasterxml/jackson/databind/ser/std/StdArraySerializers.<API key>.html" title="class in com.fasterxml.jackson.databind.ser.std">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?com/fasterxml/jackson/databind/ser/std/class-use/StdArraySerializers.<API key>.html" target="_top">Frames</a></li>
<li><a href="StdArraySerializers.<API key>.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip-navbar_top">
</a></div>
<div class="header">
<h2 title="Uses of Class com.fasterxml.jackson.databind.ser.std.StdArraySerializers.<API key>" class="title">Uses of Class<br>com.fasterxml.jackson.databind.ser.std.StdArraySerializers.<API key></h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../../com/fasterxml/jackson/databind/ser/std/StdArraySerializers.<API key>.html" title="class in com.fasterxml.jackson.databind.ser.std">StdArraySerializers.<API key></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.fasterxml.jackson.databind.ser.std">com.fasterxml.jackson.databind.ser.std</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="com.fasterxml.jackson.databind.ser.std">
</a>
<h3>Uses of <a href="../../../../../../../com/fasterxml/jackson/databind/ser/std/StdArraySerializers.<API key>.html" title="class in com.fasterxml.jackson.databind.ser.std">StdArraySerializers.<API key></a> in <a href="../../../../../../../com/fasterxml/jackson/databind/ser/std/package-summary.html">com.fasterxml.jackson.databind.ser.std</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation">
<caption><span>Constructors in <a href="../../../../../../../com/fasterxml/jackson/databind/ser/std/package-summary.html">com.fasterxml.jackson.databind.ser.std</a> with parameters of type <a href="../../../../../../../com/fasterxml/jackson/databind/ser/std/StdArraySerializers.<API key>.html" title="class in com.fasterxml.jackson.databind.ser.std">StdArraySerializers.<API key></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="../../../../../../../com/fasterxml/jackson/databind/ser/std/StdArraySerializers.<API key>.html#StdArraySerializers.<API key>(com.fasterxml.jackson.databind.ser.std.StdArraySerializers.<API key>, com.fasterxml.jackson.databind.BeanProperty, com.fasterxml.jackson.databind.jsontype.TypeSerializer)">StdArraySerializers.<API key></a></strong>(<a href="../../../../../../../com/fasterxml/jackson/databind/ser/std/StdArraySerializers.<API key>.html" title="class in com.fasterxml.jackson.databind.ser.std">StdArraySerializers.<API key></a> src,
<a href="../../../../../../../com/fasterxml/jackson/databind/BeanProperty.html" title="interface in com.fasterxml.jackson.databind">BeanProperty</a> prop,
<a href="../../../../../../../com/fasterxml/jackson/databind/jsontype/TypeSerializer.html" title="class in com.fasterxml.jackson.databind.jsontype">TypeSerializer</a> vts)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="bottomNav"><a name="navbar_bottom">
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>">
</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/fasterxml/jackson/databind/ser/std/StdArraySerializers.<API key>.html" title="class in com.fasterxml.jackson.databind.ser.std">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?com/fasterxml/jackson/databind/ser/std/class-use/StdArraySerializers.<API key>.html" target="_top">Frames</a></li>
<li><a href="StdArraySerializers.<API key>.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip-navbar_bottom">
</a></div>
<p class="legalCopy"><small>Copyright &
</body>
</html> |
/**
* @constructor
* @extends {WebInspector.Object}
* @param {WebInspector.Workspace} workspace
*/
WebInspector.CSSStyleModel = function(workspace)
{
this._workspace = workspace;
this.<API key> = [];
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoRequested, this._undoRedoRequested, this);
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoCompleted, this._undoRedoCompleted, this);
WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.<API key>, this.<API key>, this);
this.<API key> = {};
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this.<API key>, this);
InspectorBackend.<API key>(new WebInspector.CSSDispatcher(this));
CSSAgent.enable();
this._resetStyleSheets();
}
/**
* @param {Array.<CSSAgent.CSSRule>} ruleArray
*/
WebInspector.CSSStyleModel.<API key> = function(ruleArray)
{
var result = [];
for (var i = 0; i < ruleArray.length; ++i)
result.push(WebInspector.CSSRule.parsePayload(ruleArray[i]));
return result;
}
/**
* @param {Array.<CSSAgent.RuleMatch>} matchArray
*/
WebInspector.CSSStyleModel.<API key> = function(matchArray)
{
var result = [];
for (var i = 0; i < matchArray.length; ++i)
result.push(WebInspector.CSSRule.parsePayload(matchArray[i].rule, matchArray[i].matchingSelectors));
return result;
}
WebInspector.CSSStyleModel.Events = {
StyleSheetAdded: "StyleSheetAdded",
StyleSheetChanged: "StyleSheetChanged",
StyleSheetRemoved: "StyleSheetRemoved",
<API key>: "<API key>",
NamedFlowCreated: "NamedFlowCreated",
NamedFlowRemoved: "NamedFlowRemoved",
RegionLayoutUpdated: "RegionLayoutUpdated",
<API key>: "<API key>"
}
WebInspector.CSSStyleModel.MediaTypes = ["all", "braille", "embossed", "handheld", "print", "projection", "screen", "speech", "tty", "tv"];
WebInspector.CSSStyleModel.prototype = {
/**
* @param {DOMAgent.NodeId} nodeId
* @param {boolean} needPseudo
* @param {boolean} needInherited
* @param {function(?*)} userCallback
*/
<API key>: function(nodeId, needPseudo, needInherited, userCallback)
{
/**
* @param {function(?*)} userCallback
* @param {?Protocol.Error} error
* @param {Array.<CSSAgent.RuleMatch>=} matchedPayload
* @param {Array.<CSSAgent.PseudoIdMatches>=} pseudoPayload
* @param {Array.<CSSAgent.InheritedStyleEntry>=} inheritedPayload
*/
function callback(userCallback, error, matchedPayload, pseudoPayload, inheritedPayload)
{
if (error) {
if (userCallback)
userCallback(null);
return;
}
var result = {};
if (matchedPayload)
result.matchedCSSRules = WebInspector.CSSStyleModel.<API key>(matchedPayload);
if (pseudoPayload) {
result.pseudoElements = [];
for (var i = 0; i < pseudoPayload.length; ++i) {
var entryPayload = pseudoPayload[i];
result.pseudoElements.push({ pseudoId: entryPayload.pseudoId, rules: WebInspector.CSSStyleModel.<API key>(entryPayload.matches) });
}
}
if (inheritedPayload) {
result.inherited = [];
for (var i = 0; i < inheritedPayload.length; ++i) {
var entryPayload = inheritedPayload[i];
var entry = {};
if (entryPayload.inlineStyle)
entry.inlineStyle = WebInspector.CSSStyleDeclaration.parsePayload(entryPayload.inlineStyle);
if (entryPayload.matchedCSSRules)
entry.matchedCSSRules = WebInspector.CSSStyleModel.<API key>(entryPayload.matchedCSSRules);
result.inherited.push(entry);
}
}
if (userCallback)
userCallback(result);
}
CSSAgent.<API key>(nodeId, needPseudo, needInherited, callback.bind(null, userCallback));
},
/**
* @param {DOMAgent.NodeId} nodeId
* @param {function(?WebInspector.CSSStyleDeclaration)} userCallback
*/
<API key>: function(nodeId, userCallback)
{
/**
* @param {function(?WebInspector.CSSStyleDeclaration)} userCallback
*/
function callback(userCallback, error, computedPayload)
{
if (error || !computedPayload)
userCallback(null);
else
userCallback(WebInspector.CSSStyleDeclaration.<API key>(computedPayload));
}
CSSAgent.<API key>(nodeId, callback.bind(null, userCallback));
},
/**
* @param {DOMAgent.NodeId} nodeId
* @param {function(?WebInspector.CSSStyleDeclaration, ?WebInspector.CSSStyleDeclaration)} userCallback
*/
<API key>: function(nodeId, userCallback)
{
/**
* @param {function(?WebInspector.CSSStyleDeclaration, ?WebInspector.CSSStyleDeclaration)} userCallback
* @param {?Protocol.Error} error
* @param {?CSSAgent.CSSStyle=} inlinePayload
* @param {?CSSAgent.CSSStyle=} <API key>
*/
function callback(userCallback, error, inlinePayload, <API key>)
{
if (error || !inlinePayload)
userCallback(null, null);
else
userCallback(WebInspector.CSSStyleDeclaration.parsePayload(inlinePayload), <API key> ? WebInspector.CSSStyleDeclaration.parsePayload(<API key>) : null);
}
CSSAgent.<API key>(nodeId, callback.bind(null, userCallback));
},
/**
* @param {DOMAgent.NodeId} nodeId
* @param {?Array.<string>|undefined} forcedPseudoClasses
* @param {function()=} userCallback
*/
forcePseudoState: function(nodeId, forcedPseudoClasses, userCallback)
{
CSSAgent.forcePseudoState(nodeId, forcedPseudoClasses || [], userCallback);
},
/**
* @param {DOMAgent.NodeId} documentNodeId
* @param {function(?WebInspector.NamedFlowCollection)} userCallback
*/
<API key>: function(documentNodeId, userCallback)
{
var namedFlowCollection = this.<API key>[documentNodeId];
if (namedFlowCollection) {
userCallback(namedFlowCollection);
return;
}
/**
* @param {function(?WebInspector.NamedFlowCollection)} userCallback
* @param {?Protocol.Error} error
* @param {?Array.<CSSAgent.NamedFlow>} namedFlowPayload
*/
function callback(userCallback, error, namedFlowPayload)
{
if (error || !namedFlowPayload)
userCallback(null);
else {
var namedFlowCollection = new WebInspector.NamedFlowCollection(namedFlowPayload);
this.<API key>[documentNodeId] = namedFlowCollection;
userCallback(namedFlowCollection);
}
}
CSSAgent.<API key>(documentNodeId, callback.bind(this, userCallback));
},
/**
* @param {DOMAgent.NodeId} documentNodeId
* @param {string} flowName
* @param {function(?WebInspector.NamedFlow)} userCallback
*/
getFlowByNameAsync: function(documentNodeId, flowName, userCallback)
{
var namedFlowCollection = this.<API key>[documentNodeId];
if (namedFlowCollection) {
userCallback(namedFlowCollection.flowByName(flowName));
return;
}
/**
* @param {function(?WebInspector.NamedFlow)} userCallback
* @param {?WebInspector.NamedFlowCollection} namedFlowCollection
*/
function callback(userCallback, namedFlowCollection)
{
if (!namedFlowCollection)
userCallback(null);
else
userCallback(namedFlowCollection.flowByName(flowName));
}
this.<API key>(documentNodeId, callback.bind(this, userCallback));
},
/**
* @param {CSSAgent.CSSRuleId} ruleId
* @param {DOMAgent.NodeId} nodeId
* @param {string} newSelector
* @param {function(WebInspector.CSSRule, boolean)} successCallback
* @param {function()} failureCallback
*/
setRuleSelector: function(ruleId, nodeId, newSelector, successCallback, failureCallback)
{
/**
* @param {DOMAgent.NodeId} nodeId
* @param {function(WebInspector.CSSRule, boolean)} successCallback
* @param {CSSAgent.CSSRule} rulePayload
* @param {?Array.<DOMAgent.NodeId>} selectedNodeIds
*/
function <API key>(nodeId, successCallback, rulePayload, selectedNodeIds)
{
if (!selectedNodeIds)
return;
var <API key> = (selectedNodeIds.indexOf(nodeId) >= 0);
var rule = WebInspector.CSSRule.parsePayload(rulePayload);
successCallback(rule, <API key>);
}
/**
* @param {DOMAgent.NodeId} nodeId
* @param {function(WebInspector.CSSRule, boolean)} successCallback
* @param {function()} failureCallback
* @param {?Protocol.Error} error
* @param {string} newSelector
* @param {?CSSAgent.CSSRule} rulePayload
*/
function callback(nodeId, successCallback, failureCallback, newSelector, error, rulePayload)
{
this.<API key>.pop();
if (error)
failureCallback();
else {
WebInspector.domAgent.markUndoableState();
var ownerDocumentId = this._ownerDocumentId(nodeId);
if (ownerDocumentId)
WebInspector.domAgent.querySelectorAll(ownerDocumentId, newSelector, <API key>.bind(this, nodeId, successCallback, rulePayload));
else
failureCallback();
}
}
this.<API key>.push(true);
CSSAgent.setRuleSelector(ruleId, newSelector, callback.bind(this, nodeId, successCallback, failureCallback, newSelector));
},
/**
* @param {DOMAgent.NodeId} nodeId
* @param {string} selector
* @param {function(WebInspector.CSSRule, boolean)} successCallback
* @param {function()} failureCallback
*/
addRule: function(nodeId, selector, successCallback, failureCallback)
{
/**
* @param {DOMAgent.NodeId} nodeId
* @param {function(WebInspector.CSSRule, boolean)} successCallback
* @param {CSSAgent.CSSRule} rulePayload
* @param {?Array.<DOMAgent.NodeId>} selectedNodeIds
*/
function <API key>(nodeId, successCallback, rulePayload, selectedNodeIds)
{
if (!selectedNodeIds)
return;
var <API key> = (selectedNodeIds.indexOf(nodeId) >= 0);
var rule = WebInspector.CSSRule.parsePayload(rulePayload);
successCallback(rule, <API key>);
}
/**
* @param {function(WebInspector.CSSRule, boolean)} successCallback
* @param {function()} failureCallback
* @param {string} selector
* @param {?Protocol.Error} error
* @param {?CSSAgent.CSSRule} rulePayload
*/
function callback(successCallback, failureCallback, selector, error, rulePayload)
{
this.<API key>.pop();
if (error) {
// Invalid syntax for a selector
failureCallback();
} else {
WebInspector.domAgent.markUndoableState();
var ownerDocumentId = this._ownerDocumentId(nodeId);
if (ownerDocumentId)
WebInspector.domAgent.querySelectorAll(ownerDocumentId, selector, <API key>.bind(this, nodeId, successCallback, rulePayload));
else
failureCallback();
}
}
this.<API key>.push(true);
CSSAgent.addRule(nodeId, selector, callback.bind(this, successCallback, failureCallback, selector));
},
<API key>: function()
{
this.<API key>(WebInspector.CSSStyleModel.Events.<API key>);
},
/**
* @param {!CSSAgent.StyleSheetId} id
* @return {WebInspector.CSSStyleSheetHeader}
*/
<API key>: function(id)
{
return this.<API key>[id];
},
/**
* @return {Array.<WebInspector.CSSStyleSheetHeader>}
*/
styleSheetHeaders: function()
{
return Object.values(this.<API key>);
},
/**
* @param {DOMAgent.NodeId} nodeId
*/
_ownerDocumentId: function(nodeId)
{
var node = WebInspector.domAgent.nodeForId(nodeId);
if (!node)
return null;
return node.ownerDocument ? node.ownerDocument.id : null;
},
/**
* @param {CSSAgent.StyleSheetId} styleSheetId
*/
<API key>: function(styleSheetId)
{
if (!this.<API key>.length)
return;
var majorChange = this.<API key>[this.<API key>.length - 1];
if (!majorChange || !styleSheetId || !this.hasEventListeners(WebInspector.CSSStyleModel.Events.StyleSheetChanged))
return;
this.<API key>(WebInspector.CSSStyleModel.Events.StyleSheetChanged, { styleSheetId: styleSheetId, majorChange: majorChange });
},
/**
* @param {!CSSAgent.CSSStyleSheetHeader} header
*/
_styleSheetAdded: function(header)
{
console.assert(!this.<API key>[header.styleSheetId]);
var styleSheetHeader = new WebInspector.CSSStyleSheetHeader(header);
this.<API key>[header.styleSheetId] = styleSheetHeader;
var url = styleSheetHeader.resourceURL();
if (!this.<API key>[url])
this.<API key>[url] = {};
var <API key> = this.<API key>[url];
var styleSheetIds = <API key>[styleSheetHeader.frameId];
if (!styleSheetIds) {
styleSheetIds = [];
<API key>[styleSheetHeader.frameId] = styleSheetIds;
}
styleSheetIds.push(styleSheetHeader.id);
this.<API key>(WebInspector.CSSStyleModel.Events.StyleSheetAdded, styleSheetHeader);
},
/**
* @param {!CSSAgent.StyleSheetId} id
*/
_styleSheetRemoved: function(id)
{
var header = this.<API key>[id];
console.assert(header);
delete this.<API key>[id];
var url = header.resourceURL();
var <API key> = this.<API key>[url];
<API key>[header.frameId].remove(id);
if (!<API key>[header.frameId].length) {
delete <API key>[header.frameId];
if (!Object.keys(this.<API key>[url]).length)
delete this.<API key>[url];
}
this.<API key>(WebInspector.CSSStyleModel.Events.StyleSheetRemoved, header);
},
/**
* @param {string} url
* @return {Array.<CSSAgent.StyleSheetId>}
*/
styleSheetIdsForURL: function(url)
{
var <API key> = this.<API key>[url];
if (!<API key>)
return [];
var result = [];
for (var frameId in <API key>)
result = result.concat(<API key>[frameId]);
return result;
},
/**
* @param {string} url
* @return {Object.<NetworkAgent.FrameId, Array.<CSSAgent.StyleSheetId>>}
*/
<API key>: function(url)
{
var <API key> = this.<API key>[url];
if (!<API key>)
return {};
return <API key>;
},
/**
* @param {CSSAgent.NamedFlow} namedFlowPayload
*/
_namedFlowCreated: function(namedFlowPayload)
{
var namedFlow = WebInspector.NamedFlow.parsePayload(namedFlowPayload);
var namedFlowCollection = this.<API key>[namedFlow.documentNodeId];
if (!namedFlowCollection)
return;
namedFlowCollection._appendNamedFlow(namedFlow);
this.<API key>(WebInspector.CSSStyleModel.Events.NamedFlowCreated, namedFlow);
},
/**
* @param {DOMAgent.NodeId} documentNodeId
* @param {string} flowName
*/
_namedFlowRemoved: function(documentNodeId, flowName)
{
var namedFlowCollection = this.<API key>[documentNodeId];
if (!namedFlowCollection)
return;
namedFlowCollection._removeNamedFlow(flowName);
this.<API key>(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, { documentNodeId: documentNodeId, flowName: flowName });
},
/**
* @param {CSSAgent.NamedFlow} namedFlowPayload
*/
<API key>: function(namedFlowPayload)
{
var namedFlow = WebInspector.NamedFlow.parsePayload(namedFlowPayload);
var namedFlowCollection = this.<API key>[namedFlow.documentNodeId];
if (!namedFlowCollection)
return;
namedFlowCollection._appendNamedFlow(namedFlow);
this.<API key>(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, namedFlow);
},
/**
* @param {CSSAgent.NamedFlow} namedFlowPayload
*/
<API key>: function(namedFlowPayload)
{
var namedFlow = WebInspector.NamedFlow.parsePayload(namedFlowPayload);
var namedFlowCollection = this.<API key>[namedFlow.documentNodeId];
if (!namedFlowCollection)
return;
namedFlowCollection._appendNamedFlow(namedFlow);
this.<API key>(WebInspector.CSSStyleModel.Events.<API key>, namedFlow);
},
/**
* @param {CSSAgent.StyleSheetId} styleSheetId
* @param {string} newText
* @param {boolean} majorChange
* @param {function(?string)} userCallback
*/
setStyleSheetText: function(styleSheetId, newText, majorChange, userCallback)
{
function callback(error)
{
this.<API key>.pop();
if (!error && majorChange)
WebInspector.domAgent.markUndoableState();
if (!error && userCallback)
userCallback(error);
}
this.<API key>.push(majorChange);
CSSAgent.setStyleSheetText(styleSheetId, newText, callback.bind(this));
},
_undoRedoRequested: function()
{
this.<API key>.push(true);
},
_undoRedoCompleted: function()
{
this.<API key>.pop();
},
<API key>: function()
{
this._resetStyleSheets();
},
_resetStyleSheets: function()
{
/** @type {!Object.<string, !Object.<NetworkAgent.FrameId, !Array.<!CSSAgent.StyleSheetId>>>} */
this.<API key> = {};
/** @type {!Object.<CSSAgent.StyleSheetId, !WebInspector.CSSStyleSheetHeader>} */
this.<API key> = {};
},
<API key>: function()
{
this.<API key> = {};
},
updateLocations: function()
{
var headers = Object.values(this.<API key>);
for (var i = 0; i < headers.length; ++i)
headers[i].updateLocations();
},
/**
* @param {CSSAgent.StyleSheetId} styleSheetId
* @param {WebInspector.CSSLocation} rawLocation
* @param {function(WebInspector.UILocation):(boolean|undefined)} updateDelegate
* @return {?WebInspector.LiveLocation}
*/
createLiveLocation: function(styleSheetId, rawLocation, updateDelegate)
{
if (!rawLocation)
return null;
var header = this.<API key>(styleSheetId);
if (!header)
return null;
return header.createLiveLocation(rawLocation, updateDelegate);
},
/**
* @param {WebInspector.CSSLocation} rawLocation
* @return {?WebInspector.UILocation}
*/
<API key>: function(rawLocation)
{
var frameIdToSheetIds = this.<API key>[rawLocation.url];
if (!frameIdToSheetIds)
return null;
var styleSheetIds = [];
for (var frameId in frameIdToSheetIds)
styleSheetIds = styleSheetIds.concat(frameIdToSheetIds[frameId]);
var uiLocation;
for (var i = 0; !uiLocation && i < styleSheetIds.length; ++i) {
var header = this.<API key>(styleSheetIds[i]);
console.assert(header);
uiLocation = header.<API key>(rawLocation.lineNumber, rawLocation.columnNumber);
}
return uiLocation || null;
},
__proto__: WebInspector.Object.prototype
}
/**
* @constructor
* @extends {WebInspector.LiveLocation}
* @param {WebInspector.CSSLocation} rawLocation
* @param {function(WebInspector.UILocation):(boolean|undefined)} updateDelegate
*/
WebInspector.CSSStyleModel.LiveLocation = function(rawLocation, updateDelegate, header)
{
WebInspector.LiveLocation.call(this, rawLocation, updateDelegate);
this._header = header;
}
WebInspector.CSSStyleModel.LiveLocation.prototype = {
/**
* @return {WebInspector.UILocation}
*/
uiLocation: function()
{
var cssLocation = /** @type WebInspector.CSSLocation */ (this.rawLocation());
return this._header.<API key>(cssLocation.lineNumber, cssLocation.columnNumber);
},
dispose: function()
{
WebInspector.LiveLocation.prototype.dispose.call(this);
this._header._removeLocation(this);
},
__proto__: WebInspector.LiveLocation.prototype
}
/**
* @constructor
* @implements {WebInspector.RawLocation}
* @param {string} url
* @param {number} lineNumber
* @param {number=} columnNumber
*/
WebInspector.CSSLocation = function(url, lineNumber, columnNumber)
{
this.url = url;
this.lineNumber = lineNumber;
this.columnNumber = columnNumber || 0;
}
/**
* @constructor
* @param {CSSAgent.CSSStyle} payload
*/
WebInspector.CSSStyleDeclaration = function(payload)
{
this.id = payload.styleId;
this.width = payload.width;
this.height = payload.height;
this.range = payload.range;
this._shorthandValues = WebInspector.CSSStyleDeclaration.<API key>(payload.shorthandEntries);
this._livePropertyMap = {}; // LIVE properties (source-based or style-based) : { name -> CSSProperty }
this._allProperties = []; // ALL properties: [ CSSProperty ]
this.<API key> = {}; // DISABLED properties: { index -> CSSProperty }
var <API key> = payload.cssProperties.length;
var propertyIndex = 0;
for (var i = 0; i < <API key>; ++i) {
var property = WebInspector.CSSProperty.parsePayload(this, i, payload.cssProperties[i]);
this._allProperties.push(property);
if (property.disabled)
this.<API key>[i] = property;
if (!property.active && !property.styleBased)
continue;
var name = property.name;
this[propertyIndex] = name;
this._livePropertyMap[name] = property;
++propertyIndex;
}
this.length = propertyIndex;
if ("cssText" in payload)
this.cssText = payload.cssText;
}
/**
* @param {Array.<CSSAgent.ShorthandEntry>} shorthandEntries
* @return {Object}
*/
WebInspector.CSSStyleDeclaration.<API key> = function(shorthandEntries)
{
var result = {};
for (var i = 0; i < shorthandEntries.length; ++i)
result[shorthandEntries[i].name] = shorthandEntries[i].value;
return result;
}
/**
* @param {CSSAgent.CSSStyle} payload
* @return {WebInspector.CSSStyleDeclaration}
*/
WebInspector.CSSStyleDeclaration.parsePayload = function(payload)
{
return new WebInspector.CSSStyleDeclaration(payload);
}
/**
* @param {Array.<CSSAgent.<API key>>} payload
* @return {WebInspector.CSSStyleDeclaration}
*/
WebInspector.CSSStyleDeclaration.<API key> = function(payload)
{
var newPayload = /** @type {CSSAgent.CSSStyle} */ ({ cssProperties: [], shorthandEntries: [], width: "", height: "" });
if (payload)
newPayload.cssProperties = payload;
return new WebInspector.CSSStyleDeclaration(newPayload);
}
WebInspector.CSSStyleDeclaration.prototype = {
get allProperties()
{
return this._allProperties;
},
/**
* @param {string} name
* @return {WebInspector.CSSProperty|undefined}
*/
getLiveProperty: function(name)
{
return this._livePropertyMap[name];
},
/**
* @param {string} name
* @return {string}
*/
getPropertyValue: function(name)
{
var property = this._livePropertyMap[name];
return property ? property.value : "";
},
/**
* @param {string} name
* @return {string}
*/
getPropertyPriority: function(name)
{
var property = this._livePropertyMap[name];
return property ? property.priority : "";
},
/**
* @param {string} name
* @return {boolean}
*/
isPropertyImplicit: function(name)
{
var property = this._livePropertyMap[name];
return property ? property.implicit : "";
},
/**
* @param {string} name
* @return {Array.<WebInspector.CSSProperty>}
*/
longhandProperties: function(name)
{
var longhands = WebInspector.CSSMetadata.<API key>.longhands(name);
var result = [];
for (var i = 0; longhands && i < longhands.length; ++i) {
var property = this._livePropertyMap[longhands[i]];
if (property)
result.push(property);
}
return result;
},
/**
* @param {string} shorthandProperty
* @return {string}
*/
shorthandValue: function(shorthandProperty)
{
return this._shorthandValues[shorthandProperty];
},
/**
* @param {number} index
* @return {?WebInspector.CSSProperty}
*/
propertyAt: function(index)
{
return (index < this.allProperties.length) ? this.allProperties[index] : null;
},
/**
* @return {number}
*/
<API key>: function()
{
for (var i = this.allProperties.length - 1; i >= 0; --i) {
var property = this.allProperties[i];
if (property.active || property.disabled)
return i + 1;
}
return 0;
},
/**
* @param {number=} index
*/
newBlankProperty: function(index)
{
index = (typeof index === "undefined") ? this.<API key>() : index;
return new WebInspector.CSSProperty(this, index, "", "", "", "active", true, false, "");
},
/**
* @param {number} index
* @param {string} name
* @param {string} value
* @param {function(?WebInspector.CSSStyleDeclaration)=} userCallback
*/
insertPropertyAt: function(index, name, value, userCallback)
{
/**
* @param {?string} error
* @param {CSSAgent.CSSStyle} payload
*/
function callback(error, payload)
{
WebInspector.cssModel.<API key>.pop();
if (!userCallback)
return;
if (error) {
console.error(error);
userCallback(null);
} else
userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));
}
if (!this.id)
throw "No style id";
WebInspector.cssModel.<API key>.push(true);
CSSAgent.setPropertyText(this.id, index, name + ": " + value + ";", false, callback.bind(this));
},
/**
* @param {string} name
* @param {string} value
* @param {function(?WebInspector.CSSStyleDeclaration)=} userCallback
*/
appendProperty: function(name, value, userCallback)
{
this.insertPropertyAt(this.allProperties.length, name, value, userCallback);
},
/**
* @param {string} text
* @param {function(?WebInspector.CSSStyleDeclaration)=} userCallback
*/
setText: function(text, userCallback)
{
/**
* @param {?string} error
* @param {CSSAgent.CSSStyle} payload
*/
function callback(error, payload)
{
WebInspector.cssModel.<API key>.pop();
if (!userCallback)
return;
if (error) {
console.error(error);
userCallback(null);
} else
userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));
}
if (!this.id)
throw "No style id";
if (typeof this.cssText === "undefined") {
userCallback(null);
return;
}
WebInspector.cssModel.<API key>.push(true);
CSSAgent.setStyleText(this.id, text, callback);
}
}
/**
* @constructor
* @param {CSSAgent.CSSRule} payload
* @param {Array.<number>=} matchingSelectors
*/
WebInspector.CSSRule = function(payload, matchingSelectors)
{
this.id = payload.ruleId;
if (matchingSelectors)
this.matchingSelectors = matchingSelectors;
this.selectors = payload.selectorList.selectors;
this.selectorText = this.selectors.join(", ");
this.selectorRange = payload.selectorList.range;
this.sourceURL = payload.sourceURL;
this.origin = payload.origin;
this.style = WebInspector.CSSStyleDeclaration.parsePayload(payload.style);
this.style.parentRule = this;
if (payload.media)
this.media = WebInspector.CSSMedia.<API key>(payload.media);
this.<API key>();
}
/**
* @param {CSSAgent.CSSRule} payload
* @param {Array.<number>=} matchingIndices
* @return {WebInspector.CSSRule}
*/
WebInspector.CSSRule.parsePayload = function(payload, matchingIndices)
{
return new WebInspector.CSSRule(payload, matchingIndices);
}
WebInspector.CSSRule.prototype = {
<API key>: function()
{
if (!this.id)
return;
var styleSheetHeader = WebInspector.cssModel.<API key>(this.id.styleSheetId);
this.frameId = styleSheetHeader.frameId;
var url = styleSheetHeader.resourceURL();
if (!url)
return;
this.rawLocation = new WebInspector.CSSLocation(url, this.lineNumberInSource(), this.<API key>());
},
/**
* @return {string}
*/
resourceURL: function()
{
if (!this.id)
return "";
var styleSheetHeader = WebInspector.cssModel.<API key>(this.id.styleSheetId);
return styleSheetHeader.resourceURL();
},
/**
* @return {number}
*/
lineNumberInSource: function()
{
if (!this.selectorRange)
return 0;
var styleSheetHeader = WebInspector.cssModel.<API key>(this.id.styleSheetId);
return styleSheetHeader.lineNumberInSource(this.selectorRange.startLine);
},
/**
* @return {number|undefined}
*/
<API key>: function()
{
if (!this.selectorRange)
return undefined;
var styleSheetHeader = WebInspector.cssModel.<API key>(this.id.styleSheetId);
console.assert(styleSheetHeader);
return styleSheetHeader.<API key>(this.selectorRange.startLine, this.selectorRange.startColumn);
},
get isUserAgent()
{
return this.origin === "user-agent";
},
get isUser()
{
return this.origin === "user";
},
get isViaInspector()
{
return this.origin === "inspector";
},
get isRegular()
{
return this.origin === "regular";
}
}
/**
* @constructor
* @param {?WebInspector.CSSStyleDeclaration} ownerStyle
* @param {number} index
* @param {string} name
* @param {string} value
* @param {?string} priority
* @param {string} status
* @param {boolean} parsedOk
* @param {boolean} implicit
* @param {?string=} text
* @param {CSSAgent.SourceRange=} range
*/
WebInspector.CSSProperty = function(ownerStyle, index, name, value, priority, status, parsedOk, implicit, text, range)
{
this.ownerStyle = ownerStyle;
this.index = index;
this.name = name;
this.value = value;
this.priority = priority;
this.status = status;
this.parsedOk = parsedOk;
this.implicit = implicit;
this.text = text;
this.range = range;
}
/**
* @param {?WebInspector.CSSStyleDeclaration} ownerStyle
* @param {number} index
* @param {CSSAgent.CSSProperty} payload
* @return {WebInspector.CSSProperty}
*/
WebInspector.CSSProperty.parsePayload = function(ownerStyle, index, payload)
{
// The following default field values are used in the payload:
// priority: ""
// parsedOk: true
// implicit: false
// status: "style"
var result = new WebInspector.CSSProperty(
ownerStyle, index, payload.name, payload.value, payload.priority || "", payload.status || "style", ("parsedOk" in payload) ? !!payload.parsedOk : true, !!payload.implicit, payload.text, payload.range);
return result;
}
WebInspector.CSSProperty.prototype = {
get propertyText()
{
if (this.text !== undefined)
return this.text;
if (this.name === "")
return "";
return this.name + ": " + this.value + (this.priority ? " !" + this.priority : "") + ";";
},
get isLive()
{
return this.active || this.styleBased;
},
get active()
{
return this.status === "active";
},
get styleBased()
{
return this.status === "style";
},
get inactive()
{
return this.status === "inactive";
},
get disabled()
{
return this.status === "disabled";
},
/**
* Replaces "propertyName: propertyValue [!important];" in the stylesheet by an arbitrary propertyText.
*
* @param {string} propertyText
* @param {boolean} majorChange
* @param {boolean} overwrite
* @param {function(?WebInspector.CSSStyleDeclaration)=} userCallback
*/
setText: function(propertyText, majorChange, overwrite, userCallback)
{
/**
* @param {?WebInspector.CSSStyleDeclaration} style
*/
function enabledCallback(style)
{
if (userCallback)
userCallback(style);
}
/**
* @param {?string} error
* @param {?CSSAgent.CSSStyle} stylePayload
*/
function callback(error, stylePayload)
{
WebInspector.cssModel.<API key>.pop();
if (!error) {
if (majorChange)
WebInspector.domAgent.markUndoableState();
this.text = propertyText;
var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
var newProperty = style.allProperties[this.index];
if (newProperty && this.disabled && !propertyText.match(/^\s*$/)) {
newProperty.setDisabled(false, enabledCallback);
return;
}
if (userCallback)
userCallback(style);
} else {
if (userCallback)
userCallback(null);
}
}
if (!this.ownerStyle)
throw "No ownerStyle for property";
if (!this.ownerStyle.id)
throw "No owner style id";
// An index past all the properties adds a new property to the style.
WebInspector.cssModel.<API key>.push(majorChange);
CSSAgent.setPropertyText(this.ownerStyle.id, this.index, propertyText, overwrite, callback.bind(this));
},
/**
* @param {string} newValue
* @param {boolean} majorChange
* @param {boolean} overwrite
* @param {function(?WebInspector.CSSStyleDeclaration)=} userCallback
*/
setValue: function(newValue, majorChange, overwrite, userCallback)
{
var text = this.name + ": " + newValue + (this.priority ? " !" + this.priority : "") + ";"
this.setText(text, majorChange, overwrite, userCallback);
},
/**
* @param {boolean} disabled
* @param {function(?WebInspector.CSSStyleDeclaration)=} userCallback
*/
setDisabled: function(disabled, userCallback)
{
if (!this.ownerStyle && userCallback)
userCallback(null);
if (disabled === this.disabled && userCallback)
userCallback(this.ownerStyle);
/**
* @param {?string} error
* @param {CSSAgent.CSSStyle} stylePayload
*/
function callback(error, stylePayload)
{
WebInspector.cssModel.<API key>.pop();
if (error) {
if (userCallback)
userCallback(null);
return;
}
WebInspector.domAgent.markUndoableState();
if (userCallback) {
var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
userCallback(style);
}
}
if (!this.ownerStyle.id)
throw "No owner style id";
WebInspector.cssModel.<API key>.push(false);
CSSAgent.toggleProperty(this.ownerStyle.id, this.index, disabled, callback.bind(this));
},
/**
* @param {boolean} forName
* @return {WebInspector.UILocation}
*/
uiLocation: function(forName)
{
if (!this.range || !this.ownerStyle || !this.ownerStyle.parentRule)
return null;
var url = this.ownerStyle.parentRule.resourceURL();
if (!url)
return null;
var range = this.range;
var line = forName ? range.startLine : range.endLine;
// End of range is exclusive, so subtract 1 from the end offset.
var column = forName ? range.startColumn : range.endColumn - (this.text && this.text.endsWith(";") ? 2 : 1);
var rawLocation = new WebInspector.CSSLocation(url, line, column);
return WebInspector.cssModel.<API key>(rawLocation);
}
}
/**
* @constructor
* @param {CSSAgent.CSSMedia} payload
*/
WebInspector.CSSMedia = function(payload)
{
this.text = payload.text;
this.source = payload.source;
this.sourceURL = payload.sourceURL || "";
this.range = payload.range;
this.parentStyleSheetId = payload.parentStyleSheetId;
}
WebInspector.CSSMedia.Source = {
LINKED_SHEET: "linkedSheet",
INLINE_SHEET: "inlineSheet",
MEDIA_RULE: "mediaRule",
IMPORT_RULE: "importRule"
};
/**
* @param {CSSAgent.CSSMedia} payload
* @return {WebInspector.CSSMedia}
*/
WebInspector.CSSMedia.parsePayload = function(payload)
{
return new WebInspector.CSSMedia(payload);
}
/**
* @param {Array.<CSSAgent.CSSMedia>} payload
* @return {Array.<WebInspector.CSSMedia>}
*/
WebInspector.CSSMedia.<API key> = function(payload)
{
var result = [];
for (var i = 0; i < payload.length; ++i)
result.push(WebInspector.CSSMedia.parsePayload(payload[i]));
return result;
}
WebInspector.CSSMedia.prototype = {
/**
* @return {number|undefined}
*/
lineNumberInSource: function()
{
if (!this.range)
return undefined;
var header = this.header();
if (!header)
return undefined;
return header.lineNumberInSource(this.range.startLine);
},
/**
* @return {number|undefined}
*/
<API key>: function()
{
if (!this.range)
return undefined;
var header = this.header();
if (!header)
return undefined;
return header.<API key>(this.range.startLine, this.range.startColumn);
},
/**
* @return {?WebInspector.CSSStyleSheetHeader}
*/
header: function()
{
return this.parentStyleSheetId ? WebInspector.cssModel.<API key>(this.parentStyleSheetId) : null;
}
}
/**
* @constructor
* @implements {WebInspector.ContentProvider}
* @param {CSSAgent.CSSStyleSheetHeader} payload
*/
WebInspector.CSSStyleSheetHeader = function(payload)
{
this.id = payload.styleSheetId;
this.frameId = payload.frameId;
this.sourceURL = payload.sourceURL;
this.hasSourceURL = !!payload.hasSourceURL;
this.sourceMapURL = payload.sourceMapURL;
this.origin = payload.origin;
this.title = payload.title;
this.disabled = payload.disabled;
this.isInline = payload.isInline;
this.startLine = payload.startLine;
this.startColumn = payload.startColumn;
/** @type {!Set.<!WebInspector.CSSStyleModel.LiveLocation>} */
this._locations = new Set();
/** @type {!Array.<!WebInspector.SourceMapping>} */
this._sourceMappings = [];
}
WebInspector.CSSStyleSheetHeader.prototype = {
/**
* @return {string}
*/
resourceURL: function()
{
return this.origin === "inspector" ? this.<API key>() : this.sourceURL;
},
/**
* @param {WebInspector.CSSLocation} rawLocation
* @param {function(WebInspector.UILocation):(boolean|undefined)} updateDelegate
* @return {?WebInspector.LiveLocation}
*/
createLiveLocation: function(rawLocation, updateDelegate)
{
var location = new WebInspector.CSSStyleModel.LiveLocation(rawLocation, updateDelegate, this);
this._locations.add(location);
location.update();
return location;
},
updateLocations: function()
{
var items = this._locations.items();
for (var i = 0; i < items.length; ++i)
items[i].update();
},
/**
* @param {!WebInspector.CSSStyleModel.LiveLocation} location
*/
_removeLocation: function(location)
{
this._locations.remove(location);
},
/**
* @param {number} lineNumber
* @param {number=} columnNumber
* @return {?WebInspector.UILocation}
*/
<API key>: function(lineNumber, columnNumber)
{
var uiLocation;
var rawLocation = new WebInspector.CSSLocation(this.resourceURL(), lineNumber, columnNumber || 0);
for (var i = this._sourceMappings.length - 1; !uiLocation && i >= 0; --i)
uiLocation = this._sourceMappings[i].<API key>(rawLocation);
return uiLocation || null;
},
/**
* @param {!WebInspector.SourceMapping} sourceMapping
*/
pushSourceMapping: function(sourceMapping)
{
this._sourceMappings.push(sourceMapping);
this.updateLocations();
},
/**
* @return {string}
*/
_key: function()
{
return this.frameId + ":" + this.resourceURL();
},
/**
* @return {string}
*/
<API key>: function()
{
var frame = WebInspector.resourceTreeModel.frameForId(this.frameId);
console.assert(frame);
var parsedURL = new WebInspector.ParsedURL(frame.url);
var fakeURL = "inspector://" + parsedURL.host + parsedURL.<API key>;
if (!fakeURL.endsWith("/"))
fakeURL += "/";
fakeURL += "<API key>";
return fakeURL;
},
/**
* @param {number} <API key>
* @return {number}
*/
lineNumberInSource: function(<API key>)
{
return this.startLine + <API key>;
},
/**
* @param {number} <API key>
* @param {number} <API key>
* @return {number|undefined}
*/
<API key>: function(<API key>, <API key>)
{
return (<API key> ? 0 : this.startColumn) + <API key>;
},
/**
* @override
*/
contentURL: function()
{
return this.resourceURL();
},
/**
* @override
*/
contentType: function()
{
return WebInspector.resourceTypes.Stylesheet;
},
/**
* @override
*/
requestContent: function(callback)
{
CSSAgent.getStyleSheetText(this.id, textCallback.bind(this));
function textCallback(error, text)
{
if (error) {
WebInspector.log("Failed to get text for stylesheet " + this.id + ": " + error);
text = "";
// Fall through.
}
callback(text, false, "text/css");
}
},
/**
* @override
*/
searchInContent: function(query, caseSensitive, isRegex, callback)
{
function performSearch(content)
{
callback(WebInspector.ContentProvider.<API key>(content, query, caseSensitive, isRegex));
}
// searchInContent should call back later.
this.requestContent(performSearch);
}
}
/**
* @constructor
* @param {CSSAgent.CSSStyleSheetBody} payload
*/
WebInspector.CSSStyleSheet = function(payload)
{
this.id = payload.styleSheetId;
this.rules = [];
this.styles = {};
for (var i = 0; i < payload.rules.length; ++i) {
var rule = WebInspector.CSSRule.parsePayload(payload.rules[i]);
this.rules.push(rule);
if (rule.style)
this.styles[rule.style.id] = rule.style;
}
if ("text" in payload)
this._text = payload.text;
}
/**
* @param {CSSAgent.StyleSheetId} styleSheetId
* @param {function(?WebInspector.CSSStyleSheet)} userCallback
*/
WebInspector.CSSStyleSheet.createForId = function(styleSheetId, userCallback)
{
/**
* @param {?string} error
* @param {CSSAgent.CSSStyleSheetBody} styleSheetPayload
*/
function callback(error, styleSheetPayload)
{
if (error)
userCallback(null);
else
userCallback(new WebInspector.CSSStyleSheet(styleSheetPayload));
}
CSSAgent.getStyleSheet(styleSheetId, callback.bind(this));
}
WebInspector.CSSStyleSheet.prototype = {
/**
* @return {string|undefined}
*/
getText: function()
{
return this._text;
},
/**
* @param {string} newText
* @param {boolean} majorChange
* @param {function(?string)=} userCallback
*/
setText: function(newText, majorChange, userCallback)
{
/**
* @param {?string} error
*/
function callback(error)
{
if (!error)
WebInspector.domAgent.markUndoableState();
WebInspector.cssModel.<API key>.pop();
if (userCallback)
userCallback(error);
}
WebInspector.cssModel.<API key>.push(majorChange);
CSSAgent.setStyleSheetText(this.id, newText, callback.bind(this));
}
}
/**
* @constructor
* @implements {CSSAgent.Dispatcher}
* @param {WebInspector.CSSStyleModel} cssModel
*/
WebInspector.CSSDispatcher = function(cssModel)
{
this._cssModel = cssModel;
}
WebInspector.CSSDispatcher.prototype = {
<API key>: function()
{
this._cssModel.<API key>();
},
/**
* @param {CSSAgent.StyleSheetId} styleSheetId
*/
styleSheetChanged: function(styleSheetId)
{
this._cssModel.<API key>(styleSheetId);
},
/**
* @param {CSSAgent.CSSStyleSheetHeader} header
*/
styleSheetAdded: function(header)
{
this._cssModel._styleSheetAdded(header);
},
/**
* @param {CSSAgent.StyleSheetId} id
*/
styleSheetRemoved: function(id)
{
this._cssModel._styleSheetRemoved(id);
},
/**
* @param {CSSAgent.NamedFlow} namedFlowPayload
*/
namedFlowCreated: function(namedFlowPayload)
{
this._cssModel._namedFlowCreated(namedFlowPayload);
},
/**
* @param {DOMAgent.NodeId} documentNodeId
* @param {string} flowName
*/
namedFlowRemoved: function(documentNodeId, flowName)
{
this._cssModel._namedFlowRemoved(documentNodeId, flowName);
},
/**
* @param {CSSAgent.NamedFlow} namedFlowPayload
*/
regionLayoutUpdated: function(namedFlowPayload)
{
this._cssModel.<API key>(namedFlowPayload);
},
/**
* @param {CSSAgent.NamedFlow} namedFlowPayload
*/
<API key>: function(namedFlowPayload)
{
this._cssModel.<API key>(namedFlowPayload);
}
}
/**
* @constructor
* @param {CSSAgent.NamedFlow} payload
*/
WebInspector.NamedFlow = function(payload)
{
this.documentNodeId = payload.documentNodeId;
this.name = payload.name;
this.overset = payload.overset;
this.content = payload.content;
this.regions = payload.regions;
}
/**
* @param {CSSAgent.NamedFlow} payload
* @return {WebInspector.NamedFlow}
*/
WebInspector.NamedFlow.parsePayload = function(payload)
{
return new WebInspector.NamedFlow(payload);
}
/**
* @constructor
* @param {Array.<CSSAgent.NamedFlow>} payload
*/
WebInspector.NamedFlowCollection = function(payload)
{
/** @type {Object.<string, WebInspector.NamedFlow>} */
this.namedFlowMap = {};
for (var i = 0; i < payload.length; ++i) {
var namedFlow = WebInspector.NamedFlow.parsePayload(payload[i]);
this.namedFlowMap[namedFlow.name] = namedFlow;
}
}
WebInspector.NamedFlowCollection.prototype = {
/**
* @param {WebInspector.NamedFlow} namedFlow
*/
_appendNamedFlow: function(namedFlow)
{
this.namedFlowMap[namedFlow.name] = namedFlow;
},
/**
* @param {string} flowName
*/
_removeNamedFlow: function(flowName)
{
delete this.namedFlowMap[flowName];
},
/**
* @param {string} flowName
* @return {WebInspector.NamedFlow}
*/
flowByName: function(flowName)
{
var namedFlow = this.namedFlowMap[flowName];
if (!namedFlow)
return null;
return namedFlow;
}
}
/**
* @type {WebInspector.CSSStyleModel}
*/
WebInspector.cssModel = null; |
using System;
using System.IO;
using System.Text;
namespace Aoite.Serialization
{
<summary>
</summary>
public class ObjectReader : ObjectFormatterBase
{
<summary>
16
</summary>
internal readonly byte[] DefaultBuffer = new byte[16];
<summary>
<see cref="ObjectReader"/>
</summary>
<param name="stream"></param>
<param name="encoding"></param>
public ObjectReader(Stream stream, Encoding encoding)
: base(stream, encoding)
{
if(!stream.CanRead) throw new <API key>("");
}
<summary>
</summary>
<returns></returns>
public object Deserialize()
{
var tag = (FormatterTag)this.Stream.ReadByte();
switch(tag)
{
case FormatterTag.Reference: return this.ReadReference();
case FormatterTag.Null: return null;
case FormatterTag.SuccessfullyResult: return Result.Successfully;
case FormatterTag.DBNull: return DBNull.Value;
case FormatterTag.Guid: return this.ReadGuid();
case FormatterTag.DateTime: return this.ReadDateTime();
case FormatterTag.TimeSpan: return this.ReadTimeSpan();
case FormatterTag.Boolean: return this.ReadBoolean();
case FormatterTag.Byte: return this.ReadByte();
case FormatterTag.SByte: return this.ReadSByte();
case FormatterTag.Char: return this.ReadChar();
case FormatterTag.Int16: return this.ReadInt16();
case FormatterTag.Int32: return this.ReadInt32();
case FormatterTag.Int64: return this.ReadInt64();
case FormatterTag.UInt16: return this.ReadUInt16();
case FormatterTag.UInt32: return this.ReadUInt32();
case FormatterTag.UInt64: return this.ReadUInt64();
case FormatterTag.Single: return this.ReadSingle();
case FormatterTag.Double: return this.ReadDouble();
case FormatterTag.Decimal: return this.ReadDecimal();
case FormatterTag.ValueTypeObject: return this.ReadValueTypeObject();
}
var index = this.ReferenceContainer.Count;
this.ReferenceContainer.Add(null);
object value;
switch(tag)
{
case FormatterTag.Result: return this.ReadResult(index);
case FormatterTag.GResult: return this.ReadGResult(index);
case FormatterTag.Array: return this.ReadSimpleArray(index);
case FormatterTag.MultiRankArray: return this.ReadMultiRankArray(index);
case FormatterTag.GList: return this.ReadGList(index);
case FormatterTag.GDictionary: return this.ReadGDictionary(index);
case FormatterTag.<API key>: return this.<API key>(index);
case FormatterTag.HybridDictionary: return this.<API key>(index);
case FormatterTag.Custom: return this.ReadCustom(index);
case FormatterTag.Object: return this.ReadObject(index);
case FormatterTag.ObjectArray: return this.ReadObjectArray(index);
case FormatterTag.Type:
value = this.ReadType();
break;
case FormatterTag.TypeArray:
value = this.ReadTypeArray();
break;
case FormatterTag.GuidArray:
value = this.ReadGuidArray();
break;
case FormatterTag.DateTimeArray:
value = this.ReadDateTimeArray();
break;
case FormatterTag.TimeSpanArray:
value = this.ReadTimeSpanArray();
break;
case FormatterTag.BooleanArray:
value = this.ReadBooleanArray();
break;
case FormatterTag.ByteArray:
value = this.ReadByteArray();
break;
case FormatterTag.SByteArray:
value = this.ReadSByteArray();
break;
case FormatterTag.CharArray:
value = this.ReadCharArray();
break;
case FormatterTag.Int16Array:
value = this.ReadInt16Array();
break;
case FormatterTag.Int32Array:
value = this.ReadInt32Array();
break;
case FormatterTag.Int64Array:
value = this.ReadInt64Array();
break;
case FormatterTag.UInt16Array:
value = this.ReadUInt16Array();
break;
case FormatterTag.UInt32Array:
value = this.ReadUInt32Array();
break;
case FormatterTag.UInt64Array:
value = this.ReadUInt64Array();
break;
case FormatterTag.SingleArray:
value = this.ReadSingleArray();
break;
case FormatterTag.DoubleArray:
value = this.ReadDoubleArray();
break;
case FormatterTag.DecimalArray:
value = this.ReadDecimalArray();
break;
case FormatterTag.String:
value = this.ReadString();
break;
case FormatterTag.StringArray:
value = this.ReadStringArray();
break;
case FormatterTag.StringBuilder:
value = this.ReadStringBuilder();
break;
case FormatterTag.StringBuilderArray:
value = this.<API key>();
break;
default:
throw new ArgumentException(tag + "");
}
this.ReferenceContainer[index] = value;
return value;
}
}
} |
## O2 Platform support for WebGoat
_(just sent to the OWASP WebGoat mailing list)_
Hi WebGoat Crowd
I finally started adding support for WebGoat to the [OWASP O2 Platform](http:
At the moment there is a first pass at an API for WebGoat (see [API_WebGoat.cs](http:
So far the following browser-driven UnitTests/WebAutomation workflows have been implemented:
* Download the latest version of WebGoat (starting in the OWASP website and ending with the download 'save as' pop-up from Google Code)
* Start a local copy of WebGoat
* Open the WebGoat HomePage (with support for auto submitting the WebGoat's Basic Auth requirement (using guest:guest), and clicking on the 'Start WebGoat' button)
* Complete the Lab: "Cross-Site Scripting (XSS) --> LAB: Cross Site Scripting --> Stage 1: Stored XSS " using two injection points: the "address1" field (which is vulnerable to XSS) and the "description" field (which is NOT vulnerable to XSS)
The Stored XSS lesson is a good example of O2's powerful web automation capabilities (using WatiN's engine on top of IE) since it shows how complex web workflows can be easily created, tested and packaged:
[Test]
public string <API key>()
{
return <API key>("address1");
}
[Test]
public string <API key>()
{
return <API key>("description");
}
private string <API key>(string <API key>)
{
setup();
var payload = "[Over me to see xss](http:
webGoat.openMainPage();
ie.link("Cross-Site Scripting (XSS)").flash().click();
ie.link("LAB: Cross Site Scripting").flash().click();
ie.link("Stage 1: Stored XSS").flash();
ie.field("password").flash().value("larry");
ie.button("Login").flash().click();
ie.selectLists()[1].options()[0].select().flash();
ie.button("ViewProfile").flash().click();
ie.button("EditProfile").flash().click();
ie.field(<API key>).value(payload).flash();
ie.button("UpdateProfile").flash().click();
Assert.That(ie.html().contains("onmouseover=\"javascript:alert('xss')\""), "Payload was not inserted into page");
return "ok";
}
The sample code above (from [<API key>.cs](http:
For example:
**_ie.link("LAB: Cross Site Scripting").flash().click();_**
will:
* in the current page, find the link called "Lab: Cross Site Scripting"
* flash the link 3 times (i.e. scroll the browser to the current page location of the link (which could be outside the user's view) and set its background color to yellow for a couple seconds)
* click on the link
* wait for the linked page to load completely before continuing execution
**_ie.field("password").flash().value("larry");_**
will:
* find the field called "password" in the current page
* flash it 3 times
* set the value of the field to "larry"
_**ie.selectLists()[1].options()[0].select().flash();**_
will:
* get a list of 'Selection Lists' from the current page (these are also called DropDownList/ComboBox)
* select the 2nd SelectionList (we couldn't get the reference using the name since its HtmlElement didn't seem to have a value that could be used to find it)
* get the current Options of the chosen SelectionList (this is the list of the DropDownList options/values)
* chose the first option and selected it
* Flash the selected option so the user can see which one we chose
Hopefully this all makes sense, and you (webGoat community) can now continue this from here.
Ideally we should have all WebGoat Lessons mapped using these Security UnitTests, and once that is done, create a 'secure version of WebGoat' that passes all those UnitTests (assuming the UnitTests are designed to succeed when the vulnerability was exploited)
Please have a go and let me know if you have any problems or ideas on how to improve it (see the video on [http:
Dinis Cruz |
package tscfg.example;
public class JavaIssue13Cfg {
public final JavaIssue13Cfg.Issue issue;
public static class Issue {
public final java.lang.String optionalFoo;
public Issue(com.typesafe.config.Config c, java.lang.String parentPath, $TsCfgValidator $tsCfgValidator) {
this.optionalFoo = c.hasPathOrNull("optionalFoo") ? c.getString("optionalFoo") : null;
}
}
public JavaIssue13Cfg(com.typesafe.config.Config c) {
final $TsCfgValidator $tsCfgValidator = new $TsCfgValidator();
final java.lang.String parentPath = "";
this.issue = c.hasPathOrNull("issue") ? new JavaIssue13Cfg.Issue(c.getConfig("issue"), parentPath + "issue.", $tsCfgValidator) : new JavaIssue13Cfg.Issue(com.typesafe.config.ConfigFactory.parseString("issue{}"), parentPath + "issue.", $tsCfgValidator);
$tsCfgValidator.validate();
}
private static final class $TsCfgValidator {
private final java.util.List<java.lang.String> badPaths = new java.util.ArrayList<>();
void addBadPath(java.lang.String path, com.typesafe.config.ConfigException e) {
badPaths.add("'" + path + "': " + e.getClass().getName() + "(" + e.getMessage() + ")");
}
void validate() {
if (!badPaths.isEmpty()) {
java.lang.StringBuilder sb = new java.lang.StringBuilder("Invalid configuration:");
for (java.lang.String path : badPaths) {
sb.append("\n ").append(path);
}
throw new com.typesafe.config.ConfigException(sb.toString()) {};
}
}
}
} |
# AUTOGENERATED FILE
FROM balenalib/<API key>:33-build
RUN dnf -y update \
&& dnf clean all \
&& dnf -y install \
gzip \
java-1.8.0-openjdk \
java-1.8.0-openjdk-devel \
tar \
&& dnf clean all
# set JAVA_HOME
ENV JAVA_HOME /usr/lib/jvm/java-openjdk
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https:
RUN echo $'#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh |
<?php
final class <API key>
extends <API key> {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$request = $this->getRequest();
$viewer = $request->getViewer();
$response = $this->loadProject();
if ($response) {
return $response;
}
$project = $this->getProject();
$engine = $this-><API key>();
$default = $engine->getDefaultItem();
switch ($default->getBuiltinKey()) {
case PhabricatorProject::ITEM_WORKBOARD:
$controller_object = new <API key>();
break;
case PhabricatorProject::ITEM_PROFILE:
default:
$controller_object = new <API key>();
break;
}
return $this-><API key>($controller_object);
}
} |
<!DOCTYPE html>
<html lang="en">
<head>
<title>Pixel</title>
<meta charset="utf-8">
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<link rel="stylesheet" href="stylesheets/styles.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js"></script>
<script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script>
<script src="https://code.createjs.com/easeljs-0.8.2.min.js"></script>
<script src="scripts/pixel-config.js"></script>
<script src="scripts/PixelSocket.js"></script>
<script src="scripts/main.js"></script>
</head>
<body>
<canvas id="pixelCanvas"></canvas>
</body>
</html> |
<?php
namespace Google\AdsApi\AdManager\v202202;
/**
* This file was generated from WSDL. DO NOT EDIT.
*/
class CdnConfiguration
{
/**
* @var int $id
*/
protected $id = null;
/**
* @var string $name
*/
protected $name = null;
/**
* @var string $<API key>
*/
protected $<API key> = null;
/**
* @var \Google\AdsApi\AdManager\v202202\<API key> $<API key>
*/
protected $<API key> = null;
/**
* @var string $<API key>
*/
protected $<API key> = null;
/**
* @param int $id
* @param string $name
* @param string $<API key>
* @param \Google\AdsApi\AdManager\v202202\<API key> $<API key>
* @param string $<API key>
*/
public function __construct($id = null, $name = null, $<API key> = null, $<API key> = null, $<API key> = null)
{
$this->id = $id;
$this->name = $name;
$this-><API key> = $<API key>;
$this-><API key> = $<API key>;
$this-><API key> = $<API key>;
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
* @return \Google\AdsApi\AdManager\v202202\CdnConfiguration
*/
public function setId($id)
{
$this->id = (!is_null($id) && PHP_INT_SIZE === 4)
? floatval($id) : $id;
return $this;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
* @return \Google\AdsApi\AdManager\v202202\CdnConfiguration
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function <API key>()
{
return $this-><API key>;
}
/**
* @param string $<API key>
* @return \Google\AdsApi\AdManager\v202202\CdnConfiguration
*/
public function <API key>($<API key>)
{
$this-><API key> = $<API key>;
return $this;
}
/**
* @return \Google\AdsApi\AdManager\v202202\<API key>
*/
public function <API key>()
{
return $this-><API key>;
}
/**
* @param \Google\AdsApi\AdManager\v202202\<API key> $<API key>
* @return \Google\AdsApi\AdManager\v202202\CdnConfiguration
*/
public function <API key>($<API key>)
{
$this-><API key> = $<API key>;
return $this;
}
/**
* @return string
*/
public function <API key>()
{
return $this-><API key>;
}
/**
* @param string $<API key>
* @return \Google\AdsApi\AdManager\v202202\CdnConfiguration
*/
public function <API key>($<API key>)
{
$this-><API key> = $<API key>;
return $this;
}
} |
// Bug-1174
#include "Bug-1174.h"
USING_NS_CC;
int check_for_error( Vec2 p1, Vec2 p2, Vec2 p3, Vec2 p4, float s, float t );
int check_for_error( Vec2 p1, Vec2 p2, Vec2 p3, Vec2 p4, float s, float t )
{
// the hit point is p3 + t * (p4 - p3);
// the hit point also is p1 + s * (p2 - p1);
auto p4_p3 = p4 - p3;
auto p4_p3_t = p4_p3 * t;
auto hitPoint1 = p3 + p4_p3_t;
auto p2_p1 = p2 - p1;
auto p2_p1_s = p2_p1 * s;
auto hitPoint2 = p1 + p2_p1_s;
// Since float has rounding errors, only check if diff is < 0.05
if( (fabs( hitPoint1.x - hitPoint2.x) > 0.1f) || ( fabs(hitPoint1.y - hitPoint2.y) > 0.1f) )
{
log("ERROR: (%f,%f) != (%f,%f)", hitPoint1.x, hitPoint1.y, hitPoint2.x, hitPoint2.y);
return 1;
}
return 0;
}
bool Bug1174Layer::init()
{
if (BugsTestBase::init())
{
// // seed
// std::srand(0);
Vec2 A,B,C,D,p1,p2,p3,p4;
float s,t;
int err=0;
int ok=0;
// Test 1.
log("Test1 - Start");
for( int i=0; i < 10000; i++)
{
// A | b
// c | d
float ax = CCRANDOM_0_1() * -5000;
float ay = CCRANDOM_0_1() * 5000;
// a | b
// c | D
float dx = CCRANDOM_0_1() * 5000;
float dy = CCRANDOM_0_1() * -5000;
// a | B
// c | d
float bx = CCRANDOM_0_1() * 5000;
float by = CCRANDOM_0_1() * 5000;
// a | b
// C | d
float cx = CCRANDOM_0_1() * -5000;
float cy = CCRANDOM_0_1() * -5000;
A = Vec2(ax,ay);
B = Vec2(bx,by);
C = Vec2(cx,cy);
D = Vec2(dx,dy);
if( Vec2::isLineIntersect( A, D, B, C, &s, &t) ) {
if( check_for_error(A, D, B, C, s, t) )
err++;
else
ok++;
}
}
log("Test1 - End. OK=%i, Err=%i", ok, err);
// Test 2.
log("Test2 - Start");
p1 = Vec2(220,480);
p2 = Vec2(304,325);
p3 = Vec2(264,416);
p4 = Vec2(186,416);
s = 0.0f;
t = 0.0f;
if( Vec2::isLineIntersect(p1, p2, p3, p4, &s, &t) )
check_for_error(p1, p2, p3, p4, s,t );
log("Test2 - End");
// Test 3
log("Test3 - Start");
ok=0;
err=0;
for( int i=0;i<10000;i++)
{
// A | b
// c | d
float ax = CCRANDOM_0_1() * -500;
float ay = CCRANDOM_0_1() * 500;
p1 = Vec2(ax,ay);
// a | b
// c | D
float dx = CCRANDOM_0_1() * 500;
float dy = CCRANDOM_0_1() * -500;
p2 = Vec2(dx,dy);
float y = ay - ((ay - dy) /2.0f);
// a | b
// C | d
float cx = CCRANDOM_0_1() * -500;
p3 = Vec2(cx,y);
// a | B
// c | d
float bx = CCRANDOM_0_1() * 500;
p4 = Vec2(bx,y);
s = 0.0f;
t = 0.0f;
if( Vec2::isLineIntersect(p1, p2, p3, p4, &s, &t) ) {
if( check_for_error(p1, p2, p3, p4, s,t ) )
err++;
else
ok++;
}
}
log("Test3 - End. OK=%i, err=%i", ok, err);
return true;
}
return false;
} |
package org.ovirt.engine.ui.uicommonweb.models.vms;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.ovirt.engine.core.common.TimeZoneType;
import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider;
public class TimeZoneModel {
private static final Map<TimeZoneType, Collection<TimeZoneModel>> <API key> = new HashMap<>();
public static Collection<TimeZoneModel> getTimeZones(TimeZoneType timeZoneType) {
return <API key>.get(timeZoneType);
}
static {
for (TimeZoneType timeZoneType : TimeZoneType.values()) {
mapListModels(timeZoneType, timeZoneType.getTimeZoneList());
}
}
private static void mapListModels(TimeZoneType timeZoneType, Map<String, String> timeZones) {
List<TimeZoneModel> models = new ArrayList<>();
models.add(new TimeZoneModel(null, timeZoneType)); // add empty field representing default engine TZ
for (Map.Entry<String, String> entry : timeZones.entrySet()) {
models.add(new TimeZoneModel(entry.getKey(), timeZoneType));
}
<API key>.put(timeZoneType, models);
}
private final String timeZoneKey;
private final TimeZoneType timeZoneType;
public TimeZoneModel(String timeZoneKey, TimeZoneType timeZoneType) {
this.timeZoneKey = timeZoneKey;
this.timeZoneType = timeZoneType;
}
public String getTimeZoneKey() {
return timeZoneKey;
}
public boolean isDefault() {
return timeZoneKey == null;
}
public String getDisplayValue() {
if (isDefault()) {
String defaultTimeZoneKey = (String) AsyncDataProvider.getInstance().<API key>(timeZoneType.<API key>());
// check if default timezone is correct
if (!timeZoneType.getTimeZoneList().containsKey(defaultTimeZoneKey)) {
// if not show GMT
defaultTimeZoneKey = timeZoneType.getUltimateFallback();
}
return timeZoneType.getTimeZoneList().get(defaultTimeZoneKey);
} else {
return timeZoneType.getTimeZoneList().get(timeZoneKey);
}
}
} |
# Changelog
## [1.9.0] -- 2019-05-21
Added
- Environment variable `<API key>`. See README for details.
Removed
- NPI implementation. The NPI library was broken, and the functionality was removed to make the automated tests work.
Changed
- HTTP status code is defaulted to 500 for errors that do not specify status codes.
- Users of scope `admin` can now see patients.
Fixed
- Mongo SSL config.
## [Prior to 1.9.0]
Added
- Mock data generation script.
Changed
- Environment variable `<API key>` is now an array of strings, rather than a string of comma-separated values.
- Running the test suite will no longer drop your non-testing database.
- Medication scheduling fixes.
- Fixed crash when fetching notes.
- Restrict help desk search/access to patient-type accounts. |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// Errors
$lang['error_csrf'] = 'This form post did not pass our security checks.';
// Login
$lang['login_heading'] = 'Login';
$lang['login_subheading'] = 'Silakan login dengan email/username dan password anda.';
$lang['<API key>'] = 'Email/Username:';
$lang['<API key>'] = 'Kata Sandi:';
$lang['<API key>'] = 'Ingatkan Saya:';
$lang['login_submit_btn'] = 'Login';
$lang['<API key>'] = 'Lupa Kata Sandi?';
// Index
$lang['index_heading'] = 'Pengguna';
$lang['index_subheading'] = 'Di bawah ini list dari para Pengguna.';
$lang['index_fname_th'] = 'Nama Awal';
$lang['index_lname_th'] = 'Nama Akhir';
$lang['index_email_th'] = 'Email';
$lang['index_groups_th'] = 'Grup';
$lang['index_status_th'] = 'Status';
$lang['index_action_th'] = 'Aksi';
$lang['index_active_link'] = 'Aktif';
$lang['index_inactive_link'] = 'Tidak Aktif';
$lang['<API key>'] = 'Buat Pengguna baru';
$lang['<API key>'] = 'Buat grup baru';
// Deactivate User
$lang['deactivate_heading'] = 'Deaktivasi Pengguna';
$lang['<API key>'] = 'Kamu yakin akan melakukan deaktivasi akun Pengguna \'%s\'';
$lang['<API key>'] = 'Ya:';
$lang['<API key>'] = 'Tidak:';
$lang['<API key>'] = 'Submit';
$lang['<API key>'] = 'konfirmasi';
$lang['<API key>'] = 'ID Pengguna';
// Create User
$lang['create_user_heading'] = 'Buat Pengguna';
$lang['<API key>'] = 'Silakan masukan informasi Pengguna di bawah ini.';
$lang['<API key>'] = 'Nama Awal:';
$lang['<API key>'] = 'Nama Akhir:';
$lang['<API key>'] = 'Identitas:';
$lang['<API key>'] = 'Nama Perusahaan:';
$lang['<API key>'] = 'Surel:';
$lang['<API key>'] = 'Telepon:';
$lang['<API key>'] = 'Kata Sandi:';
$lang['<API key>'] = 'Konfirmasi Kata Sandi:';
$lang['<API key>'] = 'Buat Pengguna';
$lang['<API key>'] = 'Nama Awal';
$lang['<API key>'] = 'Nama Akhir';
$lang['<API key>'] = 'Identitas';
$lang['<API key>'] = 'Alamat Surel';
$lang['<API key>'] = 'Bagian Kesatu dari Telepon';
$lang['<API key>'] = 'Bagian Kedua dari Telepon';
$lang['<API key>'] = 'Bagian Ketiga dari Telepon';
$lang['<API key>'] = 'Nama Perusahaan';
$lang['<API key>'] = 'Kata Sandi';
$lang['<API key>'] = 'Konfirmasi Kata Sandi';
// Edit User
$lang['edit_user_heading'] = 'Ubah Pengguna';
$lang['<API key>'] = 'Silakan masukan informasi Pengguna di bawah ini.';
$lang['<API key>'] = 'Nama Awal:';
$lang['<API key>'] = 'Nama Akhir:';
$lang['<API key>'] = 'Nama Perusahaan:';
$lang['<API key>'] = 'Surel:';
$lang['<API key>'] = 'Telepon:';
$lang['<API key>'] = 'Kata Sandi:';
$lang['<API key>'] = 'Konfirmasi Kata Sandi:';
$lang['<API key>'] = 'Anggota dari Grup';
$lang['<API key>'] = 'Simpan Pengguna';
$lang['<API key>'] = 'Nama Awal';
$lang['<API key>'] = 'Nama Akhir';
$lang['<API key>'] = 'Alamat Surel';
$lang['<API key>'] = 'Bagian Kesatu dari Telepon';
$lang['<API key>'] = 'Bagian Kedua dari Telepon';
$lang['<API key>'] = 'Bagian Ketiga dari Telepon';
$lang['<API key>'] = 'Nama Perusahaan';
$lang['<API key>'] = 'Nama Grup';
$lang['<API key>'] = 'Kata Sandi';
$lang['<API key>'] = 'Konfirmasi Kata Sandi';
// Create Group
$lang['create_group_title'] = 'Buat Grup';
$lang['<API key>'] = 'Buat Grupp';
$lang['<API key>'] = 'Silakan masukan detail Grup di bawah ini.';
$lang['<API key>'] = 'Nama Grup:';
$lang['<API key>'] = 'Deskripsi:';
$lang['<API key>'] = 'Buat Grup';
$lang['<API key>'] = 'Nama Grup';
$lang['<API key>'] = 'Deskripsi';
// Edit Group
$lang['edit_group_title'] = 'Ubah Grup';
$lang['edit_group_saved'] = 'Grup Tersimpan';
$lang['edit_group_heading'] = 'Ubah Grup';
$lang['<API key>'] = 'Silakan masukan detail Grup di bawah ini.';
$lang['<API key>'] = 'Nama Grup:';
$lang['<API key>'] = 'Deskripsi:';
$lang['<API key>'] = 'Simpan Grup';
$lang['<API key>'] = 'Nama Grup';
$lang['<API key>'] = 'Deskripsi';
// Change Password
$lang['<API key>'] = 'Ganti Kata Sandi';
$lang['change_<API key>] = 'Kata Santi Lama:';
$lang['change_<API key>] = 'Kata Sandi Baru (paling sedikit %s karakter):';
$lang['change_<API key>] = 'Konfirmasi Kata Sandi::';
$lang['<API key>'] = 'Ubah';
$lang['change_<API key>] = 'Kata Sandi Lama';
$lang['change_<API key>] = 'Kata Sandi Baru';
$lang['change_<API key>] = 'Konfirmasi Kata Sandi Baru';
// Forgot Password
$lang['<API key>'] = 'Lupa Kata Sandi';
$lang['<API key>'] = 'PSilakan masukkan %s anda, agar kami bisa mengirim Kata Sandi baru ke surel Anda.';
$lang['<API key>'] = '%s:';
$lang['<API key>'] = 'Submit';
$lang['forgot_<API key>] = 'Alamat Surel';
$lang['forgot_<API key>] = 'Nama Pengguna';
$lang['forgot_<API key>] = 'Surel';
$lang['forgot_<API key>] = 'Tidak ada data dari surel tersebut.';
// Reset Password
$lang['<API key>'] = 'Ganti Kata Sandi';
$lang['reset_<API key>] = 'Kata Sandi Baru (paling sedikit %s karakter):';
$lang['reset_<API key>] = 'Konfirmasi Kata Sandi:';
$lang['<API key>'] = 'Ubah';
$lang['reset_<API key>] = 'Kata Sandi Baru';
$lang['reset_<API key>] = 'Konfirmasi Kata Sandi Baru';
// Activation Email
$lang['<API key>'] = 'Aktivasi Akun untuk %s';
$lang['<API key>'] = 'Silakan klik link ini untuk %s.';
$lang['email_activate_link'] = 'Aktivasi akun anda';
// Forgot Password Email
$lang['<API key>'] = 'Ubah Kata Sandi for %s';
$lang['<API key>'] = 'Silakan klik link ini untuk %s.';
$lang['<API key>'] = 'Ubah Kata Sandi Anda';
// New Password Email
$lang['<API key>'] = 'Kata Sandi Baru untuk %s';
$lang['<API key>'] = 'Kata Sandi and sudah diubah menjadi: %s'; |
## Connection pooling
Basics
The driver communicates with Cassandra over TCP, using the Cassandra
binary protocol. This protocol is asynchronous, which allows each TCP
connection to handle multiple simultaneous requests:
* when a query gets executed, a *stream id* gets assigned to it. It is a
unique identifier on the current connection;
* the driver writes a request containing the stream id and the query on
the connection, and then proceeds without waiting for the response (if
you're using the asynchronous API, this is when the driver will send you
back a [ResultSetFuture][result_set_future]).
Once the request has been written to the
connection, we say that it is *in flight*;
* at some point, Cassandra will send back a response on the connection.
This response also contains the stream id, which allows the driver to
trigger a callback that will complete the corresponding query (this is
the point where your `ResultSetFuture` will get completed).
You don't need to manage connections yourself. You simply interact with a `Session` object, which takes care of it.
**For each `Session`, there is one connection pool per connected host** (a host is connected when it is up and
not ignored by the [load balancing policy](../load_balancing)).
The number of connections per pool is configurable (this will be
described in the next section). The number of stream ids depends on the
[native protocol version](../native_protocol/):
* protocol v2 or below: 128 stream ids per connection.
* protocol v3 or above: up to 32768 stream ids per connection.
ditaa
+
|Cluster+
+
Configuring the connection pool
Connections pools are configured with a [PoolingOptions][pooling_options] object, which
is global to a `Cluster` instance. You can pass that object when
building the cluster:
java
PoolingOptions poolingOptions = new PoolingOptions();
// customize options...
Cluster cluster = Cluster.builder()
.withContactPoints("127.0.0.1")
.withPoolingOptions(poolingOptions)
.build();
Most options can also be changed at runtime. If you don't have a
reference to the `PoolingOptions` instance, here's how you can get it:
java
PoolingOptions poolingOptions = cluster.getConfiguration().getPoolingOptions();
// customize options...
# Pool size
Connection pools have a variable size, which gets adjusted automatically
depending on the current load. There will always be at least a *core*
number of connections, and at most a *max* number. These values can be
configured independently by host *distance* (the distance is determined
by your [LoadBalancingPolicy][lbp], and will generally indicate whether a
host is in the same datacenter or not).
java
poolingOptions
.<API key>(HostDistance.LOCAL, 4)
.<API key>( HostDistance.LOCAL, 10)
.<API key>(HostDistance.REMOTE, 2)
.<API key>( HostDistance.REMOTE, 4);
For convenience, core and max can be set simultaneously:
java
poolingOptions
.<API key>(HostDistance.LOCAL, 4, 10)
.<API key>(HostDistance.REMOTE, 2, 4);
The default settings are:
* protocol v2:
* `LOCAL` hosts: core = 2, max = 8
* `REMOTE` hosts: core = 1, max = 2
* protocol v3:
* `LOCAL` hosts: core = max = 1
* `REMOTE` hosts: core = max = 1
[PoolingOptions.<API key>][nct] determines the threshold
that triggers the creation of a new connection when the pool is not at
its maximum capacity. In general, you shouldn't need to change its
default value.
# Dynamic resizing
If core != max, the pool will resize automatically to adjust to the
current activity on the host.
When activity goes up and there are *n* connections with n < max, the driver
will add a connection when the number of concurrent requests is more than
(n - 1) * 128 + [PoolingOptions.<API key>][nct]
(in layman's terms, when all but the last connection are full and the last
connection is above the threshold).
When activity goes down, the driver will "trash" connections if the maximum
number of requests in a 10 second time period can be satisfied by less than
the number of connections opened. Trashed connections are kept open but do
not accept new requests. After a given timeout (defined by
[PoolingOptions.<API key>][sits]), trashed connections are closed
and removed. If during that idle period activity increases again, those
connections will be resurrected back into the active pool and reused. The
main intent of that is to not constantly recreate connections if activity
changes quickly over an interval.
# Simultaneous requests per connection
[PoolingOptions.<API key>][mrpc] allows you to
throttle the number of concurrent requests per connection.
With protocol v2, there is no reason to throttle. It is set to 128 (the
max) and you should not change it.
With protocol v3, it is set to 1024 for `LOCAL` hosts, and 256 for
`REMOTE` hosts. These low defaults were chosen so that the default
configuration for protocol v2 and v3 allow the same total number of
simultaneous requests (to avoid bad surprises when clients migrate from
v2 to v3). You can raise this threshold, or even set it to the max:
java
poolingOptions
.<API key>(HostDistance.LOCAL, 32768)
.<API key>(HostDistance.REMOTE, 2000);
Just keep in mind that high values will give clients more bandwidth and
therefore put more pressure on your cluster. This might require some
tuning, especially if you have many clients.
# Heartbeat
If connections stay idle for too long, they might be dropped by
intermediate network devices (routers, firewalls...). Normally, TCP
keepalive should take care of this; but tweaking low-level keepalive
settings might be impractical in some environments.
The driver provides application-side keepalive in the form of a
connection heartbeat: when a connection has been idle for a given amount
of time, the driver will simulate activity by writing a dummy request to
it.
This feature is enabled by default. The default heartbeat interval is 30
seconds, it can be customized with the following method:
java
poolingOptions.<API key>(60);
If it gets changed at runtime, only connections created after that will
use the new interval. Most users will want to do this at startup.
The heartbeat interval should be set higher than
[SocketOptions.readTimeoutMillis][rtm]:
the read timeout is the maximum time that the driver waits for a regular
query to complete, therefore the connection should not be considered
idle before it has elapsed.
To disable heartbeat, set the interval to 0.
Implementation note: the dummy request sent by heartbeat is an
[OPTIONS](https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v3.spec#L278)
message.
# Acquisition queue
When the driver tries to send a request to a host, it will first try to
acquire a connection from this host's pool. If the pool is busy (i.e.
all connections are already handling their maximum number of in flight
requests), the acquisition attempt gets enqueued until a connection becomes
available again.
Two options control that queue: a maximum size ([PoolingOptions.setMaxQueueSize][smqs]) and a timeout
([PoolingOptions.<API key>][sptm]).
* if either option is set to zero, the attempt is rejected immediately;
* else if more than `maxQueueSize` requests are already waiting for a connection, the attempt is also rejected;
* otherwise, the attempt is enqueued; if a connection becomes available before `poolTimeoutMillis` has elapsed,
then the attempt succeeds, otherwise it is rejected.
If the attempt is rejected, the driver will move to the next host in the [query plan](../load_balancing/#query-plan),
and try to acquire a connection again.
If all hosts are busy with a full queue, the request will fail with a
[<API key>][nhae]. If you inspect the map returns by this
exception's [getErrors] method, you will see a [BusyPoolException] for
each host.
Monitoring and tuning the pool
The easiest way to monitor pool usage is with [Session.getState][get_state]. Here's
a simple example that will print the number of open connections, active
requests, and maximum capacity for each host, every 5 seconds:
java
final LoadBalancingPolicy loadBalancingPolicy =
cluster.getConfiguration().getPolicies().<API key>();
final PoolingOptions poolingOptions =
cluster.getConfiguration().getPoolingOptions();
<API key> scheduled =
Executors.<API key>(1);
scheduled.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
Session.State state = session.getState();
for (Host host : state.getConnectedHosts()) {
HostDistance distance = loadBalancingPolicy.distance(host);
int connections = state.getOpenConnections(host);
int inFlightQueries = state.getInFlightQueries(host);
System.out.printf("%s connections=%d, current load=%d, max
load=%d%n",
host, connections, inFlightQueries,
connections *
poolingOptions.<API key>(distance));
}
}
}, 5, 5, TimeUnit.SECONDS);
In real life, you'll probably want something more sophisticated, like
exposing a JMX MBean or sending the data to your favorite monitoring
tool.
If you find that the current load stays close or equal to the maximum
load at all time, it's a sign that your connection pools are saturated
and you should raise the max connections per host, or max requests per
connection (protocol v3).
If you're using protocol v2 and the load is often less than core * 128,
your pools are underused and you could get away with less core
connections.
# Tuning protocol v3 for very high throughputs
As mentioned above, the default pool size for protocol v3 is core = max
= 1. This means all requests to a given node will share a single
connection, and therefore a single Netty I/O thread.
There is a corner case where this I/O thread can max out its CPU core
and become a bottleneck in the driver; in our benchmarks, this happened
with a single-node cluster and a high throughput (approximately 80K
requests / second).
It's unlikely that you'll run into this issue: in most real-world
deployments, the driver connects to more than one node, so the load will
spread across more I/O threads. However if you suspect that you
experience the issue, here's what to look out for:
* the driver throughput plateaus but the process does not appear to
max out any system resource (in particular, overall CPU usage is well
below 100%);
* one of the driver's I/O threads maxes out its CPU core. You can see
that with a profiler, or OS-level tools like `pidstat -tu` on Linux.
I/O threads are called `<cluster_name>-nio-worker-<n>`, unless you're
injecting your own `EventLoopGroup` with `NettyOptions`.
The solution is to add more connections per node. To ensure that
additional connections get created before you run into the bottleneck,
either:
* set core = max;
* keep core = 1, but adjust [<API key>][mrpc] and
[<API key>][nct] so that enough connections are added by
the time you reach the bottleneck.
[result_set_future]: http://docs.datastax.com/en/drivers/java/3.2/com/datastax/driver/core/ResultSetFuture.html
[pooling_options]: http://docs.datastax.com/en/drivers/java/3.2/com/datastax/driver/core/PoolingOptions.html
[lbp]: http://docs.datastax.com/en/drivers/java/3.2/com/datastax/driver/core/policies/LoadBalancingPolicy.html
[nct]: http://docs.datastax.com/en/drivers/java/3.2/com/datastax/driver/core/PoolingOptions.html#<API key>.datastax.driver.core.HostDistance-int-
[mrpc]: http://docs.datastax.com/en/drivers/java/3.2/com/datastax/driver/core/PoolingOptions.html#<API key>.datastax.driver.core.HostDistance-int-
[sits]: http://docs.datastax.com/en/drivers/java/3.2/com/datastax/driver/core/PoolingOptions.html#<API key>-
[rtm]: http://docs.datastax.com/en/drivers/java/3.2/com/datastax/driver/core/SocketOptions.html#<API key>--
[smqs]: http://docs.datastax.com/en/drivers/java/3.2/com/datastax/driver/core/PoolingOptions.html#setMaxQueueSize-int-
[sptm]: http://docs.datastax.com/en/drivers/java/3.2/com/datastax/driver/core/PoolingOptions.html#<API key>-
[nhae]: http://docs.datastax.com/en/drivers/java/3.2/com/datastax/driver/core/exceptions/<API key>.html
[getErrors]: http://docs.datastax.com/en/drivers/java/3.2/com/datastax/driver/core/exceptions/<API key>.html#getErrors--
[get_state]: http://docs.datastax.com/en/drivers/java/3.2/com/datastax/driver/core/Session.html#getState--
[BusyPoolException]: http://docs.datastax.com/en/drivers/java/3.2/com/datastax/driver/core/exceptions/BusyPoolException.html |
package org.comicwiki.gcd.tables;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.RowFactory;
import org.comicwiki.BaseTable;
import org.comicwiki.ThingFactory;
import org.comicwiki.gcd.tables.PublisherTable.PublisherRow;
import org.comicwiki.model.Instant;
import org.junit.Test;
public class PublisherTableTest extends TableTestCase<PublisherTable> {
@Override
protected PublisherTable createTable(ThingFactory thingFactory) {
return new PublisherTable(null, thingFactory);
}
@Test
public void allNull() throws Exception {
ThingFactory thingFactory = createThingFactory();
PublisherTable table = createTable(thingFactory);
Row row = RowFactory.create(null, null, null, null, null, null, null,
null);
table.process(row);
assertEquals(0, table.rowCache.size());
}
@Test
public void country() throws Exception {
ThingFactory thingFactory = createThingFactory();
CountryTable countryTable = new CountryTable(null, thingFactory);
Row countryRow = RowFactory.create(225, "us", "United States");
countryTable.process(countryRow);
PublisherTable table = createTable(thingFactory);
Row row = RowFactory.create(1, null, 225, null, null, null, null,
null, null);
PublisherRow row2 = table.process(row);
table.joinTables(new BaseTable[]{countryTable});
table.tranform();
assertNotNull(row2.instance.location);
assertEquals("United States", row2.country.name);
assertEquals("us", row2.country.countryCode[0]);
}
@Test
public void yearBegin() throws Exception {
ThingFactory thingFactory = createThingFactory();
PublisherTable table = createTable(thingFactory);
Row row = RowFactory.create(1, null, null, 1940, null, null, null,
null, null);
PublisherRow row2 = table.process(row);
table.tranform();
assertEquals(new Integer(1940), row2.yearBegan);
Instant begin = (Instant) thingFactory.getCache().get(
row2.instance.foundingDate);
assertEquals(1940, begin.year);
}
@Test
public void yearEnd() throws Exception {
ThingFactory thingFactory = createThingFactory();
PublisherTable table = createTable(thingFactory);
Row row = RowFactory.create(1, null, null, null, 2016, null, null,
null, null);
PublisherRow row2 = table.process(row);
table.tranform();
assertEquals(new Integer(2016), row2.yearEnded);
Instant end = (Instant) thingFactory.getCache().get(
row2.instance.dissolutionDate);
assertEquals(2016, end.year);
}
} |
package com.obtuse.util;
import com.obtuse.util.exceptions.<API key>;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Vector;
@SuppressWarnings({ "<API key>", "NestedAssignment", "<API key>" })
public class CSVParser implements Closeable {
private BufferedReader _input;
private int _lnum;
private int _pushbackChar;
private boolean _pushedBack = false;
private boolean _atEOF = false;
private static final DateFormat DATE_FORMAT = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
/**
* Create a new <API key> parser.
*
* @param input the input stream which is to be parsed.
*/
public CSVParser( BufferedReader input ) {
super();
_input = input;
_lnum = 1;
}
/**
* Close the input stream.
*
* @throws java.io.IOException if the call to {@link java.io.BufferedReader#close} fails.
*/
public void close()
throws IOException {
_input.close();
}
/**
* Get the data format that is being used to parse dates.
*
* @return the date format being used to parse dates.
*/
@SuppressWarnings({ "UnusedDeclaration" })
public static DateFormat getDateFormat() {
return CSVParser.DATE_FORMAT;
}
/**
* Get the current line number.
*
* @return the current line number.
*/
public int getLnum() {
return _lnum;
}
/**
* Return the next (possibly pushed back) character from the input stream.
*
* @return the next character or -1 if we've reached the end of the input stream.
*/
protected int nextCh() {
if ( _pushedBack ) {
_pushedBack = false;
if ( _pushbackChar == -1 ) {
_atEOF = true;
}
return _pushbackChar;
}
try {
int ch = _input.read();
if ( ch == -1 ) {
_atEOF = true;
}
return ch;
} catch ( IOException e ) {
// Pretend that nothing of substance happened (which is, pretty much, true)
return -1;
}
}
/**
* Are we there yet?
*
* @return true if the end of the input file has been reached, false otherwise.
*/
@SuppressWarnings({ "<API key>" })
protected boolean atEOF() {
return _atEOF;
}
/**
* Push a character back onto the input stream.
*
* @param ch the character to be pushed back.
* @throws <API key> if there is already one character pushed back onto the stream.
*/
protected void pushback( int ch ) {
if ( _pushedBack ) {
throw new <API key>( "double pushback attempted" );
}
if ( ch != -1 ) {
_atEOF = false;
}
_pushbackChar = ch;
_pushedBack = true;
}
protected String getField() {
StringBuilder rval = new StringBuilder();
while ( true ) {
int iCh = nextCh();
if ( iCh == (int)',' || iCh == (int)'\n' || iCh == -1 ) {
pushback( iCh );
return rval.toString();
}
char ch = (char)iCh;
if ( ch != '\r' ) {
rval.append( ch );
}
}
}
/**
* Get a sequence of characters from a specified set.
*
* @param charSet the set of characters to retrieve.
* @return the sequence of characters.
*/
protected String getWord( String charSet ) {
if ( charSet.indexOf( ',' ) >= 0 ) {
throw new <API key>( "words may not contain commas" );
}
String rval = "";
int ch;
while ( charSet.indexOf( ch = nextCh() ) >= 0 ) {
rval += (char)ch;
}
pushback( ch );
// Logger.logMsg("word is \"" + rval + "\"");
return rval;
}
/**
* Parse a bitmask value.
* Any sequence of 0's and 1's that fits in an int when treated as a base-2 value is acceptable.
* Note that the first bit in the input is the least significant bit in the result.
*
* @return the parsed value.
* @throws com.obtuse.util.exceptions.<API key> if something is encountered that is not acceptable.
*/
@SuppressWarnings({ "UnusedDeclaration" })
protected int getBitMask()
throws <API key> {
int rval = 0;
//noinspection MagicNumber
for ( int bitNumber = 0; bitNumber < 32; bitNumber += 1 ) {
int ch = nextCh();
if ( ch == (int)'1' ) {
//noinspection <API key>
rval |= ( 1 << bitNumber );
} else if ( ch == (int)'0' ) {
// just ignore the zero bits
} else {
pushback( ch );
return rval;
}
}
// Oops - there's only room for 32 bits in an int!
throw new <API key>( "more than 32 bits in bitmask on line " + _lnum );
}
/**
* Parse an integer value.
* Anything that {@link Integer#parseInt(String)} accepts is considered valid.
*
* @return the parsed value.
* @throws <API key> if something is encountered that is not accepted by {@link Integer#parseInt(String)}.
*/
protected int getInt()
throws <API key> {
String s = null;
try {
getWord( " \t" ); // skip past any leading spaces
s = getWord( "-0123456789" );
getWord( " \t" ); // ignore any trailing spaces as well
if ( atEOF() ) {
return 0;
}
@SuppressWarnings({ "<API key>" })
int rval = Integer.parseInt( s );
return rval;
} catch ( <API key> e ) {
throw new <API key>( "unable to convert \"" + s + "\" on line " + _lnum, e );
}
}
/**
* Parse a double precision value.
* Anything that {@link Double#parseDouble(String)} accepts is considered valid.
*
* @return the parsed value.
* @throws <API key> if something is encountered that is not accepted by {@link Double#parseDouble(String)}.
*/
protected double getDouble()
throws <API key> {
String s = null;
try {
s = getWord( "-0123456789." );
if ( atEOF() ) {
return 0.0;
}
@SuppressWarnings({ "<API key>" })
double rval = Double.parseDouble( s );
return rval;
} catch ( <API key> e ) {
throw new <API key>( "unable to convert \"" + s + "\" on line " + _lnum, e );
}
}
/**
* Parse a string that's enclosed in double quotes.
* The basic C-style escape characters (\n, \r, \t, \b and \\) are treated as one would expect.
*
* @return the parsed string.
* @throws <API key> if a backslash-escaped character other than the basic C-style set is encountered.
*/
@SuppressWarnings({ "ConstantConditions" })
protected String getString()
throws <API key> {
int iDelim = nextCh();
if ( iDelim == -1 ) {
return "";
}
char delim = (char)iDelim;
if ( delim != (int)'"' ) {
throw new <API key>( "missing opening quote" );
}
int iCh;
String rval = "";
while ( ( iCh = nextCh() ) != delim && iCh != (int)'\n' && iCh != -1 ) {
char ch = (char)iCh;
if ( ch == (int)'\\' ) {
iCh = nextCh();
ch = (char)iCh;
switch ( iCh ) {
case 'n':
rval += '\n';
break;
case 'r':
rval += '\r';
break;
case 't':
rval += '\t';
break;
case 'b':
rval += '\b';
break;
case '\\':
rval += '\\';
break;
default:
throw new <API key>( "illegal char after backslash" );
}
} else {
rval += (char)ch;
}
}
if ( iCh == delim ) {
return rval;
}
throw new <API key>( "missing closing string delimiter" );
}
/**
* Get the next character.
*
* @return the next character.
* @throws <API key> if the next character is a comma or a newline or if the end of the input
* stream has been reached.
*/
@SuppressWarnings({ "UnusedDeclaration" })
protected char getChar()
throws <API key> {
int ch = nextCh();
if ( ch == (int)',' || ch == (int)'\n' || ch == -1 ) {
throw new <API key>( "invalid char" );
} else {
return (char)ch;
}
}
/**
* Get a date of the format "YYYY-MM-DD HH:MM:SS".
* Note that the date must be enclosed in double quotes.
*
* @return the parsed date.
* @throws <API key> if a syntax error is encountered (of course).
*/
@SuppressWarnings({ "UnusedDeclaration" })
protected ImmutableDate getDate()
throws <API key> {
String s = getString();
if ( atEOF() ) {
return null;
}
return CSVParser.parseDate( s );
}
/**
* Parse a date of the format "YYYY-MM-DD HH:MM:SS" from a string.
*
* @param dateStr the string to be parsed.
* @return the parsed date.
* @throws <API key> if a syntax error is encountered (of course).
*/
public static ImmutableDate parseDate( String dateStr )
throws <API key> {
try {
return new ImmutableDate( CSVParser.DATE_FORMAT.parse( dateStr ) );
} catch ( ParseException e ) {
throw new <API key>( "invalid date format", e );
}
}
/**
* Convert an integer value into a hexadecimal string.
*
* @param val the value to convert
* @return the resulting string
*/
private String fmtHex( int val ) {
if ( val == 0 ) {
return "0";
} else {
long lval = (long)val;
String rval = "";
while ( lval != 0L ) {
//noinspection MagicNumber
rval = "" + "0123456789abcdef".charAt( (int)( lval & 0xfL ) ) + rval;
//noinspection MagicNumber
lval >>= 4L;
}
return rval;
}
}
/**
* Get a comma-separated array of integers that is enclosed in square brackets.
*
* @return the array of ints.
* @throws <API key> if a syntax error is encountered (of course).
*/
@SuppressWarnings({ "UnusedDeclaration" })
protected int[] getIntArray()
throws <API key> {
Vector<Integer> v = new Vector<Integer>();
int ch = nextCh();
if ( ch != (int)'[' ) {
throw new <API key>( "missing opening '['" );
}
while ( ( ch = nextCh() ) != (int)']' ) {
pushback( ch );
v.add( getInt() );
ch = nextCh();
if ( ch == (int)',' ) {
// life is wonderful
} else if ( ch == (int)']' ) {
pushback( ch );
} else {
throw new <API key>( "bogus char after int in int array" );
}
}
Integer[] iArray = v.toArray( new Integer[v.size()] );
int[] rval = new int[iArray.length];
for ( int i = 0; i < iArray.length; i += 1 ) {
rval[i] = iArray[i].intValue();
}
return rval;
}
/**
* Get a comma-separated array of doubles that is enclosed in square brackets.
*
* @return the array of ints.
* @throws <API key> if a syntax error is encountered (of course).
*/
@SuppressWarnings({ "UnusedDeclaration" })
protected double[] getDoubleArray()
throws <API key> {
Vector<Double> v = new Vector<Double>();
int ch = nextCh();
if ( ch != (int)'[' ) {
throw new <API key>( "missing opening '['" );
}
while ( ( ch = nextCh() ) != (int)']' ) {
pushback( ch );
v.add( getDouble() );
ch = nextCh();
if ( ch == (int)',' ) {
// life is wonderful
} else if ( ch == (int)']' ) {
pushback( ch );
} else {
throw new <API key>( "bogus char after double in double array" );
}
}
Double[] dArray = v.toArray( new Double[v.size()] );
double[] rval = new double[dArray.length];
for ( int i = 0; i < dArray.length; i += 1 ) {
rval[i] = dArray[i].doubleValue();
}
return rval;
}
/**
* Consume the next character (which must be a comma).
*
* @throws <API key> if the next character is not a comma.
*/
protected void comma()
throws <API key> {
int ch = nextCh();
if ( ch != (int)',' ) {
if ( ch >= (int)' ' && ch <= (int)'~' ) {
throw new <API key>( "next character ('" + (char)ch + "') is not a comma" );
} else {
throw new <API key>( "next character (0x" + fmtHex( ch ) + ") is not a comma" );
}
}
}
/**
* Consume the next character (which must be a newline character).
*
* @throws <API key> if the next character is not a newline character.
*/
protected void endOfLine()
throws <API key> {
int ch = nextCh();
if ( ch != (int)'\n' ) {
if ( ch >= (int)' ' && ch <= (int)'~' ) {
throw new <API key>( "next character ('" + (char)ch + "') is not a newline character" );
} else {
throw new <API key>( "next character (0x" + fmtHex( ch ) + ") is not a newline character" );
}
}
_lnum += 1;
}
protected void <API key>()
throws <API key> {
int ch = nextCh();
while ( ch != (int)'\n' ) {
ch = nextCh();
}
pushback( ch );
endOfLine();
}
} |
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_45) on Sat Jul 13 18:59:10 WEST 2013 -->
<TITLE>
OFActionDataLayer
</TITLE>
<META NAME="date" CONTENT="2013-07-13">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="OFActionDataLayer";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/OFActionDataLayer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../org/openflow/protocol/action/OFAction.html" title="class in org.openflow.protocol.action"><B>PREV CLASS</B></A>
<A HREF="../../../../org/openflow/protocol/action/<API key>.html" title="class in org.openflow.protocol.action"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/openflow/protocol/action/OFActionDataLayer.html" target="_top"><B>FRAMES</B></A>
<A HREF="OFActionDataLayer.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<H2>
<FONT SIZE="-1">
org.openflow.protocol.action</FONT>
<BR>
Class OFActionDataLayer</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../org/openflow/protocol/action/OFAction.html" title="class in org.openflow.protocol.action">org.openflow.protocol.action.OFAction</A>
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.openflow.protocol.action.OFActionDataLayer</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD>java.lang.Cloneable</DD>
</DL>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../org/openflow/protocol/action/<API key>.html" title="class in org.openflow.protocol.action"><API key></A>, <A HREF="../../../../org/openflow/protocol/action/<API key>.html" title="class in org.openflow.protocol.action"><API key></A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public abstract class <B>OFActionDataLayer</B><DT>extends <A HREF="../../../../org/openflow/protocol/action/OFAction.html" title="class in org.openflow.protocol.action">OFAction</A></DL>
</PRE>
<P>
Represents an ofp_action_dl_addr
<P>
<P>
<DL>
<DT><B>Author:</B></DT>
<DD>David Erickson (daviderickson@cs.stanford.edu) - Mar 11, 2010</DD>
</DL>
<HR>
<P>
<A NAME="field_summary"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/openflow/protocol/action/OFActionDataLayer.html#dataLayerAddress">dataLayerAddress</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/openflow/protocol/action/OFActionDataLayer.html#MINIMUM_LENGTH">MINIMUM_LENGTH</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="<API key>.openflow.protocol.action.OFAction"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="<API key>">
<TH ALIGN="left"><B>Fields inherited from class org.openflow.protocol.action.<A HREF="../../../../org/openflow/protocol/action/OFAction.html" title="class in org.openflow.protocol.action">OFAction</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../org/openflow/protocol/action/OFAction.html#length">length</A>, <A HREF="../../../../org/openflow/protocol/action/OFAction.html#OFFSET_LENGTH">OFFSET_LENGTH</A>, <A HREF="../../../../org/openflow/protocol/action/OFAction.html#OFFSET_TYPE">OFFSET_TYPE</A>, <A HREF="../../../../org/openflow/protocol/action/OFAction.html#type">type</A></CODE></TD>
</TR>
</TABLE>
<A NAME="constructor_summary"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/openflow/protocol/action/OFActionDataLayer.html#OFActionDataLayer()">OFActionDataLayer</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="method_summary"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/openflow/protocol/action/OFActionDataLayer.html#equals(java.lang.Object)">equals</A></B>(java.lang.Object obj)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/openflow/protocol/action/OFActionDataLayer.html#getDataLayerAddress()">getDataLayerAddress</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/openflow/protocol/action/OFActionDataLayer.html#hashCode()">hashCode</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/openflow/protocol/action/OFActionDataLayer.html#readFrom(org.jboss.netty.buffer.ChannelBuffer)">readFrom</A></B>(org.jboss.netty.buffer.ChannelBuffer data)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/openflow/protocol/action/OFActionDataLayer.html#setDataLayerAddress(byte[])">setDataLayerAddress</A></B>(byte[] dataLayerAddress)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/openflow/protocol/action/OFActionDataLayer.html#writeTo(org.jboss.netty.buffer.ChannelBuffer)">writeTo</A></B>(org.jboss.netty.buffer.ChannelBuffer data)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="<API key>.openflow.protocol.action.OFAction"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="<API key>">
<TH ALIGN="left"><B>Methods inherited from class org.openflow.protocol.action.<A HREF="../../../../org/openflow/protocol/action/OFAction.html" title="class in org.openflow.protocol.action">OFAction</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../org/openflow/protocol/action/OFAction.html#clone()">clone</A>, <A HREF="../../../../org/openflow/protocol/action/OFAction.html#fromString(java.lang.String)">fromString</A>, <A HREF="../../../../org/openflow/protocol/action/OFAction.html#getLength()">getLength</A>, <A HREF="../../../../org/openflow/protocol/action/OFAction.html#getLengthU()">getLengthU</A>, <A HREF="../../../../org/openflow/protocol/action/OFAction.html#getType()">getType</A>, <A HREF="../../../../org/openflow/protocol/action/OFAction.html#setLength(short)">setLength</A>, <A HREF="../../../../org/openflow/protocol/action/OFAction.html#setType(org.openflow.protocol.action.OFActionType)">setType</A>, <A HREF="../../../../org/openflow/protocol/action/OFAction.html#toString()">toString</A></CODE></TD>
</TR>
</TABLE>
<A NAME="<API key>.lang.Object"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="<API key>">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>finalize, getClass, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<A NAME="field_detail"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="MINIMUM_LENGTH"></A><H3>
MINIMUM_LENGTH</H3>
<PRE>
public static int <B>MINIMUM_LENGTH</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="dataLayerAddress"></A><H3>
dataLayerAddress</H3>
<PRE>
protected byte[] <B>dataLayerAddress</B></PRE>
<DL>
<DL>
</DL>
</DL>
<A NAME="constructor_detail"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="OFActionDataLayer()"></A><H3>
OFActionDataLayer</H3>
<PRE>
public <B>OFActionDataLayer</B>()</PRE>
<DL>
</DL>
<A NAME="method_detail"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="getDataLayerAddress()"></A><H3>
getDataLayerAddress</H3>
<PRE>
public byte[] <B>getDataLayerAddress</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Returns:</B><DD>the dataLayerAddress</DL>
</DD>
</DL>
<HR>
<A NAME="setDataLayerAddress(byte[])"></A><H3>
setDataLayerAddress</H3>
<PRE>
public void <B>setDataLayerAddress</B>(byte[] dataLayerAddress)</PRE>
<DL>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dataLayerAddress</CODE> - the dataLayerAddress to set</DL>
</DD>
</DL>
<HR>
<A NAME="readFrom(org.jboss.netty.buffer.ChannelBuffer)"></A><H3>
readFrom</H3>
<PRE>
public void <B>readFrom</B>(org.jboss.netty.buffer.ChannelBuffer data)</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../../org/openflow/protocol/action/OFAction.html#readFrom(org.jboss.netty.buffer.ChannelBuffer)">readFrom</A></CODE> in class <CODE><A HREF="../../../../org/openflow/protocol/action/OFAction.html" title="class in org.openflow.protocol.action">OFAction</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="writeTo(org.jboss.netty.buffer.ChannelBuffer)"></A><H3>
writeTo</H3>
<PRE>
public void <B>writeTo</B>(org.jboss.netty.buffer.ChannelBuffer data)</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../../org/openflow/protocol/action/OFAction.html#writeTo(org.jboss.netty.buffer.ChannelBuffer)">writeTo</A></CODE> in class <CODE><A HREF="../../../../org/openflow/protocol/action/OFAction.html" title="class in org.openflow.protocol.action">OFAction</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="hashCode()"></A><H3>
hashCode</H3>
<PRE>
public int <B>hashCode</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../../org/openflow/protocol/action/OFAction.html#hashCode()">hashCode</A></CODE> in class <CODE><A HREF="../../../../org/openflow/protocol/action/OFAction.html" title="class in org.openflow.protocol.action">OFAction</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="equals(java.lang.Object)"></A><H3>
equals</H3>
<PRE>
public boolean <B>equals</B>(java.lang.Object obj)</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../../org/openflow/protocol/action/OFAction.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="../../../../org/openflow/protocol/action/OFAction.html" title="class in org.openflow.protocol.action">OFAction</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/OFActionDataLayer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../org/openflow/protocol/action/OFAction.html" title="class in org.openflow.protocol.action"><B>PREV CLASS</B></A>
<A HREF="../../../../org/openflow/protocol/action/<API key>.html" title="class in org.openflow.protocol.action"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/openflow/protocol/action/OFActionDataLayer.html" target="_top"><B>FRAMES</B></A>
<A HREF="OFActionDataLayer.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
</BODY>
</HTML> |
var webpackConfig = require('../webpack.config');
module.exports = function(config) {
config.set({
basePath: '../',
frameworks: [
'jasmine',
],
files: [
require.resolve('es6-shim'),
'node_modules/jquery/dist/jquery.js',
'node_modules/jasmine-jquery/lib/jasmine-jquery.js',
'node_modules/jasmine-fixture/dist/jasmine-fixture.js',
'test/jasmine/main.js',
'test/jasmine*.js',
{ pattern: 'test/jasmine/fixtures*', included: false },
],
preprocessors: {
'test/jasmine*.js': ['webpack', 'sourcemap'],
},
webpack: webpackConfig,
reporters: ['progress', 'coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['PhantomJS'],
singleRun: false,
concurrency: Infinity,
coverageReporter: {
reporters: [{
type: 'text-summary',
}, {
type: 'html',
dir: 'coverage/',
}],
},
});
}; |
<footer id="footer" role="contentinfo">
<section class="footer-body">
Banter
<a th:if="${not #strings.isEmpty(version)}" th:href="${versionUrl}" th:text="${shortVersion}">v1.0.0</a>
© <span th:text="${#calendars.year(execInfo.now)}" th:remove="tag">9999</span> David M. Carr
</section>
</footer> |
export class DashboardDefault {
public graphs: string
constructor() {
this.graphs=`
[
{
"id": "graph2",
"x": 10,
"y": 20,
"width": 300,
"height": 90,
"type": "counterSquare",
"fields": [],
"title": "Stacks CPU: ",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": true,
"alertMin": "30",
"alertMax": "100",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "all",
"field": "cpu-usage",
"counterHorizontal": true,
"requestId": "graph2"
},
{
"id": "graph3",
"x": 10,
"y": 130,
"width": 300,
"height": 90,
"type": "counterSquare",
"fields": [],
"title": "Stacks Mem: ",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": true,
"alertMin": "4GB",
"alertMax": "7GB",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "all",
"field": "mem-usage",
"counterHorizontal": true,
"requestId": "graph3"
},
{
"id": "graph4",
"x": 10,
"y": 240,
"width": 300,
"height": 100,
"type": "counterSquare",
"fields": [],
"title": "Stacks Net: ",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": true,
"alertMin": "",
"alertMax": "",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "all",
"field": "net-total-bytes",
"counterHorizontal": true,
"requestId": "graph4"
},
{
"id": "graph5",
"x": 10,
"y": 360,
"width": 300,
"height": 100,
"type": "counterSquare",
"fields": [],
"title": "Stacks IO: ",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": true,
"alertMin": "",
"alertMax": "",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "all",
"field": "io-total",
"counterHorizontal": true,
"requestId": "graph5"
},
{
"id": "graph6",
"x": 440,
"y": 20,
"width": 210,
"height": 50,
"type": "counterSquare",
"fields": [],
"title": "Stack number: ",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": true,
"alertMin": "",
"alertMax": "1",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "stack",
"field": "number",
"counterHorizontal": true,
"requestId": "graph6"
},
{
"id": "graph7",
"x": 440,
"y": 80,
"width": 210,
"height": 50,
"type": "counterSquare",
"fields": [],
"title": "Service number: ",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": true,
"alertMin": "",
"alertMax": "10",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "service",
"field": "number",
"counterHorizontal": true,
"requestId": "graph7"
},
{
"id": "graph8",
"x": 440,
"y": 140,
"width": 210,
"height": 50,
"type": "counterSquare",
"fields": [],
"title": "Container number: ",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": true,
"alertMin": "",
"alertMax": "14",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "container",
"field": "number",
"counterHorizontal": true,
"requestId": "graph8"
},
{
"id": "graph9",
"x": 670,
"y": 200,
"width": 530,
"height": 260,
"type": "bubbles",
"fields": [],
"title": "5 first services CPU/Mem size: Net",
"border": true,
"modeParameter": false,
"topNumber": 5,
"alert": false,
"alertMin": "",
"alertMax": "",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "service",
"field": "net-total-bytes",
"bubbleXField": "mem-usage",
"bubbleYField": "cpu-usage",
"bubbleScale": "medium",
"requestId": "graph9"
},
{
"id": "graph10",
"x": 670,
"y": 20,
"width": 170,
"height": 170,
"type": "pie",
"fields": [],
"title": "CPU: 3 First services",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": false,
"alertMin": "",
"alertMax": "",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "service",
"field": "cpu-usage",
"requestId": "graph10"
},
{
"id": "graph11",
"x": 1030,
"y": 20,
"width": 170,
"height": 170,
"type": "pie",
"fields": [],
"title": "Net: 3 first services",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": false,
"alertMin": "",
"alertMax": "",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "service",
"field": "net-total-bytes",
"requestId": "graph11"
},
{
"id": "graph12",
"x": 850,
"y": 20,
"width": 170,
"height": 170,
"type": "pie",
"fields": [],
"title": "Mem: 3 First services",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": false,
"alertMin": "",
"alertMax": "",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "service",
"field": "mem-usage",
"requestId": "graph12"
},
{
"id": "graph13",
"x": 440,
"y": 200,
"width": 210,
"height": 210,
"type": "legend",
"fields": [],
"title": "Legend services",
"border": false,
"modeParameter": false,
"topNumber": 3,
"alert": false,
"alertMin": "",
"alertMax": "",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "service",
"transparentLegend": false
},
{
"id": "graph14",
"x": 320,
"y": 20,
"width": 100,
"height": 90,
"type": "lines",
"fields": [],
"title": "all",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": false,
"alertMin": "",
"alertMax": "",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "all",
"field": "cpu-usage",
"histoPeriod": "now-30m",
"requestId": "graph14",
"yTitle": "cpu usage",
"histoStep": "1m"
},
{
"id": "graph15",
"x": 320,
"y": 130,
"width": 100,
"height": 90,
"type": "lines",
"fields": [],
"title": "all",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": false,
"alertMin": "",
"alertMax": "",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "all",
"field": "mem-usage",
"histoPeriod": "now-30m",
"requestId": "graph15",
"yTitle": "cpu usage",
"histoStep": "1m"
},
{
"id": "graph16",
"x": 320,
"y": 240,
"width": 100,
"height": 100,
"type": "lines",
"fields": [],
"title": "all",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": false,
"alertMin": "",
"alertMax": "",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "all",
"field": "net-total-bytes",
"histoPeriod": "now-30m",
"requestId": "graph16",
"yTitle": "cpu usage",
"histoStep": "1m"
},
{
"id": "graph17",
"x": 320,
"y": 360,
"width": 100,
"height": 100,
"type": "lines",
"fields": [],
"title": "all",
"border": true,
"modeParameter": false,
"topNumber": 3,
"alert": false,
"alertMin": "",
"alertMax": "",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "all",
"field": "cpu-usage",
"histoPeriod": "now-30m",
"requestId": "graph17",
"yTitle": "cpu usage",
"histoStep": "1m"
},
{
"id": "graph18",
"x": 320,
"y": 0,
"width": 100,
"height": 20,
"type": "text",
"fields": [],
"title": "30 min",
"border": false,
"modeParameter": false,
"topNumber": 3,
"alert": false,
"alertMin": "",
"alertMax": "",
"criterion": "",
"criterionValue": "",
"stackedAreas": true,
"legendNames": [],
"legendColors": [],
"containerAvg": false,
"roundedBox": true,
"object": "stack",
"field": "cpu-usage",
"requestId": "graph18"
}
]
`
}
} |
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Screener;
using Screener.Filters;
namespace UnitTests
{
[TestClass]
public class DonchianFilterTest
{
[TestMethod]
public void DonchianUpBreakout()
{
var companies = GenerateCompanies();
var filter = new <API key>(6, 1);
var result = filter.Filter(companies);
var company = result[0];
Assert.AreEqual(1, result.Length);
Assert.AreEqual("UpBreakout", company.Name);
}
[TestMethod]
public void <API key>()
{
var companies = GenerateCompanies();
var filter = new <API key>(6, -1);
var result = filter.Filter(companies);
var company = result[0];
var company2 = result[1];
Assert.AreEqual(2, result.Length);
Assert.AreEqual("DownBreakout", company.Name);
Assert.AreEqual("DownBreakout2", company2.Name);
}
[TestMethod]
public void <API key>()
{
var companies = GenerateCompanies();
var filter = new <API key>(6, 1, 0.05M);
var result = filter.Filter(companies);
var company = result[0];
var company2 = result[1];
Assert.AreEqual(2, result.Length);
Assert.AreEqual("UpBreakout", company.Name);
Assert.AreEqual("NearUpBreakout", company2.Name);
}
public Company[] GenerateCompanies()
{
return new Company[]
{
new Company()
{
Name = "UpBreakout",
Chart = new Candle[]
{
new Candle() { High = 10, Low = 8 },
new Candle() { High = 9, Low = 7 },
new Candle() { High = 8, Low = 6 },
new Candle() { High = 7, Low = 5 },
new Candle() { High = 9, Low = 7 },
new Candle() { High = 10, Low = 8 }
}
},
new Company()
{
Name = "NearUpBreakout",
Chart = new Candle[]
{
new Candle() { High = 100, Low = 80 },
new Candle() { High = 90, Low = 70 },
new Candle() { High = 80, Low = 60 },
new Candle() { High = 70, Low = 50 },
new Candle() { High = 90, Low = 70 },
new Candle() { High = 96, Low = 76 }
}
},
new Company()
{
Name = "DownBreakout",
Chart = new Candle[]
{
new Candle() { Low = 1, High = 5 },
new Candle() { Low = 2, High = 6 },
new Candle() { Low = 3, High = 7 },
new Candle() { Low = 4, High = 8 },
new Candle() { Low = 2, High = 6 },
new Candle() { Low = 1, High = 5 }
}
},
new Company()
{
Name = "DownBreakout2",
Chart = new Candle[]
{
new Candle() { Low = 2, High = 5 },
new Candle() { Low = 3, High = 6 },
new Candle() { Low = 4, High = 7 },
new Candle() { Low = 5, High = 8 },
new Candle() { Low = 2, High = 6 },
new Candle() { Low = 1, High = 5 }
}
},
};
}
}
} |
package Model;
// Generated Jan 14, 2011 3:39:55 PM by Hibernate Tools 3.2.1.GA
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* EmpAttachment generated by hbm2java
*/
@Entity
@Table(name="emp_attachment"
,catalog="ashrm"
)
public class EmpAttachment implements java.io.Serializable {
private EmpAttachmentId id;
private Employee employee;
private String eattachDesc;
private String eattachFilename;
private Integer eattachSize;
private byte[] eattachAttachment;
private String eattachType;
public EmpAttachment() {
}
public EmpAttachment(EmpAttachmentId id, Employee employee) {
this.id = id;
this.employee = employee;
}
public EmpAttachment(EmpAttachmentId id, Employee employee, String eattachDesc, String eattachFilename, Integer eattachSize, byte[] eattachAttachment, String eattachType) {
this.id = id;
this.employee = employee;
this.eattachDesc = eattachDesc;
this.eattachFilename = eattachFilename;
this.eattachSize = eattachSize;
this.eattachAttachment = eattachAttachment;
this.eattachType = eattachType;
}
@EmbeddedId
@AttributeOverrides( {
@AttributeOverride(name="empNumber", column=@Column(name="emp_number", nullable=false) ),
@AttributeOverride(name="eattachId", column=@Column(name="eattach_id", nullable=false, precision=10, scale=0) ) } )
public EmpAttachmentId getId() {
return this.id;
}
public void setId(EmpAttachmentId id) {
this.id = id;
}
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="emp_number", nullable=false, insertable=false, updatable=false)
public Employee getEmployee() {
return this.employee;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
@Column(name="eattach_desc", length=200)
public String getEattachDesc() {
return this.eattachDesc;
}
public void setEattachDesc(String eattachDesc) {
this.eattachDesc = eattachDesc;
}
@Column(name="eattach_filename", length=100)
public String getEattachFilename() {
return this.eattachFilename;
}
public void setEattachFilename(String eattachFilename) {
this.eattachFilename = eattachFilename;
}
@Column(name="eattach_size")
public Integer getEattachSize() {
return this.eattachSize;
}
public void setEattachSize(Integer eattachSize) {
this.eattachSize = eattachSize;
}
@Column(name="eattach_attachment")
public byte[] <API key>() {
return this.eattachAttachment;
}
public void <API key>(byte[] eattachAttachment) {
this.eattachAttachment = eattachAttachment;
}
@Column(name="eattach_type", length=50)
public String getEattachType() {
return this.eattachType;
}
public void setEattachType(String eattachType) {
this.eattachType = eattachType;
}
} |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-08 15:45
from __future__ import unicode_literals
from django.db import migrations
import share.robot
class Migration(migrations.Migration):
dependencies = [
('share', '0001_initial'),
('djcelery', '0001_initial'),
]
operations = [
migrations.RunPython(
code=share.robot.RobotUserMigration('edu.opensiuc'),
),
migrations.RunPython(
code=share.robot.<API key>('edu.opensiuc'),
),
migrations.RunPython(
code=share.robot.<API key>('edu.opensiuc'),
),
] |
# vmware_horizon_view
# Table of Contents
1. [Overview](#overview)
2. [Module Description - What the module does and why it is useful](#module-description)
3. [Setup - The basics of getting started with vmware_horizon_view](#setup)
* [What vmware_horizon_view affects](#<API key>)
* [Setup requirements](#setup-requirements)
* [Beginning with vmware_horizon_view](#<API key>)
4. [Usage - Configuration options and additional functionality](#usage)
5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
5. [Limitations - OS compatibility, etc.](#limitations)
6. [Development - Guide for contributing to the module](#development)
## Overview
This module manage the PCOIP settings within a VMware Horizon with View environment for internal and external connections. It is also known as the secret weapon.
## Module Description
This module allows to configure different PCOIP settings for internal and externe VMware Horizon with View connections. The following settings can be changed:
* Enable or Disable the ThinPrint Services (TPAutoConnSvc and TPVCGateway)
* Enable or Disable the PCOIP Build to Lossless configuration
* Configure the PCoIP minimum image quality
* Configure the PCoIP maximum initial image quality
* Configure the PCoIP maximum frame rate
* Configure the PCoIP use image setting
* Configure the PCoIP clipboard state
* Configure the PCoIP audio bandwidth limit
* Configure the Exclude all USB Devices setting.
It also automates the configuration necessary to enable the puppet run during each internal and external connection.
## Setup
What vmware_horizon_view affects
For more details please check the Blog https://blogs.vmware.com/consulting/2015/10/<API key>.html
Setup Requirements **OPTIONAL**
It will configure the following:
* Automates the Script creation at C:\Program Files\VMware\VMware View\Agent\scripts\runpuppetagent.vbs that will trigger a puppet agent -t run.
* Automates the necessary Registy keys:
** HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents\StartSession
** HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents\StartSession\Bullet1 and value "wscript C:\Program Files\VMware\VMware View\Agent\scripts\runpuppetagent.vbs" (string)
** HKLM\SOFTWARE\VMware, Inc.\VMware VDM\Agent\Configuration\<API key> and value 1 (dword)
** HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents\TimeoutsInMinutes and value 0 (dword)
* enabling the Windows Script Host Service (WSSH)
Beginning with vmware_horizon_view
You can use the init.pp module inside your VMware Horizon with View template to configure the setup requirements. It will configure the described configurations independent from the parameter configurations.
## Usage
First you need to specify the external broker DNS name parameter (<API key>) and internal broker DNS name parameter (<API key>)
Beside that you can specify the following internal settings. If not specified the default values will be used.
You can specify the following settings for external connections:
* Enable (true) or disable (false) the ThinPrint Services: <API key> (default = true)
* Enable (true) or disable (false) PCoIP Build to Lossless: <API key> (default = true)
* Configuration of the PCoIP minimum image quality: <API key> (default = 30)
* Configuration of the PCoIP maximum initial image quality: <API key> (default = 70)
* Configuration of the PCoIP maximum frame rate: <API key> (default = 12)
* Configuration of the Use image setting enabled (true) or disabled (false): <API key> (default = true)
* Configuration of the PCoIP clipboard state: <API key> (default = false)
* Configuration of the PCoIP audio bandwidth limit: <API key> (default = 80)
* Configuration of to enable or disable exclude all usb devices: <API key> (default = true),
You can specify the following settings for internal connections:
* Enable (true) or disable (false) the ThinPrint Services: <API key> (default = false)
* Enable (true) or disable (false) PCoIP Build to Lossless: <API key> (default = false)
* Configuration of the PCoIP minimum image quality: <API key> (default = 40)
* Configuration of the PCoIP maximum initial image quality: <API key> (default = 80)
* Configuration of the PCoIP maximum frame rate: <API key> (default = 20)
* Configuration of the Use image setting enabled (true) or disabled (false): <API key> (default = true)
* Configuration of the PCoIP clipboard state: <API key> (default = true)
* Configuration of the PCoIP audio bandwidth limit: <API key> (default = 250)
* Configuration of to enable or disable exclude all usb devices: <API key> (default = false)
The module also creates some custom facts for reporting:
* <API key>: Information about the PCoIP audio bandwidth limit configuration before the puppet agent run.
* <API key>: Information about the PCoIP enable build to lossless configuration before the puppet agent run.
* <API key>: Information about the PCoIP maximum frame rate configuration before the puppet agent run.
* <API key>: Information about the PCoIP maximum initial image quality configuration before the puppet agent run.
* <API key>: Information about the PCoIP minimum image quality configuration before the puppet agent run.
* <API key>: Information about the PCoIP server clipboard state configuration before the puppet agent run.
* <API key>: Information about the PCoIP client img setting before the puppet agent run.
* <API key>: Information about the <API key> before the puppet agent run.
* <API key>: Information about the View Client broker DNS name of all VDM Brokers available within your
## Limitations
- Only works right now with one external and one internal VMware Horizon with View Desktop broker but can be extended to an array of possible broker names in future.
## Development
For your ideas to extend the module please let me know your requests by creating issues at the github repository: https://github.com/Andulla/vmware_horizon_view/issues
## Release Notes/Contributors/Etc **Optional**
Version 0.0.1: Initial Release of the module |
Suchseite
=================
Person suchen
Im Bereich *Dashboard* und *Profile durchsuchen* kann nach Personen, durch Eingabe von einem Suchbegriff in der Suchleiste, gesucht werden.

 |
var user = Alloy.Models.user;
$.first.text = " " + user.toJSON().firstName + " ";
$.last.text = user.toJSON().lastName;
var purchases = Alloy.Collections.purchase;
function closeModal(e) {
$.modal.fireEvent("removeClose", e);
}
function <API key>(e) {
Storekit.addEventListener('<API key>', <API key>);
restorePurchases();
}
var Storekit = require('ti.storekit');
Storekit.<API key> = true;
Storekit.<API key><API key>;
var verifyingReceipts = false;
function showLoading()
{
Ti.App.fireEvent("showLoading_new");
}
function hideLoading()
{
Ti.App.fireEvent("hideLoading_new");
}
function getModelById(modelId) {
var modelById;
purchases.each(function(purchase) {
var purchaseJSON = purchase.toJSON();
if (purchaseJSON.productid == modelId) {
modelById = purchase;
}
});
return modelById;
}
function <API key>(identifier)
{
Ti.API.info('Marking as purchased: ' + identifier);
var purchaseModel = getModelById(identifier);
purchaseModel.set({purchased:1});
purchaseModel.save();
}
function restorePurchases()
{
showLoading();
Storekit.<API key>();
}
function <API key>(evt) {
hideLoading();
if (evt.error) {
alert(evt.error);
}
else if (evt.transactions == null || evt.transactions.length == 0) {
alert('There were no purchases to restore!');
}
else {
Ti.API.info("evt.transactions: " + evt.transactions.length);
Ti.API.info("evt.transactions[i].productIdentifier: " + evt.transactions[0].productIdentifier);
for (var i = 0; i < evt.transactions.length; i++) {
if (verifyingReceipts) {
Storekit.verifyReceipt(evt.transactions[i], function (e) {
if (e.valid) {
<API key>(e.productIdentifier);
} else {
Ti.API.error("Restored transaction is not valid");
}
});
} else {
Ti.API.info("evt.transactions[i].productIdentifier: " + evt.transactions[i].productIdentifier);
<API key>(evt.transactions[i].productIdentifier);
}
}
Ti.API.info('Restored ' + evt.transactions.length + ' purchases!');
alert('Restored ' + evt.transactions.length + ' purchases!');
Storekit.removeEventListener('<API key>', <API key>);
}
} |
package org.opencds.cqf.ruler.cdshooks.request;
import com.google.gson.JsonObject;
public class Request {
private String serviceName;
private JsonObject requestJson;
private JsonObject <API key>;
private String hook;
private String hookInstance;
private String fhirServerUrl;
private FhirAuthorization fhirAuthorization;
private String user;
private Context context;
private Prefetch prefetch;
private Boolean applyCql;
public Request(String serviceName, JsonObject requestJson, JsonObject <API key>) {
this.serviceName = serviceName;
this.requestJson = requestJson;
this.<API key> = <API key>;
}
public String getServiceName() {
return serviceName;
}
public JsonObject getRequestJson() {
return requestJson;
}
public String getHook() {
if (hook == null) {
hook = JsonHelper.getStringRequired(requestJson, "hook");
}
return hook;
}
public String getHookInstance() {
if (hookInstance == null) {
hookInstance = JsonHelper.getStringRequired(requestJson, "hookInstance");
}
return hookInstance;
}
public String getFhirServerUrl() {
if (fhirServerUrl == null) {
// if fhirAuthorization is present, fhirServer is required
fhirServerUrl = <API key>() == null
? JsonHelper.getStringOptional(requestJson, "fhirServer")
: JsonHelper.getStringRequired(requestJson, "fhirServer");
}
return fhirServerUrl;
}
public FhirAuthorization <API key>() {
if (fhirAuthorization == null) {
JsonObject object = JsonHelper.getObjectOptional(requestJson, "fhirAuthorization");
if (object != null) {
fhirAuthorization = new FhirAuthorization(object);
}
}
return fhirAuthorization;
}
public String getUser() {
if (user == null) {
user = JsonHelper.getStringOptional(requestJson, "user");
// account for case when user is in the context
if (user == null) {
user = JsonHelper.getStringOptional(getContext().getContextJson(), "user");
if (user == null) {
user = JsonHelper.getStringRequired(getContext().getContextJson(), "userId");
}
}
}
return user;
}
public Context getContext() {
if (context == null) {
context = new Context(JsonHelper.getObjectRequired(requestJson, "context"));
}
return context;
}
public Prefetch getPrefetch() {
if (prefetch == null) {
prefetch = new Prefetch(JsonHelper.getObjectOptional(requestJson, "prefetch"), <API key>);
}
return prefetch;
}
public boolean isApplyCql() {
if (applyCql == null) {
applyCql = JsonHelper.getBooleanOptional(requestJson, "applyCql");
}
return applyCql;
}
} |
var models = require('../../models/mongoModels');
exports.setup = function (router, helper, mongoose) {
var Account = models.Account(mongoose);
router.use(helper.logRequest);
router.route('/')
.get(function(req, res) {
Account.find(function(err, accounts) {
if(err) return helper.logAndSend500(err, res);
res.json(accounts);
});
})
.post(function(req, res) {
var account = new Account();
account.id = req.body.id;
account.name = req.body.name;
if (!account.id || !account.name) return helper.sendStatus(res, 400);
account.save(function(err) {
if(err) return helper.logAndSend500(err, res);
res.json({ msg: 'Account created' });
});
});
router.route('/:id')
.get(function(req, res) {
Account.findOne({ id: req.params.id }, function(err, account) {
if(err) return helper.logAndSend500(err, res);
if(!account) return helper.sendStatus(res, 404);
res.json(account);
});
})
.put(function(req, res) {
var id = req.params.id,
name = req.body.name;
if (!id || !name) return helper.sendStatus(res, 400);
Account.findOne({ id: id }, function(err, account) {
if(err) return helper.logAndSend500(err, res);
if(!account) return helper.sendStatus(res, 404);
account.name = name;
account.save(function(err) {
if(err) return helper.logAndSend500(err, res);
res.json({ msg: 'Account updated' });
});
});
})
.delete(function(req, res) {
var id = req.params.id;
if(!id) return helper.sendStatus(res, 400);
Account.findOneAndRemove({ id: id }, function(err, result) {
if(err) return helper.logAndSend500(err, res);
if(!result) return helper.sendStatus(res, 404);
res.json({ msg: 'Account removed' });
});
});
return router;
}; |
package sync
import (
"fmt"
"sync"
"sync/atomic"
)
// Init is a helper to perform initializer function only single time and return saved error if any
type Init struct {
m sync.Mutex
done uint32
err error
}
// Do calls function initializer only for the first time for this instance of Init and saves error returned from it
// if any. Do returns nil if no error happened during the initializer execution or it returns error. Even in case of
// error during initializer execution it will not be called second time, error will be saved and return each time Do
// called. If initializer panics, it'll be recovered and captured as error and returned by future Do calls.
func (init *Init) Do(initializer func() error) (err error) {
// if init already done just returned stored error
if atomic.LoadUint32(&init.done) == 1 {
return init.err
}
// Slow path if init isn't done yet
init.m.Lock()
defer init.m.Unlock()
// Check if init is still not done
if init.done == 0 {
// We consider init done if entered this section
defer atomic.StoreUint32(&init.done, 1)
// Convert panic into error and store it as init error
defer func() {
if recoveredErr := recover(); recoveredErr != nil {
// save panic as error to be returned by next Init.Do call
init.err = fmt.Errorf("panic during init: %s", recoveredErr)
// override error returned from Init.Do
err = init.err
}
}()
// run provided init function and store error returned from it to be returned by next Init.Do call
init.err = initializer()
if init.err != nil {
init.err = fmt.Errorf("error during init: %s", init.err)
}
}
return init.err
} |
package javacommon.base;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.validator.ValidatorForm;
/**
* @author badqiu
*/
public class BaseStrutsForm extends ValidatorForm{
protected Log log = LogFactory.getLog(getClass());
} |
package de.tum.in.niedermr.ta.core.artifacts.exceptions;
import java.io.InputStream;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.objectweb.asm.ClassReader;
import de.tum.in.niedermr.ta.core.artifacts.visitor.IArtifactVisitor;
import de.tum.in.niedermr.ta.core.code.operation.ICodeOperation;
import de.tum.in.niedermr.ta.core.code.util.JavaUtility;
/** Fault tolerant exception handler. */
public class <API key> implements <API key> {
/** Logger. */
private static final Logger LOGGER = LogManager.getLogger(<API key>.class);
/** {@inheritDoc} */
@Override
public void <API key>(Throwable throwable, IArtifactVisitor<?> visitor, ClassReader classInputReader,
String originalClassPath) {
LOGGER.warn("Skipping " + JavaUtility.toClassName(classInputReader.getClassName()) + " in fault tolerant mode. "
+ throwable.getClass().getName() + " occurred with message '" + throwable.getMessage() + "'.");
}
/** {@inheritDoc} */
@Override
public void <API key>(Throwable throwable, IArtifactVisitor<?> visitor, InputStream inputStream,
String resourcePath) {
LOGGER.warn("Skipping resource " + resourcePath + " in fault tolerant mode. " + throwable.getClass().getName()
+ " occurred with message '" + throwable.getMessage() + "'.");
}
/** {@inheritDoc} */
@Override
public void <API key>(Throwable throwable, IArtifactVisitor<?> visitor,
ICodeOperation operation, String artifactContainer) {
LOGGER.error("Skipping artifact processing in fault tolerant mode because of a failure: " + artifactContainer,
throwable);
operation.reset();
}
} |
/* $NetBSD: sscom_var.h,v 1.13 2014/03/14 21:40:48 matt Exp $ */
/* derived from sys/dev/ic/comvar.h */
#ifndef <API key>
#define <API key>
#include "opt_multiprocessor.h"
#include "opt_lockdebug.h"
#include "opt_sscom.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/termios.h>
#include <sys/callout.h>
#include <sys/bus.h>
#ifdef SSCOM_S3C2410
#include <arm/s3c2xx0/s3c2410reg.h>
#include <arm/s3c2xx0/s3c2410var.h>
#elif defined(SSCOM_S3C2440)
#include <arm/s3c2xx0/s3c2440reg.h>
#include <arm/s3c2xx0/s3c2440var.h>
#endif
/* Hardware flag masks */
#define SSCOM_HW_FLOW 0x02
#define SSCOM_HW_DEV_OK 0x04
#define SSCOM_HW_CONSOLE 0x08
#define SSCOM_HW_KGDB 0x10
#define SSCOM_HW_TXINT 0x20
#define SSCOM_HW_RXINT 0x40
/* Buffer size for character buffer */
#define SSCOM_RING_SIZE 2048
struct sscom_softc {
device_t sc_dev;
void *sc_si;
struct tty *sc_tty;
struct callout sc_diag_callout;
int sc_unit; /* UART0/UART1 */
int sc_frequency;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
u_int sc_overflows,
sc_floods,
sc_errors;
int sc_hwflags,
sc_swflags;
u_int sc_r_hiwat,
sc_r_lowat;
u_char *volatile sc_rbget,
*volatile sc_rbput;
volatile u_int sc_rbavail;
u_char *sc_rbuf,
*sc_ebuf;
u_char *sc_tba;
u_int sc_tbc,
sc_heldtbc;
volatile u_char sc_rx_flags,
#define RX_TTY_BLOCKED 0x01
#define RX_TTY_OVERFLOWED 0x02
#define RX_IBUF_BLOCKED 0x04
#define RX_IBUF_OVERFLOWED 0x08
#define RX_ANY_BLOCK 0x0f
sc_tx_busy,
sc_tx_done,
sc_tx_stopped,
sc_st_check,
sc_rx_ready;
/* data to stored in UART registers.
actual write to UART register is pended while sc_tx_busy */
uint16_t sc_ucon; /* control register */
uint16_t sc_ubrdiv; /* baudrate register */
uint8_t sc_heldchange; /* register changes are pended */
uint8_t sc_ulcon; /* line control */
uint8_t sc_umcon; /* modem control */
#define UMCON_HW_MASK (UMCON_RTS)
#define UMCON_DTR (1<<4) /* provided by other means such as GPIO */
uint8_t sc_msts; /* modem status */
#define MSTS_CTS UMSTAT_CTS /* bit0 */
#define MSTS_DCD (1<<1)
#define MSTS_DSR (1<<2)
uint8_t sc_msr_dcd; /* DCD or 0 */
uint8_t sc_mcr_dtr; /* DTR or 0 or DTR|RTS*/
uint8_t sc_mcr_rts; /* RTS or DTR in sc_umcon */
uint8_t sc_msr_cts; /* CTS or DCD in sc_msts */
uint8_t sc_msr_mask; /* sc_msr_cts|sc_msr_dcd */
uint8_t sc_mcr_active;
uint8_t sc_msr_delta;
uint8_t sc_rx_irqno, sc_tx_irqno;
#if 0
/* PPS signal on DCD, with or without inkernel clock disciplining */
u_char sc_ppsmask; /* pps signal mask */
u_char sc_ppsassert; /* pps leading edge */
u_char sc_ppsclear; /* pps trailing edge */
pps_info_t ppsinfo;
pps_params_t ppsparam;
#endif
#ifdef RND_COM
krndsource_t sc_rnd_source;
#endif
#if (defined(MULTIPROCESSOR) || defined(LOCKDEBUG)) && defined(SSCOM_MPLOCK)
kmutex_t sc_lock;
#endif
/*
* S3C2XX0's UART doesn't have modem control/status pins.
* On platforms with S3C2XX0, those pins are simply unavailable
* or provided by other means such as GPIO. Platform specific attach routine
* have to provide functions to read/write modem control/status pins.
*/
int (*<API key>)( struct sscom_softc * );
void (*<API key>)( struct sscom_softc * );
void (*<API key>)(struct sscom_softc *, bool, u_int);
};
/* UART register address, etc. */
struct sscom_uart_info {
int unit;
char tx_int, rx_int, err_int;
bus_addr_t iobase;
};
#define sscom_rxrdy(iot,ioh) \
(bus_space_read_1((iot), (ioh), SSCOM_UTRSTAT) & UTRSTAT_RXREADY)
#define sscom_getc(iot,ioh) bus_space_read_1((iot), (ioh), SSCOM_URXH)
#define sscom_geterr(iot,ioh) bus_space_read_1((iot), (ioh), SSCOM_UERSTAT)
#define sscom_mask_rxint(sc) \
(*(sc)-><API key>)((sc), false, SSCOM_HW_RXINT)
#define sscom_unmask_rxint(sc) \
(*(sc)-><API key>)((sc), true, SSCOM_HW_RXINT)
#define sscom_mask_txint(sc) \
(*(sc)-><API key>)((sc), false, SSCOM_HW_TXINT)
#define sscom_unmask_txint(sc) \
(*(sc)-><API key>)((sc), true, SSCOM_HW_TXINT)
#define sscom_mask_txrxint(sc) \
(*(sc)-><API key>)((sc), false, \
SSCOM_HW_RXINT | SSCOM_HW_TXINT)
#define <API key>(sc) \
(*(sc)-><API key>)((sc), true, \
SSCOM_HW_RXINT | SSCOM_HW_TXINT)
#define sscom_enable_rxint(sc) \
(sscom_unmask_rxint(sc), ((sc)->sc_hwflags |= SSCOM_HW_RXINT))
#define sscom_disable_rxint(sc) \
(sscom_mask_rxint(sc), ((sc)->sc_hwflags &= ~SSCOM_HW_RXINT))
#define sscom_enable_txint(sc) \
(sscom_unmask_txint(sc), ((sc)->sc_hwflags |= SSCOM_HW_TXINT))
#define sscom_disable_txint(sc) \
(sscom_mask_txint(sc),((sc)->sc_hwflags &= ~SSCOM_HW_TXINT))
#define <API key>(sc) \
(<API key>(sc),((sc)->sc_hwflags |= (SSCOM_HW_TXINT|SSCOM_HW_RXINT)))
#define <API key>(sc) \
(sscom_mask_txrxint(sc),((sc)->sc_hwflags &= ~(SSCOM_HW_TXINT|SSCOM_HW_RXINT)))
int sscomspeed(long, long);
void sscom_attach_subr(struct sscom_softc *);
int sscom_detach(device_t, int);
int sscom_activate(device_t, enum devact);
void sscom_shutdown(struct sscom_softc *);
void sscomdiag(void *);
void sscomstart(struct tty *);
int sscomparam(struct tty *, struct termios *);
int sscomread(dev_t, struct uio *, int);
void sscom_config(struct sscom_softc *);
int sscomtxintr(void *);
int sscomrxintr(void *);
int sscom_cnattach(bus_space_tag_t, const struct sscom_uart_info *,
int, int, tcflag_t);
void sscom_cndetach(void);
int sscom_is_console(bus_space_tag_t, int, bus_space_handle_t *);
#ifdef KGDB
int sscom_kgdb_attach(bus_space_tag_t, const struct sscom_uart_info *,
int, int, tcflag_t);
#endif
#endif /* <API key> */ |
# AUTOGENERATED FILE
FROM balenalib/nitrogen8mm-alpine:3.11-run
ENV GO_VERSION 1.14.13
# set up nsswitch.conf for Go's "netgo" implementation
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
# gcc for cgo
RUN apk add --no-cache git gcc ca-certificates
RUN fetchDeps='curl' \
&& set -x \
&& apk add --no-cache $fetchDeps \
&& mkdir -p /usr/local/go \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/golang/v$GO_VERSION/go$GO_VERSION.<API key>.tar.gz" \
&& echo "<SHA256-like> go$GO_VERSION.<API key>.tar.gz" | sha256sum -c - \
&& tar -xzf "go$GO_VERSION.<API key>.tar.gz" -C /usr/local/go --strip-components=1 \
&& rm -f go$GO_VERSION.<API key>.tar.gz
ENV GOROOT /usr/local/go
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/<SHA1-like>/scripts/assets/tests/test-stack@golang.sh" \
&& echo "Running test-stack@golang" \
&& chmod +x test-stack@golang.sh \
&& bash test-stack@golang.sh \
&& rm -rf test-stack@golang.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https:
RUN echo $'#!/bin/bash\nbalena-info\nbusybox ln -sf /bin/busybox /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& ln -f /bin/sh /bin/sh.real \
&& ln -f /bin/sh-shim /bin/sh |
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_45) on Fri Nov 14 23:56:06 UTC 2014 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Class org.apache.hadoop.fs.http.client.HttpFSFileSystem.FILE_TYPE (Apache Hadoop HttpFS 2.5.2 API)
</TITLE>
<META NAME="date" CONTENT="2014-11-14">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.hadoop.fs.http.client.HttpFSFileSystem.FILE_TYPE (Apache Hadoop HttpFS 2.5.2 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/hadoop/fs/http/client/HttpFSFileSystem.FILE_TYPE.html" title="enum in org.apache.hadoop.fs.http.client"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?org/apache/hadoop/fs/http/client//<API key>.FILE_TYPE.html" target="_top"><B>FRAMES</B></A>
<A HREF="HttpFSFileSystem.FILE_TYPE.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.apache.hadoop.fs.http.client.HttpFSFileSystem.FILE_TYPE</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../../../../../org/apache/hadoop/fs/http/client/HttpFSFileSystem.FILE_TYPE.html" title="enum in org.apache.hadoop.fs.http.client">HttpFSFileSystem.FILE_TYPE</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.fs.http.client"><B>org.apache.hadoop.fs.http.client</B></A></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.fs.http.client"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../../../org/apache/hadoop/fs/http/client/HttpFSFileSystem.FILE_TYPE.html" title="enum in org.apache.hadoop.fs.http.client">HttpFSFileSystem.FILE_TYPE</A> in <A HREF="../../../../../../../org/apache/hadoop/fs/http/client/package-summary.html">org.apache.hadoop.fs.http.client</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="<API key>">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../../../org/apache/hadoop/fs/http/client/package-summary.html">org.apache.hadoop.fs.http.client</A> that return <A HREF="../../../../../../../org/apache/hadoop/fs/http/client/HttpFSFileSystem.FILE_TYPE.html" title="enum in org.apache.hadoop.fs.http.client">HttpFSFileSystem.FILE_TYPE</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../../../org/apache/hadoop/fs/http/client/HttpFSFileSystem.FILE_TYPE.html" title="enum in org.apache.hadoop.fs.http.client">HttpFSFileSystem.FILE_TYPE</A></CODE></FONT></TD>
<TD><CODE><B>HttpFSFileSystem.FILE_TYPE.</B><B><A HREF="../../../../../../../org/apache/hadoop/fs/http/client/HttpFSFileSystem.FILE_TYPE.html#getType(org.apache.hadoop.fs.FileStatus)">getType</A></B>(org.apache.hadoop.fs.FileStatus fileStatus)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../../../org/apache/hadoop/fs/http/client/HttpFSFileSystem.FILE_TYPE.html" title="enum in org.apache.hadoop.fs.http.client">HttpFSFileSystem.FILE_TYPE</A></CODE></FONT></TD>
<TD><CODE><B>HttpFSFileSystem.FILE_TYPE.</B><B><A HREF="../../../../../../../org/apache/hadoop/fs/http/client/HttpFSFileSystem.FILE_TYPE.html
<BR>
Returns the enum constant of this type with the specified name.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../../../org/apache/hadoop/fs/http/client/HttpFSFileSystem.FILE_TYPE.html" title="enum in org.apache.hadoop.fs.http.client">HttpFSFileSystem.FILE_TYPE</A>[]</CODE></FONT></TD>
<TD><CODE><B>HttpFSFileSystem.FILE_TYPE.</B><B><A HREF="../../../../../../../org/apache/hadoop/fs/http/client/HttpFSFileSystem.FILE_TYPE.html#values()">values</A></B>()</CODE>
<BR>
Returns an array containing the constants of this enum type, in
the order they are declared.</TD>
</TR>
</TABLE>
<P>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/hadoop/fs/http/client/HttpFSFileSystem.FILE_TYPE.html" title="enum in org.apache.hadoop.fs.http.client"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?org/apache/hadoop/fs/http/client//<API key>.FILE_TYPE.html" target="_top"><B>FRAMES</B></A>
<A HREF="HttpFSFileSystem.FILE_TYPE.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
Copyright &
</BODY>
</HTML> |
package ru.pavlenov.scala.homework.rosalind.ngs
import ru.pavlenov.scala.utils.File
import scala.collection.mutable.ArrayBuffer
object Bphr {
def start() {
println("Base Quality Distribution ")
println("from http://rosalind.info/problems/Bphr/")
println("==========================")
val data = File.fromData(this)
val delta = 33
val threshold = data.head.toInt
val list = data.tail
val line = list.length / 4
val scores = new Array[Int](list(1).length)
list.sliding(4, 4).toList.map(el => {
val ch = el(3).map(c => c.toByte - delta).toList
var i = 0; for (c <- ch) { scores(i) += c; i += 1 }
})
var cnt = 0
scores.map(_ / line).foreach(el => {
if (el < threshold) cnt += 1
})
println(cnt)
}
} |
package com.tangpeng.mycoolweather.db;
import org.litepal.crud.DataSupport;
public class Province extends DataSupport {
private int id;
private String provinceName;
private int provinceCode;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public int getProvinceCode() {
return provinceCode;
}
public void setProvinceCode(int provinceCode) {
this.provinceCode = provinceCode;
}
} |
<?php
namespace TestNamespace
{
function <API key>($message)
{
throw new \RuntimeException($message);
}
class TestClass2
{
public $var;
public function __construct()
{
$this->var = 'foo';
}
}
}
namespace BracketedNamespace
{
function <API key>($message)
{
throw new \RuntimeException("Bracketed Exception: $message");
}
} |
import errno
import os
for num in [errno.ENOENT, errno.EINTR, errno.EBUSY]:
name = errno.errorcode[num]
print('[{num:>2}] {name:<6}: {msg}'.format(
name=name, num=num, msg=os.strerror(num))) |
// <auto-generated/>
#nullable disable
using System;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
using Azure.ResourceManager.Compute.Models;
namespace Azure.ResourceManager.Compute
{
internal partial class <API key>
{
private string subscriptionId;
private Uri endpoint;
private ClientDiagnostics _clientDiagnostics;
private HttpPipeline _pipeline;
<summary> Initializes a new instance of <API key>. </summary>
<param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
<param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
<param name="subscriptionId"> Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. </param>
<param name="endpoint"> server parameter. </param>
<exception cref="<API key>"> This occurs when one of the required arguments is null. </exception>
public <API key>(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
{
if (subscriptionId == null)
{
throw new <API key>(nameof(subscriptionId));
}
endpoint ??= new Uri("https://management.azure.com");
this.subscriptionId = subscriptionId;
this.endpoint = endpoint;
_clientDiagnostics = clientDiagnostics;
_pipeline = pipeline;
}
internal HttpMessage CreateListRequest(string location)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Get;
var uri = new <API key>();
uri.Reset(endpoint);
uri.AppendPath("/subscriptions/", false);
uri.AppendPath(subscriptionId, true);
uri.AppendPath("/providers/Microsoft.Compute/locations/", false);
uri.AppendPath(location, true);
uri.AppendPath("/runCommands", false);
uri.AppendQuery("api-version", "2019-12-01", true);
request.Uri = uri;
return message;
}
<summary> Lists all available run commands for a subscription in a location. </summary>
<param name="location"> The location upon which run commands is queried. </param>
<param name="cancellationToken"> The cancellation token to use. </param>
public async Task<Response<<API key>>> ListAsync(string location, Cancellation<API key> = default)
{
if (location == null)
{
throw new <API key>(nameof(location));
}
using var message = CreateListRequest(location);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
<API key> value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = <API key>.<API key>(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.<API key>(message.Response).ConfigureAwait(false);
}
}
<summary> Lists all available run commands for a subscription in a location. </summary>
<param name="location"> The location upon which run commands is queried. </param>
<param name="cancellationToken"> The cancellation token to use. </param>
public Response<<API key>> List(string location, Cancellation<API key> = default)
{
if (location == null)
{
throw new <API key>(nameof(location));
}
using var message = CreateListRequest(location);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
<API key> value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = <API key>.<API key>(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.<API key>(message.Response);
}
}
internal HttpMessage CreateGetRequest(string location, string commandId)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Get;
var uri = new <API key>();
uri.Reset(endpoint);
uri.AppendPath("/subscriptions/", false);
uri.AppendPath(subscriptionId, true);
uri.AppendPath("/providers/Microsoft.Compute/locations/", false);
uri.AppendPath(location, true);
uri.AppendPath("/runCommands/", false);
uri.AppendPath(commandId, true);
uri.AppendQuery("api-version", "2019-12-01", true);
request.Uri = uri;
return message;
}
<summary> Gets specific run command for a subscription in a location. </summary>
<param name="location"> The location upon which run commands is queried. </param>
<param name="commandId"> The command id. </param>
<param name="cancellationToken"> The cancellation token to use. </param>
public async Task<Response<RunCommandDocument>> GetAsync(string location, string commandId, Cancellation<API key> = default)
{
if (location == null)
{
throw new <API key>(nameof(location));
}
if (commandId == null)
{
throw new <API key>(nameof(commandId));
}
using var message = CreateGetRequest(location, commandId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
RunCommandDocument value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = RunCommandDocument.<API key>(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.<API key>(message.Response).ConfigureAwait(false);
}
}
<summary> Gets specific run command for a subscription in a location. </summary>
<param name="location"> The location upon which run commands is queried. </param>
<param name="commandId"> The command id. </param>
<param name="cancellationToken"> The cancellation token to use. </param>
public Response<RunCommandDocument> Get(string location, string commandId, Cancellation<API key> = default)
{
if (location == null)
{
throw new <API key>(nameof(location));
}
if (commandId == null)
{
throw new <API key>(nameof(commandId));
}
using var message = CreateGetRequest(location, commandId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
RunCommandDocument value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = RunCommandDocument.<API key>(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.<API key>(message.Response);
}
}
internal HttpMessage <API key>(string nextLink, string location)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Get;
var uri = new <API key>();
uri.Reset(endpoint);
uri.AppendRawNextLink(nextLink, false);
request.Uri = uri;
return message;
}
<summary> Lists all available run commands for a subscription in a location. </summary>
<param name="nextLink"> The URL to the next page of results. </param>
<param name="location"> The location upon which run commands is queried. </param>
<param name="cancellationToken"> The cancellation token to use. </param>
public async Task<Response<<API key>>> ListNextPageAsync(string nextLink, string location, Cancellation<API key> = default)
{
if (nextLink == null)
{
throw new <API key>(nameof(nextLink));
}
if (location == null)
{
throw new <API key>(nameof(location));
}
using var message = <API key>(nextLink, location);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
<API key> value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = <API key>.<API key>(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.<API key>(message.Response).ConfigureAwait(false);
}
}
<summary> Lists all available run commands for a subscription in a location. </summary>
<param name="nextLink"> The URL to the next page of results. </param>
<param name="location"> The location upon which run commands is queried. </param>
<param name="cancellationToken"> The cancellation token to use. </param>
public Response<<API key>> ListNextPage(string nextLink, string location, Cancellation<API key> = default)
{
if (nextLink == null)
{
throw new <API key>(nameof(nextLink));
}
if (location == null)
{
throw new <API key>(nameof(location));
}
using var message = <API key>(nextLink, location);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
<API key> value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = <API key>.<API key>(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.<API key>(message.Response);
}
}
}
} |
package com.perforce.p4java.impl.mapbased.rpc.func.helper;
import com.perforce.p4java.CharsetDefs;
import com.perforce.p4java.common.base.OSUtils;
import com.perforce.p4java.exception.P4JavaError;
import com.perforce.p4java.impl.generic.client.ClientLineEnding;
import com.perforce.p4java.impl.mapbased.rpc.sys.<API key>;
import com.perforce.test.P4ExtFileUtils;
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.<API key>;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.<API key>;
import java.lang.reflect.<API key>;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.<API key>;
import java.util.Iterator;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
/**
* MD5Digester Tester.
*/
@SuppressWarnings({ "WeakerAccess", "JUnit5Platform" })
@RunWith(JUnitPlatform.class)
public class MD5DigesterTest {
private MD5Digester md5Digester;
private static File windowsTestFile;
private static File normTestFile;
private static String expectedTestFileMd5 = "<API key>";
private static String <API key> = "<API key>";
private static String <API key> = "<API key>";
@BeforeAll
public static void beforeAll()
throws IOException {
try (InputStream contents = P4ExtFileUtils.getStream(
MD5Digester.class,
"com/perforce/p4java/impl/mapbased/rpc/func/helper/md5_digest_test.txt")) {
windowsTestFile = File.createTempFile("windows", ".txt");
try (FileWriter winOut = new FileWriter(windowsTestFile)) {
normTestFile = File.createTempFile("unix", ".txt");
try (FileWriter unixOut = new FileWriter(normTestFile)) {
Iterator<String> iter = IOUtils.lineIterator(contents, Charset.forName("UTF-8"));
while (iter.hasNext()) {
String line = iter.next();
winOut.write(line + "\r\n");
unixOut.write(line + "\n");
}
}
}
}
}
@BeforeEach
public void beforeEach() {
md5Digester = new MD5Digester();
}
/**
* Method: update(byte[] bytes)
*/
@DisplayName("update(byte[] bytes) with non-null argument")
@Test
public void <API key>() {
byte[] bytes = new byte[] {};
MessageDigest mockMessageDigest = mock(MessageDigest.class);
md5Digester.setMessageDigest(mockMessageDigest);
md5Digester.update(bytes);
verify(mockMessageDigest, times(1)).update(bytes);
}
/**
* Method: update(byte[] bytes)
*/
@DisplayName("update(byte[] bytes) with given null argument")
@Test
public void <API key>() {
MessageDigest mockMessageDigest = mock(MessageDigest.class);
md5Digester.setMessageDigest(mockMessageDigest);
md5Digester.update((byte[]) null);
verify(mockMessageDigest, times(0)).update((byte[]) null);
}
/**
* Method: update(String value)
*/
@DisplayName("update(String value) without exception")
@Test
public void <API key>() throws Exception {
String value = "abc123";
MessageDigest mockMessageDigest = mock(MessageDigest.class);
md5Digester.setMessageDigest(mockMessageDigest);
md5Digester.update(value);
verify(mockMessageDigest, times(1)).update(value.getBytes(CharsetDefs.UTF8.name()));
}
/**
* Method: update(String value)
*/
@DisplayName("update(String value) with exception")
@Test
public void <API key>() {
String value = "abc123";
MessageDigest mockMessageDigest = mock(MessageDigest.class);
doThrow(<API key>.class).when(mockMessageDigest)
.update(any(byte[].class));
md5Digester.setMessageDigest(mockMessageDigest);
Assertions.assertThrows(P4JavaError.class, () -> md5Digester.update(value));
}
/**
* Method: <API key>(File file, Charset charset, boolean
* <API key>)
*/
@Test
public void <API key>() {
String actual = md5Digester.<API key>(normTestFile, Charset.forName("UTF-8"), true);
assertThat(actual, is(expectedTestFileMd5));
// FIXME This fails on non-Windows OS
// Because: <API key>
// sees that the native line ending ("\n") is the same as the server line ending
// (which the ClientLineEnding assumes is \n).
if (OSUtils.isWindows()) {
actual = md5Digester.<API key>(windowsTestFile, Charset.forName("UTF-8"), true);
assertThat(actual, is(expectedTestFileMd5));
}
}
/**
* Method: <API key>(File file, Charset charset, boolean
* <API key>, ClientLineEnding clientLineEnding)
*/
@Test
public void <API key>() {
String actual = md5Digester.<API key>(windowsTestFile, Charset.forName("UTF-8"), false,
null);
assertThat(actual, is(<API key>));
actual = md5Digester.<API key>(normTestFile, Charset.forName("UTF-8"), false,
null);
assertThat(actual, is(expectedTestFileMd5));
}
/**
* Method: <API key>(File file, Charset charset, boolean
* <API key>, ClientLineEnding clientLineEnding)
*/
@Test
public void testDigestFileAs32ByteHexForFileCharsetConvertLineEndingsClientLineEndingNonCharset() {
String actual = md5Digester.<API key>(windowsTestFile, null, false, null);
assertThat(actual, is(<API key>));
actual = md5Digester.<API key>(normTestFile, null, false, null);
assertThat(actual, is(expectedTestFileMd5));
}
/**
* Method: <API key>(File file, Charset charset, boolean
* <API key>, ClientLineEnding clientLineEnding)
*/
@Test
public void testDigestFileAs32ByteHexForFileCharsetConvertLineEndingsClientLineEndingNonCharset_needConvertLindEnding() {
String actual = md5Digester.<API key>(normTestFile, Charset.forName("UTF-8"), true,
null);
assertThat(actual, is(expectedTestFileMd5));
// FIXME This fails on non-Windows computers
actual = md5Digester.<API key>(windowsTestFile, Charset.forName("UTF-8"), true,
null);
//assertThat(actual, is(expectedTestFileMd5));
}
/**
* Method: <API key>(File file, Charset charset, boolean
* <API key>, ClientLineEnding clientLineEnding)
*/
@DisplayName("test <API key>(File file, Charset charset, boolean <API key>, ClientLineEnding clientLineEnding) throw exception")
@Test
public void testDigestFileAs32ByteHexForFileCharsetConvertLineEndingsClientLineEndingNonCharset_throwException() {
File dirAsFile = new File(System.getProperty("java.io.tmpdir"));
String actual = md5Digester.<API key>(dirAsFile, Charset.forName("UTF-8"), true,
null);
assertNull(actual);
}
/**
* Method: <API key>(File file, Charset charset, boolean
* <API key>, ClientLineEnding clientLineEnding)
*/
@Test
public void testDigestFileAs32ByteHexForFileCharsetConvertLineEndingsClientLineEndingNonCharset_nonNullClientLineEnding() {
String actual = md5Digester.<API key>(windowsTestFile, Charset.forName("UTF-8"), true,
ClientLineEnding.FST_L_CR);
assertThat(actual,
is(<API key>));
actual = md5Digester.<API key>(normTestFile, Charset.forName("UTF-8"), true,
ClientLineEnding.FST_L_CR);
assertThat(actual,
is(expectedTestFileMd5));
}
/**
* Method: <API key>(File file)
*/
@Test
public void <API key>() {
String actual = md5Digester.<API key>(windowsTestFile);
assertThat(actual, is(<API key>));
actual = md5Digester.<API key>(normTestFile);
assertThat(actual, is(expectedTestFileMd5));
}
/**
* Method: <API key>(File file, Charset charset)
*/
@Test
public void <API key>() {
String actual = md5Digester.<API key>(windowsTestFile, Charset.forName("UTF-8"));
assertThat(actual, is(<API key>));
actual = md5Digester.<API key>(normTestFile, Charset.forName("UTF-8"));
assertThat(actual, is(expectedTestFileMd5));
}
@DisplayName("test <API key>(File file) throws an exception")
@Test
public void <API key>() {
File dirAsFile = new File(System.getProperty("java.io.tmpdir"));
String actual = md5Digester.<API key>(dirAsFile);
assertNull(actual);
}
/**
* Method: digestStream(InputStream inStream, boolean convertLineEndings,
* ClientLineEnding clientLineEnding)
*/
@DisplayName("test digestStream() with normal file")
@Test
public void testDigestStream1() throws Exception {
// p4ic4idea: use a better loader
//InputStream in = new FileInputStream(getClass().getClassLoader()
// .getResource(
// "com/perforce/p4java/impl/mapbased/rpc/func/helper/md5_digest_test.txt")
// .getFile());
InputStream in = P4ExtFileUtils
.getStream(this, "com/perforce/p4java/impl/mapbased/rpc/func/helper/md5_digest_test.txt");
ClientLineEnding clientLineEnding = ClientLineEnding.FST_L_CR;
Method method = <API key>();
method.setAccessible(true);
method.invoke(md5Digester, in, true, clientLineEnding);
}
@DisplayName("test digestStream() with mock bytes")
@Test
public void testDigestStream2() throws <API key>, <API key>,
<API key>, <API key> {
byte[] sourceBytes = new byte[] { 2, 5, 7, '\r', '\n', '\r', '\n', 8, 11, 59, '\n', '\r',
'\n' };
InputStream inStream = new <API key>(sourceBytes);
Method method = <API key>();
MD5Digester mock = new MD5Digester(4);
method.invoke(mock, inStream, true, ClientLineEnding.FST_L_CRLF);
byte[] actual = mock.digestAsBytes();
// expected
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(new byte[] { 2, 5, 7, '\n', '\n', 8, 11, 59, '\n', '\n' });
byte[] expect = messageDigest.digest();
assertThat(actual, is(expect));
}
private Method <API key>() throws <API key> {
Method method = MD5Digester.class.getDeclaredMethod("digestStream", InputStream.class,
boolean.class, ClientLineEnding.class);
method.setAccessible(true);
return method;
}
@Test
public void <API key>()
throws Exception {
boolean expected = ClientLineEnding.CONVERT_TEXT;
ClientLineEnding nullObj = null;
Method method = MD5Digester.class.getDeclaredMethod(
"<API key>", ClientLineEnding.class);
method.setAccessible(true);
boolean actual = (boolean) method.invoke(md5Digester, nullObj);
assertThat(actual, is(expected));
}
@Test
public void <API key>()
throws Exception {
Method method = MD5Digester.class.getDeclaredMethod(
"<API key>", ClientLineEnding.class);
method.setAccessible(true);
boolean actual = (boolean) method.invoke(md5Digester, ClientLineEnding.FST_L_CR);
assertThat(actual, is(true));
}
@DisplayName("<API key>() with need covert client line ending argument")
@Test
public void <API key>() throws Exception {
ClientLineEnding clientLineEnding = ClientLineEnding.FST_L_CR;
byte lastByte = ClientLineEnding.FST_L_CR_BYTES[0];
Method method = MD5Digester.class.getDeclaredMethod(
"<API key>",
byte.class, ClientLineEnding.class);
method.setAccessible(true);
int actual = (int) method.invoke(md5Digester, lastByte, clientLineEnding);
int expected = ClientLineEnding.FST_L_CR_BYTES.length - 1;
assertThat(actual, is(expected));
}
@DisplayName("update(ByteBuffer byteBuf) with nonNull argument")
@Test
public void <API key>() {
byte[] mockBytes = { 1, 2, 3 };
ByteBuffer byteBuffer = ByteBuffer.wrap(mockBytes, 0, 3);
MessageDigest mockMessageDigest = mock(MessageDigest.class);
md5Digester.setMessageDigest(mockMessageDigest);
md5Digester.update(byteBuffer);
verify(mockMessageDigest, times(1)).update(mockBytes);
}
@DisplayName("update(ByteBuffer byteBuf) with nonNull argument")
@Test
public void <API key>() {
ByteBuffer byteBuffer = null;
MessageDigest mockMessageDigest = mock(MessageDigest.class);
md5Digester.setMessageDigest(mockMessageDigest);
md5Digester.update(byteBuffer);
verify(mockMessageDigest, times(0)).update(any(byte[].class));
}
@DisplayName("<API key>() and it's converted")
@Test
public void <API key>()
throws <API key>, <API key>, <API key> {
byte[] sourceBytes = new byte[] { 2, 5, 7, '\n', '\r', '\n', 12, 13 };
int indexOfSourceBytes = 3;
int length = 8;
byte[] clientLineEndBytes = new byte[] { '\n', '\r', '\n' };
boolean actual = <API key>(sourceBytes, indexOfSourceBytes, length,
clientLineEndBytes);
assertThat(actual, is(true));
}
@DisplayName("<API key>() and it's not converted but first byte is same")
@Test
public void <API key>()
throws <API key>, <API key>, <API key> {
byte[] sourceBytes = new byte[] { 2, 5, 7, '\n', '\n', '\r', '\n', 12, 13 };
int indexOfSourceBytes = 3;
int length = 8;
byte[] clientLineEndBytes = new byte[] { '\n', '\r', '\n' };
boolean actual = <API key>(sourceBytes, indexOfSourceBytes, length,
clientLineEndBytes);
assertThat(actual, is(false));
}
@DisplayName("<API key>() and it's not converted")
@Test
public void <API key>()
throws <API key>, <API key>, <API key> {
byte[] sourceBytes = new byte[] { 2, 5, 7, '\r', '\n', '\r', '\n', 12, 13 };
int indexOfSourceBytes = 3;
int length = 8;
byte[] clientLineEndBytes = new byte[] { '\n', '\r', '\n' };
boolean actual = <API key>(sourceBytes, indexOfSourceBytes, length,
clientLineEndBytes);
assertThat(actual, is(false));
}
private boolean <API key>(byte[] sourceBytes,
final int indexOfSourceBytes, final int length, byte[] clientLineEndBytes)
throws <API key>, <API key>, <API key> {
Method method = MD5Digester.class.getDeclaredMethod(
"<API key>", byte[].class, int.class, int.class,
byte[].class);
method.setAccessible(true);
return (boolean) method.invoke(md5Digester, sourceBytes, indexOfSourceBytes, length,
clientLineEndBytes);
}
@DisplayName("test <API key>() - 1. source bytes use same client line endings")
@Test
public void <API key>()
throws <API key>, <API key>, <API key> {
byte[] sourceBytes = new byte[] { 2, 5, 7, '\r', '\n', 12, 13 };
int start = 3;
int length = 7;
ClientLineEnding clientLineEnding = ClientLineEnding.FST_L_CRLF;
ByteBuffer actual = <API key>(sourceBytes, start,
length, clientLineEnding);
ByteBuffer expected = ByteBuffer.wrap(new byte[] { '\n', 12, 13 }, 0, 3);
assertThat(actual, is(expected));
}
@DisplayName("test <API key>() - 2. source bytes use same client line endings")
@Test
public void <API key>()
throws <API key>, <API key>, <API key> {
byte[] sourceBytes = new byte[] { 2, 5, 7, '\n', '\r', '\n', 12, 13 };
int start = 3;
int length = 8;
ClientLineEnding clientLineEnding = ClientLineEnding.FST_L_CRLF;
ByteBuffer actual = <API key>(sourceBytes, start,
length, clientLineEnding);
ByteBuffer expected = ByteBuffer.wrap(new byte[] { '\n', '\n', 12, 13 }, 0, 4);
assertThat(actual, is(expected));
}
@DisplayName("test <API key>() - 3. is not require convert client or local line ending to server format")
@Test
public void <API key>()
throws <API key>, <API key>, <API key> {
byte[] sourceBytes = new byte[] { 2, 5, 7, '\n', '\r', '\n', 12, 13 };
int start = 3;
int length = 5;
ClientLineEnding clientLineEnding = ClientLineEnding.FST_L_LF;
ByteBuffer actual = <API key>(sourceBytes, start,
length, clientLineEnding);
ByteBuffer expected = ByteBuffer.wrap(sourceBytes, start, length);
assertThat(actual, is(expected));
}
private ByteBuffer <API key>(
@Nonnull byte[] sourceBytes, final int start, final int length,
@Nullable ClientLineEnding clientLineEnding)
throws <API key>, <API key>, <API key> {
Method method = MD5Digester.class.getDeclaredMethod("<API key>",
byte[].class, int.class, int.class, ClientLineEnding.class);
method.setAccessible(true);
return (ByteBuffer) method.invoke(md5Digester, sourceBytes, start, length,
clientLineEnding);
}
@DisplayName("test <API key>() - 1. verify if last byte ends with first byte of client line ending.")
@Test
public void <API key>()
throws <API key>, <API key>, <API key>,
IOException {
byte[] sourceBytes = new byte[] { 2, 5, 7, '\r', '\n', '\r', '\n', 8, 11, 59, '\n', '\r',
'\n' };
InputStream inStream = new <API key>(sourceBytes);
byte[] readBuffer = new byte[10];
readBuffer[0] = 2;
readBuffer[1] = 5;
readBuffer[2] = 7;
readBuffer[3] = '\r';
int <API key> = 4;
inStream.read(new byte[<API key>]);
ByteBuffer actual = <API key>(
inStream, readBuffer, <API key>, ClientLineEnding.FST_L_CRLF);
byte[] expectedBytes = new byte[] { 2, 5, 7, '\n' };
ByteBuffer expected = ByteBuffer.wrap(expectedBytes, 0, 4);
assertThat(actual, equalTo(expected));
}
private ByteBuffer <API key>(
@Nonnull InputStream inStream, @Nonnull final byte[] readBuffer,
final int <API key>, @Nullable ClientLineEnding clientLineEnding)
throws <API key>, <API key>, <API key> {
Method method = MD5Digester.class.getDeclaredMethod(
"<API key>",
InputStream.class, byte[].class, int.class, ClientLineEnding.class);
method.setAccessible(true);
return (ByteBuffer) method.invoke(md5Digester, inStream, readBuffer,
<API key>, clientLineEnding);
}
@Test
public void <API key>()
throws IOException, <API key>, <API key>,
<API key> {
byte[] sourceBytes = new byte[] { 'q', 'c', 'e', '\r', '\n', '\r', '\n', 'd', 'h', 'b',
'\n', '\r', '\n' };
<API key> unicodeInputStream = new <API key>(
new <API key>(sourceBytes));
InputStreamReader encodedStreamReader = new InputStreamReader(unicodeInputStream,
StandardCharsets.US_ASCII);
CharsetEncoder utf8CharsetEncoder = CharsetDefs.UTF8.newEncoder()
.onMalformedInput(CodingErrorAction.REPORT)
.<API key>(CodingErrorAction.REPORT);
char[] buffer = new char[5];
buffer[0] = 'q';
buffer[1] = 'c';
buffer[2] = 'e';
buffer[3] = '\r';
ByteBuffer utf8ByteBuffer = utf8CharsetEncoder.encode(CharBuffer.wrap(buffer, 0, 4));
encodedStreamReader.read(new char[4]);
ByteBuffer actual = <API key>(
encodedStreamReader, utf8CharsetEncoder, utf8ByteBuffer,
ClientLineEnding.FST_L_CRLF);
byte[] expectedBytes = new byte[] { 'q', 'c', 'e', '\n' };
ByteBuffer expected = ByteBuffer.wrap(expectedBytes, 0, 4);
assertThat(actual, is(expected));
}
@Test
public void <API key>()
throws IOException, <API key>, <API key>,
<API key> {
byte[] sourceBytes = new byte[] { 'q', 'c', 'e', '\r', '\n', '\r', '\n', 'd', 'h', 'b',
'\n', '\r', '\n' };
<API key> unicodeInputStream = new <API key>(
new <API key>(sourceBytes));
InputStreamReader encodedStreamReader = new InputStreamReader(unicodeInputStream,
StandardCharsets.US_ASCII);
CharsetEncoder utf8CharsetEncoder = CharsetDefs.UTF8.newEncoder()
.onMalformedInput(CodingErrorAction.REPORT)
.<API key>(CodingErrorAction.REPORT);
char[] buffer = new char[7];
buffer[0] = 'q';
buffer[1] = 'c';
buffer[2] = 'e';
buffer[3] = '\r';
buffer[4] = '\n';
ByteBuffer utf8ByteBuffer = utf8CharsetEncoder.encode(CharBuffer.wrap(buffer, 0, 5));
encodedStreamReader.read(new char[5]);
ByteBuffer actual = <API key>(
encodedStreamReader, utf8CharsetEncoder, utf8ByteBuffer,
ClientLineEnding.FST_L_CRLF);
byte[] expectedBytes = new byte[] { 'q', 'c', 'e', '\n' };
ByteBuffer expected = ByteBuffer.wrap(expectedBytes, 0, 4);
assertThat(actual, is(expected));
}
@Test
public void <API key>()
throws IOException, <API key>, <API key>,
<API key> {
byte[] sourceBytes = new byte[] { 'q', 'c', 'e', '\r', '\n', '\r', '\n', 'd', 'h', 'b',
'\n', '\r', '\n' };
<API key> unicodeInputStream = new <API key>(
new <API key>(sourceBytes));
InputStreamReader encodedStreamReader = new InputStreamReader(unicodeInputStream,
StandardCharsets.US_ASCII);
CharsetEncoder utf8CharsetEncoder = CharsetDefs.UTF8.newEncoder()
.onMalformedInput(CodingErrorAction.REPORT)
.<API key>(CodingErrorAction.REPORT);
char[] buffer = new char[9];
buffer[0] = 'q';
buffer[1] = 'c';
buffer[2] = 'e';
buffer[3] = '\r';
buffer[4] = '\n';
buffer[5] = '\r';
buffer[6] = '\n';
buffer[7] = 'd';
ByteBuffer utf8ByteBuffer = utf8CharsetEncoder.encode(CharBuffer.wrap(buffer, 0, 8));
encodedStreamReader.read(new char[8]);
ByteBuffer actual = <API key>(
encodedStreamReader, utf8CharsetEncoder, utf8ByteBuffer,
ClientLineEnding.FST_L_CRLF);
byte[] expectedBytes = new byte[] { 'q', 'c', 'e', '\n', '\n', 'd' };
ByteBuffer expected = ByteBuffer.wrap(expectedBytes, 0, 6);
assertThat(actual, is(expected));
}
private ByteBuffer <API key>(
@Nonnull InputStreamReader encodedStreamReader,
@Nonnull CharsetEncoder utf8CharsetEncoder, @Nonnull ByteBuffer utf8ByteBuffer,
@Nullable ClientLineEnding clientLineEnding)
throws <API key>, <API key>, <API key> {
Method method = MD5Digester.class.getDeclaredMethod(
"<API key>",
InputStreamReader.class, CharsetEncoder.class, ByteBuffer.class,
ClientLineEnding.class);
method.setAccessible(true);
return (ByteBuffer) method.invoke(md5Digester, encodedStreamReader, utf8CharsetEncoder,
utf8ByteBuffer, clientLineEnding);
}
} |
var widgetDirective = function($compile) {
var Chart = {
_render: function(node, data, chart, do_after){
nv.addGraph(function() {
d3.select(node)
.datum(data).transition().duration(0)
.call(chart);
if (typeof do_after === "function") {
do_after(node, chart)
}
nv.utils.windowResize(chart.update);
})
},
_widgets: {
Pie: "pie",
StackedArea: "stack",
Lines: "lines",
Histogram: "histogram"
},
get_chart: function(widget) {
if (widget in this._widgets) {
var name = this._widgets[widget];
return Chart[name]
}
return function() { console.log("Error: unexpected widget:", widget) }
},
pie: function(node, data, opts, do_after) {
var chart = nv.models.pieChart()
.x(function(d) { return d.key })
.y(function(d) { return d.values })
.showLabels(true)
.labelType("percent")
.donut(true)
.donutRatio(0.25)
.donutLabelsOutside(true)
.color(function(d){
if (d.data && d.data.color) { return d.data.color }
});
var colorizer = new Chart.colorizer("errors"), data_ = [];
for (var i in data) {
data_.push({key:data[i][0], values:data[i][1], color:colorizer.get_color(data[i][0])})
}
Chart._render(node, data_, chart)
},
colorizer: function(failure_key, failure_color) {
this.failure_key = failure_key || "failed_duration";
this.failure_color = failure_color || "#d62728"; // red
this.color_idx = -1;
/* NOTE(amaretskiy): this is actually a result of
d3.scale.category20().range(), excluding red color (#d62728)
which is reserved for errors */
this.colors = ["#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c",
"#98df8a", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b",
"#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7",
"#bcbd22", "#dbdb8d", "#17becf", "#9edae5"];
this.get_color = function(key) {
if (key === this.failure_key) {
return this.failure_color
}
if (this.color_idx > (this.colors.length - 2)) {
this.color_idx = 0
} else {
this.color_idx++
}
return this.colors[this.color_idx]
}
},
stack: function(node, data, opts, do_after) {
var chart = nv.models.stackedAreaChart()
.x(function(d) { return d[0] })
.y(function(d) { return d[1] })
.<API key>(opts.guide)
.showControls(opts.controls)
.clipEdge(true);
chart.xAxis
.axisLabel(opts.xname)
.tickFormat(opts.xformat)
.showMaxMin(opts.showmaxmin);
chart.yAxis
.orient("left")
.tickFormat(d3.format(opts.yformat || ",.3f"));
var colorizer = new Chart.colorizer(), data_ = [];
for (var i in data) {
data_.push({key:data[i][0], values:data[i][1], color:colorizer.get_color(data[i][0])})
}
Chart._render(node, data_, chart, do_after);
},
lines: function(node, data, opts, do_after) {
var chart = nv.models.lineChart()
.x(function(d) { return d[0] })
.y(function(d) { return d[1] })
.<API key>(opts.guide)
.clipEdge(true);
chart.xAxis
.axisLabel(opts.xname)
.tickFormat(opts.xformat)
.rotateLabels(opts.xrotate)
.showMaxMin(opts.showmaxmin);
chart.yAxis
.orient("left")
.tickFormat(d3.format(opts.yformat || ",.3f"));
var colorizer = new Chart.colorizer(), data_ = [];
for (var i in data) {
data_.push({key:data[i][0], values:data[i][1], color:colorizer.get_color(data[i][0])})
}
Chart._render(node, data_, chart, do_after)
},
histogram: function(node, data, opts) {
var chart = nv.models.multiBarChart()
.reduceXTicks(true)
.showControls(false)
.transitionDuration(0)
.groupSpacing(0.05);
chart
.legend.radioButtonMode(true);
chart.xAxis
.axisLabel("Duration (seconds)")
.tickFormat(d3.format(",.2f"));
chart.yAxis
.axisLabel("Iterations (frequency)")
.tickFormat(d3.format("d"));
Chart._render(node, data, chart)
}
};
return {
restrict: "A",
scope: { data: "=" },
link: function(scope, element, attrs) {
scope.$watch("data", function(data) {
if (! data) { return console.log("Chart has no data to render!") }
if (attrs.widget === "Table") {
var ng_class = attrs.lastrowClass ? " ng-class='{"+attrs.lastrowClass+":$last}'" : "";
var template = "<table class='striped'><thead>" +
"<tr><th ng-repeat='i in data.cols track by $index'>{{i}}<tr>" +
"</thead><tbody>" +
"<tr" + ng_class + " ng-repeat='row in data.rows track by $index'>" +
"<td ng-repeat='i in row track by $index'>{{i}}" +
"<tr>" +
"</tbody></table>";
var el = element.empty().append($compile(template)(scope)).children()[0]
} else if (attrs.widget === "TextArea") {
var template = "<div style='padding:0 0 5px' ng-repeat='str in data track by $index'>{{str}}</div><div style='height:10px'></div>";
var el = element.empty().append($compile(template)(scope)).children()[0]
} else {
var el_chart = element.addClass("chart").css({display:"block"});
var el = el_chart.html("<svg></svg>").children()[0];
var do_after = null;
if (attrs.widget in {StackedArea:0, Lines:0}) {
/* Hide widget if not enough data */
if ((! data.length) || (data[0].length < 1) || (data[0][1].length < 2)) {
return element.empty().css({display:"none"})
}
/* NOTE(amaretskiy): Dirty fix for changing chart width in case
if there are too long Y values that overlaps chart box. */
var do_after = function(node, chart){
var g_box = angular.element(el_chart[0].querySelector(".nv-y.nv-axis"));
if (g_box && g_box[0] && g_box[0].getBBox) {
try {
// 30 is padding aroung graphs
var width = g_box[0].getBBox().width + 30;
} catch (err) {
// This happens sometimes, just skip silently
return
}
// 890 is chart width (set by CSS)
if (typeof width === "number" && width > 890) {
width = (890 * 2) - width;
if (width > 0) {
angular.element(node).css({width:width+"px"});
chart.update()
}
}
}
}
}
else if (attrs.widget === "Pie") {
if (! data.length) {
return element.empty().css({display:"none"})
}
}
var opts = {
xname: attrs.nameX || "",
xrotate: attrs.rotateX || 0,
yformat: attrs.formatY || ",.3f",
controls: attrs.controls === "true",
guide: attrs.guide === "true",
showmaxmin: attrs.showmaxmin === "true"
};
if (attrs.formatDateX) {
opts.xformat = function(d) { return d3.time.format(attrs.formatDateX)(new Date(d)) }
} else {
opts.xformat = d3.format(attrs.formatX || "d")
}
Chart.get_chart(attrs.widget)(el, data, opts, do_after);
}
if (attrs.nameY) {
/* NOTE(amaretskiy): Dirty fix for displaying Y-axis label correctly.
I believe sometimes NVD3 will allow doing this in normal way */
var label_y = angular.element("<div>").addClass("chart-label-y").text(attrs.nameY);
angular.element(el).parent().prepend(label_y)
}
if (attrs.description) {
var desc_el = angular.element("<div>").addClass(attrs.descriptionClass || "h3").text(attrs.description);
angular.element(el).parent().prepend(desc_el)
}
if (attrs.title) {
var title_el = angular.element("<div>").addClass(attrs.titleClass || "h2").text(attrs.title);
angular.element(el).parent().prepend(title_el)
}
angular.element(el).parent().append(angular.element("<div style='clear:both'>"))
});
}
}
}; |
package com.google.sitebricks.compiler;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Provider;
import com.google.inject.TypeLiteral;
import com.google.sitebricks.Bricks;
import com.google.sitebricks.Renderable;
import com.google.sitebricks.Respond;
import com.google.sitebricks.<API key>;
import com.google.sitebricks.Template;
import com.google.sitebricks.TestRequestCreator;
import com.google.sitebricks.conversion.MvelTypeConverter;
import com.google.sitebricks.conversion.TypeConverter;
import com.google.sitebricks.headless.Request;
import com.google.sitebricks.http.Delete;
import com.google.sitebricks.http.Get;
import com.google.sitebricks.http.Patch;
import com.google.sitebricks.http.Post;
import com.google.sitebricks.http.Put;
import com.google.sitebricks.rendering.EmbedAs;
import com.google.sitebricks.rendering.control.Chains;
import com.google.sitebricks.rendering.control.WidgetRegistry;
import com.google.sitebricks.routing.PageBook;
import com.google.sitebricks.routing.SystemMetrics;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.lang.annotation.Annotation;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.fail;
/**
* @author Dhanji R. Prasanna (dhanji@gmail.com)
*/
public class <API key> {
private static final String <API key> = "Annotation expressions";
private Injector injector;
private WidgetRegistry registry;
private PageBook pageBook;
private SystemMetrics metrics;
private final Map<String, Class<? extends Annotation>> methods = Maps.newHashMap();
private <API key> compiler() {
registry = injector.getInstance(WidgetRegistry.class);
registry.addEmbed("myfave");
pageBook = injector.getInstance(PageBook.class);
pageBook.at("/somewhere", MyEmbeddedPage.class).apply(Chains.terminal());
return new <API key>(registry, pageBook, metrics);
}
@BeforeMethod
public void pre() {
methods.put("get", Get.class);
methods.put("post", Post.class);
methods.put("put", Put.class);
methods.put("patch", Patch.class);
methods.put("delete", Delete.class);
injector = Guice.createInjector(new AbstractModule() {
protected void configure() {
bind(new TypeLiteral<Request>(){}).toProvider(<API key>());
bind(new TypeLiteral<Map<String, Class<? extends Annotation>>>() {
})
.annotatedWith(Bricks.class)
.toInstance(methods);
}
});
pageBook = createNiceMock(PageBook.class);
metrics = createNiceMock(SystemMetrics.class);
}
@Test
public final void <API key>() {
assert "link".equals(Dom.<API key>("@Link")[0]) : "Extraction wrong: ";
assert "thing".equals(Dom.<API key>("@Thing()")[0]) : "Extraction wrong: ";
assert "thing".equals(Dom.<API key>("@Thing(asodkoas)")[0]) : "Extraction wrong: ";
assert "thing".equals(Dom.<API key>("@Thing(asodkoas) ")[0]) : "Extraction wrong: ";
assert "thing".equals(Dom.<API key>("@Thing(asodkoas) kko")[0]) : "Extraction wrong: ";
assert "".equals(Dom.<API key>("@Link")[1]) : "Extraction wrong: ";
final String val = Dom.<API key>("@Thing()")[1];
assert null == (val) : "Extraction wrong: " + val;
assert "asodkoas".equals(Dom.<API key>("@Thing(asodkoas)")[1]) : "Extraction wrong: ";
assert "asodkoas".equals(Dom.<API key>("@Thing(asodkoas) ")[1]) : "Extraction wrong: ";
assert "asodkoas".equals(Dom.<API key>("@Thing(asodkoas) kko")[1]) : "Extraction wrong: ";
}
@Test
public final void <API key>() {
Renderable widget = compiler()
.compile(Object.class, new Template("<html>@ShowIf(true)<p>hello</p></html>"));
// .compile("<!doctype html>\n" +
// "<html><head><meta charset=\"UTF-8\"><title>small test</title></head><body>\n" +
// "@ShowIf(true)<p>hello</p>" +
// "\n</body></html>");
assert null != widget : " null ";
final Respond mockRespond = <API key>.newRespond();
// final Respond mockRespond = new <API key>() {
// @Override
// public void write(String text) {
// builder.append(text);
// @Override
// public void write(char text) {
// builder.append(text);
// @Override
// public void chew() {
// builder.deleteCharAt(builder.length() - 1);
widget.render(new Object(), mockRespond);
final String value = mockRespond.toString();
System.out.println(value);
assert "<html><p>hello</p></html>".equals(value) : "Did not write expected output, instead: " + value;
// assert "<!doctype html><html><head><meta charset=\"UTF-8\"><title>small test</title></head><body><p>hello</p></body></html>".equals(value) : "Did not write expected output, instead: " + value;
}
@DataProvider(name = <API key>)
public Object[][] get() {
return new Object[][]{
{"true"},
{"java.lang.Boolean.TRUE"},
{"java.lang.Boolean.valueOf('true')"},
// {"true ? true : true"}, @TODO (BD): Disabled until I actually investigate if this is a valid test.
{"'x' == 'x'"},
{"\"x\" == \"x\""},
{"'hello' instanceof java.io.Serializable"},
{"true; return true"},
{" 5 >= 2 "},
};
}
@Test(dataProvider = <API key>)
public final void <API key>(String expression) {
Renderable widget = compiler()
.compile(Object.class, new Template(String.format("<html>@ShowIf(%s)<p>hello</p></html>", expression)));
assert null != widget : " null ";
final Respond mockRespond = <API key>.newRespond();
widget.render(new Object(), mockRespond);
final String value = mockRespond.toString();
assert "<html><p>hello</p></html>".equals(value) : "Did not write expected output, instead: " + value;
}
@Test
public final void <API key>() {
Renderable widget = compiler()
.compile(Object.class, new Template("<html>@ShowIf(false)<p>hello</p></html>"));
assert null != widget : " null ";
final Respond mockRespond = <API key>.newRespond();
widget.render(new Object(), mockRespond);
final String value = mockRespond.toString();
assert "<html></html>".equals(value) : "Did not write expected output, instead: " + value;
}
@Test
public final void <API key>() {
// make a basic type converter without creating
TypeConverter converter = new MvelTypeConverter();
Parsing.setTypeConverter(converter);
Renderable widget = compiler()
.compile(TestBackingType.class, new Template("<html><div class='${clazz}'>hello <a href='/people/${id}'>${name}</a></div></html>"));
assert null != widget : " null ";
final Respond mockRespond = <API key>.newRespond();
widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);
final String value = mockRespond.toString();
assert "<html><div class='content'>hello <a href='/people/12'>Dhanji</a></div></html>"
.replaceAll("'", "\"")
.equals(value) : "Did not write expected output, instead: " + value;
}
public static class TestBackingType {
private String name;
private String clazz;
private Integer id;
public TestBackingType(String name, String clazz, Integer id) {
this.name = name;
this.clazz = clazz;
this.id = id;
}
public String getName() {
return name;
}
public String getClazz() {
return clazz;
}
public Integer getId() {
return id;
}
}
@Test
public final void <API key>() {
// make a basic type converter without creating
TypeConverter converter = new MvelTypeConverter();
Parsing.setTypeConverter(converter);
Renderable widget = compiler()
//new <API key>(registry, pageBook, metrics)
.compile(TestBackingType.class, new Template("<html> <head>" +
" @Require <script type='text/javascript' src='my.js'> </script>" +
" @Require <script type='text/javascript' src='my.js'> </script>" +
"</head><body>" +
"<div class='${clazz}'>hello <a href='/people/${id}'>${name}</a></div>" +
"</body></html>"));
assert null != widget : " null ";
final Respond respond = <API key>.newRespond();
widget.render(new TestBackingType("Dhanji", "content", 12), respond);
final String value = respond.toString();
String expected = "<html> <head>" +
" <script type='text/javascript' src='my.js'> </script>" +
"</head><body>" +
"<div class='content'>hello <a href='/people/12'>Dhanji</a></div></body></html>";
expected = expected.replaceAll("'", "\"");
assertEquals(value, expected);
}
@Test
public final void <API key>() {
try{
Renderable widget = compiler()
.compile(TestBackingType.class, new Template("<html>\n<div class='${clazz}'>hello</div>\n</html>${qwe}"));
fail();
} catch (Exception ex){
assertEquals(ex.getClass(), <API key>.class);
<API key> te = (<API key>) ex;
assertEquals(te.getErrors().size(), 1);
CompileError error = te.getErrors().get(0);
assertEquals(error.getLine(), 2);
}
}
@Test
public final void <API key>() {
try{
Renderable widget = compiler()
.compile(TestBackingType.class, new Template("<html>\n<div class='${clazz}'>hello</div>\n\n</html>@ShowIf(true)\n${qwe}"));
fail();
} catch (Exception ex){
assertEquals(ex.getClass(), <API key>.class);
<API key> te = (<API key>) ex;
assertEquals(te.getErrors().size(), 1);
CompileError error = te.getErrors().get(0);
assertEquals(error.getLine(), 4);
}
}
@Test
public final void readHtmlWidget() {
Renderable widget = compiler()
.compile(TestBackingType.class, new Template("<html><div class='${clazz}'>hello</div></html>"));
assert null != widget : " null ";
final Respond mockRespond = <API key>.newRespond();
widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);
final String s = mockRespond.toString();
assert "<html><div class=\"content\">hello</div></html>"
.equals(s) : "Did not write expected output, instead: " + s;
}
@Test
public final void <API key>() {
Renderable widget = compiler()
.compile(TestBackingType.class, new Template("<!doctype html><html><body><div class='${clazz}'>hello @ShowIf(false)<a href='/hi/${id}'>hideme</a></div></body></html>"));
assert null != widget : " null ";
final Respond mockRespond = <API key>.newRespond();
widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);
final String s = mockRespond.toString();
assertEquals(s, "<!doctype html><html><body><div class=\"content\">hello </div></body></html>");
}
@EmbedAs(MyEmbeddedPage.MY_FAVE_ANNOTATION)
public static class MyEmbeddedPage {
protected static final String MY_FAVE_ANNOTATION = "MyFave";
private boolean should = true;
public boolean isShould() {
return should;
}
public void setShould(boolean should) {
this.should = should;
}
}
@Test
public final void <API key>() {
Renderable widget = compiler()
.compile(TestBackingType.class, new Template("<xml><div class='content'>hello @MyFave(should=false)<a href='/hi/${id}'>hideme</a></div></xml>"));
assert null != widget : " null ";
//tell pagebook to track this as an embedded widget
pageBook.embedAs(MyEmbeddedPage.class, MyEmbeddedPage.MY_FAVE_ANNOTATION)
.apply(Chains.terminal());
final Respond mockRespond = <API key>.newRespond();
widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);
final String s = mockRespond.toString();
assert "<xml><div class=\"content\">hello </div></xml>"
.equals(s) : "Did not write expected output, instead: " + s;
}
@Test
public final void readEmbedWidgetOnly() {
Renderable widget = compiler()
.compile(TestBackingType.class, new Template("<html><div class='content'>hello @MyFave(should=false)<a href='/hi/${id}'>hideme</a></div></html>"));
assert null != widget : " null ";
//tell pagebook to track this as an embedded widget
pageBook.embedAs(MyEmbeddedPage.class, MyEmbeddedPage.MY_FAVE_ANNOTATION)
.apply(Chains.terminal());
final Respond mockRespond = <API key>.newRespond();
widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);
final String s = mockRespond.toString();
assert "<html><div class=\"content\">hello </div></html>"
.equals(s) : "Did not write expected output, instead: " + s;
}
//TODO Fix this test!
// @Test
// public final void <API key>() throws <API key> {
// final Evaluator evaluator = new MvelEvaluator();
// final Injector injector = Guice.createInjector(new AbstractModule() {
// protected void configure() {
// bind(HttpServletRequest.class).toProvider(<API key>());
// final PageBook book = injector.getInstance(PageBook.class); //hacky, where are you super-packages!
// final WidgetRegistry registry = injector.getInstance(WidgetRegistry.class);
// final <API key> compiler = new <API key>(TestBackingType.class);
// Renderable widget =
// new <API key>(Object.class, compiler, registry, book, metrics)
// .compile("<xml><div class='content'>hello @MyFave(should=true)<a href='/hi/${id}'> @With(\"me\")<p>showme</p></a></div></xml>");
// assert null != widget : " null ";
// HtmlWidget bodyWrapper = new XmlWidget(Chains.proceeding().addWidget(new IncludeWidget(new TerminalWidgetChain(), "'me'", evaluator)),
// "body", compiler, Collections.<String, String>emptyMap());
// bodyWrapper.setRequestProvider(<API key>());
// //should include the @With("me") annotated widget from the template above (discarding the <p> tag).
// book.embedAs(MyEmbeddedPage.class).apply(bodyWrapper);
// final Respond mockRespond = new <API key>();
// widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);
// final String s = mockRespond.toString();
// assert "<xml><div class=\"content\">hello showme</div></xml>"
// .equals(s) : "Did not write expected output, instead: " + s;
public static Provider<Request> <API key>() {
return new Provider<Request>() {
public Request get() {
final HttpServletRequest request = createNiceMock(HttpServletRequest.class);
expect(request.getContextPath())
.andReturn("")
.anyTimes();
expect(request.getMethod())
.andReturn("POST")
.anyTimes();
expect(request.getParameterMap())
.andReturn(ImmutableMap.of())
.anyTimes();
replay(request);
return TestRequestCreator.from(request, null);
}
};
}
} |
{*<?php exit();?>*}
<div class="block" id="contact">
<div class="head">
<div class="left"></div>
<div class="title">{$lang.contact}</div>
<div class="right"></div>
</div>
<div class="main">
{foreach from=$contact name=contact item=item}
<span>{$item.word}</span>{$item.content}<br />
{/foreach}
</div>
</div> |
package org.swtk.commons.dict.wordnet.indexbyname.instance.c.a.f; import java.util.ArrayList; import java.util.Collection; import java.util.Map; import java.util.TreeMap; import org.swtk.common.dict.dto.wordnet.IndexNoun; import com.trimc.blogger.commons.utils.GsonUtils; public final class <API key> { private static Map<String, Collection<IndexNoun>> map = new TreeMap<String, Collection<IndexNoun>>(); static { add("{\"term\":\"cafe\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"02939042\"]}");
add("{\"term\":\"cafe au lait\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"07935812\"]}");
add("{\"term\":\"cafe noir\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"07935905\"]}");
add("{\"term\":\"cafe royale\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"07946180\"]}");
add("{\"term\":\"cafeteria\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"02939275\"]}");
add("{\"term\":\"cafeteria facility\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"02939404\"]}");
add("{\"term\":\"cafeteria tray\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"02939560\"]}");
add("{\"term\":\"caff\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"02939665\"]}");
add("{\"term\":\"caffe latte\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"07936462\"]}");
add("{\"term\":\"caffein\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"14785301\"]}");
add("{\"term\":\"caffein addict\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"09906152\"]}");
add("{\"term\":\"caffein addiction\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"14088638\"]}");
add("{\"term\":\"caffeine\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"14785301\"]}");
add("{\"term\":\"caffeine addict\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"09906152\"]}");
add("{\"term\":\"caffeine intoxication\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"14533849\"]}");
add("{\"term\":\"caffeinism\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"14533849\"]}");
add("{\"term\":\"caffer\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"10248534\"]}");
add("{\"term\":\"caffer cat\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"02128524\"]}");
add("{\"term\":\"caffre\", \"synsetCount\":1, \"upperType\":\"NOUN\", \"ids\":[\"10248534\"]}");
add("{\"term\":\"caftan\", \"synsetCount\":2, \"upperType\":\"NOUN\", \"ids\":[\"02939786\", \"02939954\"]}");
} private static void add(final String JSON) { IndexNoun indexNoun = GsonUtils.toObject(JSON, IndexNoun.class); Collection<IndexNoun> list = (map.containsKey(indexNoun.getTerm())) ? map.get(indexNoun.getTerm()) : new ArrayList<IndexNoun>(); list.add(indexNoun); map.put(indexNoun.getTerm(), list); } public static Collection<IndexNoun> get(final String TERM) { return map.get(TERM); } public static boolean has(final String TERM) { return map.containsKey(TERM); } public static Collection<String> terms() { return map.keySet(); } } |
package org.camunda.bpm.getstarted.cmmn.loanapproval;
import java.util.logging.Logger;
import org.camunda.bpm.engine.delegate.<API key>;
import org.camunda.bpm.engine.delegate.<API key>;
public class LifecycleListener implements <API key> {
private final static Logger LOGGER = Logger.getLogger("LOAN-REQUESTS-CMMN");
public void notify(<API key> caseExecution) throws Exception {
LOGGER.info("Plan Item '" + caseExecution.getActivityId() + "' labeled '" + caseExecution.getActivityName() + "' has performed transition: "
+ caseExecution.getEventName());
}
} |
function <API key>(data) {
$("#<API key>").val(data.epe);
$("#<API key>").val(data.exa);
$("#<API key>").val(data.dexa);
$("#<API key>").val(data.mnome);
$("#<API key>").val(data.crm);
$("#<API key>").val(data.tipg);
$("#<API key>").val(data.loea);
markcheckbox(data.cb_agl_9_2, document.getElementsByName("9-2cb_rquarto"));
$("#prv9-3_rquarto").val(data.prv);
if (data.prv == "2") {
$('.<API key>').collapse('show');
}
if(data.agpv == "1") {
$('#agpv9-4_rquarto').prop('checked', true);
$('.<API key>').collapse('show');
if(data.ede == "1") {
$('#ede9-5_rquarto').prop('checked', true);
$('.<API key>').collapse('show');
markcheckbox(data.cb_ede_0, document.getElementsByName("9-5-0cb_rquarto"));
markcheckbox(data.cb_ede_1, document.getElementsByName("9-5-1cb_rquarto"));
}
if(data.hip == "1") {
$('#hip9-6_rquarto').prop('checked', true);
$('.<API key>').collapse('show');
markcheckbox(data.cb_hip_0, document.getElementsByName("9-6-0cb_rquarto"));
markcheckbox(data.cb_hip_1, document.getElementsByName("9-6-1cb_rquarto"));
markcheckbox(data.cb_hip_2, document.getElementsByName("9-6-2cb_rquarto"));
}
if(data.ava == "1") {
$('#ava9-7_rquarto').prop('checked', true);
$('.<API key>').collapse('show');
markcheckbox(data.cb_ava_0, document.getElementsByName("9-7-0cb_rquarto"));
markcheckbox(data.cb_ava_1, document.getElementsByName("9-7-1cb_rquarto"));
markcheckbox(data.cb_ava_2, document.getElementsByName("9-7-2cb_rquarto"));
}
}
if (data.bli == "1") {
$('#bli9-8_rquarto').prop('checked', true);
$('.<API key>').collapse('show');
if (data.ibi == "1") {
$('#ibi9-9_rquarto').prop('checked', true);
$('.<API key>').collapse('show');
markcheckbox(data.cb_ibi_0, document.getElementsByName("9-9-0cb_rquarto"));
markcheckbox(data.cb_ibi_1, document.getElementsByName("9-9-1cb_rquarto"));
}
if (data.iud == "1") {
$('#iud9-10_rquarto').prop('checked', true);
$('.<API key>').collapse('show');
markcheckbox(data.cb_iud_0, document.getElementsByName("9-10-0cb_rquarto"));
markcheckbox(data.cb_iud_1, document.getElementsByName("9-10-1cb_rquarto"));
}
if (data.iue == "1") {
$('#iue9-11_rquarto').prop('checked', true);
$('.<API key>').collapse('show');
markcheckbox(data.cb_iue_0, document.getElementsByName("9-11-0cb_rquarto"));
markcheckbox(data.cb_iue_1, document.getElementsByName("9-11-1cb_rquarto"));
}
if (data.rco == "1") {
$('#rco9-12_rquarto').prop('checked', true);
}
if (data.dep == "1") {
$('#dep9-13_rquarto').prop('checked', true);
$('.<API key>').collapse('show');
markcheckbox(data.cb_dep_0, document.getElementsByName("9-13-0cb_rquarto"));
markcheckbox(data.cb_dep_1, document.getElementsByName("9-13-1cb_rquarto"));
}
if (data.hipe == "1") {
$('#hipe9-14_rquarto').prop('checked', true);
}
}
if (data.cgl == "1") {
$('#cgl9-15_rquarto').prop('checked', true);
$('.<API key>').collapse('show');
markcheckbox(data.cb_cgl_0, document.getElementsByName("9-15-0cb_rquarto"));
markcheckbox(data.cb_cgl_1, document.getElementsByName("9-15-1cb_rquarto"));
}
if (data.mmo == "1") {
$('#mmo9-16_rquarto').prop('checked', true);
$('.<API key>').collapse('show');
markcheckbox(data.cb_mmo_0, document.getElementsByName("9-16-0cb_rquarto"));
}
if(data.<API key> != "") {
$('.<API key>').collapse('show');
document.getElementById("txtareaobsquarto").value = data.<API key>;
}
<API key>(data.<API key>);
}
function <API key>(<API key>) {
$.ajax({
type : "GET",
url : url+"<API key>.php?number="+<API key>,
contentType: content,
success: function (response) {
var json = JSON.parse(response);
if(json['success']){
if(json['tipo'] == "pendente") {
<API key>(json['data'][0]);
}else if (json['tipo'] == "concluido") {
<API key>(json['data'][0])
}
console.log(json);
}else{
console.log("erro fase de parecer fono retorno");
}
},
error: function (e) {
console.log(e);
}
});
}
function <API key>(data) {
$('.<API key>').collapse('show');
markcheckbox(data.cb_mdp, document.getElementsByName("10-0cb_rquarto"));
markcheckbox(data.cb_cfo, document.getElementsByName("10-1cb_rquarto"));
$("#exs10-2_rquarto").val(data.exs);
$("#dt10-2_rquarto").val(data.dt);
if (data.<API key> != "") {
$('.<API key>').collapse('show');
$("#<API key>").val(data.<API key>);
}
}
function <API key>(data) {
$('.<API key>').collapse('show');
markcheckbox(data.cb_fnl_0, document.getElementsByName("11-0cb_rquarto"));
if ($('#cb3-fnl11-0_rquarto').is(':checked')) {
$('.<API key>').collapse('show');
$("#<API key>").val(data.dias);
$("#<API key>").val(data.com);
}
markcheckbox(data.cb_fnl_1, document.getElementsByName("11-2cb_rquarto"));
$("#lcl11-2_rquarto").val(data.lcl);
$("#dt11-2_rquarto").val(data.dt);
if (data.<API key> != "") {
$('.<API key>').collapse('show');
$("#<API key>").val(data.<API key>);
}
} |
<?php
namespace sunsun\aq118\req;
class Aq118ReqFactory
{
public static function create($type, $data)
{
$req = null;
switch ($type) {
case Aq118ReqType::Login:
$req = new Aq118LoginReq($data);
break;
case Aq118ReqType::DeviceInfo:
$req = new Aq118DeviceInfoReq($data);
break;
case Aq118ReqType::Event:
$req = new Aq118DeviceEventReq($data);
break;
case Aq118ReqType::Control:
$req = new Aq118CtrlDeviceReq($data);
break;
case Aq118ReqType::FirmwareUpdate:
$req = new <API key>($data);
break;
case Aq118ReqType::Heartbeat:
$req = new Aq118HbReq($data);
break;
default:
break;
}
return $req;
}
} |
package main
import (
"fmt"
"net"
hyperclient "github.com/Cloud-Foundations/Dominator/hypervisor/client"
"github.com/Cloud-Foundations/Dominator/lib/log"
)
func <API key>(args []string,
logger log.DebugLogger) error {
if err := connectToVmConsole(args[0], logger); err != nil {
return fmt.Errorf("Error connecting to VM console: %s", err)
}
return nil
}
func connectToVmConsole(vmHostname string, logger log.DebugLogger) error {
if vmIP, hypervisor, err := <API key>(vmHostname); err != nil {
return err
} else {
return <API key>(hypervisor, vmIP, logger)
}
}
func <API key>(hypervisor string, ipAddr net.IP,
logger log.DebugLogger) error {
client, err := dialHypervisor(hypervisor)
if err != nil {
return err
}
defer client.Close()
return hyperclient.ConnectToVmConsole(client, ipAddr, *vncViewer, logger)
} |
package com.imaginea.activegrid.core.models
sealed trait AWSInstanceType {
def instanceType: String
def ramSize: Double
def rootPartitionSize: Double
}
case object AWSInstanceType {
case object T1Micro extends AWSInstanceType {
override def instanceType: String = "t1.micro"
override def ramSize: Double = 0.613D
override def rootPartitionSize: Double = 8D
}
case object T2Micro extends AWSInstanceType {
override def instanceType: String = "t2.micro"
override def ramSize: Double = 0.613D
override def rootPartitionSize: Double = 8D
}
case object M1Small extends AWSInstanceType {
override def instanceType: String = "m1.small"
override def ramSize: Double = 1.7D
override def rootPartitionSize: Double = 8D
}
case object M1Medium extends AWSInstanceType {
override def instanceType: String = "m1.medium"
override def ramSize: Double = 3.7D
override def rootPartitionSize: Double = 8D
}
case object M1Large extends AWSInstanceType {
override def instanceType: String = "m1.large"
override def ramSize: Double = 7.5D
override def rootPartitionSize: Double = 10D
}
case object M1XLarge extends AWSInstanceType {
override def instanceType: String = "m1.xLarge"
override def ramSize: Double = 15D
override def rootPartitionSize: Double = 10D
}
case object M3Medium extends AWSInstanceType {
override def instanceType: String = "m3.medium"
override def ramSize: Double = 3.75D
override def rootPartitionSize: Double = 10D
}
case object M3Large extends AWSInstanceType {
override def instanceType: String = "m3.large"
override def ramSize: Double = 7D
override def rootPartitionSize: Double = 10D
}
case object M3XLarge extends AWSInstanceType {
override def instanceType: String = "m3.xlarge"
override def ramSize: Double = 15D
override def rootPartitionSize: Double = 10D
}
case object M32XLarge extends AWSInstanceType {
override def instanceType: String = "m3.2xlarge"
override def ramSize: Double = 30D
override def rootPartitionSize: Double = 10D
}
case object M2XLarge extends AWSInstanceType {
override def instanceType: String = "m2.xlarge"
override def ramSize: Double = 34.2D
override def rootPartitionSize: Double = 10D
}
case object M22XLarge extends AWSInstanceType {
override def instanceType: String = "m2.2xlarge"
override def ramSize: Double = 17.1D
override def rootPartitionSize: Double = 10D
}
case object M24XLarge extends AWSInstanceType {
override def instanceType: String = "m2.4xlarge"
override def ramSize: Double = 68.4D
override def rootPartitionSize: Double = 10D
}
case object HI14XLarge extends AWSInstanceType {
override def instanceType: String = "hi1.4xlarge"
override def ramSize: Double = 0.613D
override def rootPartitionSize: Double = 8D
}
case object HI18XLarge extends AWSInstanceType {
override def instanceType: String = "hi1.8xlarge"
override def ramSize: Double = 117D
override def rootPartitionSize: Double = 10D
}
case object C1Medium extends AWSInstanceType {
override def instanceType: String = "c1.medium"
override def ramSize: Double = 1.7D
override def rootPartitionSize: Double = 10D
}
case object C1XLarge extends AWSInstanceType {
override def instanceType: String = "c1.xlarge"
override def ramSize: Double = 7D
override def rootPartitionSize: Double = 10D
}
case object C3Large extends AWSInstanceType {
override def instanceType: String = "c3.large"
override def ramSize: Double = 3.75D
override def rootPartitionSize: Double = 10D
}
case object C3XLarge extends AWSInstanceType {
override def instanceType: String = "c3.xlarge"
override def ramSize: Double = 7.5D
override def rootPartitionSize: Double = 10D
}
case object C32XLarge extends AWSInstanceType {
override def instanceType: String = "c3.2xlarge"
override def ramSize: Double = 15D
override def rootPartitionSize: Double = 10D
}
case object C34XLarge extends AWSInstanceType {
override def instanceType: String = "c3.4xlarge"
override def ramSize: Double = 30D
override def rootPartitionSize: Double = 10D
}
case object C38XLarge extends AWSInstanceType {
override def instanceType: String = "c3.8xlarge"
override def ramSize: Double = 60D
override def rootPartitionSize: Double = 10D
}
case object NEWERBETTER extends AWSInstanceType {
override def instanceType: String = "unknown"
override def ramSize: Double = 1D
override def rootPartitionSize: Double = 1D
}
def toAWSInstanceType(awsInstanceName: String): AWSInstanceType = {
awsInstanceName match {
case "t1.micro" => T1Micro
case "t2.micro" => T2Micro
case "m1.small" => M1Small
case "m1.medium" => M1Medium
case "m1.large" => M1Large
case "m1.xlarge" => M1XLarge
case "m3.medium" => M3Medium
case "m3.large" => M3Large
case "m3.xlarge" => M3XLarge
case "m3.2xlarge" => M32XLarge
case "m2.xlarge" => M2XLarge
case "m2.2xlarge" => M22XLarge
case "m2.4xlarge" => M24XLarge
case "hi1.4xlarge" => HI14XLarge
case "hi1.8xlarge" => HI18XLarge
case "c1.medium" => C1Medium
case "c1.xlarge" => C1XLarge
case "c3.large" => C3Large
case "c3.xlarge" => C3XLarge
case "c3.2xlarge" => C32XLarge
case "c3.4xlarge" => C34XLarge
case "c3.8xlarge" => C38XLarge
case _ => NEWERBETTER
}
}
} |
\documentclass[a1paper,landscape]{article}
\usepackage{qtree}
\usepackage{geometry}
\begin{document}
\small{
\Tree [ .M [ .K [ .R [ .LEMME [ .donner ] ] [ .POLYP [ .RT [ .GPTRAITS [ .GPTRAIT [ .PORTMA [ .. ] ] [ .TRAIT [ .IND ] ] ] [ .GPTRAITS [ .GPTRAIT [ .PORTMA [ .. ] ] [ .TRAIT [ .PRS ] ] ] [ .GPTRAITS [ .GPTRAIT [ .PORTMA [ .. ] ] [ .TRAIT [ .1SG ] ] ] ] ] ] ] ] ] [ .TS [ .T [ .MORPH0 [ .GMORPH0 [ .[ ] ] [ .POLYP [ .RT [ .TRAIT [ .IND ] ] [ .GPTRAITS [ .GPTRAIT [ .PORTMA [ .. ] ] [ .TRAIT [ .PRS ] ] ] [ .GPTRAITS [ .GPTRAIT [ .PORTMA [ .. ] ] [ .TRAIT [ .1SG ] ] ] ] ] ] ] [ .DMORPH0 [ .] ] ] ] ] ] ] ]
}
\end{document} |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using Talifun.Crusher.Configuration.Sprites;
using Talifun.Crusher.Crusher;
using Talifun.Web.Helper;
namespace Talifun.Crusher.CssSprite
{
public class <API key>
{
public StringBuilder ProcessGroups(IPathProvider pathProvider, ICssSpriteCreator cssSpriteCreator, <API key> cssSpriteGroups)
{
var output = new StringBuilder("Css Sprite Files created:\r\n");
Action<<API key>> processJsGroup = ProcessJsGroup;
var <API key> = cssSpriteGroups.Cast<<API key>>()
.Select(group => new <API key>
{
CssSpriteCreator = cssSpriteCreator,
PathProvider = pathProvider,
Group = group,
Output = output
}).ToList();
if (<API key>.Any())
{
ParallelExecute.EachParallel(<API key>, processJsGroup);
}
else
{
output.AppendFormat("No files to process");
}
return output;
}
private void ProcessJsGroup(<API key> <API key>)
{
var stopwatch = Stopwatch.StartNew();
var files = <API key>.Group.Files.Cast<ImageFileElement>()
.Select(imageFile => new ImageFile
{
FilePath = imageFile.FilePath,
Name = imageFile.Name
})
.ToList();
var directories = <API key>.Group.Directories.Cast<<API key>>()
.Select(imageDirectory => new ImageDirectory
{
DirectoryPath = imageDirectory.DirectoryPath,
ExcludeFilter = imageDirectory.ExcludeFilter,
IncludeFilter = imageDirectory.IncludeFilter,
<API key> = imageDirectory.<API key>,
PollTime = imageDirectory.PollTime
})
.ToList();
var cssOutPutUri = string.IsNullOrEmpty(<API key>.Group.CssUrl) ? new Uri(<API key>.PathProvider.ToAbsolute(<API key>.Group.CssOutputFilePath), UriKind.Absolute) : new Uri(<API key>.Group.CssUrl, UriKind.RelativeOrAbsolute);
var cssOutputPath = new FileInfo(new Uri(<API key>.PathProvider.MapPath(<API key>.Group.CssOutputFilePath)).LocalPath);
var imageOutputUri = string.IsNullOrEmpty(<API key>.Group.ImageUrl) ? new Uri(<API key>.PathProvider.ToAbsolute(<API key>.Group.ImageOutputFilePath), UriKind.Absolute) : new Uri(<API key>.Group.ImageUrl, UriKind.RelativeOrAbsolute);
var imageOutputPath = new FileInfo(new Uri(<API key>.PathProvider.MapPath(<API key>.Group.ImageOutputFilePath)).LocalPath);
var output = <API key>.CssSpriteCreator.AddFiles(imageOutputPath, imageOutputUri, cssOutputPath, files, directories);
stopwatch.Stop();
<API key>.Output.Append(CreateLogEntries(<API key>, cssOutPutUri, imageOutputUri, output, stopwatch));
}
private StringBuilder CreateLogEntries(<API key> <API key>, Uri cssOutPutUri, Uri imageOutputUri, IEnumerable<ImageFile> filesToWatch, Stopwatch stopwatch)
{
cssOutPutUri = new Uri(<API key>.PathProvider.ToAbsolute(cssOutPutUri.ToString()), UriKind.Absolute);
imageOutputUri = new Uri(<API key>.PathProvider.ToAbsolute(imageOutputUri.ToString()), UriKind.Absolute);
var rootPath = <API key>.PathProvider.<API key>("~/");
var output = new StringBuilder();
output.AppendFormat("{0}({1} - {2} ms)\r\n", rootPath.MakeRelativeUri(cssOutPutUri), <API key>.Group.Name, stopwatch.ElapsedMilliseconds);
output.AppendFormat("{0}({1} - {2} ms)\r\n", rootPath.MakeRelativeUri(imageOutputUri), <API key>.Group.Name, stopwatch.ElapsedMilliseconds);
foreach (var fileToWatch in filesToWatch)
{
var <API key> = new Uri(<API key>.PathProvider.ToAbsolute(fileToWatch.FilePath), UriKind.Absolute);
output.AppendFormat(" {0}\r\n", rootPath.MakeRelativeUri(<API key>));
}
return output;
}
}
} |
// WYDownloadProgress.h
// Rapid
#import <Foundation/Foundation.h>
@interface WYDownloadProgress : NSObject
@end |
local redis = require "resty.redis"
local red = redis:new()
function connect()
red:set_timeout(1000) -- 1 sec
local ok, err = red:connect("127.0.0.1", 6379)
if not ok then
ngx.say("failed to connect to redis: ", err)
ngx.exit(ngx.ERROR)
return nil
end
end
local HC = {}
function HC.add()
connect()
ok, err = red:incr("hit_counter")
if not ok then
ngx.say("failed to increment hit_counter: ", err)
return
end
end
function HC.get()
local hit_counter, err = red:get("hit_counter")
if not hit_counter then
ngx.say("failed to get hit_counter: ", err)
return
end
return hit_counter
end
return HC |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.