answer
stringlengths 15
1.25M
|
|---|
import Helper, { states } from './_helper';
import { module, test } from 'qunit';
module('Integration | ORM | Has Many | Named Reflexive | association #set', function(hooks) {
hooks.beforeEach(function() {
this.helper = new Helper();
});
/*
The model can update its association via parent, for all states
*/
states.forEach((state) => {
test(`a ${state} can update its association to a list of saved children`, function(assert) {
let [ tag, originalTags ] = this.helper[state]();
let savedTag = this.helper.savedChild();
tag.labels = [ savedTag ];
assert.ok(tag.labels.includes(savedTag));
assert.equal(tag.labelIds[0], savedTag.id);
assert.ok(savedTag.labels.includes(tag), 'the inverse was set');
tag.save();
originalTags.forEach(originalTag => {
originalTag.reload();
assert.notOk(originalTag.labels.includes(tag), 'old inverses were cleared');
});
});
test(`a ${state} can update its association to a new parent`, function(assert) {
let [ tag, originalTags ] = this.helper[state]();
let newTag = this.helper.newChild();
tag.labels = [ newTag ];
assert.ok(tag.labels.includes(newTag));
assert.equal(tag.labelIds[0], undefined);
assert.ok(newTag.labels.includes(tag), 'the inverse was set');
tag.save();
originalTags.forEach(originalTag => {
originalTag.reload();
assert.notOk(originalTag.labels.includes(tag), 'old inverses were cleared');
});
});
test(`a ${state} can clear its association via an empty list`, function(assert) {
let [ tag, originalTags ] = this.helper[state]();
tag.labels = [ ];
assert.deepEqual(tag.labelIds, [ ]);
assert.equal(tag.labels.models.length, 0);
tag.save();
originalTags.forEach(originalTag => {
originalTag.reload();
assert.notOk(originalTag.labels.includes(tag), 'old inverses were cleared');
});
});
test(`a ${state} can clear its association via an empty list`, function(assert) {
let [ tag, originalTags ] = this.helper[state]();
tag.labels = null;
assert.deepEqual(tag.labelIds, [ ]);
assert.equal(tag.labels.models.length, 0);
tag.save();
originalTags.forEach(originalTag => {
originalTag.reload();
assert.notOk(originalTag.labels.includes(tag), 'old inverses were cleared');
});
});
});
});
|
{{ partial "head.html" . }}
{{ partial "body-before.html" . }}
<!-- Layout for Content Area of Markdown Page Goes Here -->
<div id="default__title">{{ .Title }}</div>
<div id="default__subtitle">{{ .Params.subtitle }}</div>
<div>{{ .Date.Format "Jan 02, 2006" }}</div>
<div id="default_text"> {{ .Content }} </div>
{{ partial "body-after.html" . }}
|
import * as React from 'react';
export interface LabelDetailProps {
[key: string]: any;
/** An element type to render as (string or function). */
as?: any;
/** Primary content. */
children?: React.ReactNode;
/** Additional classes. */
className?: string;
/** Shorthand for primary content. */
content?: React.ReactNode;
}
declare const LabelDetail: React.StatelessComponent<LabelDetailProps>;
export default LabelDetail;
|
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Orleans;
using Orleans.Runtime;
using Orleans.Runtime.Scheduler;
using UnitTests.GrainInterfaces;
using UnitTests.Grains;
namespace UnitTestGrains
{
public class TimerGrain : Grain, ITimerGrain
{
private bool deactivating;
int counter = 0;
Dictionary<string, IDisposable> allTimers;
IDisposable defaultTimer;
private static readonly TimeSpan period = TimeSpan.FromMilliseconds(100);
string DefaultTimerName = "DEFAULT TIMER";
ISchedulingContext context;
private Logger logger;
public override Task OnActivateAsync()
{
ThrowIfDeactivating();
logger = this.GetLogger("TimerGrain_" + base.Data.Address.ToString());
context = RuntimeContext.Current.ActivationContext;
defaultTimer = this.RegisterTimer(Tick, DefaultTimerName, period, period);
allTimers = new Dictionary<string, IDisposable>();
return Task.CompletedTask;
}
public Task StopDefaultTimer()
{
ThrowIfDeactivating();
defaultTimer.Dispose();
return Task.CompletedTask;
}
private Task Tick(object data)
{
counter++;
logger.Info(data.ToString() + " Tick # " + counter + " RuntimeContext = " + RuntimeContext.Current.ActivationContext.ToString());
// make sure we run in the right activation context.
if(!Equals(context, RuntimeContext.Current.ActivationContext))
logger.Error((int)ErrorCode.<API key>, "grain not running in the right activation context");
string name = (string)data;
IDisposable timer = null;
if (name == DefaultTimerName)
{
timer = defaultTimer;
}
else
{
timer = allTimers[(string)data];
}
if(timer == null)
logger.Error((int)ErrorCode.<API key>, "Timer is null");
if (timer != null && counter > 10000)
{
// do not let orphan timers ticking for long periods
timer.Dispose();
}
return Task.CompletedTask;
}
public Task<TimeSpan> GetTimerPeriod()
{
return Task.FromResult(period);
}
public Task<int> GetCounter()
{
ThrowIfDeactivating();
return Task.FromResult(counter);
}
public Task SetCounter(int value)
{
ThrowIfDeactivating();
lock (this)
{
counter = value;
}
return Task.CompletedTask;
}
public Task StartTimer(string timerName)
{
ThrowIfDeactivating();
IDisposable timer = this.RegisterTimer(Tick, timerName, TimeSpan.Zero, period);
allTimers.Add(timerName, timer);
return Task.CompletedTask;
}
public Task StopTimer(string timerName)
{
ThrowIfDeactivating();
IDisposable timer = allTimers[timerName];
timer.Dispose();
return Task.CompletedTask;
}
public Task LongWait(TimeSpan time)
{
ThrowIfDeactivating();
Thread.Sleep(time);
return Task.CompletedTask;
}
public Task Deactivate()
{
deactivating = true;
DeactivateOnIdle();
return Task.CompletedTask;
}
private void ThrowIfDeactivating()
{
if (deactivating) throw new <API key>("This activation is deactivating");
}
}
public class TimerCallGrain : Grain, ITimerCallGrain
{
private int tickCount;
private Exception tickException;
private IDisposable timer;
private string timerName;
private ISchedulingContext context;
private TaskScheduler <API key>;
private Logger logger;
public Task<int> GetTickCount() { return Task.FromResult(tickCount); }
public Task<Exception> GetException() { return Task.FromResult(tickException); }
public override Task OnActivateAsync()
{
logger = this.GetLogger("TimerCallGrain_" + base.Data.Address);
context = RuntimeContext.Current.ActivationContext;
<API key> = TaskScheduler.Current;
return Task.CompletedTask;
}
public Task StartTimer(string name, TimeSpan delay)
{
logger.Info("StartTimer Name={0} Delay={1}", name, delay);
this.timerName = name;
this.timer = base.RegisterTimer(TimerTick, name, delay, Constants.INFINITE_TIMESPAN); // One shot timer
return Task.CompletedTask;
}
public Task StopTimer(string name)
{
logger.Info("StopTimer Name={0}", name);
if (name != this.timerName)
{
throw new ArgumentException(string.Format("Wrong timer name: Expected={0} Actual={1}", this.timerName, name));
}
timer.Dispose();
return Task.CompletedTask;
}
private async Task TimerTick(object data)
{
try
{
await ProcessTimerTick(data);
}
catch (Exception exc)
{
this.tickException = exc;
throw;
}
}
private async Task ProcessTimerTick(object data)
{
string step = "TimerTick";
LogStatus(step);
// make sure we run in the right activation context.
CheckRuntimeContext(step);
string name = (string)data;
if (name != this.timerName)
{
throw new ArgumentException(string.Format("Wrong timer name: Expected={0} Actual={1}", this.timerName, name));
}
ISimpleGrain grain = GrainFactory.GetGrain<ISimpleGrain>(0, SimpleGrain.<API key>);
LogStatus("Before grain call
await grain.SetA(tickCount);
step = "After grain call
LogStatus(step);
CheckRuntimeContext(step);
LogStatus("Before Delay");
await Task.Delay(TimeSpan.FromSeconds(1));
step = "After Delay";
LogStatus(step);
CheckRuntimeContext(step);
LogStatus("Before grain call
await grain.SetB(tickCount);
step = "After grain call
LogStatus(step);
CheckRuntimeContext(step);
LogStatus("Before grain call
int res = await grain.GetAxB();
step = "After grain call #3 - Result = " + res;
LogStatus(step);
CheckRuntimeContext(step);
tickCount++;
}
private void CheckRuntimeContext(string what)
{
if (RuntimeContext.Current.ActivationContext == null
|| !RuntimeContext.Current.ActivationContext.Equals(context))
{
throw new <API key>(
string.Format("{0} in timer callback with unexpected activation context: Expected={1} Actual={2}",
what, context, RuntimeContext.Current.ActivationContext));
}
if (TaskScheduler.Current.Equals(<API key>) && TaskScheduler.Current is <API key>)
{
// Everything is as expected
}
else
{
throw new <API key>(
string.Format("{0} in timer callback with unexpected TaskScheduler.Current context: Expected={1} Actual={2}",
what, <API key>, TaskScheduler.Current));
}
}
private void LogStatus(string what)
{
logger.Info("{0} Tick # {1} - {2} - RuntimeContext.Current={3} TaskScheduler.Current={4} CurrentWorkerThread={5}",
timerName, tickCount, what, RuntimeContext.Current, TaskScheduler.Current,
WorkerPoolThread.CurrentWorkerThread);
}
}
}
|
layout: theme
title: "Streamflow Prediction Research"
date: 2016-08-03 16:55:00
categories:
- themes
img: <API key>.jpg
ref: stream
tags: [themes]
One of the four overarching research themes addressed in this collection of work. Our ability to understand how much and when... < more about this research theme, coming soon >
|
#!/usr/bin/env python
import sys
def fix_terminator(tokens):
if not tokens:
return
last = tokens[-1]
if last not in ('.', '?', '!') and last.endswith('.'):
tokens[-1] = last[:-1]
tokens.append('.')
def balance_quotes(tokens):
count = tokens.count("'")
if not count:
return
processed = 0
for i, token in enumerate(tokens):
if token == "'":
if processed % 2 == 0 and (i == 0 or processed != count - 1):
tokens[i] = "`"
processed += 1
def output(tokens):
if not tokens:
return
# fix_terminator(tokens)
balance_quotes(tokens)
print ' '.join(tokens)
prev = None
for line in sys.stdin:
tokens = line.split()
if len(tokens) == 1 and tokens[0] in ('"', "'", ')', ']'):
prev.append(tokens[0])
else:
output(prev)
prev = tokens
output(prev)
|
<?php
namespace YOOtheme\Widgetkit\Framework\View\Asset;
interface AssetInterface
{
/**
* Gets the name.
*
* @return string
*/
public function getName();
/**
* Gets the source.
*
* @return string
*/
public function getSource();
/**
* Gets the dependencies.
*
* @return array
*/
public function getDependencies();
/**
* Gets the content.
*
* @return string
*/
public function getContent();
/**
* Sets the content.
*
* @param string $content
*/
public function setContent($content);
/**
* Gets all options.
*
* @return array
*/
public function getOptions();
/**
* Gets a option.
*
* @param string $name
* @return mixed
*/
public function getOption($name);
/**
* Sets a option.
*
* @param string $name
* @param mixed $value
*/
public function setOption($name, $value);
/**
* Gets the unique hash.
*
* @param string $salt
* @return string
*/
public function hash($salt = '');
/**
* Applies filters and returns the asset as a string.
*
* @param array $filters
* @return string
*/
public function dump(array $filters = array());
}
|
package br.pucrio.opus.smells.tests.visitor;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import br.pucrio.opus.smells.ast.visitors.<API key>;
import br.pucrio.opus.smells.tests.util.<API key>;
public class <API key> {
private CompilationUnit compilationUnit;
@Before
public void setUp() throws IOException{
File file = new File("test/br/pucrio/opus/smells/tests/dummy/FieldDeclaration.java");
this.compilationUnit = <API key>.getCompilationUnit(file);
}
@Test
public void <API key>() {
<API key> visitor = new <API key>();
this.compilationUnit.accept(visitor);
List<FieldDeclaration> collectedFields = visitor.getNodesCollected();
Assert.assertEquals(6, collectedFields.size());
}
}
|
module rl.utilities.services.momentWrapper {
export var moduleName: string = 'rl.utilities.services.momentWrapper';
export var serviceName: string = 'momentWrapper';
export function momentWrapper(): void {
'use strict';
// Using `any` instead of MomentStatic because
// <API key> doesn't appear to be
// defined in MomentStatic... :-(
var momentWrapper: any = moment; // moment must already be loaded
// Set default method for handling non-ISO date conversions.
// This also prevents the deprecation warning message to the console.
momentWrapper.<API key> = (config: any): void => {
config._d = new Date(config._i);
};
return momentWrapper;
}
angular.module(moduleName, [])
.factory(serviceName, momentWrapper);
}
|
/* describe, it, afterEach, beforeEach */
import './snoocore-mocha';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
chai.use(chaiAsPromised);
let expect = chai.expect;
import config from '../config';
import util from './util';
import ResponseError from '../../src/ResponseError';
import Endpoint from '../../src/Endpoint';
describe(__filename, function () {
this.timeout(config.testTimeout);
it('should get a proper response error', function() {
var message = 'oh hello there';
var response = { _status: 200, _body: 'a response body' };
var userConfig = util.getScriptUserConfig();
var endpoint = new Endpoint(userConfig,
userConfig.serverOAuth,
'get',
'/some/path',
{}, // headers
{ some: 'args' });
var responseError = new ResponseError(message,
response,
endpoint);
expect(responseError instanceof ResponseError);
expect(responseError.status).to.eql(200);
expect(responseError.url).to.eql('https://oauth.reddit.com/some/path');
expect(responseError.args).to.eql({ some: 'args', api_type: 'json' });
expect(responseError.message.indexOf('oh hello there')).to.not.eql(-1);
expect(responseError.message.indexOf('Response Status')).to.not.eql(-1);
expect(responseError.message.indexOf('Endpoint URL')).to.not.eql(-1);
expect(responseError.message.indexOf('Arguments')).to.not.eql(-1);
expect(responseError.message.indexOf('Response Body')).to.not.eql(-1);
});
});
|
using System;
using System.Collections.Generic;
using Csla;
namespace Templates
{
[Serializable]
public class <API key> :
<API key><DynamicRoot>
{
protected override object AddNewCore()
{
DynamicRoot item = DataPortal.Create<DynamicRoot>();
Add(item);
return item;
}
private static void <API key>()
{
// TODO: add authorization rules
//AuthorizationRules.AllowGet(typeof(<API key>), "Role");
//AuthorizationRules.AllowEdit(typeof(<API key>), "Role");
}
[Fetch]
private void Fetch()
{
// TODO: load values
<API key> = false;
object listData = null;
foreach (var item in (List<object>)listData)
Add(DataPortal.Fetch<DynamicRoot>(item));
<API key> = true;
}
}
}
|
#ifndef _DEFINES_H
#define _DEFINES_H
/* $Id: defines.h,v 1.171 2013/03/07 09:06:13 dtucker Exp $ */
/* Constants */
#if defined(HAVE_DECL_SHUT_RD) && HAVE_DECL_SHUT_RD == 0
enum
{
SHUT_RD = 0, /* No more receptions. */
SHUT_WR, /* No more transmissions. */
SHUT_RDWR /* No more receptions or transmissions. */
};
# define SHUT_RD SHUT_RD
# define SHUT_WR SHUT_WR
# define SHUT_RDWR SHUT_RDWR
#endif
/*
* Definitions for IP type of service (ip_tos)
*/
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#ifndef IPTOS_LOWDELAY
# define IPTOS_LOWDELAY 0x10
# define IPTOS_THROUGHPUT 0x08
# define IPTOS_RELIABILITY 0x04
# define IPTOS_LOWCOST 0x02
# define IPTOS_MINCOST IPTOS_LOWCOST
#endif /* IPTOS_LOWDELAY */
/*
* Definitions for DiffServ Codepoints as per RFC2474
*/
#ifndef IPTOS_DSCP_AF11
# define IPTOS_DSCP_AF11 0x28
# define IPTOS_DSCP_AF12 0x30
# define IPTOS_DSCP_AF13 0x38
# define IPTOS_DSCP_AF21 0x48
# define IPTOS_DSCP_AF22 0x50
# define IPTOS_DSCP_AF23 0x58
# define IPTOS_DSCP_AF31 0x68
# define IPTOS_DSCP_AF32 0x70
# define IPTOS_DSCP_AF33 0x78
# define IPTOS_DSCP_AF41 0x88
# define IPTOS_DSCP_AF42 0x90
# define IPTOS_DSCP_AF43 0x98
# define IPTOS_DSCP_EF 0xb8
#endif /* IPTOS_DSCP_AF11 */
#ifndef IPTOS_DSCP_CS0
# define IPTOS_DSCP_CS0 0x00
# define IPTOS_DSCP_CS1 0x20
# define IPTOS_DSCP_CS2 0x40
# define IPTOS_DSCP_CS3 0x60
# define IPTOS_DSCP_CS4 0x80
# define IPTOS_DSCP_CS5 0xa0
# define IPTOS_DSCP_CS6 0xc0
# define IPTOS_DSCP_CS7 0xe0
#endif /* IPTOS_DSCP_CS0 */
#ifndef IPTOS_DSCP_EF
# define IPTOS_DSCP_EF 0xb8
#endif /* IPTOS_DSCP_EF */
#ifndef PATH_MAX
# ifdef _POSIX_PATH_MAX
# define PATH_MAX _POSIX_PATH_MAX
# endif
#endif
#ifndef MAXPATHLEN
# ifdef PATH_MAX
# define MAXPATHLEN PATH_MAX
# else /* PATH_MAX */
# define MAXPATHLEN 64
/* realpath uses a fixed buffer of size MAXPATHLEN, so force use of ours */
# ifndef BROKEN_REALPATH
# define BROKEN_REALPATH 1
# endif /* BROKEN_REALPATH */
# endif /* PATH_MAX */
#endif /* MAXPATHLEN */
#if defined(<API key>) && <API key> == 0
# define MAXSYMLINKS 5
#endif
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
#endif
#ifndef STDOUT_FILENO
# define STDOUT_FILENO 1
#endif
#ifndef STDERR_FILENO
# define STDERR_FILENO 2
#endif
#ifndef NGROUPS_MAX /* Disable groupaccess if NGROUP_MAX is not set */
#ifdef NGROUPS
#define NGROUPS_MAX NGROUPS
#else
#define NGROUPS_MAX 0
#endif
#endif
#if defined(<API key>) && <API key> == 0
# define O_NONBLOCK 00004 /* Non Blocking Open */
#endif
#ifndef S_IFSOCK
# define S_IFSOCK 0
#endif /* S_IFSOCK */
#ifndef S_ISDIR
# define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR))
#endif /* S_ISDIR */
#ifndef S_ISREG
# define S_ISREG(mode) (((mode) & (_S_IFMT)) == (_S_IFREG))
#endif /* S_ISREG */
#ifndef S_ISLNK
# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
#endif /* S_ISLNK */
#ifndef S_IXUSR
# define S_IXUSR 0000100
# define S_IXGRP 0000010
# define S_IXOTH 0000001
# define _S_IWUSR 0000200
# define S_IWUSR _S_IWUSR
# define S_IWGRP 0000020
# define S_IWOTH 0000002
# define S_IRUSR 0000400
# define S_IRGRP 0000040
# define S_IROTH 0000004
# define S_IRWXU 0000700 /* read, write, execute */
# define S_IRWXG 0000070 /* read, write, execute */
# define S_IRWXO 0000007 /* read, write, execute */
#endif /* S_IXUSR */
#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
#define MAP_ANON MAP_ANONYMOUS
#endif
#ifndef MAP_FAILED
# define MAP_FAILED ((void *)-1)
#endif
/* *-*-nto-qnx doesn't define this constant in the system headers */
#ifdef MISSING_NFDBITS
# define NFDBITS (8 * sizeof(unsigned long))
#endif
/*
SCO Open Server 3 has INADDR_LOOPBACK defined in rpc/rpc.h but
including rpc/rpc.h breaks Solaris 6
*/
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK ((u_long)0x7f000001)
#endif
/* Types */
/* If sys/types.h does not supply intXX_t, supply them ourselves */
/* (or die trying) */
#ifndef HAVE_U_INT
typedef unsigned int u_int;
#endif
#ifndef HAVE_INTXX_T
typedef signed char int8_t;
# if (SIZEOF_SHORT_INT == 2)
typedef short int int16_t;
# else
# ifdef _UNICOS
# if (SIZEOF_SHORT_INT == 4)
typedef short int16_t;
# else
typedef long int16_t;
# endif
# else
# error "16 bit int type not found."
# endif /* _UNICOS */
# endif
# if (SIZEOF_INT == 4)
typedef int int32_t;
# else
# ifdef _UNICOS
typedef long int32_t;
# else
# error "32 bit int type not found."
# endif /* _UNICOS */
# endif
#endif
/* If sys/types.h does not supply u_intXX_t, supply them ourselves */
#ifndef HAVE_U_INTXX_T
# ifdef HAVE_UINTXX_T
typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
# define HAVE_U_INTXX_T 1
# else
typedef unsigned char u_int8_t;
# if (SIZEOF_SHORT_INT == 2)
typedef unsigned short int u_int16_t;
# else
# ifdef _UNICOS
# if (SIZEOF_SHORT_INT == 4)
typedef unsigned short u_int16_t;
# else
typedef unsigned long u_int16_t;
# endif
# else
# error "16 bit int type not found."
# endif
# endif
# if (SIZEOF_INT == 4)
typedef unsigned int u_int32_t;
# else
# ifdef _UNICOS
typedef unsigned long u_int32_t;
# else
# error "32 bit int type not found."
# endif
# endif
# endif
#define <API key>
#endif
/* 64-bit types */
#ifndef HAVE_INT64_T
# if (SIZEOF_LONG_INT == 8)
typedef long int int64_t;
# else
# if (<API key> == 8)
typedef long long int int64_t;
# endif
# endif
#endif
#ifndef HAVE_U_INT64_T
# if (SIZEOF_LONG_INT == 8)
typedef unsigned long int u_int64_t;
# else
# if (<API key> == 8)
typedef unsigned long long int u_int64_t;
# endif
# endif
#endif
#ifndef HAVE_U_CHAR
typedef unsigned char u_char;
# define HAVE_U_CHAR
#endif /* HAVE_U_CHAR */
#ifndef ULLONG_MAX
# define ULLONG_MAX ((unsigned long long)-1)
#endif
#ifndef SIZE_T_MAX
#define SIZE_T_MAX ULONG_MAX
#endif /* SIZE_T_MAX */
#ifndef HAVE_SIZE_T
typedef unsigned int size_t;
# define HAVE_SIZE_T
# define SIZE_T_MAX UINT_MAX
#endif /* HAVE_SIZE_T */
#ifndef SIZE_MAX
#define SIZE_MAX SIZE_T_MAX
#endif
#ifndef HAVE_SSIZE_T
typedef int ssize_t;
# define HAVE_SSIZE_T
#endif /* HAVE_SSIZE_T */
#ifndef HAVE_CLOCK_T
typedef long clock_t;
# define HAVE_CLOCK_T
#endif /* HAVE_CLOCK_T */
#ifndef HAVE_SA_FAMILY_T
typedef int sa_family_t;
# define HAVE_SA_FAMILY_T
#endif /* HAVE_SA_FAMILY_T */
#ifndef HAVE_PID_T
typedef int pid_t;
# define HAVE_PID_T
#endif /* HAVE_PID_T */
#ifndef HAVE_SIG_ATOMIC_T
typedef int sig_atomic_t;
# define HAVE_SIG_ATOMIC_T
#endif /* HAVE_SIG_ATOMIC_T */
#ifndef HAVE_MODE_T
typedef int mode_t;
# define HAVE_MODE_T
#endif /* HAVE_MODE_T */
#if !defined(<API key>) && defined(<API key>)
# define ss_family __ss_family
#endif /* !defined(<API key>) && defined(<API key>) */
#ifndef HAVE_SYS_UN_H
struct sockaddr_un {
short sun_family; /* AF_UNIX */
char sun_path[108]; /* path name (gag) */
};
#endif /* HAVE_SYS_UN_H */
#ifndef HAVE_IN_ADDR_T
typedef u_int32_t in_addr_t;
#endif
#ifndef HAVE_IN_PORT_T
typedef u_int16_t in_port_t;
#endif
#if defined(BROKEN_SYS_TERMIO_H) && !defined(_STRUCT_WINSIZE)
#define _STRUCT_WINSIZE
struct winsize {
unsigned short ws_row; /* rows, in characters */
unsigned short ws_col; /* columns, in character */
unsigned short ws_xpixel; /* horizontal size, pixels */
unsigned short ws_ypixel; /* vertical size, pixels */
};
#endif
/* *-*-nto-qnx does not define this type in the system headers */
#ifdef MISSING_FD_MASK
typedef unsigned long int fd_mask;
#endif
/* Paths */
#ifndef _PATH_BSHELL
# define _PATH_BSHELL "/bin/sh"
#endif
#ifdef USER_PATH
# ifdef _PATH_STDPATH
# undef _PATH_STDPATH
# endif
# define _PATH_STDPATH USER_PATH
#endif
#ifndef _PATH_STDPATH
# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
#endif
#ifndef SUPERUSER_PATH
# define SUPERUSER_PATH _PATH_STDPATH
#endif
#ifndef _PATH_DEVNULL
# define _PATH_DEVNULL "/dev/null"
#endif
/* user may have set a different path */
#if defined(_PATH_MAILDIR) && defined(MAIL_DIRECTORY)
# undef _PATH_MAILDIR MAILDIR
#endif /* defined(_PATH_MAILDIR) && defined(MAIL_DIRECTORY) */
#ifdef MAIL_DIRECTORY
# define _PATH_MAILDIR MAIL_DIRECTORY
#endif
#ifndef _PATH_NOLOGIN
# define _PATH_NOLOGIN "/etc/nologin"
#endif
/* Define this to be the path of the xauth program. */
#ifdef XAUTH_PATH
#define _PATH_XAUTH XAUTH_PATH
#endif /* XAUTH_PATH */
/* derived from XF4/xc/lib/dps/Xlibnet.h */
#ifndef X_UNIX_PATH
# ifdef __hpux
# define X_UNIX_PATH "/var/spool/sockets/X11/%u"
# else
# define X_UNIX_PATH "/tmp/.X11-unix/X%u"
# endif
#endif /* X_UNIX_PATH */
#define _PATH_UNIX_X X_UNIX_PATH
#ifndef _PATH_TTY
# define _PATH_TTY "/dev/tty"
#endif
/* Macros */
#if defined(<API key>) && defined(HAVE_LOGIN_CAP_H)
# define HAVE_LOGIN_CAP
#endif
#ifndef MAX
# define MAX(a,b) (((a)>(b))?(a):(b))
# define MIN(a,b) (((a)<(b))?(a):(b))
#endif
#ifndef roundup
# define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
#endif
#ifndef timersub
#define timersub(a, b, result) \
do { \
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
if ((result)->tv_usec < 0) { \
--(result)->tv_sec; \
(result)->tv_usec += 1000000; \
} \
} while (0)
#endif
#ifndef TIMEVAL_TO_TIMESPEC
#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
}
#endif
#ifndef TIMESPEC_TO_TIMEVAL
#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
}
#endif
#ifndef __P
# define __P(x) x
#endif
#if !defined(<API key>)
# define <API key>(a) \
((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
(((u_int32_t *) (a))[2] == htonl (0xffff)))
#endif /* !defined(<API key>) */
#if !defined(__GNUC__) || (__GNUC__ < 2)
# define __attribute__(x)
#endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
#if !defined(<API key>) && !defined(__sentinel__)
# define __sentinel__
#endif
#if !defined(<API key>) && !defined(__bounded__)
# define __bounded__(x, y, z)
#endif
#if !defined(<API key>) && !defined(__nonnull__)
# define __nonnull__(x)
#endif
/* *-*-nto-qnx doesn't define this macro in the system headers */
#ifdef MISSING_HOWMANY
# define howmany(x,y) (((x)+((y)-1))/(y))
#endif
#ifndef OSSH_ALIGNBYTES
#define OSSH_ALIGNBYTES (sizeof(int) - 1)
#endif
#ifndef __CMSG_ALIGN
#define __CMSG_ALIGN(p) (((u_int)(p) + OSSH_ALIGNBYTES) &~ OSSH_ALIGNBYTES)
#endif
/* Length of the contents of a control message of length len */
#ifndef CMSG_LEN
#define CMSG_LEN(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
#endif
/* Length of the space taken up by a padded control message of length len */
#ifndef CMSG_SPACE
#define CMSG_SPACE(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len))
#endif
/* given pointer to struct cmsghdr, return pointer to data */
#ifndef CMSG_DATA
#define CMSG_DATA(cmsg) ((u_char *)(cmsg) + __CMSG_ALIGN(sizeof(struct cmsghdr)))
#endif /* CMSG_DATA */
/*
* RFC 2292 requires to check msg_controllen, in case that the kernel returns
* an empty list for some reasons.
*/
#ifndef CMSG_FIRSTHDR
#define CMSG_FIRSTHDR(mhdr) \
((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
(struct cmsghdr *)(mhdr)->msg_control : \
(struct cmsghdr *)NULL)
#endif /* CMSG_FIRSTHDR */
#if defined(HAVE_DECL_OFFSETOF) && HAVE_DECL_OFFSETOF == 0
# define offsetof(type, member) ((size_t) &((type *)0)->member)
#endif
/* Set up BSD-style BYTE_ORDER definition if it isn't there already */
/* XXX: doesn't try to cope with strange byte orders (PDP_ENDIAN) */
#ifndef BYTE_ORDER
# ifndef LITTLE_ENDIAN
# define LITTLE_ENDIAN 1234
# endif /* LITTLE_ENDIAN */
# ifndef BIG_ENDIAN
# define BIG_ENDIAN 4321
# endif /* BIG_ENDIAN */
# ifdef WORDS_BIGENDIAN
# define BYTE_ORDER BIG_ENDIAN
# else /* WORDS_BIGENDIAN */
# define BYTE_ORDER LITTLE_ENDIAN
# endif /* WORDS_BIGENDIAN */
#endif /* BYTE_ORDER */
/* Function replacement / compatibility hacks */
#if !defined(HAVE_GETADDRINFO) && (defined(HAVE_OGETADDRINFO) || defined(HAVE_NGETADDRINFO))
# define HAVE_GETADDRINFO
#endif
#ifndef <API key>
# undef getopt
# undef opterr
# undef optind
# undef optopt
# undef optreset
# undef optarg
# define getopt(ac, av, o) BSDgetopt(ac, av, o)
# define opterr BSDopterr
# define optind BSDoptind
# define optopt BSDoptopt
# define optreset BSDoptreset
# define optarg BSDoptarg
#endif
#if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO)
# undef HAVE_GETADDRINFO
#endif
#if defined(BROKEN_GETADDRINFO) && defined(HAVE_FREEADDRINFO)
# undef HAVE_FREEADDRINFO
#endif
#if defined(BROKEN_GETADDRINFO) && defined(HAVE_GAI_STRERROR)
# undef HAVE_GAI_STRERROR
#endif
#if defined(BROKEN_UPDWTMPX) && defined(HAVE_UPDWTMPX)
# undef HAVE_UPDWTMPX
#endif
#if defined(<API key>) && defined(HAS_SHADOW_EXPIRE)
# undef HAS_SHADOW_EXPIRE
#endif
#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT) && \
defined(<API key>)
# define <API key>
#endif
#if !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY)
# define memmove(s1, s2, n) bcopy((s2), (s1), (n))
#endif /* !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) */
#if defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX)
# define USE_VHANGUP
#endif /* defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX) */
#ifndef GETPGRP_VOID
# include <unistd.h>
# define getpgrp() getpgrp(0)
#endif
#ifdef USE_BSM_AUDIT
# define SSH_AUDIT_EVENTS
# define <API key>
#endif
#ifdef USE_LINUX_AUDIT
# define SSH_AUDIT_EVENTS
# define <API key>
#endif
#if !defined(HAVE___func__) && defined(HAVE___FUNCTION__)
# define __func__ __FUNCTION__
# define __func__ ""
#endif
#if defined(KRB5) && !defined(HEIMDAL)
# define krb5_get_err_text(context,code) error_message(code)
#endif
#if defined(SKEYCHALLENGE_4ARG)
# define <API key>(a,b,c,d) skeychallenge(a,b,c,d)
#else
# define <API key>(a,b,c,d) skeychallenge(a,b,c)
#endif
/* Maximum number of file descriptors available */
#ifdef HAVE_SYSCONF
# define SSH_SYSFDMAX sysconf(_SC_OPEN_MAX)
#else
# define SSH_SYSFDMAX 10000
#endif
#ifdef FSID_HAS_VAL
/* encode f_fsid into a 64 bit value */
#define FSID_TO_ULONG(f) \
((((u_int64_t)(f).val[0] & 0xffffffffUL) << 32) | \
((f).val[1] & 0xffffffffUL))
#define FSID_TO_ULONG(f) \
((((u_int64_t)(f).__val[0] & 0xffffffffUL) << 32) | \
((f).__val[1] & 0xffffffffUL))
#else
# define FSID_TO_ULONG(f) ((f))
#endif
#if defined(__Lynx__)
/*
* LynxOS defines these in param.h which we do not want to include since
* it will also pull in a bunch of kernel definitions.
*/
# define ALIGNBYTES (sizeof(int) - 1)
# define ALIGN(p) (((unsigned)p + ALIGNBYTES) & ~ALIGNBYTES)
/* Missing prototypes on LynxOS */
int snprintf (char *, size_t, const char *, ...);
int mkstemp (char *);
char *crypt (const char *, const char *);
int seteuid (uid_t);
int setegid (gid_t);
char *mkdtemp (char *);
int rresvport_af (int *, sa_family_t);
int innetgr (const char *, const char *, const char *, const char *);
#endif
/*
* Define this to use pipes instead of socketpairs for communicating with the
* client program. Socketpairs do not seem to work on all systems.
*
* configure.ac sets this for a few OS's which are known to have problems
* but you may need to set it yourself
*/
/* #define USE_PIPES 1 */
/**
** login recorder definitions
**/
/* FIXME: put default paths back in */
#ifndef UTMP_FILE
# ifdef _PATH_UTMP
# define UTMP_FILE _PATH_UTMP
# else
# ifdef CONF_UTMP_FILE
# define UTMP_FILE CONF_UTMP_FILE
# endif
# endif
#endif
#ifndef WTMP_FILE
# ifdef _PATH_WTMP
# define WTMP_FILE _PATH_WTMP
# else
# ifdef CONF_WTMP_FILE
# define WTMP_FILE CONF_WTMP_FILE
# endif
# endif
#endif
/* pick up the user's location for lastlog if given */
#ifndef LASTLOG_FILE
# ifdef _PATH_LASTLOG
# define LASTLOG_FILE _PATH_LASTLOG
# else
# ifdef CONF_LASTLOG_FILE
# define LASTLOG_FILE CONF_LASTLOG_FILE
# endif
# endif
#endif
#if defined(HAVE_SHADOW_H) && !defined(DISABLE_SHADOW)
# define USE_SHADOW
#endif
/* The login() library function in libutil is first choice */
#if defined(HAVE_LOGIN) && !defined(DISABLE_LOGIN)
# define USE_LOGIN
#else
/* Simply select your favourite login types. */
/* Can't do if-else because some systems use several... <sigh> */
# if !defined(DISABLE_UTMPX)
# define USE_UTMPX
# endif
# if defined(UTMP_FILE) && !defined(DISABLE_UTMP)
# define USE_UTMP
# endif
# if defined(WTMPX_FILE) && !defined(DISABLE_WTMPX)
# define USE_WTMPX
# endif
# if defined(WTMP_FILE) && !defined(DISABLE_WTMP)
# define USE_WTMP
# endif
#endif
#ifndef UT_LINESIZE
# define UT_LINESIZE 8
#endif
/* I hope that the presence of LASTLOG_FILE is enough to detect this */
#if defined(LASTLOG_FILE) && !defined(DISABLE_LASTLOG)
# define USE_LASTLOG
#endif
#ifdef HAVE_OSF_SIA
# ifdef USE_SHADOW
# undef USE_SHADOW
# endif
# define <API key> 1
#endif
#if defined(HAVE_LIBIAF) && defined(HAVE_SET_ID) && !defined(HAVE_SECUREWARE)
# define <API key> 1
#endif
#if defined(HAVE_LIBIAF) && defined(HAVE_SET_ID) && !defined(BROKEN_LIBIAF)
# define USE_LIBIAF
#endif
/* HP-UX 11.11 */
#ifdef BTMP_FILE
# define _PATH_BTMP BTMP_FILE
#endif
#if defined(USE_BTMP) && defined(_PATH_BTMP)
# define CUSTOM_FAILED_LOGIN
#endif
/** end of login recorder definitions */
#ifdef BROKEN_GETGROUPS
# define getgroups(a,b) ((a)==0 && (b)==NULL ? NGROUPS_MAX : getgroups((a),(b)))
#endif
#if defined(HAVE_MMAP) && defined(BROKEN_MMAP)
# undef HAVE_MMAP
#endif
#ifndef IOV_MAX
# if defined(_XOPEN_IOV_MAX)
# define IOV_MAX _XOPEN_IOV_MAX
# elif defined(DEF_IOV_MAX)
# define IOV_MAX DEF_IOV_MAX
# else
# define IOV_MAX 16
# endif
#endif
#ifndef EWOULDBLOCK
# define EWOULDBLOCK EAGAIN
#endif
#ifndef INET6_ADDRSTRLEN /* for non IPv6 machines */
#define INET6_ADDRSTRLEN 46
#endif
#ifndef SSH_IOBUFSZ
# define SSH_IOBUFSZ 8192
#endif
#ifndef _NSIG
# ifdef NSIG
# define _NSIG NSIG
# else
# define _NSIG 128
# endif
#endif
#endif /* _DEFINES_H */
|
<?php
namespace Tixi\App\AppBundle\Interfaces;
class <API key> {
public $id;
public $anchorDate;
public $<API key>;
public $lookaheadaddressTo;
public $zoneStatus;
public $zoneId;
public $zoneName;
public $orderTime;
public $isRepeated;
public $compagnion;
public $memo;
//repeated part
public $endDate;
public $mondayOrderTime;
public $tuesdayOrderTime;
public $wednesdayOrderTime;
public $thursdayOrderTime;
public $fridayOrderTime;
public $saturdayOrderTime;
public $sundayOrderTime;
}
|
#include "curl_setup.h"
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef __VMS
#include <in.h>
#include <inet.h>
#endif
#ifdef HAVE_PROCESS_H
#include <process.h>
#endif
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
#undef in_addr_t
#define in_addr_t unsigned long
#endif
#ifdef CURLRES_ARES
#include "urldata.h"
#include "sendf.h"
#include "hostip.h"
#include "hash.h"
#include "share.h"
#include "strerror.h"
#include "url.h"
#include "multiif.h"
#include "inet_pton.h"
#include "connect.h"
#include "select.h"
#include "progress.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
# if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && \
(defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__))
# define CARES_STATICLIB
# endif
# include <ares.h>
# include <ares_version.h> /* really old c-ares didn't include this by
itself */
#if ARES_VERSION >= 0x010500
/* c-ares 1.5.0 or later, the callback proto is modified */
#define <API key> 1
#endif
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
struct ResolverResults {
int num_pending; /* number of ares_gethostbyname() requests */
Curl_addrinfo *temp_ai; /* intermediary result while fetching c-ares parts */
int last_status;
};
/*
* <API key>() - the generic low-level asynchronous name
* resolve API. Called from curl_global_init() to initialize global resolver
* environment. Initializes ares library.
*/
int <API key>(void)
{
#ifdef <API key>
if(ares_library_init(ARES_LIB_INIT_ALL)) {
return CURLE_FAILED_INIT;
}
#endif
return CURLE_OK;
}
/*
* <API key>()
*
* Called from curl_global_cleanup() to destroy global resolver environment.
* Deinitializes ares library.
*/
void <API key>(void)
{
#ifdef <API key>
<API key>();
#endif
}
/*
* Curl_resolver_init()
*
* Called from curl_easy_init() -> Curl_open() to initialize resolver
* URL-state specific environment ('resolver' member of the UrlState
* structure). Fills the passed pointer by the initialized ares_channel.
*/
CURLcode Curl_resolver_init(void **resolver)
{
int status = ares_init((ares_channel*)resolver);
if(status != ARES_SUCCESS) {
if(status == ARES_ENOMEM)
return CURLE_OUT_OF_MEMORY;
else
return CURLE_FAILED_INIT;
}
return CURLE_OK;
/* make sure that all other returns from this function should destroy the
ares channel before returning error! */
}
/*
* <API key>()
*
* Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver
* URL-state specific environment ('resolver' member of the UrlState
* structure). Destroys the ares channel.
*/
void <API key>(void *resolver)
{
ares_destroy((ares_channel)resolver);
}
/*
* <API key>()
*
* Called from curl_easy_duphandle() to duplicate resolver URL-state specific
* environment ('resolver' member of the UrlState structure). Duplicates the
* 'from' ares channel and passes the resulting channel to the 'to' pointer.
*/
int <API key>(void **to, void *from)
{
/* Clone the ares channel for the new handle */
if(ARES_SUCCESS != ares_dup((ares_channel*)to,(ares_channel)from))
return CURLE_FAILED_INIT;
return CURLE_OK;
}
static void destroy_async_data (struct Curl_async *async);
/*
* Cancel all possibly still on-going resolves for this connection.
*/
void <API key>(struct connectdata *conn)
{
if(conn && conn->data && conn->data->state.resolver)
ares_cancel((ares_channel)conn->data->state.resolver);
destroy_async_data(&conn->async);
}
/*
* destroy_async_data() cleans up async resolver data.
*/
static void destroy_async_data (struct Curl_async *async)
{
if(async->hostname)
free(async->hostname);
if(async->os_specific) {
struct ResolverResults *res = (struct ResolverResults *)async->os_specific;
if(res) {
if(res->temp_ai) {
Curl_freeaddrinfo(res->temp_ai);
res->temp_ai = NULL;
}
free(res);
}
async->os_specific = NULL;
}
async->hostname = NULL;
}
/*
* <API key>() is called when someone from the outside world
* (using curl_multi_fdset()) wants to get our fd_set setup and we're talking
* with ares. The caller must make sure that this function is only called when
* we have a working ares channel.
*
* Returns: <API key>
*/
int <API key>(struct connectdata *conn,
curl_socket_t *socks,
int numsocks)
{
struct timeval maxtime;
struct timeval timebuf;
struct timeval *timeout;
long milli;
int max = ares_getsock((ares_channel)conn->data->state.resolver,
(ares_socket_t *)socks, numsocks);
maxtime.tv_sec = <API key>;
maxtime.tv_usec = 0;
timeout = ares_timeout((ares_channel)conn->data->state.resolver, &maxtime,
&timebuf);
milli = (timeout->tv_sec * 1000) + (timeout->tv_usec/1000);
if(milli == 0)
milli += 10;
Curl_expire(conn->data, milli);
return max;
}
/*
* waitperform()
*
* 1) Ask ares what sockets it currently plays with, then
* 2) wait for the timeout period to check for action on ares' sockets.
* 3) tell ares to act on all the sockets marked as "with action"
*
* return number of sockets it worked on
*/
static int waitperform(struct connectdata *conn, int timeout_ms)
{
struct SessionHandle *data = conn->data;
int nfds;
int bitmask;
ares_socket_t socks[ARES_GETSOCK_MAXNUM];
struct pollfd pfd[ARES_GETSOCK_MAXNUM];
int i;
int num = 0;
bitmask = ares_getsock((ares_channel)data->state.resolver, socks,
ARES_GETSOCK_MAXNUM);
for(i=0; i < ARES_GETSOCK_MAXNUM; i++) {
pfd[i].events = 0;
pfd[i].revents = 0;
if(<API key>(bitmask, i)) {
pfd[i].fd = socks[i];
pfd[i].events |= POLLRDNORM|POLLIN;
}
if(<API key>(bitmask, i)) {
pfd[i].fd = socks[i];
pfd[i].events |= POLLWRNORM|POLLOUT;
}
if(pfd[i].events != 0)
num++;
else
break;
}
if(num)
nfds = Curl_poll(pfd, num, timeout_ms);
else
nfds = 0;
if(!nfds)
/* Call ares_process() unconditonally here, even if we simply timed out
above, as otherwise the ares name resolve won't timeout! */
ares_process_fd((ares_channel)data->state.resolver, ARES_SOCKET_BAD,
ARES_SOCKET_BAD);
else {
/* move through the descriptors and ask for processing on them */
for(i=0; i < num; i++)
ares_process_fd((ares_channel)data->state.resolver,
pfd[i].revents & (POLLRDNORM|POLLIN)?
pfd[i].fd:ARES_SOCKET_BAD,
pfd[i].revents & (POLLWRNORM|POLLOUT)?
pfd[i].fd:ARES_SOCKET_BAD);
}
return nfds;
}
/*
* <API key>() is called repeatedly to check if a previous
* name resolve request has completed. It should also make sure to time-out if
* the operation seems to take too long.
*
* Returns normal CURLcode errors.
*/
CURLcode <API key>(struct connectdata *conn,
struct Curl_dns_entry **dns)
{
struct SessionHandle *data = conn->data;
struct ResolverResults *res = (struct ResolverResults *)
conn->async.os_specific;
CURLcode rc = CURLE_OK;
*dns = NULL;
waitperform(conn, 0);
if(res && !res->num_pending) {
(void)<API key>(conn, res->last_status, res->temp_ai);
/* temp_ai ownership is moved to the connection, so we need not free-up
them */
res->temp_ai = NULL;
if(!conn->async.dns) {
failf(data, "Could not resolve: %s (%s)",
conn->async.hostname, ares_strerror(conn->async.status));
rc = conn->bits.proxy?<API key>:
<API key>;
}
else
*dns = conn->async.dns;
destroy_async_data(&conn->async);
}
return rc;
}
/*
* <API key>()
*
* waits for a resolve to finish. This function should be avoided since using
* this risk getting the multi interface to "hang".
*
* If 'entry' is non-NULL, make it point to the resolved dns entry
*
* Returns <API key> if the host was not resolved, and
* <API key> if a time-out occurred.
*/
CURLcode <API key>(struct connectdata *conn,
struct Curl_dns_entry **entry)
{
CURLcode rc=CURLE_OK;
struct SessionHandle *data = conn->data;
long timeout;
struct timeval now = Curl_tvnow();
struct Curl_dns_entry *temp_entry;
timeout = Curl_timeleft(data, &now, TRUE);
if(!timeout)
timeout = <API key> * 1000; /* default name resolve timeout */
/* Wait for the name resolve query to complete. */
for(;;) {
struct timeval *tvp, tv, store;
long timediff;
int itimeout;
int timeout_ms;
itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout;
store.tv_sec = itimeout/1000;
store.tv_usec = (itimeout%1000)*1000;
tvp = ares_timeout((ares_channel)data->state.resolver, &store, &tv);
/* use the timeout period ares returned to us above if less than one
second is left, otherwise just use 1000ms to make sure the progress
callback gets called frequent enough */
if(!tvp->tv_sec)
timeout_ms = (int)(tvp->tv_usec/1000);
else
timeout_ms = 1000;
waitperform(conn, timeout_ms);
<API key>(conn,&temp_entry);
if(conn->async.done)
break;
if(Curl_pgrsUpdate(conn)) {
rc = <API key>;
timeout = -1; /* trigger the cancel below */
}
else {
struct timeval now2 = Curl_tvnow();
timediff = Curl_tvdiff(now2, now); /* spent time */
timeout -= timediff?timediff:1; /* always deduct at least 1 */
now = now2; /* for next loop */
}
if(timeout < 0) {
/* our timeout, so we cancel the ares operation */
ares_cancel((ares_channel)data->state.resolver);
break;
}
}
/* Operation complete, if the lookup was successful we now have the entry
in the cache. */
if(entry)
*entry = conn->async.dns;
if(rc)
/* close the connection, since we can't return failure here without
cleaning up this connection properly.
TODO: remove this action from here, it is not a name resolver decision.
*/
conn->bits.close = TRUE;
return rc;
}
/* Connects results to the list */
static void compound_results(struct ResolverResults *res,
Curl_addrinfo *ai)
{
Curl_addrinfo *ai_tail;
if(!ai)
return;
ai_tail = ai;
while(ai_tail->ai_next)
ai_tail = ai_tail->ai_next;
/* Add the new results to the list of old results. */
ai_tail->ai_next = res->temp_ai;
res->temp_ai = ai;
}
/*
* <API key>() is the callback that ares will call when
* the host query initiated by ares_gethostbyname() from Curl_getaddrinfo(),
* when using ares, is completed either successfully or with failure.
*/
static void query_completed_cb(void *arg, /* (struct connectdata *) */
int status,
#ifdef <API key>
int timeouts,
#endif
struct hostent *hostent)
{
struct connectdata *conn = (struct connectdata *)arg;
struct ResolverResults *res;
#ifdef <API key>
(void)timeouts; /* ignored */
#endif
if(ARES_EDESTRUCTION == status)
/* when this ares handle is getting destroyed, the 'arg' pointer may not
be valid so only defer it when we know the 'status' says its fine! */
return;
res = (struct ResolverResults *)conn->async.os_specific;
res->num_pending
if(CURL_ASYNC_SUCCESS == status) {
Curl_addrinfo *ai = Curl_he2ai(hostent, conn->async.port);
if(ai) {
compound_results(res, ai);
}
}
/* A successful result overwrites any previous error */
if(res->last_status != ARES_SUCCESS)
res->last_status = status;
}
/*
* <API key>() - when using ares
*
* Returns name information about the given hostname and port number. If
* successful, the 'hostent' is returned and the forth argument will point to
* memory we need to free after use. That memory *MUST* be freed with
* Curl_freeaddrinfo(), nothing else.
*/
Curl_addrinfo *<API key>(struct connectdata *conn,
const char *hostname,
int port,
int *waitp)
{
char *bufp;
struct SessionHandle *data = conn->data;
struct in_addr in;
int family = PF_INET;
#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */
struct in6_addr in6;
#endif /* CURLRES_IPV6 */
*waitp = 0; /* default to synchronous response */
/* First check if this is an IPv4 address string */
if(Curl_inet_pton(AF_INET, hostname, &in) > 0) {
/* This is a dotted IP address 123.123.123.123-style */
return Curl_ip2addr(AF_INET, &in, hostname, port);
}
#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */
/* Otherwise, check if this is an IPv6 address string */
if(Curl_inet_pton (AF_INET6, hostname, &in6) > 0)
/* This must be an IPv6 address literal. */
return Curl_ip2addr(AF_INET6, &in6, hostname, port);
switch(conn->ip_version) {
default:
#if ARES_VERSION >= 0x010601
family = PF_UNSPEC; /* supported by c-ares since 1.6.1, so for older
c-ares versions this just falls through and defaults
to PF_INET */
break;
#endif
case CURL_IPRESOLVE_V4:
family = PF_INET;
break;
case CURL_IPRESOLVE_V6:
family = PF_INET6;
break;
}
#endif /* CURLRES_IPV6 */
bufp = strdup(hostname);
if(bufp) {
struct ResolverResults *res = NULL;
Curl_safefree(conn->async.hostname);
conn->async.hostname = bufp;
conn->async.port = port;
conn->async.done = FALSE; /* not done */
conn->async.status = 0; /* clear */
conn->async.dns = NULL; /* clear */
res = calloc(sizeof(struct ResolverResults),1);
if(!res) {
Curl_safefree(conn->async.hostname);
conn->async.hostname = NULL;
return NULL;
}
conn->async.os_specific = res;
/* initial status - failed */
res->last_status = ARES_ENOTFOUND;
#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */
if(family == PF_UNSPEC) {
if(Curl_ipv6works()) {
res->num_pending = 2;
/* areschannel is already setup in the Curl_open() function */
ares_gethostbyname((ares_channel)data->state.resolver, hostname,
PF_INET, query_completed_cb, conn);
ares_gethostbyname((ares_channel)data->state.resolver, hostname,
PF_INET6, query_completed_cb, conn);
}
else {
res->num_pending = 1;
/* areschannel is already setup in the Curl_open() function */
ares_gethostbyname((ares_channel)data->state.resolver, hostname,
PF_INET, query_completed_cb, conn);
}
}
else
#endif /* CURLRES_IPV6 */
{
res->num_pending = 1;
/* areschannel is already setup in the Curl_open() function */
ares_gethostbyname((ares_channel)data->state.resolver, hostname, family,
query_completed_cb, conn);
}
*waitp = 1; /* expect asynchronous response */
}
return NULL; /* no struct yet */
}
CURLcode <API key>(struct SessionHandle *data,
char *servers)
{
CURLcode result = CURLE_NOT_BUILT_IN;
int ares_result;
/* If server is NULL or empty, this would purge all DNS servers
* from ares library, which will cause any and all queries to fail.
* So, just return OK if none are configured and don't actually make
* any changes to c-ares. This lets c-ares use it's defaults, which
* it gets from the OS (for instance from /etc/resolv.conf on Linux).
*/
if(!(servers && servers[0]))
return CURLE_OK;
#if (ARES_VERSION >= 0x010704)
ares_result = <API key>(data->state.resolver, servers);
switch(ares_result) {
case ARES_SUCCESS:
result = CURLE_OK;
break;
case ARES_ENOMEM:
result = CURLE_OUT_OF_MEMORY;
break;
case <API key>:
case ARES_ENODATA:
case ARES_EBADSTR:
default:
result = <API key>;
break;
}
#else /* too old c-ares version! */
(void)data;
(void)(ares_result);
#endif
return result;
}
CURLcode <API key>(struct SessionHandle *data,
const char *interf)
{
#if (ARES_VERSION >= 0x010704)
if(!interf)
interf = "";
ares_set_local_dev((ares_channel)data->state.resolver, interf);
return CURLE_OK;
#else /* c-ares version too old! */
(void)data;
(void)interf;
return CURLE_NOT_BUILT_IN;
#endif
}
CURLcode <API key>(struct SessionHandle *data,
const char *local_ip4)
{
#if (ARES_VERSION >= 0x010704)
uint32_t a4;
if((!local_ip4) || (local_ip4[0] == 0)) {
a4 = 0; /* disabled: do not bind to a specific address */
}
else {
if(Curl_inet_pton(AF_INET, local_ip4, &a4) != 1) {
return <API key>;
}
}
ares_set_local_ip4((ares_channel)data->state.resolver, ntohl(a4));
return CURLE_OK;
#else /* c-ares version too old! */
(void)data;
(void)local_ip4;
return CURLE_NOT_BUILT_IN;
#endif
}
CURLcode <API key>(struct SessionHandle *data,
const char *local_ip6)
{
#if (ARES_VERSION >= 0x010704)
unsigned char a6[INET6_ADDRSTRLEN];
if((!local_ip6) || (local_ip6[0] == 0)) {
/* disabled: do not bind to a specific address */
memset(a6, 0, sizeof(a6));
}
else {
if(Curl_inet_pton(AF_INET6, local_ip6, a6) != 1) {
return <API key>;
}
}
ares_set_local_ip6((ares_channel)data->state.resolver, a6);
return CURLE_OK;
#else /* c-ares version too old! */
(void)data;
(void)local_ip6;
return CURLE_NOT_BUILT_IN;
#endif
}
#endif /* CURLRES_ARES */
|
package org.jsondoc.core.issues.issue151;
import org.jsondoc.core.annotation.Api;
import org.jsondoc.core.annotation.ApiMethod;
import org.jsondoc.core.annotation.ApiResponseObject;
@Api(name = "Foo Services", description = "bla, bla, bla ...", group = "foogroup")
public class FooController {
@ApiMethod(path = { "/api/foo" }, description = "Main foo service")
@ApiResponseObject
public FooWrapper<BarPojo> getBar() {
return null;
}
@ApiMethod(path = { "/api/foo-wildcard" }, description = "Main foo service with wildcard")
@ApiResponseObject
public FooWrapper<?> wildcard() {
return null;
}
}
|
namespace Porter2Stemmer
{
public interface IStemmer
{
<summary>
Stem a word.
</summary>
<param name="word">Word to stem.</param>
<returns>
The stemmed word, with a reference to the original unstemmed word.
</returns>
StemmedWord Stem(string word);
}
}
|
function <API key>(firstParameter='something',
secondParameter='booooo',
third=null, fourthParameter=false,
fifthParameter=123.12,
sixthParam=true
){
}
function <API key>(
firstParameter='something',
secondParameter='booooo',
) {
}
function blah() {
}
function blah()
{
}
var object =
{
<API key>: function(
firstParameter='something',
secondParameter='booooo',
third=null,
fourthParameter=false,
fifthParameter=123.12,
sixthParam=true
) /** w00t */ {
}
<API key>: function (firstParameter='something',
secondParameter='booooo',
third=null
) {
}
<API key>: function (
firstParameter, secondParameter, third=null
) {
}
<API key>: function (
firstParameter, secondParameter
) {
}
<API key>: function (
firstParameter,
secondParameter=array(1,2,3),
third=null
) {
}
}
var a = Function('return 1+1');
|
category: <API key>
Endpoint
GET https://api.paymentwall.com/api/rest/country
Sample Response
json
{
"code":"US",
"country":"United States"
}
|
#!/usr/bin/env node
require("babel/register")({
"stage": 1
});
var fs = require("fs");
GLOBAL.WALLACEVERSION = "Err";
GLOBAL.PLUGIN_CONTRIBUTORS = [];
try {
var p = JSON.parse(fs.readFileSync(__dirname+"/package.json"));
GLOBAL.WALLACEVERSION = p.version;
}
catch(e) {}
var Core = require("./core/Core.js");
process.on('uncaughtException', function (err) {
console.error(err);
});
GLOBAL.core = new Core();
|
<?php
Route::group([ 'middleware' => 'guest' ], function () {
Route::get('login', 'Auth\AuthController@getLogin');
Route::post('login', 'Auth\AuthController@postLogin');
// Password reset link request routes...
Route::get('password/email', 'Auth\PasswordController@getEmail');
Route::post('password/email', 'Auth\PasswordController@postEmail');
// Password reset routes...
Route::get('password/reset/{token}', 'Auth\PasswordController@getReset');
Route::post('password/reset', 'Auth\PasswordController@postReset');
});
Route::group([ 'middleware' => 'auth' ], function () {
Route::get('/', [
'as' => 'home',
'uses' => 'ProjectController@index'
]);
Route::get('/project/create', [
'as' => 'project.create',
'uses' => 'ProjectController@create'
]);
Route::post('/project/create', [
'as' => 'project.store',
'uses' => 'ProjectController@store'
]);
Route::post('/project/search', [
'as' => 'project.search',
'uses' => 'ProjectController@search'
]);
Route::get('/project/{project}/graph', [
'as' => 'detail.graph',
'uses' => '<API key>@graph'
]);
Route::get('/project/{project}/overview', [
'as' => 'detail.overview',
'uses' => '<API key>@overview'
]);
Route::get('/project/{project}/activity', [
'as' => 'detail.activity',
'uses' => '<API key>@activity'
]);
Route::get('/project/{project}/inspection-{issue}/{category}', [
'as' => 'detail.issue',
'uses' => '<API key>@issue'
]);
Route::post('/project/{project}/inspection-{issue}/', [
'as' => 'detail.issue.category',
'uses' => '<API key>@issueByCategory'
]);
Route::delete('/project/{project}', [
'as' => 'project.destroy',
'uses' => 'ProjectController@destroy'
]);
Route::get('/project/{project}/inspect', [
'as' => 'inspection.create',
'uses' => '<API key>@create'
]);
Route::post('/project/{project}/inspect', [
'as' => 'inspection.store',
'uses' => '<API key>@store'
]);
Route::get('logout', 'Auth\AuthController@getLogout');
Route::group([ 'middleware' => 'role' ], function () {
Route::resource('user', 'UserController');
});
});
|
## Ruby
These settings apply only when `--ruby` is specified on the command line.
yaml $(ruby)
ruby:
package-name: azure_mgmt_search
package-version: "0.16.0"
azure-arm: true
Ruby multi-api
yaml $(ruby) && $(multiapi)
batch:
- tag: package-2015-08
Tag: package-2015-08 and ruby
These settings apply only when `--tag=package-2015-08 --ruby` is specified on the command line.
Please also specify `--ruby-sdks-folder=<path to the root directory of your azure-sdk-for-ruby clone>`.
yaml $(tag) == 'package-2015-08' && $(ruby)
namespace: "Azure::Search::Mgmt::V2015_08_19"
output-folder: $(ruby-sdks-folder)/management/azure_mgmt_search/lib
|
<?php return unserialize('a:1:{i:0;O:27:"Doctrine\\ORM\\Mapping\\Column":10:{s:4:"type";s:8:"datetime";s:6:"length";N;s:9:"precision";i:0;s:5:"scale";i:0;s:6:"unique";b:0;s:8:"nullable";b:0;s:4:"name";s:16:"fecha_nacimiento";s:7:"options";a:0:{}s:16:"columnDefinition";N;s:5:"value";N;}}');
|
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
/*global cEngine */
/*eslint no-console:0*/
(function (cEngine) {
cEngine.extend('__name__', {
create: function create(config) {
config = config || {};
var __name__ = {
cEnginePlugin: {
name: '__name__',
version: '0.0.1'
},
init: function init(engine) {
console.log('init', engine);
},
start: function start() {
console.log('start');
},
stop: function stop() {
console.log('stop');
},
preStep: function preStep(context, width, height, dt) {
console.log('preStep', context, width, height, dt);
},
postStep: function postStep(context, width, height, dt) {
console.log('postStep', context, width, height, dt);
},
destroy: function destroy() {
console.log('destroy');
}
};
return __name__;
}
});
})(cEngine);
},{}]},{},[1])
|
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// all copies or substantial portions of the Software.
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
'use strict';
var EventEmitter = require('./lib/event_emitter');
var stat = require('./lib/stat');
var inherits = require('util').inherits;
var errors = require('./errors');
var States = require('./reqres_states');
function TChannelOutResponse(id, options) {
options = options || {};
var self = this;
EventEmitter.call(self);
self.errorEvent = self.defineEvent('error');
self.spanEvent = self.defineEvent('span');
self.finishEvent = self.defineEvent('finish');
self.channel = options.channel;
self.inreq = options.inreq;
self.logger = options.logger;
self.random = options.random;
self.timers = options.timers;
self.start = 0;
self.end = 0;
self.state = States.Initial;
self.id = id || 0;
self.code = options.code || 0;
self.tracing = options.tracing || null;
self.headers = options.headers || {};
self.checksumType = options.checksumType || 0;
self.checksum = options.checksum || null;
self.ok = self.code === 0;
self.span = options.span || null;
self.streamed = false;
self._argstream = null;
self.arg1 = null;
self.arg2 = null;
self.arg3 = null;
self.codeString = null;
self.message = null;
}
inherits(TChannelOutResponse, EventEmitter);
TChannelOutResponse.prototype.type = 'tchannel.outgoing-response';
TChannelOutResponse.prototype._sendCallResponse = function _sendCallResponse(args, isLast) {
var self = this;
throw errors.UnimplementedMethod({
className: self.constructor.name,
methodName: '_sendCallResponse'
});
};
TChannelOutResponse.prototype.<API key> = function <API key>(args, isLast) {
var self = this;
throw errors.UnimplementedMethod({
className: self.constructor.name,
methodName: '<API key>'
});
};
TChannelOutResponse.prototype._sendError = function _sendError(codeString, message) {
var self = this;
throw errors.UnimplementedMethod({
className: self.constructor.name,
methodName: '_sendError'
});
};
TChannelOutResponse.prototype.sendParts = function sendParts(parts, isLast) {
var self = this;
switch (self.state) {
case States.Initial:
self.<API key>(parts, isLast);
break;
case States.Streaming:
self.<API key>(parts, isLast);
break;
case States.Done:
self.errorEvent.emit(self, errors.ResponseFrameState({
attempted: 'arg parts',
state: 'Done'
}));
break;
case States.Error:
// TODO: log warn
break;
default:
self.channel.logger.error('TChannelOutResponse is in a wrong state', {
state: self.state
});
break;
}
};
TChannelOutResponse.prototype.<API key> = function <API key>(args, isLast) {
var self = this;
switch (self.state) {
case States.Initial:
self.start = self.timers.now();
self._sendCallResponse(args, isLast);
if (self.span) {
self.span.annotate('ss');
}
if (isLast) self.state = States.Done;
else self.state = States.Streaming;
break;
case States.Streaming:
self.errorEvent.emit(self, errors.ResponseFrameState({
attempted: 'call response',
state: 'Streaming'
}));
break;
case States.Done:
case States.Error:
var arg2 = args[1] || '';
var arg3 = args[2] || '';
self.errorEvent.emit(self, errors.ResponseAlreadyDone({
attempted: 'call response',
state: self.state,
method: '<API key>',
bufArg2: arg2.slice(0, 50),
arg2: String(arg2).slice(0, 50),
bufArg3: arg3.slice(0, 50),
arg3: String(arg3).slice(0, 50)
}));
}
};
TChannelOutResponse.prototype.<API key> = function <API key>(args, isLast) {
var self = this;
switch (self.state) {
case States.Initial:
self.errorEvent.emit(self, errors.ResponseFrameState({
attempted: 'call response continuation',
state: 'Initial'
}));
break;
case States.Streaming:
self.<API key>(args, isLast);
if (isLast) self.state = States.Done;
break;
case States.Done:
case States.Error:
self.errorEvent.emit(self, errors.ResponseAlreadyDone({
attempted: 'call response continuation',
state: self.state,
method: '<API key>'
}));
}
};
TChannelOutResponse.prototype.sendError = function sendError(codeString, message) {
var self = this;
if (self.state === States.Done || self.state === States.Error) {
self.errorEvent.emit(self, errors.ResponseAlreadyDone({
attempted: 'send error frame: ' + codeString + ': ' + message,
currentState: self.state,
method: 'sendError',
codeString: codeString,
errMessage: message
}));
} else {
if (self.span) {
self.span.annotate('ss');
}
self.state = States.Error;
self.codeString = codeString;
self.message = message;
self.channel.<API key>.increment(1, {
'calling-service': self.inreq.headers.cn,
'service': self.inreq.serviceName,
'endpoint': String(self.inreq.arg1),
'type': self.codeString
});
self._sendError(codeString, message);
self.emitFinish();
}
};
TChannelOutResponse.prototype.emitFinish = function emitFinish() {
var self = this;
var now = self.timers.now();
if (self.end) {
self.logger.warn('out response double emitFinish', {
end: self.end,
now: now,
serviceName: self.inreq.serviceName,
cn: self.inreq.headers.cn,
endpoint: String(self.inreq.arg1),
codeString: self.codeString,
errorMessage: self.message,
remoteAddr: self.inreq.connection.socketRemoteAddr,
state: self.state,
isOk: self.ok
});
return;
}
self.end = now;
var latency = self.end - self.inreq.start;
self.channel.emitFastStat(self.channel.buildStat(
'tchannel.inbound.calls.latency',
'timing',
latency,
new stat.<API key>(
self.inreq.headers.cn,
self.inreq.serviceName,
self.inreq.endpoint
)
));
if (self.span) {
self.spanEvent.emit(self, self.span);
}
self.finishEvent.emit(self);
};
TChannelOutResponse.prototype.setOk = function setOk(ok) {
var self = this;
if (self.state !== States.Initial) {
self.errorEvent.emit(self, errors.<API key>({
state: self.state,
method: 'setOk',
ok: ok
}));
return false;
}
self.ok = ok;
self.code = ok ? 0 : 1; // TODO: too coupled to v2 specifics?
return true;
};
TChannelOutResponse.prototype.sendOk = function sendOk(res1, res2) {
var self = this;
self.setOk(true);
self.send(res1, res2);
};
TChannelOutResponse.prototype.sendNotOk = function sendNotOk(res1, res2) {
var self = this;
if (self.state === States.Error) {
self.logger.error('cannot send application error, already sent error frame', {
res1: res1,
res2: res2
});
} else {
self.setOk(false);
self.send(res1, res2);
}
};
TChannelOutResponse.prototype.send = function send(res1, res2) {
var self = this;
/* send calls after finish() should be swallowed */
if (self.end) {
var logOptions = {
serviceName: self.inreq.serviceName,
cn: self.inreq.headers.cn,
endpoint: self.inreq.endpoint,
remoteAddr: self.inreq.remoteAddr,
end: self.end,
codeString: self.codeString,
errorMessage: self.message,
isOk: self.ok,
hasResponse: !!self.arg3,
state: self.state
};
if (self.inreq && self.inreq.timedOut) {
self.logger.info('OutResponse.send() after inreq timed out', logOptions);
} else {
self.logger.warn('OutResponse called send() after end', logOptions);
}
return;
}
self.arg2 = res1;
self.arg3 = res2;
if (self.ok) {
self.channel.emitFastStat(self.channel.buildStat(
'tchannel.inbound.calls.success',
'counter',
1,
new stat.<API key>(
self.inreq.headers.cn,
self.inreq.serviceName,
self.inreq.endpoint
)
));
} else {
// TODO: add outResponse.setErrorType()
self.channel.emitFastStat(self.channel.buildStat(
'tchannel.inbound.calls.app-errors',
'counter',
1,
new stat.<API key>(
self.inreq.headers.cn,
self.inreq.serviceName,
self.inreq.endpoint,
'unknown'
)
));
}
self.<API key>([self.arg1, res1, res2], true);
self.emitFinish();
return self;
};
module.exports = TChannelOutResponse;
|
<div class="alert alert-{{$type}}">
<h1>{{$title}}</h1>
<p>{{$content}}</p>
</div>
|
using RedditSharp.Things;
using System.Threading.Tasks;
namespace RedditSharp
{
partial class Helpers
{
private const string GetThingUrl = "/api/info.json?id={0}";
<summary>
Get a <see cref="Thing"/> by full name.
</summary>
<param name="agent">IWebAgent to use to make request</param>
<param name="fullname">fullname including kind + underscore. EG ("t1_
<returns></returns>
public static async Task<Thing> <API key>(IWebAgent agent, string fullname)
{
var json = await agent.Get(string.Format(GetThingUrl, fullname)).ConfigureAwait(false);
return Thing.Parse(agent, json["data"]["children"][0]);
}
}
}
|
#!/usr/bin/env node
/**
* Release this package.
*/
"use strict";
process.chdir(__dirname + '/..');
const apeTasking = require('ape-tasking'),
apeReleasing = require('ape-releasing');
apeTasking.runTasks('release', [
(callback) => {
apeReleasing.releasePackage({
beforeRelease: [
'./ci/build.js',
'./ci/test.js'
]
}, callback);
}
], true);
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Jumbotron Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="/static/static/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="/static/static/css/jumbotron.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/<API key>.js"></script><![endif]-->
<script src="/static/static/js/<API key>.js"></script>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Project name</a>
</div>
<div class="navbar-collapse collapse">
<form class="navbar-form navbar-right" role="form">
<div class="form-group">
<input type="text" placeholder="Email" class="form-control">
</div>
<div class="form-group">
<input type="password" placeholder="Password" class="form-control">
</div>
<button type="submit" class="btn btn-success">Sign in</button>
</form>
</div><!--/.navbar-collapse -->
</div>
</div>
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<div class="container">
<h1>Hello, world!</h1>
<p>This is a template for a simple marketing or informational website. It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
<p><a class="btn btn-primary btn-lg" role="button">Learn more »</a></p>
</div>
</div>
<div class="container">
<!-- Example row of columns -->
{% if messages %}
<div class='row'>
<div class='col-xs-12'>
{% for message in messages %}
<p {% if message.tags %} class="{{ message.tags }}"{% endif %}>
{{ message }}
</p>
{% endfor %}
</div>
</div>
{% endif %}
<div class="row">
<div class="col-md-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn btn-default" href="#" role="button">View details »</a></p>
</div>
<div class="col-md-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn btn-default" href="#" role="button">View details »</a></p>
</div>
<div class="col-md-4">
<h2>Heading</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<p><a class="btn btn-default" href="#" role="button">View details »</a></p>
</div>
<div class="col-md-4">
{% block content %}{% endblock %}
</div>
</div>
<hr>
<footer>
<p>© Company 2014</p>
</footer>
</div> <!-- /container -->
<!-- Bootstrap core JavaScript
===============================================
<!-- Placed at the end of the document so the pages load faster -->
<script src="/static/static/js/jquery.min.js"></script>
<script src="/static/static/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="/static/static/js/<API key>.js"></script>
</body>
</html>
|
@echo off
rem
rem ADOBE SYSTEMS INCORPORATED
rem Copyright 2007 Adobe Systems Incorporated
rem All Rights Reserved.
rem
rem NOTICE: Adobe permits you to use, modify, and distribute this file
rem in accordance with the terms of the license agreement accompanying it.
rem
rem
rem acompc.bat script for Windows.
rem This simply executes compc.exe in the same directory,
rem inserting the option +configname=air, which makes
rem compc.exe use air-config.xml instead of flex-config.xml.
rem On Unix, acompc is used instead.
rem
"%~dp0compc.exe" +configname=air %*
|
import os, scrapy, argparse
from realclearpolitics.spiders.spider import RcpSpider
from scrapy.crawler import CrawlerProcess
parser = argparse.ArgumentParser('Scrap realclearpolitics polls data')
parser.add_argument('url', action="store")
parser.add_argument('--locale', action="store", default='')
parser.add_argument('--race', action="store", default='primary')
parser.add_argument('--csv', dest='to_csv', action='store_true')
parser.add_argument('--output', dest='output', action='store')
args = parser.parse_args()
url = args.url
extra_fields = { 'locale': args.locale, 'race': args.race }
if (args.to_csv):
if args.output is None:
filename = url.split('/')[-1].split('.')[0]
output = filename + ".csv"
print("No output file specified : using " + output)
else:
output = args.output
if not output.endswith(".csv"):
output = output + ".csv"
if os.path.isfile(output):
os.remove(output)
os.system("scrapy crawl <API key> -a url="+url+" -o "+output)
else:
settings = {
'ITEM_PIPELINES' : {
'realclearpolitics.pipeline.PollPipeline': 300,
},
'LOG_LEVEL' : 'ERROR',
'DOWNLOAD_HANDLERS' : {'s3': None,}
}
process = CrawlerProcess(settings);
process.crawl(RcpSpider, url, extra_fields)
process.start()
|
/*global d3 */
// asynchronously load data from the Lagotto API
queue()
.defer(d3.json, encodeURI("/api/agents/"))
.await(function(error, a) {
if (error) { return console.warn(error); }
agentsViz(a.agents);
});
// add data to page
function agentsViz(data) {
for (var i=0; i<data.length; i++) {
var agent = data[i];
// responses tab
d3.select("#response_count_" + agent.id)
.text(numberWithDelimiter(agent.responses.count));
d3.select("#average_count_" + agent.id)
.text(numberWithDelimiter(agent.responses.average));
}
}
|
var test = require("tape").test
var level = require("level-test")()
var testdb = level("test-versionstream")
var version = require("../")
var db = version(testdb)
var lastVersion
test("stuff some datas", function (t) {
t.plan(2)
db.put("pet", "fluffy", {version: 0})
db.put("pet", "spot", {version: 1})
db.put("pet", "scratch", {version: 334})
db.put("watch", "calculator", {version: 11})
db.put("watch", "casio", {version: 14})
db.put("pet", "sparky", function (err, version) {
t.notOk(err, "no error")
t.ok(version > Date.now() - 1000, "Default version is a recent timestamp")
lastVersion = version
})
})
test("versionstream pets", function (t) {
t.plan(5)
var versions = []
db.createVersionStream("pet")
.on("data", function (record) {
t.ok(record.version != null, "record has a version")
versions.push(record.version)
})
.on("end", function () {
t.deepEqual(versions, [lastVersion, 334, 1, 0], "Versions came out in the correct order")
})
})
test("versionstream pets version no min", function (t) {
t.plan(2)
var versions = []
db.createVersionStream("pet", {maxVersion: 500, limit: 1})
.on("data", function (record) {
t.ok(record.version != null, "record has a version")
versions.push(record.version)
})
.on("end", function () {
t.deepEqual(versions, [334], "Versions came out in the correct order")
})
})
test("versionstream pets version reverse no min", function (t) {
t.plan(2)
var versions = []
db.createVersionStream("pet", {maxVersion: 500, limit: 1, reverse: true})
.on("data", function (record) {
t.ok(record.version != null, "record has a version")
versions.push(record.version)
})
.on("end", function () {
t.deepEqual(versions, [0], "Versions came out in the correct order")
})
})
test("versionstream pets version range no max", function (t) {
t.plan(2)
var versions = []
db.createVersionStream("pet", {minVersion: 10, limit: 1})
.on("data", function (record) {
t.ok(record.version != null, "record has a version")
versions.push(record.version)
})
.on("end", function () {
t.deepEqual(versions, [lastVersion], "Versions came out in the correct order")
})
})
test("versionstream pets version range", function (t) {
t.plan(2)
var versions = []
db.createVersionStream("pet", {minVersion: 10, maxVersion: 500, limit: 1})
.on("data", function (record) {
t.ok(record.version != null, "record has a version")
versions.push(record.version)
})
.on("end", function () {
t.deepEqual(versions, [334], "Versions came out in the correct order")
})
})
test("versionstream watches", function (t) {
t.plan(3)
var versions = []
db.createVersionStream("watch")
.on("data", function (record) {
t.ok(record.version != null, "record has a version")
versions.push(record.version)
})
.on("end", function () {
t.deepEqual(versions, [14, 11], "Versions came out in the correct order")
})
})
test("alias", function (t) {
var versions = []
db.versionStream("pet")
.on("data", function (record) {
t.ok(record.version != null, "record has a version")
versions.push(record.version)
})
.on("end", function () {
t.deepEqual(versions, [lastVersion, 334, 1, 0], "Versions came out in the correct order")
t.end()
})
})
|
#ifndef <API key>
#define <API key>
#include <Dataflow/Network/Module.h>
#include <Modules/Basic/share.h>
namespace SCIRun {
namespace Modules {
namespace Basic {
class SCISHARE PortFeedbackSender : public SCIRun::Dataflow::Networks::Module,
public Has1InputPort<StringPortTag>,
public HasNoOutputPorts
{
public:
PortFeedbackSender();
virtual void execute() override;
virtual void setStateDefaults() override;
INPUT_PORT(0, Input, String);
<API key>(NoAlgoOrUI)
};
class SCISHARE <API key> : public SCIRun::Dataflow::Networks::Module,
public Has1OutputPort<StringPortTag>,
public HasNoInputPorts
{
public:
void processFeedback(const Core::Datatypes::ModuleFeedback& var);
<API key>();
virtual void execute() override;
virtual void setStateDefaults() override;
OUTPUT_PORT(0, Output, String);
<API key>(NoAlgoOrUI)
};
}}}
#endif
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery Mobile Docs - Theming Pages</title>
<link rel="stylesheet" href="../../../css/themes/default/jquery.mobile.css" />
<link rel="stylesheet" href="../../_assets/css/jqm-docs.css"/>
<script src="../../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
<script src="../../../js/jquery.js"></script>
<script src="../../../docs/_assets/js/jqm-docs.js"></script>
<script src="../../../js/jquery.mobile.js"></script>
</head>
<body>
<div data-role="page" class="type-interior" data-theme="e">
<div data-role="header" data-theme="e">
<h1>Theming pages</h1>
<a href="../../../" data-icon="home" data-iconpos="notext" data-direction="reverse">Home</a>
<a href="../../nav.html" data-icon="search" data-iconpos="notext" data-rel="dialog" data-transition="fade">Search</a>
</div><!-- /header -->
<div data-role="content">
<div class="content-primary">
<ul data-role="controlgroup" data-type="horizontal" class="localnav">
<li><a href="../pages-themes.html" data-role="button" data-transition="fade">Theme Overview</a></li>
<li><a href="theme-a.html" data-role="button" data-transition="fade">A </a></li>
<li><a href="theme-b.html" data-role="button" data-transition="fade">B </a></li>
<li><a href="theme-c.html" data-role="button" data-transition="fade">C </a></li>
<li><a href="theme-d.html" data-role="button" data-transition="fade">D </a></li>
<li><a href="theme-e.html" data-role="button" data-transition="fade" class="ui-btn-active">E </a></li>
</ul>
<h2>Theme E Sample Page</h2>
<p>This is an example of <code>data-theme="e"</code> applied to the same element as <code>data-role="page"</code>, showing how the theme is inherited by widgets throughout the page.</p>
<div data-role="fieldcontain">
<label for="name-a">Text Input:</label>
<input type="text" name="name" id="name-a" value="" />
</div>
<div data-role="fieldcontain">
<label for="switch-a">Flip switch:</label>
<select name="switch-a" id="switch-a" data-role="slider">
<option value="off">Off</option>
<option value="on">On</option>
</select>
</div>
<div data-role="fieldcontain">
<label for="slider-a">Slider:</label>
<input type="range" name="slider" id="slider-a" value="0" min="0" max="100" />
</div>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" data-type="horizontal">
<legend>Font styling:</legend>
<input type="checkbox" name="checkbox-6a" id="checkbox-6a" class="custom" />
<label for="checkbox-6a">b</label>
<input type="checkbox" name="checkbox-7a" id="checkbox-7a" class="custom" />
<label for="checkbox-7a"><em>i</em></label>
<input type="checkbox" name="checkbox-8a" id="checkbox-8a" class="custom" />
<label for="checkbox-8a">u</label>
</fieldset>
</div>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<legend>Choose a pet:</legend>
<input type="radio" name="radio-choice-1" id="radio-choice-1a" value="choice-1" />
<label for="radio-choice-1a">Cat</label>
<input type="radio" name="radio-choice-1" id="radio-choice-2a" value="choice-2" />
<label for="radio-choice-2a">Dog</label>
<input type="radio" name="radio-choice-1" id="radio-choice-3a" value="choice-3" />
<label for="radio-choice-3a">Hamster</label>
<input type="radio" name="radio-choice-1" id="radio-choice-4a" value="choice-4" />
<label for="radio-choice-4a">Lizard</label>
</fieldset>
</div>
<div data-role="fieldcontain">
<label for="select-choice-a" class="select">Choose shipping method:</label>
<select name="select-choice-a" id="select-choice-a">
<option value="standard">Standard: 7 day</option>
<option value="rush">Rush: 3 days</option>
<option value="express">Express: next day</option>
<option value="overnight">Overnight</option>
</select>
</div>
<h2>Collapsible Sets</h2>
<div data-role="collapsible-set">
<div data-role="collapsible" data-collapsed="false">
<h3>Section 1</h3>
<p>I'm the collapsible content in a set so this feels like an accordion. I'm visible by default because I have the <code>data-collapsed="false"</code> attribute; to collapse me, either click my header or expand another header in my set.</p>
</div>
<div data-role="collapsible">
<h3>Section 2</h3>
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
</div>
<div data-role="collapsible">
<h3>Section 3</h3>
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
</div>
</div>
<h2>Inset List</h2>
<ul data-role="listview" data-inset="true">
<li><a href="index.html">Inbox <span class="ui-li-count" >12</span></a></li>
<li><a href="index.html">Outbox <span class="ui-li-count">0</span></a></li>
<li><a href="index.html">Drafts <span class="ui-li-count">4</span></a></li>
<li><a href="index.html">Sent <span class="ui-li-count">328</span></a></li>
<li><a href="index.html">Trash <span class="ui-li-count">62</span></a></li>
</ul>
</div><!--/content-primary -->
<div class="content-secondary">
<div data-role="collapsible" data-collapsed="true" data-theme="e" data-content-theme="e">
<h3>More in this section</h3>
<ul data-role="listview" data-theme="e" data-dividertheme="e">
<li data-role="list-divider">Pages & Dialogs</li>
<li><a href="../../page-anatomy.html">Anatomy of a page</a></li>
<li><a href="../../page-template.html" data-ajax="false">Single page template</a></li>
<li><a href="../../multipage-template.html" data-ajax="false">Multi-page template</a></li>
<li><a href="../../page-titles.html">Page titles</a></li>
<li><a href="../../page-links.html">Linking pages</a></li>
<li><a href="../../page-transitions.html" data-ajax="false">Page transitions</a></li>
<li><a href="../../page-dialogs.html">Dialogs</a></li>
<li><a href="../../page-cache.html">Prefetching & caching pages</a></li>
<li><a href="../../page-navmodel.html">Ajax, hashes & history</a></li>
<li><a href="../../page-dynamic.html">Dynamically Injecting Pages</a></li>
<li><a href="../../page-scripting.html">Scripting pages</a></li>
<li data-theme="a"><a href="../../pages-themes.html">Theming pages</a></li>
</ul>
</div>
</div>
</div><!-- /content -->
<div data-role="footer" class="footer-docs" data-theme="e">
<p>© 2011-12 The jQuery Foundation</p>
</div>
</div><!-- /page -->
</body>
</html>
|
describe 'font' do
before do
@rmq = RubyMotionQuery::RMQ
end
it 'should return font from RMQ or an instance of rmq' do
@rmq.font.should == RubyMotionQuery::Font
rmq = RubyMotionQuery::RMQ.new
rmq.font.should == RubyMotionQuery::Font
end
it 'should return a list of font families' do
@rmq.font.family_list.grep(/Helvetica/).length.should > 0
end
it 'should return a list of fonts for one family' do
@rmq.font.for_family('Arial').grep(/Arial/).length.should > 0
end
it 'should return a system font given a size' do
@rmq.font.system(11).is_a?(UIFont).should == true
end
it 'should return a system font with system default font size' do
@rmq.font.system.pointSize.should == UIFont.systemFontSize
end
it 'should return font with name' do
@rmq.font.with_name('American Typewriter', 11).is_a?(UIFont).should == true
end
it "should return fonts that have been named" do
@rmq.font.add_named('awesome_font', 'American Typewriter', 12)
@rmq.font.awesome_font.is_a?(UIFont).should.be.true
end
end
|
#ifndef <API key>
#ifndef <API key>
#define <API key>
namespace j2cpp { namespace java { namespace lang { class Exception; } } }
namespace j2cpp { namespace java { namespace lang { class String; } } }
namespace j2cpp { namespace java { namespace lang { class Throwable; } } }
namespace j2cpp { namespace java { namespace lang { class Object; } } }
namespace j2cpp { namespace java { namespace io { class IOException; } } }
namespace j2cpp { namespace java { namespace io { class Serializable; } } }
namespace j2cpp { namespace java { namespace io { class <API key>; } } }
#include <java/io/IOException.hpp>
#include <java/io/<API key>.hpp>
#include <java/io/Serializable.hpp>
#include <java/lang/Exception.hpp>
#include <java/lang/Object.hpp>
#include <java/lang/String.hpp>
#include <java/lang/Throwable.hpp>
namespace j2cpp {
namespace java { namespace io {
class <API key>;
class <API key>
: public object<<API key>>
{
public:
J2CPP_DECLARE_CLASS
<API key>(0)
<API key>(1)
<API key>(2)
J2CPP_DECLARE_FIELD(0)
explicit <API key>(jobject jobj)
: object<<API key>>(jobj)
, detail(jobj)
{
}
operator local_ref<java::lang::Exception>() const;
operator local_ref<java::lang::Throwable>() const;
operator local_ref<java::lang::Object>() const;
operator local_ref<java::io::IOException>() const;
operator local_ref<java::io::Serializable>() const;
operator local_ref<java::io::<API key>>() const;
<API key>(local_ref< java::lang::String > const&, local_ref< java::lang::Exception > const&);
local_ref< java::lang::String > getMessage();
local_ref< java::lang::Throwable > getCause();
field< J2CPP_CLASS_NAME, J2CPP_FIELD_NAME(0), <API key>(0), local_ref< java::lang::Exception > > detail;
}; //class <API key>
} //namespace io
} //namespace java
} //namespace j2cpp
#endif //<API key>
#else //<API key>
#ifndef <API key>
#define <API key>
namespace j2cpp {
java::io::<API key>::operator local_ref<java::lang::Exception>() const
{
return local_ref<java::lang::Exception>(get_jobject());
}
java::io::<API key>::operator local_ref<java::lang::Throwable>() const
{
return local_ref<java::lang::Throwable>(get_jobject());
}
java::io::<API key>::operator local_ref<java::lang::Object>() const
{
return local_ref<java::lang::Object>(get_jobject());
}
java::io::<API key>::operator local_ref<java::io::IOException>() const
{
return local_ref<java::io::IOException>(get_jobject());
}
java::io::<API key>::operator local_ref<java::io::Serializable>() const
{
return local_ref<java::io::Serializable>(get_jobject());
}
java::io::<API key>::operator local_ref<java::io::<API key>>() const
{
return local_ref<java::io::<API key>>(get_jobject());
}
java::io::<API key>::<API key>(local_ref< java::lang::String > const &a0, local_ref< java::lang::Exception > const &a1)
: object<java::io::<API key>>(
call_new_object<
java::io::<API key>::J2CPP_CLASS_NAME,
java::io::<API key>::J2CPP_METHOD_NAME(0),
java::io::<API key>::<API key>(0)
>(a0, a1)
)
, detail(get_jobject())
{
}
local_ref< java::lang::String > java::io::<API key>::getMessage()
{
return call_method<
java::io::<API key>::J2CPP_CLASS_NAME,
java::io::<API key>::J2CPP_METHOD_NAME(1),
java::io::<API key>::<API key>(1),
local_ref< java::lang::String >
>(get_jobject());
}
local_ref< java::lang::Throwable > java::io::<API key>::getCause()
{
return call_method<
java::io::<API key>::J2CPP_CLASS_NAME,
java::io::<API key>::J2CPP_METHOD_NAME(2),
java::io::<API key>::<API key>(2),
local_ref< java::lang::Throwable >
>(get_jobject());
}
J2CPP_DEFINE_CLASS(java::io::<API key>,"java/io/<API key>")
J2CPP_DEFINE_METHOD(java::io::<API key>,0,"<init>","(Ljava/lang/String;Ljava/lang/Exception;)V")
J2CPP_DEFINE_METHOD(java::io::<API key>,1,"getMessage","()Ljava/lang/String;")
J2CPP_DEFINE_METHOD(java::io::<API key>,2,"getCause","()Ljava/lang/Throwable;")
J2CPP_DEFINE_FIELD(java::io::<API key>,0,"detail","Ljava/lang/Exception;")
} //namespace j2cpp
#endif //<API key>
#endif //<API key>
|
<?php
namespace Concrete\Tests\Core\File;
use Concrete\Core\File\Importer;
use Concrete\Core\Attribute\Type as AttributeType;
use Concrete\Core\Attribute\Key\FileKey;
use Concrete\Core\Attribute\Key\Category;
class FileListTest extends \FileStorageTestCase
{
/** @var \Concrete\Core\File\FileList */
protected $list;
protected function setUp()
{
$this->tables = array_merge($this->tables, array(
'Users',
'<API key>',
'FileAttributeValues',
'<API key>',
'ConfigStore',
'FileSets',
'FileVersionLog',
'FileSetFiles',
));
$this->metadatas = array_merge($this->metadatas, array(
'Concrete\Core\Entity\Attribute\Key\Type\NumberType',
'Concrete\Core\Entity\Attribute\Key\Type\Type',
'Concrete\Core\Entity\Attribute\Key\FileKey',
'Concrete\Core\Entity\Attribute\Value\FileValue',
'Concrete\Core\Entity\Attribute\Key\Key',
'Concrete\Core\Entity\Attribute\Value\Value',
'Concrete\Core\Entity\Attribute\Value\Value\NumberValue',
'Concrete\Core\Entity\Attribute\Value\Value\Value',
'Concrete\Core\Entity\Attribute\Type',
'Concrete\Core\Entity\Attribute\Category',
));
parent::setUp();
\Config::set('concrete.upload.extensions', '*.txt;*.jpg;*.jpeg;*.png');
Category::add('file');
\Concrete\Core\Permission\Access\Entity\Type::add('file_uploader', 'File Uploader');
$number = AttributeType::add('number', 'Number');
FileKey::add($number, array('akHandle' => 'width', 'akName' => 'Width'));
FileKey::add($number, array('akHandle' => 'height', 'akName' => 'Height'));
mkdir($this->getStorageDirectory());
$this->getStorageLocation();
$sample = dirname(__FILE__) . '/StorageLocation/fixtures/sample.txt';
$image = DIR_BASE . '/concrete/images/logo.png';
$fi = new Importer();
$files = array(
'sample1.txt' => $sample,
'sample2.txt' => $sample,
'sample4.txt' => $sample,
'sample5.txt' => $sample,
'awesome.txt' => $sample,
'testing.txt' => $sample,
'logo1.png' => $image,
'logo2.png' => $image,
'logo3.png' => $image,
'foobley.png' => $image,
'test.png' => $image,
);
foreach ($files as $filename => $pointer) {
$fi->import($pointer, $filename);
}
$this->list = new \Concrete\Core\File\FileList();
$this->list->ignorePermissions();
}
protected function cleanup()
{
parent::cleanup();
if (file_exists(dirname(__FILE__) . '/test.txt')) {
unlink(dirname(__FILE__) . '/test.txt');
}
if (file_exists(dirname(__FILE__) . '/test.invalid')) {
unlink(dirname(__FILE__) . '/test.invalid');
}
}
public function <API key>()
{
$pagination = $this->list->getPagination();
$this->assertInstanceOf('\Concrete\Core\Search\Pagination\Pagination', $pagination);
}
public function <API key>()
{
$this->assertEquals(11, $this->list->getTotalResults());
}
public function <API key>()
{
$pagination = $this->list->getPagination();
$this->assertEquals(11, $pagination->getTotalResults());
}
public function <API key>()
{
$this->list->filterByType(\Concrete\Core\File\Type\Type::T_IMAGE);
$this->assertEquals(5, $this->list->getTotalResults());
$pagination = $this->list->getPagination();
$this->assertEquals(5, $pagination->getTotalResults());
$pagination->setMaxPerPage(3)->setCurrentPage(1);
$results = $pagination-><API key>();
$this->assertEquals(3, count($results));
$this->assertInstanceOf('\Concrete\Core\Entity\File\File', $results[0]);
}
public function <API key>()
{
$this->list->filterByType(\Concrete\Core\File\Type\Type::T_TEXT);
$this->list->filterByExtension('txt');
$this->assertEquals(6, $this->list->getTotalResults());
}
public function <API key>()
{
$this->list->filterByKeywords('le');
$pagination = $this->list->getPagination();
$this->assertEquals(5, $pagination->getTotalResults());
}
public function testFilterBySet()
{
$fs = \FileSet::add('test');
$f = \File::getByID(1);
$f2 = \File::getByID(4);
$fs->addFileToSet($f);
$fs->addFileToSet($f2);
$fs2 = \FileSet::add('test2');
$fs2->addFiletoSet($f);
$this->list->filterBySet($fs);
$pagination = $this->list->getPagination();
$this->assertEquals(2, $pagination->getTotalResults());
$results = $this->list->getResults();
$this->assertEquals(2, count($results));
$this->assertEquals(4, $results[1]->getFileID());
$this->list->filterBySet($fs2);
$results = $this->list->getResults();
$this->assertEquals(1, count($results));
$this->assertEquals(1, $results[0]->getFileID());
$nl = new \Concrete\Core\File\FileList();
$nl->ignorePermissions();
$nl->filterByNoSet();
$results = $nl->getResults();
$this->assertEquals(9, count($results));
}
public function testSortByFilename()
{
$this->list-><API key>();
$pagination = $this->list->getPagination();
$pagination->setMaxPerPage(2);
$results = $pagination-><API key>();
$this->assertEquals(2, count($results));
$this->assertEquals(5, $results[0]->getFileID());
}
public function testAutoSort()
{
$req = \Request::getInstance();
$req->query->set($this->list-><API key>(), 'fv.fvFilename');
$req->query->set($this->list-><API key>(), 'desc');
$nl = new \Concrete\Core\File\FileList();
$nl->ignorePermissions();
$results = $nl->getResults();
$this->assertEquals(6, $results[0]->getFileID());
$this->assertEquals('testing.txt', $results[0]->getFilename());
$req->query->set($this->list-><API key>(), null);
$req->query->set($this->list-><API key>(), null);
}
public function <API key>()
{
$pagination = $this->list->getPagination();
$pagination->setMaxPerPage(2)->setCurrentPage(1);
$this->assertEquals(6, $pagination->getTotalPages());
$this->list->filterByType(\Concrete\Core\File\Type\Type::T_IMAGE);
$pagination = $this->list->getPagination();
$this->assertEquals(5, $pagination->getTotalResults());
$pagination->setMaxPerPage(2)->setCurrentPage(2);
$this->assertEquals(3, $pagination->getTotalPages());
$this->assertTrue($pagination->hasNextPage());
$this->assertTrue($pagination->hasPreviousPage());
$pagination->setCurrentPage(1);
$this->assertTrue($pagination->hasNextPage());
$this->assertFalse($pagination->hasPreviousPage());
$pagination->setCurrentPage(3);
$this->assertFalse($pagination->hasNextPage());
$this->assertTrue($pagination->hasPreviousPage());
$results = $pagination-><API key>();
$this->assertInstanceOf('\Concrete\Core\Entity\File\File', $results[0]);
$this->assertEquals(1, count($results[0]));
}
public function <API key>()
{
// first lets make some more files.
$sample = dirname(__FILE__) . '/StorageLocation/fixtures/sample.txt';
$image = DIR_BASE . '/concrete/images/logo.png';
$fi = new Importer();
$files = array(
'another.txt' => $sample,
'funtime.txt' => $sample,
'funtime2.txt' => $sample,
'awesome-o' => $sample,
'image.png' => $image,
);
foreach ($files as $filename => $pointer) {
$fi->import($pointer, $filename);
}
$nl = new \Concrete\Core\File\FileList();
$nl-><API key>(function ($file) {
if ($file->getTypeObject()->getGenericType() == \Concrete\Core\File\Type\Type::T_IMAGE) {
return true;
} else {
return false;
}
});
$nl-><API key>();
$results = $nl->getResults();
$pagination = $nl->getPagination();
$this->assertEquals(-1, $nl->getTotalResults());
$this->assertEquals(6, $pagination->getTotalResults());
$this->assertEquals(6, count($results));
// so there are six "real" results, and 15 total results without filtering.
$pagination->setMaxPerPage(4)->setCurrentPage(1);
$this->assertEquals(2, $pagination->getTotalPages());
$this->assertTrue($pagination->hasNextPage());
$this->assertFalse($pagination->hasPreviousPage());
// Ok, so the results ought to be the following files, broken up into pages of four, in this order:
// foobley.png
// image.png
// logo1.png
// logo2.png
// -- page break --
// logo3.png
// test.png
$results = $pagination-><API key>();
$this->assertInstanceOf('\Concrete\Core\Search\Pagination\<API key>', $pagination);
$this->assertEquals(4, count($results));
$this->assertEquals('foobley.png', $results[0]->getFilename());
$this->assertEquals('image.png', $results[1]->getFilename());
$this->assertEquals('logo1.png', $results[2]->getFilename());
$this->assertEquals('logo2.png', $results[3]->getFilename());
$pagination->setCurrentPage(2);
$results = $pagination-><API key>();
$this->assertEquals('logo3.png', $results[0]->getFilename());
$this->assertEquals('test.png', $results[1]->getFilename());
$this->assertEquals(2, count($results));
$this->assertTrue($pagination->hasPreviousPage());
$this->assertFalse($pagination->hasNextPage());
}
public function <API key>()
{
$set = \Concrete\Core\File\Search\ColumnSet\ColumnSet::getCurrent();
$this->assertInstanceOf('\Concrete\Core\File\Search\ColumnSet\DefaultSet', $set);
$columns = $set->getColumns();
$this->assertEquals(4, count($columns));
}
}
|
package com.tale.model;
import com.blade.jdbc.annotation.Table;
import java.io.Serializable;
@Table(name = "t_comments", pk = "coid")
public class Comments implements Serializable {
private static final long serialVersionUID = 1L;
// comment
private Integer coid;
// post,
private Integer cid;
// GMT unix
private Integer created;
private String author;
private Integer author_id;
private Integer owner_id;
private String mail;
private String url;
private String ip;
private String agent;
private String content;
private String type;
private String status;
private Integer parent;
public Comments() {
}
public Integer getCoid() {
return coid;
}
public void setCoid(Integer coid) {
this.coid = coid;
}
public Integer getCid() {
return cid;
}
public void setCid(Integer cid) {
this.cid = cid;
}
public Integer getCreated() {
return created;
}
public void setCreated(Integer created) {
this.created = created;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getAgent() {
return agent;
}
public void setAgent(String agent) {
this.agent = agent;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Integer getParent() {
return parent;
}
public void setParent(Integer parent) {
this.parent = parent;
}
public Integer getAuthor_id() {
return author_id;
}
public void setAuthor_id(Integer author_id) {
this.author_id = author_id;
}
public Integer getOwner_id() {
return owner_id;
}
public void setOwner_id(Integer owner_id) {
this.owner_id = owner_id;
}
}
|
"use strict";
const lua = require("../src/lua.js");
const lauxlib = require("../src/lauxlib.js");
const {to_luastring} = require("../src/fengaricore.js");
const toByteCode = function(luaCode) {
let L = lauxlib.luaL_newstate();
if (!L) throw Error("failed to create lua state");
if (lauxlib.luaL_loadstring(L, to_luastring(luaCode)) !== lua.LUA_OK)
throw Error(lua.lua_tojsstring(L, -1));
let b = [];
if (lua.lua_dump(L, function(L, b, size, B) {
B.push(...b.slice(0, size));
return 0;
}, b, false) !== 0)
throw Error("unable to dump given function");
return Uint8Array.from(b);
};
module.exports.toByteCode = toByteCode;
|
<!doctype html>
<html>
<head>
<title>ATS-Queen-Puzzle</title>
<style>
#canvas-container
{
margin: 0 auto; width: 920px; height: auto;
}
</style>
<script
src="https://cdn.jsdelivr.net/jquery/2.1.1/jquery.min.js">
</script>
<script
src="https://ats-lang.github.io/LIBRARY/libatscc2js/ATS2-0.3.2/libatscc2js_all.js">
</script>
</head>
<body>
<h1>ATS->C->JS via atscc2js</h1>
<div id="canvas-container">
<canvas
id="<API key>"
width="920px" height="600px"
oncontextmenu="event.preventDefault()">
It seems that canvas is not supported by your browser!
</canvas>
</div>
<!
HX-2014-11: it must be the last one!
<script src="./<API key>.js"></script>
</body>
</html>
|
require 'active_support/inflector'
module Trello
class BasicData
include ActiveModel::Validations
include ActiveModel::Dirty
include ActiveModel::Serializers::JSON
include Trello::JsonUtils
class << self
def path_name
name.split("::").last.underscore
end
def find(id, params = {})
client.find(path_name, id, params)
end
def create(options)
client.create(path_name, options)
end
def save(options)
new(options).tap do |basic_data|
yield basic_data if block_given?
end.save
end
def parse(response)
from_response(response).tap do |basic_data|
yield basic_data if block_given?
end
end
def parse_many(response)
from_response(response).map do |data|
data.tap do |d|
yield d if block_given?
end
end
end
end
def self.register_attributes(*names)
options = { readonly: [] }
options.merge!(names.pop) if names.last.kind_of? Hash
# Defines the attribute getter and setters.
class_eval do
define_method :attributes do
@attributes ||= names.reduce({}) { |hash, k| hash.merge(k.to_sym => nil) }
end
names.each do |key|
define_method(:"#{key}") { @attributes[key] }
unless options[:readonly].include?(key.to_sym)
define_method :"#{key}=" do |val|
send(:"#{key}_will_change!") unless val == @attributes[key]
@attributes[key] = val
end
end
end
<API key> names
end
end
def self.one(name, opts = {})
class_eval do
define_method(:"#{name}") do |*args|
options = opts.dup
klass = options.delete(:via) || Trello.const_get(name.to_s.camelize)
ident = options.delete(:using) || :id
path = options.delete(:path)
if path
client.find(path, self.send(ident))
else
klass.find(self.send(ident))
end
end
end
end
def self.many(name, opts = {})
class_eval do
define_method(:"#{name}") do |*args|
options = opts.dup
resource = options.delete(:in) || self.class.to_s.split("::").last.downcase.pluralize
klass = options.delete(:via) || Trello.const_get(name.to_s.singularize.camelize)
params = options.merge(args[0] || {})
resources = client.find_many(klass, "/#{resource}/#{id}/#{name}", params)
MultiAssociation.new(self, resources).proxy
end
end
end
def self.client
Trello.client
end
register_attributes :id, readonly: [ :id ]
attr_writer :client
def initialize(fields = {})
update_fields(fields)
end
def update_fields(fields)
raise NotImplementedError, "#{self.class} does not implement update_fields."
end
# Refresh the contents of our object.
def refresh!
self.class.find(id)
end
# Two objects are equal if their _id_ methods are equal.
def ==(other)
id == other.id
end
def client
@client ||= self.class.client
end
end
end
|
from panda3d.core import NodePath, DecalEffect
import DNANode
import DNAWall
import random
class DNAFlatBuilding(DNANode.DNANode):
COMPONENT_CODE = 9
currentWallHeight = 0
def __init__(self, name):
DNANode.DNANode.__init__(self, name)
self.width = 0
self.hasDoor = False
def setWidth(self, width):
self.width = width
def getWidth(self):
return self.width
def <API key>(self, currentWallHeight):
DNAFlatBuilding.currentWallHeight = currentWallHeight
def <API key>(self):
return DNAFlatBuilding.currentWallHeight
def setHasDoor(self, hasDoor):
self.hasDoor = hasDoor
def getHasDoor(self):
return self.hasDoor
def makeFromDGI(self, dgi):
DNANode.DNANode.makeFromDGI(self, dgi)
self.width = dgi.getInt16() / 100.0
self.hasDoor = dgi.getBool()
def <API key>(self, nodePath, dnaStorage):
name = self.getName()
if name[:2] != 'tb':
return
name = 'sb' + name[2:]
node = nodePath.attachNewNode(name)
node.setPosHpr(self.getPos(), self.getHpr())
numCodes = dnaStorage.getNumCatalogCodes('suit_wall')
if numCodes < 1:
return
code = dnaStorage.getCatalogCode(
'suit_wall', random.randint(0, numCodes - 1))
wallNode = dnaStorage.findNode(code)
if not wallNode:
return
wallNode = wallNode.copyTo(node, 0)
wallScale = wallNode.getScale()
wallScale.setX(self.width)
wallScale.setZ(DNAFlatBuilding.currentWallHeight)
wallNode.setScale(wallScale)
if self.getHasDoor():
wallNodePath = node.find('wall_*')
doorNode = dnaStorage.findNode('suit_door')
doorNode = doorNode.copyTo(wallNodePath, 0)
doorNode.setScale(NodePath(), (1, 1, 1))
doorNode.setPosHpr(0.5, 0, 0, 0, 0, 0)
wallNodePath.setEffect(DecalEffect.make())
node.flattenMedium()
node.stash()
def <API key>(self, nodePath, dnaStorage):
name = self.getName()
if name[:2] != 'tb':
return
name = 'cb' + name[2:]
node = nodePath.attachNewNode(name)
node.setPosHpr(self.getPos(), self.getHpr())
numCodes = dnaStorage.getNumCatalogCodes('cogdo_wall')
if numCodes < 1:
return
code = dnaStorage.getCatalogCode(
'cogdo_wall', random.randint(0, numCodes - 1))
wallNode = dnaStorage.findNode(code)
if not wallNode:
return
wallNode = wallNode.copyTo(node, 0)
wallScale = wallNode.getScale()
wallScale.setX(self.width)
wallScale.setZ(DNAFlatBuilding.currentWallHeight)
wallNode.setScale(wallScale)
if self.getHasDoor():
wallNodePath = node.find('wall_*')
doorNode = dnaStorage.findNode('suit_door')
doorNode = doorNode.copyTo(wallNodePath, 0)
doorNode.setScale(NodePath(), (1, 1, 1))
doorNode.setPosHpr(0.5, 0, 0, 0, 0, 0)
wallNodePath.setEffect(DecalEffect.make())
node.flattenMedium()
node.stash()
def traverse(self, nodePath, dnaStorage):
DNAFlatBuilding.currentWallHeight = 0
node = nodePath.attachNewNode(self.getName())
internalNode = node.attachNewNode(self.getName() + '-internal')
scale = self.getScale()
scale.setX(self.width)
internalNode.setScale(scale)
node.setPosHpr(self.getPos(), self.getHpr())
for child in self.children:
if isinstance(child, DNAWall.DNAWall):
child.traverse(internalNode, dnaStorage)
else:
child.traverse(node, dnaStorage)
if DNAFlatBuilding.currentWallHeight == 0:
print 'empty flat building with no walls'
else:
cameraBarrier = dnaStorage.findNode('wall_camera_barrier')
if cameraBarrier is None:
raise DNAError.DNAError('DNAFlatBuilding requires that there is a wall_camera_barrier in storage')
cameraBarrier = cameraBarrier.copyTo(internalNode, 0)
cameraBarrier.setScale((1, 1, DNAFlatBuilding.currentWallHeight))
internalNode.flattenStrong()
collisionNode = node.find('**/door_*/+CollisionNode')
if not collisionNode.isEmpty():
collisionNode.setName('<API key>' + dnaStorage.getBlock(self.getName()))
cameraBarrier.wrtReparentTo(nodePath, 0)
wallCollection = internalNode.findAllMatches('wall*')
wallHolder = node.attachNewNode('wall_holder')
wallDecal = node.attachNewNode('wall_decal')
windowCollection = internalNode.findAllMatches('**/window*')
doorCollection = internalNode.findAllMatches('**/door*')
corniceCollection = internalNode.findAllMatches('**/cornice*_d')
wallCollection.reparentTo(wallHolder)
windowCollection.reparentTo(wallDecal)
doorCollection.reparentTo(wallDecal)
corniceCollection.reparentTo(wallDecal)
for i in xrange(wallHolder.getNumChildren()):
iNode = wallHolder.getChild(i)
iNode.clearTag('DNACode')
iNode.clearTag('DNARoot')
wallHolder.flattenStrong()
wallDecal.flattenStrong()
holderChild0 = wallHolder.getChild(0)
wallDecal.getChildren().reparentTo(holderChild0)
holderChild0.reparentTo(internalNode)
holderChild0.setEffect(DecalEffect.make())
wallHolder.removeNode()
wallDecal.removeNode()
self.<API key>(nodePath, dnaStorage)
self.<API key>(nodePath, dnaStorage)
node.flattenStrong()
|
// This file was generated based on 'C:\ProgramData\Uno\Packages\Experimental.Physics\0.18.8\$.uno'.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Uno.Int.h>
namespace g{
namespace Experimental{
namespace Physics{
// private enum <API key>.MoveMode :37
uEnumType* <API key>();
}}} // ::g::Experimental::Physics
|
/* Get Programming with JavaScript
* Listing 4.01
* Displaying an object's properties on the console
*/
var movie1;
movie1 = {
title: "Inside Out",
actors: "Amy Poehler, Bill Hader",
directors: "Pete Doctor, Ronaldo Del Carmen"
};
console.log("Movie information for " + movie1.title);
console.log("
console.log("Actors: " + movie1.actors);
console.log("Directors: " + movie1.directors);
console.log("
/* Further Adventures
*
* 1) Add a second movie and display the same info for it.
*
* 2) Create an object to represent a blog post.
*
* 3) Write code to display info about the blog post.
*
*/
|
describe('Component: Product Search', function(){
var scope,
q,
oc,
state,
_ocParameters,
parameters,
mockProductList
;
beforeEach(module(function($provide) {
$provide.value('Parameters', {searchTerm: null, page: null, pageSize: null, sortBy: null});
}));
beforeEach(module('orderCloud'));
beforeEach(module('orderCloud.sdk'));
beforeEach(inject(function($rootScope, $q, OrderCloud, ocParameters, $state, Parameters){
scope = $rootScope.$new();
q = $q;
oc = OrderCloud;
state = $state;
_ocParameters = ocParameters;
parameters = Parameters;
mockProductList = {
Items:['product1', 'product2'],
Meta:{
ItemRange:[1, 3],
TotalCount: 50
}
};
}));
describe('State: <API key>', function(){
var state;
beforeEach(inject(function($state){
state = $state.get('<API key>');
spyOn(_ocParameters, 'Get');
spyOn(oc.Me, 'ListProducts');
}));
it('should resolve Parameters', inject(function($injector){
$injector.invoke(state.resolve.Parameters);
expect(_ocParameters.Get).toHaveBeenCalled();
}));
it('should resolve ProductList', inject(function($injector){
parameters.filters = {ParentID:'12'};
$injector.invoke(state.resolve.ProductList);
expect(oc.Me.ListProducts).toHaveBeenCalled();
}));
});
describe('Controller: <API key>', function(){
var productSearchCtrl;
beforeEach(inject(function($state, $controller){
var state = $state;
productSearchCtrl = $controller('ProductSearchCtrl', {
$state: state,
ocParameters: _ocParameters,
$scope: scope,
ProductList: mockProductList
});
spyOn(_ocParameters, 'Create');
spyOn(state, 'go');
}));
describe('filter', function(){
it('should reload state and call ocParameters.Create with any parameters', function(){
productSearchCtrl.parameters = {pageSize: 1};
productSearchCtrl.filter(true);
expect(state.go).toHaveBeenCalled();
expect(_ocParameters.Create).<API key>({pageSize:1}, true);
});
});
describe('updateSort', function(){
it('should reload page with value and sort order, if both are defined', function(){
productSearchCtrl.updateSort('!ID');
expect(state.go).toHaveBeenCalled();
expect(_ocParameters.Create).<API key>({searchTerm: null, page: null, pageSize: null, sortBy: '!ID'}, false);
});
it('should reload page with just value, if no order is defined', function(){
productSearchCtrl.updateSort('ID');
expect(state.go).toHaveBeenCalled();
expect(_ocParameters.Create).<API key>({searchTerm: null, page: null, pageSize: null, sortBy: 'ID'}, false);
});
});
describe('updatePageSize', function(){
it('should reload state with the new pageSize', function(){
productSearchCtrl.updatePageSize('25');
expect(state.go).toHaveBeenCalled();
expect(_ocParameters.Create).<API key>({searchTerm: null, page: null, pageSize: '25', sortBy: null}, true);
});
});
describe('pageChanged', function(){
it('should reload state with the new page', function(){
productSearchCtrl.pageChanged('newPage');
expect(state.go).toHaveBeenCalled();
expect(_ocParameters.Create).<API key>({searchTerm: null, page: 'newPage', pageSize: null, sortBy: null}, false);
});
});
describe('reverseSort', function(){
it('should reload state with a reverse sort call', function(){
productSearchCtrl.parameters.sortBy = 'ID';
productSearchCtrl.reverseSort();
expect(_ocParameters.Create).<API key>({searchTerm: null, page: null, pageSize: null, sortBy: '!ID'}, false);
});
});
});
describe('Component Directive: <API key>', function(){
var <API key>,
timeout
;
beforeEach(inject(function($componentController, $timeout){
timeout = $timeout;
<API key> = $componentController('<API key>', {
$state:state,
$timeout: timeout,
$scope: scope,
OrderCloud:oc
});
spyOn(state, 'go');
}));
describe('getSearchResults', function(){
beforeEach(function(){
var defer = q.defer();
defer.resolve();
spyOn(oc.Me, 'ListProducts').and.returnValue(defer.promise);
});
it('should call Me.ListProducts with given search term and max products', function(){
<API key>.searchTerm = 'Product1';
<API key>.maxProducts = 12;
<API key>.getSearchResults();
expect(oc.Me.ListProducts).<API key>('Product1', 1, 12);
});
it('should default max products to five, if none is provided', function(){
<API key>.searchTerm = 'Product1';
<API key>.getSearchResults();
expect(oc.Me.ListProducts).<API key>('Product1', 1, 5);
});
});
describe('onSelect', function(){
it('should route user to productDetail state for the selected product id', function(){
<API key>.onSelect(12);
expect(state.go).<API key>('productDetail', {productid:12});
});
});
describe('onHardEnter', function(){
it('should route user to search results page for the provided search term', function(){
<API key>.onHardEnter('bikes');
expect(state.go).<API key>('<API key>', {searchTerm: 'bikes'});
});
});
});
});
|
(function () {
'use strict';
angular.module('common')
.directive('svLumxUsersDropdown', function () {
return {
templateUrl: 'scripts/common/directives/<API key>.html',
scope: {
btnTitle: '@',
actionCounter: '@',
userAvatar: '@',
userName: '@',
userFirstName: '@',
userLastName: '@',
iconType: '@',
iconName: '@'
},
link: function ($scope, el, attrs) {
}
};
});
})();
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using FluentAssertions;
using Microsoft.OData.Edm;
using Microsoft.OData.Edm.Csdl;
using Microsoft.OData.Edm.Library;
using Microsoft.OData.Edm.Library.Values;
using Microsoft.OData.Edm.Validation;
using Microsoft.OData.Edm.Values;
using Xunit;
using Vipr.Reader.OData.v4;
using Vipr.Core.CodeModel;
using Vipr.Core.CodeModel.Vocabularies.Capabilities;
namespace ODataReader.v4UnitTests
{
public class <API key>
{
public <API key>()
{
}
[Xunit.Fact]
public void <API key>()
{
Func<object, IEdmValue> <API key> = o => new EdmBooleanConstant((bool) o);
<API key>(true, <API key>);
<API key>(false, <API key>);
}
[Fact]
public void <API key>()
{
Func<object, IEdmValue> stringPredicate = o => new EdmStringConstant((string) o);
<API key>(" unicode test string ", stringPredicate);
}
[Fact]
public void <API key>()
{
Func<object, IEdmValue> <API key> = o => new EdmGuidConstant((Guid) o);
<API key>(Guid.NewGuid(), <API key>);
}
[Fact]
public void <API key>()
{
Func<object, IEdmValue> <API key> = o => new EdmBinaryConstant((byte[]) o);
<API key>(new byte[] {1, 3, 3, 7}, <API key>);
}
[Fact]
public void <API key>()
{
Func<object, IEdmValue> <API key> = o => new EdmDateConstant((Date) o);
<API key>(Date.Now, <API key>);
}
[Fact]
public void <API key>()
{
Func<object, IEdmValue> <API key> =
o => new <API key>((DateTimeOffset) o);
<API key>(DateTimeOffset.Now, <API key>);
<API key>(DateTimeOffset.UtcNow, <API key>);
}
[Fact]
public void <API key>()
{
Func<object, IEdmValue> <API key> = o => new EdmDecimalConstant((decimal) o);
<API key>((decimal) 1.234, <API key>);
}
[Fact]
public void <API key>()
{
Func<object, IEdmValue> <API key> = o => new EdmFloatingConstant((double) o);
<API key>(1.234d, <API key>);
}
[Fact]
public void <API key>()
{
Func<object, IEdmValue> <API key> = o => new EdmIntegerConstant((long) o);
<API key>(123400L, <API key>);
}
[Fact]
public void <API key>()
{
Func<object, IEdmValue> <API key> = o => new EdmDurationConstant((TimeSpan) o);
<API key>(new TimeSpan(1, 2, 3, 4), <API key>);
}
[Fact]
public void <API key>()
{
Func<object, IEdmValue> <API key> = o => new <API key>((TimeOfDay) o);
<API key>(TimeOfDay.Now, <API key>);
}
private void <API key>(object originalValue, Func<object, IEdmValue> valuePredicate)
{
// Map our original value to an IEdmValue with the supplied predicate
var iEdmValue = valuePredicate(originalValue);
var result = <API key>.MapToClr(iEdmValue);
result.Should()
.Be(originalValue, "because a given clr value should roundtrip through its appropriate edm value ");
}
[Fact]
public void <API key>()
{
var annotations = <API key>("sections");
annotations.Should().HaveCount(4, "because sections have four annotations");
annotations.Should().Contain(x => x.Name == "InsertRestrictions");
var insertRestrictions = annotations.First(x => x.Name == "InsertRestrictions");
insertRestrictions.Namespace.Should().Be("Org.OData.Capabilities.V1");
insertRestrictions.Value.Should().BeOfType<<API key>>();
var insertValue = insertRestrictions.Value as <API key>;
insertValue.Insertable.Should().BeFalse();
insertValue.<API key>.Should().HaveCount(2);
insertValue.<API key>.Should().Contain("parentNotebook");
insertValue.<API key>.Should().Contain("parentSectionGroup");
}
[Fact]
public void <API key>()
{
var annotations = <API key>("sections");
annotations.Should().Contain(x => x.Name == "UpdateRestrictions");
var update = annotations.First(x => x.Name == "UpdateRestrictions");
update.Namespace.Should().Be("Org.OData.Capabilities.V1");
update.Value.Should().BeOfType<<API key>>();
var updateValue = update.Value as <API key>;
updateValue.Updatable.Should().BeFalse();
updateValue.<API key>.Should().HaveCount(3);
updateValue.<API key>.Should().Contain("pages");
updateValue.<API key>.Should().Contain("parentNotebook");
updateValue.<API key>.Should().Contain("parentSectionGroup");
}
[Fact]
public void <API key>()
{
var annotations = <API key>("sections");
annotations.Should().Contain(x => x.Name == "DeleteRestrictions");
var delete = annotations.First(x => x.Name == "DeleteRestrictions");
delete.Namespace.Should().Be("Org.OData.Capabilities.V1");
delete.Value.Should().BeOfType<<API key>>();
var deleteValue = delete.Value as <API key>;
deleteValue.Deletable.Should().BeFalse();
deleteValue.<API key>.Should().HaveCount(3);
deleteValue.<API key>.Should().Contain("pages");
deleteValue.<API key>.Should().Contain("parentNotebook");
deleteValue.<API key>.Should().Contain("parentSectionGroup");
}
[Fact]
public void <API key>()
{
var annotations = <API key>();
annotations.Should().HaveCount(3);
annotations.Should().Contain(x => x.Name == "BatchSupported");
annotations.Should().Contain(x => x.Name == "<API key>");
annotations.Should().Contain(x => x.Name == "<API key>");
// In this case, all of the value and namespaces for these annotaion are the same
// We'll loop over them for brevity.
foreach (var annotation in annotations)
{
annotation.Namespace.Should().Be("Org.OData.Capabilities.V1");
annotation.Value.Should().BeOfType<bool>();
((bool) annotation.Value).Should().BeFalse();
}
}
private List<<API key>> <API key>(string entitySet)
{
IEdmModel model = <API key>;
IEdmEntitySet sampleEntitySet = model.FindEntityContainer("OneNoteApi").FindEntitySet(entitySet);
return <API key>.GetOdcmAnnotations(model, sampleEntitySet).ToList();
}
private List<<API key>> <API key>()
{
IEdmModel model = <API key>;
var sampleContainer = model.FindEntityContainer("OneNoteApi");
return <API key>.GetOdcmAnnotations(model, sampleContainer).ToList();
}
#region Helper methods
private static readonly IEdmModel <API key> = <API key>();
private static IEdmModel <API key>()
{
IEdmModel edmModel;
IEnumerable<EdmError> errors;
if (!EdmxReader.TryParse(XmlReader.Create(new StringReader(ODataReader.v4UnitTests.Properties.Resources.OneNoteExampleEdmx)), out edmModel, out errors))
{
throw new <API key>("Failed to parse Edm model");
}
return edmModel;
}
}
#endregion
}
|
#ifndef <API key>
#ifndef <API key>
#define <API key>
namespace j2cpp { namespace android { namespace os { class Bundle; } } }
namespace j2cpp { namespace java { namespace lang { class String; } } }
namespace j2cpp { namespace java { namespace lang { class Object; } } }
namespace j2cpp { namespace com { namespace tencent { namespace mm { namespace sdk { namespace openapi { class BaseReq; } } } } } }
namespace j2cpp { namespace com { namespace tencent { namespace mm { namespace sdk { namespace openapi { class BaseResp; } } } } } }
#include <android/os/Bundle.hpp>
#include <com/tencent/mm/sdk/openapi/BaseReq.hpp>
#include <com/tencent/mm/sdk/openapi/BaseResp.hpp>
#include <java/lang/Object.hpp>
#include <java/lang/String.hpp>
namespace j2cpp {
namespace com { namespace tencent { namespace mm { namespace sdk { namespace openapi {
class SendAuth;
namespace SendAuth_ {
class Req;
class Req
: public object<Req>
{
public:
J2CPP_DECLARE_CLASS
<API key>(0)
<API key>(1)
<API key>(2)
<API key>(3)
<API key>(4)
<API key>(5)
J2CPP_DECLARE_FIELD(0)
J2CPP_DECLARE_FIELD(1)
explicit Req(jobject jobj)
: object<Req>(jobj)
, scope(jobj)
, state(jobj)
{
}
operator local_ref<java::lang::Object>() const;
operator local_ref<com::tencent::mm::sdk::openapi::BaseReq>() const;
Req();
Req(local_ref< android::os::Bundle > const&);
jint getType();
void fromBundle(local_ref< android::os::Bundle > const&);
void toBundle(local_ref< android::os::Bundle > const&);
field< J2CPP_CLASS_NAME, J2CPP_FIELD_NAME(0), <API key>(0), local_ref< java::lang::String > > scope;
field< J2CPP_CLASS_NAME, J2CPP_FIELD_NAME(1), <API key>(1), local_ref< java::lang::String > > state;
}; //class Req
class Resp;
class Resp
: public object<Resp>
{
public:
J2CPP_DECLARE_CLASS
<API key>(0)
<API key>(1)
<API key>(2)
<API key>(3)
<API key>(4)
<API key>(5)
J2CPP_DECLARE_FIELD(0)
J2CPP_DECLARE_FIELD(1)
J2CPP_DECLARE_FIELD(2)
J2CPP_DECLARE_FIELD(3)
J2CPP_DECLARE_FIELD(4)
explicit Resp(jobject jobj)
: object<Resp>(jobj)
, userName(jobj)
, token(jobj)
, expireDate(jobj)
, state(jobj)
, resultUrl(jobj)
{
}
operator local_ref<java::lang::Object>() const;
operator local_ref<com::tencent::mm::sdk::openapi::BaseResp>() const;
Resp();
Resp(local_ref< android::os::Bundle > const&);
jint getType();
void fromBundle(local_ref< android::os::Bundle > const&);
void toBundle(local_ref< android::os::Bundle > const&);
field< J2CPP_CLASS_NAME, J2CPP_FIELD_NAME(0), <API key>(0), local_ref< java::lang::String > > userName;
field< J2CPP_CLASS_NAME, J2CPP_FIELD_NAME(1), <API key>(1), local_ref< java::lang::String > > token;
field< J2CPP_CLASS_NAME, J2CPP_FIELD_NAME(2), <API key>(2), jint > expireDate;
field< J2CPP_CLASS_NAME, J2CPP_FIELD_NAME(3), <API key>(3), local_ref< java::lang::String > > state;
field< J2CPP_CLASS_NAME, J2CPP_FIELD_NAME(4), <API key>(4), local_ref< java::lang::String > > resultUrl;
}; //class Resp
} //namespace SendAuth_
class SendAuth
: public object<SendAuth>
{
public:
J2CPP_DECLARE_CLASS
<API key>(0)
typedef SendAuth_::Req Req;
typedef SendAuth_::Resp Resp;
explicit SendAuth(jobject jobj)
: object<SendAuth>(jobj)
{
}
operator local_ref<java::lang::Object>() const;
}; //class SendAuth
} //namespace openapi
} //namespace sdk
} //namespace mm
} //namespace tencent
} //namespace com
} //namespace j2cpp
#endif //<API key>
#else //<API key>
#ifndef <API key>
#define <API key>
namespace j2cpp {
com::tencent::mm::sdk::openapi::SendAuth_::Req::operator local_ref<java::lang::Object>() const
{
return local_ref<java::lang::Object>(get_jobject());
}
com::tencent::mm::sdk::openapi::SendAuth_::Req::operator local_ref<com::tencent::mm::sdk::openapi::BaseReq>() const
{
return local_ref<com::tencent::mm::sdk::openapi::BaseReq>(get_jobject());
}
com::tencent::mm::sdk::openapi::SendAuth_::Req::Req()
: object<com::tencent::mm::sdk::openapi::SendAuth_::Req>(
call_new_object<
com::tencent::mm::sdk::openapi::SendAuth_::Req::J2CPP_CLASS_NAME,
com::tencent::mm::sdk::openapi::SendAuth_::Req::J2CPP_METHOD_NAME(0),
com::tencent::mm::sdk::openapi::SendAuth_::Req::<API key>(0)
>()
)
, scope(get_jobject())
, state(get_jobject())
{
}
com::tencent::mm::sdk::openapi::SendAuth_::Req::Req(local_ref< android::os::Bundle > const &a0)
: object<com::tencent::mm::sdk::openapi::SendAuth_::Req>(
call_new_object<
com::tencent::mm::sdk::openapi::SendAuth_::Req::J2CPP_CLASS_NAME,
com::tencent::mm::sdk::openapi::SendAuth_::Req::J2CPP_METHOD_NAME(1),
com::tencent::mm::sdk::openapi::SendAuth_::Req::<API key>(1)
>(a0)
)
, scope(get_jobject())
, state(get_jobject())
{
}
jint com::tencent::mm::sdk::openapi::SendAuth_::Req::getType()
{
return call_method<
com::tencent::mm::sdk::openapi::SendAuth_::Req::J2CPP_CLASS_NAME,
com::tencent::mm::sdk::openapi::SendAuth_::Req::J2CPP_METHOD_NAME(2),
com::tencent::mm::sdk::openapi::SendAuth_::Req::<API key>(2),
jint
>(get_jobject());
}
void com::tencent::mm::sdk::openapi::SendAuth_::Req::fromBundle(local_ref< android::os::Bundle > const &a0)
{
return call_method<
com::tencent::mm::sdk::openapi::SendAuth_::Req::J2CPP_CLASS_NAME,
com::tencent::mm::sdk::openapi::SendAuth_::Req::J2CPP_METHOD_NAME(3),
com::tencent::mm::sdk::openapi::SendAuth_::Req::<API key>(3),
void
>(get_jobject(), a0);
}
void com::tencent::mm::sdk::openapi::SendAuth_::Req::toBundle(local_ref< android::os::Bundle > const &a0)
{
return call_method<
com::tencent::mm::sdk::openapi::SendAuth_::Req::J2CPP_CLASS_NAME,
com::tencent::mm::sdk::openapi::SendAuth_::Req::J2CPP_METHOD_NAME(4),
com::tencent::mm::sdk::openapi::SendAuth_::Req::<API key>(4),
void
>(get_jobject(), a0);
}
J2CPP_DEFINE_CLASS(com::tencent::mm::sdk::openapi::SendAuth_::Req,"com/tencent/mm/sdk/openapi/SendAuth$Req")
J2CPP_DEFINE_METHOD(com::tencent::mm::sdk::openapi::SendAuth_::Req,0,"<init>","()V")
J2CPP_DEFINE_METHOD(com::tencent::mm::sdk::openapi::SendAuth_::Req,1,"<init>","(Landroid/os/Bundle;)V")
J2CPP_DEFINE_METHOD(com::tencent::mm::sdk::openapi::SendAuth_::Req,2,"getType","()I")
J2CPP_DEFINE_METHOD(com::tencent::mm::sdk::openapi::SendAuth_::Req,3,"fromBundle","(Landroid/os/Bundle;)V")
J2CPP_DEFINE_METHOD(com::tencent::mm::sdk::openapi::SendAuth_::Req,4,"toBundle","(Landroid/os/Bundle;)V")
J2CPP_DEFINE_METHOD(com::tencent::mm::sdk::openapi::SendAuth_::Req,5,"checkArgs","()Z")
J2CPP_DEFINE_FIELD(com::tencent::mm::sdk::openapi::SendAuth_::Req,0,"scope","Ljava/lang/String;")
J2CPP_DEFINE_FIELD(com::tencent::mm::sdk::openapi::SendAuth_::Req,1,"state","Ljava/lang/String;")
com::tencent::mm::sdk::openapi::SendAuth_::Resp::operator local_ref<java::lang::Object>() const
{
return local_ref<java::lang::Object>(get_jobject());
}
com::tencent::mm::sdk::openapi::SendAuth_::Resp::operator local_ref<com::tencent::mm::sdk::openapi::BaseResp>() const
{
return local_ref<com::tencent::mm::sdk::openapi::BaseResp>(get_jobject());
}
com::tencent::mm::sdk::openapi::SendAuth_::Resp::Resp()
: object<com::tencent::mm::sdk::openapi::SendAuth_::Resp>(
call_new_object<
com::tencent::mm::sdk::openapi::SendAuth_::Resp::J2CPP_CLASS_NAME,
com::tencent::mm::sdk::openapi::SendAuth_::Resp::J2CPP_METHOD_NAME(0),
com::tencent::mm::sdk::openapi::SendAuth_::Resp::<API key>(0)
>()
)
, userName(get_jobject())
, token(get_jobject())
, expireDate(get_jobject())
, state(get_jobject())
, resultUrl(get_jobject())
{
}
com::tencent::mm::sdk::openapi::SendAuth_::Resp::Resp(local_ref< android::os::Bundle > const &a0)
: object<com::tencent::mm::sdk::openapi::SendAuth_::Resp>(
call_new_object<
com::tencent::mm::sdk::openapi::SendAuth_::Resp::J2CPP_CLASS_NAME,
com::tencent::mm::sdk::openapi::SendAuth_::Resp::J2CPP_METHOD_NAME(1),
com::tencent::mm::sdk::openapi::SendAuth_::Resp::<API key>(1)
>(a0)
)
, userName(get_jobject())
, token(get_jobject())
, expireDate(get_jobject())
, state(get_jobject())
, resultUrl(get_jobject())
{
}
jint com::tencent::mm::sdk::openapi::SendAuth_::Resp::getType()
{
return call_method<
com::tencent::mm::sdk::openapi::SendAuth_::Resp::J2CPP_CLASS_NAME,
com::tencent::mm::sdk::openapi::SendAuth_::Resp::J2CPP_METHOD_NAME(2),
com::tencent::mm::sdk::openapi::SendAuth_::Resp::<API key>(2),
jint
>(get_jobject());
}
void com::tencent::mm::sdk::openapi::SendAuth_::Resp::fromBundle(local_ref< android::os::Bundle > const &a0)
{
return call_method<
com::tencent::mm::sdk::openapi::SendAuth_::Resp::J2CPP_CLASS_NAME,
com::tencent::mm::sdk::openapi::SendAuth_::Resp::J2CPP_METHOD_NAME(3),
com::tencent::mm::sdk::openapi::SendAuth_::Resp::<API key>(3),
void
>(get_jobject(), a0);
}
void com::tencent::mm::sdk::openapi::SendAuth_::Resp::toBundle(local_ref< android::os::Bundle > const &a0)
{
return call_method<
com::tencent::mm::sdk::openapi::SendAuth_::Resp::J2CPP_CLASS_NAME,
com::tencent::mm::sdk::openapi::SendAuth_::Resp::J2CPP_METHOD_NAME(4),
com::tencent::mm::sdk::openapi::SendAuth_::Resp::<API key>(4),
void
>(get_jobject(), a0);
}
J2CPP_DEFINE_CLASS(com::tencent::mm::sdk::openapi::SendAuth_::Resp,"com/tencent/mm/sdk/openapi/SendAuth$Resp")
J2CPP_DEFINE_METHOD(com::tencent::mm::sdk::openapi::SendAuth_::Resp,0,"<init>","()V")
J2CPP_DEFINE_METHOD(com::tencent::mm::sdk::openapi::SendAuth_::Resp,1,"<init>","(Landroid/os/Bundle;)V")
J2CPP_DEFINE_METHOD(com::tencent::mm::sdk::openapi::SendAuth_::Resp,2,"getType","()I")
J2CPP_DEFINE_METHOD(com::tencent::mm::sdk::openapi::SendAuth_::Resp,3,"fromBundle","(Landroid/os/Bundle;)V")
J2CPP_DEFINE_METHOD(com::tencent::mm::sdk::openapi::SendAuth_::Resp,4,"toBundle","(Landroid/os/Bundle;)V")
J2CPP_DEFINE_METHOD(com::tencent::mm::sdk::openapi::SendAuth_::Resp,5,"checkArgs","()Z")
J2CPP_DEFINE_FIELD(com::tencent::mm::sdk::openapi::SendAuth_::Resp,0,"userName","Ljava/lang/String;")
J2CPP_DEFINE_FIELD(com::tencent::mm::sdk::openapi::SendAuth_::Resp,1,"token","Ljava/lang/String;")
J2CPP_DEFINE_FIELD(com::tencent::mm::sdk::openapi::SendAuth_::Resp,2,"expireDate","I")
J2CPP_DEFINE_FIELD(com::tencent::mm::sdk::openapi::SendAuth_::Resp,3,"state","Ljava/lang/String;")
J2CPP_DEFINE_FIELD(com::tencent::mm::sdk::openapi::SendAuth_::Resp,4,"resultUrl","Ljava/lang/String;")
com::tencent::mm::sdk::openapi::SendAuth::operator local_ref<java::lang::Object>() const
{
return local_ref<java::lang::Object>(get_jobject());
}
J2CPP_DEFINE_CLASS(com::tencent::mm::sdk::openapi::SendAuth,"com/tencent/mm/sdk/openapi/SendAuth")
J2CPP_DEFINE_METHOD(com::tencent::mm::sdk::openapi::SendAuth,0,"<init>","()V")
} //namespace j2cpp
#endif //<API key>
#endif //<API key>
|
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
namespace BrightstarDB.Polaris {
using System;
<summary>
A strongly-typed resource class, for looking up localized strings, etc.
</summary>
// This class was auto-generated by the <API key>
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.<API key>("System.Resources.Tools.<API key>", "4.0.0.0")]
[global::System.Diagnostics.<API key>()]
[global::System.Runtime.CompilerServices.<API key>()]
internal class Strings {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.<API key>("Microsoft.Performance", "CA1811:<API key>")]
internal Strings() {
}
<summary>
Returns the cached ResourceManager instance used by this class.
</summary>
[global::System.ComponentModel.<API key>(global::System.ComponentModel.<API key>.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BrightstarDB.Polaris.Strings", typeof(Strings).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
<summary>
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
</summary>
[global::System.ComponentModel.<API key>(global::System.ComponentModel.<API key>.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
<summary>
Looks up a localized string similar to Polaris Management Tool for BrightstarDB.
</summary>
internal static string AboutHeading {
get {
return ResourceManager.GetString("AboutHeading", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Release: {0}, Build: {1}
Copyright (c) 2013 Khalil Ahmed, Graham Moore.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
[rest of string was truncated]";.
</summary>
internal static string AboutInfo {
get {
return ResourceManager.GetString("AboutInfo", resourceCulture);
}
}
<summary>
Looks up a localized string similar to This application makes use of the following open-source components:
dotNetRDF (http:
Copyright (c) 2011 Rob Vesse
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Softwa [rest of string was truncated]";.
</summary>
internal static string Acknowledgements {
get {
return ResourceManager.GetString("Acknowledgements", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Are you sure you want to delete the store '{0}' from the server ?
This operation cannot be undone!.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Delete Store ?.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Select the root folder for the Brightstar service. This folder will contain a subfolder for each store created within the service..
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Are you sure you want to permanently remove the server connection '{0}' from the server list ?.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Remove Server from Server List ?.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to The export of data from store '{0}' has completed successfully. The data can be found on the BrightstarDB server under the import directory..
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Export Completed.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to The export of data from store '{0}' failed. Check the export tab for details..
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Export Failed.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to {0} Export.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to An unexpected error prevented the export job from running..
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to NTriples (*.nt)|*.nt;*.nt.gz|NQuads (*.nq)|*.nq;*.nq.gz|RDF/XML (*.rdf)|*.rdf;*.rdf.gz|RDF/JSON (*.rj;*.json)|*.rj;*.json;*.rj.gz;*.json.gz|Notation3 (*.n3)|*.n3;*.n3.gz|Turtle (*.ttl)|*.ttl;*.ttl.gz|All Files(*.*)|*.*.
</summary>
internal static string FileSelectorOptions {
get {
return ResourceManager.GetString("FileSelectorOptions", resourceCulture);
}
}
<summary>
Looks up a localized string similar to {0} History.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to The import of data into store '{0}' has completed successfully..
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Import Completed.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to The import of data into store '{0}' failed. Check the import tab for details..
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Import Failed.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Cannot find import file '{0}'..
</summary>
internal static string ImportFileNotFound {
get {
return ResourceManager.GetString("ImportFileNotFound", resourceCulture);
}
}
<summary>
Looks up a localized string similar to The file '{0}' is quite large (over 50MB).
A local import may require a large amount of memory on this machine as well as a fast network connection to the server.
If possible consider copying the file to the BrightstarDB server's import folder and using a Remote import job instead.
Are you sure you want to attempt to import this file with a Local import job ?.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to File Size Warning.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to The import file is too large to be processed in memory on the client. Please copy this file to the server and use a Remote import instead..
</summary>
internal static string ImportFileTooLarge {
get {
return ResourceManager.GetString("ImportFileTooLarge", resourceCulture);
}
}
<summary>
Looks up a localized string similar to An older Polaris configuration file has been found. Do you want to import this existing configuration ? If you choose No, a new empty configuration will be created for you..
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Import Old Configuration.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to {0} Import.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to An unexpected error prevented the import job from running..
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to A Connection specifies how Polaris should connect to a BrightstarDB store. This may be either a direct connection to the directory or (recommended) a connection to a BrightstarDB server.
You currently have no connections defined. Would you like to create a new connection now ?.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to No Connections Defined.
</summary>
internal static string NoConnectionsTitle {
get {
return ResourceManager.GetString("NoConnectionsTitle", resourceCulture);
}
}
<summary>
Looks up a localized string similar to An error occurred when parsing the content of the file {0}. Cause: {1}.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Error Parsing RDF File.
</summary>
internal static string ParseErrorTitle {
get {
return ResourceManager.GetString("ParseErrorTitle", resourceCulture);
}
}
<summary>
Looks up a localized string similar to New Query.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to {0} Statistics.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Failed to create new store. {0}.
</summary>
internal static string StoreCreateFailed {
get {
return ResourceManager.GetString("StoreCreateFailed", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Store Creation Failed.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
<summary>
Looks up a localized string similar to Transaction failed..
</summary>
internal static string TransactionFailed {
get {
return ResourceManager.GetString("TransactionFailed", resourceCulture);
}
}
<summary>
Looks up a localized string similar to The transaction completed successfully..
</summary>
internal static string TransactionSuccess {
get {
return ResourceManager.GetString("TransactionSuccess", resourceCulture);
}
}
<summary>
Looks up a localized string similar to New Transaction.
</summary>
internal static string <API key> {
get {
return ResourceManager.GetString("<API key>", resourceCulture);
}
}
}
}
|
# -*- coding: utf-8 -*-
"""
Various i18n functions.
Helper functions for both the internal translation system
and for TranslateWiki-based translations.
By default messages are assumed to reside in a package called
'scripts.i18n'. In pywikibot 2.0, that package is not packaged
with pywikibot, and pywikibot 2.0 does not have a hard dependency
on any i18n messages. However, there are three user input questions
in pagegenerators which will use i18 messages if they can be loaded.
The default message location may be changed by calling
L{set_message_package} with a package name. The package must contain
an __init__.py, and a message bundle called 'pywikibot' containing
messages. See L{twntranslate} for more information on the messages.
"""
from __future__ import unicode_literals
__version__ = '$Id$'
import sys
import re
import locale
import json
import os
import pkgutil
from collections import defaultdict
from pywikibot import Error
from .plural import plural_rules
import pywikibot
from . import config2 as config
if sys.version_info[0] > 2:
basestring = (str, )
PLURAL_PATTERN = r'{{PLURAL:(?:%\()?([^\)]*?)(?:\)d)?\|(.*?)}}'
# Package name for the translation messages. The messages data must loaded
# relative to that package name. In the top of this package should be
# directories named after for each script/message bundle, and each directory
# should contain JSON files called <lang>.json
<API key> = 'scripts.i18n'
# Flag to indicate whether translation messages are available
_messages_available = None
# Cache of translated messages
_cache = defaultdict(dict)
def <API key>(package_name):
"""Set the package name where i18n messages are located."""
global <API key>
global _messages_available
<API key> = package_name
_messages_available = None
def messages_available():
"""
Return False if there are no i18n messages available.
To determine if messages are available, it looks for the package name
set using L{<API key>} for a message bundle called 'pywikibot'
containing messages.
@rtype: bool
"""
global _messages_available
if _messages_available is not None:
return _messages_available
try:
__import__(<API key>)
except ImportError:
_messages_available = False
return False
_messages_available = True
return True
def _altlang(code):
"""Define fallback languages for particular languages.
If no translation is available to a specified language, translate() will
try each of the specified fallback languages, in order, until it finds
one with a translation, with 'en' and '_default' as a last resort.
For example, if for language 'xx', you want the preference of languages
to be: xx > fr > ru > en, you let this method return ['fr', 'ru'].
This code is used by other translating methods below.
@param code: The language code
@type code: string
@return: language codes
@rtype: list of str
"""
# Akan
if code in ['ak', 'tw']:
return ['ak', 'tw']
# Amharic
if code in ['aa', 'ti']:
return ['am']
# Arab
if code in ['arc', 'arz', 'so']:
return ['ar']
if code == 'kab':
return ['ar', 'fr']
# Bulgarian
if code in ['cu', 'mk']:
return ['bg', 'sr', 'sh']
# Czech
if code in ['cs', 'sk']:
return ['cs', 'sk']
# German
if code in ['bar', 'frr', 'ksh', 'pdc', 'pfl']:
return ['de']
if code == 'lb':
return ['de', 'fr']
if code in ['als', 'gsw']:
return ['als', 'gsw', 'de']
if code == 'nds':
return ['nds-nl', 'de']
if code in ['dsb', 'hsb']:
return ['hsb', 'dsb', 'de']
if code == 'sli':
return ['de', 'pl']
if code == 'rm':
return ['de', 'it']
if code == 'stq':
return ['nds', 'de']
# Greek
if code in ['grc', 'pnt']:
return ['el']
# Esperanto
if code in ['io', 'nov']:
return ['eo']
# Spanish
if code in ['an', 'arn', 'ast', 'ay', 'ca', 'ext', 'lad', 'nah', 'nv', 'qu',
'yua']:
return ['es']
if code in ['gl', 'gn']:
return ['es', 'pt']
if code == 'eu':
return ['es', 'fr']
if code == 'cbk-zam':
return ['es', 'tl']
# Estonian
if code in ['fiu-vro', 'vro']:
return ['fiu-vro', 'vro', 'et']
if code == 'liv':
return ['et', 'lv']
# Persian (Farsi)
if code == 'ps':
return ['fa']
if code in ['glk', 'mzn']:
return ['glk', 'mzn', 'fa', 'ar']
# Finnish
if code == 'vep':
return ['fi', 'ru']
if code == 'fit':
return ['fi', 'sv']
# French
if code in ['bm', 'br', 'ht', 'kg', 'ln', 'mg', 'nrm', 'pcd',
'rw', 'sg', 'ty', 'wa']:
return ['fr']
if code == 'oc':
return ['fr', 'ca', 'es']
if code in ['co', 'frp']:
return ['fr', 'it']
# Hindi
if code in ['sa']:
return ['hi']
if code in ['ne', 'new']:
return ['ne', 'new', 'hi']
if code in ['bh', 'bho']:
return ['bh', 'bho']
# Indonesian and Malay
if code in ['ace', 'bug', 'bjn', 'id', 'jv', 'ms', 'su']:
return ['id', 'ms', 'jv']
if code == 'map-bms':
return ['jv', 'id', 'ms']
# Inuit languages
if code in ['ik', 'iu']:
return ['iu', 'kl']
if code == 'kl':
return ['da', 'iu', 'no', 'nb']
# Italian
if code in ['eml', 'fur', 'lij', 'lmo', 'nap', 'pms', 'roa-tara', 'sc',
'scn', 'vec']:
return ['it']
# Lithuanian
if code in ['bat-smg', 'sgs']:
return ['bat-smg', 'sgs', 'lt']
# Latvian
if code == 'ltg':
return ['lv']
# Dutch
if code in ['af', 'fy', 'li', 'pap', 'srn', 'vls', 'zea']:
return ['nl']
if code == ['nds-nl']:
return ['nds', 'nl']
# Polish
if code in ['csb', 'szl']:
return ['pl']
# Portuguese
if code in ['fab', 'mwl', 'tet']:
return ['pt']
# Romanian
if code in ['roa-rup', 'rup']:
return ['roa-rup', 'rup', 'ro']
if code == 'mo':
return ['ro']
# Russian and Belarusian
if code in ['ab', 'av', 'ba', 'bxr', 'ce', 'cv', 'inh', 'kk', 'koi', 'krc',
'kv', 'ky', 'lbe', 'lez', 'mdf', 'mhr', 'mn', 'mrj', 'myv',
'os', 'sah', 'tg', 'udm', 'uk', 'xal']:
return ['ru']
if code in ['kbd', 'ady']:
return ['kbd', 'ady', 'ru']
if code == 'tt':
return ['tt-cyrl', 'ru']
if code in ['be', 'be-x-old', 'be-tarask']:
return ['be', 'be-x-old', 'be-tarask', 'ru']
if code == 'kaa':
return ['uz', 'ru']
# Serbocroatian
if code in ['bs', 'hr', 'sh']:
return ['sh', 'hr', 'bs', 'sr', 'sr-el']
if code == 'sr':
return ['sr-el', 'sh', 'hr', 'bs']
# Tagalog
if code in ['bcl', 'ceb', 'ilo', 'pag', 'pam', 'war']:
return ['tl']
# Turkish and Kurdish
if code in ['diq', 'ku']:
return ['ku', 'ku-latn', 'tr']
if code == 'gag':
return ['tr']
if code == 'ckb':
return ['ku']
# Ukrainian
if code in ['crh', 'crh-latn']:
return ['crh', 'crh-latn', 'uk', 'ru']
if code in ['rue']:
return ['uk', 'ru']
# Chinese
if code in ['zh-classical', 'lzh', 'minnan', 'zh-min-nan', 'nan', 'zh-tw',
'zh', 'zh-hans']:
return ['zh', 'zh-hans', 'zh-tw', 'zh-cn', 'zh-classical', 'lzh']
if code in ['cdo', 'gan', 'hak', 'ii', 'wuu', 'za', 'zh-classical', 'lzh',
'zh-cn', 'zh-yue', 'yue']:
return ['zh', 'zh-hans' 'zh-cn', 'zh-tw', 'zh-classical', 'lzh']
# Scandinavian languages
if code in ['da', 'sv']:
return ['da', 'no', 'nb', 'sv', 'nn']
if code in ['fo', 'is']:
return ['da', 'no', 'nb', 'nn', 'sv']
if code == 'nn':
return ['no', 'nb', 'sv', 'da']
if code in ['no', 'nb']:
return ['no', 'nb', 'da', 'nn', 'sv']
if code == 'se':
return ['sv', 'no', 'nb', 'nn', 'fi']
# Other languages
if code in ['bi', 'tpi']:
return ['bi', 'tpi']
if code == 'yi':
return ['he', 'de']
if code in ['ia', 'ie']:
return ['ia', 'la', 'it', 'fr', 'es']
if code == 'xmf':
return ['ka']
if code in ['nso', 'st']:
return ['st', 'nso']
if code in ['kj', 'ng']:
return ['kj', 'ng']
if code in ['meu', 'hmo']:
return ['meu', 'hmo']
if code == ['as']:
return ['bn']
# Default value
return []
class TranslationError(Error, ImportError):
"""Raised when no correct translation could be found."""
# Inherits from ImportError, as this exception is now used
# where previously an ImportError would have been raised,
# and may have been caught by scripts as such.
pass
def _get_translation(lang, twtitle):
"""
Return message of certain twtitle if exists.
For internal use, don't use it directly.
"""
if twtitle in _cache[lang]:
return _cache[lang][twtitle]
message_bundle = twtitle.split('-')[0]
trans_text = None
filename = '%s/%s.json' % (message_bundle, lang)
try:
trans_text = pkgutil.get_data(
<API key>, filename).decode('utf-8')
except (OSError, IOError): # file open can cause several exceptions
_cache[lang][twtitle] = None
return
transdict = json.loads(trans_text)
_cache[lang].update(transdict)
try:
return transdict[twtitle]
except KeyError:
return
def _extract_plural(code, message, parameters):
"""Check for the plural variants in message and replace them.
@param message: the message to be replaced
@type message: unicode string
@param parameters: plural parameters passed from other methods
@type parameters: int, basestring, tuple, list, dict
"""
plural_items = re.findall(PLURAL_PATTERN, message)
if plural_items: # we found PLURAL patterns, process it
if len(plural_items) > 1 and isinstance(parameters, (tuple, list)) and \
len(plural_items) != len(parameters):
raise ValueError("Length of parameter does not match PLURAL "
"occurrences.")
i = 0
for selector, variants in plural_items:
if isinstance(parameters, dict):
num = int(parameters[selector])
elif isinstance(parameters, basestring):
num = int(parameters)
elif isinstance(parameters, (tuple, list)):
num = int(parameters[i])
i += 1
else:
num = parameters
# TODO: check against plural_rules[code]['nplurals']
try:
index = plural_rules[code]['plural'](num)
except KeyError:
index = plural_rules['_default']['plural'](num)
except TypeError:
# we got an int, not a function
index = plural_rules[code]['plural']
repl = variants.split('|')[index]
message = re.sub(PLURAL_PATTERN, repl, message, count=1)
return message
DEFAULT_FALLBACK = ('_default', )
def translate(code, xdict, parameters=None, fallback=False):
"""Return the most appropriate translation from a translation dict.
Given a language code and a dictionary, returns the dictionary's value for
key 'code' if this key exists; otherwise tries to return a value for an
alternative language that is most applicable to use on the wiki in
language 'code' except fallback is False.
The language itself is always checked first, then languages that
have been defined to be alternatives, and finally English. If none of
the options gives result, we just take the one language from xdict which may
not be always the same. When fallback is iterable it'll return None if no
code applies (instead of returning one).
For PLURAL support have a look at the twntranslate method
@param code: The language code
@type code: string or Site object
@param xdict: dictionary with language codes as keys or extended dictionary
with family names as keys containing language dictionaries or
a single (unicode) string. May contain PLURAL tags as
described in twntranslate
@type xdict: dict, string, unicode
@param parameters: For passing (plural) parameters
@type parameters: dict, string, unicode, int
@param fallback: Try an alternate language code. If it's iterable it'll
also try those entries and choose the first match.
@type fallback: boolean or iterable
"""
family = pywikibot.config.family
# If a site is given instead of a code, use its language
if hasattr(code, 'code'):
family = code.family.name
code = code.code
# Check whether xdict has multiple projects
if isinstance(xdict, dict):
if family in xdict:
xdict = xdict[family]
elif 'wikipedia' in xdict:
xdict = xdict['wikipedia']
# Get the translated string
if not isinstance(xdict, dict):
trans = xdict
elif not xdict:
trans = None
else:
codes = [code]
if fallback is True:
codes += _altlang(code) + ['_default', 'en']
elif fallback is not False:
codes += list(fallback)
for code in codes:
if code in xdict:
trans = xdict[code]
break
else:
if fallback is not True:
# this shouldn't simply return "any one" code but when fallback
# was True before 65518573d2b0, it did just that. When False it
# did just return None. It's now also returning None in the new
# iterable mode.
return
code = list(xdict.keys())[0]
trans = xdict[code]
if trans is None:
return # return None if we have no translation found
if parameters is None:
return trans
# else we check for PLURAL variants
trans = _extract_plural(code, trans, parameters)
if parameters:
try:
return trans % parameters
except (KeyError, TypeError):
# parameter is for PLURAL variants only, don't change the string
pass
return trans
def twtranslate(code, twtitle, parameters=None, fallback=True):
"""
Translate a message.
The translations are retrieved from json files in <API key>.
fallback parameter must be True for i18n and False for L10N or testing
purposes.
@param code: The language code
@param twtitle: The TranslateWiki string title, in <package>-<key> format
@param parameters: For passing parameters.
@param fallback: Try an alternate language code
@type fallback: boolean
"""
if not messages_available():
raise TranslationError(
'Unable to load messages package %s for bundle %s'
'\nIt can happen due to lack of i18n submodule or files. '
'Read https://mediawiki.org/wiki/PWB/i18n'
% (<API key>, twtitle))
code_needed = False
# If a site is given instead of a code, use its language
if hasattr(code, 'code'):
lang = code.code
# check whether we need the language code back
elif isinstance(code, list):
lang = code.pop()
code_needed = True
else:
lang = code
# There are two possible failure modes: the translation dict might not have
# the language altogether, or a specific key could be untranslated. Both
# modes are caught with the KeyError.
langs = [lang]
if fallback:
langs += _altlang(lang) + ['en']
for alt in langs:
trans = _get_translation(alt, twtitle)
if trans:
break
else:
raise TranslationError(
'No English translation has been defined for TranslateWiki key'
' %r\nIt can happen due to lack of i18n submodule or files. '
'Read https://mediawiki.org/wiki/PWB/i18n' % twtitle)
# send the language code back via the given list
if code_needed:
code.append(alt)
if parameters:
return trans % parameters
else:
return trans
# Maybe this function should be merged with twtranslate
def twntranslate(code, twtitle, parameters=None):
r"""Translate a message with plural support.
Support is implemented like in MediaWiki extension. If the TranslateWiki
message contains a plural tag inside which looks like::
{{PLURAL:<number>|<variant1>|<variant2>[|<variantn>]}}
it takes that variant calculated by the plural_rules depending on the number
value. Multiple plurals are allowed.
As an examples, if we had several json dictionaries in test folder like:
en.json:
{
"test-plural": "Bot: Changing %(num)s {{PLURAL:%(num)d|page|pages}}.",
}
fr.json:
{
"test-plural": "Robot: Changer %(descr)s {{PLURAL:num|une page|quelques pages}}.",
}
and so on.
from pywikibot import i18n
i18n.<API key>('tests.i18n')
# use a number
str(i18n.twntranslate('en', 'test-plural', 0) % {'num': 'no'})
'Bot: Changing no pages.'
# use a string
str(i18n.twntranslate('en', 'test-plural', '1') % {'num': 'one'})
'Bot: Changing one page.'
# use a dictionary
str(i18n.twntranslate('en', 'test-plural', {'num':2}))
'Bot: Changing 2 pages.'
# use additional format strings
str(i18n.twntranslate('fr', 'test-plural', {'num': 1, 'descr': 'seulement'}))
'Robot: Changer seulement une page.'
# use format strings also outside
str(i18n.twntranslate('fr', 'test-plural', 10) % {'descr': 'seulement'})
'Robot: Changer seulement quelques pages.'
The translations are retrieved from i18n.<package>, based on the callers
import table.
@param code: The language code
@param twtitle: The TranslateWiki string title, in <package>-<key> format
@param parameters: For passing (plural) parameters.
"""
# If a site is given instead of a code, use its language
if hasattr(code, 'code'):
code = code.code
# we send the code via list and get the alternate code back
code = [code]
trans = twtranslate(code, twtitle)
lang = code.pop()
# check for PLURAL variants
trans = _extract_plural(lang, trans, parameters)
# we always have a dict for replacement of translatewiki messages
if parameters and isinstance(parameters, dict):
try:
return trans % parameters
except KeyError:
# parameter is for PLURAL variants only, don't change the string
pass
return trans
def twhas_key(code, twtitle):
"""
Check if a message has a translation in the specified language code.
The translations are retrieved from i18n.<package>, based on the callers
import table.
No code fallback is made.
@param code: The language code
@param twtitle: The TranslateWiki string title, in <package>-<key> format
"""
# If a site is given instead of a code, use its language
if hasattr(code, 'code'):
code = code.code
transdict = _get_translation(code, twtitle)
if transdict is None:
return False
return True
def twget_keys(twtitle):
"""
Return all language codes for a special message.
@param twtitle: The TranslateWiki string title, in <package>-<key> format
"""
# obtain the directory containing all the json files for this package
package = twtitle.split("-")[0]
mod = __import__(<API key>, fromlist=[str('__file__')])
pathname = os.path.join(os.path.dirname(mod.__file__), package)
# build a list of languages in that directory
langs = [filename.partition('.')[0]
for filename in sorted(os.listdir(pathname))
if filename.endswith('.json')]
# exclude languages does not have this specific message in that package
# i.e. an incomplete set of translated messages.
return [lang for lang in langs
if lang != 'qqq' and
_get_translation(lang, twtitle)]
def input(twtitle, parameters=None, password=False, fallback_prompt=None):
"""
Ask the user a question, return the user's answer.
The prompt message is retrieved via L{twtranslate} and either uses the
config variable 'userinterface_lang' or the default locale as the language
code.
@param twtitle: The TranslateWiki string title, in <package>-<key> format
@param parameters: The values which will be applied to the translated text
@param password: Hides the user's input (for password entry)
@param fallback_prompt: The English prompt if i18n is not available.
@rtype: unicode string
"""
if not messages_available():
if not fallback_prompt:
raise TranslationError(
'Unable to load messages package %s for bundle %s'
% (<API key>, twtitle))
else:
prompt = fallback_prompt
else:
code = config.userinterface_lang or \
locale.getdefaultlocale()[0].split('_')[0]
prompt = twtranslate(code, twtitle, parameters)
return pywikibot.input(prompt, password)
|
'use strict';
moduloEpisodio.controller('<API key>', ['$scope', '$routeParams', 'serverService', 'episodioService', '$location', '$uibModalInstance', 'id',
function ($scope, $routeParams, serverService, episodioService, $location, $uibModalInstance, id) {
$scope.fields = episodioService.getFields();
$scope.obtitle = episodioService.getObTitle();
$scope.icon = episodioService.getIcon();
$scope.ob = episodioService.getTitle();
$scope.title = "Vista de " + $scope.obtitle;
$scope.id = id;
$scope.status = null;
$scope.debugging = serverService.debugging();
serverService.promise_getOne($scope.ob, $scope.id).then(function (response) {
if (response.status == 200) {
if (response.data.status == 200) {
$scope.status = null;
$scope.bean = response.data.message;
var filter = "and,id_medico,equa," + $scope.bean.obj_medico.id;
serverService.promise_getPage("usuario", 1, 1, filter).then(function (data) {
if (data.data.message.length > 0)
$scope.medico = data.data.message[0];
});
} else {
$scope.status = "Error en la recepción de datos del servidor";
}
} else {
$scope.status = "Error en la recepción de datos del servidor";
}
}).catch(function (data) {
$scope.status = "Error en la recepción de datos del servidor";
});
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
}
}]);
|
'use strict';
var path = require('path');
var gulp = require('gulp');
var conf = require('./conf');
var browserSync = require('browser-sync');
function isOnlyChange(event) {
return event.type === 'changed';
}
gulp.task('watch', ['inject'], function () {
path.join(conf.paths.src, '/assets/styles/css*.css'),
path.join(conf.paths.src, '/assets/styles/less*.less')
path.join(conf.paths.src, '/app*.css'),
path.join(conf.paths.src, '/app*.less')
gulp.watch(path.join(conf.paths.src, '/app*.js'), function(event) {
gulp.watch(path.join(conf.paths.src, '/app*.html'), function(event) {
|
.model-icon { min-width: 20px !important; display: inline-block !important; margin-left: 2px; }
.table a { display: block; }
.controller-admin .plugin-list { list-style: none; margin: 0; padding: 0; }
.controller-admin .plugin-list a { display: block; padding: 5px 15px; }
.controller-admin .plugin-list a.float-right { display: none; }
.controller-admin .plugin-list li:hover a.float-right { display: block; color: #fff; }
.controller-admin .plugin-list a:hover { background: #45c5eb; color: #fff; border-radius: .3rem; }
.controller-admin .plugin-list a:hover .model-icon { color: #fff; }
.controller-admin .plugin-list a:hover .text-muted { color: #dbf1fa; }
.controller-crud .associations { margin: 2rem 0; }
.controller-crud .associations h3 { margin-bottom: 1rem; }
.controller-acl .table { width: auto; }
.controller-acl .table td { padding: 0; }
.controller-acl .table a { display: block; padding: 1rem; color: #000; }
.controller-acl .table a span { opacity: .2; }
.controller-acl .table a:hover { text-decoration: none; }
.controller-acl .table a:hover span { opacity: 1; }
.controller-acl .table .permission a { text-align: center; }
.controller-acl .table .permission .action.allow { background-color: #e7f2dd; }
.controller-acl .table .permission .action.inherit { background-color: #dbf1fa; }
.controller-acl .table .permission .action.deny { background-color: #fdc5c1; }
.controller-acl .matrix-head { background: #1d1f21 !important; border-color: #52555a !important; color: #fff; }
.controller-acl .matrix-head a { color: #E5E5E5; }
.controller-acl .matrix-head a:hover { color: #fff; }
.controller-acl .matrix-head.matrix-y { min-width: 150px; }
.controller-logs table tbody a { display: inline-block; }
.controller-reports .reported-item { margin: 2rem 0 1rem 0; }
.controller-reports .reported-item h3 { margin-bottom: 1rem; }
.controller-upload .field .col.span-2 { margin-right: 1.5rem; }
.controller-upload .field .field-col .checkbox label { margin-left: 5px; }
.controller-upload .field .field-help { vertical-align: middle; margin: 8px 0 0 10px; display: inline-block; }
.controller-upload .field textarea { min-height: 100px; }
.controller-upload .splash { padding: 100px; text-align: center; border: 1px solid #e5e5e5; background: #fbfbfb; border-radius: .3em; }
.controller-upload .splash h2 { margin-bottom: 25px; }
.field-null { display: inline-block; margin-left: 10px; }
.field-null label { margin-left: 5px; font-weight: normal; }
.field-null input { top: 1px; position: relative; }
.type-integer,
.type-boolean,
.type-enum,
.type-float { text-align: center !important; }
.type-datetime { text-align: right !important; }
.col-checkbox { width: 15px; }
.col-actions { width: 15px; padding: .5rem !important; }
.col-actions .button { display: inline-block; padding: 3px 4px; float: none; font-size: .8rem; }
|
<?php
namespace Icewind\SMB;
use Icewind\SMB\Exception\DependencyException;
use Icewind\SMB\Exception\Exception;
/**
* Use existing kerberos ticket to authenticate and reuse the apache ticket cache (mod_auth_kerb)
*/
class KerberosApacheAuth extends KerberosAuth implements IAuth {
/** @var string */
private $ticketPath = "";
/** @var bool */
private $init = false;
/** @var string|false */
private $ticketName;
public function __construct() {
$this->ticketName = getenv("KRB5CCNAME");
}
/**
* Copy the ticket to a temporary location and use that ticket for authentication
*
* @return void
*/
public function copyTicket(): void {
if (!$this->checkTicket()) {
return;
}
$krb5 = new \KRB5CCache();
$krb5->open($this->ticketName);
$tmpFilename = tempnam("/tmp", "krb5cc_php_");
$tmpCacheFile = "FILE:" . $tmpFilename;
$krb5->save($tmpCacheFile);
$this->ticketPath = $tmpFilename;
$this->ticketName = $tmpCacheFile;
}
/**
* Pass the ticket to smbclient by memory instead of path
*
* @return void
*/
public function <API key>(): void {
if (!$this->checkTicket()) {
return;
}
$krb5 = new \KRB5CCache();
$krb5->open($this->ticketName);
$this->ticketName = (string)$krb5->getName();
}
/**
* Check if a valid kerberos ticket is present
*
* @return bool
* @<API key> string $this->ticketName
*/
public function checkTicket(): bool {
//read apache kerberos ticket cache
if (!$this->ticketName) {
return false;
}
$krb5 = new \KRB5CCache();
$krb5->open($this->ticketName);
/** @psalm-suppress MixedArgument */
return count($krb5->getEntries()) > 0;
}
private function init(): void {
if ($this->init) {
return;
}
$this->init = true;
if (!extension_loaded("krb5")) {
throw new DependencyException('Ensure php-krb5 is installed.');
}
//read apache kerberos ticket cache
if (!$this->checkTicket()) {
throw new Exception('No kerberos ticket cache environment variable (KRB5CCNAME) found.');
}
// note that even if the ticketname is the value we got from `getenv("KRB5CCNAME")` we still need to set the env variable ourselves
// this is because `getenv` also reads the variables passed from the SAPI (apache-php) and we need to set the variable in the OS's env
putenv("KRB5CCNAME=" . $this->ticketName);
}
public function <API key>(): string {
$this->init();
return parent::<API key>();
}
public function <API key>($smbClientState): void {
$this->init();
try {
parent::<API key>($smbClientState);
} catch (Exception $e) {
// suppress
}
}
public function __destruct() {
if (!empty($this->ticketPath) && file_exists($this->ticketPath) && is_file($this->ticketPath)) {
unlink($this->ticketPath);
}
}
}
|
/* adddma.c
*/
#include <lib.h>
#define adddma _adddma
#include <unistd.h>
#include <stdarg.h>
int adddma(proc_e, start, size)
endpoint_t proc_e;
phys_bytes start;
phys_bytes size;
{
message m;
m.m2_i1= proc_e;
m.m2_l1= start;
m.m2_l2= size;
return _syscall(MM, ADDDMA, &m);
}
|
module Trinidad
module Extensions
class BarOptionsExtension < OptionsExtension
def configure(parser, default_options)
default_options ||= {}
default_options[:bar] = true
end
end
end
end
|
require "heroku/command/base"
require "base64"
require "excon"
# manage organization accounts
class Heroku::Command::Orgs < Heroku::Command::Base
# orgs
# lists the orgs that you are a member of.
def index
response = org_api.get_orgs.body
orgs = []
response.fetch('organizations', []).each do |org|
orgs << org
org.fetch('child_orgs', []).each do |child|
orgs << child
end
end
default = response['user']['<API key>'] || ""
orgs.map! do |org|
name = org["organization_name"]
t = []
t << org["role"]
t << 'default' if name == default
[name, t.join(', ')]
end
if orgs.empty?
display("You are not a member of any organizations.")
else
styled_array(orgs)
end
end
# orgs:open --org ORG
# opens the org interface in a browser
def open
launchy("Opening web interface for
end
# orgs:default [TARGET]
# sets the default org.
# TARGET can be an org you belong to or it can be "personal"
# for your personal account. If no argument or option is given,
# the default org is displayed
def default
options[:ignore_no_org] = true
if target = shift_argument
options[:org] = target
end
if org == "personal" || options[:personal]
action("Setting personal account as default") do
org_api.remove_default_org
end
elsif org && !options[:using_default_org]
action("Setting #{org} as the default organization") do
org_api.set_default_org(org)
end
elsif org
display("#{org} is the default organization.")
else
display("Personal account is default.")
end
end
end
|
var assert = require('assert');
var _ = require('@sailshq/lodash');
var SchemaBuilder = require('../lib/waterline-schema');
describe('Has Many Through :: ', function() {
describe('Junction Tables', function() {
var schema;
before(function() {
var fixtures = [
{
identity: 'user',
primaryKey: 'id',
attributes: {
id: {
type: 'number'
},
cars: {
collection: 'car',
through: 'drive',
via: 'user'
}
}
},
{
identity: 'drive',
primaryKey: 'id',
attributes: {
id: {
type: 'number'
},
car: {
model: 'car'
},
user: {
model: 'user'
}
}
},
{
identity: 'car',
primaryKey: 'id',
attributes: {
id: {
type: 'number'
},
drivers: {
collection: 'user',
through: 'drive',
via: 'car'
}
}
}
];
var collections = _.map(fixtures, function(obj) {
var collection = function() {};
collection.prototype = obj;
return collection;
});
// Build the schema
schema = SchemaBuilder(collections);
});
it('should flag the "through" table and not mark it as a junction table', function() {
assert(schema.drive);
assert(!schema.drive.junctionTable);
assert(schema.drive.throughTable);
});
});
describe('Reference Mapping', function() {
var schema;
before(function() {
var fixtures = [
{
identity: 'foo',
primaryKey: 'id',
attributes: {
id: {
type: 'number'
},
bars: {
collection: 'bar',
through: 'foobar',
via: 'foo'
}
}
},
{
identity: 'foobar',
primaryKey: 'id',
attributes: {
id: {
type: 'number'
},
type: {
type: 'string'
},
foo: {
model: 'foo',
columnName: 'foo_id'
},
bar: {
model: 'bar',
columnName: 'bar_id'
}
}
},
{
identity: 'bar',
primaryKey: 'id',
attributes: {
id: {
type: 'number'
},
foo: {
collection: 'foo',
through: 'foobar',
via: 'bar'
}
}
}
];
var collections = _.map(fixtures, function(obj) {
var collection = function() {};
collection.prototype = obj;
return collection;
});
// Build the schema
schema = SchemaBuilder(collections);
});
it('should update the parent collection to point to the join table', function() {
assert.equal(schema.foo.schema.bars.references, 'foobar');
assert.equal(schema.foo.schema.bars.on, 'foo_id');
});
});
});
|
package sacloud
// IPv6Addr IP(IPv6)
type IPv6Addr struct {
HostName string `json:",omitempty"`
IPv6Addr string `json:",omitempty"` // IPv6
Interface *Interface `json:",omitempty"`
IPv6Net *IPv6Net `json:",omitempty"` // IPv6
}
// GetIPv6NetID IPv6IPv6NetID
func (a *IPv6Addr) GetIPv6NetID() int64 {
if a.IPv6Net != nil {
return a.IPv6Net.ID
}
return 0
}
// GetInternetID IPv6+(Internet)ID
func (a *IPv6Addr) GetInternetID() int64 {
if a.IPv6Net != nil && a.IPv6Net.Switch != nil && a.IPv6Net.Switch.Internet != nil {
return a.IPv6Net.Switch.Internet.ID
}
return 0
}
// CreateNewIPv6Addr IPv6
func CreateNewIPv6Addr() *IPv6Addr {
return &IPv6Addr{
IPv6Net: &IPv6Net{
Resource: &Resource{},
},
}
}
|
using System;
using System.Runtime.InteropServices;
using Duality;
using Duality.Drawing;
using Duality.Resources;
namespace DynamicLighting
{
[StructLayout(LayoutKind.Sequential)]
public struct VertexC1P3T2A4 : IVertexData
{
public static readonly VertexDeclaration Declaration = VertexDeclaration.Get<VertexC1P3T2A4>();
[VertexElement(VertexElementRole.Color)]
public ColorRgba Color;
[VertexElement(VertexElementRole.Position)]
public Vector3 Pos;
[VertexElement(VertexElementRole.TexCoord)]
public Vector2 TexCoord;
public Vector4 Attrib;
// Add Vector3 for lighting world position, see note in Light.cs
Vector3 IVertexData.Pos
{
get { return this.Pos; }
set { this.Pos = value; }
}
ColorRgba IVertexData.Color
{
get { return this.Color; }
set { this.Color = value; }
}
VertexDeclaration IVertexData.Declaration
{
get { return Declaration; }
}
}
}
|
package engine.actions;
import engine.gameObject.GameObject;
import authoring.model.collections.<API key>;
public class <API key> extends PhysicsTypeAction {
public <API key> (String type, String secondType, Double value) {
super(type, secondType, value);
// TODO Auto-generated constructor stub
}
@Override
public void applyPhysics (<API key> myObjects) {
GameObject <API key> = null;
GameObject <API key> = null;
for (GameObject g : myObjects){
if (g.getIdentifier().getType().equals(myType) && g.isCollisionEnabled()){
<API key> = g;
}
if (g.getIdentifier().getType().equals(mySecondType) && g.isCollisionEnabled()){
<API key> = g;
}
}
myCollision.fixedCollision(<API key>, <API key>);
}
}
|
<?php
phpinfo();
|
An ember command line utility.
Supports node 0.10.5 and npm 1.4.6.
## Community
* irc: #ember-cli on freenode
* issues: [ember-cli/issues](https://github.com/stefanpenner/ember-cli/issues)
* website: [iamstef.net/ember-cli](http://iamstef.net/ember-cli)
[
* [loader](https://github.com/stefanpenner/loader.js)
* [ember-cli-shims](https://github.com/stefanpenner/ember-cli-shims)
* [<API key>](https://github.com/stefanpenner/<API key>)
## Development Hints
Working with master
sh
git clone https://github.com/stefanpenner/ember-cli.git
cd ember-cli
npm link
`npm link` is very similar to `npm install -g` except that instead of downloading the package from the repo the just cloned `ember-cli/` folder becomes the global package. Any changes to the files in the `ember-cli/` folder will immediately affect the global ember-cli package.
Now you can use `ember-cli` via the command line:
sh
ember new foo
cd foo
npm link ember-cli
ember server
`npm link ember-cli` is needed because by default the globally installed `ember-cli` just loads the local `ember-cli` from the project. `npm link ember-cli` symlinks the global `ember-cli` package to the local `ember-cli` package. Now the `ember-cli` you cloned before is in three places: The folder you cloned it into, npm's folder where it stores global packages and the `ember-cli` project you just created.
If you upgrade an app running against Ember CLI master you will need to re-link to your checkout of Ember CLI by running `npm link ember-cli` in your project again.
Please read the official [npm-link documentation](https://www.npmjs.org/doc/cli/npm-link.html) and the [npm-link cheatsheet](https://blog.nodejitsu.com/npm-cheatsheet/#<API key>) for more information.
Working with the tests
Use `npm run-script autotest` to run the tests after every file change (Runs only fast tests). Use `npm test` to run them once.
For a full test run which includes some very slow acceptance tests,
please run: `npm run-script test-all`. Please note, this is what travis
runs.
To exclude a test or test suite append a `.skip` to `it()` or `describe()` respectively (e.g. `it.skip(...)`). To focus on a certain test or test suite append `.only`.
Please read the official [mocha documentation](http://visionmedia.github.io/mocha) for more information.
## Contribution
[See `CONTRIBUTING.md`](https://github.com/stefanpenner/ember-cli/blob/master/CONTRIBUTING.md)
## Donating
All donations will support this project and treats for contributors.
[.requires('lively.Network').toRun(function() {
// depends on the <API key>
Object.extend(lively.ide.DirectoryWatcher, {
watchServerURL: new URL(Config.nodeJSURL+'/<API key>/'),
dirs: {},
reset: function() {
// lively.ide.DirectoryWatcher.reset()
this.dirs = {};
this.watchServerURL.withFilename('reset').asWebResource().post();
},
request: function(url, thenDo) {
return url.asWebResource().beAsync().withJSONWhenDone(function(json, status) {
thenDo(!json || json.error, json); }).get();
},
getFiles: function(dir, thenDo) {
this.request(this.watchServerURL.withFilename('files').withQuery({dir: dir}), thenDo);
},
getChanges: function(dir, since, startWatchTime, thenDo) {
this.request(this.watchServerURL.withFilename('changes').withQuery({
startWatchTime: startWatchTime, since: since, dir: dir}), thenDo);
},
withFilesOfDir: function(dir, doFunc) {
// Retrieves efficiently the files of dir. Uses a server side watcher that
// sends infos about file changes, deletions, creations.
// This methods synchs those with the cached state held in this object
// dir = lively.shell.exec('pwd', {sync:true}).resultString()
// lively.ide.DirectoryWatcher.dirs
// lively.ide.DirectoryWatcher.withFilesOfDir(dir, function(files) { show(Object.keys(files).length); })
var watchState = this.dirs[dir] || (this.dirs[dir] = {updateInProgress: false, callbacks: []});
doFunc && watchState.callbacks.push(doFunc);
if (watchState.updateInProgress) { return; }
watchState.updateInProgress = true;
if (!watchState.files) { // first time called
this.getFiles(dir, function(err, result) {
if (err) show("dir watch error: %s", err);
result.files && Properties.forEachOwn(result.files, function(path, stat) { extend(stat); })
Object.extend(watchState, {
files: result.files,
lastUpdated: result.startTime,
startTime: result.startTime
});
whenDone();
});
return;
}
var timeSinceLastUpdate = Date.now() - (watchState.lastUpdated || 0);
if (timeSinceLastUpdate < 10 * 1000) { whenDone(); } // recently updated
// get updates
this.getChanges(dir, watchState.lastUpdated, watchState.startTime, function(err, result) {
if (!result.changes || result.changes.length === 0) { whenDone(); return; }
watchState.lastUpdated = result.changes[0].time;
console.log('%s files changed in %s: %s', result.changes.length, dir, result.changes.pluck('path').join('\n'));
result.changes.forEach(function(change) {
switch (change.type) {
case 'removal': delete watchState.files[change.path]; break;
case 'creation': case 'change': watchState.files[change.path] = extend(change.stat); break;
}
});
whenDone();
});
function whenDone() {
watchState.updateInProgress = false;
var cb;
while ((cb = watchState.callbacks.shift())) cb(watchState.files);
}
function extend(statObj) { // convert date string into a date object
if (!statObj) statObj = {};
statObj.isDirectory = !!(statObj.mode & 0x4000);
['atime', 'mtime', 'ctime'].forEach(function(field) {
if (statObj[field]) statObj[field] = new Date(statObj[field]); });
return statObj;
}
}
});
}) // end of module
|
<html>
<head>
<title>Popcorn processing unit Tests</title>
<link rel="stylesheet" href="../../test/qunit/qunit.css" type="text/css" media="screen">
<script src="../../test/qunit/qunit.js"></script>
<script src="../../popcorn.js"></script>
<script src="popcorn.processing.js"></script>
<script src="popcorn.processing.unit.js"></script>
</head>
<body>
<h1 id="qunit-header">Popcorn processing Plug-in Demo</h1>
<h2 id="qunit-banner"></h2>
<div id="<API key>"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"> </div>
<div>
<video id="video"
controls preload="none"
width="250px"
poster="../../test/poster.png">
<source id="mp4"
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
<source id="ogv"
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
<source id='webm'
src="../../test/trailer.webm"
type='video/webm; codecs="vp8, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
</video>
</div>
<div id="processing-div-1" width="50%" height="50%"></div>
<div id="processing-div-2" width="50%" height="50%"></div>
<div id="processing-div-3" width="50%" height="50%"></div>
<div id="processing-div-4" width="50%" height="50%"></div>
</html>
|
body.<API key> #header .navbar-minimize > a {
background-color: #8d8d6e;
color: #ffffff;
}
body.<API key> #header .navbar-minimize:hover > a {
background-color: #7f7f63;
}
#header .navbar-header {
background-color: #8d8d6e;
}
.sidebar-content img {
border: 2px solid #8d8d6e;
}
#sidebar-left.sidebar-box .sidebar-menu > li.active > a > .icon i,
#sidebar-left.sidebar-rounded .sidebar-menu > li.active > a > .icon i,
#sidebar-left.sidebar-circle .sidebar-menu > li.active > a > .icon i {
background-color: #8d8d6e;
}
#sidebar-left.sidebar-box .sidebar-menu > li > ul > li:hover:after,
#sidebar-left.sidebar-rounded .sidebar-menu > li > ul > li:hover:after,
#sidebar-left.sidebar-circle .sidebar-menu > li > ul > li:hover:after {
-webkit-box-shadow: 0 0 0 5px #707058;
-moz-box-shadow: 0 0 0 5px #707058;
box-shadow: 0 0 0 5px #707058;
}
#sidebar-left .sidebar-menu ul li:hover:after {
background-color: #8d8d6e;
}
#sidebar-left .sidebar-menu ul li:hover a:before {
color: #8d8d6e;
}
#sidebar-left .sidebar-menu ul li.active:after {
background-color: #8d8d6e;
}
#sidebar-left .sidebar-menu ul li.active > ul > li.active a:before {
color: #8d8d6e;
}
body.<API key> .navbar-minimize,
body.<API key> .navbar-minimize {
border-right: 1px solid #8d8d6e !important;
}
body.<API key> .navbar-minimize a,
body.<API key> .navbar-minimize a {
background-color: #8d8d6e;
border-bottom: 1px solid #8d8d6e;
}
body.<API key> .navbar-minimize a:hover,
body.<API key> .navbar-minimize a:hover {
background-color: #7f7f63;
border-bottom: 1px solid #7f7f63;
}
body.<API key> .navbar-minimize a i,
body.<API key> .navbar-minimize a i {
color: #ffffff;
}
.<API key> {
background-color: #8d8d6e;
}
.<API key>:hover {
background-color: #7f7f63;
}
@media (max-width: 768px) {
body.<API key> .<API key>,
body.<API key> .<API key> {
background-color: #707058;
}
body.<API key> .<API key>:hover,
body.<API key> .<API key>:hover {
background-color: #7f7f63;
}
}
.navbar-toolbar .navbar-form input:focus {
border: 1px solid #8d8d6e;
}
.navbar-toolbar .navbar-form .btn-focus {
background-color: #8d8d6e;
box-shadow: none;
border: none;
color: #ffffff;
}
.navbar-toolbar .navbar-right .dropdown > a:focus > i {
color: #8d8d6e;
}
.sign-wrapper a {
color: #8d8d6e;
}
.sign-wrapper a:hover,
.sign-wrapper a:focus,
.sign-wrapper a:active {
color: #8a8a6c;
}
.sign-text:before {
background-color: #a4a48a;
}
.sign-header {
background-color: #8d8d6e;
border-bottom: 10px solid #79795e;
}
.sign-text span {
background-color: #8d8d6e;
}
.sign-text img {
border: 7px solid #8d8d6e;
}
.error-wrapper h1 {
color: #8d8d6e;
}
.product-num {
background-color: #8d8d6e;
}
a {
color: #8d8d6e;
}
a:hover,
a:active,
a:focus {
color: #707058;
}
input.no-border-left:focus,
textarea.no-border-left:focus {
border-top: 1px solid #8d8d6e !important;
border-right: 1px solid #8d8d6e !important;
border-bottom: 1px solid #8d8d6e !important;
border-left: none !important;
}
input.no-border-right:focus,
textarea.no-border-right:focus {
border-top: 1px solid #8d8d6e !important;
border-none: 1px solid #8d8d6e !important;
border-bottom: 1px solid #8d8d6e !important;
border-right: none !important;
}
input:focus,
textarea:focus {
border: 1px solid #8d8d6e !important;
}
.panel-tab .panel-heading ul li.active a i {
color: #8d8d6e;
}
.panel-tab .panel-heading ul li a:hover i {
color: #8d8d6e;
}
.media-manager .<API key> .filter-type a.active {
color: #8d8d6e;
}
.pagination > li > a {
color: #707058;
}
.pagination > .active > a,
.pagination > .active > span {
background-color: #707058;
border: 1px solid #707058;
}
.pagination > .active > a:hover,
.pagination > .active > span:hover,
.pagination > .active > a:focus,
.pagination > .active > span:focus {
background-color: #8d8d6e;
border: 1px solid #8d8d6e;
}
.pager > li > a {
color: #707058;
}
.rating .star:hover:before {
color: #8d8d6e;
}
.rating .star.active:before {
color: #8d8d6e;
}
.rating .star.active ~ .star:before {
color: #8d8d6e;
}
.dropdown-menu li {
position: relative;
}
.dropdown-menu li.active a {
background-color: #8d8d6e;
}
.dropdown-menu li.active:hover a,
.dropdown-menu li.active:focus a,
.dropdown-menu li.active:active a {
background-color: #8d8d6e;
cursor: default;
}
.dropdown-menu li > a:hover:before {
display: block;
content: "";
position: absolute;
left: 0px;
top: 0px;
bottom: 0px;
border-left: 3px solid #7f7f63;
}
a.list-group-item.active {
background-color: #8d8d6e;
border-color: #8d8d6e;
}
a.list-group-item.active:hover,
a.list-group-item.active:focus {
background-color: #8d8d6e;
border-color: #8d8d6e;
}
.ckbox-theme input[type=checkbox]:checked + label::after {
border-color: #8d8d6e;
background-color: #8d8d6e;
}
.ckbox-theme input[type=checkbox][disabled]:checked + label::after {
border-color: #8d8d6e;
opacity: .5;
}
.rdio-theme input[type=radio]:checked + label::after {
border-color: #8d8d6e;
background-color: #8d8d6e;
}
.rdio-theme input[type=radio][disabled]:checked + label::after {
border-color: #8d8d6e;
opacity: .5;
}
.form-control:focus {
border: 1px solid #8d8d6e;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.form-focus {
border: 1px solid #8d8d6e;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.table-theme thead tr th {
background-color: #8d8d6e !important;
border-color: #99997c #99997c #79795e !important;
color: #fff;
}
.table-theme tbody tr td.sorting_1 {
background: #abab93 !important;
color: white;
border-bottom: 1px solid #babaa7 !important;
}
.table-theme tfoot tr th {
background-color: #8d8d6e !important;
border-color: #79795e #99997c #99997c !important;
color: #fff;
}
.table-theme.table-bordered {
border: 1px solid #8d8d6e;
}
.table-theme.table-bordered thead tr th:first-child,
.table-theme.table-bordered tfoot tr th:first-child,
.table-theme.table-bordered thead tr th:last-child,
.table-theme.table-bordered tfoot tr th:last-child {
-<API key>: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
}
.table-theme.table-bordered tbody tr td.sorting_1 {
border-right: 1px solid #babaa7 !important;
}
.table-theme table.has-columns-hidden > tbody > tr > td > span.responsiveExpander:before {
color: white;
}
.table-theme table.has-columns-hidden > tbody > tr.detail-show > td span.responsiveExpander:before {
color: white;
}
.btn-theme {
background-color: #8d8d6e;
border-color: #8d8d6e;
color: white;
}
.btn-theme:hover,
.btn-theme:focus,
.btn-theme:active,
.btn-theme.active,
.btn-theme[disabled],
.btn-theme.disabled {
background-color: #7f7f63;
border-color: transparent;
color: white;
}
.btn-theme.dropdown-toggle.btn-theme {
background-color: #8d8d6e;
border-color: #7f7f63;
color: white;
}
.btn-theme.btn-alt {
background-color: #7f7f63;
border: 1px solid #8d8d6e;
}
.btn-theme.btn-alt:hover {
background-color: #707058;
}
.btn-theme.btn-stroke {
border: 1px double #8d8d6e;
background-color: transparent;
color: #999;
}
.btn-theme.btn-stroke:hover {
background-color: #7f7f63;
border-color: transparent;
color: white;
}
.btn-theme.btn-solid {
border: 1px solid #8d8d6e;
}
.btn-theme.btn-dashed {
border: 1px dashed #8d8d6e;
}
.btn-theme.btn-dotted {
border: 1px dotted #8d8d6e;
}
.btn-theme.btn-double {
border: 4px double #8d8d6e;
}
.btn-theme.btn-inset {
border: 4px inset #8d8d6e;
}
.btn-theme.btn-circle {
padding-left: 0;
padding-right: 0;
width: 34px;
-<API key>: 50% 50% 50% 50%;
-moz-border-radius: 50% 50% 50% 50%;
border-radius: 50% 50% 50% 50%;
}
.btn-theme.btn-slidedown:after {
width: 100%;
height: 0;
top: 0;
left: 0;
background-color: #707058;
z-index: -1;
}
.btn-theme.btn-slidedown:hover,
.btn-theme.btn-slidedown:active {
color: white;
}
.btn-theme.btn-slidedown:hover:after,
.btn-theme.btn-slidedown:active:after {
height: 100%;
}
.btn-theme.btn-slideright:after {
width: 0%;
height: 100%;
top: 0;
left: 0;
background-color: #707058;
z-index: -1;
}
.btn-theme.btn-slideright:hover,
.btn-theme.btn-slideright:active {
color: white;
}
.btn-theme.btn-slideright:hover:after,
.btn-theme.btn-slideright:active:after {
width: 100%;
}
.btn-theme.btn-expand:after {
width: 0;
height: 103%;
top: 50%;
left: 50%;
background-color: #707058;
opacity: 0;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
-o-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
.btn-theme.btn-expand:hover:after {
width: 90%;
opacity: 1;
}
.btn-theme.btn-expand:active:after {
width: 101%;
opacity: 1;
}
.btn-theme.btn-rotate {
overflow: hidden;
}
.btn-theme.btn-rotate:after {
width: 100%;
height: 0;
top: 50%;
left: 50%;
background-color: #707058;
opacity: 0;
-webkit-transform: translateX(-50%) translateY(-50%) rotate(45deg);
-moz-transform: translateX(-50%) translateY(-50%) rotate(45deg);
-ms-transform: translateX(-50%) translateY(-50%) rotate(45deg);
-o-transform: translateX(-50%) translateY(-50%) rotate(45deg);
transform: translateX(-50%) translateY(-50%) rotate(45deg);
}
.btn-theme.btn-rotate:hover:after {
height: 260%;
opacity: 1;
}
.btn-theme.btn-rotate:active:after {
height: 400%;
opacity: 1;
}
.btn-theme.btn-open {
overflow: hidden;
}
.btn-theme.btn-open:after {
width: 101%;
height: 0;
top: 50%;
left: 50%;
background-color: #707058;
opacity: 0;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
-o-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
.btn-theme.btn-open:hover:after {
height: 75%;
opacity: 1;
}
.btn-theme.btn-open:active:after {
height: 130%;
opacity: 1;
}
.btn-theme.btn-push {
background: #8d8d6e;
box-shadow: 0 6px #707058;
-webkit-transition: none;
-moz-transition: none;
transition: none;
}
.btn-theme.btn-push:hover {
box-shadow: 0 4px #707058;
top: 2px;
}
.btn-theme.btn-push:active {
box-shadow: 0 0 #707058;
top: 6px;
}
.btn-theme.btn-pushright {
background: #8d8d6e;
box-shadow: 6px 0 #707058;
-webkit-transition: none;
-moz-transition: none;
transition: none;
}
.btn-theme.btn-pushright:hover {
box-shadow: 4px 0 #707058;
left: 2px;
}
.btn-theme.btn-pushright:active {
box-shadow: 0 0 #707058;
left: 6px;
}
.panel-theme .panel-heading {
background-color: #8d8d6e;
border: 1px solid #8a8a6c;
color: white;
}
.panel-theme .panel-heading .option .btn:hover {
background-color: #7f7f63;
color: white;
}
.panel-theme .panel-heading .option .btn i {
color: white;
}
.panel-bg-theme .panel-body {
background-color: #8d8d6e;
color: white;
}
.panel-bg-theme .panel-body .text-muted {
color: #f2f2f2;
}
.img-bordered-theme {
border: 2px solid #8d8d6e;
}
.progress-bar-theme {
background-color: #8d8d6e;
}
.fg-theme {
color: #8d8d6e !important;
}
.nicescroll-rails div {
background-color: #8d8d6e !important;
}
.sidebar .nicescroll-rails div {
background-color: #323232 !important;
}
.cal-month-box {
border-top: 7px solid #79795e !important;
-<API key>: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
}
.cal-row-head [class*="cal-cell1"],
.cal-row-head [class*="cal-cell"] {
background-color: #8d8d6e;
color: #ffffff;
border-width: 0px 1px 0px !important;
border-style: solid;
border-color: #99997c #99997c #79795e !important;
border-left: none !important;
}
.cal-row-head [class*="cal-cell1"]:hover,
.cal-row-head [class*="cal-cell"]:hover {
background-color: #8d8d6e !important;
}
.cal-row-head [class*="cal-cell1"]:first-child,
.cal-row-head [class*="cal-cell"]:first-child {
border-width: 0px 1px 0px !important;
border-style: solid;
border-color: #99997c #99997c #79795e !important;
}
.cal-row-head [class*="cal-cell1"]:last-child,
.cal-row-head [class*="cal-cell"]:last-child {
border-right: none !important;
}
#cal-day-panel {
border-top: 7px solid #79795e !important;
background-color: rgba(255, 255, 255, 0.28);
}
.cal-day-today {
background-color: #8d8d6e !important;
}
.cal-row-head + .cal-day-hour {
background-color: #79795e !important;
color: #ffffff;
}
.bg-theme {
background-color: #8d8d6e !important;
border: 1px solid #8d8d6e;
color: white;
}
.bg-theme a,
.bg-theme i,
.bg-theme span,
.bg-theme small,
.bg-theme p {
color: white;
}
.bg-theme .flot-tick-label.tickLabel {
color: rgba(255, 255, 255, 0.5) !important;
}
.bg-theme .<API key> {
background-color: #707058;
}
#back-top:hover {
background: #8d8d6e;
box-shadow: 0 0 0 6px #ffffff;
}
.jqvmap-zoomin,
.jqvmap-zoomout {
background: #8d8d6e !important;
}
.jqvmap-zoomin:hover,
.jqvmap-zoomout:hover {
background: #707058 !important;
}
.chosen-container .chosen-results li.highlighted {
background-color: #8d8d6e !important;
background-image: none !important;
}
.dz-file-preview .dz-details:before {
color: #8d8d6e;
}
#jpreBar {
background-color: #8d8d6e;
}
.datepicker table thead tr:first-child {
background-color: #8d8d6e;
}
.datepicker table thead tr:last-child {
background-color: #707058;
}
.datepicker table thead tr th {
background-color: #8d8d6e;
border-color: #7f7f63 #7f7f63 #79795e;
}
.datepicker table thead tr .prev:hover,
.datepicker table thead tr .switch:hover,
.datepicker table thead tr .next:hover {
background-color: #7f7f63 !important;
}
.datepicker table tbody tr td.active,
.datepicker table tbody tr td.active:hover,
.datepicker table tbody tr td.active:disabled,
.datepicker table tbody tr td.active.disabled:hover {
background-color: #8d8d6e;
}
.datepicker table tbody tr td.active.active {
background-color: #8d8d6e;
border-top: 1px solid #8d8d6e;
border-bottom: 1px solid #8d8d6e;
}
.datepicker table tbody tr td.active.active:hover {
background-color: #707058;
}
.datepicker .icon-arrow-left:before {
font-family: "FontAwesome";
content: "\f104";
}
.datepicker .icon-arrow-right:before {
font-family: "FontAwesome";
content: "\f105";
}
.datepicker-dropdown:after {
border-bottom: 6px solid #8d8d6e;
}
.slider-theme .irs-diapason {
background-color: #99997c !important;
}
.slider-theme .irs-slider {
background-color: #8d8d6e !important;
}
.slider-theme #irs-active-slider,
.slider-theme .irs-slider:hover {
background-color: #8d8d6e !important;
}
.slider-theme .irs-from,
.slider-theme .irs-to,
.slider-theme .irs-single {
background-color: #8d8d6e !important;
}
.slider-theme .irs-from:after,
.slider-theme .irs-to:after,
.slider-theme .irs-single:after {
border-top-color: #8d8d6e !important;
}
.slider-theme.circle .irs-slider {
top: 21px;
width: 20px;
height: 20px;
-<API key>: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
.slider-theme.donut .irs-slider {
background: #e1e4e9 !important;
top: 21px;
width: 20px;
height: 20px;
-<API key>: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
border: 4px solid #8d8d6e;
margin-left: -3px;
}
|
package com.jvm_bloggers.core.data_fetching.blog_posts;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.routing.RoundRobinPool;
import com.jvm_bloggers.core.data_fetching.blogs.<API key>;
import com.jvm_bloggers.core.rss.SyndFeedProducer;
import com.jvm_bloggers.entities.blog.Blog;
import com.jvm_bloggers.entities.blog.BlogRepository;
import com.jvm_bloggers.entities.metadata.Metadata;
import com.jvm_bloggers.entities.metadata.MetadataKeys;
import com.jvm_bloggers.entities.metadata.MetadataRepository;
import com.jvm_bloggers.utils.NowProvider;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@Component
@NoArgsConstructor
public class BlogPostsFetcher {
private BlogRepository blogRepository;
private ActorRef rssCheckingActor;
private MetadataRepository metadataRepository;
private NowProvider nowProvider;
private <API key> <API key>
= new <API key>();
@Autowired
public BlogPostsFetcher(ActorSystem actorSystem, BlogRepository blogRepository,
BlogPostService blogPostService,
SyndFeedProducer syndFeedFactory,
MetadataRepository metadataRepository,
NowProvider nowProvider) {
this.blogRepository = blogRepository;
final ActorRef <API key> = actorSystem
.actorOf(<API key>.props(blogPostService));
rssCheckingActor = actorSystem.actorOf(new RoundRobinPool(10)
.props(RssCheckingActor.props(<API key>, syndFeedFactory)), "rss-checkers");
this.metadataRepository = metadataRepository;
this.nowProvider = nowProvider;
}
void refreshPosts() {
<API key>.<API key>(this::<API key>);
}
@Async("<API key>")
public void <API key>() {
refreshPosts();
}
private Void <API key>() {
blogRepository.findAllActiveBlogs()
.filter(Blog::isActive)
.forEach(person -> rssCheckingActor.tell(new RssLink(person), ActorRef.noSender()));
final Metadata dateOfLastFetch = metadataRepository
.findByName(MetadataKeys.<API key>);
dateOfLastFetch.setValue(nowProvider.now().toString());
metadataRepository.save(dateOfLastFetch);
return null;
}
public boolean <API key>() {
return <API key>.isExecuting();
}
}
|
'use strict';
require('../common');
// This test ensures that zlib throws a RangeError if the final buffer needs to
// be larger than kMaxLength and concatenation fails.
const assert = require('assert');
// Change kMaxLength for zlib to trigger the error without having to allocate
// large Buffers.
const buffer = require('buffer');
const oldkMaxLength = buffer.kMaxLength;
buffer.kMaxLength = 64;
const zlib = require('zlib');
buffer.kMaxLength = oldkMaxLength;
const encoded = Buffer.from('G38A+CXCIrFAIAM=', 'base64');
// Async
zlib.brotliDecompress(encoded, function(err) {
assert.ok(err instanceof RangeError);
});
// Sync
assert.throws(function() {
zlib.<API key>(encoded);
}, RangeError);
|
const {<API key>} = require('../../utils');
module.exports = <API key>('posts_meta', 'email_only', {
type: 'bool',
nullable: false,
defaultTo: false
});
|
import { EventsKey } from '../events';
import BaseEvent from '../events/Event';
import { Extent } from '../extent';
import Feature from '../Feature';
import Geometry from '../geom/Geometry';
import Point from '../geom/Point';
import { ObjectEvent } from '../Object';
import Projection from '../proj/Projection';
import { AttributionLike } from './Source';
import VectorSource, { VectorSourceEvent } from './Vector';
export interface Options {
attributions?: AttributionLike;
distance?: number;
geometryFunction?: (p0: Feature<Geometry>) => Point;
source?: VectorSource<Geometry>;
wrapX?: boolean;
}
export default class Cluster extends VectorSource {
constructor(options: Options);
protected distance: number;
protected features: Feature<Geometry>[];
protected geometryFunction: (feature: Feature<Geometry>) => Point;
protected resolution: number;
protected cluster(): void;
protected createCluster(features: Feature<Geometry>[]): Feature<Geometry>;
/**
* Remove all features from the source.
*/
clear(opt_fast?: boolean): void;
/**
* Get the distance in pixels between clusters.
*/
getDistance(): number;
getResolutions(): number[] | undefined;
/**
* Get a reference to the wrapped source.
*/
getSource(): VectorSource<Geometry>;
loadFeatures(extent: Extent, resolution: number, projection: Projection): void;
/**
* Handle the source changing.
*/
refresh(): void;
/**
* Set the distance in pixels between clusters.
*/
setDistance(distance: number): void;
/**
* Replace the wrapped source.
*/
setSource(source: VectorSource<Geometry>): void;
on(type: string | string[], listener: (p0: any) => any): EventsKey | EventsKey[];
once(type: string | string[], listener: (p0: any) => any): EventsKey | EventsKey[];
un(type: string | string[], listener: (p0: any) => any): void;
on(type: 'addfeature', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
once(type: 'addfeature', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
un(type: 'addfeature', listener: (evt: VectorSourceEvent<Geometry>) => void): void;
on(type: 'change', listener: (evt: BaseEvent) => void): EventsKey;
once(type: 'change', listener: (evt: BaseEvent) => void): EventsKey;
un(type: 'change', listener: (evt: BaseEvent) => void): void;
on(type: 'changefeature', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
once(type: 'changefeature', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
un(type: 'changefeature', listener: (evt: VectorSourceEvent<Geometry>) => void): void;
on(type: 'clear', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
once(type: 'clear', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
un(type: 'clear', listener: (evt: VectorSourceEvent<Geometry>) => void): void;
on(type: 'error', listener: (evt: BaseEvent) => void): EventsKey;
once(type: 'error', listener: (evt: BaseEvent) => void): EventsKey;
un(type: 'error', listener: (evt: BaseEvent) => void): void;
on(type: 'featuresloadend', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
once(type: 'featuresloadend', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
un(type: 'featuresloadend', listener: (evt: VectorSourceEvent<Geometry>) => void): void;
on(type: 'featuresloaderror', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
once(type: 'featuresloaderror', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
un(type: 'featuresloaderror', listener: (evt: VectorSourceEvent<Geometry>) => void): void;
on(type: 'featuresloadstart', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
once(type: 'featuresloadstart', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
un(type: 'featuresloadstart', listener: (evt: VectorSourceEvent<Geometry>) => void): void;
on(type: 'propertychange', listener: (evt: ObjectEvent) => void): EventsKey;
once(type: 'propertychange', listener: (evt: ObjectEvent) => void): EventsKey;
un(type: 'propertychange', listener: (evt: ObjectEvent) => void): void;
on(type: 'removefeature', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
once(type: 'removefeature', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey;
un(type: 'removefeature', listener: (evt: VectorSourceEvent<Geometry>) => void): void;
}
|
<?php
require_once($argv[1]); // type.php
require_once($argv[2]); // program.php
$file_prefix = $argv[3];
?>
[apps..default]
run = true
count = 1
network.server.0.RPC_CHANNEL_TCP = NET_HDR_HTTP, dsn::tools::<API key>, 65536
[apps.server]
name = server
type = server
arguments =
ports = 27001
run = true
pools = THREAD_POOL_DEFAULT
[apps.client]
name = client
type = client
arguments = localhost 27001
count = 0
run = true
pools = THREAD_POOL_DEFAULT
<?php foreach ($_PROG->services as $svc) { ?>
[apps.client.perf.<?=$svc->name?>]
name = client.perf.<?=$svc->name?>
type = client.perf.<?=$svc->name?>
arguments = localhost 27001
count = 1
run = false
<?php } ?>
[core]
;tool = simulator
tool = nativerun
;toollets = tracer
;toollets = tracer, profiler, fault_injector
pause_on_start = false
<API key> = dsn::tools::screen_logger
[tools.simulator]
random_seed = 0
[network]
; how many network threads for network library(used by asio)
<API key> = 2
; specification for each thread pool
[threadpool..default]
[threadpool.THREAD_POOL_DEFAULT]
name = default
partitioned = false
worker_count = 1
<API key> = 1024
worker_priority = <API key>
[task..default]
is_trace = true
is_profile = true
allow_inline = false
rpc_call_channel = RPC_CHANNEL_TCP
<API key> = false
<API key> = dsn
<API key> = 5000
perf_test_rounds = 10000
<API key> = NET_HDR_HTTP
[task.<API key>]
is_trace = false
is_profile = false
allow_inline = false
[task.LPC_RPC_TIMEOUT]
is_trace = false
is_profile = false
|
package tenant
import (
"context"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/influxdata/influxdb/v2"
influxdbcontext "github.com/influxdata/influxdb/v2/context"
"github.com/influxdata/influxdb/v2/kit/feature"
"github.com/influxdata/influxdb/v2/kit/platform"
"github.com/influxdata/influxdb/v2/kit/platform/errors"
kithttp "github.com/influxdata/influxdb/v2/kit/transport/http"
"github.com/influxdata/influxdb/v2/mock"
influxdbtesting "github.com/influxdata/influxdb/v2/testing"
)
var idOne platform.ID = 1
var idTwo platform.ID = 2
var idThree platform.ID = 3
func <API key>(t *testing.T) {
type fields struct {
<API key> influxdb.<API key>
OrgService influxdb.OrganizationService
}
type args struct {
permissions []influxdb.Permission
}
type wants struct {
err error
urms []*influxdb.UserResourceMapping
}
tests := []struct {
name string
fields fields
args args
wants wants
}{
{
name: "authorized to see all users",
fields: fields{
<API key>: &mock.<API key>{
FindMappingsFn: func(ctx context.Context, filter influxdb.<API key>) ([]*influxdb.UserResourceMapping, int, error) {
return []*influxdb.UserResourceMapping{
{
ResourceID: 1,
ResourceType: influxdb.BucketsResourceType,
},
{
ResourceID: 2,
ResourceType: influxdb.BucketsResourceType,
},
{
ResourceID: 3,
ResourceType: influxdb.BucketsResourceType,
},
}, 3, nil
},
},
},
args: args{
permissions: []influxdb.Permission{
{
Action: "read",
Resource: influxdb.Resource{
Type: influxdb.OrgsResourceType,
ID: influxdbtesting.IDPtr(10),
},
},
{
Action: "read",
Resource: influxdb.Resource{
Type: influxdb.BucketsResourceType,
// ID: &idOne,
OrgID: influxdbtesting.IDPtr(10),
},
},
{
Action: "read",
Resource: influxdb.Resource{
Type: influxdb.BucketsResourceType,
OrgID: influxdbtesting.IDPtr(10),
},
},
{
Action: "read",
Resource: influxdb.Resource{
Type: influxdb.BucketsResourceType,
OrgID: influxdbtesting.IDPtr(10),
},
},
},
},
wants: wants{
urms: []*influxdb.UserResourceMapping{
{
ResourceID: 1,
ResourceType: influxdb.BucketsResourceType,
},
{
ResourceID: 2,
ResourceType: influxdb.BucketsResourceType,
},
{
ResourceID: 3,
ResourceType: influxdb.BucketsResourceType,
},
},
},
},
{
name: "authorized to see all users by org auth",
fields: fields{
<API key>: &mock.<API key>{
FindMappingsFn: func(ctx context.Context, filter influxdb.<API key>) ([]*influxdb.UserResourceMapping, int, error) {
return []*influxdb.UserResourceMapping{
{
ResourceID: 1,
ResourceType: influxdb.BucketsResourceType,
},
{
ResourceID: 2,
ResourceType: influxdb.BucketsResourceType,
},
{
ResourceID: 3,
ResourceType: influxdb.BucketsResourceType,
},
}, 3, nil
},
},
},
args: args{
permissions: []influxdb.Permission{
{
Action: "read",
Resource: influxdb.Resource{
Type: influxdb.BucketsResourceType,
OrgID: influxdbtesting.IDPtr(10),
},
},
},
},
wants: wants{
err: ErrNotFound,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := NewAuthedURMService(tt.fields.OrgService, tt.fields.<API key>)
orgID := influxdbtesting.IDPtr(10)
ctx := context.WithValue(context.Background(), kithttp.CtxOrgKey, *orgID)
ctx = influxdbcontext.SetAuthorizer(ctx, mock.NewMockAuthorizer(false, tt.args.permissions))
ctx, _ = feature.Annotate(ctx, feature.DefaultFlagger(), feature.MakeBoolFlag("Org Only Member list",
"orgOnlyMemberList",
"Compute Team",
true,
feature.Temporary,
false,
))
urms, _, err := s.<API key>(ctx, influxdb.<API key>{})
influxdbtesting.ErrorsEqual(t, err, tt.wants.err)
if diff := cmp.Diff(urms, tt.wants.urms); diff != "" {
t.Errorf("urms are different -got/+want\ndiff %s", diff)
}
})
}
}
func <API key>(t *testing.T) {
type fields struct {
<API key> influxdb.<API key>
OrgService influxdb.OrganizationService
}
type args struct {
permissions []influxdb.Permission
}
type wants struct {
err error
urms []*influxdb.UserResourceMapping
}
tests := []struct {
name string
fields fields
args args
wants wants
}{
{
name: "authorized to see all users by bucket auth",
fields: fields{
<API key>: &mock.<API key>{
FindMappingsFn: func(ctx context.Context, filter influxdb.<API key>) ([]*influxdb.UserResourceMapping, int, error) {
return []*influxdb.UserResourceMapping{
{
ResourceID: 1,
ResourceType: influxdb.BucketsResourceType,
},
{
ResourceID: 2,
ResourceType: influxdb.BucketsResourceType,
},
{
ResourceID: 3,
ResourceType: influxdb.BucketsResourceType,
},
}, 3, nil
},
},
},
args: args{
permissions: []influxdb.Permission{
{
Action: "read",
Resource: influxdb.Resource{
Type: influxdb.BucketsResourceType,
ID: &idOne,
},
},
{
Action: "read",
Resource: influxdb.Resource{
Type: influxdb.BucketsResourceType,
ID: &idTwo,
},
},
{
Action: "read",
Resource: influxdb.Resource{
Type: influxdb.BucketsResourceType,
ID: &idThree,
},
},
},
},
wants: wants{
urms: []*influxdb.UserResourceMapping{
{
ResourceID: 1,
ResourceType: influxdb.BucketsResourceType,
},
{
ResourceID: 2,
ResourceType: influxdb.BucketsResourceType,
},
{
ResourceID: 3,
ResourceType: influxdb.BucketsResourceType,
},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := NewAuthedURMService(tt.fields.OrgService, tt.fields.<API key>)
ctx := context.Background()
ctx = influxdbcontext.SetAuthorizer(ctx, mock.NewMockAuthorizer(false, tt.args.permissions))
urms, _, err := s.<API key>(ctx, influxdb.<API key>{})
influxdbtesting.ErrorsEqual(t, err, tt.wants.err)
if diff := cmp.Diff(urms, tt.wants.urms); diff != "" {
t.Errorf("urms are different -got/+want\ndiff %s", diff)
}
})
}
}
func <API key>(t *testing.T) {
type fields struct {
<API key> influxdb.<API key>
OrgService influxdb.OrganizationService
}
type args struct {
permission influxdb.Permission
}
type wants struct {
err error
}
tests := []struct {
name string
fields fields
args args
wants wants
}{
{
name: "authorized to write urm",
fields: fields{
<API key>: &mock.<API key>{
CreateMappingFn: func(ctx context.Context, m *influxdb.UserResourceMapping) error {
return nil
},
DeleteMappingFn: func(ctx context.Context, rid, uid platform.ID) error {
return nil
},
FindMappingsFn: func(ctx context.Context, filter influxdb.<API key>) ([]*influxdb.UserResourceMapping, int, error) {
return []*influxdb.UserResourceMapping{
{
ResourceID: 1,
ResourceType: influxdb.BucketsResourceType,
UserID: 100,
},
}, 3, nil
},
},
},
args: args{
permission: influxdb.Permission{
Action: "write",
Resource: influxdb.Resource{
Type: influxdb.BucketsResourceType,
ID: &idOne,
OrgID: influxdbtesting.IDPtr(10),
},
},
},
wants: wants{
err: nil,
},
},
{
name: "unauthorized to write urm",
fields: fields{
<API key>: &mock.<API key>{
CreateMappingFn: func(ctx context.Context, m *influxdb.UserResourceMapping) error {
return nil
},
DeleteMappingFn: func(ctx context.Context, rid, uid platform.ID) error {
return nil
},
FindMappingsFn: func(ctx context.Context, filter influxdb.<API key>) ([]*influxdb.UserResourceMapping, int, error) {
return []*influxdb.UserResourceMapping{
{
ResourceID: 1,
ResourceType: influxdb.BucketsResourceType,
UserID: 100,
},
}, 3, nil
},
},
},
args: args{
permission: influxdb.Permission{
Action: "write",
Resource: influxdb.Resource{
Type: influxdb.BucketsResourceType,
OrgID: influxdbtesting.IDPtr(11),
},
},
},
wants: wants{
err: &errors.Error{
Msg: "write:buckets/0000000000000001 is unauthorized",
Code: errors.EUnauthorized,
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := NewAuthedURMService(tt.fields.OrgService, tt.fields.<API key>)
ctx := context.Background()
ctx = influxdbcontext.SetAuthorizer(ctx, mock.NewMockAuthorizer(false, []influxdb.Permission{tt.args.permission}))
t.Run("create urm", func(t *testing.T) {
err := s.<API key>(ctx, &influxdb.UserResourceMapping{ResourceType: influxdb.BucketsResourceType, ResourceID: 1})
influxdbtesting.ErrorsEqual(t, err, tt.wants.err)
})
t.Run("delete urm", func(t *testing.T) {
err := s.<API key>(ctx, 1, 100)
influxdbtesting.ErrorsEqual(t, err, tt.wants.err)
})
})
}
}
|
package com.lichkin.framework.springboot.controllers.impl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.lichkin.framework.bases.LKDatas;
import com.lichkin.framework.bases.annotations.WithOutLogin;
import com.lichkin.framework.springboot.controllers.LKController;
/**
*
* @author SuZhou LichKin Information Technology Co., Ltd.
*/
@Controller
@RequestMapping(value = "/demo")
public class LKDemoController extends LKController {
/**
*
* @param requestDatas
* @param subUrl
* @return
*/
@WithOutLogin
@RequestMapping(value = "/{subUrl}.html", method = RequestMethod.GET)
public ModelAndView toGo(final LKDatas requestDatas, @PathVariable(value = "subUrl") final String subUrl) {
return getModelAndView(requestDatas);
}
}
|
//currently commented out as TokenTester is causing a OOG error due to the Factory being too big
//Not fully needed as factory & separate tests cover token creation.
/*contract("TokenTester", function(accounts) {
it("creates 10000 initial tokens", function(done) {
var tester = TokenTester.at(TokenTester.deployed_address);
tester.<API key>.call()
.then(function(tokenContractAddr) {
var tokenContract = HumanStandardToken.at(tokenContractAddr);
return tokenContract.balanceOf.call(TokenTester.deployed_address);
}).then(function (result) {
assert.strictEqual(result.toNumber(), 10000); // 10000 as specified in TokenTester.sol
done();
}).catch(done);
});
//todo:add test on retrieving addresses
});*/
|
module.exports = {
"extends": "airbnb",
"parser": "babel-eslint",
"plugins": [
"react"
],
"rules": {
"react/prop-types": 0,
"react/jsx-boolean-value": 0,
"consistent-return": 0,
"guard-for-in": 0,
"<API key>": 0,
"<API key>": [2, { "anonymous": "never", "named": "always" }]
}
};
|
package au.com.codeka.planetrender;
import java.util.Random;
import au.com.codeka.common.PerlinNoise;
import au.com.codeka.common.Vector2;
import au.com.codeka.common.Vector3;
/**
* This class takes a ray that's going in a certain direction and warps it based on a noise pattern. This is used
* to generate misshapen asteroid images, for example.
*/
public class RayWarper {
private NoiseGenerator mNoiseGenerator;
private double mWarpFactor;
public RayWarper(Template.WarpTemplate tmpl, Random rand) {
if (tmpl.getNoiseGenerator() == Template.WarpTemplate.NoiseGenerator.Perlin) {
mNoiseGenerator = new PerlinGenerator(tmpl, rand);
} else if (tmpl.getNoiseGenerator() == Template.WarpTemplate.NoiseGenerator.Spiral) {
mNoiseGenerator = new SpiralGenerator(tmpl, rand);
}
mWarpFactor = tmpl.getWarpFactor();
}
public void warp(Vector3 vec, double u, double v) {
mNoiseGenerator.warp(vec, u, v, mWarpFactor);
}
static abstract class NoiseGenerator {
protected double getNoise(double u, double v) {
return 0.0;
}
protected Vector3 getValue(double u, double v) {
double x = getNoise(u * 0.25, v * 0.25);
double y = getNoise(0.25 + u * 0.25, v * 0.25);
double z = getNoise(u * 0.25, 0.25 + v * 0.25);
return Vector3.pool.borrow().reset(x, y, z);
}
protected void warp(Vector3 vec, double u, double v, double factor) {
Vector3 warpVector = getValue(u, v);
warpVector.reset(warpVector.x * factor + (1.0 - factor),
warpVector.y * factor + (1.0 - factor),
warpVector.z * factor + (1.0 - factor));
vec.reset(vec.x * warpVector.x,
vec.y * warpVector.y,
vec.z * warpVector.z);
Vector3.pool.release(warpVector);
}
}
static class PerlinGenerator extends NoiseGenerator {
private PerlinNoise mNoise;
public PerlinGenerator(Template.WarpTemplate tmpl, Random rand) {
mNoise = new <API key>(tmpl.getParameter(Template.PerlinNoiseTemplate.class), rand);
}
@Override
public double getNoise(double u, double v) {
return mNoise.getNoise(u, v);
}
}
static class SpiralGenerator extends NoiseGenerator {
public SpiralGenerator(Template.WarpTemplate tmpl, Random rand) {
}
@Override
protected void warp(Vector3 vec, double u, double v, double factor) {
Vector2 uv = Vector2.pool.borrow().reset(u, v);
uv.rotate(factor * uv.length() * 2.0 * Math.PI * 2.0 / 360.0);
vec.reset(uv.x, -uv.y, 1.0);
Vector2.pool.release(uv);
}
}
}
|
body { overflow-x: hidden; font-family: "Roboto Slab", "Helvetica Neue", Helvetica, Arial, sans-serif }
.text-muted { color: #777 }
.text-primary { color: #fed136 }
p { font-size: 14px; line-height: 1.75 }
p.large { font-size: 16px }
a, a:hover, a:focus, a:active, a.active { outline: 0 }
a { color: #fed136 }
a:hover, a:focus, a:active, a.active { color: #fec503 }
h1, h2, h3, h4, h5, h6 { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700 }
.img-centered { margin: 0 auto }
.bg-light-gray { background-color: #f7f7f7 }
.bg-darkest-gray { background-color: #222 }
.btn-primary { color: #fff; background-color: #fed136; border-color: #fed136; font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700 }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active, .open .dropdown-toggle.btn-primary { color: #fff; background-color: #fec503; border-color: #f6bf01 }
.btn-primary:active, .btn-primary.active, .open .dropdown-toggle.btn-primary { background-image: none }
.btn-primary.disabled, .btn-primary[disabled], fieldset[disabled] .btn-primary, .btn-primary.disabled:hover, .btn-primary[disabled]:hover, fieldset[disabled] .btn-primary:hover, .btn-primary.disabled:focus, .btn-primary[disabled]:focus, fieldset[disabled] .btn-primary:focus, .btn-primary.disabled:active, .btn-primary[disabled]:active, fieldset[disabled] .btn-primary:active, .btn-primary.disabled.active, .btn-primary[disabled].active, fieldset[disabled] .btn-primary.active { background-color: #fed136; border-color: #fed136 }
.btn-primary .badge { color: #fed136; background-color: #fff }
.btn-xl { color: #fff; background-color: #fed136; border-color: #fed136; font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700; border-radius: 3px; font-size: 18px; padding: 20px 40px; margin-top: 110px }
.btn-xl:hover, .btn-xl:focus, .btn-xl:active, .btn-xl.active, .open .dropdown-toggle.btn-xl { color: #fff; background-color: #fec503; border-color: #f6bf01 }
.btn-xl:active, .btn-xl.active, .open .dropdown-toggle.btn-xl { background-image: none }
.btn-xl.disabled, .btn-xl[disabled], fieldset[disabled] .btn-xl, .btn-xl.disabled:hover, .btn-xl[disabled]:hover, fieldset[disabled] .btn-xl:hover, .btn-xl.disabled:focus, .btn-xl[disabled]:focus, fieldset[disabled] .btn-xl:focus, .btn-xl.disabled:active, .btn-xl[disabled]:active, fieldset[disabled] .btn-xl:active, .btn-xl.disabled.active, .btn-xl[disabled].active, fieldset[disabled] .btn-xl.active { background-color: #fed136; border-color: #fed136 }
.btn-xl .badge { color: #fed136; background-color: #fff }
.navbar-default { background-color: #222; border-color: transparent }
.navbar-default .navbar-brand { color: #fed136; font-family: "Kaushan Script", "Helvetica Neue", Helvetica, Arial, cursive }
.navbar-default .navbar-brand:hover, .navbar-default .navbar-brand:focus, .navbar-default .navbar-brand:active, .navbar-default .navbar-brand.active { color: #fec503 }
.navbar-default .navbar-collapse { border-color: rgba(255, 255, 255, .02) }
.navbar-default .navbar-toggle { background-color: #fed136; border-color: #fed136 }
.navbar-default .navbar-toggle .icon-bar { background-color: #fff }
.navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus { background-color: #fed136 }
.navbar-default .nav li a { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 400; letter-spacing: 1px; color: #fff }
.navbar-default .nav li a:hover, .navbar-default .nav li a:focus { color: #fed136; outline: 0 }
.navbar-default .navbar-nav>.active>a { border-radius: 0; color: #fff; background-color: #fed136 }
.navbar-default .navbar-nav>.active>a:hover, .navbar-default .navbar-nav>.active>a:focus { color: #fff; background-color: #fec503 }
@media (min-width:768px) {
.navbar-default { background-color: transparent; padding: 25px 0; -webkit-transition: padding .3s; -moz-transition: padding .3s; transition: padding .3s; border: 0 }
.navbar-default .navbar-brand { font-size: 2em; -webkit-transition: all .3s; -moz-transition: all .3s; transition: all .3s }
.navbar-default .navbar-nav>.active>a { border-radius: 3px }
.navbar-default.navbar-shrink { background-color: #51749a; padding: 10px 0 }
.navbar-default.navbar-shrink .navbar-brand { font-size: 1.5em }
}
header { background-image: url(../img/header-bg.jpg); background-repeat: none; <API key>: scroll; background-position: center center; -<API key>: cover; -moz-background-size: cover; background-size: cover; -o-background-size: cover; text-align: center; color: #fff }
header .intro-text { padding-top: 100px; padding-bottom: 50px }
header .intro-text .intro-lead-in { font-family: "Droid Serif", "Helvetica Neue", Helvetica, Arial, sans-serif; font-style: italic; font-size: 22px; line-height: 22px; margin-bottom: 25px }
header .intro-text .intro-heading { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 200; font-size: 20px; line-height: 20px; margin-bottom: 15px }
@media (min-width:768px) {
header .intro-text { padding-top: 300px; padding-bottom: 200px }
header .intro-text .intro-lead-in { font-family: "Droid Serif", "Helvetica Neue", Helvetica, Arial, sans-serif; font-style: italic; font-size: 40px; line-height: 40px; margin-bottom: 25px }
header .intro-text .intro-heading { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 200; font-size: 20px; line-height: 20px; margin-bottom: 15px }
}
section { padding: 50px 0 }
section h2.section-heading { font-size: 40px; margin-top: 50px; margin-bottom: 15px }
section h3.section-subheading { font-size: 16px; font-family: "Droid Serif", "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: none; font-style: italic; font-weight: 400; margin-bottom: 75px }
@media (min-width:768px) {
section { padding: 50px 0 }
}
.service-heading { margin: 15px 0; text-transform: none }
.services-text-color { color: #fec503; font-style: bold; font-weight: 700;}
#portfolio .portfolio-item { margin: 0 0 15px; right: 0 }
#portfolio .portfolio-item .portfolio-link { display: block; position: relative; max-width: 400px; margin: 0 auto }
#portfolio .portfolio-item .portfolio-link .portfolio-hover { background: rgba(254, 209, 54, .9); position: absolute; width: 100%; height: 100%; opacity: 0; transition: all ease .5s; -webkit-transition: all ease .5s; -moz-transition: all ease .5s }
#portfolio .portfolio-item .portfolio-link .portfolio-hover:hover { opacity: 1 }
#portfolio .portfolio-item .portfolio-link .portfolio-hover .<API key> { position: absolute; width: 100%; height: 20px; font-size: 20px; text-align: center; top: 50%; margin-top: -12px; color: #fff }
#portfolio .portfolio-item .portfolio-link .portfolio-hover .<API key> i { margin-top: -12px }
#portfolio .portfolio-item .portfolio-link .portfolio-hover .<API key> h3, #portfolio .portfolio-item .portfolio-link .portfolio-hover .<API key> h4 { margin: 0 }
#portfolio .portfolio-item .portfolio-caption { max-width: 400px; margin: 0 auto; background-color: #fff; text-align: center; padding: 25px }
#portfolio .portfolio-item .portfolio-caption h4 { text-transform: none; margin: 0 }
#portfolio .portfolio-item .portfolio-caption p { font-family: "Droid Serif", "Helvetica Neue", Helvetica, Arial, sans-serif; font-style: italic; font-size: 16px; margin: 0 }
#portfolio * { z-index: 2 }
@media (min-width:767px) {
#portfolio .portfolio-item { margin: 0 0 30px }
}
.timeline { list-style: none; padding: 0; position: relative }
.timeline:before { top: 0; bottom: 0; position: absolute; content: ""; width: 2px; background-color: #f1f1f1; left: 40px; margin-left: -1.5px }
.timeline>li { margin-bottom: 50px; position: relative; min-height: 50px }
.timeline>li:before, .timeline>li:after { content: " "; display: table }
.timeline>li:after { clear: both }
.timeline>li .timeline-panel { width: 100%; float: right; padding: 0 20px 0 100px; position: relative; text-align: left }
.timeline>li .timeline-panel:before { border-left-width: 0; border-right-width: 15px; left: -15px; right: auto }
.timeline>li .timeline-panel:after { border-left-width: 0; border-right-width: 14px; left: -14px; right: auto }
.timeline>li .timeline-image { left: 0; margin-left: 0; width: 80px; height: 80px; position: absolute; z-index: 100; background-color: #fed136; color: #fff; border-radius: 100%; border: 7px solid #f1f1f1; text-align: center }
.timeline>li .timeline-image h4 { font-size: 10px; margin-top: 12px; line-height: 14px }
.timeline>li.timeline-inverted>.timeline-panel { float: right; text-align: left; padding: 0 20px 0 100px }
.timeline>li.timeline-inverted>.timeline-panel:before { border-left-width: 0; border-right-width: 15px; left: -15px; right: auto }
.timeline>li.timeline-inverted>.timeline-panel:after { border-left-width: 0; border-right-width: 14px; left: -14px; right: auto }
.timeline>li:last-child { margin-bottom: 0 }
.timeline .timeline-heading h4 { margin-top: 0; color: inherit }
.timeline .timeline-heading h4.subheading { text-transform: none }
.timeline .timeline-body>p, .timeline .timeline-body>ul { margin-bottom: 0 }
@media (min-width:768px) {
.timeline:before { left: 50% }
.timeline>li { margin-bottom: 100px; min-height: 100px }
.timeline>li .timeline-panel { width: 41%; float: left; padding: 0 20px 20px 30px; text-align: right }
.timeline>li .timeline-image { width: 100px; height: 100px; left: 50%; margin-left: -50px }
.timeline>li .timeline-image h4 { font-size: 13px; margin-top: 16px; line-height: 18px }
.timeline>li.timeline-inverted>.timeline-panel { float: right; text-align: left; padding: 0 30px 20px 20px }
}
@media (min-width:992px) {
.timeline>li { min-height: 150px }
.timeline>li .timeline-panel { padding: 0 20px 20px }
.timeline>li .timeline-image { width: 150px; height: 150px; margin-left: -75px }
.timeline>li .timeline-image h4 { font-size: 18px; margin-top: 30px; line-height: 26px }
.timeline>li.timeline-inverted>.timeline-panel { padding: 0 20px 20px }
}
@media (min-width:1200px) {
.timeline>li { min-height: 170px }
.timeline>li .timeline-panel { padding: 0 20px 20px 100px }
.timeline>li .timeline-image { width: 170px; height: 170px; margin-left: -85px }
.timeline>li .timeline-image h4 { margin-top: 40px }
.timeline>li.timeline-inverted>.timeline-panel { padding: 0 100px 20px 20px }
}
.team-member { text-align: center; margin-bottom: 50px }
.team-member img { margin: 0 auto; border: 7px solid #fff }
.team-member h4 { margin-top: 25px; margin-bottom: 0; text-transform: none }
.team-member p { margin-top: 0 }
aside.clients img { margin: 50px auto }
section#contact { background-color: #374e68; }
section#contact .section-heading { color: #fff }
section#contact .form-group { margin-bottom: 25px }
section#contact .form-group input, section#contact .form-group textarea { padding: 20px; }
section#contact .form-group input.form-control { height: auto }
section#contact .form-group textarea.form-control { height: 236px }
section#contact .form-control:focus { border-color: #fed136; box-shadow: none }
section#contact::-<API key> { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700; color: #bbb }
section#contact:-moz-placeholder { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700; color: #bbb }
section#contact::-moz-placeholder { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700; color: #bbb }
section#contact:-<API key> { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700; color: #bbb }
section#contact .text-danger { color: #e74c3c }
footer { padding: 25px 0; text-align: center }
footer span.copyright { line-height: 40px; font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; text-transform: none }
footer ul.quicklinks { margin-bottom: 0; line-height: 40px; font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; text-transform: none }
ul.social-buttons { margin-bottom: 0 }
ul.social-buttons li a { display: block; background-color: #222; height: 40px; width: 40px; border-radius: 100%; font-size: 20px; line-height: 40px; color: #fff; outline: 0; -webkit-transition: all .3s; -moz-transition: all .3s; transition: all .3s }
ul.social-buttons li a:hover, ul.social-buttons li a:focus, ul.social-buttons li a:active { background-color: #fed136 }
.btn:focus, .btn:active, .btn.active, .btn:active:focus { outline: 0 }
.portfolio-modal .modal-content {border-radius:0;background-clip:border-box;-webkit-box-shadow:none;box-shadow:none;border:0;min-height:100%;padding:100px 0;text-align:center}
.portfolio-modal .modal-content h2{margin-bottom:15px;font-size:3em}
.portfolio-modal .modal-content p{margin-bottom:30px}
.portfolio-modal .modal-content p.item-intro { margin: 20px 0 30px; font-family: "Droid Serif", "Helvetica Neue", Helvetica, Arial, sans-serif; font-style: italic; font-size: 16px }
.portfolio-modal .modal-content ul.list-inline { margin-bottom: 30px; margin-top: 0 }
.portfolio-modal .modal-content img { margin-bottom: 30px }
.portfolio-modal .close-modal { position: absolute; width: 75px; height: 75px; background-color: transparent; top: 25px; right: 25px; cursor: pointer }
.portfolio-modal .close-modal:hover { opacity: .3 }
.portfolio-modal .close-modal .lr { height: 75px; width: 1px; margin-left: 35px; background-color: #222; transform: rotate(45deg); -ms-transform: rotate(45deg); -webkit-transform: rotate(45deg); z-index: 1051 }
.portfolio-modal .close-modal .lr .rl { height: 75px; width: 1px; background-color: #222; transform: rotate(90deg); -ms-transform: rotate(90deg); -webkit-transform: rotate(90deg); z-index: 1052 }
.portfolio-modal .modal-backdrop { opacity: 0; display: none }
::-moz-selection { text-shadow: none; background: #fed136 }
::selection { text-shadow: none; background: #fed136 }
img::selection { background: 0 0 }
img::-moz-selection { background: 0 0 }
body { <API key>: #fed136 }
.spacer { margin-top: 20px; }
@media (min-width:768px) {
.spacer { margin-top: 120px; }
}
.alert { font-size: 18px; font-weight: bold; }
section img { max-width: 100%; }
a.sponsor img { margin: 15px; }
.up { color: #33CC00; }
.down { color: #FF6600; }
.has-error { color: #FF6600; }
|
$demoPath = 'C:\Dropbox\GitRepos\<API key>\Testing PowerShell with Pester\Demos'
## Ensure no functions were just copied/pasted into session
Remove-Item Function:\Start-ClusterTest,Function:\Restart-Cluster,Function:\Test-ClusterProblem -ErrorAction Ignore
## Import the ClusterTest module into the session
Import-Module "$demoPath\Introduction\Project 1 - PowerShell Project\ClusterTest.psd1"
## Notice only a single function is exported
Get-Command -Module ClusterTest
## One test from the Start-ClusterTest describe block above.
## Not all of the functions that are referenced inside of Start-ClusterTest are exported.
## FAIL!
describe 'Start-ClusterTest' {
## Create mocks to simply let the function execute and essentially do nothing
mock 'Write-Host'
mock 'Test-ClusterProblem' {
$true
}
mock 'Restart-Cluster' ## Null
it 'tests the correct cluster' {
$assMParams = @{
CommandName = 'Test-ClusterProblem'
Times = 1
Exactly = $true
ParameterFilter = {
$ClusterName -eq 'DOESNOTMATTER'
}
}
Assert-MockCalled @assMParams
}
}
## Mocks must be able to access functions to work. Use InModuleScope
InModuleScope 'ClusterTest' {
describe 'Start-ClusterTest' {
## Create mocks to simply let the function execute and essentially do nothing
mock 'Write-Host'
mock 'Test-ClusterProblem' {
$true
}
mock 'Restart-Cluster'
$result = Start-ClusterTest -ClusterName 'DOESNOTMATTER'
it 'tests the correct cluster' {
$assMParams = @{
CommandName = 'Test-ClusterProblem'
Times = 1
Exactly = $true
ParameterFilter = {
$ClusterName -eq 'DOESNOTMATTER'
}
}
Assert-MockCalled @assMParams
}
}
}
|
// QNFormUpload.h
// QiniuSDK
#import "QNHttpDelegate.h"
#import "QNUpToken.h"
#import "QNUploadManager.h"
#import <Foundation/Foundation.h>
@interface QNFormUpload : NSObject
- (instancetype)initWithData:(NSData *)data
withKey:(NSString *)key
withFileName:(NSString *)fileName
withToken:(QNUpToken *)<API key>:(<API key>)block
withOption:(QNUploadOption *)option
withHttpManager:(id<QNHttpDelegate>)http
withConfiguration:(QNConfiguration *)config;
- (void)put;
@end
|
## AzureResourceSchema
These settings apply only when `--azureresourceschema` is specified on the command line.
AzureResourceSchema multi-api
yaml $(azureresourceschema) && $(multiapi)
batch:
- tag: <API key>
- tag: <API key>
- tag: <API key>
Please also specify `--<API key>=<path to the root directory of your <API key> clone>`.
Tag: <API key> and azureresourceschema
yaml $(tag) == '<API key>' && $(azureresourceschema)
output-folder: $(<API key>)/schemas
# all the input files in this apiVersion
input-file:
- Microsoft.Kubernetes/preview/2021-04-01-preview/connectedClusters.json
Tag: <API key> and azureresourceschema
yaml $(tag) == '<API key>' && $(azureresourceschema)
output-folder: $(<API key>)/schemas
# all the input files in this apiVersion
input-file:
- Microsoft.Kubernetes/stable/2021-03-01/connectedClusters.json
Tag: <API key> and azureresourceschema
yaml $(tag) == '<API key>' && $(azureresourceschema)
output-folder: $(<API key>)/schemas
# all the input files in this apiVersion
input-file:
- Microsoft.Kubernetes/preview/2020-01-01-preview/connectedClusters.json
|
<?php defined('SYSPATH') or die('No direct script access.');
class Jelly_Meta extends Jelly_Core_Meta {}
|
//>>built
define("clipart/SpinInput",["dojo/_base/declare","clipart/_clipart"],function(_1,_2){
return _1("clipart.SpinInput",[_2],{});
});
|
// <API key>.h
// <API key>
// Fade animation and arrow navigation strategy are based on:
// <API key>.h
// <API key>.m
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// all copies or substantial portions of the Software.
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@class <API key>;
/**
* `UIViewController(<API key>)` is a category of `UIViewController` for providing mandatory properties and implementations so that a UIViewController can be used as a child view of `<API key>`.
*/
@interface UIViewController (<API key>)
/**
* When contained as a child in a `<API key>` this property contains a reference to the parent `<API key>`. If the `UIViewController` is not a child of any `<API key>` this property is nil. */
@property (nonatomic, weak) <API key> *<API key>;
/**
* This method is called when a `<API key>` is about to show the called instance of `UIViewController`. The called `UIViewController` can use the parameters to update it's content such that no content will disappear below a toolbar.
*
* @param newInsets The new edge insets.
*/
- (void)adaptToEdgeInsets:(UIEdgeInsets)newInsets;
@end
/**
* This is an enumeration of the supported animation types.
*/
typedef enum {
<API key>,
<API key>,
<API key>,
<API key>
} <API key>;
/**
* This is an enumeration of the supported automated navigation strategies
*/
typedef enum {
<API key>,
<API key>,
<API key>
} <API key>;
/**
* `<API key>` is an iOS control for showing multiple view controller in one view controller and selecting one with a segmented control. Every `<API key>` should be pushed into a `<API key>`.
*/
@interface <API key> : UIViewController
/**
* Provides access to the child view controllers.
*/
@property (nonatomic, strong) NSArray *viewController;
/**
* Used to change the animation type when switching from one view controller to another.
*/
@property (nonatomic, assign) <API key> animationStyle;
/**
* Used to control whether or not the `<API key>` will also show the left and right navigation bar button item of the currently shown child view controller.
*/
@property (nonatomic, assign) BOOL <API key>;
/**
* Used to control whether or not the `<API key>` will also show the toolbar items of the currently shown child view controller.
*/
@property (nonatomic, assign) BOOL <API key>;
/**
* Used to control whether <API key> will auto-create, auto-display, and use a segmented control for navigation.
*/
@property (nonatomic, assign) <API key> navigationStrategy;
/**
* Used to initialize a new `<API key>`.
*
* @param someViewControllers An array of child view controllers.
*
* @return A new `<API key>`.
*/
- (instancetype)<API key>:(NSArray *)someViewControllers;
/**
* Call this method if you want to display a certain child view controller.
*
* @param aViewController The view controller you want to show. This view controller must be an element of the viewController array.
* @param animated Used to enable or disable animations for this change.
*/
- (void)showViewController:(UIViewController *)aViewController animated:(BOOL)animated;
@end
|
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="zh">
<head>
<!-- Generated by javadoc (1.8.0_171) on Mon Apr 22 17:36:00 CST 2019 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>cn.jpush.im.android.api.exceptions (android API)</title>
<meta name="date" content="2019-04-22">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="cn.jpush.im.android.api.exceptions \u7C7B\u5206\u5C42\u7ED3\u6784 (android API)";
}
}
catch(err) {
}
</script>
<noscript>
<div> JavaScript</div>
</noscript>
<div class="topNav"><a name="navbar.top">
</a>
<div class="skipNav"><a href="#skip.navbar.top" title=""></a></div>
<a name="navbar.top.firstrow">
</a>
<ul class="navList" title="">
<li><a href="../../../../../../overview-summary.html"></a></li>
<li><a href="package-summary.html"></a></li>
<li></li>
<li class="navBarCell1Rev"></li>
<li><a href="../../../../../../deprecated-list.html"></a></li>
<li><a href="../../../../../../index-files/index-1.html"></a></li>
<li><a href="../../../../../../help-doc.html"></a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../cn/jpush/im/android/api/event/package-tree.html"></a></li>
<li><a href="../../../../../../cn/jpush/im/android/api/jmrtc/package-tree.html"></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?cn/jpush/im/android/api/exceptions/package-tree.html" target="_top"></a></li>
<li><a href="package-tree.html" target="_top"></a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../allclasses-noframe.html"></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 class="title">cn.jpush.im.android.api.exceptions</h1>
<span class="<API key>">:</span>
<ul class="horizontal">
<li><a href="../../../../../../overview-tree.html"></a></li>
</ul>
</div>
<div class="contentContainer">
<h2 title=""></h2>
<ul>
<li type="circle">java.lang.Object
<ul>
<li type="circle">java.lang.Throwable (implements java.io.Serializable)
<ul>
<li type="circle">java.lang.Exception
<ul>
<li type="circle">cn.jpush.im.android.api.exceptions.<a href="../../../../../../cn/jpush/im/android/api/exceptions/JMessageException.html" title="cn.jpush.im.android.api.exceptions"><span class="typeNameLink">JMessageException</span></a>
<ul>
<li type="circle">cn.jpush.im.android.api.exceptions.<a href="../../../../../../cn/jpush/im/android/api/exceptions/<API key>.html" title="cn.jpush.im.android.api.exceptions"><span class="typeNameLink"><API key></span></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="bottomNav"><a name="navbar.bottom">
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title=""></a></div>
<a name="navbar.bottom.firstrow">
</a>
<ul class="navList" title="">
<li><a href="../../../../../../overview-summary.html"></a></li>
<li><a href="package-summary.html"></a></li>
<li></li>
<li class="navBarCell1Rev"></li>
<li><a href="../../../../../../deprecated-list.html"></a></li>
<li><a href="../../../../../../index-files/index-1.html"></a></li>
<li><a href="../../../../../../help-doc.html"></a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../cn/jpush/im/android/api/event/package-tree.html"></a></li>
<li><a href="../../../../../../cn/jpush/im/android/api/jmrtc/package-tree.html"></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?cn/jpush/im/android/api/exceptions/package-tree.html" target="_top"></a></li>
<li><a href="package-tree.html" target="_top"></a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../allclasses-noframe.html"></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>
</body>
</html>
|
# coding=utf8
## PubNub Real-time Push APIs and Notifications Framework
import sys
from pubnub import PubnubTornado as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
secret_key = len(sys.argv) > 3 and sys.argv[3] or 'demo'
cipher_key = len(sys.argv) > 4 and sys.argv[4] or ''
ssl_on = len(sys.argv) > 5 and bool(sys.argv[5]) or False
## Initiate Pubnub State
pubnub = Pubnub(publish_key=publish_key, subscribe_key=subscribe_key,
secret_key=secret_key, cipher_key=cipher_key, ssl_on=ssl_on)
channel = 'hello_world'
# Asynchronous usage
def callback(message):
print(message)
pubnub.here_now(channel, callback=callback, error=callback)
pubnub.start()
|
using System;
using System.Collections.Concurrent;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Common.Core;
using Microsoft.Common.Core.Logging;
using Microsoft.R.Common.Core.Output;
using static System.FormattableString;
namespace Microsoft.R.Host.Client.BrokerServices {
public class WebServer {
private static <API key><int, WebServer> Servers { get; } = new <API key><int, WebServer>();
private static object _serverLock = new object();
private readonly <API key> _remoteUriService;
private readonly string _baseAddress;
private readonly IActionLog _log;
private readonly IConsole _console;
private readonly string _name;
private HttpListener _listener;
public string LocalHost { get; }
public int LocalPort { get; private set; }
public string RemoteHost { get; }
public int RemotePort { get; }
private WebServer(string remoteHostIp, int remotePort, string baseAddress, string name, IActionLog log, IConsole console) {
_name = name.ToUpperInvariant();
_baseAddress = baseAddress;
_log = log;
_console = console;
LocalHost = IPAddress.Loopback.ToString();
RemoteHost = remoteHostIp;
RemotePort = remotePort;
_remoteUriService = new RemoteUriWebService(baseAddress, log, console);
}
public void Initialize(CancellationToken ct) {
Random r = new Random();
// if remote port is between 10000 and 32000, select a port in the same range.
// R Help uses ports in that range.
int localPortMin = (RemotePort >= 10000 && RemotePort <= 32000) ? 10000 : 49152;
int localPortMax = (RemotePort >= 10000 && RemotePort <= 32000) ? 32000 : 65535;
_console.WriteErrorLine(Resources.<API key>.FormatInvariant(_name));
while (true) {
ct.<API key>();
_listener = new HttpListener();
LocalPort = r.Next(localPortMin, localPortMax);
_listener.Prefixes.Add(Invariant($"http://{LocalHost}:{LocalPort}/"));
try {
_listener.Start();
} catch (<API key>) {
_listener.Close();
continue;
} catch (<API key>) {
// Socket got closed
_log.WriteLine(LogVerbosity.Minimal, MessageCategory.Error, Resources.<API key>.FormatInvariant(_name));
_console.WriteErrorLine(Resources.<API key>.FormatInvariant(_name));
throw new <API key>();
}
break;
}
try {
_log.WriteLine(LogVerbosity.Minimal, MessageCategory.General, Resources.<API key>.FormatInvariant(_name, LocalHost, LocalPort));
_console.WriteErrorLine(Resources.<API key>.FormatInvariant(_name, LocalHost, LocalPort));
_console.WriteErrorLine(Resources.<API key>.FormatInvariant(Environment.MachineName, LocalHost, LocalPort, _name, _baseAddress));
} catch {
}
}
private void Stop() {
try {
if (_listener.IsListening) {
_listener.Stop();
}
_listener.Close();
_log.WriteLine(LogVerbosity.Minimal, MessageCategory.General, Resources.<API key>.FormatInvariant(_name));
_console.WriteErrorLine(Resources.<API key>.FormatInvariant(_name));
} catch (Exception ex) when (!ex.IsCriticalException()) {
}
}
public static void Stop(int port) {
if (Servers.TryRemove(port, out WebServer server)) {
server.Stop();
}
}
public static void StopAll() {
var ports = Servers.Keys.AsArray();
foreach (var port in ports) {
Stop(port);
}
}
private async Task DoWorkAsync(CancellationToken ct = default(CancellationToken)) {
try {
while (_listener.IsListening) {
if (ct.<API key>) {
_listener.Stop();
break;
}
HttpListenerContext context = await _listener.GetContextAsync();
string localUrl = $"{LocalHost}:{LocalPort}";
string remoteUrl = $"{RemoteHost}:{RemotePort}";
_remoteUriService.GetResponseAsync(context, localUrl, remoteUrl, ct).DoNotWait();
}
} catch(Exception ex) {
if (Servers.ContainsKey(RemotePort)) {
// Log only if we expect this web server to be running and it fails.
_log.WriteLine(LogVerbosity.Minimal, MessageCategory.Error, Resources.<API key>.FormatInvariant(_name, ex.Message));
_console.WriteErrorLine(Resources.<API key>.FormatInvariant(_name, ex.Message));
}
} finally {
Stop(RemotePort);
}
}
public static Task<string> <API key>(string remoteUrl, string baseAddress, string name, IActionLog log, IConsole console, CancellationToken ct = default(CancellationToken)) {
var remoteUri = new Uri(remoteUrl);
var localUri = new UriBuilder(remoteUri);
WebServer server;
lock (_serverLock) {
if (!Servers.TryGetValue(remoteUri.Port, out server)) {
server = new WebServer(remoteUri.Host, remoteUri.Port, baseAddress, name, log, console);
server.Initialize(ct);
Servers.TryAdd(remoteUri.Port, server);
}
}
server.DoWorkAsync(ct).DoNotWait();
localUri.Host = server.LocalHost;
localUri.Port = server.LocalPort;
return Task.FromResult(localUri.Uri.ToString());
}
}
}
|
"use strict";
var request = require('request');
var iconv = require('iconv-lite');
var crypto = require('crypto');
var Buffer = require('buffer').Buffer;
/**
* [_parseYouku ]
* @param [type] $url [description]
* @return [type] [description]
*/
module.exports = function($url,callback){
var $matches = $url.match(/id\_([\w=]+)/);
if ($matches&&$matches.length>1){
return _getYouku($matches[1].trim(),callback);
}else{
return null;
}
}
function _getYouku($vid,callback){
var $base = "http://v.youku.com/player/getPlaylist/VideoIDS/";
var $blink = $base+$vid;
var $link = $blink+"/Pf/4/ctype/12/ev/1";
request($link, function(er, response,body) {
if (er)
return callback(er);
var $retval = body;
if($retval){
var $rs = JSON.parse($retval);
request($blink, function(er, response,body) {
if (er)
return callback(er);
var $data = {
'1080Phd3':[],
'hd2':[],
'mp4':[],
'flvhd':[],
'flv':[],
'3gphd':[],
'3gp':[]
};
var $bretval = body;
var $brs = JSON.parse($bretval);
var $rs_data = $rs.data[0];
var $brs_data = $brs.data[0];
if($rs_data.error){
return callback(null, $data['error'] = $rs_data.error);
}
var $streamtypes = $rs_data.streamtypes;
var $streamfileids = $rs_data.streamfileids;
var $seed = $rs_data.seed;
var $segs = $rs_data.segs;
var $ip = $rs_data.ip;
var $bsegs = $brs_data.segs;
var yk_e_result = yk_e('becaf9be', yk_na($rs_data.ep)).split('_');
var $sid = yk_e_result[0], $token = yk_e_result[1];
for(var $key in $segs){
if(in_array($key,$streamtypes)){
var $segs_key_val = $segs[$key];
for(var kk=0;kk<$segs_key_val.length;kk++){
var $v = $segs_key_val[kk];
var $no = $v.no.toString(16).toUpperCase();
if($no.length == 1){
$no ="0"+$no;
}
var $_k = $v.k;
if ((!$_k || $_k == '') || $_k == '-1') {
$_k = $bsegs[$key][kk].k;
}
var $fileId = getFileid($streamfileids[$key],$seed);
$fileId = $fileId.substr(0,8)+$no+$fileId.substr(10);
var m0 = yk_e('bf7e5f01', $sid + '_' + $fileId + '_' + $token);
var m1 = yk_d(m0);
var iconv_result = iconv.decode(new Buffer(m1), 'UTF-8');
if(iconv_result!=""){
var $ep = urlencode(iconv_result);
var $typeArray = [];
$typeArray['flv']= 'flv';
$typeArray['mp4']= 'mp4';
$typeArray['hd2']= 'flv';
$typeArray['3gphd']= 'mp4';
$typeArray['3gp']= 'flv';
$typeArray['hd3']= 'flv';
var $sharpness = [];
$sharpness['flv']= 'flv';
$sharpness['flvhd']= 'flvhd';
$sharpness['mp4']= 'mp4';
$sharpness['hd2']= 'hd2';
$sharpness['3gphd']= '3gphd';
$sharpness['3gp']= '3gp';
$sharpness['hd3']= '1080Phd3';
var $fileType = $typeArray[$key];
$data[$sharpness[$key]][kk] = "http://k.youku.com/player/getFlvPath/sid/"+$sid+"_00/st/"+$fileType+"/fileid/"+$fileId+"?K="+$_k+"&hd=1&myp=0&ts="+((((($v['seconds']+'&ypp=0&ctype=12&ev=1&token=')+$token)+'&oip=')+$ip)+'&ep=')+$ep;
}
}
}
}
$data['coverImg'] = $rs['data'][0]['logo'];
$data['title'] = $rs['data'][0]['title'];
$data['seconds'] = $rs['data'][0]['seconds'];
return callback(null,$data);
});
}else{
return callback(null,null);
}
})
}
function urlencode(str) {
str = (str + '').toString();
return encodeURIComponent(str)
.replace(/!/g, '%21')
.replace(/'/g, '%27')
.replace(/\(/g, '%28')
.replace(/\)/g, '%29')
.replace(/\*/g, '%2A')
.replace(/%20/g, '+');
};
function in_array(needle, haystack, argStrict) {
var key = '',
strict = !! argStrict;
if (strict) {
for (key in haystack) {
if (haystack[key] === needle) {
return true;
}
}
} else {
for (key in haystack) {
if (haystack[key] == needle) {
return true;
}
}
}
return false;
};
//start
function getSid(){
var $sid = new Date().getTime()+(Math.random() * 9001+10000);
return $sid;
}
function getKey($key1,$key2){
var $a = parseInt($key1,16);
var $b = $a ^0xA55AA5A5;
var $b = $b.toString(16);
return $key2+$b;
}
function getFileid($fileId,$seed){
var $mixed = getMixString($seed);
|
namespace org.critterai.interop
{
<summary>
Indicates how an object's unmanaged resources have been allocated and are managed.
</summary>
public enum AllocType : byte
{
<summary>
Unmanaged resources were allocated locally and must be freed locally.
</summary>
Local = 0,
<summary>
Unmanaged resources were allocated by an external library and a call must be made
to the library to free them.
</summary>
External = 1,
<summary>
Unmanaged resources were allocated and are managed by an external library. There is
no local responsiblity to directly free the resources.
</summary>
<remarks>
<para>
Objects of this type are usually allocated and owned by another unmanaged object. So
its resources are freed by its owner when its owner is freed.
</para>
</remarks>
ExternallyManaged = 2
}
}
|
package cn.mutils.app.alipay;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
# Strict mode
When you create a new workspace or an application you have an option to create them in a strict mode using the `--strict` flag.
Enabling this flag initializes your new workspace or application with a few new settings that improve maintainability, help you catch bugs ahead of time.
Additionally, applications that use these stricter settings are easier to statically analyze, which can help the `ng update` command refactor code more safely and precisely when you are updating to future versions of Angular.
Specifically, the `strict` flag does the following:
* Enables [`strict` mode in TypeScript](https://www.typescriptlang.org/tsconfig#strict), as well as other strictness flags recommended by the TypeScript team. Specifically, `<API key>`, `noImplicitReturns`, `<API key>`.
* Turns on strict Angular compiler flags [`strictTemplates`](guide/<API key>#stricttemplates), [`<API key>`](guide/<API key>#<API key>) and [`<API key>`](guide/template-typecheck#<API key>).
* [Bundle size budgets](guide/build#<API key>) have been reduced by ~75%.
You can apply these settings at the workspace and project level.
To create a new workspace and application using the strict mode, run the following command:
<code-example language="sh" class="code-shell">
ng new [project-name] --strict
</code-example>
To create a new application in the strict mode within an existing non-strict workspace, run the following command:
<code-example language="sh" class="code-shell">
ng generate application [project-name] --strict
</code-example>
|
pre {
display: none;
}
table {
font-family: inherit;
font-size: inherit;
border: inherit;
}
#groupparts {
width: 100% !important;
margin-left: auto;
margin-right: auto;
}
#groupparts th {
width: auto !important;
}
table.pgrouptable {
background-color: inherit !important;
}
table.pgrouptable td {
background-color: inherit !important;
border: 0px;
}
table.pgrouptable thead th {
background-color: inherit !important;
border: 0px;
}
|
using System.IO;
using Aspose.Cells;
using System;
namespace Aspose.Cells.Examples.CSharp.Data.Handling
{
public class AddingDataToCells
{
public static void Run()
{
// ExStart:1
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Obtaining the reference of the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Adding a string value to the cell
worksheet.Cells["A1"].PutValue("Hello World");
// Adding a double value to the cell
worksheet.Cells["A2"].PutValue(20.5);
// Adding an integer value to the cell
worksheet.Cells["A3"].PutValue(15);
// Adding a boolean value to the cell
worksheet.Cells["A4"].PutValue(true);
// Adding a date/time value to the cell
worksheet.Cells["A5"].PutValue(DateTime.Now);
// Setting the display format of the date
Style style = worksheet.Cells["A5"].GetStyle();
style.Number = 15;
worksheet.Cells["A5"].SetStyle(style);
// Saving the Excel file
workbook.Save(dataDir + "output.out.xls");
// ExEnd:1
}
}
}
|
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
$page = 'boxgamefile';
$tab = 3;
$isSummary = TRUE;
if (isset($_GET['id']) && is_numeric($_GET['id']))
{
$boxid = $_GET['id'];
}
else
{
exit('Error: BoxID error.');
}
$return = 'boxgamefile.php?id='.urlencode($boxid);
require("../configuration.php");
require("./include.php");
require_once("../includes/func.ssh2.inc.php");
require_once("../libs/phpseclib/Crypt/AES.php");
require_once("../libs/gameinstaller/gameinstaller.php");
$title = T_('Box Game File Repositories');
if (query_numrows( "SELECT `name` FROM `".DBPREFIX."box` WHERE `boxid` = '".$boxid."'" ) == 0)
{
exit('Error: BoxID is invalid.');
}
$rows = query_fetch_assoc( "SELECT * FROM `".DBPREFIX."box` WHERE `boxid` = '".$boxid."' LIMIT 1" );
$games = mysql_query( "SELECT * FROM `".DBPREFIX."game` ORDER BY `game`" );
$aes = new Crypt_AES();
$aes->setKeyLength(256);
$aes->setKey(CRYPT_KEY);
// Get SSH2 Object OR ERROR String
$ssh = newNetSSH2($rows['ip'], $rows['sshport'], $rows['login'], $aes->decrypt($rows['password']));
if (!is_object($ssh))
{
$_SESSION['msg1'] = T_('Connection Error!');
$_SESSION['msg2'] = $ssh;
$_SESSION['msg-type'] = 'error';
}
$gameInstaller = new GameInstaller( $ssh );
include("./bootstrap/header.php");
/**
* Notifications
*/
include("./bootstrap/notifications.php");
?>
<ul class="nav nav-tabs">
<li><a href="boxsummary.php?id=<?php echo $boxid; ?>"><?php echo T_('Summary'); ?></a></li>
<li><a href="boxprofile.php?id=<?php echo $boxid; ?>"><?php echo T_('Profile'); ?></a></li>
<li><a href="boxip.php?id=<?php echo $boxid; ?>"><?php echo T_('IP Addresses'); ?></a></li>
<li><a href="boxserver.php?id=<?php echo $boxid; ?>"><?php echo T_('Servers'); ?></a></li>
<li><a href="boxchart.php?id=<?php echo $boxid; ?>"><?php echo T_('Charts'); ?></a></li>
<li class="active"><a href="boxgamefile.php?id=<?php echo $boxid; ?>"><?php echo T_('Game File Repositories'); ?></a></li>
<li><a href="boxlog.php?id=<?php echo $boxid; ?>"><?php echo T_('Activity Logs'); ?></a></li>
</ul>
<div class="well">
<table id="gamefiles" class="zebra-striped">
<thead>
<tr>
<th><?php echo T_('Game'); ?></th>
<th><?php echo T_('Cache Directory'); ?></th>
<th><?php echo T_('Disk Usage'); ?></th>
<th><?php echo T_('Last Modification'); ?></th>
<th><?php echo T_('Status'); ?></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php
while ($rowsGames = mysql_fetch_assoc($games))
{
$repoCacheInfo = $gameInstaller->getCacheInfo( $rowsGames['cachedir'] );
$gameExists = $gameInstaller->gameExists( $rowsGames['game'] );
?>
<tr>
<td><?php echo htmlspecialchars($rowsGames['game'], ENT_QUOTES); ?></td>
<td><?php echo htmlspecialchars($rowsGames['cachedir'], ENT_QUOTES); ?></td>
<td><?php if ($repoCacheInfo != FALSE) { echo htmlspecialchars($repoCacheInfo['size'], ENT_QUOTES); } else { echo T_('None'); } ?></td>
<td><?php if ($repoCacheInfo != FALSE) { echo @date('l | F j, Y | H:i', $repoCacheInfo['mtime']); } else { echo T_('Never'); } ?></td>
<td><?php
if ($gameExists == FALSE) {
echo "<span class=\"label\">".T_('Game Not Supported')."</span>";
}
else if ($repoCacheInfo == FALSE) {
echo "<span class=\"label label-warning\">".T_('No Cache')."</span>";
}
else if ($repoCacheInfo['status'] == 'Ready') {
echo "<span class=\"label label-success\">Ready</span>";
}
else if ($repoCacheInfo['status'] == 'Aborted') {
echo "<span class=\"label label-important\">Aborted</span>";
}
else {
echo "<span class=\"label label-info\">".htmlspecialchars($repoCacheInfo['status'], ENT_QUOTES)."</span>";
}
?></td>
<td>
<!-- Actions -->
<div style="text-align: center;">
<?php
if ($gameExists)
{
if ( ($repoCacheInfo == FALSE) || ($repoCacheInfo['status'] == 'Aborted') ) {
// No repo OR repo not ready
?>
<a class="btn btn-small" href="#" onclick="doRepoAction('<?php echo $boxid; ?>', '<?php echo $rowsGames['gameid']; ?>', 'makeRepo', '<?php echo T_('create a new cache repository for'); ?>', '<?php echo htmlspecialchars($rowsGames['game'], ENT_QUOTES); ?>')">
<i class="icon-download-alt <?php echo formatIcon(); ?>"></i>
</a>
<?php
}
if ( ($repoCacheInfo != FALSE) && ($repoCacheInfo['status'] != 'Aborted') && ($repoCacheInfo['status'] != 'Ready') ) {
// Operation in progress
?>
<a class="btn btn-small" href="#" onclick="doRepoAction('<?php echo $boxid; ?>', '<?php echo $rowsGames['gameid']; ?>', 'abortOperation', '<?php echo T_('abort current operation for repository'); ?>', '<?php echo htmlspecialchars($rowsGames['game'], ENT_QUOTES); ?>')">
<i class="icon-stop <?php echo formatIcon(); ?>"></i>
</a>
<?php
}
if ( $repoCacheInfo['status'] == 'Ready') {
// Cache Ready
?>
<a class="btn btn-small" href="#" onclick="doRepoAction('<?php echo $boxid; ?>', '<?php echo $rowsGames['gameid']; ?>', 'makeRepo', '<?php echo T_('refresh repository contents for'); ?>', '<?php echo htmlspecialchars($rowsGames['game'], ENT_QUOTES); ?>')">
<i class="icon-repeat <?php echo formatIcon(); ?>"></i>
</a>
<?php
}
}
?>
</div>
</td>
<td>
<!-- Drop Action -->
<div style="text-align: center;">
<?php
if ($gameExists)
{
if ( ($repoCacheInfo != FALSE) && ( ($repoCacheInfo['status'] == 'Aborted') || ($repoCacheInfo['status'] == 'Ready') ) ) {
// Repo exists AND no operation in progress
?>
<a class="btn btn-small" href="#" onclick="doRepoAction('<?php echo $boxid; ?>', '<?php echo $rowsGames['gameid']; ?>', 'deleteRepo', '<?php echo T_('remove cache repository for'); ?>', '<?php echo htmlspecialchars($rowsGames['game'], ENT_QUOTES); ?>')">
<i class="icon-trash <?php echo formatIcon(); ?>"></i>
</a>
<?php
}
}
?>
</div>
</td>
</tr>
<?php
}
?> </tbody>
</table>
<?php
if (mysql_num_rows($games) != 0)
{
?>
<script type="text/javascript">
$(document).ready(function() {
$("#gamefiles").tablesorter({
headers: {
5: {
sorter: false
},
6: {
sorter: false
}
},
sortList: [[0,0]]
});
});
function doRepoAction(boxid, gameid, task, action, game)
{
if (confirm('<?php echo T_('Are you sure you want to'); ?> '+action+' '+game+' ?'))
{
window.location='boxprocess.php?boxid='+boxid+'&gameid='+gameid+'&task='+task;
}
}
</script>
<?php
}
unset($games);
?>
</div>
<?php
include("./bootstrap/footer.php");
?>
|
// FKFlickr<API key>.h
// FlickrKit
// Generated by FKAPIBuilder on 19 Sep, 2014 at 10:49.
// DO NOT MODIFY THIS FILE - IT IS MACHINE GENERATED
#import "FKFlickrAPIMethod.h"
typedef enum {
FKFlickr<API key> = 96, /* The passed signature was invalid. */
FKFlickr<API key> = 97, /* The call required signing but no signature was sent. */
FKFlickr<API key> = 100, /* The API key passed was not valid or has expired. */
FKFlickr<API key> = 105, /* The requested service is temporarily unavailable. */
FKFlickr<API key> = 106, /* The requested operation failed due to a temporary issue. */
FKFlickr<API key> = 111, /* The requested response format was not found. */
FKFlickr<API key> = 112, /* The requested method was not found. */
FKFlickr<API key> = 114, /* The SOAP envelope send in the request could not be parsed. */
FKFlickr<API key> = 115, /* The XML-RPC request document could not be parsed. */
FKFlickr<API key> = 116, /* One or more arguments contained a URL that has been used for abuse on Flickr. */
} FKFlickr<API key>;
/*
Exchange an auth token from the old Authentication API, to an OAuth access token. Calling this method will delete the auth token used to make the request.
Response:
<auth>
<access_token oauth_<API key> oauth_token_<API key> />
</auth>
*/
@interface FKFlickr<API key> : NSObject <FKFlickrAPIMethod>
@end
|
#ifndef _NMSPI_H_
#define _NMSPI_H_
#include "common/include/nm_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @fn nm_spi_init
* @brief Initialize the SPI
* @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
*/
sint8 nm_spi_init(void);
/**
* @fn nm_spi_reset
* @brief reset the SPI
* @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
*/
sint8 nm_spi_reset(void);
/**
* @fn nm_spi_deinit
* @brief DeInitialize the SPI
* @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
*/
sint8 nm_spi_deinit(void);
/**
* @fn nm_spi_read_reg
* @brief Read register
* @param [in] u32Addr
* Register address
* @return Register value
*/
uint32 nm_spi_read_reg(uint32 u32Addr);
/**
* @fn <API key>
* @brief Read register with error code return
* @param [in] u32Addr
* Register address
* @param [out] pu32RetVal
* Pointer to u32 variable used to return the read value
* @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
*/
sint8 <API key>(uint32 u32Addr, uint32* pu32RetVal);
/**
* @fn nm_spi_write_reg
* @brief write register
* @param [in] u32Addr
* Register address
* @param [in] u32Val
* Value to be written to the register
* @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
*/
sint8 nm_spi_write_reg(uint32 u32Addr, uint32 u32Val);
/**
* @fn nm_spi_read_block
* @brief Read block of data
* @param [in] u32Addr
* Start address
* @param [out] puBuf
* Pointer to a buffer used to return the read data
* @param [in] u16Sz
* Number of bytes to read. The buffer size must be >= u16Sz
* @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
*/
sint8 nm_spi_read_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz);
/**
* @fn nm_spi_write_block
* @brief Write block of data
* @param [in] u32Addr
* Start address
* @param [in] puBuf
* Pointer to the buffer holding the data to be written
* @param [in] u16Sz
* Number of bytes to write. The buffer size must be >= u16Sz
* @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
*/
sint8 nm_spi_write_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz);
#ifdef __cplusplus
}
#endif
#endif /* _NMSPI_H_ */
|
/*plugin styles*/
.visualize { border: 1px solid #ccc; position: relative; background: #fafafa; margin:0 auto 30px auto; }
.visualize canvas { position: absolute; }
.visualize ul, .visualize li { margin: 0; padding: 0; }
/*table title, key elements*/
.visualize .visualize-info { padding: 3px 5px; background: #fafafa; border: 1px solid #ccc; position: absolute; top: -20px; right: 10px; opacity: .8; }
.visualize .visualize-title { display: block; color: #333; margin-bottom: 3px; font-size: 1.1em; }
.visualize ul.visualize-key { list-style: none; }
.visualize ul.visualize-key li { list-style: none; float: left; margin-right: 10px; padding-left: 10px; position: relative; background:none; }
.visualize ul.visualize-key .visualize-key-color { width: 6px; height: 6px; left: 0; position: absolute; top: 50%; margin-top: -3px; }
.visualize ul.visualize-key .visualize-key-label { color: #000; }
/*pie labels*/
.visualize-pie .visualize-labels { list-style: none; }
.visualize-pie .visualize-label-pos, .visualize-pie .visualize-label { position: absolute; margin: 0; padding:0; }
.visualize-pie .visualize-label { display: block; color: #fff; font-weight: bold; font-size: 1em; }
.<API key> .visualize-label { color: #000; font-weight: normal; }
/*line,bar, area labels*/
.visualize-labels-x,.visualize-labels-y { position: absolute; left: 0; top: 0; list-style: none; }
.visualize-labels-x li, .visualize-labels-y li { position: absolute; bottom: 0; background:none; }
.visualize-labels-x li span.label, .visualize-labels-y li span.label { position: absolute; color: #555; }
.visualize-labels-x li span.line, .visualize-labels-y li span.line { position: absolute; border: 0 solid #ccc; }
.visualize-labels-x li { height: 100%; }
.visualize-labels-x li span.label { top: 100%; margin-top: 5px; }
.visualize-labels-x li span.line { border-left-width: 1px; height: 100%; display: block; }
.visualize-labels-x li span.line { border: 0;} /*hide vertical lines on area, line, bar*/
.visualize-labels-y li { width: 100%; }
.visualize-labels-y li span.label { right: 100%; margin-right: 5px; display: block; width: 100px; text-align: right; }
.visualize-labels-y li span.line { border-top-width: 1px; width: 100%; }
.visualize-bar .visualize-labels-x li span.label { width: 100%; text-align: center; }
.ie8 .<API key> { margin-top:0 !important; }
/*tooltips*/
.visualize .chart_tooltip {
padding:6px 7px;
background:#000;
background:url(../img/jquery/visualize_tooltip.png) 0 0 repeat;
margin:3px 4px 0;
-<API key>:5px;
-moz-border-radius:5px;
border-radius:5px;
color:#fff;
font-size:10px;
line-height:normal;
}
|
// <auto-generated/>
#nullable disable
using System.Collections.Generic;
using System.Text.Json;
using Azure.Core;
namespace Azure.Analytics.Synapse.Artifacts.Models
{
public partial class ShopifySource : <API key>
{
void <API key>.Write(Utf8JsonWriter writer)
{
writer.WriteStartObject();
if (Optional.IsDefined(Query))
{
writer.WritePropertyName("query");
writer.WriteObjectValue(Query);
}
if (Optional.IsDefined(QueryTimeout))
{
writer.WritePropertyName("queryTimeout");
writer.WriteObjectValue(QueryTimeout);
}
writer.WritePropertyName("type");
writer.WriteStringValue(Type);
if (Optional.IsDefined(SourceRetryCount))
{
writer.WritePropertyName("sourceRetryCount");
writer.WriteObjectValue(SourceRetryCount);
}
if (Optional.IsDefined(SourceRetryWait))
{
writer.WritePropertyName("sourceRetryWait");
writer.WriteObjectValue(SourceRetryWait);
}
if (Optional.IsDefined(<API key>))
{
writer.WritePropertyName("<API key>");
writer.WriteObjectValue(<API key>);
}
foreach (var item in <API key>)
{
writer.WritePropertyName(item.Key);
writer.WriteObjectValue(item.Value);
}
writer.WriteEndObject();
}
internal static ShopifySource <API key>(JsonElement element)
{
Optional<object> query = default;
Optional<object> queryTimeout = default;
string type = default;
Optional<object> sourceRetryCount = default;
Optional<object> sourceRetryWait = default;
Optional<object> <API key> = default;
IDictionary<string, object> <API key> = default;
Dictionary<string, object> <API key> = new Dictionary<string, object>();
foreach (var property in element.EnumerateObject())
{
if (property.NameEquals("query"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
property.<API key>();
continue;
}
query = property.Value.GetObject();
continue;
}
if (property.NameEquals("queryTimeout"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
property.<API key>();
continue;
}
queryTimeout = property.Value.GetObject();
continue;
}
if (property.NameEquals("type"))
{
type = property.Value.GetString();
continue;
}
if (property.NameEquals("sourceRetryCount"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
property.<API key>();
continue;
}
sourceRetryCount = property.Value.GetObject();
continue;
}
if (property.NameEquals("sourceRetryWait"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
property.<API key>();
continue;
}
sourceRetryWait = property.Value.GetObject();
continue;
}
if (property.NameEquals("<API key>"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
property.<API key>();
continue;
}
<API key> = property.Value.GetObject();
continue;
}
<API key>.Add(property.Name, property.Value.GetObject());
}
<API key> = <API key>;
return new ShopifySource(type, sourceRetryCount.Value, sourceRetryWait.Value, <API key>.Value, <API key>, queryTimeout.Value, query.Value);
}
}
}
|
// This file has been autogenerated.
exports.setEnvironment = function() {
process.env['<API key>'] = '<API key>';
};
exports.scopes = [[function (nock) {
var result =
nock('http://management.azure.com:443')
.get('/subscriptions/<API key>/resourceGroups/nodetestrg/providers/Microsoft.Devices/IotHubs/nodeTestHub/eventHubEndpoints/events/ConsumerGroups/testconsumergroup?api-version=2017-07-01')
.reply(200, "{\"tags\":null,\"id\":\"/subscriptions/<API key>/resourceGroups/nodetestrg/providers/Microsoft.Devices/IotHubs/nodeTestHub\",\"name\":\"testconsumergroup\"}", { 'cache-control': 'no-cache',
pragma: 'no-cache',
'content-length': '173',
'content-type': 'application/json; charset=utf-8',
expires: '-1',
server: 'Microsoft-HTTPAPI/2.0',
'<API key>': '14953',
'x-ms-request-id': '<API key>',
'<API key>': '<API key>',
'<API key>': 'WESTUS:20170502T195224Z:<API key>',
'<API key>': 'max-age=31536000; includeSubDomains',
date: 'Tue, 02 May 2017 19:52:23 GMT',
connection: 'close' });
return result; },
function (nock) {
var result =
nock('https://management.azure.com:443')
.get('/subscriptions/<API key>/resourceGroups/nodetestrg/providers/Microsoft.Devices/IotHubs/nodeTestHub/eventHubEndpoints/events/ConsumerGroups/testconsumergroup?api-version=2017-07-01')
.reply(200, "{\"tags\":null,\"id\":\"/subscriptions/<API key>/resourceGroups/nodetestrg/providers/Microsoft.Devices/IotHubs/nodeTestHub\",\"name\":\"testconsumergroup\"}", { 'cache-control': 'no-cache',
pragma: 'no-cache',
'content-length': '173',
'content-type': 'application/json; charset=utf-8',
expires: '-1',
server: 'Microsoft-HTTPAPI/2.0',
'<API key>': '14953',
'x-ms-request-id': '<API key>',
'<API key>': '<API key>',
'<API key>': 'WESTUS:20170502T195224Z:<API key>',
'<API key>': 'max-age=31536000; includeSubDomains',
date: 'Tue, 02 May 2017 19:52:23 GMT',
connection: 'close' });
return result; }]];
|
## About threex.tweencontrols.js
* NOTES: is it position only ?
* it gives the currentPosition
* it gives the targetPosition
* it gives a transitionDelay
* targetPosition is dynamic
- everytime it changes, test if a tweening is in progress
- if current tweening, don't change the delay
- else put default delay
* which function for the tweening ?
## About size variations
* if focus generation changes, the display size will change too
* could that be handled at the css level
## About dynamic generation based on wikipedia content
* how to query it from wikipedia
* query some info from a page
* query related pages from a page - build from it
* cache all that
* how to build it dynamically
## About threex.<API key>.js
About controls strategy
* i went for a dynamic physics
- it seems hard to controls
- it is hard to predict too
* what about a hardcoded topology
- like a given tree portion will be visualized this way
- with very little freedom, thus very predictive
- a given tree portion got a single visualisation
- switch from a portion to another is just a tweening on top
- it seems possible and seems to be simpler, what about the details
Deterministic visualisation
* without animation for now, as a simplification assumption.
- go for the simplest
* focused node at the center
* children of a node spread around the parent node
- equal angle between each link
- so the parent is included in the computation
* the length of a link is relative to the child node generation
# Nice... how to code it now
* if generation === 1, then position.set(0,0,0)
* the world position of children is set by the parent
* so setting position of each node is only done on a node if it got children
- what is the algo to apply to each node ?
- reccursive function: handle current node and forward to all child
- to handle a node is finding its position in world space
# Pseudo code for computePosition(node)
function computePosition(node){
// special case of focus node position
var isFocusedNode = node.parent !== null ? true : false
if( isFocusedNode ){
node.position.set(0,0,0)
}
// if no children, do nothing more
if( node.children.length === 0 ) continue;
// ... here compute the position of each node
// forward to each child
node.children.forEach(function(child){
computePosition(child)
})
}
**how to compute the position of each child ?**
* is there a node.parent ?
* how many children are there.
var linksCount = node.children.length + (node.parent !== null? 1 : 0)
var deltaAngle = Math.PI*2 / linksCount
var startAngle = 0
if( node.parent !== null ){
var deltaY = node.parent.position.y - node.position.y
var deltaX = node.parent.position.x - node.position.x
startAngle = Math.atan2(deltaY, deltaX)
startAngle += deltaAngle
}
// compute the radius
var radiuses= [0,100, 40]
console.assert(node.generation >= 1 && node.generation < radiuses.length )
var radius = radiuses[node.generation]
var angle = startAngle
node.children.forEach(function(nodeChild){
nodeChild.position.x = Math.cos(angle)*radius
nodeChild.position.y = Math.sin(angle)*radius
angle += deltaAngle
})
|
#pragma once
//! Class for creating undo record for any class with a "Real-World Map Size" property.
//! This is a template class where the template parameter T is the type
//! which supports the real-world map size property. This class must have
//! a method called <API key>(BOOL state).
template <class T> class <API key>: public RestoreObj
{
public:
//! Create a real-world map size undo record
//! \param[in] pObj - the object which supports the undo/redo toggle
//! \param[in] oldState - the state of the real-world map size toggle to restore to.
<API key>(T* pObj, BOOL oldState)
{
mpObj = pObj;
mOldState = oldState;
}
//! \see RestoreObj::Restore
void Restore(int isUndo)
{
if (isUndo)
mpObj-><API key>(mOldState);
}
//! \see RestoreObj::Redo
void Redo()
{
mpObj-><API key>(!mOldState);
}
private:
T* mpObj;
BOOL mOldState;
};
//! The class ID of the real-world scale interface <API key>.
#define RWS_INTERFACE Interface_ID(0x9ff44ef, 0x6c050704)
//! The unique instance of the real worls map size interface
extern CoreExport FPInterfaceDesc <API key>;
//! \brief The commong mix-in interface for setting realWorldMapSize properties on
//! objects and modifiers
//! Details follow here.
//! This class is used with multiple inheritence from a class
//! which exports a "real-world map size" toggle. The class must
//! implement two abstract methods for setting and getting this value.
//! The class must implement the following method:
//! BaseInterface* GetInterface(Interface_ID id)
//! if (id == RWS_INTERFACE)
//! return this;
//! else
//! return FPMixinInterface::GetInterface(id);
//! The client class must add this interface the first time ClassDesc::Create()
//! is called on the class's class descriptor.
//! See maxsdk/samples/objects/boxobj.cpp for an example of the use of this class.
class <API key>: public FPMixinInterface
{
public:
//! Gets the state of the real-world map size toggle
//! \return the current state of the toggle
virtual BOOL <API key>() = 0;
//! Set the real-world map size toggle
//! \param[in] flag - the new value of the toggle
virtual void <API key>(BOOL flag) = 0;
//From FPMixinInterface
//! \see FPMixinInterface::GetDesc
FPInterfaceDesc* GetDesc() { return &<API key>; }
//! Function published properties for real-world map size
enum{ <API key>, <API key>};
// Function Map for Function Publishing System
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.