code stringlengths 5 1.01M | repo_name stringlengths 5 84 | path stringlengths 4 311 | language stringclasses 30 values | license stringclasses 15 values | size int64 5 1.01M | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm, colors
initDir = '../init/'
nlat = 31
nlon = 30
# Dimensions
L = 1.5e7
c0 = 2
timeDim = L / c0 / (60. * 60. * 24)
H = 200
tau_0 = 1.0922666667e-2
delta_T = 1.
sampFreq = 0.35 / 0.06 * 12 # (in year^-1)
# Case definition
muRng = np.array([2.1, 2.5, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95,
3., 3.1, 3.3, 3.7])
#amu0Rng = np.arange(0.1, 0.51, 0.1)
#amu0Rng = np.array([0.2])
amu0Rng = np.array([0.75, 1.])
#epsRng = np.arange(0., 0.11, 0.05)
epsRng = np.array([0.])
sNoise = 'without noise'
# spinup = int(sampFreq * 10)
# timeWin = np.array([0, -1])
spinup = 0
timeWin = np.array([0, int(sampFreq * 1000)])
neof = 1
prefix = 'zc'
simType = '_%deof_seasonal' % (neof,)
indicesDir = '../observables/'
field_h = (1, 'Thermocline depth', r'$h$', 'm', H, r'$h^2$')
field_T = (2, 'SST', 'T', r'$^\circ C$', delta_T, r'$(^\circ C)^2$')
#field_u_A = (3, 'Wind stress due to coupling', r'$u_A$', 'm/s', tau_0)
#field_taux = (4, 'External wind-stress', 'taux', 'm/s', tau_0)
# Indices definition
# Nino3
#nino3Def = ('NINO3', 'nino3')
nino3Def = ('Eastern', 'nino3')
# Nino4
#nino4Def = ('NINO4', 'nino4')
nino4Def = ('Western', 'nino4')
# Field and index choice
fieldDef = field_T
indexDef = nino3Def
#fieldDef = field_h
#indexDef = nino4Def
#fieldDef = field_u_A
#indexDef = nino4Def
#fieldDef = field_taux
#indexDef = nino4Def
fs_default = 'x-large'
fs_latex = 'xx-large'
fs_xlabel = fs_default
fs_ylabel = fs_default
fs_xticklabels = fs_default
fs_yticklabels = fs_default
fs_legend_title = fs_default
fs_legend_labels = fs_default
fs_cbar_label = fs_default
# figFormat = 'eps'
figFormat = 'png'
dpi = 300
for eps in epsRng:
for amu0 in amu0Rng:
for mu in muRng:
postfix = '_mu%04d_amu0%04d_eps%04d' \
% (np.round(mu * 1000, 1), np.round(amu0 * 1000, 1),
np.round(eps * 1000, 1))
resDir = '%s%s%s/' % (prefix, simType, postfix)
indicesPath = '%s/%s' % (indicesDir, resDir)
pltDir = resDir
os.system('mkdir %s %s 2> /dev/null' % (pltDir, indicesPath))
# Read dataset
indexData = np.loadtxt('%s/%s.txt' % (indicesPath, indexDef[1]))
timeND = indexData[:, 0]
timeFull = timeND * timeDim / 365
indexFull = indexData[:, fieldDef[0]] * fieldDef[4]
# Remove spinup
index = indexFull[spinup:]
time = timeFull[spinup:]
nt = time.shape[0]
# Plot time-series
linewidth = 2
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(time[timeWin[0]:timeWin[1]], index[timeWin[0]:timeWin[1]],
linewidth=linewidth)
# plt.title('Time-series of %s averaged over %s\nfor mu = %.4f and eps = %.4f' % (fieldDef[1], indexDef[0], mu, eps))
ax.set_xlabel('years', fontsize=fs_latex)
ax.set_ylabel('%s %s (%s)' \
% (indexDef[0], fieldDef[1], fieldDef[3]),
fontsize=fs_latex)
# ax.set_xlim(0, 250)
# ax.set_ylim(29.70, 30.)
plt.setp(ax.get_xticklabels(), fontsize=fs_xticklabels)
plt.setp(ax.get_yticklabels(), fontsize=fs_yticklabels)
fig.savefig('%s/%s%s%s.png' % (pltDir, indexDef[1], fieldDef[2],
postfix), bbox_inches='tight')
# Get periodogram of zonal wind stress averaged over index
nRAVG = 1
window = np.hamming(nt)
# Get nearest larger power of 2
if np.log2(nt) != int(np.log2(nt)):
nfft = 2**(int(np.log2(nt)) + 1)
else:
nfft = nt
# Get frequencies and shift zero frequency to center
freq = np.fft.fftfreq(nfft, d=1./sampFreq)
freq = np.fft.fftshift(freq)
ts = index - index.mean(0)
# Apply window
tsWindowed = ts * window
# Fourier transform and shift zero frequency to center
fts = np.fft.fft(tsWindowed, nfft, 0)
fts = np.fft.fftshift(fts)
# Get periodogram
perio = np.abs(fts / nt)**2
# Apply running average
perioRAVG = perio.copy()
for iavg in np.arange(nRAVG/2, nfft-nRAVG/2):
perioRAVG[iavg] = perio[iavg-nRAVG/2:iavg+nRAVG/2 + 1].mean()\
/ nRAVG
# Plot
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot(freq, np.log10(perioRAVG), '-k')
# ax.set_xscale('log')
# ax.set_yscale('log')
ax.set_xlim(0, 4)
#ax.set_ylim(0, vmax)
ax.set_xlabel(r'years$^{-1}$', fontsize=fs_latex)
ax.set_ylabel(fieldDef[5], fontsize=fs_latex)
plt.setp(ax.get_xticklabels(), fontsize=fs_xticklabels)
plt.setp(ax.get_yticklabels(), fontsize=fs_yticklabels)
xlim = ax.get_xlim()
ylim = ax.get_ylim()
ax.text(xlim[0] + 0.2 * (xlim[1] - xlim[0]),
ylim[0] + 0.1 * (ylim[1] - ylim[0]),
r'$\mu = %.3f$ %s' % (mu, sNoise), fontsize=32)
# plt.title('Periodogram of %s averaged over %s\nfor mu = %.1f and eps = %.2f' % (fieldDef[1], indexDef[0], mu, eps))
fig.savefig('%s/%s%sPerio%s.%s' \
% (pltDir, indexDef[1], fieldDef[2],
postfix, figFormat),
bbox_inches='tight', dpi=dpi)
| atantet/transferCZ | plot/plot_index_loop_seasonal.py | Python | gpl-2.0 | 5,743 | [
30522,
12324,
9808,
12324,
16371,
8737,
2100,
2004,
27937,
12324,
13523,
24759,
4140,
29521,
1012,
1052,
22571,
10994,
2004,
20228,
2102,
2013,
13523,
24759,
4140,
29521,
12324,
4642,
1010,
6087,
1999,
4183,
4305,
2099,
1027,
1005,
1012,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <iostream>
#include <string>
#include "parser.h"
#include "CLI/wrapper.h"
#include "Libraries/linenoise.h"
#include "CLI/interface.h"
#define HIST_FILENAME ".polyBobHistory"
int main(int argc, char **argv)
{
char* line;
unsigned int promptNb = 1;
char promptMsg[100];
srand(time(NULL));
printLogo();
/* Set the completion callback. This will be called every time the
* user uses the <tab> key. */
linenoiseSetCompletionCallback(completion);
/* Load history from file.*/
linenoiseHistoryLoad(HIST_FILENAME); /* Load the history at startup */
snprintf(promptMsg, 100, "%s[%d]: ", "\033[0m", promptNb);
while((line = linenoise(promptMsg)) != NULL)
{
linenoiseHistoryAdd(line); /* Add to the history. */
linenoiseHistorySave(HIST_FILENAME); /* Save the history on disk. */
/* Do something with the string. */
rmSuperscript(line);
if(line[0] == '/')
parseCommand(&(line[1]));
else if(!strcmp(line, "exit") || !strcmp(line, "quit") || (line[1] == 0 && (line[0] == 'e' || line[0] == 'q')))
break;
else if(line[0] != '\0')
{
simpleParserAPI(line);
}
snprintf(promptMsg, 100, "[%d]: ", ++promptNb);
}
finalProcessing();
return 0;
} | Taiki-San/Polybob | entrypoint.cpp | C++ | bsd-3-clause | 1,286 | [
30522,
1001,
2421,
1026,
2358,
20617,
1012,
1044,
1028,
1001,
2421,
1026,
2358,
19422,
12322,
1012,
1044,
1028,
1001,
2421,
1026,
5164,
1012,
1044,
1028,
1001,
2421,
1026,
2051,
1012,
1044,
1028,
1001,
2421,
1026,
16380,
25379,
1028,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
base64encode.c - modified by David Lazar
Originally:
cencoder.c - c source to a base64 encoding algorithm implementation
This is part of the libb64 project, and has been placed in the public domain.
For details, see http://sourceforge.net/projects/libb64
*/
#include <stddef.h>
#include <stdint.h>
#include "base64encode.h"
void base64_encode_init(base64_encodestate *S) {
S->step = step_A;
S->result = 0;
}
char base64_encode_value(uint8_t value) {
static const char* encoding = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
if (value > 63) return '=';
return encoding[value];
}
ptrdiff_t base64_encode_update(base64_encodestate *S, const uint8_t *data, uint64_t datalen, char *encoded) {
char *encoded_begin = encoded;
const uint8_t *currbyte = data;
const uint8_t *data_end = data + datalen;
uint8_t result;
uint8_t fragment;
result = S->result;
switch (S->step) {
while (1) {
case step_A:
if (currbyte == data_end) {
S->result = result;
S->step = step_A;
return encoded - encoded_begin;
}
fragment = *currbyte++;
result = (fragment & 0x0fc) >> 2;
*encoded++ = base64_encode_value(result);
result = (fragment & 0x003) << 4;
case step_B:
if (currbyte == data_end) {
S->result = result;
S->step = step_B;
return encoded - encoded_begin;
}
fragment = *currbyte++;
result |= (fragment & 0x0f0) >> 4;
*encoded++ = base64_encode_value(result);
result = (fragment & 0x00f) << 2;
case step_C:
if (currbyte == data_end) {
S->result = result;
S->step = step_C;
return encoded - encoded_begin;
}
fragment = *currbyte++;
result |= (fragment & 0x0c0) >> 6;
*encoded++ = base64_encode_value(result);
result = (fragment & 0x03f) >> 0;
*encoded++ = base64_encode_value(result);
}
}
// control flow shouldn't reach here
return encoded - encoded_begin;
}
ptrdiff_t base64_encode_final(base64_encodestate *S, char *encoded) {
char *encoded_begin = encoded;
switch (S->step) {
case step_B:
*encoded++ = base64_encode_value(S->result);
*encoded++ = '=';
*encoded++ = '=';
break;
case step_C:
*encoded++ = base64_encode_value(S->result);
*encoded++ = '=';
break;
case step_A:
break;
}
return encoded - encoded_begin;
}
ptrdiff_t base64_encode(const uint8_t *data, uint64_t datalen, char *encoded) {
ptrdiff_t c = 0;
base64_encodestate S;
base64_encode_init(&S);
c += base64_encode_update(&S, data, datalen, encoded);
c += base64_encode_final(&S, encoded + c);
return c;
}
| lzhouAlan/ccode_test | certifificate/base64encode.c | C | gpl-3.0 | 2,969 | [
30522,
1013,
1008,
2918,
21084,
2368,
16044,
1012,
1039,
1011,
6310,
2011,
2585,
2474,
9057,
2761,
1024,
8292,
15305,
4063,
1012,
1039,
1011,
1039,
3120,
2000,
1037,
2918,
21084,
17181,
9896,
7375,
2023,
2003,
2112,
1997,
1996,
5622,
10322,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
namespace RIAPP.MOD.datadialog {
import utilsMOD = RIAPP.MOD.utils;
import templMOD = RIAPP.MOD.template;
import mvvm = RIAPP.MOD.mvvm;
var utils: utilsMOD.Utils;
RIAPP.global.addOnInitialize((s, args) => {
utils = s.utils;
});
export const enum DIALOG_ACTION { Default = 0, StayOpen = 1 };
export interface IDialogConstructorOptions {
dataContext?: any;
templateID: string;
width?: any;
height?: any;
title?: string;
submitOnOK?: boolean;
canRefresh?: boolean;
canCancel?: boolean;
fn_OnClose?: (dialog: DataEditDialog) => void;
fn_OnOK?: (dialog: DataEditDialog) => number;
fn_OnShow?: (dialog: DataEditDialog) => void;
fn_OnCancel?: (dialog: DataEditDialog) => number;
fn_OnTemplateCreated?: (template: templMOD.Template) => void;
fn_OnTemplateDestroy?: (template: templMOD.Template) => void;
}
export interface IButton {
id: string;
text: string;
'class': string;
click: () => void;
}
interface IDialogOptions {
width: any;
height: any;
title: string;
autoOpen: boolean;
modal: boolean;
close: (event: any, ui: any) => void;
buttons: IButton[];
}
var DLG_EVENTS = {
close: 'close',
refresh: 'refresh'
};
var PROP_NAME = {
dataContext: 'dataContext',
isSubmitOnOK: 'isSubmitOnOK',
width: 'width',
height: 'height',
title: 'title',
canRefresh: 'canRefresh',
canCancel: 'canCancel'
};
export class DataEditDialog extends BaseObject implements templMOD.ITemplateEvents {
private _objId: string;
private _dataContext: any;
private _templateID: string;
private _submitOnOK: boolean;
private _canRefresh: boolean;
private _canCancel: boolean;
private _fn_OnClose: (dialog: DataEditDialog) => void;
private _fn_OnOK: (dialog: DataEditDialog) => number;
private _fn_OnShow: (dialog: DataEditDialog) => void;
private _fn_OnCancel: (dialog: DataEditDialog) => number;
private _fn_OnTemplateCreated: (template: templMOD.Template) => void;
private _fn_OnTemplateDestroy: (template: templMOD.Template) => void;
private _isEditable: RIAPP.IEditable;
private _template: templMOD.Template;
private _$template: JQuery;
private _result: string;
private _options: IDialogOptions;
private _dialogCreated: boolean;
private _fn_submitOnOK: () => RIAPP.IVoidPromise;
private _app: Application;
//save the global's currentSelectable before showing and restore it on dialog's closing
private _currentSelectable: RIAPP.ISelectableProvider;
constructor(app: RIAPP.Application, options: IDialogConstructorOptions) {
super();
var self = this;
options = utils.extend(false, {
dataContext: null,
templateID: null,
width: 500,
height: 350,
title: 'data edit dialog',
submitOnOK: false,
canRefresh: false,
canCancel: true,
fn_OnClose: null,
fn_OnOK: null,
fn_OnShow: null,
fn_OnCancel: null,
fn_OnTemplateCreated: null,
fn_OnTemplateDestroy: null
}, options);
this._objId = 'dlg' + baseUtils.getNewID();
this._app = app;
this._dataContext = options.dataContext;
this._templateID = options.templateID;
this._submitOnOK = options.submitOnOK;
this._canRefresh = options.canRefresh;
this._canCancel = options.canCancel;
this._fn_OnClose = options.fn_OnClose;
this._fn_OnOK = options.fn_OnOK;
this._fn_OnShow = options.fn_OnShow;
this._fn_OnCancel = options.fn_OnCancel;
this._fn_OnTemplateCreated = options.fn_OnTemplateCreated;
this._fn_OnTemplateDestroy = options.fn_OnTemplateDestroy;
this._isEditable = null;
this._template = null;
this._$template = null;
this._result = null;
this._currentSelectable = null;
this._fn_submitOnOK = function () {
var iSubmittable = utils.getSubmittable(self._dataContext);
if (!iSubmittable || !iSubmittable.isCanSubmit) {
//signals immediatly
return utils.createDeferred().resolve();
}
return iSubmittable.submitChanges();
};
this._updateIsEditable();
this._options = {
width: options.width,
height: options.height,
title: options.title,
autoOpen: false,
modal: true,
close: function (event, ui) {
self._onClose();
},
buttons: self._getButtons()
};
this._dialogCreated = false;
this._createDialog();
}
handleError(error: any, source: any): boolean {
var isHandled = super.handleError(error, source);
if (!isHandled) {
return this._app.handleError(error, source);
}
return isHandled;
}
addOnClose(fn: TEventHandler<DataEditDialog, any>, nmspace?: string, context?: BaseObject) {
this._addHandler(DLG_EVENTS.close, fn, nmspace, context);
}
removeOnClose(nmspace?: string) {
this._removeHandler(DLG_EVENTS.close, nmspace);
}
addOnRefresh(fn: TEventHandler<DataEditDialog, { isHandled: boolean; }>, nmspace?: string, context?: BaseObject) {
this._addHandler(DLG_EVENTS.refresh, fn, nmspace, context);
}
removeOnRefresh(nmspace?: string) {
this._removeHandler(DLG_EVENTS.refresh, nmspace);
}
protected _updateIsEditable() {
this._isEditable = utils.getEditable(this._dataContext);
}
protected _createDialog() {
if (this._dialogCreated)
return;
try {
this._template = this._createTemplate();
this._$template = global.$(this._template.el);
global.document.body.appendChild(this._template.el);
(<any>this._$template).dialog(this._options);
this._dialogCreated = true;
}
catch (ex) {
RIAPP.reThrow(ex, this.handleError(ex, this));
}
}
protected _getEventNames() {
var base_events = super._getEventNames();
return [DLG_EVENTS.close, DLG_EVENTS.refresh].concat(base_events);
}
templateLoading(template: templMOD.Template): void {
//noop
}
templateLoaded(template: templMOD.Template): void {
if (this._isDestroyCalled)
return;
if (!!this._fn_OnTemplateCreated) {
this._fn_OnTemplateCreated(template);
}
}
templateUnLoading(template: templMOD.Template): void {
if (!!this._fn_OnTemplateDestroy) {
this._fn_OnTemplateDestroy(template);
}
}
protected _createTemplate() {
return new templMOD.Template({
app: this.app,
templateID: this._templateID,
dataContext: null,
templEvents: this
});
}
protected _destroyTemplate() {
if (!!this._template)
this._template.destroy();
}
protected _getButtons(): IButton[] {
var self = this, buttons = [
{
'id': self._objId + 'Refresh',
'text': localizable.TEXT.txtRefresh,
'class': 'btn btn-info',
'click': function () {
self._onRefresh();
}
},
{
'id': self._objId + 'Ok',
'text': localizable.TEXT.txtOk,
'class': 'btn btn-info',
'click': function () {
self._onOk();
}
},
{
'id': self._objId + 'Cancel',
'text': localizable.TEXT.txtCancel,
'class': 'btn btn-info',
'click': function () {
self._onCancel();
}
}
];
if (!this.canRefresh) {
buttons.shift();
}
if (!this.canCancel) {
buttons.pop();
}
return buttons;
}
protected _getOkButton() {
return $("#" + this._objId + 'Ok');
}
protected _getCancelButton() {
return $("#" + this._objId + 'Cancel');
}
protected _getRefreshButton() {
return $("#" + this._objId + 'Refresh');
}
protected _getAllButtons() {
return [this._getOkButton(), this._getCancelButton(), this._getRefreshButton()];
}
protected _disableButtons(isDisable: boolean) {
var btns = this._getAllButtons();
btns.forEach(function ($btn) {
$btn.prop("disabled", !!isDisable);
});
}
protected _onOk() {
var self = this, canCommit: boolean, action = DIALOG_ACTION.Default;
if (!!this._fn_OnOK) {
action = this._fn_OnOK(this);
}
if (action == DIALOG_ACTION.StayOpen)
return;
if (!this._dataContext) {
self.hide();
return;
}
if (!!this._isEditable)
canCommit = this._isEditable.endEdit();
else
canCommit = true;
if (canCommit) {
if (this._submitOnOK) {
this._disableButtons(true);
var title = this.title;
this.title = localizable.TEXT.txtSubmitting;
var promise = this._fn_submitOnOK();
promise.always(function () {
self._disableButtons(false);
self.title = title;
});
promise.done(function () {
self._result = 'ok';
self.hide();
});
promise.fail(function () {
//resume editing if fn_onEndEdit callback returns false in isOk argument
if (!!self._isEditable) {
if (!self._isEditable.beginEdit()) {
self._result = 'cancel';
self.hide();
}
}
});
}
else {
self._result = 'ok';
self.hide();
}
}
}
protected _onCancel() {
var action = DIALOG_ACTION.Default;
if (!!this._fn_OnCancel) {
action = this._fn_OnCancel(this);
}
if (action == DIALOG_ACTION.StayOpen)
return;
if (!!this._isEditable)
this._isEditable.cancelEdit();
this._result = 'cancel';
this.hide();
}
protected _onRefresh() {
var args = { isHandled: false };
this.raiseEvent(DLG_EVENTS.refresh, args);
if (args.isHandled)
return;
var dctx = this._dataContext;
if (!!dctx) {
if (utils.check.isFunction(dctx.refresh)) {
dctx.refresh();
}
else if (!!dctx._aspect && utils.check.isFunction(dctx._aspect.refresh)) {
dctx._aspect.refresh();
}
}
}
protected _onClose() {
try {
if (this._result != 'ok' && !!this._dataContext) {
if (!!this._isEditable)
this._isEditable.cancelEdit();
if (this._submitOnOK) {
var subm = utils.getSubmittable(this._dataContext);
if (!!subm)
subm.rejectChanges();
}
}
if (!!this._fn_OnClose)
this._fn_OnClose(this);
this.raiseEvent(DLG_EVENTS.close, {});
}
finally {
this._template.dataContext = null;
}
var csel = this._currentSelectable;
this._currentSelectable = null;
setTimeout(function () { global.currentSelectable = csel; csel = null; }, 50);
}
protected _onShow() {
this._currentSelectable = global.currentSelectable;
if (!!this._fn_OnShow) {
this._fn_OnShow(this);
}
}
show() {
var self = this;
self._result = null;
(<any>self._$template).dialog("option", "buttons", this._getButtons());
this._template.dataContext = this._dataContext;
self._onShow();
(<any>self._$template).dialog("open");
}
hide() {
var self = this;
if (!self._$template)
return;
(<any>self._$template).dialog("close");
}
getOption(name: string) {
if (!this._$template)
return undefined;
return (<any>this._$template).dialog('option', name);
}
setOption(name: string, value: any) {
var self = this;
(<any>self._$template).dialog('option', name, value);
}
destroy() {
if (this._isDestroyed)
return;
this._isDestroyCalled = true;
this.hide();
this._destroyTemplate();
this._$template = null;
this._template = null;
this._dialogCreated = false;
this._dataContext = null;
this._fn_submitOnOK = null;
this._isEditable = null;
this._app = null;
super.destroy();
}
get app() { return this._app; }
get dataContext() { return this._dataContext; }
set dataContext(v) {
if (v !== this._dataContext) {
this._dataContext = v;
this._updateIsEditable();
this.raisePropertyChanged(PROP_NAME.dataContext);
}
}
get result() { return this._result; }
get template() { return this._template; }
get isSubmitOnOK() { return this._submitOnOK; }
set isSubmitOnOK(v) {
if (this._submitOnOK !== v) {
this._submitOnOK = v;
this.raisePropertyChanged(PROP_NAME.isSubmitOnOK);
}
}
get width() { return this.getOption('width'); }
set width(v) {
var x = this.getOption('width');
if (v !== x) {
this.setOption('width', v);
this.raisePropertyChanged(PROP_NAME.width);
}
}
get height() { return this.getOption('height'); }
set height(v) {
var x = this.getOption('height');
if (v !== x) {
this.setOption('height', v);
this.raisePropertyChanged(PROP_NAME.height);
}
}
get title() { return this.getOption('title'); }
set title(v) {
var x = this.getOption('title');
if (v !== x) {
this.setOption('title', v);
this.raisePropertyChanged(PROP_NAME.title);
}
}
get canRefresh() { return this._canRefresh; }
set canRefresh(v) {
var x = this._canRefresh;
if (v !== x) {
this._canRefresh = v;
this.raisePropertyChanged(PROP_NAME.canRefresh);
}
}
get canCancel() { return this._canCancel; }
set canCancel(v) {
var x = this._canCancel;
if (v !== x) {
this._canCancel = v;
this.raisePropertyChanged(PROP_NAME.canCancel);
}
}
}
export class DialogVM extends mvvm.BaseViewModel {
_dialogs: { [name: string]: () => DataEditDialog; };
constructor(app: Application) {
super(app);
this._dialogs = {};
}
createDialog(name: string, options: IDialogConstructorOptions) {
var self = this;
//the map stores functions those create dialogs (aka factories)
this._dialogs[name] = function () {
var dialog = new DataEditDialog(self.app, options);
var f = function () {
return dialog;
};
self._dialogs[name] = f;
return f();
};
return this._dialogs[name];
}
showDialog(name: string, dataContext: any) {
var dlg = this.getDialog(name);
if (!dlg)
throw new Error(utils.format('Invalid Dialog name: {0}', name));
dlg.dataContext = dataContext;
dlg.show();
return dlg;
}
getDialog(name: string) {
var factory = this._dialogs[name];
if (!factory)
return null;
return factory();
}
destroy() {
if (this._isDestroyed)
return;
this._isDestroyCalled = true;
var keys = Object.keys(this._dialogs);
keys.forEach(function (key: string) {
this._dialogs[key].destroy();
}, this);
this._dialogs = {};
super.destroy();
}
}
_isModuleLoaded = true;
}
| jmptrader/JRIAppTS | jriappTS/jriappTS/modules/datadialog.ts | TypeScript | mit | 18,511 | [
30522,
3415,
15327,
15544,
29098,
1012,
16913,
1012,
2951,
27184,
8649,
1063,
12324,
21183,
12146,
5302,
2094,
1027,
15544,
29098,
1012,
16913,
1012,
21183,
12146,
1025,
12324,
8915,
8737,
13728,
7716,
1027,
15544,
29098,
1012,
16913,
1012,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
* @copyright Aimeos (aimeos.org), 2018-2022
*/
namespace Aimeos\Admin\JQAdm\Type\Media\Property;
class StandardTest extends \PHPUnit\Framework\TestCase
{
private $context;
private $object;
private $view;
protected function setUp() : void
{
$this->view = \TestHelper::view();
$this->context = \TestHelper::context();
$this->object = new \Aimeos\Admin\JQAdm\Type\Media\Property\Standard( $this->context );
$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context );
$this->object->setAimeos( \TestHelper::getAimeos() );
$this->object->setView( $this->view );
}
protected function tearDown() : void
{
unset( $this->object, $this->view, $this->context );
}
public function testCreate()
{
$result = $this->object->create();
$this->assertStringContainsString( 'media/property', $result );
$this->assertEmpty( $this->view->get( 'errors' ) );
}
public function testCreateException()
{
$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Type\Media\Property\Standard::class )
->setConstructorArgs( array( $this->context, \TestHelper::getTemplatePaths() ) )
->setMethods( array( 'getSubClients' ) )
->getMock();
$object->expects( $this->once() )->method( 'getSubClients' )
->will( $this->throwException( new \RuntimeException() ) );
$object->setView( $this->getViewNoRender() );
$object->create();
}
public function testCopy()
{
$manager = \Aimeos\MShop::create( $this->context, 'media/property/type' );
$param = ['type' => 'unittest', 'id' => $manager->find( 'size', [], 'media' )->getId()];
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
$this->view->addHelper( 'param', $helper );
$result = $this->object->copy();
$this->assertStringContainsString( 'size', $result );
}
public function testCopyException()
{
$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Type\Media\Property\Standard::class )
->setConstructorArgs( array( $this->context, \TestHelper::getTemplatePaths() ) )
->setMethods( array( 'getSubClients' ) )
->getMock();
$object->expects( $this->once() )->method( 'getSubClients' )
->will( $this->throwException( new \RuntimeException() ) );
$object->setView( $this->getViewNoRender() );
$object->copy();
}
public function testDelete()
{
$this->assertNull( $this->getClientMock( ['redirect'], false )->delete() );
}
public function testDeleteException()
{
$object = $this->getClientMock( ['getSubClients', 'search'] );
$object->expects( $this->once() )->method( 'getSubClients' )
->will( $this->throwException( new \RuntimeException() ) );
$object->expects( $this->once() )->method( 'search' );
$object->delete();
}
public function testGet()
{
$manager = \Aimeos\MShop::create( $this->context, 'media/property/type' );
$param = ['type' => 'unittest', 'id' => $manager->find( 'size', [], 'media' )->getId()];
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
$this->view->addHelper( 'param', $helper );
$result = $this->object->get();
$this->assertStringContainsString( 'size', $result );
}
public function testGetException()
{
$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Type\Media\Property\Standard::class )
->setConstructorArgs( array( $this->context, \TestHelper::getTemplatePaths() ) )
->setMethods( array( 'getSubClients' ) )
->getMock();
$object->expects( $this->once() )->method( 'getSubClients' )
->will( $this->throwException( new \RuntimeException() ) );
$object->setView( $this->getViewNoRender() );
$object->get();
}
public function testSave()
{
$manager = \Aimeos\MShop::create( $this->context, 'media/property/type' );
$param = array(
'type' => 'unittest',
'item' => array(
'media.property.type.id' => '',
'media.property.type.status' => '1',
'media.property.type.domain' => 'product',
'media.property.type.code' => 'jqadm@test',
'media.property.type.label' => 'jqadm test',
),
);
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
$this->view->addHelper( 'param', $helper );
$result = $this->object->save();
$manager->delete( $manager->find( 'jqadm@test', [], 'product' )->getId() );
$this->assertEmpty( $this->view->get( 'errors' ) );
$this->assertNull( $result );
}
public function testSaveException()
{
$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Type\Media\Property\Standard::class )
->setConstructorArgs( array( $this->context, \TestHelper::getTemplatePaths() ) )
->setMethods( array( 'fromArray' ) )
->getMock();
$object->expects( $this->once() )->method( 'fromArray' )
->will( $this->throwException( new \RuntimeException() ) );
$object->setView( $this->getViewNoRender() );
$object->save();
}
public function testSearch()
{
$param = array(
'type' => 'unittest', 'locale' => 'de',
'filter' => array(
'key' => array( 0 => 'media.property.type.code' ),
'op' => array( 0 => '==' ),
'val' => array( 0 => 'size' ),
),
'sort' => array( '-media.property.type.id' ),
);
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
$this->view->addHelper( 'param', $helper );
$result = $this->object->search();
$this->assertStringContainsString( '>size<', $result );
}
public function testSearchException()
{
$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Type\Media\Property\Standard::class )
->setConstructorArgs( array( $this->context, \TestHelper::getTemplatePaths() ) )
->setMethods( array( 'initCriteria' ) )
->getMock();
$object->expects( $this->once() )->method( 'initCriteria' )
->will( $this->throwException( new \RuntimeException() ) );
$object->setView( $this->getViewNoRender() );
$object->search();
}
public function testGetSubClientInvalid()
{
$this->expectException( \Aimeos\Admin\JQAdm\Exception::class );
$this->object->getSubClient( '$unknown$' );
}
public function testGetSubClientUnknown()
{
$this->expectException( \Aimeos\Admin\JQAdm\Exception::class );
$this->object->getSubClient( 'unknown' );
}
public function getClientMock( $methods, $real = true )
{
$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Type\Media\Property\Standard::class )
->setConstructorArgs( array( $this->context, \TestHelper::getTemplatePaths() ) )
->setMethods( (array) $methods )
->getMock();
$object->setAimeos( \TestHelper::getAimeos() );
$object->setView( $this->getViewNoRender( $real ) );
return $object;
}
protected function getViewNoRender( $real = true )
{
$view = $this->getMockBuilder( \Aimeos\MW\View\Standard::class )
->setConstructorArgs( array( [] ) )
->setMethods( array( 'render' ) )
->getMock();
$manager = \Aimeos\MShop::create( $this->context, 'media/property/type' );
$param = ['site' => 'unittest', 'id' => $real ? $manager->find( 'size', [], 'media' )->getId() : -1];
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param );
$view->addHelper( 'param', $helper );
$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $this->context->config() );
$view->addHelper( 'config', $helper );
$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, [] );
$view->addHelper( 'access', $helper );
return $view;
}
}
| aimeos/ai-admin-jqadm | tests/Admin/JQAdm/Type/Media/Property/StandardTest.php | PHP | lgpl-3.0 | 7,433 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
6105,
1048,
21600,
2140,
2615,
2509,
1010,
8299,
1024,
1013,
1013,
7480,
8162,
3401,
1012,
8917,
1013,
15943,
1013,
1048,
21600,
2140,
1011,
1017,
1012,
1014,
1008,
1030,
9385,
6614,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Argus Software
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* Copyright (c) 1993, 1994 Carnegie Mellon University.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
*/
/*
* $Id: $
* $DateTime: $
* $Change: $
*/
#if !defined(Argus_compat_h)
#define Argus_compat_h
#define argtimeval timeval
#if defined(HAVE_SOLARIS)
#include <strings.h>
#include <sys/byteorder.h>
#endif
#if defined(linux)
#include <endian.h>
#define __FAVOR_BSD
#endif
#if defined(CYGWIN)
#define _LITTLE_ENDIAN
#define USE_IPV6
#else
#if defined(HAVE_SOLARIS)
#include <sys/ethernet.h>
#else
#if defined(__OpenBSD__) && !defined(__APPLE__)
#include <net/ethertypes.h>
#endif
#endif
#include <argus_os.h>
#if defined(__FreeBSD__)
#if defined(BYTE_ORDER)
#define __BYTE_ORDER BYTE_ORDER
#endif
#if defined(LITTLE_ENDIAN)
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#endif
#if defined(BIG_ENDIAN)
#define __BIG_ENDIAN BIG_ENDIAN
#endif
#endif
#if !defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define _LITTLE_ENDIAN
#else
#define _BIG_ENDIAN
#endif
#endif
#endif
#if !defined(HAVE_STRTOF) && !defined(CYGWIN)
//float strtof (char *, char **);
#endif
#if defined(__sgi__) || defined(HAVE_SOLARIS) || defined(ultrix) || defined(__osf__) || defined(linux) || defined(bsdi) || defined(AIX) | defined(CYGWIN)
#define timelocal mktime
#if defined(__sgi__)
#include <bstring.h>
#include <ulimit.h>
#if _MIPS_SZLONG == 64
#undef argtimeval
#define argtimeval irix5_timeval
#endif
#undef TCPSTATES
#endif
#if defined(linux)
#include <time.h>
#endif
#if defined(__sgi) || defined(bsdi)
struct ether_addr {
u_char ether_addr_octet[6];
};
#endif
#if defined(AIX)
#define _SUN
#include <sys/select.h>
#include <net/nh.h>
#endif
#endif
#define arg_uint8 u_char
#define arg_int8 char
#define arg_uint16 u_short
#define arg_int16 short
#if HOST_BITS_PER_INT == 32
#define arg_uint32 u_int
#define arg_int32 int
#else
#define arg_uint32 u_long
#define arg_int32 long
#endif
#if defined(__FreeBSD__)
#include <sys/socket.h>
#include <netinet/if_ether.h>
#endif
#if !defined(ICMP_ROUTERADVERT)
#define ICMP_ROUTERADVERT 9 /* router advertisement */
#endif
#if !defined(ICMP_ROUTERSOLICIT)
#define ICMP_ROUTERSOLICIT 10 /* router solicitation */
#endif
#if !defined(TCPOPT_WSCALE)
#define TCPOPT_WSCALE 3 /* window scale factor (rfc1072) */
#endif
#if !defined(TCPOPT_SACKOK)
#define TCPOPT_SACKOK 4 /* selective ack ok (rfc1072) */
#endif
#if !defined(TCPOPT_SACK)
#define TCPOPT_SACK 5 /* selective ack (rfc1072) */
#endif
#if !defined(TCPOPT_ECHO)
#define TCPOPT_ECHO 6 /* echo (rfc1072) */
#endif
#if !defined(TCPOPT_ECHOREPLY)
#define TCPOPT_ECHOREPLY 7 /* echo (rfc1072) */
#endif
#if !defined(TCPOPT_TIMESTAMP)
#define TCPOPT_TIMESTAMP 8 /* timestamps (rfc1323) */
#endif
#if !defined(TCPOPT_CC)
#define TCPOPT_CC 11 /* T/TCP CC options (rfc1644) */
#endif
#if !defined(TCPOPT_CCNEW)
#define TCPOPT_CCNEW 12 /* T/TCP CC options (rfc1644) */
#endif
#if !defined(TCPOPT_CCECHO)
#define TCPOPT_CCECHO 13 /* T/TCP CC options (rfc1644) */
#endif
#if !defined(ETHERTYPE_SPRITE)
#define ETHERTYPE_SPRITE 0x0500
#endif
#if !defined(ETHERTYPE_NS)
#define ETHERTYPE_NS 0x0600
#endif
#if !defined(ETHERTYPE_IP)
#define ETHERTYPE_IP 0x0800
#endif
#if !defined(ETHERTYPE_X25L3)
#define ETHERTYPE_X25L3 0x0805
#endif
#if !defined(ETHERTYPE_ARP)
#define ETHERTYPE_ARP 0x0806
#endif
#if !defined(ETHERTYPE_VINES)
#define ETHERTYPE_VINES 0x0bad
#endif
#if !defined(ETHERTYPE_TRAIL)
#define ETHERTYPE_TRAIL 0x1000
#endif
#if !defined(ETHERTYPE_TRAIN)
#define ETHERTYPE_TRAIN 0x1984
#endif
#if !defined(ETHERTYPE_3C_NBP_DGRAM)
#define ETHERTYPE_3C_NBP_DGRAM 0x3c07
#endif
#if !defined(ETHERTYPE_DEC)
#define ETHERTYPE_DEC 0x6000
#endif
#if !defined(ETHERTYPE_MOPDL)
#define ETHERTYPE_MOPDL 0x6001
#endif
#if !defined(ETHERTYPE_MOPRC)
#define ETHERTYPE_MOPRC 0x6002
#endif
#if !defined(ETHERTYPE_DN)
#define ETHERTYPE_DN 0x6003
#endif
#if !defined(ETHERTYPE_LAT)
#define ETHERTYPE_LAT 0x6004
#endif
#if !defined(ETHERTYPE_DEC_DIAG)
#define ETHERTYPE_DEC_DIAG 0x6005
#endif
#if !defined(ETHERTYPE_DEC_CUST)
#define ETHERTYPE_DEC_CUST 0x6006
#endif
#if !defined(ETHERTYPE_SCA)
#define ETHERTYPE_SCA 0x6007
#endif
#if !defined(ETHERTYPE_REVARP)
#define ETHERTYPE_REVARP 0x8035
#endif
#if !defined(ETHERTYPE_LANBRIDGE)
#define ETHERTYPE_LANBRIDGE 0x8038
#endif
#if !defined(ETHERTYPE_DECDNS)
#define ETHERTYPE_DECDNS 0x803c
#endif
#if !defined(ETHERTYPE_DECDTS)
#define ETHERTYPE_DECDTS 0x803e
#endif
#if !defined(ETHERTYPE_VEXP)
#define ETHERTYPE_VEXP 0x805b
#endif
#if !defined(ETHERTYPE_VPROD)
#define ETHERTYPE_VPROD 0x805c
#endif
#if !defined(ETHERTYPE_ATALK)
#define ETHERTYPE_ATALK 0x809b
#endif
#if !defined(ETHERTYPE_AARP)
#define ETHERTYPE_AARP 0x80f3
#endif
#if !defined(ETHERTYPE_8021Q)
#define ETHERTYPE_8021Q 0x8100
#endif
#if !defined(ETHERTYPE_IPX)
#define ETHERTYPE_IPX 0x8137
#endif
#if !defined(ETHERTYPE_SNMP)
#define ETHERTYPE_SNMP 0x814c
#endif
#if !defined(ETHERTYPE_IPV6)
#define ETHERTYPE_IPV6 0x86dd
#endif
#if !defined(ETHERTYPE_MPLS)
#define ETHERTYPE_MPLS 0x8847
#endif
#if !defined(ETHERTYPE_MPLS_MULTI)
#define ETHERTYPE_MPLS_MULTI 0x8848
#endif
#if !defined(ETHERTYPE_PPPOED)
#define ETHERTYPE_PPPOED 0x8863
#endif
#if !defined(ETHERTYPE_PPPOES)
#define ETHERTYPE_PPPOES 0x8864
#endif
#if !defined(ETHERTYPE_LOOPBACK)
#define ETHERTYPE_LOOPBACK 0x9000
#endif
#endif /* Argus_compat_h */
| hbock/argus-clients | include/compat.h | C | gpl-2.0 | 7,057 | [
30522,
1013,
1008,
1008,
25294,
4007,
1008,
2035,
2916,
9235,
1012,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
1008,
2009,
2104,
1996,
3408,
1997,
1996,
27004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* @copyright XOOPS Project https://xoops.org/
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package
* @since
* @author XOOPS Development Team, Kazumi Ono (AKA onokazu)
*/
/**
* !
* Example
*
* require_once __DIR__ . '/uploader.php';
* $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png');
* $maxfilesize = 50000;
* $maxfilewidth = 120;
* $maxfileheight = 120;
* $uploader = new \XoopsMediaUploader('/home/xoops/uploads', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
* if ($uploader->fetchMedia($_POST['uploade_file_name'])) {
* if (!$uploader->upload()) {
* echo $uploader->getErrors();
* } else {
* echo '<h4>File uploaded successfully!</h4>'
* echo 'Saved as: ' . $uploader->getSavedFileName() . '<br>';
* echo 'Full path: ' . $uploader->getSavedDestination();
* }
* } else {
* echo $uploader->getErrors();
* }
*/
/**
* Upload Media files
*
* Example of usage:
* <code>
* require_once __DIR__ . '/uploader.php';
* $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png');
* $maxfilesize = 50000;
* $maxfilewidth = 120;
* $maxfileheight = 120;
* $uploader = new \XoopsMediaUploader('/home/xoops/uploads', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
* if ($uploader->fetchMedia($_POST['uploade_file_name'])) {
* if (!$uploader->upload()) {
* echo $uploader->getErrors();
* } else {
* echo '<h4>File uploaded successfully!</h4>'
* echo 'Saved as: ' . $uploader->getSavedFileName() . '<br>';
* echo 'Full path: ' . $uploader->getSavedDestination();
* }
* } else {
* echo $uploader->getErrors();
* }
* </code>
*
* @package kernel
* @subpackage core
* @author Kazumi Ono <onokazu@xoops.org>
* @copyright (c) 2000-2003 XOOPS Project (https://xoops.org)
*/
mt_srand((double)microtime() * 1000000);
/**
* Class XoopsMediaUploader
*/
class XoopsMediaUploader
{
public $mediaName;
public $mediaType;
public $mediaSize;
public $mediaTmpName;
public $mediaError;
public $uploadDir = '';
public $allowedMimeTypes = [];
public $maxFileSize = 0;
public $maxWidth;
public $maxHeight;
public $targetFileName;
public $prefix;
public $ext;
public $dimension;
public $errors = [];
public $savedDestination;
public $savedFileName;
/**
* No admin check for uploads
*/
public $noadmin_sizecheck;
/**
* Constructor
*
* @param string $uploadDir
* @param array|int $allowedMimeTypes
* @param int $maxFileSize
* @param int $maxWidth
* @param int $maxHeight
* @internal param int $cmodvalue
*/
public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize, $maxWidth = 0, $maxHeight = 0)
{
if (is_array($allowedMimeTypes)) {
$this->allowedMimeTypes =& $allowedMimeTypes;
}
$this->uploadDir = $uploadDir;
$this->maxFileSize = (int)$maxFileSize;
if (isset($maxWidth)) {
$this->maxWidth = (int)$maxWidth;
}
if (isset($maxHeight)) {
$this->maxHeight = (int)$maxHeight;
}
}
/**
* @param $value
*/
public function noAdminSizeCheck($value)
{
$this->noadmin_sizecheck = $value;
}
/**
* Fetch the uploaded file
*
* @param string $media_name Name of the file field
* @param int $index Index of the file (if more than one uploaded under that name)
* @global $HTTP_POST_FILES
* @return bool
*/
public function fetchMedia($media_name, $index = null)
{
global $_FILES;
if (!isset($_FILES[$media_name])) {
$this->setErrors('You either did not choose a file to upload or the server has insufficient read/writes to upload this file.!');
return false;
} elseif (is_array($_FILES[$media_name]['name']) && isset($index)) {
$index = (int)$index;
// $this->mediaName = get_magic_quotes_gpc() ? stripslashes($_FILES[$media_name]['name'][$index]): $_FILES[$media_name]['name'][$index];
$this->mediaName = $_FILES[$media_name]['name'][$index];
$this->mediaType = $_FILES[$media_name]['type'][$index];
$this->mediaSize = $_FILES[$media_name]['size'][$index];
$this->mediaTmpName = $_FILES[$media_name]['tmp_name'][$index];
$this->mediaError = !empty($_FILES[$media_name]['error'][$index]) ? $_FILES[$media_name]['errir'][$index] : 0;
} else {
$media_name = @$_FILES[$media_name];
// $this->mediaName = get_magic_quotes_gpc() ? stripslashes($media_name['name']): $media_name['name'];
$this->mediaName = $media_name['name'];
$this->mediaType = $media_name['type'];
$this->mediaSize = $media_name['size'];
$this->mediaTmpName = $media_name['tmp_name'];
$this->mediaError = !empty($media_name['error']) ? $media_name['error'] : 0;
}
$this->dimension = getimagesize($this->mediaTmpName);
$this->errors = [];
if ((int)$this->mediaSize < 0) {
$this->setErrors('Invalid File Size');
return false;
}
if ('' === $this->mediaName) {
$this->setErrors('Filename Is Empty');
return false;
}
if ('none' === $this->mediaTmpName) {
$this->setErrors('No file uploaded, this is a error');
return false;
}
if (!$this->checkMaxFileSize()) {
$this->setErrors(sprintf('File Size: %u. Maximum Size Allowed: %u', $this->mediaSize, $this->maxFileSize));
}
if (is_array($this->dimension)) {
if (!$this->checkMaxWidth($this->dimension[0])) {
$this->setErrors(sprintf('File width: %u. Maximum width allowed: %u', $this->dimension[0], $this->maxWidth));
}
if (!$this->checkMaxHeight($this->dimension[1])) {
$this->setErrors(sprintf('File height: %u. Maximum height allowed: %u', $this->dimension[1], $this->maxHeight));
}
}
if (count($this->errors) > 0) {
return false;
}
if (!$this->checkMimeType()) {
$this->setErrors('MIME type not allowed: ' . $this->mediaType);
}
if (!is_uploaded_file($this->mediaTmpName)) {
switch ($this->mediaError) {
case 0: // no error; possible file attack!
$this->setErrors('There was a problem with your upload. Error: 0');
break;
case 1: // uploaded file exceeds the upload_max_filesize directive in php.ini
//if ($this->noAdminSizeCheck)
//{
// return true;
//}
$this->setErrors('The file you are trying to upload is too big. Error: 1');
break;
case 2: // uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form
$this->setErrors('The file you are trying to upload is too big. Error: 2');
break;
case 3: // uploaded file was only partially uploaded
$this->setErrors('The file you are trying upload was only partially uploaded. Error: 3');
break;
case 4: // no file was uploaded
$this->setErrors('No file selected for upload. Error: 4');
break;
default: // a default error, just in case! :)
$this->setErrors('No file selected for upload. Error: 5');
break;
}
return false;
}
return true;
}
/**
* Set the target filename
*
* @param string $value
*/
public function setTargetFileName($value)
{
$this->targetFileName = trim($value);
}
/**
* Set the prefix
*
* @param string $value
*/
public function setPrefix($value)
{
$this->prefix = trim($value);
}
/**
* Get the uploaded filename
*
* @return string
*/
public function getMediaName()
{
return $this->mediaName;
}
/**
* Get the type of the uploaded file
*
* @return string
*/
public function getMediaType()
{
return $this->mediaType;
}
/**
* Get the size of the uploaded file
*
* @return int
*/
public function getMediaSize()
{
return $this->mediaSize;
}
/**
* Get the temporary name that the uploaded file was stored under
*
* @return string
*/
public function getMediaTmpName()
{
return $this->mediaTmpName;
}
/**
* Get the saved filename
*
* @return string
*/
public function getSavedFileName()
{
return $this->savedFileName;
}
/**
* Get the destination the file is saved to
*
* @return string
*/
public function getSavedDestination()
{
return $this->savedDestination;
}
/**
* Check the file and copy it to the destination
*
* @param int $chmod
* @return bool
*/
public function upload($chmod = 0644)
{
if ('' == $this->uploadDir) {
$this->setErrors('Upload directory not set');
return false;
}
if (!is_dir($this->uploadDir)) {
$this->setErrors('Failed opening directory: ' . $this->uploadDir);
}
if (!is_writable($this->uploadDir)) {
$this->setErrors('Failed opening directory with write permission: ' . $this->uploadDir);
}
if (!$this->checkMaxFileSize()) {
$this->setErrors(sprintf('File Size: %u. Maximum Size Allowed: %u', $this->mediaSize, $this->maxFileSize));
}
if (is_array($this->dimension)) {
if (!$this->checkMaxWidth($this->dimension[0])) {
$this->setErrors(sprintf('File width: %u. Maximum width allowed: %u', $this->dimension[0], $this->maxWidth));
}
if (!$this->checkMaxHeight($this->dimension[1])) {
$this->setErrors(sprintf('File height: %u. Maximum height allowed: %u', $this->dimension[1], $this->maxHeight));
}
}
if (!$this->checkMimeType()) {
$this->setErrors('MIME type not allowed: ' . $this->mediaType);
}
if (!$this->_copyFile($chmod)) {
$this->setErrors('Failed uploading file: ' . $this->mediaName);
}
if (count($this->errors) > 0) {
return false;
}
return true;
}
/**
* Copy the file to its destination
*
* @param $chmod
* @return bool
*/
public function _copyFile($chmod)
{
$matched = [];
if (!preg_match("/\.([a-zA-Z0-9]+)$/", $this->mediaName, $matched)) {
return false;
}
if (isset($this->targetFileName)) {
$this->savedFileName = $this->targetFileName;
} elseif (isset($this->prefix)) {
$this->savedFileName = uniqid($this->prefix, true) . '.' . strtolower($matched[1]);
} else {
$this->savedFileName = strtolower($this->mediaName);
}
$this->savedFileName = preg_replace('!\s+!', '_', $this->savedFileName);
$this->savedDestination = $this->uploadDir . $this->savedFileName;
if (is_file($this->savedDestination) && !!is_dir($this->savedDestination)) {
$this->setErrors('File ' . $this->mediaName . ' already exists on the server. Please rename this file and try again.<br>');
return false;
}
if (!move_uploaded_file($this->mediaTmpName, $this->savedDestination)) {
return false;
}
@chmod($this->savedDestination, $chmod);
return true;
}
/**
* Is the file the right size?
*
* @return bool
*/
public function checkMaxFileSize()
{
if ($this->noadmin_sizecheck) {
return true;
}
if ($this->mediaSize > $this->maxFileSize) {
return false;
}
return true;
}
/**
* Is the picture the right width?
*
* @param $dimension
* @return bool
*/
public function checkMaxWidth($dimension)
{
if (!isset($this->maxWidth)) {
return true;
}
if ($dimension > $this->maxWidth) {
return false;
}
return true;
}
/**
* Is the picture the right height?
*
* @param $dimension
* @return bool
*/
public function checkMaxHeight($dimension)
{
if (!isset($this->maxHeight)) {
return true;
}
if ($dimension > $this->maxWidth) {
return false;
}
return true;
}
/**
* Is the file the right Mime type
*
* (is there a right type of mime? ;-)
*
* @return bool
*/
public function checkMimeType()
{
if (count($this->allowedMimeTypes) > 0 && !in_array($this->mediaType, $this->allowedMimeTypes)) {
return false;
} else {
return true;
}
}
/**
* Add an error
*
* @param string $error
*/
public function setErrors($error)
{
$this->errors[] = trim($error);
}
/**
* Get generated errors
*
* @param bool $ashtml Format using HTML?
* @return array |string Array of array messages OR HTML string
*/
public function &getErrors($ashtml = true)
{
if (!$ashtml) {
return $this->errors;
} else {
$ret = '';
if (count($this->errors) > 0) {
$ret = '<h4>Errors Returned While Uploading</h4>';
foreach ($this->errors as $error) {
$ret .= $error . '<br>';
}
}
return $ret;
}
}
}
| mambax7/257 | htdocs/modules/smartpartner/class/uploader.php | PHP | gpl-2.0 | 14,883 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
2017,
2089,
2025,
2689,
2030,
11477,
2151,
4664,
1997,
2023,
7615,
2030,
6495,
1008,
1997,
4637,
9797,
2013,
2023,
3120,
3642,
2030,
2151,
4637,
3120,
3642,
1008,
2029,
2003,
2641,
9385,
2098,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Strobilanthes perplexa J.R.I.Wood SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Lamiales/Acanthaceae/Strobilanthes/Strobilanthes perplexa/README.md | Markdown | apache-2.0 | 183 | [
30522,
1001,
2358,
3217,
14454,
4630,
15689,
2566,
19386,
2050,
1046,
1012,
1054,
1012,
1045,
1012,
3536,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
2248,
3269,
3415,
5950,
1001,
1001,
1001,
1001,
2405,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Loranthus scortecchinii Engl. SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Santalales/Loranthaceae/Loranthus/Loranthus scortecchinii/README.md | Markdown | apache-2.0 | 179 | [
30522,
1001,
8840,
17884,
9825,
8040,
11589,
8586,
17231,
6137,
25540,
2140,
1012,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
2248,
3269,
3415,
5950,
1001,
1001,
1001,
1001,
2405,
1999,
19701,
1001,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/******************* BASICS *******************/
body {
background-color: #e2e3e4;
font-family: "Century Gothic", 'Open Sans', sans-serif;
color: #333;
}
html {
font-size: 70%;
}
a {
cursor: pointer;
text-decoration: none;
}
a:hover { color: #99c; }
h2 {
margin-left: 10px;
font-size: 2.4em;
font-weight: 700;
}
h3 {
text-align: center;
font-size: 1.5em;
}
.clear { clear: both; }
.lightback {
background-color: #dce9f4;
color: #333;
}
.darkback {
background-color: #004e94;
color: #eee;
}
#container {
width: 960px;
min-height: 350px;
margin: 15px auto;
padding-bottom: 20px;
overflow: hidden;
background: #fff;
border-radius: 20px;
}
#content {
float: left;
width: 620px;
margin: 0 10px;
overflow: hidden;
}
#sidebar {
float: right;
margin-top: 27px;
width: 320px;
}
.logo {
float: left;
margin-top: 10px;
font-family: 'Ribeye', Georgia, serif;
line-height: 0.8;
}
.logo:first-letter {
float: left;
margin-bottom: 0;
}
.infobox {
float: left;
width: 290px;
margin: 10px;
line-height: 20px;
border-radius: 3px;
}
.infobox .infoimg {
width: 270px;
height: 80px;
margin: 10px;
border-radius: 3px 3px 0 0;
}
.infobox h3 {
float: left;
margin-top: 40px;
padding: 5px 0;
width: 100%;
letter-spacing: -1px;
font-size: 1.5em;
}
.darkback h3 { background-color: rgba( 0, 78, 148, 0.8); }
.lightback h3 { background-color: rgba( 220, 232, 244, 0.8); }
.infobox ul { margin: 10px; }
.infobox li {
padding-left: 10px;
padding-bottom: 5px;
font-size: 1.2em;
}
.infobox li .address { padding-left: 25px; }
.infobox li:before {
content: ">";
padding-right: 5px;
font-family: 'Ribeye', cursive;
font-weight: 600;
}
.darkback li:before { color: #dce8f4; }
.lightback li:before { color: #004e94; }
.infobox img { padding: 0 5px; }
/******************* HEADER *******************/
#header {
float: left;
margin: 10px;
}
#header .logo {
width: 460px;
font-size: 32px;
line-height: 0.8;
}
#header .logo a {
color: #004394;
}
#header .logo a:hover {
color: #99c;
}
#header .logo:first-line {
font-size: 64px;
letter-spacing: -6px;
}
#header .logo:first-letter {
font-size: 96px;
letter-spacing: -8px;
}
#header hr {
position: absolute;
top: 120px;
width: 940px;
height: 0;
margin: 0;
border: none;
border-top: 5px solid #004394;
border-radius: 0 0 20px 20px;
}
/******************************** TOP NAV *************************************/
#topNav {
float: right;
list-style: none;
}
#topNav li {
float: left;
display: inline-block;
height: 40px;
padding-left: 20px;
}
#topNav a {
display: block;
font-size: 1.2rem;
font-weight: 800;
line-height: 32px;
letter-spacing: -1px;
text-align: center;
color: #333;
}
#topNav a:hover { color: #004e94; }
#topNav img { width: auto; height: 32px; }
/******************* MAIN NAV *******************/
#mainNav {
float: right;
margin-top: 21px;
list-style: none;
z-index: 2;
}
#mainNav > li {
display: inline-block;
width: 88px;
}
#mainNav a {
display: block;
margin: 0;
padding-top: 4px;
font-size: 1.3rem;
font-weight: 400;
line-height: 30px;
letter-spacing: -1px;
color: #ddf;
text-align: center;
background-color: #99c;
border-radius: 7px 7px 0 0;
}
#mainNav a:hover {
background-color: #004394;
color: #eef;
}
#mainNav .current {
background-color: #004394;
color: #fff;
}
#mainNav ul a {
border-radius: 0 0 0 0;
}
#mainNav ul {
display: none;
padding-top: 5px;
z-index: 3;
}
#mainNav li:hover ul {
display: block;
position: absolute;
}
#mainNav li:hover li {
float: none;
}
#mainNav ul li {
width: 88px;
}
/******************* Breadcrumbs *******************/
#breadcrumbs {
float: left;
margin-left: 10px;
margin-top: 20px;
font-size: 1em;
}
#breadcrumbs li {
display: inline;
}
.crumb, .thiscrumb{
color:#221;
padding-right: 5px;
}
.thiscrumb {
font-size: 1.1em;
font-weight: bold;
}
.crumb:after {
padding-left: 5px;
content: ">";
font-family: 'Ribeye';
font-size: 1.2em;
color: #004394;
}
/******************* ANIMAL SEARCH ******************/
.pet {
float: left;
margin: 10px 10px 20px 10px;
padding: 5px;
color: #004e94;
border: 1px dashed #99c;
border-radius: 5px;
}
.pet:hover {
background: #004e94;
color: white;
}
.pet img {
width: 122px;
height: 122px;
border-radius: 5px;
}
.pet .name {
font-size: 1.4em;
letter-spacing: -1px;
padding: 10px 0;
}
/******************** ANIMAL PROFILE *********************/
.petdata{
float: left;
width: 462px;
font-size: 1.15em;
}
.petdata .heading {
padding: 3px;
color: #004e94;
font-weight: 700;
font-size: 1.3em;
letter-spacing: -1px;
}
.portrait {
float: left;
width: 220px;
height: 220px;
margin: 10px;
border-radius: 3px;
}
#petinfo {
float: left;
margin: 10px;
width: 200px;
}
#petinfo td {
width: 90px;
padding: 10px;
color: #555;
}
#petinfo .label {
font-weight: 700;
text-align: right;
color: #004e94;
}
#petinfo .odd { background-color: #dce8f4; }
iframe {
display: block;
margin: 10px auto;
}
.gallery {
float: left;
width: 132px;
margin: 10px;
border: 1px dashed #99c;
border-top: 0;
border-radius: 5px;
}
.gallery img {
width: 122px;
height: 122px;
margin: 5px;
border-radius: 3px;
}
.gallery p {
margin-right: -5px;
margin-left: -5px;
padding: 5px 10px;
font-size: 1.3em;
color: #eee;
background-color: #004e94;
border-radius: 3px;
}
#description, #adoptinfo {
margin: 0 10px;
border-radius: 3px;
}
.rehomeButtons a {
float: left;
width: 180px;
margin: 5px 10px;
padding: 5px 10px;
color: #eee;
font-weight: 600;
line-height: 16pt;
background-color: #99c;
border-radius: 3px;
}
.rehomeButtons a:hover { background-color: #004e94; }
.rehomeButtons a:after {
content: ">";
padding-right: 5px;
float: right;
font-size: 1.2em;
font-family: 'Ribeye', cursive;
}
#adoptinfo {
margin: 10px;
padding: 10px 20px;
color: #555;
line-height: 20px;
background-color: #dce8f4;
}
#adoptinfo .heading {
font-size: 16px;
font-weight: bold;
}
#adoptinfo li:before {
content: ">";
padding-right: 5px;
color: #004394;
font-weight: 700;
font-family: 'Ribeye', cursive;
}
/******************** NEWSSTORY*********************/
#newsstory .postdate { font-style: italic; }
#newsstory .tags {
float: left;
margin: 5px 10px;
padding: 0 10px;
line-height: 18px;
color: #fff;
background-color: #004e94;
}
#newsstory img {
float: left;
width: 122px;
height: 122px;
margin: 5px 10px 0 10px;
border-radius: 3px;
}
#newsstory .newsimage {
margin: 10px;
}
#newsstory img.large {
margin: 0 40px;
width: 500px;
height: 300px;
}
.newsimage .caption {
font-size: 0.8em;
text-align: center;
}
#newsstory .newstext {
margin: 5px 10px;
color: #555;
font-size: 1.2em;
}
/******************* SIDEBAR ******************/
.catButton, .dogButton {
height: 150px;
margin: 10px;
background-size: 350px auto;
border-radius: 3px;
}
.catButton {
background-image: url('../img/catbutton.jpg');
}
.catButton a, .dogButton a {
float: left;
width: 280px;
margin-top: 110px;
padding: 5px 10px;
font-size: 1.5em;
letter-spacing: -1px;
color: white;
background-color: rgba( 0, 78, 148, 0.8);
}
.catButton a:after, .dogButton a:after {
content: "> > >";
font-family: 'Ribeye Marrow', cursive;
font-size: 1.2em;
float: right;
}
.catButton a:hover, .dogButton a:hover {
color: #004e94;
background-color: #ccf;
}
.latestNews {
margin: 10px 15px;
border: 1px dashed #99c;
border-top: 0px;
border-radius: 3px;
}
.latestNews > .heading {
width: 280px;
margin-left: -5px;
padding: 5px 10px;
color: white;
font-size: 1.5em;
letter-spacing: -1px;
background-color: rgba( 0, 78, 148, 1.0);
border-radius: 3px;
}
.newsBrief { padding: 10px; }
.newsBrief a { font-weight: 600; }
.newsBrief img {
float: left;
width: 80px;
margin-right: 5px;
border-radius: 2px;
}
.newsBrief .heading {
font-size: 1.2em;
font-weight: 700;
}
/**************************** CONTACT FORMS ***********************************/
form {
float: left;
width: 360px;
margin: 10px;
padding: 0;
border-radius: 3px;
}
.formfield {
float: left;
width: 350px;
margin-bottom: 10px;
padding: 7px 5px;
color: #333;
border: 1px dashed #99c;
border-radius: 0 3px 3px 0;
}
.formfield label {
float: left;
width: 105px;
padding-right: 10px;
text-align: right;
line-height: 21px;
font-size: 1.2em;
}
.formfield input, .formfield textarea, .formfield select{
float: left;
margin: 0;
height: 18px;
padding: 0 0 0 5px;
width: 227px;
font-family: inherit;
font-size: 1.2em;
color: #333;
border: 1px solid #fff;
background-color: transparent;
}
.formfield input:hover, .formfield textarea:hover {
border: 1px solid #004e94;
}
.formfield textarea {
margin-top: 5px;
width: 345px;
height: 100px;
resize: none;
}
.formfield select {
font-size: 1.2em;
border: 1px solid #99c;
border-radius: 3px;
}
.button {
float: right;
width: 125px;
padding: 0;
line-height: 20px;
}
.button input {
width: 100%;
height: 100%;
padding: 5px;
font-weight: bold;
}
.button input:hover {
background-color: #004e94;
color: #eee;
}
#contactinfo {
float: left;
width: 200px;
margin: 10px;
padding: 10px;
font-size: 1.2em;
color: #444;
background-color: #dce9f4;
border-radius: 3px;
}
#contactinfo h3 {
color: #004e94;
}
#contactinfo p {
text-align: justify;
margin: 5px 0;
}
#contactinfo .contacttype {
font-style:italic;
padding-top:5px;
}
#contactinfo .contactdetail {
padding-bottom: 5px;
color: #004e94;
font-size: 1.1em;
border-bottom: 1px dashed #99c;
border-radius: 3px;
}
/******************* Content Footer ***********************/
#contentFoot p, #contentFoot a {
color: #222;
text-align: center;
}
/******************* FOOTER *******************/
#footer {
width: 960px;
height: 150px;
margin: 20px auto;
overflow: hidden;
background: #004394;
border-radius: 20px;
}
#footer .logo {
width: 300px;
margin: 10px;
font-size: 18px;
}
#footer .logo a {
color: #efefef;
}
#footer .logo a:hover {
color: #99c;
}
#footer .logo:first-line {
font-size: 36px;
letter-spacing: -4px;
}
#footer .logo:first-letter {
font-size: 54px;
letter-spacing: -6px;
}
#footer #nav {
float: right;
font-size: 1.2rem;
margin-top: 10px;
}
#footer #nav a {
width: 92px;
height: 16px;
display: block;
text-align: center;
}
#footer .virginLink {
float: right;
margin-top: 5px;
margin-right: 5px;
}
#footer .topitem {
display: inline-block;
}
#footer .topitem a {
font-weight: 700;
color: #eef;
}
#footer .subitem a {
font-weight: 400;
color: #99c;
}
#footer #nav a:hover {
color: #99c;
}
#footer .topitem > ul {
display: table;
}
#footer .address {
margin-top: -85px;
margin-left: 20px;
float: left;
width: 230px;
text-align: left;
color: #bbe;
}
#footer .charitydetails {
float: right;
margin-top: 74px;
margin-right: 10px;
color: #99c;
}
| mikeismint/otterspool | styles/main.css | CSS | mit | 11,256 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
24078,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
# pylint: disable=too-many-lines,too-complex,too-many-branches
# pylint: disable=too-many-statements,arguments-differ
# needs refactoring, but I don't have the energy for anything
# more than a superficial cleanup.
#-------------------------------------------------------------------------------
# Name: midi/__init__.py
# Purpose: Access to MIDI library / music21 classes for dealing with midi data
#
# Authors: Christopher Ariza
# Michael Scott Cuthbert
# (Will Ware -- see docs)
#
# Copyright: Copyright © 2011-2013 Michael Scott Cuthbert and the music21 Project
# Some parts of this module are in the Public Domain, see details.
# License: LGPL or BSD, see license.txt
#-------------------------------------------------------------------------------
'''
Objects and tools for processing MIDI data. Converts from MIDI files to
:class:`~MidiEvent`, :class:`~MidiTrack`, and
:class:`~MidiFile` objects, and vice-versa.
This module uses routines from Will Ware's public domain midi.py library from 2001
see http://groups.google.com/group/alt.sources/msg/0c5fc523e050c35e
'''
import struct
import sys
import unicodedata # @UnresolvedImport
# good midi reference:
# http://www.sonicspot.com/guide/midifiles.html
def is_num(usr_data):
'''
check if usr_data is a number (float, int, long, Decimal),
return boolean
unlike `isinstance(usr_data, Number)` does not return True for `True, False`.
Does not use `isinstance(usr_data, Number)` which is 6 times slower
than calling this function (except in the case of Fraction, when
it's 6 times faster, but that's rarer)
Runs by adding 0 to the "number" -- so anything that implements
add to a scalar works
>>> is_num(3.0)
True
>>> is_num(3)
True
>>> is_num('three')
False
>>> is_num([2, 3, 4])
False
True and False are NOT numbers:
>>> is_num(True)
False
>>> is_num(False)
False
>>> is_num(None)
False
:rtype: bool
'''
try:
dummy = usr_data + 0
# pylint: disable=simplifiable-if-statement
if usr_data is not True and usr_data is not False:
return True
else:
return False
except Exception: # pylint: disable=broad-except
return False
# pylint: disable=missing-docstring
#-------------------------------------------------------------------------------
class EnumerationException(Exception):
pass
class MidiException(Exception):
pass
#-------------------------------------------------------------------------------
def char_to_binary(char):
'''
Convert a char into its binary representation. Useful for debugging.
>>> char_to_binary('a')
'01100001'
'''
ascii_value = ord(char)
binary_digits = []
while ascii_value > 0:
if (ascii_value & 1) == 1:
binary_digits.append("1")
else:
binary_digits.append("0")
ascii_value = ascii_value >> 1
binary_digits.reverse()
binary = ''.join(binary_digits)
zerofix = (8 - len(binary)) * '0'
return zerofix + binary
def ints_to_hex_string(int_list):
'''
Convert a list of integers into a hex string, suitable for testing MIDI encoding.
>>> # note on, middle c, 120 velocity
>>> ints_to_hex_string([144, 60, 120])
b'\\x90<x'
'''
# note off are 128 to 143
# note on messages are decimal 144 to 159
post = b''
for i in int_list:
# B is an unsigned char
# this forces values between 0 and 255
# the same as chr(int)
post += struct.pack(">B", i)
return post
def get_number(midi_str, length):
'''
Return the value of a string byte or bytes if length > 1
from an 8-bit string or (PY3) bytes object
Then, return the remaining string or bytes object
The `length` is the number of chars to read.
This will sum a length greater than 1 if desired.
Note that MIDI uses big-endian for everything.
This is the inverse of Python's chr() function.
>>> get_number('test', 0)
(0, 'test')
>>> get_number('test', 2)
(29797, 'st')
>>> get_number('test', 4)
(1952805748, '')
'''
summation = 0
if not is_num(midi_str):
for i in range(length):
midi_str_or_num = midi_str[i]
if is_num(midi_str_or_num):
summation = (summation << 8) + midi_str_or_num
else:
summation = (summation << 8) + ord(midi_str_or_num)
return summation, midi_str[length:]
else:
mid_num = midi_str
summation = mid_num - ((mid_num >> (8*length)) << (8*length))
big_bytes = mid_num - summation
return summation, big_bytes
def get_variable_length_number(midi_str):
r'''
Given a string of data, strip off a the first character, or all high-byte characters
terminating with one whose ord() function is < 0x80. Thus a variable number of bytes
might be read.
After finding the appropriate termination,
return the remaining string.
This is necessary as DeltaTime times are given with variable size,
and thus may be if different numbers of characters are used.
(The ellipses below are just to make the doctests work on both Python 2 and
Python 3 (where the output is in bytes).)
>>> get_variable_length_number('A-u')
(65, ...'-u')
>>> get_variable_length_number('-u')
(45, ...'u')
>>> get_variable_length_number('u')
(117, ...'')
>>> get_variable_length_number('test')
(116, ...'est')
>>> get_variable_length_number('E@-E')
(69, ...'@-E')
>>> get_variable_length_number('@-E')
(64, ...'-E')
>>> get_variable_length_number('-E')
(45, ...'E')
>>> get_variable_length_number('E')
(69, ...'')
Test that variable length characters work:
>>> get_variable_length_number(b'\xff\x7f')
(16383, ...'')
>>> get_variable_length_number('中xy')
(210638584, ...'y')
If no low-byte character is encoded, raises an IndexError
>>> get_variable_length_number('中国')
Traceback (most recent call last):
MidiException: did not find the end of the number!
'''
# from http://faydoc.tripod.com/formats/mid.htm
# This allows the number to be read one byte at a time, and when you see
# a msb of 0, you know that it was the last (least significant) byte of the number.
summation = 0
if isinstance(midi_str, str):
midi_str = midi_str.encode('utf-8')
for i, byte in enumerate(midi_str):
if not is_num(byte):
byte = ord(byte)
summation = (summation << 7) + (byte & 0x7F)
if not byte & 0x80:
try:
return summation, midi_str[i+1:]
except IndexError:
break
raise MidiException('did not find the end of the number!')
def get_numbers_as_list(midi_str):
'''
Translate each char into a number, return in a list.
Used for reading data messages where each byte encodes
a different discrete value.
>>> get_numbers_as_list('\\x00\\x00\\x00\\x03')
[0, 0, 0, 3]
'''
post = []
for item in midi_str:
if is_num(item):
post.append(item)
else:
post.append(ord(item))
return post
def put_number(num, length):
'''
Put a single number as a hex number at the end of a string `length` bytes long.
>>> put_number(3, 4)
b'\\x00\\x00\\x00\\x03'
>>> put_number(0, 1)
b'\\x00'
'''
lst = bytearray()
for i in range(length):
shift_bits = 8 * (length - 1 - i)
this_num = (num >> shift_bits) & 0xFF
lst.append(this_num)
return bytes(lst)
def put_variable_length_number(num):
'''
>>> put_variable_length_number(4)
b'\\x04'
>>> put_variable_length_number(127)
b'\\x7f'
>>> put_variable_length_number(0)
b'\\x00'
>>> put_variable_length_number(1024)
b'\\x88\\x00'
>>> put_variable_length_number(8192)
b'\\xc0\\x00'
>>> put_variable_length_number(16383)
b'\\xff\\x7f'
>>> put_variable_length_number(-1)
Traceback (most recent call last):
MidiException: cannot put_variable_length_number() when number is negative: -1
'''
if num < 0:
raise MidiException(
'cannot put_variable_length_number() when number is negative: %s' % num)
lst = bytearray()
while True:
result, num = num & 0x7F, num >> 7
lst.append(result + 0x80)
if num == 0:
break
lst.reverse()
lst[-1] = lst[-1] & 0x7f
return bytes(lst)
def put_numbers_as_list(num_list):
'''
Translate a list of numbers (0-255) into a bytestring.
Used for encoding data messages where each byte encodes a different discrete value.
>>> put_numbers_as_list([0, 0, 0, 3])
b'\\x00\\x00\\x00\\x03'
If a number is < 0 then it wraps around from the top.
>>> put_numbers_as_list([0, 0, 0, -3])
b'\\x00\\x00\\x00\\xfd'
>>> put_numbers_as_list([0, 0, 0, -1])
b'\\x00\\x00\\x00\\xff'
A number > 255 is an exception:
>>> put_numbers_as_list([256])
Traceback (most recent call last):
MidiException: Cannot place a number > 255 in a list: 256
'''
post = bytearray()
for num in num_list:
if num < 0:
num = num % 256 # -1 will be 255
if num >= 256:
raise MidiException("Cannot place a number > 255 in a list: %d" % num)
post.append(num)
return bytes(post)
#-------------------------------------------------------------------------------
class Enumeration(object):
'''
Utility object for defining binary MIDI message constants.
'''
def __init__(self, enum_list=None):
if enum_list is None:
enum_list = []
lookup = {}
reverse_lookup = {}
num = 0
unique_names = []
unique_values = []
for enum in enum_list:
if isinstance(enum, tuple):
enum, num = enum
if not isinstance(enum, str):
raise EnumerationException("enum name is not a string: " + enum)
if not isinstance(num, int):
raise EnumerationException("enum value is not an integer: " + num)
if enum in unique_names:
raise EnumerationException("enum name is not unique: " + enum)
if num in unique_values:
raise EnumerationException("enum value is not unique for " + enum)
unique_names.append(enum)
unique_values.append(num)
lookup[enum] = num
reverse_lookup[num] = enum
num = num + 1
self.lookup = lookup
self.reverse_lookup = reverse_lookup
def __add__(self, other):
lst = []
for k in self.lookup:
lst.append((k, self.lookup[k]))
for k in other.lookup:
lst.append((k, other.lookup[k]))
return Enumeration(lst)
def hasattr(self, attr):
if attr in self.lookup:
return True
return False
def has_value(self, attr):
if attr in self.reverse_lookup:
return True
return False
def __getattr__(self, attr):
if attr not in self.lookup:
raise AttributeError
return self.lookup[attr]
def whatis(self, value):
post = self.reverse_lookup[value]
return post
CHANNEL_VOICE_MESSAGES = Enumeration([
("NOTE_OFF", 0x80),
("NOTE_ON", 0x90),
("POLYPHONIC_KEY_PRESSURE", 0xA0),
("CONTROLLER_CHANGE", 0xB0),
("PROGRAM_CHANGE", 0xC0),
("CHANNEL_KEY_PRESSURE", 0xD0),
("PITCH_BEND", 0xE0)])
CHANNEL_MODE_MESSAGES = Enumeration([
("ALL_SOUND_OFF", 0x78),
("RESET_ALL_CONTROLLERS", 0x79),
("LOCAL_CONTROL", 0x7A),
("ALL_NOTES_OFF", 0x7B),
("OMNI_MODE_OFF", 0x7C),
("OMNI_MODE_ON", 0x7D),
("MONO_MODE_ON", 0x7E),
("POLY_MODE_ON", 0x7F)])
META_EVENTS = Enumeration([
("SEQUENCE_NUMBER", 0x00),
("TEXT_EVENT", 0x01),
("COPYRIGHT_NOTICE", 0x02),
("SEQUENCE_TRACK_NAME", 0x03),
("INSTRUMENT_NAME", 0x04),
("LYRIC", 0x05),
("MARKER", 0x06),
("CUE_POINT", 0x07),
("PROGRAM_NAME", 0x08),
# optional event is used to embed the
# patch/program name that is called up by the immediately
# subsequent Bank Select and Program Change messages.
# It serves to aid the end user in making an intelligent
# program choice when using different hardware.
("SOUND_SET_UNSUPPORTED", 0x09),
("MIDI_CHANNEL_PREFIX", 0x20),
("MIDI_PORT", 0x21),
("END_OF_TRACK", 0x2F),
("SET_TEMPO", 0x51),
("SMTPE_OFFSET", 0x54),
("TIME_SIGNATURE", 0x58),
("KEY_SIGNATURE", 0x59),
("SEQUENCER_SPECIFIC_META_EVENT", 0x7F)])
#-------------------------------------------------------------------------------
class MidiEvent(object):
'''
A model of a MIDI event, including note-on, note-off, program change,
controller change, any many others.
MidiEvent objects are paired (preceded) by :class:`~base.DeltaTime`
objects in the list of events in a MidiTrack object.
The `track` argument must be a :class:`~base.MidiTrack` object.
The `type_` attribute is a string representation of a Midi event from the CHANNEL_VOICE_MESSAGES
or META_EVENTS definitions.
The `channel` attribute is an integer channel id, from 1 to 16.
The `time` attribute is an integer duration of the event in ticks. This value
can be zero. This value is not essential, as ultimate time positioning is
determined by :class:`~base.DeltaTime` objects.
The `pitch` attribute is only defined for note-on and note-off messages.
The attribute stores an integer representation (0-127, with 60 = middle C).
The `velocity` attribute is only defined for note-on and note-off messages.
The attribute stores an integer representation (0-127). A note-on message with
velocity 0 is generally assumed to be the same as a note-off message.
The `data` attribute is used for storing other messages,
such as SEQUENCE_TRACK_NAME string values.
>>> mt = MidiTrack(1)
>>> me1 = MidiEvent(mt)
>>> me1.type_ = "NOTE_ON"
>>> me1.channel = 3
>>> me1.time = 200
>>> me1.pitch = 60
>>> me1.velocity = 120
>>> me1
<MidiEvent NOTE_ON, t=200, track=1, channel=3, pitch=60, velocity=120>
>>> me2 = MidiEvent(mt)
>>> me2.type_ = "SEQUENCE_TRACK_NAME"
>>> me2.time = 0
>>> me2.data = 'guitar'
>>> me2
<MidiEvent SEQUENCE_TRACK_NAME, t=0, track=1, channel=None, data=b'guitar'>
'''
def __init__(self, track, type_=None, time=None, channel=None):
self.track = track
self.type_ = type_
self.time = time
self.channel = channel
self._parameter1 = None # pitch or first data value
self._parameter2 = None # velocity or second data value
# data is a property...
# if this is a Note on/off, need to store original
# pitch space value in order to determine if this is has a microtone
self.cent_shift = None
# store a reference to a corresponding event
# if a noteOn, store the note off, and vice versa
# NTODO: We should make sure that we garbage collect this -- otherwise it's a memory
# leak from a circular reference.
# note: that's what weak references are for
# unimplemented
self.corresponding_event = None
# store and pass on a running status if found
self.last_status_byte = None
self.sort_order = 0
self.update_sort_order()
def update_sort_order(self):
if self.type_ == 'PITCH_BEND':
self.sort_order = -10
if self.type_ == 'NOTE_OFF':
self.sort_order = -20
def __repr__(self):
if self.track is None:
track_index = None
else:
track_index = self.track.index
return_str = ("<MidiEvent %s, t=%s, track=%s, channel=%s" %
(self.type_, repr(self.time), track_index,
repr(self.channel)))
if self.type_ in ['NOTE_ON', 'NOTE_OFF']:
attr_list = ["pitch", "velocity"]
else:
if self._parameter2 is None:
attr_list = ['data']
else:
attr_list = ['_parameter1', '_parameter2']
for attrib in attr_list:
if getattr(self, attrib) is not None:
return_str = return_str + ", " + attrib + "=" + repr(getattr(self, attrib))
return return_str + ">"
def _set_pitch(self, value):
self._parameter1 = value
def _get_pitch(self):
if self.type_ in ['NOTE_ON', 'NOTE_OFF']:
return self._parameter1
else:
return None
pitch = property(_get_pitch, _set_pitch)
def _set_velocity(self, value):
self._parameter2 = value
def _get_velocity(self):
return self._parameter2
velocity = property(_get_velocity, _set_velocity)
def _set_data(self, value):
if value is not None and not isinstance(value, bytes):
if isinstance(value, str):
value = value.encode('utf-8')
self._parameter1 = value
def _get_data(self):
return self._parameter1
data = property(_get_data, _set_data)
def set_pitch_bend(self, cents, bend_range=2):
'''
Treat this event as a pitch bend value, and set the ._parameter1 and
._parameter2 fields appropriately given a specified bend value in cents.
The `bend_range` parameter gives the number of half steps in the bend range.
>>> mt = MidiTrack(1)
>>> me1 = MidiEvent(mt)
>>> me1.set_pitch_bend(50)
>>> me1._parameter1, me1._parameter2
(0, 80)
>>> me1.set_pitch_bend(100)
>>> me1._parameter1, me1._parameter2
(0, 96)
>>> me1.set_pitch_bend(200)
>>> me1._parameter1, me1._parameter2
(127, 127)
>>> me1.set_pitch_bend(-50)
>>> me1._parameter1, me1._parameter2
(0, 48)
>>> me1.set_pitch_bend(-100)
>>> me1._parameter1, me1._parameter2
(0, 32)
'''
# value range is 0, 16383
# center should be 8192
cent_range = bend_range * 100
center = 8192
top_span = 16383 - center
bottom_span = center
if cents > 0:
shift_scalar = cents / float(cent_range)
shift = int(round(shift_scalar * top_span))
elif cents < 0:
shift_scalar = cents / float(cent_range) # will be negative
shift = int(round(shift_scalar * bottom_span)) # will be negative
else:
shift = 0
target = center + shift
# produce a two-char value
char_value = put_variable_length_number(target)
data1, _ = get_number(char_value[0], 1)
# need to convert from 8 bit to 7, so using & 0x7F
data1 = data1 & 0x7F
if len(char_value) > 1:
data2, _ = get_number(char_value[1], 1)
data2 = data2 & 0x7F
else:
data2 = 0
self._parameter1 = data2
self._parameter2 = data1 # data1 is msb here
def _parse_channel_voice_message(self, midi_str):
'''
>>> mt = MidiTrack(1)
>>> me1 = MidiEvent(mt)
>>> remainder = me1._parse_channel_voice_message(ints_to_hex_string([144, 60, 120]))
>>> me1.channel
1
>>> remainder = me1._parse_channel_voice_message(ints_to_hex_string([145, 60, 120]))
>>> me1.channel
2
>>> me1.type_
'NOTE_ON'
>>> me1.pitch
60
>>> me1.velocity
120
'''
# first_byte, channel_number, and second_byte define
# characteristics of the first two chars
# for first_byte: The left nybble (4 bits) contains the actual command, and the right nibble
# contains the midi channel number on which the command will be executed.
if is_num(midi_str[0]):
first_byte = midi_str[0]
else:
first_byte = ord(midi_str[0])
channel_number = first_byte & 0xF0
if is_num(midi_str[1]):
second_byte = midi_str[1]
else:
second_byte = ord(midi_str[1])
if is_num(midi_str[2]):
third_byte = midi_str[2]
else:
third_byte = ord(midi_str[2])
self.channel = (first_byte & 0x0F) + 1
self.type_ = CHANNEL_VOICE_MESSAGES.whatis(channel_number)
if (self.type_ == "PROGRAM_CHANGE" or
self.type_ == "CHANNEL_KEY_PRESSURE"):
self.data = second_byte
return midi_str[2:]
elif self.type_ == "CONTROLLER_CHANGE":
# for now, do nothing with this data
# for a note, str[2] is velocity; here, it is the control value
self.pitch = second_byte # this is the controller id
self.velocity = third_byte # this is the controller value
return midi_str[3:]
else:
self.pitch = second_byte
self.velocity = third_byte
return midi_str[3:]
def read(self, time, midi_str):
'''
Parse the string that is given and take the beginning
section and convert it into data for this event and return the
now truncated string.
The `time` value is the number of ticks into the Track
at which this event happens. This is derived from reading
data the level of the track.
TODO: These instructions are inadequate.
>>> # all note-on messages (144-159) can be found
>>> 145 & 0xF0 # testing message type_ extraction
144
>>> 146 & 0xF0 # testing message type_ extraction
144
>>> (144 & 0x0F) + 1 # getting the channel
1
>>> (159 & 0x0F) + 1 # getting the channel
16
'''
if len(midi_str) < 2:
# often what we have here are null events:
# the string is simply: 0x00
print(
'MidiEvent.read(): got bad data string',
'time',
time,
'str',
repr(midi_str))
return ''
# first_byte, message_type, and second_byte define
# characteristics of the first two chars
# for first_byte: The left nybble (4 bits) contains the
# actual command, and the right nibble
# contains the midi channel number on which the command will
# be executed.
if is_num(midi_str[0]):
first_byte = midi_str[0]
else:
first_byte = ord(midi_str[0])
# detect running status: if the status byte is less than 128, its
# not a status byte, but a data byte
if first_byte < 128:
if self.last_status_byte is not None:
rsb = self.last_status_byte
if is_num(rsb):
rsb = bytes([rsb])
else:
rsb = bytes([0x90])
# add the running status byte to the front of the string
# and process as before
midi_str = rsb + midi_str
if is_num(midi_str[0]):
first_byte = midi_str[0]
else:
first_byte = ord(midi_str[0])
else:
self.last_status_byte = midi_str[0]
message_type = first_byte & 0xF0
if is_num(midi_str[1]):
second_byte = midi_str[1]
else:
second_byte = ord(midi_str[1])
if CHANNEL_VOICE_MESSAGES.has_value(message_type):
return self._parse_channel_voice_message(midi_str)
elif message_type == 0xB0 and CHANNEL_MODE_MESSAGES.has_value(second_byte):
self.channel = (first_byte & 0x0F) + 1
self.type_ = CHANNEL_MODE_MESSAGES.whatis(second_byte)
if self.type_ == "LOCAL_CONTROL":
self.data = (ord(midi_str[2]) == 0x7F)
elif self.type_ == "MONO_MODE_ON":
self.data = ord(midi_str[2])
else:
print('unhandled message:', midi_str[2])
return midi_str[3:]
elif first_byte == 0xF0 or first_byte == 0xF7:
self.type_ = {0xF0: "F0_SYSEX_EVENT",
0xF7: "F7_SYSEX_EVENT"}[first_byte]
length, midi_str = get_variable_length_number(midi_str[1:])
self.data = midi_str[:length]
return midi_str[length:]
# SEQUENCE_TRACK_NAME and other MetaEvents are here
elif first_byte == 0xFF:
if not META_EVENTS.has_value(second_byte):
print("unknown meta event: FF %02X" % second_byte)
sys.stdout.flush()
raise MidiException("Unknown midi event type_: %r, %r" % (first_byte, second_byte))
self.type_ = META_EVENTS.whatis(second_byte)
length, midi_str = get_variable_length_number(midi_str[2:])
self.data = midi_str[:length]
return midi_str[length:]
else:
# an uncaught message
print(
'got unknown midi event type_',
repr(first_byte),
'char_to_binary(midi_str[0])',
char_to_binary(midi_str[0]),
'char_to_binary(midi_str[1])',
char_to_binary(midi_str[1]))
raise MidiException("Unknown midi event type_")
def get_bytes(self):
'''
Return a set of bytes for this MIDI event.
'''
sysex_event_dict = {"F0_SYSEX_EVENT": 0xF0,
"F7_SYSEX_EVENT": 0xF7}
if CHANNEL_VOICE_MESSAGES.hasattr(self.type_):
return_bytes = chr((self.channel - 1) +
getattr(CHANNEL_VOICE_MESSAGES, self.type_))
# for writing note-on/note-off
if self.type_ not in [
'PROGRAM_CHANGE', 'CHANNEL_KEY_PRESSURE']:
# this results in a two-part string, like '\x00\x00'
try:
data = chr(self._parameter1) + chr(self._parameter2)
except ValueError:
raise MidiException(
"Problem with representing either %d or %d" % (
self._parameter1, self._parameter2))
elif self.type_ in ['PROGRAM_CHANGE']:
try:
data = chr(self.data)
except TypeError:
raise MidiException(
"Got incorrect data for %return_bytes in .data: %return_bytes," %
(self, self.data) + "cannot parse Program Change")
else:
try:
data = chr(self.data)
except TypeError:
raise MidiException(
("Got incorrect data for %return_bytes in "
".data: %return_bytes, ") % (self, self.data) +
"cannot parse Miscellaneous Message")
return return_bytes + data
elif CHANNEL_MODE_MESSAGES.hasattr(self.type_):
return_bytes = getattr(CHANNEL_MODE_MESSAGES, self.type_)
return_bytes = (chr(0xB0 + (self.channel - 1)) +
chr(return_bytes) +
chr(self.data))
return return_bytes
elif self.type_ in sysex_event_dict:
return_bytes = bytes([sysex_event_dict[self.type_]])
return_bytes = return_bytes + put_variable_length_number(len(self.data))
return return_bytes + self.data
elif META_EVENTS.hasattr(self.type_):
return_bytes = bytes([0xFF]) + bytes([getattr(META_EVENTS, self.type_)])
return_bytes = return_bytes + put_variable_length_number(len(self.data))
try:
return return_bytes + self.data
except (UnicodeDecodeError, TypeError):
return return_bytes + unicodedata.normalize(
'NFKD', self.data).encode('ascii', 'ignore')
else:
raise MidiException("unknown midi event type_: %return_bytes" % self.type_)
#---------------------------------------------------------------------------
def is_note_on(self):
'''
return a boolean if this is a NOTE_ON message and velocity is not zero_
>>> mt = MidiTrack(1)
>>> me1 = MidiEvent(mt)
>>> me1.type_ = "NOTE_ON"
>>> me1.velocity = 120
>>> me1.is_note_on()
True
>>> me1.is_note_off()
False
'''
return self.type_ == "NOTE_ON" and self.velocity != 0
def is_note_off(self):
'''
Return a boolean if this is should be interpreted as a note-off message,
either as a real note-off or as a note-on with zero velocity.
>>> mt = MidiTrack(1)
>>> me1 = MidiEvent(mt)
>>> me1.type_ = "NOTE_OFF"
>>> me1.is_note_on()
False
>>> me1.is_note_off()
True
>>> me2 = MidiEvent(mt)
>>> me2.type_ = "NOTE_ON"
>>> me2.velocity = 0
>>> me2.is_note_on()
False
>>> me2.is_note_off()
True
'''
if self.type_ == "NOTE_OFF":
return True
elif self.type_ == "NOTE_ON" and self.velocity == 0:
return True
return False
def is_delta_time(self):
'''
Return a boolean if this is a DeltaTime subclass.
>>> mt = MidiTrack(1)
>>> dt = DeltaTime(mt)
>>> dt.is_delta_time()
True
'''
if self.type_ == "DeltaTime":
return True
return False
def matched_note_off(self, other):
'''
Returns True if `other` is a MIDI event that specifies
a note-off message for this message. That is, this event
is a NOTE_ON message, and the other is a NOTE_OFF message
for this pitch on this channel. Otherwise returns False
>>> mt = MidiTrack(1)
>>> me1 = MidiEvent(mt)
>>> me1.type_ = "NOTE_ON"
>>> me1.velocity = 120
>>> me1.pitch = 60
>>> me2 = MidiEvent(mt)
>>> me2.type_ = "NOTE_ON"
>>> me2.velocity = 0
>>> me2.pitch = 60
>>> me1.matched_note_off(me2)
True
>>> me2.pitch = 61
>>> me1.matched_note_off(me2)
False
>>> me2.type_ = "NOTE_OFF"
>>> me1.matched_note_off(me2)
False
>>> me2.pitch = 60
>>> me1.matched_note_off(me2)
True
>>> me2.channel = 12
>>> me1.matched_note_off(me2)
False
'''
if other.is_note_off:
# might check velocity here too?
if self.pitch == other.pitch and self.channel == other.channel:
return True
return False
class DeltaTime(MidiEvent):
'''
A :class:`~base.MidiEvent` subclass that stores the
time change (in ticks) since the start or since the last MidiEvent.
Pairs of DeltaTime and MidiEvent objects are the basic presentation of temporal data.
The `track` argument must be a :class:`~base.MidiTrack` object.
Time values are in integers, representing ticks.
The `channel` attribute, inherited from MidiEvent is not used and set to None
unless overridden (don't!).
>>> mt = MidiTrack(1)
>>> dt = DeltaTime(mt)
>>> dt.time = 380
>>> dt
<MidiEvent DeltaTime, t=380, track=1, channel=None>
'''
def __init__(self, track, time=None, channel=None):
MidiEvent.__init__(self, track, time=time, channel=channel)
self.type_ = "DeltaTime"
def read(self, oldstr):
self.time, newstr = get_variable_length_number(oldstr)
return self.time, newstr
def get_bytes(self):
midi_str = put_variable_length_number(self.time)
return midi_str
class MidiTrack(object):
'''
A MIDI Track. Each track contains a list of
:class:`~base.MidiChannel` objects, one for each channel.
All events are stored in the `events` list, in order.
An `index` is an integer identifier for this object.
TODO: Better Docs
>>> mt = MidiTrack(0)
'''
def __init__(self, index):
self.index = index
self.events = []
self.length = 0 #the data length; only used on read()
def read(self, midi_str):
'''
Read as much of the string (representing midi data) as necessary;
return the remaining string for reassignment and further processing.
The string should begin with `MTrk`, specifying a Midi Track
Creates and stores :class:`~base.DeltaTime`
and :class:`~base.MidiEvent` objects.
'''
time = 0 # a running counter of ticks
if not midi_str[:4] == b"MTrk":
raise MidiException('badly formed midi string: missing leading MTrk')
# get the 4 chars after the MTrk encoding
length, midi_str = get_number(midi_str[4:], 4)
self.length = length
# all event data is in the track str
track_str = midi_str[:length]
remainder = midi_str[length:]
e_previous = None
while track_str:
# shave off the time stamp from the event
delta_t = DeltaTime(self)
# return extracted time, as well as remaining string
d_time, track_str_candidate = delta_t.read(track_str)
# this is the offset that this event happens at, in ticks
time_candidate = time + d_time
# pass self to event, set this MidiTrack as the track for this event
event = MidiEvent(self)
if e_previous is not None: # set the last status byte
event.last_status_byte = e_previous.last_status_byte
# some midi events may raise errors; simply skip for now
try:
track_str_candidate = event.read(time_candidate, track_str_candidate)
except MidiException:
# assume that track_str, after delta extraction, is still correct
# set to result after taking delta time
track_str = track_str_candidate
continue
# only set after trying to read, which may raise exception
time = time_candidate
track_str = track_str_candidate # remainder string
# only append if we get this far
self.events.append(delta_t)
self.events.append(event)
e_previous = event
return remainder # remainder string after extracting track data
def get_bytes(self):
'''
returns a string of midi-data from the `.events` in the object.
'''
# build str using MidiEvents
midi_str = b""
for event in self.events:
# this writes both delta time and message events
try:
event_bytes = event.get_bytes()
int_array = []
for byte in event_bytes:
if is_num(byte):
int_array.append(byte)
else:
int_array.append(ord(byte))
event_bytes = bytes(bytearray(int_array))
midi_str = midi_str + event_bytes
except MidiException as err:
print("Conversion error for %s: %s; ignored." % (event, err))
return b"MTrk" + put_number(len(midi_str), 4) + midi_str
def __repr__(self):
return_str = "<MidiTrack %d -- %d events\n" % (self.index, len(self.events))
for event in self.events:
return_str = return_str + " " + event.__repr__() + "\n"
return return_str + " >"
#---------------------------------------------------------------------------
def update_events(self):
'''
We may attach events to this track before setting their `track` parameter.
This method will move through all events and set their track to this track.
'''
for event in self.events:
event.track = self
def has_notes(self):
'''Return True/False if this track has any note-on/note-off pairs defined.
'''
for event in self.events:
if event.is_note_on():
return True
return False
def set_channel(self, value):
'''Set the channel of all events in this Track.
'''
if value not in range(1, 17):
raise MidiException('bad channel value: %s' % value)
for event in self.events:
event.channel = value
def get_channels(self):
'''Get all channels used in this Track.
'''
post = []
for event in self.events:
if event.channel not in post:
post.append(event.channel)
return post
def get_program_changes(self):
'''Get all unique program changes used in this Track, sorted.
'''
post = []
for event in self.events:
if event.type_ == 'PROGRAM_CHANGE':
if event.data not in post:
post.append(event.data)
return post
class MidiFile(object):
'''
Low-level MIDI file writing, emulating methods from normal Python files.
The `ticks_per_quarter_note` attribute must be set before writing. 1024 is a common value.
This object is returned by some properties for directly writing files of midi representations.
'''
def __init__(self):
self.file = None
self.format = 1
self.tracks = []
self.ticks_per_quarter_note = 1024
self.ticks_per_second = None
def open(self, filename, attrib="rb"):
'''
Open a MIDI file path for reading or writing.
For writing to a MIDI file, `attrib` should be "wb".
'''
if attrib not in ['rb', 'wb']:
raise MidiException('cannot read or write unless in binary mode, not:', attrib)
self.file = open(filename, attrib)
def open_file_like(self, file_like):
'''Assign a file-like object, such as those provided by StringIO, as an open file object.
>>> from io import StringIO
>>> fileLikeOpen = StringIO()
>>> mf = MidiFile()
>>> mf.open_file_like(fileLikeOpen)
>>> mf.close()
'''
self.file = file_like
def __repr__(self):
return_str = "<MidiFile %d tracks\n" % len(self.tracks)
for track in self.tracks:
return_str = return_str + " " + track.__repr__() + "\n"
return return_str + ">"
def close(self):
'''
Close the file.
'''
self.file.close()
def read(self):
'''
Read and parse MIDI data stored in a file.
'''
self.readstr(self.file.read())
def readstr(self, midi_str):
'''
Read and parse MIDI data as a string, putting the
data in `.ticks_per_quarter_note` and a list of
`MidiTrack` objects in the attribute `.tracks`.
'''
if not midi_str[:4] == b"MThd":
raise MidiException('badly formated midi string, got: %s' % midi_str[:20])
# we step through the str src, chopping off characters as we go
# and reassigning to str
length, midi_str = get_number(midi_str[4:], 4)
if length != 6:
raise MidiException('badly formated midi string')
midi_format_type, midi_str = get_number(midi_str, 2)
self.format = midi_format_type
if midi_format_type not in (0, 1):
raise MidiException('cannot handle midi file format: %s' % format)
num_tracks, midi_str = get_number(midi_str, 2)
division, midi_str = get_number(midi_str, 2)
# very few midi files seem to define ticks_per_second
if division & 0x8000:
frames_per_second = -((division >> 8) | -128)
ticks_per_frame = division & 0xFF
if ticks_per_frame not in [24, 25, 29, 30]:
raise MidiException('cannot handle ticks per frame: %s' % ticks_per_frame)
if ticks_per_frame == 29:
ticks_per_frame = 30 # drop frame
self.ticks_per_second = ticks_per_frame * frames_per_second
else:
self.ticks_per_quarter_note = division & 0x7FFF
for i in range(num_tracks):
trk = MidiTrack(i) # sets the MidiTrack index parameters
midi_str = trk.read(midi_str) # pass all the remaining string, reassing
self.tracks.append(trk)
def write(self):
'''
Write MIDI data as a file to the file opened with `.open()`.
'''
self.file.write(self.writestr())
def writestr(self):
'''
generate the midi data header and convert the list of
midi_track objects in self_tracks into midi data and return it as a string_
'''
midi_str = self.write_m_thd_str()
for trk in self.tracks:
midi_str = midi_str + trk.get_bytes()
return midi_str
def write_m_thd_str(self):
'''
convert the information in self_ticks_per_quarter_note
into midi data header and return it as a string_'''
division = self.ticks_per_quarter_note
# Don't handle ticks_per_second yet, too confusing
if (division & 0x8000) != 0:
raise MidiException(
'Cannot write midi string unless self.ticks_per_quarter_note is a multiple of 1024')
midi_str = b"MThd" + put_number(6, 4) + put_number(self.format, 2)
midi_str = midi_str + put_number(len(self.tracks), 2)
midi_str = midi_str + put_number(division, 2)
return midi_str
if __name__ == "__main__":
import doctest
doctest.testmod(optionflags=doctest.ELLIPSIS)
| nihlaeth/voicetrainer | voicetrainer/midi.py | Python | gpl-3.0 | 42,017 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
1052,
8516,
18447,
1024,
4487,
19150,
1027,
2205,
1011,
2116,
1011,
3210,
1010,
2205,
1011,
3375,
1010,
2205,
1011,
2116,
1011,
5628,
1001,
1052,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package main
var (
// Debug var to switch mode from outside
debug string
// CommitHash exported to assign it from main.go
commitHash string
)
// Most easiest way to configure
// an application is define config as
// yaml string and then parse it into
// map.
// How it works see here:
// https://github.com/olebedev/config
var confString = `
debug: false
commit: 0
port: 5000
title: Vio
api:
prefix: /api
duktape:
path: static/build/bundle.js
`
| jasonf7/memories-of-harambe | server/conf.go | GO | mit | 459 | [
30522,
7427,
2364,
13075,
1006,
1013,
1013,
2139,
8569,
2290,
13075,
2000,
6942,
5549,
2013,
2648,
2139,
8569,
2290,
5164,
1013,
1013,
10797,
14949,
2232,
15612,
2000,
23911,
2009,
2013,
2364,
1012,
2175,
10797,
14949,
2232,
5164,
1007,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright ©2015 The gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gonum
import (
"gonum.org/v1/gonum/blas"
"gonum.org/v1/gonum/lapack"
)
// Dlasr applies a sequence of plane rotations to the m×n matrix A. This series
// of plane rotations is implicitly represented by a matrix P. P is multiplied
// by a depending on the value of side -- A = P * A if side == lapack.Left,
// A = A * P^T if side == lapack.Right.
//
//The exact value of P depends on the value of pivot, but in all cases P is
// implicitly represented by a series of 2×2 rotation matrices. The entries of
// rotation matrix k are defined by s[k] and c[k]
// R(k) = [ c[k] s[k]]
// [-s[k] s[k]]
// If direct == lapack.Forward, the rotation matrices are applied as
// P = P(z-1) * ... * P(2) * P(1), while if direct == lapack.Backward they are
// applied as P = P(1) * P(2) * ... * P(n).
//
// pivot defines the mapping of the elements in R(k) to P(k).
// If pivot == lapack.Variable, the rotation is performed for the (k, k+1) plane.
// P(k) = [1 ]
// [ ... ]
// [ 1 ]
// [ c[k] s[k] ]
// [ -s[k] c[k] ]
// [ 1 ]
// [ ... ]
// [ 1]
// if pivot == lapack.Top, the rotation is performed for the (1, k+1) plane,
// P(k) = [c[k] s[k] ]
// [ 1 ]
// [ ... ]
// [ 1 ]
// [-s[k] c[k] ]
// [ 1 ]
// [ ... ]
// [ 1]
// and if pivot == lapack.Bottom, the rotation is performed for the (k, z) plane.
// P(k) = [1 ]
// [ ... ]
// [ 1 ]
// [ c[k] s[k]]
// [ 1 ]
// [ ... ]
// [ 1 ]
// [ -s[k] c[k]]
// s and c have length m - 1 if side == blas.Left, and n - 1 if side == blas.Right.
//
// Dlasr is an internal routine. It is exported for testing purposes.
func (impl Implementation) Dlasr(side blas.Side, pivot lapack.Pivot, direct lapack.Direct, m, n int, c, s, a []float64, lda int) {
checkMatrix(m, n, a, lda)
if side != blas.Left && side != blas.Right {
panic(badSide)
}
if pivot != lapack.Variable && pivot != lapack.Top && pivot != lapack.Bottom {
panic(badPivot)
}
if direct != lapack.Forward && direct != lapack.Backward {
panic(badDirect)
}
if side == blas.Left {
if len(c) < m-1 {
panic(badSlice)
}
if len(s) < m-1 {
panic(badSlice)
}
} else {
if len(c) < n-1 {
panic(badSlice)
}
if len(s) < n-1 {
panic(badSlice)
}
}
if m == 0 || n == 0 {
return
}
if side == blas.Left {
if pivot == lapack.Variable {
if direct == lapack.Forward {
for j := 0; j < m-1; j++ {
ctmp := c[j]
stmp := s[j]
if ctmp != 1 || stmp != 0 {
for i := 0; i < n; i++ {
tmp2 := a[j*lda+i]
tmp := a[(j+1)*lda+i]
a[(j+1)*lda+i] = ctmp*tmp - stmp*tmp2
a[j*lda+i] = stmp*tmp + ctmp*tmp2
}
}
}
return
}
for j := m - 2; j >= 0; j-- {
ctmp := c[j]
stmp := s[j]
if ctmp != 1 || stmp != 0 {
for i := 0; i < n; i++ {
tmp2 := a[j*lda+i]
tmp := a[(j+1)*lda+i]
a[(j+1)*lda+i] = ctmp*tmp - stmp*tmp2
a[j*lda+i] = stmp*tmp + ctmp*tmp2
}
}
}
return
} else if pivot == lapack.Top {
if direct == lapack.Forward {
for j := 1; j < m; j++ {
ctmp := c[j-1]
stmp := s[j-1]
if ctmp != 1 || stmp != 0 {
for i := 0; i < n; i++ {
tmp := a[j*lda+i]
tmp2 := a[i]
a[j*lda+i] = ctmp*tmp - stmp*tmp2
a[i] = stmp*tmp + ctmp*tmp2
}
}
}
return
}
for j := m - 1; j >= 1; j-- {
ctmp := c[j-1]
stmp := s[j-1]
if ctmp != 1 || stmp != 0 {
for i := 0; i < n; i++ {
ctmp := c[j-1]
stmp := s[j-1]
if ctmp != 1 || stmp != 0 {
for i := 0; i < n; i++ {
tmp := a[j*lda+i]
tmp2 := a[i]
a[j*lda+i] = ctmp*tmp - stmp*tmp2
a[i] = stmp*tmp + ctmp*tmp2
}
}
}
}
}
return
}
if direct == lapack.Forward {
for j := 0; j < m-1; j++ {
ctmp := c[j]
stmp := s[j]
if ctmp != 1 || stmp != 0 {
for i := 0; i < n; i++ {
tmp := a[j*lda+i]
tmp2 := a[(m-1)*lda+i]
a[j*lda+i] = stmp*tmp2 + ctmp*tmp
a[(m-1)*lda+i] = ctmp*tmp2 - stmp*tmp
}
}
}
return
}
for j := m - 2; j >= 0; j-- {
ctmp := c[j]
stmp := s[j]
if ctmp != 1 || stmp != 0 {
for i := 0; i < n; i++ {
tmp := a[j*lda+i]
tmp2 := a[(m-1)*lda+i]
a[j*lda+i] = stmp*tmp2 + ctmp*tmp
a[(m-1)*lda+i] = ctmp*tmp2 - stmp*tmp
}
}
}
return
}
if pivot == lapack.Variable {
if direct == lapack.Forward {
for j := 0; j < n-1; j++ {
ctmp := c[j]
stmp := s[j]
if ctmp != 1 || stmp != 0 {
for i := 0; i < m; i++ {
tmp := a[i*lda+j+1]
tmp2 := a[i*lda+j]
a[i*lda+j+1] = ctmp*tmp - stmp*tmp2
a[i*lda+j] = stmp*tmp + ctmp*tmp2
}
}
}
return
}
for j := n - 2; j >= 0; j-- {
ctmp := c[j]
stmp := s[j]
if ctmp != 1 || stmp != 0 {
for i := 0; i < m; i++ {
tmp := a[i*lda+j+1]
tmp2 := a[i*lda+j]
a[i*lda+j+1] = ctmp*tmp - stmp*tmp2
a[i*lda+j] = stmp*tmp + ctmp*tmp2
}
}
}
return
} else if pivot == lapack.Top {
if direct == lapack.Forward {
for j := 1; j < n; j++ {
ctmp := c[j-1]
stmp := s[j-1]
if ctmp != 1 || stmp != 0 {
for i := 0; i < m; i++ {
tmp := a[i*lda+j]
tmp2 := a[i*lda]
a[i*lda+j] = ctmp*tmp - stmp*tmp2
a[i*lda] = stmp*tmp + ctmp*tmp2
}
}
}
return
}
for j := n - 1; j >= 1; j-- {
ctmp := c[j-1]
stmp := s[j-1]
if ctmp != 1 || stmp != 0 {
for i := 0; i < m; i++ {
tmp := a[i*lda+j]
tmp2 := a[i*lda]
a[i*lda+j] = ctmp*tmp - stmp*tmp2
a[i*lda] = stmp*tmp + ctmp*tmp2
}
}
}
return
}
if direct == lapack.Forward {
for j := 0; j < n-1; j++ {
ctmp := c[j]
stmp := s[j]
if ctmp != 1 || stmp != 0 {
for i := 0; i < m; i++ {
tmp := a[i*lda+j]
tmp2 := a[i*lda+n-1]
a[i*lda+j] = stmp*tmp2 + ctmp*tmp
a[i*lda+n-1] = ctmp*tmp2 - stmp*tmp
}
}
}
return
}
for j := n - 2; j >= 0; j-- {
ctmp := c[j]
stmp := s[j]
if ctmp != 1 || stmp != 0 {
for i := 0; i < m; i++ {
tmp := a[i*lda+j]
tmp2 := a[i*lda+n-1]
a[i*lda+j] = stmp*tmp2 + ctmp*tmp
a[i*lda+n-1] = ctmp*tmp2 - stmp*tmp
}
}
}
}
| pts-eduardoacuna/pachy-learning | vendor/gonum.org/v1/gonum/lapack/gonum/dlasr.go | GO | gpl-3.0 | 6,827 | [
30522,
1013,
1013,
9385,
1075,
11387,
16068,
1996,
2175,
19172,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
1013,
1013,
6105,
2008,
2064,
2022,
2179,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
trait Set<T> {
fn contains(&self, T) -> bool;
fn set(&mut self, T);
}
impl<'a, T, S> Set<&'a [T]> for S where
T: Copy,
S: Set<T>,
{
fn contains(&self, bits: &[T]) -> bool {
bits.iter().all(|&bit| self.contains(bit))
}
fn set(&mut self, bits: &[T]) {
for &bit in bits.iter() {
self.set(bit)
}
}
}
fn main() {
let bits: &[_] = &[0, 1];
0.contains(bits);
//~^ ERROR the trait `Set<_>` is not implemented for the type `_`
}
| kimroen/rust | src/test/compile-fail/issue-18400.rs | Rust | apache-2.0 | 967 | [
30522,
1013,
1013,
9385,
2297,
1996,
18399,
2622,
9797,
1012,
2156,
1996,
9385,
1013,
1013,
5371,
2012,
1996,
2327,
1011,
2504,
14176,
1997,
2023,
4353,
1998,
2012,
1013,
1013,
8299,
1024,
1013,
1013,
18399,
1011,
11374,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
class RemoveModels < ActiveRecord::Migration[4.2]
def change
drop_table :roles
drop_table :role_names
drop_table :people
end
end
| ZeusWPI/Gandalf | db/migrate/20140308135535_remove_models.rb | Ruby | mit | 145 | [
30522,
2465,
6366,
5302,
9247,
2015,
1026,
3161,
2890,
27108,
2094,
1024,
1024,
9230,
1031,
1018,
1012,
1016,
1033,
13366,
2689,
4530,
1035,
2795,
1024,
4395,
4530,
1035,
2795,
1024,
2535,
1035,
3415,
4530,
1035,
2795,
1024,
2111,
2203,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
if os.path.exists(asset_path):
# Skip downloading
asset_path = None
else:
if not os.path.exists(path):
os.makedirs(path)
f = urllib2.urlopen(url)
with open(asset_path, "wb") as local_file:
local_file.write(f.read())
except Exception as e:
sys.exit('Failed to fetch IDE. Error: {0}'.format(e))
finally:
return asset_path
def handle_release_assets(assets):
assets = [ asset for asset in assets if re.match(r'redhawk-ide.+?(?=x86_64)', asset['name'])]
if not assets:
sys.exit('Failed to find the IDE asset')
elif len(assets) > 1:
sys.exit('Found too many IDE assets matching that description...?')
return download_asset('downloads', assets[0]['browser_download_url'])
def run(pv):
RELEASES_URL = 'http://api.github.com/repos/RedhawkSDR/redhawk/releases'
ide_asset = ''
try:
releases = json.loads(urllib2.urlopen(RELEASES_URL).read())
releases = [r for r in releases if r['tag_name'] == pv]
if releases:
ide_asset = handle_release_assets(releases[0]['assets'])
else:
sys.exit('Failed to find the release: {0}'.format(pv))
finally:
return ide_asset
if __name__ == '__main__':
# First argument is the version
asset = run(sys.argv[1])
print asset | Geontech/docker-redhawk-ubuntu | Dockerfiles/files/build/ide-fetcher.py | Python | gpl-3.0 | 1,661 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
18750,
1001,
3166,
1024,
2726,
19928,
1026,
18411,
24146,
10105,
1030,
20248,
10111,
2818,
1012,
4012,
1028,
12324,
24471,
6894,
2497,
2475,
1010,
1046,
3385,
1010,
9808,
1010,
25353,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
require File.expand_path(File.join('..', 'spec_helper'), File.dirname(__FILE__))
require 'pukiwikiparser'
describe PukiWikiParser::PukiWikiParser do
before(:each) do
@parser = PukiWikiParser::PukiWikiParser.new
end
it "should parse hr notation" do
input = "----"
html = "<hr />"
expect(@parser.to_html(input, [])).to eq html
end
it "should parse h2 notation" do
input = "*example"
html = "<h2>example</h2>"
expect(@parser.to_html(input, [])).to eq html
end
it "should parse h3 notation" do
input = "**example"
html = "<h3>example</h3>"
expect(@parser.to_html(input, [])).to eq html
end
it "should parse h4 notation" do
input = "***example"
html = "<h4>example</h4>"
expect(@parser.to_html(input, [])).to eq html
end
it "should parse pre notation" do
input = " example"
html = "<pre><code>example\n</code></pre>"
expect(@parser.to_html(input, [])).to eq html
end
it "should parse quote notation" do
input = "> example"
html = "<blockquote><p>\n example\n</p></blockquote>"
expect(@parser.to_html(input, [])).to eq html
end
it "should parse ul level 1 notation" do
input = "-example"
html = "<ul>\n<li>example\n</li>\n</ul>"
expect(@parser.to_html(input, [])).to eq html
end
it "should parse ul level 2 notation" do
input = "--example"
html = "<ul>\n<ul>\n<li>example\n</li>\n</ul>\n</ul>"
expect(@parser.to_html(input, [])).to eq html
end
it "should parse ul level 3 notation" do
input = "---example"
html = "<ul>\n<ul>\n<ul>\n<li>example\n</li>\n</ul>\n</ul>\n</ul>"
expect(@parser.to_html(input, [])).to eq html
expect(@parser.to_html(input, [])).to eq html
end
it "should parse ol level 1 notation" do
input = "+example"
html = "<ol>\n<li>example\n</li>\n</ol>"
expect(@parser.to_html(input, [])).to eq html
end
it "should parse ol level 2 notation" do
input = "++example"
html = "<ol>\n<ol>\n<li>example\n</li>\n</ol>\n</ol>"
expect(@parser.to_html(input, [])).to eq html
end
it "should parse ol level 3 notation" do
input = "+++example"
html = "<ol>\n<ol>\n<ol>\n<li>example\n</li>\n</ol>\n</ol>\n</ol>"
expect(@parser.to_html(input, [])).to eq html
end
it "should parse dl notation" do
input = ":example|foobarbaz"
html = "<dl>\n<dt>example</dt>\n<dd>foobarbaz</dd>\n</dl>"
expect(@parser.to_html(input, [])).to eq html
end
it "should parse every other inputs as P tag" do
input = "foo, bar, baz"
html = "<p>\nfoo, bar, baz\n</p>"
expect(@parser.to_html(input, [])).to eq html
end
it "should parse line break" do
input = "example~"
html = "<p>\nexample<br />\n</p>"
expect(@parser.to_html(input, [])).to eq html
end
end
| akishin/pukiwikiparser | spec/lib/pukiwikiparser_spec.rb | Ruby | mit | 2,833 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
5478,
5371,
1012,
7818,
1035,
4130,
1006,
5371,
1012,
3693,
1006,
1005,
1012,
1012,
1005,
1010,
1005,
28699,
1035,
2393,
2121,
1005,
1007,
1010,
5371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import os, shutil, xbmc, xbmcgui
pDialog = xbmcgui.DialogProgress()
dialog = xbmcgui.Dialog()
Game_Directories = [ "E:\\Games\\", "F:\\Games\\", "G:\\Games\\", "E:\\Applications\\", "F:\\Applications\\", "G:\\Applications\\", "E:\\Homebrew\\", "F:\\Homebrew\\", "G:\\Homebrew\\", "E:\\Apps\\", "F:\\Apps\\", "G:\\Apps\\", "E:\\Ports\\", "F:\\Ports\\", "G:\\Ports\\" ]
for Game_Directories in Game_Directories:
if os.path.isdir( Game_Directories ):
pDialog.create( "PARSING XBOX GAMES","Initializing" )
pDialog.update(0,"Removing _Resources Folders","","This can take some time, please be patient.")
for Items in sorted( os.listdir( Game_Directories ) ):
if os.path.isdir(os.path.join( Game_Directories, Items)):
Game_Directory = os.path.join( Game_Directories, Items )
_Resources = os.path.join( Game_Directory, "_Resources" )
DefaultTBN = os.path.join( Game_Directory, "default.tbn" )
FanartJPG = os.path.join( Game_Directory, "fanart.jpg" )
if os.path.isdir(_Resources):
shutil.rmtree(_Resources)
else:
print "Cannot find: " + _Resources
if os.path.isfile(DefaultTBN):
os.remove(DefaultTBN)
else:
print "Cannot find: " + DefaultTBN
if os.path.isfile(FanartJPG):
os.remove(FanartJPG)
else:
print "Cannot find: " + FanartJPG
pDialog.close()
dialog.ok("COMPLETE","Done, _Resources Folders Removed.") | Rocky5/XBMC-Emustation | Mod Files/emustation/scripts/not used/Other/Remove _Resources.py | Python | gpl-3.0 | 1,405 | [
30522,
12324,
9808,
1010,
3844,
4014,
1010,
1060,
25526,
2278,
1010,
1060,
25526,
2278,
25698,
22851,
4818,
8649,
1027,
1060,
25526,
2278,
25698,
1012,
13764,
8649,
21572,
17603,
4757,
1006,
1007,
13764,
8649,
1027,
1060,
25526,
2278,
25698,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from migrate.versioning.shell import main
if __name__ == '__main__':
main(debug='False', repository='.')
| ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/db/sqlalchemy/migrate_repo/manage.py | Python | gpl-2.0 | 724 | [
30522,
1001,
9385,
2262,
7480,
2696,
3600,
3192,
1001,
1001,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
1001,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* AJDebug.java
*
* This file is part of Tritonus: http://www.tritonus.org/
*/
/*
* Copyright (c) 1999 - 2002 by Matthias Pfisterer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
|<--- this code is formatted to fit into 80 columns --->|
*/
package org.tritonus.debug;
import org.aspectj.lang.JoinPoint;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.Synthesizer;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.SourceDataLine;
import org.tritonus.core.TMidiConfig;
import org.tritonus.core.TInit;
import org.tritonus.share.TDebug;
import org.tritonus.share.midi.TSequencer;
import org.tritonus.midi.device.alsa.AlsaSequencer;
import org.tritonus.midi.device.alsa.AlsaSequencer.PlaybackAlsaMidiInListener;
import org.tritonus.midi.device.alsa.AlsaSequencer.RecordingAlsaMidiInListener;
import org.tritonus.midi.device.alsa.AlsaSequencer.AlsaSequencerReceiver;
import org.tritonus.midi.device.alsa.AlsaSequencer.AlsaSequencerTransmitter;
import org.tritonus.midi.device.alsa.AlsaSequencer.LoaderThread;
import org.tritonus.midi.device.alsa.AlsaSequencer.MasterSynchronizer;
import org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream;
/** Debugging output aspect.
*/
public aspect AJDebug
extends Utils
{
pointcut allExceptions(): handler(Throwable+);
// TAudioConfig, TMidiConfig, TInit
pointcut TMidiConfigCalls(): execution(* TMidiConfig.*(..));
pointcut TInitCalls(): execution(* TInit.*(..));
// share
// midi
pointcut MidiSystemCalls(): execution(* MidiSystem.*(..));
pointcut Sequencer(): execution(TSequencer+.new(..)) ||
execution(* TSequencer+.*(..)) ||
execution(* PlaybackAlsaMidiInListener.*(..)) ||
execution(* RecordingAlsaMidiInListener.*(..)) ||
execution(* AlsaSequencerReceiver.*(..)) ||
execution(* AlsaSequencerTransmitter.*(..)) ||
execution(LoaderThread.new(..)) ||
execution(* LoaderThread.*(..)) ||
execution(MasterSynchronizer.new(..)) ||
execution(* MasterSynchronizer.*(..));
// audio
pointcut AudioSystemCalls(): execution(* AudioSystem.*(..));
pointcut sourceDataLine():
call(* SourceDataLine+.*(..));
// OLD
// pointcut playerStates():
// execution(private void TPlayer.setState(int));
// currently not used
pointcut printVelocity(): execution(* JavaSoundToneGenerator.playTone(..)) && call(JavaSoundToneGenerator.ToneThread.new(..));
// pointcut tracedCall(): execution(protected void JavaSoundAudioPlayer.doRealize() throws Exception);
///////////////////////////////////////////////////////
//
// ACTIONS
//
///////////////////////////////////////////////////////
before(): MidiSystemCalls()
{
if (TDebug.TraceMidiSystem) outEnteringJoinPoint(thisJoinPoint);
}
after(): MidiSystemCalls()
{
if (TDebug.TraceSequencer) outLeavingJoinPoint(thisJoinPoint);
}
before(): Sequencer()
{
if (TDebug.TraceSequencer) outEnteringJoinPoint(thisJoinPoint);
}
after(): Sequencer()
{
if (TDebug.TraceSequencer) outLeavingJoinPoint(thisJoinPoint);
}
before(): TInitCalls()
{
if (TDebug.TraceInit) outEnteringJoinPoint(thisJoinPoint);
}
after(): TInitCalls()
{
if (TDebug.TraceInit) outLeavingJoinPoint(thisJoinPoint);
}
before(): TMidiConfigCalls()
{
if (TDebug.TraceMidiConfig) outEnteringJoinPoint(thisJoinPoint);
}
after(): TMidiConfigCalls()
{
if (TDebug.TraceMidiConfig) outLeavingJoinPoint(thisJoinPoint);
}
// execution(* TAsynchronousFilteredAudioInputStream.read(..))
before(): execution(* TAsynchronousFilteredAudioInputStream.read())
{
if (TDebug.TraceAudioConverter) outEnteringJoinPoint(thisJoinPoint);
}
after(): execution(* TAsynchronousFilteredAudioInputStream.read())
{
if (TDebug.TraceAudioConverter) outLeavingJoinPoint(thisJoinPoint);
}
before(): execution(* TAsynchronousFilteredAudioInputStream.read(byte[]))
{
if (TDebug.TraceAudioConverter) outEnteringJoinPoint(thisJoinPoint);
}
after(): execution(* TAsynchronousFilteredAudioInputStream.read(byte[]))
{
if (TDebug.TraceAudioConverter) outLeavingJoinPoint(thisJoinPoint);
}
before(): execution(* TAsynchronousFilteredAudioInputStream.read(byte[], int, int))
{
if (TDebug.TraceAudioConverter) outEnteringJoinPoint(thisJoinPoint);
}
after(): execution(* TAsynchronousFilteredAudioInputStream.read(byte[], int, int))
{
if (TDebug.TraceAudioConverter) outLeavingJoinPoint(thisJoinPoint);
}
after() returning(int nBytes): call(* TAsynchronousFilteredAudioInputStream.read(byte[], int, int))
{
if (TDebug.TraceAudioConverter) TDebug.out("returning bytes: " + nBytes);
}
// before(int nState): playerStates() && args(nState)
// {
// // if (TDebug.TracePlayerStates)
// // {
// // TDebug.out("TPlayer.setState(): " + nState);
// // }
// }
// before(): playerStateTransitions()
// {
// // if (TDebug.TracePlayerStateTransitions)
// // {
// // TDebug.out("Entering: " + thisJoinPoint);
// // }
// }
// Synthesizer around(): call(* MidiSystem.getSynthesizer())
// {
// // Synthesizer s = proceed();
// // if (TDebug.TraceToneGenerator)
// // {
// // TDebug.out("MidiSystem.getSynthesizer() gives: " + s);
// // }
// // return s;
// // only to get no compilation errors
// return null;
// }
// TODO: v gives an error; find out what to do
// before(int v): printVelocity() && args(nVelocity)
// {
// if (TDebug.TraceToneGenerator)
// {
// TDebug.out("velocity: " + v);
// }
// }
before(Throwable t): allExceptions() && args(t)
{
if (TDebug.TraceAllExceptions) TDebug.out(t);
}
}
/*** AJDebug.java ***/
| srnsw/xena | plugins/audio/ext/src/tritonus/src/classes/org/tritonus/debug/AJDebug.java | Java | gpl-3.0 | 6,383 | [
30522,
1013,
1008,
1008,
19128,
3207,
8569,
2290,
1012,
9262,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
13012,
2669,
2271,
1024,
8299,
1024,
1013,
1013,
7479,
1012,
13012,
2669,
2271,
1012,
8917,
1013,
1008,
1013,
1013,
1008,
1008,
9385,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>error-handlers: 16 s 🏆</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.4.6 / error-handlers - 1.2.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
error-handlers
<small>
1.2.0
<span class="label label-success">16 s 🏆</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2021-12-17 23:41:22 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-12-17 23:41:22 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-ocamlbuild base OCamlbuild binary and libraries distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 1 Virtual package relying on perl
coq 8.4.6 Formal proof management system.
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.02.3 The OCaml compiler (virtual package)
ocaml-base-compiler 4.02.3 Official 4.02.3 release
ocaml-config 1 OCaml Switch Configuration
ocamlbuild 0 Build system distributed with the OCaml compiler since OCaml 3.10.0
# opam file:
opam-version: "2.0"
maintainer: "dev@clarus.me"
homepage: "https://github.com/clarus/coq-error-handlers"
dev-repo: "git+https://github.com/clarus/coq-error-handlers.git"
bug-reports: "https://github.com/clarus/coq-error-handlers/issues"
authors: ["Guillaume Claret"]
license: "MIT"
build: [
["./configure.sh"]
[make "-j%{jobs}%"]
]
install: [
[make "install"]
]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/ErrorHandlers"]
depends: [
"ocaml"
"coq" {>= "8.4pl4"}
]
synopsis: "Simple and robust error handling functions"
flags: light-uninstall
url {
src: "https://github.com/clarus/coq-error-handlers/archive/1.2.0.tar.gz"
checksum: "md5=e485360ba31980d55cf053cf59b255e2"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-error-handlers.1.2.0 coq.8.4.6</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-error-handlers.1.2.0 coq.8.4.6</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>12 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-error-handlers.1.2.0 coq.8.4.6</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>16 s</dd>
</dl>
<h2>Installation size</h2>
<p>Total: 4 K</p>
<ul>
<li>4 K <code>../ocaml-base-compiler.4.02.3/lib/coq/user-contrib/ErrorHandlers/All.vo</code></li>
</ul>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq-error-handlers.1.2.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| coq-bench/coq-bench.github.io | clean/Linux-x86_64-4.02.3-2.0.6/released/8.4.6/error-handlers/1.2.0.html | HTML | mit | 6,748 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Au terme de ce chapitre, vous en savez désormais plus quant aux retours et aux phases de bêta et de validation.
Nous allons maintenant voir comme faire un retour, ce qui peut aussi vous aider à développer votre œil critique si vous êtes rédacteur. | firm1/zest-writer | src/test/resources/com/zds/zw/fixtures/le-guide-du-contributeur/828_contribuer-au-contenu/les-phases-de-correction-et-de-validation/conclusion.md | Markdown | gpl-3.0 | 256 | [
30522,
8740,
2744,
2063,
2139,
8292,
15775,
23270,
2890,
1010,
29536,
2271,
4372,
3828,
2480,
4078,
2953,
2863,
2483,
4606,
24110,
2102,
19554,
2128,
21163,
2015,
3802,
19554,
12335,
2139,
8247,
3802,
2139,
27354,
1012,
2053,
2271,
2035,
56... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2016-2020 Crown Copyright
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package uk.gov.gchq.gaffer.cache.util;
/**
* System properties used by the Gaffer cache service implementations.
*/
public final class CacheProperties {
private CacheProperties() {
// private constructor to prevent instantiation
}
/**
* Name of the system property to use in order to define the cache service class.
*/
public static final String CACHE_SERVICE_CLASS = "gaffer.cache.service.class";
/**
* Name of the system property to use in order to locate the cache config file.
*/
public static final String CACHE_CONFIG_FILE = "gaffer.cache.config.file";
}
| GovernmentCommunicationsHeadquarters/Gaffer | core/cache/src/main/java/uk/gov/gchq/gaffer/cache/util/CacheProperties.java | Java | apache-2.0 | 1,225 | [
30522,
1013,
1008,
1008,
9385,
2355,
1011,
12609,
4410,
9385,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import sys, pygame, math, random, time
from Level import *
from Player import *
from Enemy import *
from NPC import *
from Menu import *
from Item import *
pygame.init()
clock = pygame.time.Clock()
width = 1000
height = 700
size = width, height
bgColor = r,b,g = 255,255,255
screen = pygame.display.set_mode(size)
mode = "menu"
enemies = pygame.sprite.Group()
boundries = pygame.sprite.Group()
backGrounds = pygame.sprite.Group()
people = pygame.sprite.Group()
items = pygame.sprite.Group()
players = pygame.sprite.Group()
all = pygame.sprite.OrderedUpdates()
Enemy.containers = (enemies, all)
SoftBlock.containers = (backGrounds, all)
HardBlock.containers = (boundries, all)
NPC.containers = (people, all)
Item.containers = (items, all)
Player.containers = (people, players, all)
levLayer =0
levx = 3
levy = 3
start = time.time()
def loadNewLev(direction, levx, levy):
if direction == "up":
if levy >1:
levy-=1
elif direction == "down":
if levy <3:
levy+=1
elif direction == "left":
if levx >1:
levx-=1
elif direction == "right":
if levx <3:
levx+=1
for s in all.sprites():
s.kill()
levFile = "Levels/map" + str(levLayer) + str(levy) + str(levx)
level=Level(levFile)
return levx, levy
while True:
while mode == "menu":
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_1:
mode = "game"
if event.key == pygame.K_2:
mode = "how to play"
if event.key == pygame.K_q:
mode = "quit"
bg = pygame.image.load("Resources/mainmenu.png")
bgrect = bg.get_rect(center = [width/2,height/2])
screen.fill(bgColor)
screen.blit(bg, bgrect)
pygame.display.flip()
clock.tick(60)
while mode == "how to play":
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
mode = "menu"
bg = pygame.image.load("Resources/howtoplay.png")
bgrect = bg.get_rect(center = [width/2,height/1.9])
screen.fill(bgColor)
screen.blit(bg, bgrect)
pygame.display.flip()
clock.tick(60)
while mode == "quit":
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
sys.exit()
levFile = "Levels/map" + str(levLayer) + str(levy) + str(levx)
level=Level(levFile)
player = Player([5,5], [900,500])
while mode == "test":
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_w:
levx, levy = loadNewLev("up", levx, levy)
elif event.key == pygame.K_s:
levx, levy = loadNewLev("down", levx, levy)
elif event.key == pygame.K_a:
levx, levy = loadNewLev("left", levx, levy)
elif event.key == pygame.K_d:
levx, levy = loadNewLev("right", levx, levy)
#print len(all.sprites())
bgColor = r,g,b
screen.fill(bgColor)
dirty = all.draw(screen)
pygame.display.update(dirty)
pygame.display.flip()
clock.tick(60)
while mode == "game":
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_w or event.key == pygame.K_UP:
player.go("up")
elif event.key == pygame.K_s or event.key == pygame.K_DOWN:
player.go("down")
elif event.key == pygame.K_a or event.key == pygame.K_LEFT:
player.go("left")
elif event.key == pygame.K_d or event.key == pygame.K_RIGHT:
player.go("right")
elif event.type == pygame.KEYUP:
if event.key == pygame.K_w or event.key == pygame.K_UP:
player.go("stop up")
elif event.key == pygame.K_s or event.key == pygame.K_DOWN:
player.go("stop down")
elif event.key == pygame.K_a or event.key == pygame.K_LEFT:
player.go("stop left")
elif event.key == pygame.K_d or event.key == pygame.K_RIGHT:
player.go("stop right")
all.update(size)
#print len(all.sprites())
#From Manpac V2
if player.rect.center[0] > size[0]:
levx, levy = loadNewLev("right", levx, levy)
player = Player([5,5], [0, player.rect.center[1]])
elif player.rect.center[0] < 0:
levx, levy = loadNewLev("left", levx, levy)
player = Player([5,5], [size[0], player.rect.center[1]])
elif player.rect.center[1] > size[1]:
levx, levy = loadNewLev("down", levx, levy)
player = Player([5,5], [player.rect.center[0], 0])
elif player.rect.center[1] < 0:
levx, levy = loadNewLev("up", levx, levy)
player = Player([5,5], [player.rect.center[0], size[1]])
playersHitsBoundries = pygame.sprite.groupcollide(players, boundries, False, False)
for p in playersHitsBoundries:
for boundry in playersHitsBoundries[p]:
p.collideHardblock(boundry)
#playersHitsItems = pygame.sprite.groupcollide(players, items, False, False)
#for p in playersHitsitems:
#for item in playersHitsitems[p]:
enemiesHitsBoundries = pygame.sprite.groupcollide(enemies, boundries, False, False)
for e in enemiesHitsBoundries:
for boundry in enemiesHitsBoundries[e]:
e.collideHardblock(boundry)
bgColor = r,g,b
screen.fill(bgColor)
dirty = all.draw(screen)
pygame.display.update(dirty)
pygame.display.flip()
clock.tick(60)
| KRHS-GameProgramming-2015/Adlez | Adlez.py | Python | bsd-2-clause | 6,657 | [
30522,
12324,
25353,
2015,
1010,
1052,
2100,
16650,
1010,
8785,
1010,
6721,
1010,
2051,
2013,
2504,
12324,
1008,
2013,
2447,
12324,
1008,
2013,
4099,
12324,
1008,
2013,
27937,
2278,
12324,
1008,
2013,
12183,
12324,
1008,
2013,
8875,
12324,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<footer class="main-footer">
<div class="pull-right hidden-xs">
</div>
<strong>Orange TV.</strong> All rights reserved.
</footer>
<!-- Control Sidebar -->
<!-- /.control-sidebar -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->
<!-- jQuery 2.2.3 -->
<script src="assets/plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
$.widget.bridge('uibutton', $.ui.button);
</script>
<!-- DataTables -->
<script src="assets/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="assets/plugins/datatables/dataTables.bootstrap.min.js"></script>
<!--<script src="assets/plugins/ckeditor/adapters/jquery.js"></script>-->
<!-- Bootstrap 3.3.6 -->
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<!-- <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> -->
<!-- Morris.js charts -->
<!--
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="assets/plugins/morris/morris.min.js"></script>
-->
<!-- Sparkline -->
<script src="assets/plugins/sparkline/jquery.sparkline.min.js"></script>
<!-- jvectormap -->
<script src="assets/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="assets/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<!-- jQuery Knob Chart -->
<script src="assets/plugins/knob/jquery.knob.js"></script>
<!-- daterangepicker -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.2/moment.min.js"></script>
<script src="assets/plugins/daterangepicker/daterangepicker.js"></script>
<!-- datepicker -->
<script src="assets/plugins/datepicker/bootstrap-datepicker.js"></script>
<!-- Bootstrap WYSIHTML5 -->
<script src="assets/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
<!-- Slimscroll -->
<script src="assets/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="assets/plugins/fastclick/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="assets/dist/js/app.min.js"></script>
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<!--<script src="assets/dist/js/pages/dashboard.js"></script>-->
<!-- AdminLTE for demo purposes -->
<script src="assets/dist/js/demo.js"></script>
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.4/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.4/js/buttons.flash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
<!--
<script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js"></script>
<script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js"></script>
-->
<script src="https://cdn.datatables.net/buttons/1.2.4/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.4/js/buttons.print.min.js"></script>
<script src="assets/dist/js/custom.js"></script>
<script>
$(function () {
/*
var table = $('#example').DataTable( {
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
} );
table.buttons().container()
.appendTo( $('div.eight.column:eq(0)', table.table().container()) );
$('#example2').DataTable( {
buttons: [
{
extend: 'excel',
text: 'Save current page',
exportOptions: {
modifier: {
page: 'current'
}
}
}
]
} );
*/
$('#example').DataTable( {
dom: 'Bfrtip',
pageLength: 5,
//dom : 'Bflit',
buttons: ['copy', 'csv', 'excel', 'pdf', 'print'],
responsive: true
} );
$("#example1").DataTable();
$("#example2").DataTable({
"paging": false
});
$('#example3').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false
});
$('#example30').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false
});
});
// datatable paging
$(function() {
table = $('#example2c').DataTable({
"processing": true, //Feature control the processing indicator.
"serverSide": true, //Feature control DataTables' server-side processing mode.
"order": [], //Initial no order.
// Load data for the table's content from an Ajax source
"ajax": {
"url": "<?php if(isset($url)) {echo $url; } ?>",
"type": "POST"
},
//Set column definition initialisation properties.
"columnDefs": [
{
"targets": [ 0 ], //first column / numbering column
"orderable": false, //set not orderable
},
],
});
});
</script>
</body>
</html>
| ariefstd/cdone_server_new | application/views/footer.php | PHP | mit | 5,358 | [
30522,
1026,
3329,
2121,
2465,
1027,
1000,
2364,
1011,
3329,
2121,
1000,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
4139,
1011,
2157,
5023,
1011,
1060,
2015,
1000,
1028,
1026,
1013,
4487,
2615,
1028,
1026,
2844,
1028,
4589,
2694,
1012,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package uk.co.badgersinfoil.metaas.fixes;
import junit.framework.TestCase;
import uk.co.badgersinfoil.metaas.ActionScriptFactory;
import uk.co.badgersinfoil.metaas.ActionScriptParser;
import uk.co.badgersinfoil.metaas.dom.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
/**
* This test checks if method declaration w/o semicolons works fine.
*
* @author Alexander Eliseyev
*/
public class InterfaceMetodsSemicolonTest extends TestCase {
public void testIt() {
ActionScriptFactory fact = new ActionScriptFactory();
ASCompilationUnit unit = loadSyntaxExample(fact);
ASInterfaceType interfaceType = (ASInterfaceType) unit.getType();
List methods = interfaceType.getMethods();
assertEquals(4, methods.size());
int i = 0;
for (Object methodObj : methods) {
ASMethod method = (ASMethod) methodObj;
print(method.getName());
assertEquals("$myFunc" + ++i, method.getName());
}
}
private static void print(String str) {
System.out.println(str);
}
private ASCompilationUnit loadSyntaxExample(ActionScriptFactory fact) {
InputStream in = getClass().getClassLoader().getResourceAsStream("InterfaceMetodsSemicolon.as");
ActionScriptParser parser = fact.newParser();
ASCompilationUnit unit = parser.parse(new InputStreamReader(in));
return unit;
}
} | code-orchestra/metaas-fork | src/test/java/uk/co/badgersinfoil/metaas/fixes/InterfaceMetodsSemicolonTest.java | Java | apache-2.0 | 1,494 | [
30522,
7427,
2866,
1012,
2522,
1012,
24186,
11493,
24323,
1012,
18804,
3022,
1012,
8081,
2229,
1025,
12324,
12022,
4183,
1012,
7705,
1012,
3231,
18382,
1025,
12324,
2866,
1012,
2522,
1012,
24186,
11493,
24323,
1012,
18804,
3022,
1012,
4506,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Kendo\UI;
class SchedulerMessagesRecurrenceEditorOffsetPositions extends \Kendo\SerializableObject {
//>> Properties
/**
* The text similar to "first" displayed in the scheduler recurrence editor.
* @param string $value
* @return \Kendo\UI\SchedulerMessagesRecurrenceEditorOffsetPositions
*/
public function first($value) {
return $this->setProperty('first', $value);
}
/**
* The text similar to "second" displayed in the scheduler recurrence editor.
* @param string $value
* @return \Kendo\UI\SchedulerMessagesRecurrenceEditorOffsetPositions
*/
public function second($value) {
return $this->setProperty('second', $value);
}
/**
* The text similar to "third" displayed in the scheduler recurrence editor.
* @param string $value
* @return \Kendo\UI\SchedulerMessagesRecurrenceEditorOffsetPositions
*/
public function third($value) {
return $this->setProperty('third', $value);
}
/**
* The text similar to "fourth" displayed in the scheduler recurrence editor.
* @param string $value
* @return \Kendo\UI\SchedulerMessagesRecurrenceEditorOffsetPositions
*/
public function fourth($value) {
return $this->setProperty('fourth', $value);
}
/**
* The text similar to "last" displayed in the scheduler recurrence editor.
* @param string $value
* @return \Kendo\UI\SchedulerMessagesRecurrenceEditorOffsetPositions
*/
public function last($value) {
return $this->setProperty('last', $value);
}
//<< Properties
}
?>
| deviffy/laravel-kendo-ui | wrappers/php/lib/Kendo/UI/SchedulerMessagesRecurrenceEditorOffsetPositions.php | PHP | mit | 1,611 | [
30522,
1026,
1029,
25718,
3415,
15327,
6358,
3527,
1032,
21318,
1025,
2465,
6134,
10867,
7971,
13923,
2890,
10841,
14343,
5897,
2098,
15660,
27475,
3388,
26994,
2015,
8908,
1032,
6358,
3527,
1032,
7642,
21335,
3468,
16429,
20614,
1063,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*! s.js (C) 2019-present SheetJS -- https://sheetjs.com */
export * from "./index";
| SheetJS/js-xlsx | packages/s/dist/typings/umd.d.ts | TypeScript | apache-2.0 | 85 | [
30522,
1013,
1008,
999,
1055,
1012,
1046,
2015,
1006,
1039,
1007,
10476,
1011,
2556,
7123,
22578,
1011,
1011,
16770,
1024,
1013,
1013,
7123,
22578,
1012,
4012,
1008,
1013,
9167,
1008,
2013,
1000,
1012,
1013,
5950,
1000,
1025,
102,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2010-2020 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.api.process.model.builders;
import java.util.HashSet;
import java.util.Set;
import org.activiti.api.process.model.payloads.GetProcessDefinitionsPayload;
public class GetProcessDefinitionsPayloadBuilder {
private String processDefinitionId;
private Set<String> processDefinitionKeys = new HashSet<>();
public GetProcessDefinitionsPayloadBuilder withProcessDefinitionKeys(Set<String> processDefinitionKeys) {
this.processDefinitionKeys = processDefinitionKeys;
return this;
}
public GetProcessDefinitionsPayloadBuilder withProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
return this;
}
public GetProcessDefinitionsPayloadBuilder withProcessDefinitionKey(String processDefinitionKey) {
if (processDefinitionKeys == null) {
processDefinitionKeys = new HashSet<>();
}
processDefinitionKeys.add(processDefinitionKey);
return this;
}
public GetProcessDefinitionsPayload build() {
return new GetProcessDefinitionsPayload(processDefinitionId, processDefinitionKeys);
}
}
| Activiti/Activiti | activiti-api/activiti-api-process-model/src/main/java/org/activiti/api/process/model/builders/GetProcessDefinitionsPayloadBuilder.java | Java | apache-2.0 | 1,777 | [
30522,
1013,
1008,
1008,
9385,
2230,
1011,
12609,
24493,
6072,
3597,
4007,
1010,
5183,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_151) on Tue Oct 30 00:53:05 MST 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class org.wildfly.swarm.jose.SignatureInput (BOM: * : All 2.2.1.Final API)</title>
<meta name="date" content="2018-10-30">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.wildfly.swarm.jose.SignatureInput (BOM: * : All 2.2.1.Final API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/wildfly/swarm/jose/SignatureInput.html" title="class in org.wildfly.swarm.jose">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">Thorntail API, 2.2.1.Final</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/wildfly/swarm/jose/class-use/SignatureInput.html" target="_top">Frames</a></li>
<li><a href="SignatureInput.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.wildfly.swarm.jose.SignatureInput" class="title">Uses of Class<br>org.wildfly.swarm.jose.SignatureInput</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../org/wildfly/swarm/jose/SignatureInput.html" title="class in org.wildfly.swarm.jose">SignatureInput</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.wildfly.swarm.jose">org.wildfly.swarm.jose</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="#org.wildfly.swarm.jose.provider">org.wildfly.swarm.jose.provider</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.wildfly.swarm.jose">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../org/wildfly/swarm/jose/SignatureInput.html" title="class in org.wildfly.swarm.jose">SignatureInput</a> in <a href="../../../../../org/wildfly/swarm/jose/package-summary.html">org.wildfly.swarm.jose</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../org/wildfly/swarm/jose/package-summary.html">org.wildfly.swarm.jose</a> with parameters of type <a href="../../../../../org/wildfly/swarm/jose/SignatureInput.html" title="class in org.wildfly.swarm.jose">SignatureInput</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><span class="typeNameLabel">Jose.</span><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/jose/Jose.html#sign-org.wildfly.swarm.jose.SignatureInput-">sign</a></span>(<a href="../../../../../org/wildfly/swarm/jose/SignatureInput.html" title="class in org.wildfly.swarm.jose">SignatureInput</a> input)</code>
<div class="block">Sign the data in the JWS Compact or JSON (optional) format.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.wildfly.swarm.jose.provider">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../org/wildfly/swarm/jose/SignatureInput.html" title="class in org.wildfly.swarm.jose">SignatureInput</a> in <a href="../../../../../org/wildfly/swarm/jose/provider/package-summary.html">org.wildfly.swarm.jose.provider</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../org/wildfly/swarm/jose/provider/package-summary.html">org.wildfly.swarm.jose.provider</a> with parameters of type <a href="../../../../../org/wildfly/swarm/jose/SignatureInput.html" title="class in org.wildfly.swarm.jose">SignatureInput</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><span class="typeNameLabel">DefaultJoseImpl.</span><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/jose/provider/DefaultJoseImpl.html#sign-org.wildfly.swarm.jose.SignatureInput-">sign</a></span>(<a href="../../../../../org/wildfly/swarm/jose/SignatureInput.html" title="class in org.wildfly.swarm.jose">SignatureInput</a> input)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/wildfly/swarm/jose/SignatureInput.html" title="class in org.wildfly.swarm.jose">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">Thorntail API, 2.2.1.Final</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/wildfly/swarm/jose/class-use/SignatureInput.html" target="_top">Frames</a></li>
<li><a href="SignatureInput.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2018 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
| wildfly-swarm/wildfly-swarm-javadocs | 2.2.1.Final/apidocs/org/wildfly/swarm/jose/class-use/SignatureInput.html | HTML | apache-2.0 | 8,795 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef FORMAT_HH
#define FORMAT_HH
namespace CASM {
int format_command(int argc, char *argv[]);
}
#endif
| jbechtel/CASMcode | apps/casm/format.hh | C++ | lgpl-2.1 | 112 | [
30522,
1001,
2065,
13629,
2546,
4289,
1035,
1044,
2232,
1001,
9375,
4289,
1035,
1044,
2232,
3415,
15327,
25222,
2213,
1063,
20014,
4289,
1035,
3094,
1006,
20014,
12098,
18195,
1010,
25869,
1008,
12098,
2290,
2615,
1031,
1033,
1007,
1025,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Conekta;
class TokenTest extends BaseTest
{
public static $validTokenWithCheckout = array(
'checkout' => array(
'returns_control_on' => 'Token'
),
);
public function testSuccesfulCreateTokenWithCheckout()
{
$this->setApiKey();
if (Conekta::$apiBase == 'https://api.conekta.io') {
$this->markTestSkipped('This test should be run in staging.');
}
$token = Token::create(self::$validTokenWithCheckout);
$this->assertTrue(strpos(get_class($token), 'Token') !== false);
$this->assertTrue(strpos(get_class($token->checkout), 'Checkout') !== false);
$this->assertEquals(false, $token->checkout->multifactor_authentication);
$this->assertEquals(array("card"), (array) $token->checkout->allowed_payment_methods);
$this->assertEquals(false, $token->checkout->monthly_installments_enabled);
$this->assertEquals(array(), (array) $token->checkout->monthly_installments_options);
$this->assertTrue( strlen($token->checkout->id) == 36);
$this->assertEquals('checkout', $token->checkout->object);
$this->assertEquals('Integration', $token->checkout->type);
}
}
| conekta/conekta-php | test/Conekta-2.0/TokenTest.php | PHP | mit | 1,159 | [
30522,
1026,
1029,
25718,
3415,
15327,
13171,
25509,
2050,
30524,
22199,
1063,
2270,
10763,
1002,
9398,
18715,
2368,
24415,
5403,
19665,
4904,
1027,
9140,
1006,
1005,
4638,
5833,
1005,
1027,
1028,
9140,
1006,
1005,
5651,
1035,
2491,
1035,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import React, { Component } from 'react';
import CatagoryBox1 from '../CatagoryBox1';
import { BgBox } from './style';
function BackgroundBox (props) {
const {bcolor} = props;
const {data} = props;
const cata = data.map((d,i) => <CatagoryBox1 data={d} key={i} />);
return (
<BgBox bcolor={bcolor}>
{cata}
</BgBox>
);
};
export default BackgroundBox;
| fatrossy/color_palette | src/components/BackgroundBox/index.js | JavaScript | mit | 382 | [
30522,
12324,
10509,
1010,
1063,
6922,
1065,
2013,
1005,
10509,
1005,
1025,
12324,
4937,
23692,
2854,
8758,
2487,
2013,
1005,
1012,
1012,
1013,
4937,
23692,
2854,
8758,
2487,
1005,
1025,
12324,
1063,
1038,
18259,
11636,
1065,
2013,
1005,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package my.cardgame.main;
public class Run {
public static void main(String[] args) {
Login.login();
}
}
| Hajdulord/My.CardGame.Project-akci--reakci- | Card-Game.Main/src/my/cardgame/main/Run.java | Java | unlicense | 123 | [
30522,
7427,
2026,
1012,
4003,
16650,
1012,
2364,
1025,
2270,
2465,
2448,
1063,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
8833,
2378,
1012,
8833,
2378,
1006,
1007,
1025,
1065,
1065,
102,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package input
import (
glfw "github.com/go-gl/glfw3"
"github.com/tedsta/fission/core"
"github.com/tedsta/fission/core/event"
)
type InputSystem struct {
eventManager *event.Manager
window *glfw.Window
}
func NewInputSystem(w *glfw.Window, e *event.Manager) *InputSystem {
i := &InputSystem{}
// Set the input callbacks
w.SetMouseButtonCallback(i.onMouseBtn)
//w.SetMouseWheelCallback((i).onMouseWheel)
w.SetCursorPositionCallback(i.onMouseMove)
w.SetKeyCallback(i.onKey)
w.SetCharacterCallback(i.onChar)
i.window = w
i.eventManager = e
return i
}
func (i *InputSystem) Begin(dt float32) {
glfw.PollEvents()
}
func (i *InputSystem) ProcessEntity(e *core.Entity, dt float32) {
}
func (i *InputSystem) End(dt float32) {
}
func (i *InputSystem) TypeBits() (core.TypeBits, core.TypeBits) {
return 0, 0
}
// Callbacks ###################################################################
func (i *InputSystem) onResize(wnd *glfw.Window, w, h int) {
//fmt.Printf("resized: %dx%d\n", w, h)
}
func (i *InputSystem) onMouseBtn(w *glfw.Window, btn glfw.MouseButton, action glfw.Action, mods glfw.ModifierKey) {
e := &MouseBtnEvent{MouseButton(btn), Action(action), ModifierKey(mods)}
i.eventManager.FireEvent(e)
}
func (i *InputSystem) onMouseWheel(w *glfw.Window, delta int) {
//fmt.Printf("mouse wheel: %d\n", delta)
}
func (i *InputSystem) onMouseMove(w *glfw.Window, xpos float64, ypos float64) {
e := &MouseMoveEvent{int(xpos), int(ypos)}
i.eventManager.FireEvent(e)
}
func (i *InputSystem) onKey(w *glfw.Window, key glfw.Key, scancode int, action glfw.Action, mods glfw.ModifierKey) {
e := &KeyEvent{Key(key), scancode, Action(action), ModifierKey(mods)}
i.eventManager.FireEvent(e)
}
func (i *InputSystem) onChar(w *glfw.Window, key uint) {
//fmt.Printf("char: %d\n", key)
}
// init ##########################################################
func init() {
IntentComponentType = core.RegisterComponent(IntentComponentFactory)
}
| tedsta/gofission | input/inputsystem.go | GO | mit | 1,973 | [
30522,
7427,
7953,
12324,
1006,
1043,
10270,
2860,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
2175,
1011,
1043,
2140,
1013,
1043,
10270,
2860,
2509,
1000,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
6945,
9153,
1013,
27521,
1013,
4563,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<title>SOCR Visualization of extremely high-dimensional
neuroimaging data</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<style type="text/css">
a {
color: red;
}
</style>
</head>
<body>
<ul class="topnav">
<li class="right"><a class="active"
href="http://www.socr.umich.edu/">SOCR Home</a></li>
<li><a href="">This Article <span>→</span></a></li>
<li><a href="./index.html#main">Motivation</a></li>
<li><a href="./index.html#Intro">Introduction</a></li>
<li><a href="./index.html#Pipeline">Project Pipeline</a></li>
<li><a href="./index.html#Machine_learning">Unsupervised
Learning</a></li>
<li><a href="./index.html#TensorBoard">TensorBoard</a></li>
<li><a href="./index.html#code">Code</a></li>
<li><a href="./index.html#Results">Results</a></li>
<li><a href="./index.html#Try">Try-it-Now!</a></li>
</ul>
<section id="showcase">
<div class="container"></div>
</section>
<div class="bottom-left">
<h1>User-data driven visual analytics of extremely high-dimensional studies using TensorBoard
</h1>
<p>
<a href="http://www.socr.umich.edu/people" target="_blank"> SOCR Team</a>
</p>
</div>
<div></div>
<div class="container">
<section id="main">
<blockquote>
This <a href="http://socr.umich.edu/HTML5">SOCR HTML5 resource</a> demonstrates:
<ol>
<li><a
href="http://www.socr.umich.edu/people/dinov/courses/DSPA_notes/05_DimensionalityReduction.html#9_t-sne_(t-distributed_stochastic_neighbor_embedding)">
t-distributed stochastic neighbor embedding (t-SNE)
statistical method for manifold dimension reduction</a>,</li>
<li>The <a href="https://github.com/tensorflow/tensorboard">TensorBoard
machine learning platform</a>, and</li>
<li>Hands-on Big Data Analytics using the
<a href="http://www.ukbiobank.ac.uk">UK Biobank data</a>,</li>
<li>Interactive Visual Analytics using <a href="./UsersData.html">user-provided data</a>.</li>
</ol>
</blockquote>
</section>
<section id="UsersData">
Before you begin, review the
<a href="./index.html">SOCR hands-on high-deimensional t-SNE Data Analytics Learning Module</a>
and the <a href="http://www.socr.umich.edu/people/dinov/courses/DSPA_notes/05_DimensionalityReduction.html">
DSPA Dimensionality Reduction Chapter</a>.<br/> <br/>
Similarly to the <a href="./index.html">analysis of the UK Biobank study</a>, you can use your own dataset.<br/>
This will require you to provide a pair of ASCII text files that can be loaded from your computer.<br/>
<br/>
The first file contains tab-delimitted (TSV) data including the predictor vectors (row=case * column=features).<br/>
The second file is an optional TSV file including metadata like labels for each case (row), if any. <br/>
Examples of the two data formats that can be loaded from your computer are included below.
<ul>
<ol><i>Load the data</i> as a TSV file of vectors, e.g., 4 cases in 5D:<br/>
0.1 0.2 0.3 0.4 0.5<br/>
0.2 0.3 0.4 0.5 0.6<br/>
0.2 0.3 0.4 0.5 0.6<br/>
0.2 0.3 0.4 0.5 0.6<br/>
</ol>
<ol>See this example of the
<a href="http://socr.umich.edu/HTML5/SOCR_TensorBoard_UKBB/data/SOCR_CountryRankingData.tsv">
SOCR Country Ranking Data</a>
</ol>
<br/> <br/>
<ol><i>Optionally</i>, load a TSV file of labels/metadata, e.g., 4 cases in 2D (metadata).
If there is more than one column, the first row must include column names.<br/>
<b>Class</b> <b>Phenotype</b><br/>
A Patient<br/>
A Control<br/>
B Control<br/>
C Patient<br/>
</ol>
<ol>See this example of the
<a href="http://socr.umich.edu/HTML5/SOCR_TensorBoard_UKBB/data/SOCR_Top30Country_RankIndicatorLabel.tsv">
SOCR Top-30 Country Rank Indicator Labels</a>. More
<a href="http://wiki.socr.umich.edu/index.php/SOCR_Data_2008_World_CountriesRankings">details about these COuntry Ranking data are available here</a>.
</ol>
</ul>
Once the data is loaded in the app, you can run the analysis on your own data much like
we did in the <a href="./index.html">similar dimensionality reduction activity using UK Biobank</a>. <br/> <br/>
</section>
</div>
<div class="TensorBoard">
<section id="Try">
<embed src="https://projector.tensorflow.org/?config=https://raw.githubusercontent.com/SOCR/HTML5_WebSite/master/HTML5/SOCR_TensorBoard_UKBB/data/SOCR_CountryRanking_projector_config.json" style="height:900px; width:100%;"></embed>
</section>
</div>
<hr>
<div>
<footer>
<center>
<a href="http://www.socr.umich.edu/">SOCR Resource</a> Visitor
number <img src="http://counter.digits.net/?counter=SOCR"
align="middle" border="0" height="20" hspace="4" vspace="2"
width="60" alt="">
<script type="text/javascript">
var d = new Date();
document.write(" | " + d.getFullYear() + " | ");
</script>
<a href="http://socr.umich.edu/img/SOCR_Email.png"><img
alt="SOCR Email" title="SOCR Email"
src="http://socr.umich.edu/img/SOCR_Email.png"
style="border: 0px solid;"></a>
</center>
</footer>
<!-- Start of StatCounter Code -->
<script type="text/javascript">
var sc_project = 5714596;
var sc_invisible = 1;
var sc_partition = 71;
var sc_click_stat = 1;
var sc_security = "038e9ac4";
</script>
<script type="text/javascript"
src="https://www.statcounter.com/counter/counter.js"></script>
<!-- End of StatCounter Code -->
<!-- GoogleAnalytics -->
<script src="https://www.google-analytics.com/urchin.js"
type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-676559-1";
urchinTracker();
</script>
<!-- End of GoogleAnalytics Code -->
</div>
</body>
</html> | SOCR/HTML5_WebSite | HTML5/SOCR_TensorBoard_UKBB/UsersData.html | HTML | lgpl-3.0 | 5,998 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
2516,
1028,
27084,
2099,
5107,
3989,
1997,
5186,
2152,
1011,
8789,
11265,
10976,
9581,
4726,
2951,
1026,
1013,
2516,
1028,
1026,
4957,
2128,
2140,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package dosingdecision
import (
"time"
"github.com/tidepool-org/platform/structure"
)
const (
CarbohydratesOnBoardAmountMaximum = 1000
CarbohydratesOnBoardAmountMinimum = 0
)
type CarbohydratesOnBoard struct {
Time *time.Time `json:"time,omitempty" bson:"time,omitempty"`
Amount *float64 `json:"amount,omitempty" bson:"amount,omitempty"`
}
func ParseCarbohydratesOnBoard(parser structure.ObjectParser) *CarbohydratesOnBoard {
if !parser.Exists() {
return nil
}
datum := NewCarbohydratesOnBoard()
parser.Parse(datum)
return datum
}
func NewCarbohydratesOnBoard() *CarbohydratesOnBoard {
return &CarbohydratesOnBoard{}
}
func (c *CarbohydratesOnBoard) Parse(parser structure.ObjectParser) {
c.Time = parser.Time("time", time.RFC3339Nano)
c.Amount = parser.Float64("amount")
}
func (c *CarbohydratesOnBoard) Validate(validator structure.Validator) {
validator.Float64("amount", c.Amount).Exists().InRange(CarbohydratesOnBoardAmountMinimum, CarbohydratesOnBoardAmountMaximum)
}
| tidepool-org/platform | data/types/dosingdecision/carbohydrates_on_board.go | GO | bsd-2-clause | 1,003 | [
30522,
7427,
9998,
2075,
3207,
28472,
12324,
1006,
1000,
2051,
1000,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
10401,
16869,
1011,
8917,
1013,
4132,
1013,
3252,
1000,
1007,
9530,
3367,
1006,
2482,
5092,
10536,
7265,
4570,
2239,
6277,
2259... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
You may not change or alter any portion of this comment or credits of
supporting developers from this source code or any supporting source code
which is considered copyrighted (c) material of the original comment or credit
authors.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* Module: RandomQuote
*
* @category Module
* @package randomquote
* @author XOOPS Module Development Team
* @author Mamba
* @copyright {@link http://xoops.org 2001-2016 XOOPS Project}
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
* @link http://xoops.org XOOPS
* @since 2.00
*/
$moduleDirName = basename(dirname(__DIR__));
if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
} else {
$moduleHelper = Xmf\Module\Helper::getHelper('system');
}
$adminObject = \Xmf\Module\Admin::getInstance();
$pathIcon32 = \Xmf\Module\Admin::menuIconPath('');
//$pathModIcon32 = $moduleHelper->getModule()->getInfo('modicons32');
// Load language files
$moduleHelper->loadLanguage('admin');
$moduleHelper->loadLanguage('modinfo');
$moduleHelper->loadLanguage('main');
$adminmenu = array(
array(
'title' => _MI_RANDOMQUOTE_ADMENU1,
'link' => 'admin/index.php',
'icon' => "{$pathIcon32}/home.png"
),
array(
'title' => _MI_RANDOMQUOTE_ADMENU2,
'link' => 'admin/main.php',
'icon' => "{$pathIcon32}/content.png"
),
array(
'title' => _MI_RANDOMQUOTE_ADMENU3,
'link' => 'admin/about.php',
'icon' => "{$pathIcon32}/about.png"
)
);
| XoopsModules25x/randomquote | admin/menu.php | PHP | gpl-2.0 | 1,796 | [
30522,
1026,
1029,
25718,
1013,
1008,
2017,
2089,
2025,
2689,
2030,
11477,
2151,
4664,
1997,
2023,
7615,
2030,
6495,
1997,
4637,
9797,
2013,
2023,
3120,
3642,
2030,
2151,
4637,
3120,
3642,
2029,
2003,
2641,
9385,
2098,
1006,
1039,
1007,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef __ANALYZE_CONFIG___
#define __ANALYZE_CONFIG___
#include <glib.h>
#include "analyze.h"
typedef struct {
double dir_op_ratio; /* dir 操作概率 */
double symbol_link_op_ratio; /* symlink 操作概率 */
double file_op_ratio; /* file 操作概率 */
int accuracy;
int accuracy_num;
int log_level;
int write_size;
int read_size;
int dir_max_depth;
int initial_dir_cnts;
int initial_file_cnts;
int initial_symlink_counts;
int total_op_group;
char test_dir_path[PATH_MAX];
char validation_dir_path[PATH_MAX];
char working_directory[PATH_MAX];
int working_threads;
int operations_waiting_list;
int operations_of_opened_file;
int operations_of_unopened_file;
int operations_of_opened_dir;
int operations_of_unopened_dir;
int operations_of_symlink;
double new_dir_ratio;
double open_dir_ratio;
double new_file_ratio;
double open_file_ratio;
double fsync_open_dir;
double fsetxattr_open_dir;
double fgetxattr_open_dir;
double fremovexattr_open_dir;
double readdir_open_dir;
double lk_open_dir;
double fchmod_open_dir;
double fchown_open_dir;
double futimes_open_dir;
double fstat_open_dir;
double access_unopen_dir;
double rename_unopen_dir;
double symlink_unopen_dir;
double setxattr_unopen_dir;
double getxattr_unopen_dir;
double removexattr_unopen_dir;
double chown_unopen_dir;
double chmod_unopen_dir;
double utimes_unopen_dir;
double rmdir_unopen_dir;
double stat_unopen_dir;
double statfs_unopen_dir;
double writev_open_file;
double readv_open_file;
double fallocate_open_file;
double ftruncate_open_file;
double fsync_open_file;
double fsetxattr_open_file;
double fgetxattr_open_file;
double fremovexattr_open_file;
double lk_open_file;
double fchown_open_file;
double fchmod_open_file;
double futimes_open_file;
double fstat_open_file;
double rename_unopen_file;
double symlink_unopen_file;
double link_unopen_file;
double truncate_unopen_file;
double setxattr_unopen_file;
double getxattr_unopen_file;
double removexattr_unopen_file;
double access_unopen_file;
double chown_unopen_file;
double chmod_unopen_file;
double utimes_unopen_file;
double stat_unopen_file;
double unlink_unopen_file;
double statfs_unopen_file;
double readlink_symbol_link;
double unlink_symbol_link;
int first_open_for_log;
}config_globle_var ;
extern config_globle_var cgv;
#define GET_CONFIG_STRING(src,dst) \
p = strtok (dst, tmp_delim); \
memset (src, 0, sizeof (src)); \
strcpy (src, p); \
tmp_p = strrchr(src, '/'); \
tmp_len = strlen (tmp_p); \
if (tmp_len > 1) \
strcat (src, "/"); \
free (dst);
int
get_operation_percent_int (char *config_file_path,
const gchar *group_name, const gchar *key);
double
get_operation_percent (char *config_file_path,
const gchar *group_name, const gchar *key);
char *
get_operation_string (char *config_file_path,
const gchar *group_name, const gchar *key);
int is_dir_exsit (const char *pathname);
int
config_globle_var_init (config_globle_var *cgv,
char *config_file_path);
#endif
| jianwei1216/my-scripts | debug-tools/shark/journal.h | C | gpl-2.0 | 4,459 | [
30522,
1001,
2065,
13629,
2546,
1035,
1035,
17908,
1035,
9530,
8873,
2290,
1035,
1035,
1035,
1001,
9375,
1035,
1035,
17908,
1035,
9530,
8873,
2290,
1035,
1035,
1035,
1001,
2421,
1026,
1043,
29521,
1012,
1044,
1028,
1001,
2421,
1000,
17908,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"errors"
"go/build"
"testing"
"github.com/golang/dep/internal/gps"
"github.com/golang/dep/internal/gps/pkgtree"
)
func TestInvalidEnsureFlagCombinations(t *testing.T) {
ec := &ensureCommand{
update: true,
add: true,
}
if err := ec.validateFlags(); err == nil {
t.Error("-add and -update together should fail validation")
}
ec.vendorOnly, ec.add = true, false
if err := ec.validateFlags(); err == nil {
t.Error("-vendor-only with -update should fail validation")
}
ec.add, ec.update = true, false
if err := ec.validateFlags(); err == nil {
t.Error("-vendor-only with -add should fail validation")
}
ec.noVendor, ec.add = true, false
if err := ec.validateFlags(); err == nil {
t.Error("-vendor-only with -no-vendor should fail validation")
}
ec.noVendor = false
// Also verify that the plain ensure path takes no args. This is a shady
// test, as lots of other things COULD return errors, and we don't check
// anything other than the error being non-nil. For now, it works well
// because a panic will quickly result if the initial arg length validation
// checks are incorrectly handled.
if err := ec.runDefault(nil, []string{"foo"}, nil, nil, gps.SolveParameters{}); err == nil {
t.Errorf("no args to plain ensure with -vendor-only")
}
ec.vendorOnly = false
if err := ec.runDefault(nil, []string{"foo"}, nil, nil, gps.SolveParameters{}); err == nil {
t.Errorf("no args to plain ensure")
}
}
func TestCheckErrors(t *testing.T) {
tt := []struct {
name string
fatal bool
pkgOrErrMap map[string]pkgtree.PackageOrErr
}{
{
name: "noErrors",
fatal: false,
pkgOrErrMap: map[string]pkgtree.PackageOrErr{
"mypkg": {
P: pkgtree.Package{},
},
},
},
{
name: "hasErrors",
fatal: true,
pkgOrErrMap: map[string]pkgtree.PackageOrErr{
"github.com/me/pkg": {
Err: &build.NoGoError{},
},
"github.com/someone/pkg": {
Err: errors.New("code is busted"),
},
},
},
{
name: "onlyGoErrors",
fatal: false,
pkgOrErrMap: map[string]pkgtree.PackageOrErr{
"github.com/me/pkg": {
Err: &build.NoGoError{},
},
"github.com/someone/pkg": {
P: pkgtree.Package{},
},
},
},
{
name: "onlyBuildErrors",
fatal: false,
pkgOrErrMap: map[string]pkgtree.PackageOrErr{
"github.com/me/pkg": {
Err: &build.NoGoError{},
},
"github.com/someone/pkg": {
P: pkgtree.Package{},
},
},
},
{
name: "allGoErrors",
fatal: true,
pkgOrErrMap: map[string]pkgtree.PackageOrErr{
"github.com/me/pkg": {
Err: &build.NoGoError{},
},
},
},
{
name: "allMixedErrors",
fatal: true,
pkgOrErrMap: map[string]pkgtree.PackageOrErr{
"github.com/me/pkg": {
Err: &build.NoGoError{},
},
"github.com/someone/pkg": {
Err: errors.New("code is busted"),
},
},
},
}
for _, tc := range tt {
t.Run(tc.name, func(t *testing.T) {
fatal, err := checkErrors(tc.pkgOrErrMap)
if tc.fatal != fatal {
t.Fatalf("expected fatal flag to be %T, got %T", tc.fatal, fatal)
}
if err == nil && fatal {
t.Fatal("unexpected fatal flag value while err is nil")
}
})
}
}
| variadico/etercli | vendor/github.com/golang/dep/cmd/dep/ensure_test.go | GO | mit | 3,387 | [
30522,
1013,
1013,
9385,
2418,
1996,
2175,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
1013,
1013,
6105,
2008,
2064,
2022,
2179,
1999,
1996,
6105,
5371,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Zend\Config\Reader;
use Zend\Config\Exception;
/**
* Java-style properties config reader.
*/
class JavaProperties implements ReaderInterface
{
/**
* Directory of the Java-style properties file
*
* @var string
*/
protected $directory;
/**
* fromFile(): defined by Reader interface.
*
* @see ReaderInterface::fromFile()
* @param string $filename
* @return array
* @throws Exception\RuntimeException if the file cannot be read
*/
public function fromFile($filename)
{
if (!is_file($filename) || !is_readable($filename)) {
throw new Exception\RuntimeException(sprintf(
"File '%s' doesn't exist or not readable",
$filename
));
}
$this->directory = dirname($filename);
$config = $this->parse(file_get_contents($filename));
return $this->process($config);
}
/**
* fromString(): defined by Reader interface.
*
* @see ReaderInterface::fromString()
* @param string $string
* @return array
* @throws Exception\RuntimeException if an @include key is found
*/
public function fromString($string)
{
if (empty($string)) {
return array();
}
$this->directory = null;
$config = $this->parse($string);
return $this->process($config);
}
/**
* Process the array for @include
*
* @param array $data
* @return array
* @throws Exception\RuntimeException if an @include key is found
*/
protected function process(array $data)
{
foreach ($data as $key => $value) {
if (trim($key) === '@include') {
if ($this->directory === null) {
throw new Exception\RuntimeException('Cannot process @include statement for a string');
}
$reader = clone $this;
unset($data[$key]);
$data = array_replace_recursive($data, $reader->fromFile($this->directory . '/' . $value));
}
}
return $data;
}
/**
* Parse Java-style properties string
*
* @todo Support use of the equals sign "key=value" as key-value delimiter
* @todo Ignore whitespace that precedes text past the first line of multiline values
*
* @param string $string
* @return array
*/
protected function parse($string)
{
$result = array();
$lines = explode("\n", $string);
$key = "";
$isWaitingOtherLine = false;
foreach ($lines as $i => $line) {
// Ignore empty lines and commented lines
if (empty($line)
|| (!$isWaitingOtherLine && strpos($line, "#") === 0)
|| (!$isWaitingOtherLine && strpos($line, "!") === 0)) {
continue;
}
// Add a new key-value pair or append value to a previous pair
if (!$isWaitingOtherLine) {
$key = substr($line, 0, strpos($line, ':'));
$value = substr($line, strpos($line, ':') + 1, strlen($line));
} else {
$value .= $line;
}
// Check if ends with single '\' (indicating another line is expected)
if (strrpos($value, "\\") === strlen($value) - strlen("\\")) {
$value = substr($value, 0, strlen($value) - 1);
$isWaitingOtherLine = true;
} else {
$isWaitingOtherLine = false;
}
$result[$key] = stripslashes($value);
unset($lines[$i]);
}
return $result;
}
}
| ishvaram/email-app | vendor/ZF2/library/Zend/Config/Reader/JavaProperties.php | PHP | bsd-3-clause | 4,164 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
16729,
2094,
7705,
1006,
8299,
1024,
1013,
1013,
7705,
1012,
16729,
2094,
1012,
4012,
1013,
1007,
1008,
1008,
1030,
4957,
8299,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
16729,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from __future__ import absolute_import
from django.core.management import call_command
from teams.models import Team, TeamMember, Workflow
from widget.rpc import Rpc
def refresh_obj(m):
return m.__class__._default_manager.get(pk=m.pk)
def reset_solr():
# cause the default site to load
from haystack import backend
sb = backend.SearchBackend()
sb.clear()
call_command('update_index')
rpc = Rpc()
| ofer43211/unisubs | apps/teams/tests/teamstestsutils.py | Python | agpl-3.0 | 425 | [
30522,
2013,
1035,
1035,
2925,
1035,
1035,
12324,
7619,
1035,
12324,
2013,
6520,
23422,
1012,
4563,
1012,
2968,
12324,
2655,
1035,
3094,
2013,
2780,
1012,
4275,
12324,
2136,
1010,
2136,
4168,
21784,
1010,
2147,
12314,
2013,
15536,
24291,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/** ======================================================================+
+ Copyright @2021-2022 Arjun Ray
+ Released under MIT License. See https://mit-license.org
+========================================================================*/
#pragma once
#ifndef UTILITY_CHECKLIST_H
#define UTILITY_CHECKLIST_H
#include <vector>
#include <algorithm>
namespace Utility
{
template<typename Client>
struct CheckListMethods
{
static void activate( Client& client, std::size_t counter )
{
client( counter ); // assumes function object
}
};
/**
* @class CheckList
* @brief Activates function when all prerequisites are "marked".
* Prerequisites are proxied by indexes in a bit set.
* All marks are automatically cleared after activation.
*/
template<typename Action, typename Methods = CheckListMethods<Action> >
class CheckList
{
using BitSet = std::vector<bool>;
public:
~CheckList() noexcept = default;
CheckList(std::size_t size, Action const& action)
: size_(size)
, bset_(size_, false)
, action_(action)
{}
// returns whether action was triggered
bool mark( std::size_t index )
{
if ( index < size_ ) { bset_[index] = true; }
return check_();
}
bool unmark( std::size_t index )
{ // should be rare occurence
if ( index < size_ )
{
bool _was(bset_[index]);
bset_[index] = false;
return _was;
}
return false;
}
CheckList& set_counter( std::size_t start )
{
counter_ = start;
return *this;
}
int marked() const
{
return std::count( bset_.begin(), bset_.end(), true );
}
int unmarked() const
{
return std::count( bset_.begin(), bset_.end(), false );
}
private:
std::size_t size_;
BitSet bset_;
Action action_;
std::size_t counter_{0};
bool all_set_()
{
return bset_.end() == std::find( bset_.begin(), bset_.end(), false );
}
bool check_()
{
if ( all_set_() )
{
Methods::activate( action_, counter_ );
reset_();
return true;
}
return false;
}
void reset_()
{
bset_ = BitSet(size_, false);
counter_++;
}
CheckList(CheckList const&) = delete;
CheckList& operator=( CheckList const& ) = delete;
};
} // namespace Utility
#endif // UTILITY_CHECKLIST_H
| arayq2/utility | CheckList.h | C | mit | 2,797 | [
30522,
1013,
1008,
1008,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.javaFX.fxml.refs;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.SearchScope;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.psi.xml.XmlAttribute;
import com.intellij.psi.xml.XmlAttributeValue;
import com.intellij.util.Processor;
import com.intellij.util.QueryExecutor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.javaFX.fxml.FxmlConstants;
import org.jetbrains.plugins.javaFX.indexing.JavaFxControllerClassIndex;
import java.util.List;
/**
* User: anna
* Date: 3/29/13
*/
public class JavaFxControllerFieldSearcher implements QueryExecutor<PsiReference, ReferencesSearch.SearchParameters>{
@Override
public boolean execute(@NotNull final ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<PsiReference> consumer) {
final PsiElement elementToSearch = queryParameters.getElementToSearch();
if (elementToSearch instanceof PsiField) {
final PsiField field = (PsiField)elementToSearch;
final PsiClass containingClass = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
@Override
public PsiClass compute() {
return field.getContainingClass();
}
});
if (containingClass != null) {
final String qualifiedName = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
@Override
public String compute() {
return containingClass.getQualifiedName();
}
});
if (qualifiedName != null) {
Project project = PsiUtilCore.getProjectInReadAction(containingClass);
final List<PsiFile> fxmlWithController =
JavaFxControllerClassIndex.findFxmlWithController(project, qualifiedName);
for (final PsiFile file : fxmlWithController) {
ApplicationManager.getApplication().runReadAction(() -> {
final String fieldName = field.getName();
if (fieldName == null) return;
final VirtualFile virtualFile = file.getViewProvider().getVirtualFile();
final SearchScope searchScope = queryParameters.getEffectiveSearchScope();
boolean contains = searchScope instanceof LocalSearchScope ? ((LocalSearchScope)searchScope).isInScope(virtualFile) :
((GlobalSearchScope)searchScope).contains(virtualFile);
if (contains) {
file.accept(new XmlRecursiveElementVisitor() {
@Override
public void visitXmlAttributeValue(final XmlAttributeValue value) {
final PsiReference reference = value.getReference();
if (reference != null) {
final PsiElement resolve = reference.resolve();
if (resolve instanceof XmlAttributeValue) {
final PsiElement parent = resolve.getParent();
if (parent instanceof XmlAttribute) {
final XmlAttribute attribute = (XmlAttribute)parent;
if (FxmlConstants.FX_ID.equals(attribute.getName()) && fieldName.equals(attribute.getValue())) {
consumer.process(reference);
}
}
}
}
}
});
}
});
}
}
}
}
return true;
}
}
| hurricup/intellij-community | plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxControllerFieldSearcher.java | Java | apache-2.0 | 4,457 | [
30522,
1013,
1008,
1008,
9385,
2456,
1011,
2286,
6892,
10024,
7076,
1055,
1012,
1054,
1012,
1051,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Rgaa32016 Test.6.3.1 NMI 07</title>
</head>
<body>
<div>
<h1>Rgaa32016 Test.6.3.1 NMI 07</h1>
<div class="test-detail" lang="fr">
Chaque lien texte vérifie-t-il une de ces conditions (hors cas particuliers) ?
<ul class="ssTests">
<li>L'intitulé du lien est explicite hors contexte</li>
<li>Un mécanisme permet à l'utilisateur d'obtenir un intitulé de lien explicite hors contexte</li>
<li>Le contenu du titre de lien (attribut <code>title</code>) est explicite hors contexte</li>
</ul>
</div>
<a href="my-link.html">This is a link</a>
<p class="test-explanation">NMI : The pertinence of the text link context is unpredictable</p>
</div>
</body>
</html> | Tanaguru/Tanaguru | rules/rgaa3-2016/src/test/resources/testcases/rgaa32016/Rgaa32016Rule060301/Rgaa32016.Test.06.03.01-3NMI-07.html | HTML | agpl-3.0 | 1,168 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
9384,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2016 The Draco Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef DRACO_POINT_CLOUD_POINT_CLOUD_H_
#define DRACO_POINT_CLOUD_POINT_CLOUD_H_
#include "point_cloud/point_attribute.h"
namespace draco {
// PointCloud is a collection of n-dimensional points that are described by a
// set of PointAttributes that can represent data such as positions or colors
// of individual points (see point_attribute.h).
class PointCloud {
public:
PointCloud();
virtual ~PointCloud() = default;
// Returns the number of named attributes of a given type.
int32_t NumNamedAttributes(GeometryAttribute::Type type) const;
// Returns attribute id of the first named attribute with a given type or -1
// when the attribute is not used by the point cloud.
int32_t GetNamedAttributeId(GeometryAttribute::Type type) const;
// Returns the id of the i-th named attribute of a given type.
int32_t GetNamedAttributeId(GeometryAttribute::Type type, int i) const;
// Returns the first named attribute of a given type or nullptr if the
// attribute is not used by the point cloud.
const PointAttribute *GetNamedAttribute(GeometryAttribute::Type type) const;
// Returns the i-th named attribute of a given type.
const PointAttribute *GetNamedAttribute(GeometryAttribute::Type type,
int i) const;
// Returns the named attribute of a given custom id.
const PointAttribute *GetNamedAttributeByCustomId(
GeometryAttribute::Type type, uint16_t id) const;
int32_t num_attributes() const { return attributes_.size(); }
const PointAttribute *attribute(int32_t att_id) const {
DCHECK_LE(0, att_id);
DCHECK_LT(att_id, static_cast<int32_t>(attributes_.size()));
return attributes_[att_id].get();
}
// Returned attribute can be modified, but it's caller's responsibility to
// maintain the attribute's consistency with draco::PointCloud.
PointAttribute *attribute(int32_t att_id) {
DCHECK_LE(0, att_id);
DCHECK_LT(att_id, static_cast<int32_t>(attributes_.size()));
return attributes_[att_id].get();
}
// Adds a new attribute to the point cloud.
// Returns the attribute id.
int AddAttribute(std::unique_ptr<PointAttribute> pa);
// Creates and adds a new attribute to the point cloud. The attribute has
// properties derived from the provided GeometryAttribute |att|.
// If |identity_mapping| is set to true, the attribute will use identity
// mapping between point indices and attribute value indices (i.e., each point
// has a unique attribute value).
// If |identity_mapping| is false, the mapping between point indices and
// attribute value indices is set to explicit, and it needs to be initialized
// manually using the PointAttribute::SetPointMapEntry() method.
// |num_attribute_values| can be used to specify the number of attribute
// values that are going to be stored in the newly created attribute.
// Returns attribute id of the newly created attribute.
int AddAttribute(const GeometryAttribute &att, bool identity_mapping,
AttributeValueIndex::ValueType num_attribute_values);
// Assigns an attribute id to a given PointAttribute. If an attribute with the
// same attribute id already exists, it is deleted.
virtual void SetAttribute(int att_id, std::unique_ptr<PointAttribute> pa);
// Deduplicates all attribute values (all attribute entries with the same
// value are merged into a single entry).
virtual bool DeduplicateAttributeValues();
// Removes duplicate point ids (two point ids are duplicate when all of their
// attributes are mapped to the same entry ids).
virtual void DeduplicatePointIds();
// Returns the number of n-dimensional points stored within the point cloud.
size_t num_points() const { return num_points_; }
// Sets the number of points. It's the caller's responsibility to ensure the
// new number is valid with respect to the PointAttributes stored in the point
// cloud.
void set_num_points(PointIndex::ValueType num) { num_points_ = num; }
protected:
// Applies id mapping of deduplicated points (called by DeduplicatePointIds).
virtual void ApplyPointIdDeduplication(
const IndexTypeVector<PointIndex, PointIndex> &id_map,
const std::vector<PointIndex> &unique_point_ids);
private:
// Attributes describing the point cloud.
std::vector<std::unique_ptr<PointAttribute>> attributes_;
// Ids of named attributes of the given type.
std::vector<int32_t>
named_attribute_index_[GeometryAttribute::NAMED_ATTRIBUTES_COUNT];
// The number of n-dimensional points. All point attribute values are stored
// in corresponding PointAttribute instances in the |attributes_| array.
PointIndex::ValueType num_points_;
friend struct PointCloudHasher;
};
// Functor for computing a hash from data stored within a point cloud.
// Note that this can be quite slow. Two point clouds will have the same hash
// only when all points have the same order and when all attribute values are
// exactly the same.
struct PointCloudHasher {
size_t operator()(const PointCloud &pc) const {
size_t hash = pc.num_points_;
hash = HashCombine(pc.attributes_.size(), hash);
for (int i = 0; i < GeometryAttribute::NAMED_ATTRIBUTES_COUNT; ++i) {
hash = HashCombine(pc.named_attribute_index_[i].size(), hash);
for (int j = 0; j < static_cast<int>(pc.named_attribute_index_[i].size());
++j) {
hash = HashCombine(pc.named_attribute_index_[i][j], hash);
}
}
// Hash attributes.
for (int i = 0; i < static_cast<int>(pc.attributes_.size()); ++i) {
PointAttributeHasher att_hasher;
hash = HashCombine(att_hasher(*pc.attributes_[i]), hash);
}
return hash;
}
};
} // namespace draco
#endif // DRACO_POINT_CLOUD_POINT_CLOUD_H_
| satcy/ofxDraco | libs/draco/include/point_cloud/point_cloud.h | C | apache-2.0 | 6,368 | [
30522,
1013,
1013,
9385,
2355,
1996,
2852,
22684,
6048,
1012,
1013,
1013,
1013,
1013,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1013,
1013,
2017,
2089,
2025,
2224,
2023,
5371,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# frozen_string_literal: true
module Faml
module ObjectRef
class << self
def render(ref = nil, prefix = nil, *)
h = {}
if ref.nil?
return h
end
c = class_name(ref)
i = "#{c}_#{id(ref) || 'new'}"
if prefix
c = "#{prefix}_#{c}"
i = "#{prefix}_#{i}"
end
{ id: i, class: c }
end
private
def class_name(ref)
if ref.respond_to?(:haml_object_ref)
ref.haml_object_ref
else
underscore(ref.class)
end
end
def id(ref)
if ref.respond_to?(:to_key)
key = ref.to_key
if key
key.join('_')
end
else
ref.id
end
end
def underscore(camel_cased_word)
word = camel_cased_word.to_s.dup
word.gsub!(/::/, '_')
word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
word.tr!('-', '_')
word.downcase!
word
end
end
end
end
| eagletmt/faml | lib/faml/object_ref.rb | Ruby | mit | 1,064 | [
30522,
1001,
7708,
1035,
5164,
1035,
18204,
1024,
2995,
11336,
6904,
19968,
11336,
4874,
2890,
2546,
2465,
1026,
1026,
2969,
13366,
17552,
1006,
25416,
1027,
9152,
2140,
1010,
17576,
1027,
9152,
2140,
1010,
1008,
1007,
1044,
1027,
1063,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace spec\TH\OAuth2;
use PhpSpec\ObjectBehavior;
use Symfony\Component\HttpFoundation\Request;
class OAuth2EntryPointSpec extends ObjectBehavior
{
public function let()
{
$this->beConstructedWith('AppName');
}
public function it_is_initializable()
{
$this->shouldHaveType('TH\OAuth2\OAuth2EntryPoint');
$this->shouldImplement('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface');
}
public function it_starts(Request $request)
{
$response = $this->start($request);
$response->shouldHaveType('Symfony\Component\HttpFoundation\Response');
$response->getStatusCode()->shouldReturn(401);
$response->headers->get('WWW-Authenticate')->shouldReturn('Bearer realm="AppName"');
}
}
| texthtml/oauth2-provider | spec/OAuth2EntryPointSpec.php | PHP | agpl-3.0 | 808 | [
30522,
1026,
1029,
25718,
3415,
15327,
28699,
1032,
16215,
1032,
1051,
4887,
2705,
2475,
1025,
2224,
25718,
13102,
8586,
1032,
4874,
4783,
3270,
25500,
2099,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
6922,
1032,
8299,
14876,
18426,
3508,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Tell the browser to be responsive to screen width -->
<title>SI Administrasi Desa</title>
<!-- Bootstrap 3.3.6 -->
<link rel="stylesheet" href="<?=base_url()?>assets/bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="<?=base_url()?>assets/plugins/datatables/dataTables.bootstrap.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.2.2/css/buttons.dataTables.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="<?=base_url()?>assets/dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="<?=base_url()?>assets/dist/css/skins/_all-skins.min.css">
<!-- Select2 -->
<link rel="stylesheet" href="<?=base_url()?>assets/plugins/select2/select2.min.css">
<!-- simple line icon -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.css">
<link rel="manifest" href="<?=base_url()?>assets/manifest.json">
<!-- jQuery 2.2.0 -->
<script src="<?=base_url()?>assets/plugins/jQuery/jQuery-2.2.0.min.js"></script>
<!-- DataTables -->
<script src="<?=base_url()?>assets/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="<?=base_url()?>assets/plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition skin-red sidebar-mini">
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="<?=site_url('dashboard')?>" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>SI</b></span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>SI</b>ADMINISTRASI</span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img class="img-circle" src="<?=base_url()?>assets/dist/img/no-image-user.jpg" alt="User profile picture">
</div>
<div class="pull-left info">
<input name='id' id='id' value='".$id."' type='hidden'>
<p><a href="#">User</a></p>
<a><i class="fa fa-circle text-success"></i> Online</a>
</div>
</div>
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<li class="header"> MENU</li>
<li id="home"><a href="<?=site_url('dashboard')?>"><i class="fa fa-home"></i> <span> Home</span></a></li>
<li id="data_penduduk" class="treeview">
<a href="#">
<i class="fa icon-wallet"></i> <span> Data Penduduk</span> <i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li id="penduduk"><a href="<?=site_url('penduduk')?>"><i class="fa icon-arrow-right"></i> Data Penduduk</a></li>
<li id="kelahiran"><a href="<?=site_url('kelahiran')?>"><i class="fa icon-arrow-right"></i> Data Kelahiran</a></li>
<li id="pendatang"><a href="<?=site_url('pendatang')?>"><i class="fa icon-arrow-right"></i> Data Pendatang</a></li>
<li id="kematian"><a href="<?=site_url('kematian')?>"><i class="fa icon-arrow-right"></i> Data Penduduk Meninggal</a></li>
<li id="pindah"><a href="<?=site_url('pindah')?>"><i class="fa icon-arrow-right"></i> Data Penduduk Pindah</a></li>
</ul>
</li>
<li id="surat" class="treeview">
<a href="#">
<i class="fa icon-wallet"></i> <span> Surat</span> <i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li id="surat_kelahiran"><a href="<?=site_url('surat_kelahiran')?>"><i class="fa icon-arrow-right"></i> SK Kelahiran</a></li>
<li id="surat_pendatang"><a href="#"><i class="fa icon-arrow-right"></i> SK Pendatang</a></li>
<li id="surat_kematian"><a href="#"><i class="fa icon-arrow-right"></i> SK Kematian</a></li>
<li id="surat_pindah"><a href="#"><i class="fa icon-arrow-right"></i> SK Pindah</a></li>
<li id="surat_kelakuan_baik"><a href="#"><i class="fa icon-arrow-right"></i> SK Kelakuan Baik</a></li>
<li id="surat_usaha"><a href="#"><i class="fa icon-arrow-right"></i> SK Usaha</a></li>
<li id="surat_tidak_mampu"><a href="#"><i class="fa icon-arrow-right"></i> SK Tidak Mampu</a></li>
<li id="surat_belum_kawin"><a href="#"><i class="fa icon-arrow-right"></i> SK Belum Pernah Kawin</a></li>
<li id="surat_perkawinan_hindu"><a href="#"><i class="fa icon-arrow-right"></i> SK Perkawinan Umat Hindu</a></li>
<li id="surat_permohonan_ktp"><a href="#"><i class="fa icon-arrow-right"></i> SK Permohonan KTP</a></li>
</ul>
</li>
<li id="potensi"><a href="#"><i class="fa icon-basket"></i> <span> Potensi Daerah</span></a></li>
<li class="header"> LOGOUT</li>
<li><a onclick="return confirm('Pilih OK untuk melanjutkan.')" href="<?=site_url('login/logout')?>"><i class="fa fa-power-off text-red"></i> <span> Logout</span></a></li>
</ul>
</section>
<!-- /.sidebar -->
</aside>
<?=$body?>
<!-- /.content-wrapper -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Version</b> 1.0.0
</div>
<strong>Copyright © 2017 <a href="#">SI Administrasi Desa</a>.</strong> All rights
reserved.
</footer>
<!-- /.control-sidebar -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->
<!-- Bootstrap 3.3.6 -->
<script src="<?=base_url()?>assets/bootstrap/js/bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="<?=base_url()?>assets/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="<?=base_url()?>assets/plugins/fastclick/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="<?=base_url()?>assets/dist/js/app.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?=base_url()?>assets/dist/js/demo.js"></script>
<!-- bootstrap datepicker -->
<script src="<?=base_url()?>assets/plugins/datepicker/bootstrap-datepicker.js"></script>
<!-- Select2 -->
<script src="<?=base_url()?>assets/plugins/select2/select2.full.min.js"></script>
<!-- excel -->
<script src="https://rawgithub.com/eligrey/FileSaver.js/master/FileSaver.js" type="text/javascript"></script>
<script>
function export() {
var blob = new Blob([document.getElementById('exportable').innerHTML], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
});
saveAs(blob, "report.xls");
}
</script>
<!-- page script -->
<script src="https://cdn.datatables.net/buttons/1.2.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
<script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js"></script>
<script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.2/js/buttons.html5.min.js"></script>
<script>
$(document).ready(function() {
//Initialize Select2 Elements
$(".select2").select2();
$('#example2').DataTable( {
"paging": false,
"lengthChange": true,
"searching": false,
"ordering": true,
"scrollX": true,
dom: 'Bfrtip',
buttons: [
'copyHtml5',
'excelHtml5',
'csvHtml5',
'pdfHtml5'
]
});
$('#example1').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": false
});
//Date picker
$('#datepicker').datepicker({
autoclose: true,
format: 'dd-mm-yyyy'
});
$('#kedatangan_datepicker').datepicker({
autoclose: true,
format: 'dd-mm-yyyy'
});
$('#datepicker2').datepicker({
autoclose: true,
format: 'dd-mm-yyyy'
});
} );
</script>
</body>
</body>
</html> | swantara/si-administrasi-kependudukan | application/views/template.php | PHP | mit | 9,733 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
1060,
1011,
25423,
1011,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>arms_get_rsinfo() — libarms 5.33 documentation</title>
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '5.33',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/translations.js"></script>
<script type="text/javascript" src="../_static/scroll.js"></script>
<link rel="top" title="libarms 5.33 documentation" href="../index.html" />
<link rel="up" title="API Reference" href="api_top.html" />
<link rel="next" title="arms_get_rs_url()" href="arms_get_rs_url.html" />
<link rel="prev" title="arms_get_ls_url()" href="arms_get_ls_url.html" />
</head>
<body>
<div id="header">
<a href=" ../."><img src= "../_static/logo.png" /></a>
</div>
<div class="related">
<ul>
<li>
<a href= " ../.">TOP</a> |
</li>
<li>
<a href=" ../download.html">ダウンロード</a> |
</li>
<li>
<a href=" ../contents.html">ドキュメント</a>
</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="arms-get-rsinfo">
<h1>arms_get_rsinfo()<a class="headerlink" href="#arms-get-rsinfo" title="このヘッドラインへのパーマリンク">¶</a></h1>
<div class="section" id="id1">
<h2>関数<a class="headerlink" href="#id1" title="このヘッドラインへのパーマリンク">¶</a></h2>
<dl class="function">
<dt id="arms_get_rsinfo">
int <tt class="descname">arms_get_rsinfo</tt><big>(</big>arms_context_t<em> *ctx</em>, <a class="reference internal" href="struct.html#arms_rs_info_t" title="arms_rs_info_t">arms_rs_info_t</a><em> *rsp</em>, int<em> size</em><big>)</big><a class="headerlink" href="#arms_get_rsinfo" title="この定義へのパーマリンク">¶</a></dt>
<dd></dd></dl>
</div>
<div class="section" id="id2">
<h2>呼び出し方向<a class="headerlink" href="#id2" title="このヘッドラインへのパーマリンク">¶</a></h2>
<p>アプリケーション->libarms</p>
</div>
<div class="section" id="id3">
<h2>目的<a class="headerlink" href="#id3" title="このヘッドラインへのパーマリンク">¶</a></h2>
<p>Push 接続元アドレスを取得する。</p>
</div>
<div class="section" id="id4">
<h2>説明<a class="headerlink" href="#id4" title="このヘッドラインへのパーマリンク">¶</a></h2>
<p><a class="reference internal" href="arms_pull.html#arms_pull" title="arms_pull"><tt class="xref c c-func docutils literal"><span class="pre">arms_pull()</span></tt></a> 実行時に RS から取得した、Push 接続元アドレス(複数) を取得する。</p>
</div>
<div class="section" id="id5">
<h2>引数<a class="headerlink" href="#id5" title="このヘッドラインへのパーマリンク">¶</a></h2>
<dl class="docutils">
<dt><tt class="xref c c-type docutils literal"><span class="pre">arms_context_t</span></tt> <tt class="xref c c-data docutils literal"><span class="pre">*ctx</span></tt></dt>
<dd>内部ステートを保持するコンテキスト構造体ポインタ。
<a class="reference internal" href="arms_init.html#arms_init" title="arms_init"><tt class="xref c c-func docutils literal"><span class="pre">arms_init()</span></tt></a> により取得したポインタをそのまま指定する。</dd>
<dt><a class="reference internal" href="struct.html#arms_rs_info_t" title="arms_rs_info_t"><tt class="xref c c-type docutils literal"><span class="pre">arms_rs_info_t</span></tt></a> <tt class="xref c c-data docutils literal"><span class="pre">*rsp</span></tt></dt>
<dd>アプリケーション側に領域を用意した、アドレス情報取得用バッファの
先頭アドレスを示すポインタ。sizeで指定したバイト数の書き込みが
可能となっていなければならない。詳細は <a class="reference internal" href="struct.html#arms_rs_info_t" title="arms_rs_info_t"><tt class="xref c c-type docutils literal"><span class="pre">arms_rs_info_t</span></tt></a> を参照。</dd>
<dt><tt class="xref c c-type docutils literal"><span class="pre">int</span></tt> <tt class="xref c c-data docutils literal"><span class="pre">size</span></tt></dt>
<dd>rsp のバッファサイズ[bytes]</dd>
</dl>
</div>
<div class="section" id="id6">
<h2>返り値<a class="headerlink" href="#id6" title="このヘッドラインへのパーマリンク">¶</a></h2>
<dl class="docutils">
<dt><tt class="xref c c-macro docutils literal"><span class="pre">-1</span></tt></dt>
<dd>パラメータが不適切のため情報取得に失敗。
rsp が NULL、あるいは size が sizeof(arms_rs_info_t) 未満。</dd>
<dt><tt class="xref c c-macro docutils literal"><span class="pre">-1以外</span></tt></dt>
<dd>libarms が取得し保持している RS 情報のセット数(0 を含む)。
実際に書き込んだ数ではない点に注意すること。</dd>
</dl>
</div>
<div class="section" id="id7">
<h2>コールバック関数からの呼び出し<a class="headerlink" href="#id7" title="このヘッドラインへのパーマリンク">¶</a></h2>
<p>可能</p>
</div>
<div class="section" id="id8">
<h2>ヒストリ<a class="headerlink" href="#id8" title="このヘッドラインへのパーマリンク">¶</a></h2>
<p>このAPIはVer2.20で追加された。</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../contents.html">目次</a></h3>
<ul>
<li><a class="reference internal" href="#">arms_get_rsinfo()</a><ul>
<li><a class="reference internal" href="#id1">関数</a></li>
<li><a class="reference internal" href="#id2">呼び出し方向</a></li>
<li><a class="reference internal" href="#id3">目的</a></li>
<li><a class="reference internal" href="#id4">説明</a></li>
<li><a class="reference internal" href="#id5">引数</a></li>
<li><a class="reference internal" href="#id6">返り値</a></li>
<li><a class="reference internal" href="#id7">コールバック関数からの呼び出し</a></li>
<li><a class="reference internal" href="#id8">ヒストリ</a></li>
</ul>
</li>
</ul>
<h4>前のトピックへ</h4>
<p class="topless"><a href="arms_get_ls_url.html"
title="前の章へ">arms_get_ls_url()</a></p>
<h4>次のトピックへ</h4>
<p class="topless"><a href="arms_get_rs_url.html"
title="次の章へ">arms_get_rs_url()</a></p>
<div id="searchbox" style="display: none">
<h3>クイック検索</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="検索" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
モジュール、クラス、または関数名を入力してください
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script><h3>リンク</h3>
<ul>
<li><a href="http://www.seil.jp/">SEIL Official Web</a></li>
<li><a href="http://www.smf.jp/">SMF Official Web</a></li>
<li><a href="/">SMF Developerサイト</a></li>
<li><a href="/sacm/order.php">libarms動作検証用SACM利用申請</a></li>
</ul>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>ナビゲーション</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="総合索引"
accesskey="I">索引</a></li>
<li class="right" >
<a href="arms_get_rs_url.html" title="arms_get_rs_url()"
accesskey="N">次へ</a> |</li>
<li class="right" >
<a href="arms_get_ls_url.html" title="arms_get_ls_url()"
accesskey="P">前へ</a> |</li>
<li><a href="../contents.html">libarms 5.33 documentation</a> »</li>
<li><a href="api_top.html" accesskey="U">API Reference</a> »</li>
</ul>
</div>
<div class="footer">
© 2012 Internet Initiative Japan Inc..
このドキュメントは <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2 で生成しました。
<p class="footer-up"><a href="#header"><img src="../_static/to_top.png" width="25" height="35" /></a></p>
</div>
<script type="text/javascript">
var pkBaseURL = "https://p.seil.jp/analytics/";
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="https://p.seil.jp/analytics/piwik.php?idsite=2" style="border:0" alt="" /></p></noscript>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-20473995-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html> | seil-smf/libarms | doc/api/arms_get_rsinfo.html | HTML | bsd-2-clause | 10,131 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// CocoaUPnP by A&R Cambridge Ltd, http://www.arcam.co.uk
// Copyright 2015 Arcam. See LICENSE file.
#import "UPPBaseParser.h"
@class UPPBasicDevice;
/**
Parser completion block
@param devices If parsing succeeds, a new `UPPBasicDevice` object is returned
@param error If parsing fails, an `NSError` object is returned
*/
typedef void(^CompletionBlock)(NSArray * _Nullable devices, NSError * _Nullable error);
/**
This class defines an object whose sole responsibility is to parse a device
description XML document into a `UPPDevice` object. @see UPPDevice
*/
@interface UPPDeviceParser : UPPBaseParser
/**
Download and parse a device's XML description
@param url The URL for the XML description file
@param completion A completion block returning either a `UPPDevice` object
or an `NSError` object
*/
- (void)parseURL:(nonnull NSURL *)url withCompletion:(nonnull CompletionBlock)completion;
@end
| arcam/CocoaUPnP | CocoaUPnP/Parsers/UPPDeviceParser.h | C | mit | 926 | [
30522,
1013,
1013,
22940,
6279,
16275,
2011,
1037,
1004,
1054,
4729,
5183,
1010,
8299,
1024,
1013,
1013,
7479,
1012,
8115,
3286,
1012,
2522,
1012,
2866,
1013,
1013,
9385,
2325,
8115,
3286,
1012,
2156,
6105,
5371,
1012,
1001,
12324,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
* $Id: Groupby.php 3884 2008-02-22 18:26:35Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Query_Part');
/**
* Doctrine_Query_Groupby
*
* @package Doctrine
* @subpackage Query
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3884 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class Doctrine_Query_Groupby extends Doctrine_Query_Part
{
/**
* DQL GROUP BY PARSER
* parses the group by part of the query string
*
* @param string $str
* @return void
*/
public function parse($str, $append = false)
{
$r = array();
foreach (explode(',', $str) as $reference) {
$reference = trim($reference);
$r[] = $this->query->parseClause($reference);
}
return implode(', ', $r);
}
}
| nbonamy/doctrine-0.10.4 | lib/Doctrine/Query/Groupby.php | PHP | mit | 1,870 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1002,
8909,
1024,
2177,
3762,
1012,
25718,
4229,
2620,
2549,
2263,
1011,
6185,
1011,
2570,
2324,
1024,
2656,
1024,
3486,
2480,
1046,
4213,
3351,
1002,
1008,
1008,
2023,
4007,
2003,
3024,
2011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* @file ic_frame_constructor.c
* @author Paweł Kaźmierzewski <p.kazmierzewski@inteliclinic.com>
* @author Wojtek Weclewski <w.weclewski@inteliclinic.com>
* @date February, 2017
* @brief Brief description
*
* Description
*/
#include "ic_frame_constructor.h"
#pragma GCC visibility push(hidden)
typedef enum{
RGB_LED_RED = 0x00,
RGB_LED_GREEN = 0x01,
RGB_LED_BLUE = 0x02
}e_rgbLed;
const uint8_t colors[RGB_LED_COLOR_NO_OF_COLORS][3] =
{
{RED_COLOR_RED_LED, RED_COLOR_GREEN_LED, RED_COLOR_BLUE_LED},
{GREEN_COLOR_RED_LED, GREEN_COLOR_GREEN_LED, GREEN_COLOR_BLUE_LED},
{BLUE_COLOR_RED_LED, BLUE_COLOR_GREEN_LED, BLUE_COLOR_BLUE_LED},
{WHITE_COLOR_RED_LED, WHITE_COLOR_GREEN_LED, WHITE_COLOR_BLUE_LED},
{TEAL_COLOR_RED_LED, TEAL_COLOR_GREEN_LED, TEAL_COLOR_BLUE_LED},
{0, 0, 0},
};
void priv_set_sync(u_cmdFrameContainer *frame){
frame->frame.sync = SYNC_BYTE;\
}
void priv_set_cmd(u_cmdFrameContainer *frame, e_cmd cmd){
frame->frame.cmd = (cmd);
}
void priv_set_cmd_id(u_cmdFrameContainer *frame, uint16_t id){
frame->frame.payload.device_cmd.id = id;
}
void priv_calculate_crc(u_cmdFrameContainer *frame){
frame->frame.crc = crc8_calculate(frame->data, sizeof(u_cmdFrameContainer)-1);
}
void priv_left_red_set_val(u_cmdFrameContainer *frame, uint8_t intensity){
DEV_SET(frame->frame.payload.device_cmd.device,DEV_LEFT_RED_LED);
frame->frame.payload.device_cmd.intensity.left_red_led = intensity;
}
void priv_left_green_set_val(u_cmdFrameContainer *frame, uint8_t intensity){
DEV_SET(frame->frame.payload.device_cmd.device,DEV_LEFT_GREEN_LED);
frame->frame.payload.device_cmd.intensity.left_green_led = intensity;
}
void priv_left_blue_set_val(u_cmdFrameContainer *frame, uint8_t intensity){
DEV_SET(frame->frame.payload.device_cmd.device,DEV_LEFT_BLUE_LED);
frame->frame.payload.device_cmd.intensity.left_blue_led = intensity;
}
void priv_right_red_set_val(u_cmdFrameContainer *frame, uint8_t intensity){
DEV_SET(frame->frame.payload.device_cmd.device,DEV_RIGHT_RED_LED);
frame->frame.payload.device_cmd.intensity.right_red_led = intensity;
}
void priv_right_green_set_val(u_cmdFrameContainer *frame, uint8_t intensity){
DEV_SET(frame->frame.payload.device_cmd.device,DEV_RIGHT_GREEN_LED);
frame->frame.payload.device_cmd.intensity.right_green_led = intensity;
}
void priv_right_blue_set_val(u_cmdFrameContainer *frame, uint8_t intensity){
DEV_SET(frame->frame.payload.device_cmd.device,DEV_RIGHT_BLUE_LED);
frame->frame.payload.device_cmd.intensity.right_blue_led = intensity;
}
void priv_vibrator_set_val(u_cmdFrameContainer *frame, uint8_t intensity){
DEV_SET(frame->frame.payload.device_cmd.device,DEV_VIBRATOR);
frame->frame.payload.device_cmd.intensity.vibrator = intensity;
}
void priv_power_led_set_val(u_cmdFrameContainer *frame){
DEV_SET(frame->frame.payload.device_cmd.device,DEV_POWER_LED);
}
void priv_set_device(u_cmdFrameContainer *frame, uint8_t device){
frame->frame.payload.device_cmd.device = device;
}
void priv_wrap_frame(u_cmdFrameContainer *frame, e_cmd cmd){
priv_set_sync(frame);
priv_set_cmd(frame, cmd);
priv_calculate_crc(frame);
}
void priv_set_function(u_cmdFrameContainer *frame, e_funcType function, uint32_t duration,
uint16_t period){
frame->frame.payload.device_cmd.func_type = function;
if((function != FUN_TYPE_OFF && function != FUN_TYPE_BLINK)){
frame->frame.payload.device_cmd.func_parameter.periodic_func.period = period;
frame->frame.payload.device_cmd.func_parameter.periodic_func.duration = duration;
}else{
frame->frame.payload.device_cmd.func_parameter.on_func.duration = 0;
}
}
void priv_rgb_led_left_ON(u_cmdFrameContainer *frame, bool set_func){
if(set_func == true) priv_set_function(frame, FUN_TYPE_ON, 0, 0);
priv_left_red_set_val(frame, 60);
priv_left_green_set_val(frame, 60);
priv_left_blue_set_val(frame, 10);
}
void priv_rgb_led_right_ON(u_cmdFrameContainer *frame, e_funcType set_func){
if(set_func == true) priv_set_function(frame, FUN_TYPE_ON, 0, 0);
priv_right_red_set_val(frame, 60);
priv_right_green_set_val(frame, 60);
priv_right_blue_set_val(frame, 10);
}
void priv_rgb_led_left_set_color(u_cmdFrameContainer *frame, e_rgbLedColor color,
uint8_t intensity, bool set_func){
if(set_func == true) priv_set_function(frame, FUN_TYPE_ON, 0, 0);
priv_left_red_set_val(frame,(colors[color][RGB_LED_RED]*intensity)/MAX_LED_VAL);
priv_left_green_set_val(frame, (colors[color][RGB_LED_GREEN]*intensity)/MAX_LED_VAL);
priv_left_blue_set_val(frame, (colors[color][RGB_LED_BLUE]*intensity)/MAX_LED_VAL);
}
void priv_rgb_led_right_set_color(u_cmdFrameContainer *frame, e_rgbLedColor color,
uint8_t intensity, bool set_func){
if(set_func == true) priv_set_function(frame, FUN_TYPE_ON, 0, 0);
priv_right_red_set_val(frame,(colors[color][RGB_LED_RED]*intensity)/MAX_LED_VAL);
priv_right_green_set_val(frame, (colors[color][RGB_LED_GREEN]*intensity)/MAX_LED_VAL);
priv_right_blue_set_val(frame, (colors[color][RGB_LED_BLUE]*intensity)/MAX_LED_VAL);
}
void priv_response_set(u_cmdFrameContainer *frame, uint16_t id, uint8_t device, e_funcType func,
uint32_t duration, uint16_t period, bool state_code){
frame->frame.payload.device_rsp.id = id;
frame->frame.payload.device_rsp.device = device;
frame->frame.payload.device_rsp.func_type = func;
frame->frame.payload.device_rsp.duration = duration;
frame->frame.payload.device_rsp.period = period;
frame->frame.payload.device_rsp.state_code = state_code;
}
void priv_response_copy(u_cmdFrameContainer *frame, u_BLECmdPayload *payload){
memcpy(&(frame->frame.payload), payload, sizeof(u_BLECmdPayload));
}
void priv_pox_set_cmd_id(u_cmdFrameContainer *frame, uint16_t id){
frame->frame.payload.pox_cmd.id = id;
}
void priv_pox_set_function(u_cmdFrameContainer *frame, e_poxFuncType function){
frame->frame.payload.pox_cmd.mode = EXEC_FUNC;
frame->frame.payload.pox_cmd.request.function = function;
}
void priv_pox_read_register(u_cmdFrameContainer *frame, t_afe4400Register reg){
frame->frame.payload.pox_cmd.mode = READ_REG;
frame->frame.payload.pox_cmd.request.reg_service.reg = reg;
}
void priv_pox_write_register(u_cmdFrameContainer *frame, t_afe4400Register reg, t_afe4400RegisterConf reg_val){
frame->frame.payload.pox_cmd.mode = WRITE_REG;
frame->frame.payload.pox_cmd.request.reg_service.reg = reg;
frame->frame.payload.pox_cmd.request.reg_service.reg_val = reg_val;
}
void priv_alarm_set_cmd_id(u_cmdFrameContainer *frame, uint16_t id){
frame->frame.payload.alarm_cmd.id = id;
}
void priv_alarm_set_conf(u_cmdFrameContainer *frame, e_alarmType type, uint32_t time, uint16_t timeout){
frame->frame.payload.alarm_cmd.type = type;
frame->frame.payload.alarm_cmd.time_to_alarm = time;
frame->frame.payload.alarm_cmd.timeout = timeout;
}
void priv_alarm_set_type(u_cmdFrameContainer *frame, e_alarmType type){
frame->frame.payload.alarm_cmd.type = type;
}
void priv_status_cmd_payload_set(u_cmdFrameContainer *frame, uint16_t id){
frame->frame.payload.device_cmd.id = id;
}
void priv_status_rsp_payload_set(u_cmdFrameContainer *frame, uint16_t id, s_devsFunc devs_func, uint8_t active_data_streams){
frame->frame.payload.status_rsp.id = id;
frame->frame.payload.status_rsp.devs_func = devs_func;
memcpy(&(frame->frame.payload.status_rsp.active_data_stream), &(active_data_streams), sizeof(active_data_streams));
}
void priv_set_dfu(u_cmdFrameContainer *frame){
frame->frame.payload.enable_dfu = true;
}
#pragma GCC visibility pop
| inteliclinic/neuroon-unified-communication | src/ic_frame_constructor.c | C | mit | 7,569 | [
30522,
1013,
1008,
1008,
1008,
1030,
5371,
24582,
1035,
4853,
1035,
9570,
2953,
1012,
1039,
1008,
1030,
3166,
22195,
2063,
18818,
10556,
2480,
9856,
15378,
7974,
5488,
1026,
1052,
1012,
10556,
2480,
9856,
15378,
7974,
5488,
1030,
13420,
259... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<html>
<body>
<pre>BEGINhtml
body
pre
include:custom(opt='val' num=2) filters.include.custom.pug
END</pre>
</body>
</html>
| february29/Learning | web/vue/AccountBook-Express/node_modules/pug/test/cases/filters.include.custom.html | HTML | mit | 144 | [
30522,
1026,
16129,
1028,
1026,
2303,
1028,
1026,
3653,
1028,
4088,
11039,
19968,
2303,
3653,
2421,
1024,
7661,
1006,
23569,
1027,
1005,
11748,
1005,
16371,
2213,
1027,
1016,
1007,
17736,
1012,
2421,
1012,
7661,
1012,
16405,
2290,
2203,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
layout: post
date: '2015-10-10'
title: "Halter Alfred Sung by Dessy Bridesmaids Dress D607"
category: Halter
tags: [Halter]
---
### Halter Alfred Sung by Dessy Bridesmaids Dress D607
Just **$196.99**
###
<a href="https://www.eudances.com/en/halter/1780-alfred-sung-by-dessy-bridesmaids-dress-d607.html"><img src="//www.eudances.com/5279-thickbox_default/alfred-sung-by-dessy-bridesmaids-dress-d607.jpg" alt="Alfred Sung by Dessy Bridesmaids Dress D607" style="width:100%;" /></a>
<!-- break --><a href="https://www.eudances.com/en/halter/1780-alfred-sung-by-dessy-bridesmaids-dress-d607.html"><img src="//www.eudances.com/5278-thickbox_default/alfred-sung-by-dessy-bridesmaids-dress-d607.jpg" alt="Alfred Sung by Dessy Bridesmaids Dress D607" style="width:100%;" /></a>
Buy it: [https://www.eudances.com/en/halter/1780-alfred-sung-by-dessy-bridesmaids-dress-d607.html](https://www.eudances.com/en/halter/1780-alfred-sung-by-dessy-bridesmaids-dress-d607.html)
| lastgown/lastgown.github.io | _posts/2015-10-10-Halter-Alfred-Sung-by-Dessy-Bridesmaids-Dress-D607.md | Markdown | mit | 973 | [
30522,
1011,
1011,
1011,
9621,
1024,
2695,
3058,
1024,
1005,
2325,
1011,
2184,
1011,
2184,
1005,
2516,
1024,
1000,
9190,
2121,
6152,
7042,
2011,
4078,
6508,
8959,
26212,
9821,
4377,
1040,
16086,
2581,
1000,
4696,
1024,
9190,
2121,
22073,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.inspire.guide.metadata;
import java.util.ArrayList;
import java.util.List;
/**
* Actions that can be performed within the
* Bukkit scheduler framework.
* <p/>
* These actions are self-contained, so when run() is
* executed, any action that will be performed does NOT require
* any additional outside information.
* <p/>
* User: InspiredIdealist
* Date: 1/11/14
*/
public abstract class Action implements Runnable {
private static List<Action> ACTIONS_AVAILABLE = new ArrayList<Action>();
private Type type;
private String description;
public Action(Type type, String description) {
this.type = type;
this.description = description;
ACTIONS_AVAILABLE.add(this); //May need to place this elsewhere. But this should work for now.
}
public Type getType() {
return type;
}
@Override
public abstract String toString();
public String getDescription() {
return description;
}
public static List<Action> getActionsAvailable() {
return ACTIONS_AVAILABLE;
}
/**
* Flag that denotes whether or not the rule can execute without
* the user specifying it.
*
* @return true if it is autonomous, false if not
*/
public abstract boolean isAutonomous();
/**
* The action to run. Call this to do the action.
*/
public abstract void run();
}
| InspiredIdealist/Trace-Framework | src/main/java/org/inspire/guide/metadata/Action.java | Java | gpl-2.0 | 1,404 | [
30522,
7427,
8917,
1012,
18708,
1012,
5009,
1012,
27425,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
9140,
9863,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2862,
1025,
1013,
1008,
1008,
1008,
4506,
2008,
2064,
2022,
2864,
2306,
1996,
1008,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
*Getting Started*
##Create a user input form for the module with built-in fields
Using the built-in fields API is an option, not a requirement.
It has some benefits like:
- saving handled automatically
- form field creation
- some fields have support:
- inline editing
- customizer integration
***
*technical insights*
###Module->fields() method
If a `fields()` method is present in the extending module class, an instance of the `ModuleFieldController` class gets assigned to the `$this->fields` module property.
The controller has following method available to you:
#####ModuleFieldController->addGroup( $groupId, $args = array() )
By calling `addGroup()` on the controller you create a new empty section, which is an instance of the `FieldSection` class.
Sections are rendered as tabs by default.
The `FieldSection` class offers a `addField()` method.
#####FieldSection->addField( $type, $key, $args );
***
###Add a text input and editor to the module
Open up your `DemoModule.php` file and add the following to it:
```php
public function fields()
{
// create group and add fields in one run
$this->fields->addGroup( 'section1', array( 'label' => 'Group of fields' ) )
->addField(
'text', // field type
'headline', // field key
array(
'label' => 'Headline',
'std' => 'Lorem Ipsum' // Default value
)
)
->addField(
'editor', // field type
'longtext', // field key
array(
'label' => 'Editor',
'media' => true, // enable add media button
'std' => '<h2>Hello World</h2><p>Lorem Ipsum...</p>'
)
);
}
```
This creates a section with the internal id of `group1` and adds two fields in the same step.
The `key` is used to access the data later on.
An alternative way of writing the above with the same result would look like this:
```php
public function fields()
{
// create group and add fiels in a seperate step
/** @var FieldSection $group1 */
$section1 = $this->fields->addGroup( 'section1', array( 'label' => 'Editor' ) );
$section1->addField(
'text', // field type
'headline', // field key
array(
'label' => 'Headline',
'std' => 'Lorem Ipsum'
)
);
$section1->addField(
'editor', // field type
'longtext', // field key
array(
'label' => 'Editor',
'media' => true, // enable add media button
'std' => '<h2>Hello World</h2><p>Lorem Ipsum</p>'
)
);
}
```
In that case you could pass a section to a custom filter or other manipulating functions.
Visit the edit screen of a page and add a new module if not already done, or reload.
If all is correct, it looks like this:
 | kai-jacobsen/kb-documentation | 02_getting-started/userform_fields_api.md | Markdown | gpl-2.0 | 3,251 | [
30522,
1008,
2893,
2318,
1008,
1001,
1001,
3443,
1037,
5310,
7953,
2433,
2005,
1996,
11336,
2007,
2328,
1011,
1999,
4249,
2478,
1996,
2328,
1011,
1999,
4249,
17928,
2003,
2019,
5724,
1010,
2025,
1037,
9095,
1012,
2009,
2038,
2070,
6666,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package city.test1;
/**
* @author chris Class representing one of the many possible stations found in
* an intersection.
*/
public class Station {
private String name;
public Station(String name) {
this.name = name;
}
/**
*
* @return Returns the station name.
*/
public String getName() {
return this.name;
}
@Override
public String toString() {
return this.name;
}
}
| saibot94/city-graph-pIII | src/city/test1/Station.java | Java | mit | 433 | [
30522,
7427,
2103,
1012,
3231,
2487,
1025,
1013,
1008,
1008,
1008,
1030,
3166,
3782,
2465,
5052,
2028,
1997,
1996,
2116,
2825,
3703,
2179,
1999,
1008,
2019,
6840,
1012,
1008,
1013,
2270,
2465,
2276,
1063,
2797,
5164,
2171,
1025,
2270,
227... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Array.prototype.equals = function(array) {
// if the other array is a falsy value, return
if (!array)
return false;
// compare lengths - can save a lot of time
if (this.length != array.length)
return false;
for (var i = 0, l = this.length; i < l; i++) {
// Check if we have nested arrays
if (this[i] instanceof Array && array[i] instanceof Array) {
// recurse into the nested arrays
if (!this[i].equals(array[i]))
return false;
} else if (this[i] != array[i]) {
// Warning - two different object instances will never be equal: {x:20} != {x:20}
return false;
}
}
return true;
}
var installed_date = new Date().getTime();
var DefaultSettings = {
"installed_date": installed_date,
"timestamp": "absolute",
"full_after_24h": false,
"name_display": "both",
"typeahead_display_username_only": true,
"circled_avatars": true,
"no_columns_icons": true,
"yt_rm_button": true,
"small_icons_compose": true,
"grayscale_notification_icons": false,
"url_redirection": true,
"blurred_modals": true,
"only_one_thumbnails": true,
"minimal_mode": true,
"flash_tweets": "mentions",
"shorten_text": false,
"share_button": true,
"providers": {
"500px": true,
"bandcamp": true,
"cloudapp": true,
"dailymotion": true,
"deviantart": true,
"dribbble": true,
"droplr": true,
"flickr": true,
"imgly": true,
"imgur": true,
"instagram": true,
"mobyto": true,
"soundcloud": true,
"ted": true,
"toresize": true,
"tumblr": true,
"vimeo": true,
"yfrog": true,
}
};
var currentOptions;
function onInstall() {
chrome.tabs.create({
url: "options/options.html#installed"
});
}
function onUpdate() {
chrome.tabs.create({
url: "options/options.html#updated"
});
}
function getVersion() {
var details = chrome.app.getDetails();
return details.version;
}
var currVersion = getVersion();
if (!localStorage['version']) {
localStorage['version'] = currVersion;
}
var prevVersion = localStorage['version'];
function init() {
const TWEETDECK_WEB_URL = 'https://tweetdeck.twitter.com';
/**
* Step 2: Collate a list of all the open tabs.
*/
function gatherTabs(urls, itemInfos) {
var allTheTabs = [];
var windowsChecked = 0;
console.log("gatherTabs", itemInfos.timestamp);
// First get all the windows...
chrome.windows.getAll(function(windows) {
for (var i = 0; i < windows.length; i++) {
// ... and then all their tabs.
chrome.tabs.getAllInWindow(windows[i].id, function(tabs) {
windowsChecked++;
allTheTabs = allTheTabs.concat(tabs);
if (windowsChecked === windows.length) {
// We have all the tabs! Search for a TweetDeck...
openApp(urls, allTheTabs, itemInfos);
}
});
}
});
}
function openApp(urls, tabs, itemInfos) {
console.log("openApp", itemInfos.timestamp);
// Search urls in priority order...
for (var i = 0; i < urls.length; i++) {
var url = urls[i];
// Search tabs...
for (var j = 0; j < tabs.length; j++) {
var tab = tabs[j];
if (tab.url.indexOf(url) === 0) {
// Found it!
var tabId = tab.id;
chrome.windows.update(tab.windowId, {
focused: true
});
chrome.tabs.update(tabId, {
selected: true,
active: true,
highlighted: true
}, function() {
console.log("update", itemInfos.timestamp);
var text = itemInfos.text;
var url = itemInfos.url;
chrome.tabs.sendMessage(tabId, {
text: text,
url: url,
timestamp: itemInfos.timestamp,
count: 2
})
});
return;
}
}
}
// Didn't find it! Open a new one!
chrome.tabs.create({
url: urls[0]
}, function(tab) {
var count = 0;
chrome.tabs.onUpdated.addListener(function(tabId, info) {
if (info.status == "complete") {
count += 1;
console.log("onUpdated", itemInfos.timestamp, count);
chrome.tabs.sendMessage(tabId, {
text: itemInfos.text,
url: itemInfos.url,
timestamp: itemInfos.timestamp,
count: count
});
}
})
});
};
var clickHandler = function(info, tab) {
var text;
var url;
if (info.selectionText && currentOptions.shorten_text) {
text = "\"" + info.selectionText.substr(0, 110) + "\"";
} else if (info.selectionText) {
text = "\"" + info.selectionText + "\"";
} else {
text = tab.title.substr(0, 110);
}
if (info.linkUrl) {
url = info.linkUrl
} else {
url = info.pageUrl;
}
if (info.mediaType === "image") {
url = info.srcUrl;
text = "";
}
gatherTabs([TWEETDECK_WEB_URL], {
"text": text,
"url": url,
"timestamp": new Date().getTime()
});
};
if (currentOptions.share_button) {
console.debug('Share button enabled');
chrome.contextMenus.create({
"title": "Share on (Better) TweetDeck",
"contexts": ["page", "selection", "image", "link"],
"onclick": clickHandler
});
}
}
chrome.storage.sync.get("BTDSettings", function(obj) {
if (obj.BTDSettings !== undefined) {
currentOptions = obj.BTDSettings;
var reApply = false;
for (var setting in DefaultSettings) {
if (currentOptions[setting] == undefined) {
console.debug("Defining", setting, "to default value", DefaultSettings[setting]);
currentOptions[setting] = DefaultSettings[setting];
reApply = true;
}
}
if (currVersion != prevVersion) {
if (!(prevVersion.split(".")[0] == currVersion.split(".")[0] && prevVersion.split(".")[1] == currVersion.split(".")[1])) {
onUpdate();
}
localStorage['version'] = currVersion;
}
for (var provider in DefaultSettings["providers"]) {
if (currentOptions["providers"][provider] == undefined) {
console.log("Adding", provider, "as a new provider with value", DefaultSettings["providers"][provider]);
currentOptions["providers"][provider] = DefaultSettings["providers"][provider];
reApply = true;
}
}
for (var setting in currentOptions) {
if (DefaultSettings[setting] == undefined) {
console.log("Deleting", setting);
delete currentOptions[setting];
reApply = true;
}
}
for (var setting in currentOptions["providers"]) {
if (DefaultSettings["providers"][setting] == undefined) {
delete currentOptions["providers"][setting];
reApply = true;
}
}
if (reApply === true) {
chrome.storage.sync.set({
"BTDSettings": currentOptions
}, function() {
console.log("Options updated!");
console.log(currentOptions);
init();
});
} else {
init();
}
} else {
chrome.storage.sync.set({
"BTDSettings": DefaultSettings
}, function() {
console.log("Default options set");
onInstall();
init();
})
}
}); | rodrigopolo/EvenBetterTweetDeck | source/js/background.js | JavaScript | mit | 7,269 | [
30522,
9140,
1012,
8773,
1012,
19635,
1027,
3853,
1006,
9140,
1007,
1063,
1013,
1013,
2065,
1996,
2060,
9140,
2003,
1037,
6904,
4877,
30524,
2051,
2065,
1006,
2023,
1012,
3091,
999,
1027,
9140,
1012,
3091,
1007,
2709,
6270,
1025,
2005,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -
每天学到的代码,记录之
| a1pussib/- | README.md | Markdown | mit | 38 | [
30522,
1001,
1011,
100,
1811,
1817,
100,
1916,
1760,
100,
1989,
100,
100,
1749,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*-
* <<
* UAVStack
* ==
* Copyright (C) 2016 - 2017 UAVStack
* ==
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* >>
*/
package com.creditease.agent.feature.hbagent;
import com.creditease.agent.http.api.UAVHttpMessage;
import com.creditease.agent.spi.AbstractHttpServiceComponent;
import com.creditease.agent.spi.HttpMessage;
public class HeartBeatQueryListenWorker extends AbstractHttpServiceComponent<UAVHttpMessage> {
public HeartBeatQueryListenWorker(String cName, String feature, String initHandlerKey) {
super(cName, feature, initHandlerKey);
}
@Override
protected UAVHttpMessage adaptRequest(HttpMessage message) {
String messageBody = message.getRequestBodyAsString("UTF-8");
if (log.isDebugEnable()) {
log.debug(this, "HeartBeatQueryListenWorker Request: " + messageBody);
}
UAVHttpMessage msg = new UAVHttpMessage(messageBody);
return msg;
}
@Override
protected void adaptResponse(HttpMessage message, UAVHttpMessage t) {
String response = t.getResponseAsJsonString();
message.putResponseBodyInString(response, 200, "utf-8");
if (log.isDebugEnable()) {
log.debug(this, "HeartBeatQueryListenWorker Response: " + response);
}
}
}
| xxxllluuu/uavstack | com.creditease.uav.agent.heartbeat/src/main/java/com/creditease/agent/feature/hbagent/HeartBeatQueryListenWorker.java | Java | apache-2.0 | 1,807 | [
30522,
1013,
1008,
1011,
1008,
1026,
1026,
1008,
25423,
15088,
2696,
3600,
1008,
1027,
1027,
1008,
9385,
1006,
1039,
1007,
2355,
1011,
2418,
25423,
15088,
2696,
3600,
1008,
1027,
1027,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.github.wovnio.wovnjava;
import java.util.HashMap;
import javax.servlet.FilterConfig;
import javax.servlet.http.HttpServletRequest;
import org.easymock.EasyMock;
import java.net.URL;
import java.net.MalformedURLException;
import junit.framework.TestCase;
public class HeadersTest extends TestCase {
private Lang japanese;
protected void setUp() throws Exception {
this.japanese = Lang.get("ja");
}
private static FilterConfig mockConfigPath() {
HashMap<String, String> parameters = new HashMap<String, String>() {{
put("urlPattern", "path");
}};
return TestUtil.makeConfigWithValidDefaults(parameters);
}
private static FilterConfig mockConfigSubdomain() {
HashMap<String, String> parameters = new HashMap<String, String>() {{
put("urlPattern", "subdomain");
}};
return TestUtil.makeConfigWithValidDefaults(parameters);
}
private static FilterConfig mockConfigQuery() {
HashMap<String, String> parameters = new HashMap<String, String>() {{
put("urlPattern", "query");
put("defaultLang", "en");
put("supportedLangs", "en,ja,zh-CHS");
}};
return TestUtil.makeConfigWithValidDefaults(parameters);
}
public void testHeaders() throws ConfigurationError {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://example.com/ja/test");
FilterConfig mockConfig = mockConfigPath();
Settings s = new Settings(mockConfig);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
Headers h = new Headers(mockRequest, s, ulph);
assertNotNull(h);
}
public void testGetRequestLangPath() throws ConfigurationError {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://example.com/ja/test");
FilterConfig mockConfig = mockConfigPath();
Settings s = new Settings(mockConfig);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
Headers h = new Headers(mockRequest, s, ulph);
assertEquals(this.japanese, h.getRequestLang());
}
public void testGetRequestLangSubdomain() throws ConfigurationError {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://ja.example.com/test");
FilterConfig mockConfig = mockConfigSubdomain();
Settings s = new Settings(mockConfig);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
Headers h = new Headers(mockRequest, s, ulph);
assertEquals(this.japanese, h.getRequestLang());
}
public void testGetRequestLangQuery() throws ConfigurationError {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://example.com/test?wovn=ja");
FilterConfig mockConfig = mockConfigQuery();
Settings s = new Settings(mockConfig);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
Headers h = new Headers(mockRequest, s, ulph);
assertEquals(this.japanese, h.getRequestLang());
}
public void testConvertToDefaultLanguage__PathPattern() throws ConfigurationError, MalformedURLException {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://example.com/ja/test");
FilterConfig mockConfig = mockConfigPath();
Settings s = new Settings(mockConfig);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
Headers h = new Headers(mockRequest, s, ulph);
URL url = new URL("http://example.com/ja/test");
assertEquals("http://example.com/test", h.convertToDefaultLanguage(url).toString());
}
public void testConvertToDefaultLanguage__SubdomainPattern() throws ConfigurationError, MalformedURLException {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://ja.example.com/test");
FilterConfig mockConfig = mockConfigSubdomain();
Settings s = new Settings(mockConfig);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
Headers h = new Headers(mockRequest, s, ulph);
URL url = new URL("http://ja.example.com/test");
assertEquals("http://example.com/test", h.convertToDefaultLanguage(url).toString());
}
public void testConvertToDefaultLanguage__QueryPattern() throws ConfigurationError, MalformedURLException {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://example.com/test?wovn=ja");
FilterConfig mockConfig = mockConfigQuery();
Settings s = new Settings(mockConfig);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
Headers h = new Headers(mockRequest, s, ulph);
URL url = new URL("http://example.com/test?wovn=ja");
assertEquals("http://example.com/test", h.convertToDefaultLanguage(url).toString());
}
public void testConvertToDefaultLanguage__PathPatternWithSitePrefixPath() throws ConfigurationError, MalformedURLException {
Headers h = createHeaders("/global/en/foo", "/global/", "");
URL url;
url = new URL("http://site.com/global/en/");
assertEquals("http://site.com/global/", h.convertToDefaultLanguage(url).toString());
url = new URL("http://site.com/en/global/");
assertEquals("http://site.com/en/global/", h.convertToDefaultLanguage(url).toString());
}
public void testLocationWithDefaultLangCode() throws ConfigurationError {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://example.com/signin");
FilterConfig mockConfig = mockConfigPath();
Settings s = new Settings(mockConfig);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
Headers h = new Headers(mockRequest, s, ulph);
assertEquals("http://example.com/", h.locationWithLangCode("http://example.com/"));
assertEquals("https://example.com/", h.locationWithLangCode("https://example.com/"));
assertEquals("https://example.com/dir/file", h.locationWithLangCode("https://example.com/dir/file"));
}
public void testLocationWithPath() throws ConfigurationError {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://example.com/ja/dir/signin");
FilterConfig mockConfig = mockConfigPath();
Settings s = new Settings(mockConfig);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
Headers h = new Headers(mockRequest, s, ulph);
assertEquals("http://example.com/ja/", h.locationWithLangCode("http://example.com/"));
assertEquals("https://example.com/ja/", h.locationWithLangCode("https://example.com/"));
assertEquals("https://example.com/ja/dir/file", h.locationWithLangCode("https://example.com/dir/file"));
assertEquals("https://other.com/dir/file", h.locationWithLangCode("https://other.com/dir/file"));
assertEquals("https://example.com/ja/", h.locationWithLangCode("/"));
assertEquals("https://example.com/ja/dir/file", h.locationWithLangCode("/dir/file"));
assertEquals("https://example.com/ja/dir/file", h.locationWithLangCode("./file"));
assertEquals("https://example.com/ja/file", h.locationWithLangCode("../file"));
assertEquals("https://example.com/ja/file", h.locationWithLangCode("../../file"));
}
public void testLocationWithPathAndTrailingSlash() throws ConfigurationError {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://example.com/ja/dir/signin/");
FilterConfig mockConfig = mockConfigPath();
Settings s = new Settings(mockConfig);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
Headers h = new Headers(mockRequest, s, ulph);
assertEquals("https://example.com/ja/dir/signin/file", h.locationWithLangCode("./file"));
assertEquals("https://example.com/ja/dir/file", h.locationWithLangCode("../file"));
assertEquals("https://example.com/ja/file", h.locationWithLangCode("../../file"));
assertEquals("https://example.com/ja/file", h.locationWithLangCode("../../../file"));
}
public void testLocationWithPathAndTopLevel() throws ConfigurationError {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://example.com/location.jsp?wovn=ja");
FilterConfig mockConfig = mockConfigQuery();
Settings s = new Settings(mockConfig);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
Headers h = new Headers(mockRequest, s, ulph);
assertEquals("https://example.com/index.jsp?wovn=ja", h.locationWithLangCode("./index.jsp"));
}
public void testLocationWithQuery() throws ConfigurationError {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://example.com/dir/signin?wovn=ja");
FilterConfig mockConfig = mockConfigQuery();
Settings s = new Settings(mockConfig);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
Headers h = new Headers(mockRequest, s, ulph);
assertEquals("http://example.com/?wovn=ja", h.locationWithLangCode("http://example.com/"));
assertEquals("https://example.com/?wovn=ja", h.locationWithLangCode("https://example.com/"));
assertEquals("https://example.com/dir/file?wovn=ja", h.locationWithLangCode("https://example.com/dir/file"));
assertEquals("https://other.com/dir/file", h.locationWithLangCode("https://other.com/dir/file"));
assertEquals("https://example.com/?wovn=ja", h.locationWithLangCode("/"));
assertEquals("https://example.com/dir/file?wovn=ja", h.locationWithLangCode("/dir/file"));
assertEquals("https://example.com/dir/file?wovn=ja", h.locationWithLangCode("./file"));
assertEquals("https://example.com/file?wovn=ja", h.locationWithLangCode("../file"));
assertEquals("https://example.com/file?wovn=ja", h.locationWithLangCode("../../file"));
assertEquals("https://example.com/file?q=hello&wovn=ja", h.locationWithLangCode("../../file?q=hello&wovn=zh-CHS"));
assertEquals("https://example.com/file?wovn=ja", h.locationWithLangCode("../../file?wovn=zh-CHS"));
}
public void testLocationWithSubdomain() throws ConfigurationError {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://ja.example.com/dir/signin");
FilterConfig mockConfig = mockConfigSubdomain();
Settings s = new Settings(mockConfig);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
Headers h = new Headers(mockRequest, s, ulph);
assertEquals("http://ja.example.com/", h.locationWithLangCode("http://example.com/"));
assertEquals("https://ja.example.com/", h.locationWithLangCode("https://example.com/"));
assertEquals("https://ja.example.com/dir/file", h.locationWithLangCode("https://example.com/dir/file"));
assertEquals("https://other.com/dir/file", h.locationWithLangCode("https://other.com/dir/file"));
assertEquals("https://fr.example.com/dir/file", h.locationWithLangCode("https://fr.example.com/dir/file"));
assertEquals("https://ja.example.com/", h.locationWithLangCode("/"));
assertEquals("https://ja.example.com/dir/file", h.locationWithLangCode("/dir/file"));
assertEquals("https://ja.example.com/dir/file", h.locationWithLangCode("./file"));
assertEquals("https://ja.example.com/file", h.locationWithLangCode("../file"));
assertEquals("https://ja.example.com/file", h.locationWithLangCode("../../file"));
}
public void testLocationWithSitePrefixPath() throws ConfigurationError {
Headers h = createHeaders("/global/ja/foo", "/global/", "");
assertEquals("http://example.com/", h.locationWithLangCode("http://example.com/"));
assertEquals("http://example.com/global/ja/", h.locationWithLangCode("http://example.com/global/"));
assertEquals("https://example.com/global/ja/", h.locationWithLangCode("https://example.com/global/"));
assertEquals("https://example.com/global/ja/", h.locationWithLangCode("https://example.com/global/ja/"));
assertEquals("https://example.com/global/ja/th/", h.locationWithLangCode("https://example.com/global/th/")); // `th` not in supportedLangs
assertEquals("https://example.com/global/ja/tokyo/", h.locationWithLangCode("https://example.com/global/tokyo/"));
assertEquals("https://example.com/global/ja/file.html", h.locationWithLangCode("https://example.com/global/file.html"));
assertEquals("https://example.com/global/ja/file.html", h.locationWithLangCode("https://example.com/pics/../global/file.html"));
assertEquals("https://example.com/global/../../file.html", h.locationWithLangCode("https://example.com/global/../../file.html"));
assertEquals("https://example.com/tokyo/", h.locationWithLangCode("https://example.com/tokyo/"));
assertEquals("https://example.com/tokyo/global/", h.locationWithLangCode("https://example.com/tokyo/global/"));
assertEquals("https://example.com/ja/global/", h.locationWithLangCode("https://example.com/ja/global/"));
assertEquals("https://example.com/th/global/", h.locationWithLangCode("https://example.com/th/global/"));
assertEquals("https://example.com/th/", h.locationWithLangCode("https://example.com/th/"));
}
public void testGetIsValidRequest() throws ConfigurationError {
Headers h;
h = createHeaders("/", "global", "");
assertEquals(false, h.getIsValidRequest());
h = createHeaders("/global", "global", "");
assertEquals(true, h.getIsValidRequest());
h = createHeaders("/global/ja/foo", "global", "");
assertEquals(true, h.getIsValidRequest());
h = createHeaders("/ja/global/foo", "global", "");
assertEquals(false, h.getIsValidRequest());
}
public void testGetIsValidRequest__withIgnoredPaths() throws ConfigurationError {
Headers h;
h = createHeaders("/", "", "/admin,/wp-admin");
assertEquals(true, h.getIsValidRequest());
h = createHeaders("/user/admin", "", "/admin,/wp-admin");
assertEquals(true, h.getIsValidRequest());
h = createHeaders("/adminpage", "", "/admin,/wp-admin");
assertEquals(true, h.getIsValidRequest());
h = createHeaders("/admin", "", "/admin,/wp-admin");
assertEquals(false, h.getIsValidRequest());
h = createHeaders("/wp-admin/", "", "/admin,/wp-admin");
assertEquals(false, h.getIsValidRequest());
h = createHeaders("/wp-admin/page", "", "/admin,/wp-admin");
assertEquals(false, h.getIsValidRequest());
h = createHeaders("/ja/admin", "", "/admin,/wp-admin");
assertEquals(false, h.getIsValidRequest());
h = createHeaders("/ja/wp-admin/", "", "/admin,/wp-admin");
assertEquals(false, h.getIsValidRequest());
h = createHeaders("/en/admin", "", "/admin,/wp-admin");
assertEquals(false, h.getIsValidRequest());
h = createHeaders("/en/wp-admin/", "", "/admin,/wp-admin");
assertEquals(false, h.getIsValidRequest());
h = createHeaders("/city/wp-admin", "city", "/admin,/wp-admin");
assertEquals(true, h.getIsValidRequest());
h = createHeaders("/city/wp-admin", "city", "/city/admin,/city/wp-admin");
assertEquals(false, h.getIsValidRequest());
}
private Headers createHeaders(String requestPath, String sitePrefixPath, String ignorePaths) throws ConfigurationError {
HttpServletRequest mockRequest = MockHttpServletRequest.create("https://example.com" + requestPath);
HashMap<String, String> option = new HashMap<String, String>() {{
put("urlPattern", "path");
put("sitePrefixPath", sitePrefixPath);
put("ignorePaths", ignorePaths);
}};
Settings s = TestUtil.makeSettings(option);
UrlLanguagePatternHandler ulph = UrlLanguagePatternHandlerFactory.create(s);
return new Headers(mockRequest, s, ulph);
}
public void testGetHreflangUrlMap__PathPattern() throws ConfigurationError {
Settings settings = TestUtil.makeSettings(new HashMap<String, String>() {{
put("defaultLang", "en");
put("supportedLangs", "en,ja,fr");
put("urlPattern", "path");
put("sitePrefixPath", "/home");
}});
UrlLanguagePatternHandler patternHandler = UrlLanguagePatternHandlerFactory.create(settings);
HttpServletRequest request = MockHttpServletRequest.create("https://example.com/home?user=123");
Headers sut = new Headers(request, settings, patternHandler);
HashMap<String, String> hreflangs = sut.getHreflangUrlMap();
assertEquals(3, hreflangs.size());
assertEquals("https://example.com/home?user=123", hreflangs.get("en"));
assertEquals("https://example.com/home/ja?user=123", hreflangs.get("ja"));
assertEquals("https://example.com/home/fr?user=123", hreflangs.get("fr"));
}
public void testGetHreflangUrlMap__QueryPattern() throws ConfigurationError {
Settings settings = TestUtil.makeSettings(new HashMap<String, String>() {{
put("defaultLang", "ja");
put("supportedLangs", "ko");
put("urlPattern", "query");
}});
UrlLanguagePatternHandler patternHandler = UrlLanguagePatternHandlerFactory.create(settings);
HttpServletRequest request = MockHttpServletRequest.create("https://example.com/home?user=123");
Headers sut = new Headers(request, settings, patternHandler);
HashMap<String, String> hreflangs = sut.getHreflangUrlMap();
assertEquals(2, hreflangs.size());
assertEquals("https://example.com/home?user=123", hreflangs.get("ja"));
assertEquals("https://example.com/home?user=123&wovn=ko", hreflangs.get("ko"));
}
public void testGetHreflangUrlMap__SubdomainPattern__WithChineseSupportedLangs() throws ConfigurationError {
Settings settings = TestUtil.makeSettings(new HashMap<String, String>() {{
put("defaultLang", "ja");
put("supportedLangs", "ko,th, zh-CHT, zh-CHS");
put("urlPattern", "subdomain");
}});
UrlLanguagePatternHandler patternHandler = UrlLanguagePatternHandlerFactory.create(settings);
HttpServletRequest request = MockHttpServletRequest.create("https://example.com/home?user=123");
Headers sut = new Headers(request, settings, patternHandler);
HashMap<String, String> hreflangs = sut.getHreflangUrlMap();
assertEquals(5, hreflangs.size());
assertEquals("https://example.com/home?user=123", hreflangs.get("ja"));
assertEquals("https://ko.example.com/home?user=123", hreflangs.get("ko"));
assertEquals("https://th.example.com/home?user=123", hreflangs.get("th"));
assertEquals("https://zh-CHT.example.com/home?user=123", hreflangs.get("zh-Hant"));
assertEquals("https://zh-CHS.example.com/home?user=123", hreflangs.get("zh-Hans"));
}
public void testIsSearchEngineBot_NoUserAgent_False() throws ConfigurationError {
String userAgent = null;
Settings settings = TestUtil.makeSettings();
UrlLanguagePatternHandler patternHandler = UrlLanguagePatternHandlerFactory.create(settings);
HttpServletRequest request = MockHttpServletRequest.create("https://example.com/home?user=123", userAgent);
Headers sut = new Headers(request, settings, patternHandler);
assertEquals(false, sut.isSearchEngineBot());
}
public void testIsSearchEngineBot_OrdinaryUserAgent_False() throws ConfigurationError {
String userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.81 Safari/537.36";
Settings settings = TestUtil.makeSettings();
UrlLanguagePatternHandler patternHandler = UrlLanguagePatternHandlerFactory.create(settings);
HttpServletRequest request = MockHttpServletRequest.create("https://example.com/home?user=123");
Headers sut = new Headers(request, settings, patternHandler);
assertEquals(false, sut.isSearchEngineBot());
}
public void testIsSearchEngineBot_SearchEngineBotUserAgent_True() throws ConfigurationError {
String userAgent = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)";
Settings settings = TestUtil.makeSettings();
UrlLanguagePatternHandler patternHandler = UrlLanguagePatternHandlerFactory.create(settings);
HttpServletRequest request = MockHttpServletRequest.create("https://example.com/home?user=123", userAgent);
Headers sut = new Headers(request, settings, patternHandler);
assertEquals(true, sut.isSearchEngineBot());
}
}
| WOVNio/wovnjava | src/test/java/com/github/wovnio/wovnjava/HeadersTest.java | Java | mit | 21,076 | [
30522,
7427,
4012,
1012,
21025,
2705,
12083,
1012,
24185,
16022,
3695,
1012,
24185,
16022,
3900,
3567,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
23325,
2863,
2361,
1025,
12324,
9262,
2595,
1012,
14262,
2615,
7485,
1012,
11307,
8663,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import { MountedToolInfo } from "../farm_designer/interfaces";
import { ToolPulloutDirection } from "farmbot/dist/resources/api_resources";
import { ToolTransformProps } from "../tools/interfaces";
export const fakeMountedToolInfo = (): MountedToolInfo => ({
name: "fake mounted tool",
pulloutDirection: ToolPulloutDirection.POSITIVE_X,
noUTM: false,
flipped: false,
});
export const fakeToolTransformProps = (): ToolTransformProps => ({
xySwap: false,
quadrant: 2,
});
| FarmBot/farmbot-web-app | frontend/__test_support__/fake_tool_info.ts | TypeScript | mit | 484 | [
30522,
12324,
1063,
5614,
30524,
4523,
1065,
2013,
1000,
1012,
1012,
1013,
5906,
1013,
19706,
1000,
1025,
9167,
9530,
3367,
8275,
27632,
3406,
18861,
14876,
1027,
1006,
1007,
1024,
5614,
3406,
18861,
14876,
1027,
1028,
1006,
1063,
2171,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* SonarQube, open source software quality management tool.
* Copyright (C) 2008-2014 SonarSource
* mailto:contact AT sonarsource DOT com
*
* SonarQube is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* SonarQube is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.sonar.api.config;
import org.junit.Test;
import static org.fest.assertions.Assertions.assertThat;
public class CategoryTest {
@Test
public void category_key_is_case_insentive() {
assertThat(new Category("Licenses")).isEqualTo(new Category("licenses"));
// Just to raise coverage
assertThat(new Category("Licenses")).isNotEqualTo("Licenses");
}
@Test
public void should_preserve_original_key() {
assertThat(new Category("Licenses").originalKey()).isEqualTo("Licenses");
}
@Test
public void should_normalize_key() throws Exception {
assertThat(new Category("Licenses").key()).isEqualTo("licenses");
}
@Test
public void should_use_original_key() throws Exception {
assertThat(new Category("Licenses").toString()).isEqualTo("Licenses");
}
}
| teryk/sonarqube | sonar-plugin-api/src/test/java/org/sonar/api/config/CategoryTest.java | Java | lgpl-3.0 | 1,690 | [
30522,
1013,
1008,
1008,
24609,
28940,
4783,
1010,
2330,
3120,
4007,
3737,
2968,
6994,
1012,
1008,
9385,
1006,
1039,
1007,
2263,
1011,
2297,
24609,
6499,
3126,
3401,
1008,
5653,
3406,
1024,
3967,
2012,
24609,
6499,
3126,
3401,
11089,
4012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright (c) 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.appengine.demos.jdoexamples;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class GuestbookServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
GuestbookUtils.insert(req.getParameter("who"), req.getParameter("message"));
resp.sendRedirect("/guestbook.jsp");
}
}
| dougkoellmer/swarm | tools/appengine-java-sdk/demos/jdoexamples/src/com/google/appengine/demos/jdoexamples/GuestbookServlet.java | Java | mit | 1,159 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2268,
8224,
4297,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/quicksight/QuickSight_EXPORTS.h>
#include <aws/quicksight/model/ThemeAlias.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace QuickSight
{
namespace Model
{
class AWS_QUICKSIGHT_API UpdateThemeAliasResult
{
public:
UpdateThemeAliasResult();
UpdateThemeAliasResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
UpdateThemeAliasResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>Information about the theme alias.</p>
*/
inline const ThemeAlias& GetThemeAlias() const{ return m_themeAlias; }
/**
* <p>Information about the theme alias.</p>
*/
inline void SetThemeAlias(const ThemeAlias& value) { m_themeAlias = value; }
/**
* <p>Information about the theme alias.</p>
*/
inline void SetThemeAlias(ThemeAlias&& value) { m_themeAlias = std::move(value); }
/**
* <p>Information about the theme alias.</p>
*/
inline UpdateThemeAliasResult& WithThemeAlias(const ThemeAlias& value) { SetThemeAlias(value); return *this;}
/**
* <p>Information about the theme alias.</p>
*/
inline UpdateThemeAliasResult& WithThemeAlias(ThemeAlias&& value) { SetThemeAlias(std::move(value)); return *this;}
/**
* <p>The HTTP status of the request.</p>
*/
inline int GetStatus() const{ return m_status; }
/**
* <p>The HTTP status of the request.</p>
*/
inline void SetStatus(int value) { m_status = value; }
/**
* <p>The HTTP status of the request.</p>
*/
inline UpdateThemeAliasResult& WithStatus(int value) { SetStatus(value); return *this;}
/**
* <p>The AWS request ID for this operation.</p>
*/
inline const Aws::String& GetRequestId() const{ return m_requestId; }
/**
* <p>The AWS request ID for this operation.</p>
*/
inline void SetRequestId(const Aws::String& value) { m_requestId = value; }
/**
* <p>The AWS request ID for this operation.</p>
*/
inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); }
/**
* <p>The AWS request ID for this operation.</p>
*/
inline void SetRequestId(const char* value) { m_requestId.assign(value); }
/**
* <p>The AWS request ID for this operation.</p>
*/
inline UpdateThemeAliasResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;}
/**
* <p>The AWS request ID for this operation.</p>
*/
inline UpdateThemeAliasResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;}
/**
* <p>The AWS request ID for this operation.</p>
*/
inline UpdateThemeAliasResult& WithRequestId(const char* value) { SetRequestId(value); return *this;}
private:
ThemeAlias m_themeAlias;
int m_status;
Aws::String m_requestId;
};
} // namespace Model
} // namespace QuickSight
} // namespace Aws
| jt70471/aws-sdk-cpp | aws-cpp-sdk-quicksight/include/aws/quicksight/model/UpdateThemeAliasResult.h | C | apache-2.0 | 3,328 | [
30522,
1013,
1008,
1008,
1008,
9385,
9733,
1012,
4012,
1010,
4297,
1012,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1008,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
15895,
1011,
1016,
1012,
1014,
1012,
1008,
1013,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2015, Yahoo Inc. All rights reserved.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
#ifndef COMMON_H
#define COMMON_H
#include <memory>
#include <regex>
#include <set>
#include <string>
typedef std::shared_ptr< const std::regex > Regex;
typedef std::shared_ptr< const std::set< std::string > > Set;
#endif //COMMON_H
| yahoo/zeus | src/common.h | C | bsd-3-clause | 397 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2325,
1010,
20643,
4297,
1012,
2035,
2916,
9235,
1012,
1008,
9385,
2015,
7000,
2104,
1996,
2047,
18667,
2094,
6105,
1012,
1008,
2156,
1996,
10860,
6105,
5371,
2005,
3408,
1012,
1008,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace ExemploEFCrud
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
| carloscds/AspNetCoreOracle | ExemploEFCrud/ExemploEFCrud/Global.asax.cs | C# | apache-2.0 | 574 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
4773,
1025,
2478,
2291,
1012,
4773,
1012,
19842,
2278,
1025,
2478,
2291,
1012,
4773,
1012,
20600,
1025,
2478,
2291,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class TestBean {
private String[] colors= {"red","blue","green","black"};
private List<String> meals = new ArrayList<>();
public TestBean(){
meals.add("soup");
meals.add("fish fillet");
meals.add("fried chips");
meals.add("steak");
}
public String[] getColors() {
return colors;
}
public void setColors(String[] colors) {
this.colors = colors;
}
public List<String> getMeals() {
return meals;
}
public void setMeals(List<String> meals) {
this.meals = meals;
}
}
| Shalantor/JSF-Course | JSF2-Expression-Language/exercises_1_and_2/src/TestBean.java | Java | mit | 613 | [
30522,
12324,
9262,
1012,
21183,
4014,
1012,
9140,
9863,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2862,
1025,
12324,
9262,
2595,
1012,
5344,
1012,
14068,
1012,
3266,
4783,
2319,
1025,
1030,
3266,
4783,
2319,
2270,
2465,
3231,
4783,
2319,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* $Id: memuserkernel-r0drv-darwin.cpp $ */
/** @file
* IPRT - User & Kernel Memory, Ring-0 Driver, Darwin.
*/
/*
* Copyright (C) 2009 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "the-darwin-kernel.h"
#include "internal/iprt.h"
#include <iprt/mem.h>
#include <iprt/assert.h>
#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
# include <iprt/asm-amd64-x86.h>
#endif
#include <iprt/err.h>
RTR0DECL(int) RTR0MemUserCopyFrom(void *pvDst, RTR3PTR R3PtrSrc, size_t cb)
{
RT_ASSERT_INTS_ON();
int rc = copyin((const user_addr_t)R3PtrSrc, pvDst, cb);
if (RT_LIKELY(rc == 0))
return VINF_SUCCESS;
return VERR_ACCESS_DENIED;
}
RTR0DECL(int) RTR0MemUserCopyTo(RTR3PTR R3PtrDst, void const *pvSrc, size_t cb)
{
RT_ASSERT_INTS_ON();
int rc = copyout(pvSrc, R3PtrDst, cb);
if (RT_LIKELY(rc == 0))
return VINF_SUCCESS;
return VERR_ACCESS_DENIED;
}
RTR0DECL(bool) RTR0MemUserIsValidAddr(RTR3PTR R3Ptr)
{
/* the commpage is above this. */
#ifdef RT_ARCH_X86
return R3Ptr < VM_MAX_ADDRESS;
#else
return R3Ptr < VM_MAX_PAGE_ADDRESS;
#endif
}
RTR0DECL(bool) RTR0MemKernelIsValidAddr(void *pv)
{
/* Found no public #define or symbol for checking this, so we'll
have to make do with thing found in the debugger and the sources. */
#ifdef RT_ARCH_X86
NOREF(pv);
return true; /* Almost anything is a valid kernel address here. */
#elif defined(RT_ARCH_AMD64)
return (uintptr_t)pv >= UINT64_C(0xffff800000000000);
#else
# error "PORTME"
#endif
}
RTR0DECL(bool) RTR0MemAreKrnlAndUsrDifferent(void)
{
/* As mentioned in RTR0MemKernelIsValidAddr, found no way of checking
this at compiler or runtime. */
#ifdef RT_ARCH_X86
return false;
#else
return true;
#endif
}
| JSansalone/VirtualBox4.1.18 | src/VBox/Runtime/r0drv/darwin/memuserkernel-r0drv-darwin.cpp | C++ | gpl-2.0 | 2,937 | [
30522,
1013,
1008,
1002,
8909,
1024,
2033,
7606,
2121,
5484,
11877,
1011,
1054,
2692,
13626,
2615,
1011,
11534,
1012,
18133,
2361,
1002,
1008,
1013,
1013,
1008,
1008,
1030,
5371,
1008,
12997,
5339,
1011,
5310,
1004,
16293,
3638,
1010,
3614,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import discord
from discord.ext import commands
from .utils.chat_formatting import escape_mass_mentions, italics, pagify
from random import randint
from random import choice
from enum import Enum
from urllib.parse import quote_plus
import datetime
import time
import aiohttp
import asyncio
settings = {"POLL_DURATION" : 60}
class RPS(Enum):
rock = "\N{MOYAI}"
paper = "\N{PAGE FACING UP}"
scissors = "\N{BLACK SCISSORS}"
class RPSParser:
def __init__(self, argument):
argument = argument.lower()
if argument == "rock":
self.choice = RPS.rock
elif argument == "paper":
self.choice = RPS.paper
elif argument == "scissors":
self.choice = RPS.scissors
else:
raise
class General:
"""General commands."""
def __init__(self, bot):
self.bot = bot
self.stopwatches = {}
self.ball = ["As I see it, yes", "It is certain", "It is decidedly so", "Most likely", "Outlook good",
"Signs point to yes", "Without a doubt", "Yes", "Yes – definitely", "You may rely on it", "Reply hazy, try again",
"Ask again later", "Better not tell you now", "Cannot predict now", "Concentrate and ask again",
"Don't count on it", "My reply is no", "My sources say no", "Outlook not so good", "Very doubtful"]
self.poll_sessions = []
@commands.command(hidden=True)
async def ping(self):
"""Pong."""
await self.bot.say("Pong.")
@commands.command()
async def choose(self, *choices):
"""Chooses between multiple choices.
To denote multiple choices, you should use double quotes.
"""
choices = [escape_mass_mentions(c) for c in choices]
if len(choices) < 2:
await self.bot.say('Not enough choices to pick from.')
else:
await self.bot.say(choice(choices))
@commands.command(pass_context=True)
async def roll(self, ctx, number : int = 100):
"""Rolls random number (between 1 and user choice)
Defaults to 100.
"""
author = ctx.message.author
if number > 1:
n = randint(1, number)
await self.bot.say("{} :game_die: {} :game_die:".format(author.mention, n))
else:
await self.bot.say("{} Maybe higher than 1? ;P".format(author.mention))
@commands.command(pass_context=True)
async def flip(self, ctx, user : discord.Member=None):
"""Flips a coin... or a user.
Defaults to coin.
"""
if user != None:
msg = ""
if user.id == self.bot.user.id:
user = ctx.message.author
msg = "Nice try. You think this is funny? How about *this* instead:\n\n"
char = "abcdefghijklmnopqrstuvwxyz"
tran = "ɐqɔpǝɟƃɥᴉɾʞlɯuodbɹsʇnʌʍxʎz"
table = str.maketrans(char, tran)
name = user.display_name.translate(table)
char = char.upper()
tran = "∀qƆpƎℲפHIſʞ˥WNOԀQᴚS┴∩ΛMX⅄Z"
table = str.maketrans(char, tran)
name = name.translate(table)
await self.bot.say(msg + "(╯°□°)╯︵ " + name[::-1])
else:
await self.bot.say("*flips a coin and... " + choice(["HEADS!*", "TAILS!*"]))
@commands.command(pass_context=True)
async def rps(self, ctx, your_choice : RPSParser):
"""Play rock paper scissors"""
author = ctx.message.author
player_choice = your_choice.choice
red_choice = choice((RPS.rock, RPS.paper, RPS.scissors))
cond = {
(RPS.rock, RPS.paper) : False,
(RPS.rock, RPS.scissors) : True,
(RPS.paper, RPS.rock) : True,
(RPS.paper, RPS.scissors) : False,
(RPS.scissors, RPS.rock) : False,
(RPS.scissors, RPS.paper) : True
}
if red_choice == player_choice:
outcome = None # Tie
else:
outcome = cond[(player_choice, red_choice)]
if outcome is True:
await self.bot.say("{} You win {}!"
"".format(red_choice.value, author.mention))
elif outcome is False:
await self.bot.say("{} You lose {}!"
"".format(red_choice.value, author.mention))
else:
await self.bot.say("{} We're square {}!"
"".format(red_choice.value, author.mention))
@commands.command(name="8", aliases=["8ball"])
async def _8ball(self, *, question : str):
"""Ask 8 ball a question
Question must end with a question mark.
"""
if question.endswith("?") and question != "?":
await self.bot.say("`" + choice(self.ball) + "`")
else:
await self.bot.say("That doesn't look like a question.")
@commands.command(aliases=["sw"], pass_context=True)
async def stopwatch(self, ctx):
"""Starts/stops stopwatch"""
author = ctx.message.author
if not author.id in self.stopwatches:
self.stopwatches[author.id] = int(time.perf_counter())
await self.bot.say(author.mention + " Stopwatch started!")
else:
tmp = abs(self.stopwatches[author.id] - int(time.perf_counter()))
tmp = str(datetime.timedelta(seconds=tmp))
await self.bot.say(author.mention + " Stopwatch stopped! Time: **" + tmp + "**")
self.stopwatches.pop(author.id, None)
@commands.command()
async def lmgtfy(self, *, search_terms : str):
"""Creates a lmgtfy link"""
search_terms = escape_mass_mentions(search_terms.replace(" ", "+"))
await self.bot.say("https://lmgtfy.com/?q={}".format(search_terms))
@commands.command(no_pm=True, hidden=True)
async def hug(self, user : discord.Member, intensity : int=1):
"""Because everyone likes hugs
Up to 10 intensity levels."""
name = italics(user.display_name)
if intensity <= 0:
msg = "(っ˘̩╭╮˘̩)っ" + name
elif intensity <= 3:
msg = "(っ´▽`)っ" + name
elif intensity <= 6:
msg = "╰(*´︶`*)╯" + name
elif intensity <= 9:
msg = "(つ≧▽≦)つ" + name
elif intensity >= 10:
msg = "(づ ̄ ³ ̄)づ{} ⊂(´・ω・`⊂)".format(name)
await self.bot.say(msg)
@commands.command(pass_context=True, no_pm=True)
async def userinfo(self, ctx, *, user: discord.Member=None):
"""Shows users's informations"""
author = ctx.message.author
server = ctx.message.server
if not user:
user = author
roles = [x.name for x in user.roles if x.name != "@everyone"]
joined_at = self.fetch_joined_at(user, server)
since_created = (ctx.message.timestamp - user.created_at).days
since_joined = (ctx.message.timestamp - joined_at).days
user_joined = joined_at.strftime("%d %b %Y %H:%M")
user_created = user.created_at.strftime("%d %b %Y %H:%M")
member_number = sorted(server.members,
key=lambda m: m.joined_at).index(user) + 1
created_on = "{}\n({} days ago)".format(user_created, since_created)
joined_on = "{}\n({} days ago)".format(user_joined, since_joined)
game = "Chilling in {} status".format(user.status)
if user.game is None:
pass
elif user.game.url is None:
game = "Playing {}".format(user.game)
else:
game = "Streaming: [{}]({})".format(user.game, user.game.url)
if roles:
roles = sorted(roles, key=[x.name for x in server.role_hierarchy
if x.name != "@everyone"].index)
roles = ", ".join(roles)
else:
roles = "None"
data = discord.Embed(description=game, colour=user.colour)
data.add_field(name="Joined Discord on", value=created_on)
data.add_field(name="Joined this server on", value=joined_on)
data.add_field(name="Roles", value=roles, inline=False)
data.set_footer(text="Member #{} | User ID:{}"
"".format(member_number, user.id))
name = str(user)
name = " ~ ".join((name, user.nick)) if user.nick else name
if user.avatar_url:
data.set_author(name=name, url=user.avatar_url)
data.set_thumbnail(url=user.avatar_url)
else:
data.set_author(name=name)
try:
await self.bot.say(embed=data)
except discord.HTTPException:
await self.bot.say("I need the `Embed links` permission "
"to send this")
@commands.command(pass_context=True, no_pm=True)
async def serverinfo(self, ctx):
"""Shows server's informations"""
server = ctx.message.server
online = len([m.status for m in server.members
if m.status == discord.Status.online or
m.status == discord.Status.idle])
total_users = len(server.members)
text_channels = len([x for x in server.channels
if x.type == discord.ChannelType.text])
voice_channels = len(server.channels) - text_channels
passed = (ctx.message.timestamp - server.created_at).days
created_at = ("Since {}. That's over {} days ago!"
"".format(server.created_at.strftime("%d %b %Y %H:%M"),
passed))
colour = ''.join([choice('0123456789ABCDEF') for x in range(6)])
colour = int(colour, 16)
data = discord.Embed(
description=created_at,
colour=discord.Colour(value=colour))
data.add_field(name="Region", value=str(server.region))
data.add_field(name="Users", value="{}/{}".format(online, total_users))
data.add_field(name="Text Channels", value=text_channels)
data.add_field(name="Voice Channels", value=voice_channels)
data.add_field(name="Roles", value=len(server.roles))
data.add_field(name="Owner", value=str(server.owner))
data.set_footer(text="Server ID: " + server.id)
if server.icon_url:
data.set_author(name=server.name, url=server.icon_url)
data.set_thumbnail(url=server.icon_url)
else:
data.set_author(name=server.name)
try:
await self.bot.say(embed=data)
except discord.HTTPException:
await self.bot.say("I need the `Embed links` permission "
"to send this")
@commands.command()
async def urban(self, *, search_terms : str, definition_number : int=1):
"""Urban Dictionary search
Definition number must be between 1 and 10"""
def encode(s):
return quote_plus(s, encoding='utf-8', errors='replace')
# definition_number is just there to show up in the help
# all this mess is to avoid forcing double quotes on the user
search_terms = search_terms.split(" ")
try:
if len(search_terms) > 1:
pos = int(search_terms[-1]) - 1
search_terms = search_terms[:-1]
else:
pos = 0
if pos not in range(0, 11): # API only provides the
pos = 0 # top 10 definitions
except ValueError:
pos = 0
search_terms = "+".join([encode(s) for s in search_terms])
url = "http://api.urbandictionary.com/v0/define?term=" + search_terms
try:
async with aiohttp.get(url) as r:
result = await r.json()
if result["list"]:
definition = result['list'][pos]['definition']
example = result['list'][pos]['example']
defs = len(result['list'])
msg = ("**Definition #{} out of {}:\n**{}\n\n"
"**Example:\n**{}".format(pos+1, defs, definition,
example))
msg = pagify(msg, ["\n"])
for page in msg:
await self.bot.say(page)
else:
await self.bot.say("Your search terms gave no results.")
except IndexError:
await self.bot.say("There is no definition #{}".format(pos+1))
except:
await self.bot.say("Error.")
@commands.command(pass_context=True, no_pm=True)
async def poll(self, ctx, *text):
"""Starts/stops a poll
Usage example:
poll Is this a poll?;Yes;No;Maybe
poll stop"""
message = ctx.message
if len(text) == 1:
if text[0].lower() == "stop":
await self.endpoll(message)
return
if not self.getPollByChannel(message):
check = " ".join(text).lower()
if "@everyone" in check or "@here" in check:
await self.bot.say("Nice try.")
return
p = NewPoll(message, " ".join(text), self)
if p.valid:
self.poll_sessions.append(p)
await p.start()
else:
await self.bot.say("poll question;option1;option2 (...)")
else:
await self.bot.say("A poll is already ongoing in this channel.")
async def endpoll(self, message):
if self.getPollByChannel(message):
p = self.getPollByChannel(message)
if p.author == message.author.id: # or isMemberAdmin(message)
await self.getPollByChannel(message).endPoll()
else:
await self.bot.say("Only admins and the author can stop the poll.")
else:
await self.bot.say("There's no poll ongoing in this channel.")
def getPollByChannel(self, message):
for poll in self.poll_sessions:
if poll.channel == message.channel:
return poll
return False
async def check_poll_votes(self, message):
if message.author.id != self.bot.user.id:
if self.getPollByChannel(message):
self.getPollByChannel(message).checkAnswer(message)
def fetch_joined_at(self, user, server):
"""Just a special case for someone special :^)"""
if user.id == "96130341705637888" and server.id == "133049272517001216":
return datetime.datetime(2016, 1, 10, 6, 8, 4, 443000)
else:
return user.joined_at
class NewPoll():
def __init__(self, message, text, main):
self.channel = message.channel
self.author = message.author.id
self.client = main.bot
self.poll_sessions = main.poll_sessions
msg = [ans.strip() for ans in text.split(";")]
if len(msg) < 2: # Needs at least one question and 2 choices
self.valid = False
return None
else:
self.valid = True
self.already_voted = []
self.question = msg[0]
msg.remove(self.question)
self.answers = {}
i = 1
for answer in msg: # {id : {answer, votes}}
self.answers[i] = {"ANSWER" : answer, "VOTES" : 0}
i += 1
async def start(self):
msg = "**POLL STARTED!**\n\n{}\n\n".format(self.question)
for id, data in self.answers.items():
msg += "{}. *{}*\n".format(id, data["ANSWER"])
msg += "\nType the number to vote!"
await self.client.send_message(self.channel, msg)
await asyncio.sleep(settings["POLL_DURATION"])
if self.valid:
await self.endPoll()
async def endPoll(self):
self.valid = False
msg = "**POLL ENDED!**\n\n{}\n\n".format(self.question)
for data in self.answers.values():
msg += "*{}* - {} votes\n".format(data["ANSWER"], str(data["VOTES"]))
await self.client.send_message(self.channel, msg)
self.poll_sessions.remove(self)
def checkAnswer(self, message):
try:
i = int(message.content)
if i in self.answers.keys():
if message.author.id not in self.already_voted:
data = self.answers[i]
data["VOTES"] += 1
self.answers[i] = data
self.already_voted.append(message.author.id)
except ValueError:
pass
def setup(bot):
n = General(bot)
bot.add_listener(n.check_poll_votes, "on_message")
bot.add_cog(n)
| jicruz/heroku-bot | cogs/general.py | Python | gpl-3.0 | 17,226 | [
30522,
12324,
12532,
4103,
2013,
12532,
4103,
1012,
4654,
2102,
12324,
10954,
2013,
1012,
21183,
12146,
1012,
11834,
1035,
4289,
3436,
12324,
4019,
1035,
3742,
1035,
9704,
1010,
19408,
1010,
6643,
5856,
12031,
2013,
6721,
12324,
14566,
18447,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Wiper
Wiper allows you to recursively delete specified folders.
Say that you want to delete all 'obj' folders in a certain root folder.
Type in 'obj' as the folder name to delete and select the root folder.
Perform a dry run to list all folders that will be affected.
Hit the delete button and you're done!
| icerocker/Wiper | README.md | Markdown | mit | 310 | [
30522,
1001,
13387,
2099,
13387,
2099,
4473,
2017,
2000,
28667,
9236,
14547,
3972,
12870,
9675,
19622,
2015,
1012,
2360,
2008,
2017,
2215,
2000,
3972,
12870,
2035,
1005,
27885,
3501,
1005,
19622,
2015,
1999,
1037,
3056,
7117,
19622,
1012,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
</main>
<div class="footer__break"></div>
<footer id="footer" class="footer" role="contentinfo">
<div class="content__wrapper">
<?php
get_template_part( 'template-parts/footer/newsletter' );
get_template_part( 'template-parts/footer/social' );
?>
</div>
<?php get_template_part( 'template-parts/footer/copyright' ); ?>
</footer>
<?php get_template_part( 'template-parts/footer/bottom' ); ?>
<?php wp_footer(); ?>
</body>
</html> | Fulcrum-Creatives/wordup | footer.php | PHP | gpl-2.0 | 454 | [
30522,
1026,
1013,
2364,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
3329,
2121,
1035,
1035,
3338,
1000,
1028,
1026,
1013,
4487,
2615,
1028,
1026,
3329,
2121,
8909,
1027,
1000,
3329,
2121,
1000,
2465,
1027,
1000,
3329,
2121,
1000,
2535,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2 generiert
// Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// �nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2014.02.19 um 02:35:56 PM CET
//
package org.onvif.ver10.media.wsdl;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>
* Java-Klasse f�r anonymous complex type.
*
* <p>
* Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Name" type="{http://www.onvif.org/ver10/schema}Name"/>
* <element name="Token" type="{http://www.onvif.org/ver10/schema}ReferenceToken" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "name", "token" })
@XmlRootElement(name = "CreateProfile")
public class CreateProfile {
@XmlElement(name = "Name", required = true)
protected String name;
@XmlElement(name = "Token")
protected String token;
/**
* Ruft den Wert der name-Eigenschaft ab.
*
* @return possible object is {@link String }
*
*/
public String getName() {
return name;
}
/**
* Legt den Wert der name-Eigenschaft fest.
*
* @param value
* allowed object is {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Ruft den Wert der token-Eigenschaft ab.
*
* @return possible object is {@link String }
*
*/
public String getToken() {
return token;
}
/**
* Legt den Wert der token-Eigenschaft fest.
*
* @param value
* allowed object is {@link String }
*
*/
public void setToken(String value) {
this.token = value;
}
}
| milg0/onvif-java-lib | src/org/onvif/ver10/media/wsdl/CreateProfile.java | Java | apache-2.0 | 2,297 | [
30522,
1013,
1013,
1013,
1013,
8289,
2063,
3058,
2072,
8814,
25547,
10210,
4315,
9262,
21246,
4294,
2005,
20950,
8031,
1006,
13118,
2497,
1007,
4431,
7375,
1010,
1058,
2475,
1012,
1016,
1012,
1019,
1011,
1016,
4962,
16252,
2102,
1013,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html dir="ltr" lang="ru">
<head>
<title>Содержание - Rubinius</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta content='ru' http-equiv='content-language'>
<meta content='Rubinius is an implementation of the Ruby programming language. The Rubinius bytecode virtual machine is written in C++. The bytecode compiler is written in pure Ruby. The vast majority of the core library is also written in Ruby, with some supporting primitives that interact with the VM directly.' name='description'>
<link href='/' rel='home'>
<link href='/' rel='start'>
<link href='/doc/ru/what-is-rubinius' rel='next' title='Что такое Rubinius?'>
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script><![endif]-->
<script src="/javascripts/jquery-1.3.2.js"></script>
<script src="/javascripts/paging_keys.js"></script>
<script src="/javascripts/application.js"></script>
<style>article, aside, dialog, figure, footer, header, hgroup, menu, nav, section { display: block; }</style>
<link href="/stylesheets/blueprint/screen.css" media="screen" rel="stylesheet" />
<link href="/stylesheets/application.css" media="screen" rel="stylesheet" />
<link href="/stylesheets/blueprint/print.css" media="print" rel="stylesheet" />
<!--[if IE]><link href="/stylesheets/blueprint/ie.css" media="screen" rel="stylesheet" type="text/css" /><![endif]-->
<!--[if IE]><link href="/stylesheets/ie.css" media="screen" rel="stylesheet" type="text/css" /><![endif]-->
<link href="/stylesheets/pygments.css" media="screen" rel="stylesheet" />
</head>
<body>
<div class='container'>
<div class='span-21 doc_menu'>
<header>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a id="blog" href="/blog">Blog</a></li>
<li><a id="documentation" href="/doc/en">Documentation</a></li>
<li><a href="/projects">Projects</a></li>
<li><a href="/roadmap">Roadmap</a></li>
<li><a href="/releases">Releases</a></li>
</ul>
</nav>
</header>
</div>
<div class='span-3 last'>
<div id='version'>
<a href="/releases/1.2.4">1.2.4</a>
</div>
</div>
</div>
<div class="container languages">
<nav>
<span class="label">Языки:</span>
<ul>
<li><a href="/doc/de/index.html"
>de</a></li>
<li><a href="/doc/en/index.html"
>en</a></li>
<li><a href="/doc/es/index.html"
>es</a></li>
<li><a href="/doc/fr/index.html"
>fr</a></li>
<li><a href="/doc/ja/index.html"
>ja</a></li>
<li><a href="/doc/pl/index.html"
>pl</a></li>
<li><a href="/doc/pt-br/index.html"
>pt-br</a></li>
<li><a href="/doc/ru/index.html"
class="current"
>ru</a></li>
</ul>
</nav>
</div>
<div class="container doc_page_nav">
</div>
<div class="container documentation">
<h2>Содержание</h2>
<ol>
<li><a href="/doc/ru/what-is-rubinius/">Что такое Rubinius?</a></li>
<li><a href="/doc/ru/getting-started/">Для начала…</a>
<ol>
<li><a href="/doc/ru/getting-started/requirements/">Минимальные требования</a></li>
<li><a href="/doc/ru/getting-started/building/">Сборка</a></li>
<li><a href="/doc/ru/getting-started/running-rubinius/">Запуск Rubinius</a></li>
<li><a href="/doc/ru/getting-started/troubleshooting/">Решение проблем</a></li>
</ol>
</li>
<li><a href="/doc/ru/contributing/">Участие в проекте</a>
<ol>
<li><a href="/doc/ru/contributing/communication/">Общение</a></li>
<li><a href="/doc/ru/contributing/style-guide">Стиль программирования</a></li>
</ol>
</li>
<li><a href="/doc/ru/ruby/">Ruby</a>
<ol>
<li><a href="/doc/ru/ruby/scripts/">Скрипты</a></li>
<li><a href="/doc/ru/ruby/methods/">Методы</a></li>
<li><a href="/doc/ru/ruby/constants/">Константы</a></li>
<li><a href="/doc/ru/ruby/classes-and-modules/">Классы и модули</a></li>
<li><a href="/doc/ru/ruby/blocks-and-procs/">Замыкания</a></li>
<li><a href="/doc/ru/ruby/local-variables/">Локальные переменные</a></li>
<li><a href="/doc/ru/ruby/instance-variables/">Переменные экземпляра</a></li>
<li><a href="/doc/ru/ruby/class-variables/">Переменные класса</a></li>
<li><a href="/doc/ru/ruby/global-variables/">Глобальные переменные</a></li>
</ol>
</li>
<li><a href="/doc/ru/specs/">Спецификации</a>
<ol>
<li><a href="/doc/ru/specs/rubyspec/">RubySpec</a></li>
<li><a href="/doc/ru/specs/compiler/">Спецификации компилятора</a></li>
</ol>
</li>
<li><a href="/doc/ru/build-system/">Система сборки</a></li>
<li><a href="/doc/ru/bootstrapping/">Начальная загрузка</a></li>
<li><a href="/doc/ru/virtual-machine/">Виртуальная машина</a>
<ol>
<li><a href="/doc/ru/virtual-machine/instructions/">Инструкции</a></li>
<li><a href="/doc/ru/virtual-machine/custom-dispatch-logic/">Custom Dispatch Logic</a></li>
</ol>
</li>
<li><a href="/doc/ru/bytecode-compiler/">Байткод-компилятор</a>
<ol>
<li><a href="/doc/ru/bytecode-compiler/parser/">Парсер</a></li>
<li><a href="/doc/ru/bytecode-compiler/ast/">AST</a></li>
<li><a href="/doc/ru/bytecode-compiler/generator/">Генератор</a></li>
<li><a href="/doc/ru/bytecode-compiler/encoder/">Кодировщик</a></li>
<li><a href="/doc/ru/bytecode-compiler/packager/">Упаковщик</a></li>
<li><a href="/doc/ru/bytecode-compiler/writer/">Запись</a></li>
<li>Принтеры</li>
<li><a href="/doc/ru/bytecode-compiler/transformations/">Преобразования</a></li>
<li><a href="/doc/en/bytecode-compiler/customization/">Настройка конвейера</a></li>
</ol>
</li>
<li><a href="/doc/ru/jit/">JIT Компилятор</a></li>
<li><a href="/doc/ru/garbage-collector/">Сборщик мусора</a>
<ol>
<li><a href="/doc/ru/garbage-collector/nursery/">Nursery</a></li>
<li><a href="/doc/ru/garbage-collector/young-generation/">Молодое поколение</a></li>
<li><a href="/doc/ru/garbage-collector/mature-generation/">Старое поколение</a></li>
<li><a href="/doc/ru/garbage-collector/large-objects/">Большие объекты</a></li>
</ol>
</li>
<li><a href="/doc/ru/systems/">Подсистемы</a>
<ol>
<li><a href="/doc/ru/systems/primitives/">Примитивы</a></li>
<li><a href="/doc/ru/systems/ffi/">FFI</a></li>
<li><a href="/doc/ru/systems/concurrency/">Параллелизм</a></li>
<li><a href="/doc/ru/systems/io/">Ввод/вывод</a></li>
<li><a href="/doc/ru/systems/c-api/">C-API</a></li>
</ol>
</li>
<li><a href="/doc/ru/tools/">Инструменты</a>
<ol>
<li><a href="/doc/ru/tools/debugger/">Отладчик</a></li>
<li><a href="/doc/ru/tools/profiler/">Профайлер</a></li>
<li><a href="/doc/ru/tools/memory-analysis/">Анализатор памяти</a></li>
</ol>
</li>
<li><a href="/doc/ru/how-to/">How-To</a>
<ol>
<li><a href="/doc/ru/how-to/write-a-ticket/">Создание тикета</a></li>
<li><a href="/doc/ru/how-to/write-a-ruby-spec/">Написание Ruby спецификации</a></li>
<li><a href="/doc/ru/how-to/fix-a-failing-spec/">Исправление неработающей спецификации</a></li>
<li><a href="/doc/ru/how-to/write-benchmarks/">Написание бенчмарков</a></li>
<li><a href="/doc/ru/how-to/write-a-blog-post/">Написание сообщения в блог</a></li>
<li><a href="/doc/ru/how-to/write-documentation/">Написание документации</a></li>
<li><a href="/doc/ru/how-to/translate-documentation/">Перевод документации</a></li>
</ol>
</li>
<li><a href="/doc/ru/appendix-a-glossary/">Приложение A - Глоссарий</a></li>
<li><a href="/doc/ru/appendix-b-reading-list/">Приложение B - Список литературы</a></li>
<li><a href="/doc/ru/index-of-terms/">Список терминов</a></li>
</ol>
</div>
<div class="container doc_page_nav">
</div>
<div class="container">
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'rubinius';
var disqus_identifier = '/doc/ru/index.html';
var disqus_url = 'http://rubini.us/doc/ru/index.html';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
<footer>
<div class='container'>
<nav>
<ul>
<li><a rel="external" href="http://twitter.com/rubinius">Follow Rubinius on Twitter</a></li>
<li><a rel="external" href="http://github.com/rubinius/rubinius">Fork Rubinius on github</a></li>
<li><a rel="external" href="http://engineyard.com">An Engine Yard project</a></li>
</ul>
</nav>
</div>
</footer>
<script>
var _gaq=[['_setAccount','UA-12328521-1'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
</body>
</html>
| PragTob/rubinius | web/_site/doc/ru/index.html | HTML | bsd-3-clause | 10,336 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
16101,
1027,
1000,
8318,
2099,
1000,
30524,
15549,
2615,
1027,
1000,
1060,
1011,
25423,
1011,
11892,
1000,
4180,
1027,
1000,
29464,
1027,
3341,
1010,
18546,
1027,
1015,
1000,
1028,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#pragma once
class cosmos;
#include "game/transcendental/step_declaration.h"
class position_copying_system {
public:
void update_transforms(const logic_step step);
}; | DaTa-/Hypersomnia | src/game/systems_stateless/position_copying_system.h | C | agpl-3.0 | 169 | [
30522,
1001,
10975,
8490,
2863,
2320,
2465,
21182,
1025,
1001,
2421,
1000,
2208,
1013,
9099,
23865,
21050,
1013,
3357,
1035,
8170,
1012,
1044,
1000,
2465,
2597,
1035,
24731,
1035,
2291,
1063,
2270,
1024,
11675,
10651,
1035,
21743,
1006,
953... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# 发布微信小游戏
1. 在发布界面中,配置相关的内容,点击 Build 一键生成小游戏工程目录

其中远程资源地址为 Assets 资源目录在资源服务器上的 Url 地址。默认指向发布后的 Assets 目录所在地址。
2. 默认会在 build/wechat 目录下生成 DevProject 和 PublishProject 两个目录
PublishProject 为发布正式版本的工程目录;DevProject 目录为开发版本的工程目录。以下以 DevProject 目录作重点说明:
* Assets 目录:游戏所有资源目录,需要完整上传到资源服务器上。目录下有个 assets.md5 文件记录所有资源对应的 md5,用于资源版本控制。
* Code 目录:小游戏工程目录,包含小游戏环境的配置文件 game.json 和 project.config.json
* dislist.dis 文件:小游戏版本及其它配置文件。游戏启动时会先取该文件,对比版本号及其它配置,若版本号不一致,需要下载 Assets 目录下的 assets.md5 文件取得最新资源的 md5 信息。
3. 在[微信公众平台](https://developers.weixin.qq.com/minigame/dev/devtools/download.html)上下载微信开发者工具
创建小游戏工程,工程目录为上面的 Code 目录,自行修改 project.config.json 中的 appid 等配置
| qiciengine/qiciengine-documentation | zh/manual/Wechat/Publish.md | Markdown | mit | 1,325 | [
30522,
1001,
30524,
1918,
100,
999,
1031,
1033,
1006,
4871,
1013,
10172,
1012,
1052,
3070,
1007,
100,
1746,
100,
100,
100,
100,
1802,
100,
100,
7045,
100,
100,
1918,
100,
100,
100,
100,
100,
100,
100,
1742,
1916,
24471,
2140,
1802,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* dmfs - http://dmfs.org/
*
* Copyright (C) 2012 Marten Gajda <marten@dmfs.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
package org.dmfs.xmlserializer;
import java.io.IOException;
import java.io.Writer;
/**
* An abstract XML node.
*
* @author Marten Gajda <marten@dmfs.org>
*/
public abstract class XmlAbstractNode
{
/**
* State for new nodes.
*/
final static int STATE_NEW = 0;
/**
* State indicating the node has been opened and the start tag has been opened.
*/
final static int STATE_START_TAG_OPEN = 1;
/**
* State indication the node has been opened and the start tag has been closed, but the end tag is not written yet.
*/
final static int STATE_START_TAG_CLOSED = 2;
/**
* State indication the node has been closed (i.e. the end tag has been written).
*/
final static int STATE_CLOSED = 3;
/**
* The state of a node, initialized with {@link STATE_NEW}.
*/
int state = STATE_NEW;
/**
* The depth at which this node is located in the XML tree. Until this node has been added to a tree it is considered to be the root element.
*/
private int mDepth = 0;
/**
* Set the depth of this node (i.e. at which level it is located in the XML node tree).
*
* @param depth
* The depth.
*/
void setDepth(int depth)
{
mDepth = depth;
}
/**
* Get the depth of this node (i.e. at which level it is located in the XML node tree).
*
* @return The depth.
*/
final int getDepth()
{
return mDepth;
}
/**
* Assign the {@link XmlNamespaceRegistry} that belongs to this XML tree.
*
* @param namespaceRegistry
* The {@link XmlNamespaceRegistry} of this XMl tree.
* @throws InvalidValueException
*/
abstract void setNamespaceRegistry(XmlNamespaceRegistry namespaceRegistry) throws InvalidValueException;
/**
* Open this node for writing to a {@link Writer}
*
* @param out
* The {@link Writer} to write to.
* @throws IOException
* @throws InvalidStateException
* @throws InvalidValueException
*/
abstract void open(Writer out) throws IOException, InvalidStateException, InvalidValueException;
/**
* Close this node, flushing out all unwritten content.
*
* @throws IOException
* @throws InvalidStateException
* @throws InvalidValueException
*/
abstract void close() throws IOException, InvalidStateException, InvalidValueException;
}
| dmfs/xml-serializer | src/org/dmfs/xmlserializer/XmlAbstractNode.java | Java | gpl-3.0 | 3,072 | [
30522,
1013,
1008,
1008,
1040,
2213,
10343,
1011,
8299,
1024,
1013,
1013,
1040,
2213,
10343,
1012,
8917,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2262,
20481,
2368,
11721,
3501,
2850,
1026,
20481,
2368,
1030,
1040,
2213,
10343,
30524,
3089... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hdfs.server.datanode;
import static org.apache.hadoop.test.MetricsAsserts.assertCounter;
import static org.apache.hadoop.test.MetricsAsserts.getMetrics;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
import java.io.File;
import java.util.ArrayList;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.impl.Log4JLogger;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.DFSTestUtil;
import org.apache.hadoop.hdfs.HdfsConfiguration;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor;
import org.apache.hadoop.hdfs.server.blockmanagement.DatanodeManager;
import org.apache.log4j.Level;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* Test reporting of DN volume failure counts and metrics.
*/
public class TestDataNodeVolumeFailureReporting {
private static final Log LOG = LogFactory.getLog(TestDataNodeVolumeFailureReporting.class);
{
((Log4JLogger)TestDataNodeVolumeFailureReporting.LOG).getLogger().setLevel(Level.ALL);
}
private FileSystem fs;
private MiniDFSCluster cluster;
private Configuration conf;
private String dataDir;
// Sleep at least 3 seconds (a 1s heartbeat plus padding) to allow
// for heartbeats to propagate from the datanodes to the namenode.
final int WAIT_FOR_HEARTBEATS = 3000;
// Wait at least (2 * re-check + 10 * heartbeat) seconds for
// a datanode to be considered dead by the namenode.
final int WAIT_FOR_DEATH = 15000;
@Before
public void setUp() throws Exception {
conf = new HdfsConfiguration();
conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, 512L);
/*
* Lower the DN heartbeat, DF rate, and recheck interval to one second
* so state about failures and datanode death propagates faster.
*/
conf.setInt(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1);
conf.setInt(DFSConfigKeys.DFS_DF_INTERVAL_KEY, 1000);
conf.setInt(DFSConfigKeys.DFS_NAMENODE_HEARTBEAT_RECHECK_INTERVAL_KEY, 1000);
// Allow a single volume failure (there are two volumes)
conf.setInt(DFSConfigKeys.DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY, 1);
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
cluster.waitActive();
fs = cluster.getFileSystem();
dataDir = cluster.getDataDirectory();
}
@After
public void tearDown() throws Exception {
for (int i = 0; i < 3; i++) {
FileUtil.setExecutable(new File(dataDir, "data"+(2*i+1)), true);
FileUtil.setExecutable(new File(dataDir, "data"+(2*i+2)), true);
}
cluster.shutdown();
}
/**
* Test that individual volume failures do not cause DNs to fail, that
* all volumes failed on a single datanode do cause it to fail, and
* that the capacities and liveliness is adjusted correctly in the NN.
*/
@Test
public void testSuccessiveVolumeFailures() throws Exception {
assumeTrue(!System.getProperty("os.name").startsWith("Windows"));
// Bring up two more datanodes
cluster.startDataNodes(conf, 2, true, null, null);
cluster.waitActive();
/*
* Calculate the total capacity of all the datanodes. Sleep for
* three seconds to be sure the datanodes have had a chance to
* heartbeat their capacities.
*/
Thread.sleep(WAIT_FOR_HEARTBEATS);
final DatanodeManager dm = cluster.getNamesystem().getBlockManager(
).getDatanodeManager();
final long origCapacity = DFSTestUtil.getLiveDatanodeCapacity(dm);
long dnCapacity = DFSTestUtil.getDatanodeCapacity(dm, 0);
File dn1Vol1 = new File(dataDir, "data"+(2*0+1));
File dn2Vol1 = new File(dataDir, "data"+(2*1+1));
File dn3Vol1 = new File(dataDir, "data"+(2*2+1));
File dn3Vol2 = new File(dataDir, "data"+(2*2+2));
/*
* Make the 1st volume directories on the first two datanodes
* non-accessible. We don't make all three 1st volume directories
* readonly since that would cause the entire pipeline to
* fail. The client does not retry failed nodes even though
* perhaps they could succeed because just a single volume failed.
*/
assertTrue("Couldn't chmod local vol", FileUtil.setExecutable(dn1Vol1, false));
assertTrue("Couldn't chmod local vol", FileUtil.setExecutable(dn2Vol1, false));
/*
* Create file1 and wait for 3 replicas (ie all DNs can still
* store a block). Then assert that all DNs are up, despite the
* volume failures.
*/
Path file1 = new Path("/test1");
DFSTestUtil.createFile(fs, file1, 1024, (short)3, 1L);
DFSTestUtil.waitReplication(fs, file1, (short)3);
ArrayList<DataNode> dns = cluster.getDataNodes();
assertTrue("DN1 should be up", dns.get(0).isDatanodeUp());
assertTrue("DN2 should be up", dns.get(1).isDatanodeUp());
assertTrue("DN3 should be up", dns.get(2).isDatanodeUp());
/*
* The metrics should confirm the volume failures.
*/
assertCounter("VolumeFailures", 1L,
getMetrics(dns.get(0).getMetrics().name()));
assertCounter("VolumeFailures", 1L,
getMetrics(dns.get(1).getMetrics().name()));
assertCounter("VolumeFailures", 0L,
getMetrics(dns.get(2).getMetrics().name()));
// Ensure we wait a sufficient amount of time
assert (WAIT_FOR_HEARTBEATS * 10) > WAIT_FOR_DEATH;
// Eventually the NN should report two volume failures
DFSTestUtil.waitForDatanodeStatus(dm, 3, 0, 2,
origCapacity - (1*dnCapacity), WAIT_FOR_HEARTBEATS);
/*
* Now fail a volume on the third datanode. We should be able to get
* three replicas since we've already identified the other failures.
*/
assertTrue("Couldn't chmod local vol", FileUtil.setExecutable(dn3Vol1, false));
Path file2 = new Path("/test2");
DFSTestUtil.createFile(fs, file2, 1024, (short)3, 1L);
DFSTestUtil.waitReplication(fs, file2, (short)3);
assertTrue("DN3 should still be up", dns.get(2).isDatanodeUp());
assertCounter("VolumeFailures", 1L,
getMetrics(dns.get(2).getMetrics().name()));
ArrayList<DatanodeDescriptor> live = new ArrayList<DatanodeDescriptor>();
ArrayList<DatanodeDescriptor> dead = new ArrayList<DatanodeDescriptor>();
dm.fetchDatanodes(live, dead, false);
live.clear();
dead.clear();
dm.fetchDatanodes(live, dead, false);
assertEquals("DN3 should have 1 failed volume",
1, live.get(2).getVolumeFailures());
/*
* Once the datanodes have a chance to heartbeat their new capacity the
* total capacity should be down by three volumes (assuming the host
* did not grow or shrink the data volume while the test was running).
*/
dnCapacity = DFSTestUtil.getDatanodeCapacity(dm, 0);
DFSTestUtil.waitForDatanodeStatus(dm, 3, 0, 3,
origCapacity - (3*dnCapacity), WAIT_FOR_HEARTBEATS);
/*
* Now fail the 2nd volume on the 3rd datanode. All its volumes
* are now failed and so it should report two volume failures
* and that it's no longer up. Only wait for two replicas since
* we'll never get a third.
*/
assertTrue("Couldn't chmod local vol", FileUtil.setExecutable(dn3Vol2, false));
Path file3 = new Path("/test3");
DFSTestUtil.createFile(fs, file3, 1024, (short)3, 1L);
DFSTestUtil.waitReplication(fs, file3, (short)2);
// The DN should consider itself dead
DFSTestUtil.waitForDatanodeDeath(dns.get(2));
// And report two failed volumes
assertCounter("VolumeFailures", 2L,
getMetrics(dns.get(2).getMetrics().name()));
// The NN considers the DN dead
DFSTestUtil.waitForDatanodeStatus(dm, 2, 1, 2,
origCapacity - (4*dnCapacity), WAIT_FOR_HEARTBEATS);
/*
* The datanode never tries to restore the failed volume, even if
* it's subsequently repaired, but it should see this volume on
* restart, so file creation should be able to succeed after
* restoring the data directories and restarting the datanodes.
*/
assertTrue("Couldn't chmod local vol", FileUtil.setExecutable(dn1Vol1, true));
assertTrue("Couldn't chmod local vol", FileUtil.setExecutable(dn2Vol1, true));
assertTrue("Couldn't chmod local vol", FileUtil.setExecutable(dn3Vol1, true));
assertTrue("Couldn't chmod local vol", FileUtil.setExecutable(dn3Vol2, true));
cluster.restartDataNodes();
cluster.waitActive();
Path file4 = new Path("/test4");
DFSTestUtil.createFile(fs, file4, 1024, (short)3, 1L);
DFSTestUtil.waitReplication(fs, file4, (short)3);
/*
* Eventually the capacity should be restored to its original value,
* and that the volume failure count should be reported as zero by
* both the metrics and the NN.
*/
DFSTestUtil.waitForDatanodeStatus(dm, 3, 0, 0, origCapacity,
WAIT_FOR_HEARTBEATS);
}
/**
* Test that the NN re-learns of volume failures after restart.
*/
@Test
public void testVolFailureStatsPreservedOnNNRestart() throws Exception {
assumeTrue(!System.getProperty("os.name").startsWith("Windows"));
// Bring up two more datanodes that can tolerate 1 failure
cluster.startDataNodes(conf, 2, true, null, null);
cluster.waitActive();
final DatanodeManager dm = cluster.getNamesystem().getBlockManager(
).getDatanodeManager();
long origCapacity = DFSTestUtil.getLiveDatanodeCapacity(dm);
long dnCapacity = DFSTestUtil.getDatanodeCapacity(dm, 0);
// Fail the first volume on both datanodes (we have to keep the
// third healthy so one node in the pipeline will not fail).
File dn1Vol1 = new File(dataDir, "data"+(2*0+1));
File dn2Vol1 = new File(dataDir, "data"+(2*1+1));
assertTrue("Couldn't chmod local vol", FileUtil.setExecutable(dn1Vol1, false));
assertTrue("Couldn't chmod local vol", FileUtil.setExecutable(dn2Vol1, false));
Path file1 = new Path("/test1");
DFSTestUtil.createFile(fs, file1, 1024, (short)2, 1L);
DFSTestUtil.waitReplication(fs, file1, (short)2);
// The NN reports two volumes failures
DFSTestUtil.waitForDatanodeStatus(dm, 3, 0, 2,
origCapacity - (1*dnCapacity), WAIT_FOR_HEARTBEATS);
// After restarting the NN it still see the two failures
cluster.restartNameNode(0);
cluster.waitActive();
DFSTestUtil.waitForDatanodeStatus(dm, 3, 0, 2,
origCapacity - (1*dnCapacity), WAIT_FOR_HEARTBEATS);
}
}
| tseen/Federated-HDFS | tseenliu/FedHDFS-hadoop-src/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeVolumeFailureReporting.java | Java | apache-2.0 | 11,522 | [
30522,
1013,
1008,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
1008,
2030,
2062,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
1008,
5500,
2007,
2023,
2147,
2005,
3176,
2592,
1008,
4953,
9385,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef Podd_THaVDCPoint_h_
#define Podd_THaVDCPoint_h_
///////////////////////////////////////////////////////////////////////////////
// //
// THaVDCPoint //
// //
// A pair of one U and one V VDC cluster in a given VDC chamber //
// //
///////////////////////////////////////////////////////////////////////////////
#include "THaCluster.h"
#include "THaVDCCluster.h"
class THaVDCChamber;
class THaTrack;
class THaVDCPoint : public THaCluster {
public:
THaVDCPoint( THaVDCCluster* u_cl, THaVDCCluster* v_cl,
THaVDCChamber* chamber );
virtual ~THaVDCPoint() {}
void CalcDetCoords();
// Get and Set Functions
THaVDCCluster* GetUCluster() const { return fUClust; }
THaVDCCluster* GetVCluster() const { return fVClust; }
THaVDCChamber* GetChamber() const { return fChamber; }
THaVDCPoint* GetPartner() const { return fPartner; }
THaTrack* GetTrack() const { return fTrack; }
Double_t GetU() const;
Double_t GetV() const;
Double_t GetX() const { return fX; }
Double_t GetY() const { return fY; }
Double_t GetTheta() const { return fTheta; }
Double_t GetPhi() const { return fPhi; }
Int_t GetTrackIndex() const;
Double_t GetZU() const;
Double_t GetZV() const;
Double_t GetZ() const { return GetZU(); }
Bool_t HasPartner() const { return (fPartner != 0); }
void CalcChisquare(Double_t &chi2, Int_t &nhits) const;
void SetTrack( THaTrack* track);
void SetPartner( THaVDCPoint* partner) { fPartner = partner;}
void SetSlopes( Double_t mu, Double_t mv );
protected:
THaVDCCluster* fUClust; // Cluster in the U plane
THaVDCCluster* fVClust; // Cluster in the V plane
THaVDCChamber* fChamber; // Chamber of this cluster pair
THaTrack* fTrack; // Track that this point is associated with
THaVDCPoint* fPartner; // Point associated with this one in
// the other chamber
// Detector system coordinates derived from fUClust and fVClust
// at the U plane (z = GetZ()). X,Y in m; theta, phi in tan(angle)
Double_t fX; // X position of point in U wire plane
Double_t fY; // Y position of point in U wire plane
Double_t fTheta; // tan(angle between z-axis and track proj onto xz plane)
Double_t fPhi; // tan(angle between z-axis and track proj onto yz plane)
void Set( Double_t x, Double_t y, Double_t theta, Double_t phi )
{ fX = x; fY = y; fTheta = theta; fPhi = phi; }
private:
// Hide copy ctor and op=
THaVDCPoint( const THaVDCPoint& );
THaVDCPoint& operator=( const THaVDCPoint& );
ClassDef(THaVDCPoint,0) // Pair of one U and one V cluster in a VDC chamber
};
//-------------------- inlines ------------------------------------------------
inline
Double_t THaVDCPoint::GetU() const
{
// Return intercept of u cluster
return fUClust->GetIntercept();
}
//_____________________________________________________________________________
inline
Double_t THaVDCPoint::GetV() const
{
// Return intercept of v cluster
return fVClust->GetIntercept();
}
///////////////////////////////////////////////////////////////////////////////
#endif
| sly2j/analyzer | src/THaVDCPoint.h | C | gpl-2.0 | 3,527 | [
30522,
1001,
2065,
13629,
2546,
17491,
2094,
1035,
22794,
16872,
21906,
25785,
1035,
1044,
1035,
1001,
9375,
17491,
2094,
1035,
22794,
16872,
21906,
25785,
1035,
1044,
1035,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#pragma once
#include"agk.h"
#include "GF.h"
#include "World.h"
#include "Input.h"
#include "Item.h"
#include "Weapon.h"
#include "LUA/lua.hpp"
//#include "Script.h"
class Player
{
public:
Player(void);
~Player(void);
void begin(World* world);
void load(uString name);
void setupLuaFunctions();
void spawn(uString point);
void setPosition(float x, float y);
void update();
void updateWeapon(ProjectileGroup* projGroup);
void activation();
bool canTravel();
void setJustLoaded(bool justLoaded);
void setVisible(int visible);
void addItem(Item item);
void setCurrentWeaponByName(uString name);
float getX();
float getY();
int getInvAmount();
Item getItemFromSlot(int slot);
private:
int img;
int SID;
int activateText;
int activateSprite;
float x;
float y;
float weapOffsetX;
float weapOffsetY;
float cameraX;
float cameraY;
int health;
float lastJump;
float speed;
float jumpHeight;
World* world;
float spriteScale;
bool checkOnGround();
bool justLoaded;
float lastTravel;
std::vector< Item >* inventory;
Weapon cWeapon;
struct Animation
{
int SID;
int imgID;
bool animated;
int FPS;
int start;
int end;
};
Animation anim[2];
//Arm arm;
};
| TheZoq2/JungleSeals | MedievalPlat/Player.h | C | gpl-2.0 | 1,229 | [
30522,
1001,
10975,
8490,
2863,
2320,
1001,
2421,
1000,
12943,
2243,
1012,
1044,
1000,
1001,
2421,
1000,
1043,
2546,
1012,
1044,
1000,
1001,
2421,
1000,
2088,
1012,
1044,
1000,
1001,
2421,
1000,
7953,
1012,
1044,
1000,
1001,
2421,
1000,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
module TestMax
using StreamStats
using Distributions
using Base.Test
# Max of uniform draws
for n in rand(1:1_000_000, 100)
xs = rand(n)
stat = StreamStats.Max()
for x in xs
update!(stat, x)
end
online_m = maximum(stat)
online_ms = state(stat)
online_n = nobs(stat)
batch_m = maximum(xs)
@test online_m == batch_m
@test online_n == n
end
end
| JuliaPackageMirrors/StreamStats.jl | test/max.jl | Julia | mit | 459 | [
30522,
11336,
3231,
17848,
2478,
9199,
29336,
2015,
2478,
20611,
2478,
2918,
1012,
3231,
1001,
4098,
1997,
6375,
9891,
2005,
1050,
1999,
14566,
1006,
1015,
1024,
1015,
1035,
2199,
1035,
2199,
1010,
2531,
1007,
1060,
2015,
1027,
14566,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
echo "holitas";
echo $_GET['url'];
?> | josuerangel/mark | php/index.php | PHP | mit | 46 | [
30522,
1026,
1029,
25718,
9052,
1000,
7570,
27606,
2015,
1000,
1025,
9052,
1002,
1035,
2131,
1031,
1005,
24471,
2140,
1005,
1033,
1025,
1029,
1028,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#ifndef SAL_HXX
#define SAL_HXX
#ifdef __GNUC__
# define __inner_checkReturn __attribute__((warn_unused_result))
#elif defined(_MSC_VER)
# define __inner_checkReturn __declspec("SAL_checkReturn")
#else
# define __inner_checkReturn
#endif
#define __checkReturn __inner_checkReturn
#define _In_
#define _In_opt_
#define _Out_
#define _Struct_size_bytes_(size)
#endif
| sdlBasic/sdlbrt | win32/mingw/i686-w64-mingw32/include/sal.h | C | lgpl-2.1 | 591 | [
30522,
1013,
1008,
1008,
1008,
2023,
5371,
2038,
2053,
9385,
4137,
1998,
2003,
2872,
1999,
1996,
2270,
5884,
1012,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
11861,
2860,
1011,
1059,
21084,
2448,
7292,
7427,
1012,
1008,
2053,
10943,
2100,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{
"name": "jquery.thumbs.js",
"url": "https://github.com/nfort/jquery.thumbs.js.git"
}
| bower/components | packages/jquery.thumbs.js | JavaScript | mit | 91 | [
30522,
1063,
1000,
2171,
1000,
1024,
1000,
1046,
4226,
2854,
1012,
16784,
1012,
1046,
2015,
1000,
1010,
1000,
24471,
2140,
1000,
1024,
1000,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
1050,
13028,
1013,
1046,
4226,
2854,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package ru.job4j.max;
/**
*Класс помогает узнать, какое из двух чисел больше.
*@author ifedorenko
*@since 14.08.2017
*@version 1
*/
public class Max {
/**
*Возвращает большее число из двух.
*@param first содержит первое число
*@param second содержит второе число
*@return Большее из двух
*/
public int max(int first, int second) {
return first > second ? first : second;
}
/**
*Возвращает большее число из трех.
*@param first содержит первое число
*@param second содержит второе число
*@param third содержит третье число
*@return Большее из трех
*/
public int max(int first, int second, int third) {
return max(first, max(second, third));
}
} | fr3anthe/ifedorenko | 1.1-Base/src/main/java/ru/job4j/max/Max.java | Java | apache-2.0 | 887 | [
30522,
7427,
21766,
1012,
3105,
2549,
3501,
1012,
4098,
1025,
1013,
1008,
1008,
1008,
1189,
29436,
10260,
29747,
29747,
1194,
14150,
29745,
14150,
29741,
10260,
15290,
22919,
1198,
29744,
19865,
22919,
23742,
1010,
1189,
10260,
23925,
14150,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package service
import (
"math"
"math/rand"
"time"
"github.com/rlister/let-me-in/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws"
"github.com/rlister/let-me-in/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request"
)
// DefaultRetryer implements basic retry logic using exponential backoff for
// most services. If you want to implement custom retry logic, implement the
// request.Retryer interface or create a structure type that composes this
// struct and override the specific methods. For example, to override only
// the MaxRetries method:
//
// type retryer struct {
// service.DefaultRetryer
// }
//
// // This implementation always has 100 max retries
// func (d retryer) MaxRetries() uint { return 100 }
type DefaultRetryer struct {
*Service
}
// MaxRetries returns the number of maximum returns the service will use to make
// an individual API request.
func (d DefaultRetryer) MaxRetries() uint {
if aws.IntValue(d.Service.Config.MaxRetries) < 0 {
return d.DefaultMaxRetries
}
return uint(aws.IntValue(d.Service.Config.MaxRetries))
}
var seededRand = rand.New(rand.NewSource(time.Now().UnixNano()))
// RetryRules returns the delay duration before retrying this request again
func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration {
delay := int(math.Pow(2, float64(r.RetryCount))) * (seededRand.Intn(30) + 30)
return time.Duration(delay) * time.Millisecond
}
// ShouldRetry returns if the request should be retried.
func (d DefaultRetryer) ShouldRetry(r *request.Request) bool {
if r.HTTPResponse.StatusCode >= 500 {
return true
}
return r.IsErrorRetryable()
}
| rlister/let-me-in | Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/default_retryer.go | GO | mit | 1,638 | [
30522,
7427,
2326,
12324,
1006,
1000,
8785,
1000,
1000,
8785,
1013,
14566,
1000,
1000,
2051,
1000,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
1054,
9863,
2121,
1013,
2292,
1011,
2033,
1011,
1999,
1013,
2643,
13699,
2015,
1013,
1035,
2573,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
$array = new SplDoublyLinkedList( );
$get = $array->offsetGet( 'fail' );
?>
| JSchwehn/php | testdata/fuzzdir/corpus/ext_spl_tests_SplDoublyLinkedList_offsetGet_param_string.php | PHP | bsd-3-clause | 85 | [
30522,
1026,
1029,
25718,
1002,
9140,
1027,
2047,
11867,
6392,
7140,
6321,
13767,
2098,
9863,
1006,
1007,
1025,
1002,
2131,
1027,
1002,
9140,
1011,
1028,
16396,
18150,
1006,
1005,
8246,
1005,
1007,
1025,
1029,
1028,
102,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
*
* $Id$
*/
package net.opengis.wfs20.validation;
import net.opengis.wfs20.AbstractTransactionActionType;
import net.opengis.wfs20.AllSomeType;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.util.FeatureMap;
/**
* A sample validator interface for {@link net.opengis.wfs20.TransactionType}.
* This doesn't really do anything, and it's not a real EMF artifact.
* It was generated by the org.eclipse.emf.examples.generator.validator plug-in to illustrate how EMF's code generator can be extended.
* This can be disabled with -vmargs -Dorg.eclipse.emf.examples.generator.validator=false.
*/
public interface TransactionTypeValidator {
boolean validate();
boolean validateGroup(FeatureMap value);
boolean validateAbstractTransactionActionGroup(FeatureMap value);
boolean validateAbstractTransactionAction(EList<AbstractTransactionActionType> value);
boolean validateLockId(String value);
boolean validateReleaseAction(AllSomeType value);
boolean validateSrsName(String value);
}
| geotools/geotools | modules/ogc/net.opengis.wfs/src/net/opengis/wfs20/validation/TransactionTypeValidator.java | Java | lgpl-2.1 | 1,029 | [
30522,
1013,
1008,
1008,
1008,
1008,
1002,
8909,
1002,
1008,
1013,
7427,
5658,
1012,
2330,
17701,
1012,
1059,
10343,
11387,
1012,
27354,
1025,
12324,
5658,
1012,
2330,
17701,
1012,
1059,
10343,
11387,
1012,
10061,
6494,
3619,
18908,
3258,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# AsylumJam2016
Projet VR sur mobile.
| RemiFusade2/AsylumJam2016 | README.md | Markdown | mit | 38 | [
30522,
1001,
11386,
3900,
2213,
11387,
16048,
4013,
15759,
27830,
7505,
4684,
1012,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.compiere.apps.search;
/*
* #%L
* de.metas.adempiere.adempiere.client
* %%
* Copyright (C) 2015 metas GmbH
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
import org.adempiere.db.DBConstants;
import org.adempiere.util.Check;
import org.compiere.model.MQuery;
import org.compiere.model.MQuery.Operator;
import org.compiere.util.DB;
import de.metas.adempiere.util.Permutation;
/**
*
* @author tsa
*
*/
public final class FindHelper
{
public static final String COLUMNNAME_Search = "Search";
public static void addStringRestriction(MQuery query, String columnName, String value, String infoName, boolean isIdentifier)
{
if (COLUMNNAME_Search.equalsIgnoreCase(columnName))
{
addStringRestriction_Search(query, columnName, value, infoName, isIdentifier);
return;
}
//
// Generic implementation
final String valueStr = prepareSearchString(value, false);
if (valueStr == null)
{
query.addRestriction("UPPER(" + columnName + ")", Operator.EQUAL, null, infoName, value);
}
else if (valueStr.indexOf('%') == -1)
{
String valueSQL = "UPPER(" + DB.TO_STRING(valueStr) + ")";
query.addRestriction("UPPER(" + columnName + ")", Operator.EQUAL, valueSQL, infoName, value);
}
else
{
query.addRestriction(columnName, Operator.LIKE_I, valueStr, infoName, value);
}
}
// metas-2009_0021_AP1_CR064
private static void addStringRestriction_Search(MQuery query, String columnName, String value, String infoName, boolean isIdentifier)
{
value = value.trim();
// metas: Permutationen ueber alle Search-Kombinationen
// z.B. 3 Tokens ergeben 3! Moeglichkeiten als Ergebnis.
if (value.contains(" "))
{
StringTokenizer st = new StringTokenizer(value, " ");
int tokens = st.countTokens();
String input[] = new String[tokens];
Permutation perm = new Permutation();
perm.setMaxIndex(tokens - 1);
for (int token = 0; token < tokens; token++)
{
input[token] = st.nextToken();
}
perm.permute(input, tokens - 1);
Iterator<String> itr = perm.getResult().iterator();
while (itr.hasNext())
{
value = ("%" + itr.next() + "%").replace(" ", "%");
query.addRestriction(COLUMNNAME_Search, Operator.LIKE_I, value, infoName, value, true);
}
}
else
{
if (!value.startsWith("%"))
value = "%" + value;
// metas-2009_0021_AP1_CR064: end
if (!value.endsWith("%"))
value += "%";
query.addRestriction(COLUMNNAME_Search, Operator.LIKE_I, value, infoName, value);
}
}
/**
* When dealing with String comparison ("LIKE") use this method instead of simply building the String.
*
* This method provides reliability when it comes to comparison behavior
*
* E.G. when searching for "123" it shall match "%123%" and when searching for "123%" it shall match exactly that and NOT "%123%".
*
* In other words, the user receives exactly what he asks for
*
* @param columnSQL
* @param value
* @param isIdentifier
* @param params
* @return
*/
public static String buildStringRestriction(String columnSQL, Object value, boolean isIdentifier, List<Object> params)
{
return buildStringRestriction(null, columnSQL, value, isIdentifier, params);
}
/**
* apply function to parameter cg: task: 02381
*
* @param criteriaFunction
* @param columnSQL
* @param value
* @param isIdentifier
* @param params
* @return
*/
public static String buildStringRestriction(String criteriaFunction, String columnSQL, Object value, boolean isIdentifier, List<Object> params)
{
final String valueStr = prepareSearchString(value, isIdentifier);
String whereClause = null;
if (Check.isEmpty(criteriaFunction, true))
{
whereClause = "UPPER(" + DBConstants.FUNC_unaccent_string(columnSQL) + ")"
+ " LIKE"
+ " UPPER(" + DBConstants.FUNC_unaccent_string("?") + ")";
}
else
{
whereClause = "UPPER(" + DBConstants.FUNC_unaccent_string(columnSQL) + ")"
+ " LIKE "
+ "UPPER(" + DBConstants.FUNC_unaccent_string(criteriaFunction.replaceFirst(columnSQL, "?")) + ")";
}
params.add(valueStr);
return whereClause;
}
public static String buildStringRestriction(String columnSQL, int displayType, Object value, Object valueTo, boolean isRange, List<Object> params)
{
StringBuffer where = new StringBuffer();
if (isRange)
{
if (value != null || valueTo != null)
where.append(" (");
if (value != null)
{
where.append(columnSQL).append(">?");
params.add(value);
}
if (valueTo != null)
{
if (value != null)
where.append(" AND ");
where.append(columnSQL).append("<?");
params.add(valueTo);
}
if (value != null || valueTo != null)
where.append(") ");
}
else
{
where.append(columnSQL).append("=?");
params.add(value);
}
return where.toString();
}
public static String prepareSearchString(Object value)
{
return prepareSearchString(value, false);
}
public static String prepareSearchString(Object value, boolean isIdentifier)
{
if (value == null || value.toString().length() == 0)
{
return null;
}
String valueStr;
if (isIdentifier)
{
// metas-2009_0021_AP1_CR064: begin
valueStr = ((String)value).trim();
if (!valueStr.startsWith("%"))
valueStr = "%" + value;
// metas-2009_0021_AP1_CR064: end
if (!valueStr.endsWith("%"))
valueStr += "%";
}
else
{
valueStr = (String)value;
if (valueStr.startsWith("%"))
{
; // nothing
}
else if (valueStr.endsWith("%"))
{
; // nothing
}
else if (valueStr.indexOf("%") < 0)
{
valueStr = "%" + valueStr + "%";
}
else
{
; // nothing
}
}
return valueStr;
}
}
| klst-com/metasfresh | de.metas.adempiere.adempiere/client/src/main/java/org/compiere/apps/search/FindHelper.java | Java | gpl-2.0 | 6,372 | [
30522,
7427,
8917,
1012,
4012,
14756,
2890,
1012,
18726,
1012,
3945,
1025,
1013,
1008,
1008,
1001,
1003,
1048,
1008,
2139,
1012,
18804,
2015,
1012,
4748,
6633,
14756,
2890,
1012,
4748,
6633,
14756,
2890,
1012,
7396,
1008,
1003,
1003,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* QEMU Empty Slot
*
* The empty_slot device emulates known to a bus but not connected devices.
*
* Copyright (c) 2010 Artyom Tarasenko
*
* This code is licensed under the GNU GPL v2 or (at your option) any later
* version.
*/
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "hw/empty_slot.h"
//#define DEBUG_EMPTY_SLOT
#ifdef DEBUG_EMPTY_SLOT
#define DPRINTF(fmt, ...) \
do { printf("empty_slot: " fmt , ## __VA_ARGS__); } while (0)
#else
#define DPRINTF(fmt, ...) do {} while (0)
#endif
#define TYPE_EMPTY_SLOT "empty_slot"
#define EMPTY_SLOT(obj) OBJECT_CHECK(EmptySlot, (obj), TYPE_EMPTY_SLOT)
typedef struct EmptySlot {
SysBusDevice parent_obj;
MemoryRegion iomem;
uint64_t size;
} EmptySlot;
static uint64_t empty_slot_read(void *opaque, hwaddr addr,
unsigned size)
{
DPRINTF("read from " TARGET_FMT_plx "\n", addr);
return 0;
}
static void empty_slot_write(void *opaque, hwaddr addr,
uint64_t val, unsigned size)
{
DPRINTF("write 0x%x to " TARGET_FMT_plx "\n", (unsigned)val, addr);
}
static const MemoryRegionOps empty_slot_ops = {
.read = empty_slot_read,
.write = empty_slot_write,
.endianness = DEVICE_NATIVE_ENDIAN,
};
void empty_slot_init(hwaddr addr, uint64_t slot_size)
{
if (slot_size > 0) {
/* Only empty slots larger than 0 byte need handling. */
DeviceState *dev;
SysBusDevice *s;
EmptySlot *e;
dev = qdev_create(NULL, TYPE_EMPTY_SLOT);
s = SYS_BUS_DEVICE(dev);
e = EMPTY_SLOT(dev);
e->size = slot_size;
qdev_init_nofail(dev);
sysbus_mmio_map(s, 0, addr);
}
}
static int empty_slot_init1(SysBusDevice *dev)
{
EmptySlot *s = EMPTY_SLOT(dev);
memory_region_init_io(&s->iomem, OBJECT(s), &empty_slot_ops, s,
"empty-slot", s->size);
sysbus_init_mmio(dev, &s->iomem);
return 0;
}
static void empty_slot_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = empty_slot_init1;
}
static const TypeInfo empty_slot_info = {
.name = TYPE_EMPTY_SLOT,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(EmptySlot),
.class_init = empty_slot_class_init,
};
static void empty_slot_register_types(void)
{
type_register_static(&empty_slot_info);
}
type_init(empty_slot_register_types)
| nypdmax/NUMA | tools/qemu-xen/hw/core/empty_slot.c | C | gpl-2.0 | 2,493 | [
30522,
1013,
1008,
1008,
1053,
6633,
2226,
4064,
10453,
1008,
1008,
1996,
4064,
1035,
10453,
5080,
7861,
18969,
2124,
2000,
1037,
3902,
2021,
2025,
4198,
5733,
1012,
1008,
1008,
9385,
1006,
1039,
1007,
2230,
2396,
7677,
2213,
10225,
5054,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2011 Daniele Simonetti
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
class MasteryAbility(object):
@staticmethod
def build_from_xml(elem):
f = MasteryAbility()
f.rank = int(elem.attrib['rank'])
f.rule = elem.attrib['rule'] if ('rule' in elem.attrib) else None
f.desc = elem.text
return f
class SkillCateg(object):
@staticmethod
def build_from_xml(elem):
f = SkillCateg()
f.id = elem.attrib['id']
f.name = elem.text
return f
def __str__(self):
return self.name
def __unicode__(self):
return self.name
def __eq__(self, obj):
return obj and obj.id == self.id
def __ne__(self, obj):
return not self.__eq__(obj)
def __hash__(self):
return self.id.__hash__()
class Skill(object):
@staticmethod
def build_from_xml(elem):
f = Skill()
f.name = elem.attrib['name']
f.id = elem.attrib['id']
f.trait = elem.attrib['trait']
f.type = elem.attrib['type']
f.tags = [f.type]
if elem.find('Tags'):
for se in elem.find('Tags').iter():
if se.tag == 'Tag':
f.tags.append(se.text)
f.mastery_abilities = []
if elem.find('MasteryAbilities'):
for se in elem.find('MasteryAbilities').iter():
if se.tag == 'MasteryAbility':
f.mastery_abilities.append(MasteryAbility.build_from_xml(se))
return f
def __str__(self):
return self.name or self.id
def __unicode__(self):
return self.name
def __eq__(self, obj):
return obj and obj.id == self.id
def __ne__(self, obj):
return not self.__eq__(obj)
def __hash__(self):
return self.id.__hash__()
| tectronics/l5rcm | dal/skill.py | Python | gpl-3.0 | 2,619 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
11163,
1011,
6070,
28154,
1011,
1015,
1011,
1008,
1011,
1001,
9385,
1006,
1039,
1007,
2249,
3817,
2063,
14072,
6916,
1001,
1001,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<title>{% if page.title %}{{ page.title }} – {% endif %}{{ site.name }} – {{ site.description }}</title>
{% include meta.html %}
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="{{ site.baseurl }}/style.css" />
<link rel="alternate" type="application/rss+xml" title="{{ site.name }} - {{ site.description }}" href="{{ site.baseurl }}/feed.xml" />
<!-- Created with Jekyll Now - http://github.com/barryclark/jekyll-now -->
</head>
<body>
<div class="wrapper-masthead">
<div class="container">
<header class="masthead clearfix">
<a href="{{ site.baseurl }}/" class="site-avatar"><img src="{{ site.avatar }}" /></a>
<div class="site-info">
<h1 class="site-name"><a href="{{ site.baseurl }}/">{{ site.name }}</a></h1>
<p class="site-description">{{ site.description }}</p>
</div>
<nav>
<a href="{{ site.baseurl }}/">Blog</a>
<a href="{{ site.baseurl }}/sobre">Sobre</a>
</nav>
</header>
</div>
</div>
<div id="main" role="main" class="container">
{{ content }}
</div>
<div class="wrapper-footer">
<div class="container">
<footer class="footer">
{% include svg-icons.html %}
</footer>
</div>
</div>
{% include analytics.html %}
</body>
</html> | yurihenrique/yurihenrique.github.io | _layouts/default.html | HTML | mit | 1,612 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
2516,
1028,
1063,
1003,
2065,
3931,
1012,
2516,
1003,
1065,
1063,
1063,
3931,
1012,
2516,
1065,
1065,
1516,
1063,
1003,
2203,
10128,
1003,
1065,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# coding: utf8
{
'!langcode!': 'fr',
'!langname!': 'Français',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" est une expression optionnelle comme "champ1=\'nouvellevaleur\'". Vous ne pouvez mettre à jour ou supprimer les résultats d\'un JOIN',
'%s %%{row} deleted': '%s lignes supprimées',
'%s %%{row} updated': '%s lignes mises à jour',
'%s selected': '%s sélectionné',
'%Y-%m-%d': '%Y-%m-%d',
'%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',
'About': 'À propos',
'Access Control': "Contrôle d'accès",
'Administrative Interface': "Interface d'administration",
'Administrative interface': "Interface d'administration",
'Ajax Recipes': 'Recettes Ajax',
'appadmin is disabled because insecure channel': "appadmin est désactivée parce que le canal n'est pas sécurisé",
'Are you sure you want to delete this object?': 'Êtes-vous sûr de vouloir supprimer cet objet?',
'Authentication': 'Authentification',
'Available Databases and Tables': 'Bases de données et tables disponibles',
'Buy this book': 'Acheter ce livre',
'cache': 'cache',
'Cache': 'Cache',
'Cache Keys': 'Clés de cache',
'Cannot be empty': 'Ne peut pas être vide',
'change password': 'changer le mot de passe',
'Check to delete': 'Cliquez pour supprimer',
'Check to delete:': 'Cliquez pour supprimer:',
'Clear CACHE?': 'Vider le CACHE?',
'Clear DISK': 'Vider le DISQUE',
'Clear RAM': 'Vider la RAM',
'Client IP': 'IP client',
'Community': 'Communauté',
'Components and Plugins': 'Composants et Plugins',
'Controller': 'Contrôleur',
'Copyright': 'Copyright',
'Created By': 'Créé par',
'Created On': 'Créé le',
'Current request': 'Demande actuelle',
'Current response': 'Réponse actuelle',
'Current session': 'Session en cours',
'customize me!': 'personnalisez-moi!',
'data uploaded': 'données téléchargées',
'Database': 'base de données',
'Database %s select': 'base de données %s selectionnée',
'db': 'bdd',
'DB Model': 'Modèle BDD',
'Delete:': 'Supprimer:',
'Demo': 'Démo',
'Deployment Recipes': 'Recettes de déploiement',
'Description': 'Description',
'design': 'design',
'DISK': 'DISQUE',
'Disk Cache Keys': 'Clés de cache du disque',
'Disk Cleared': 'Disque vidé',
'Documentation': 'Documentation',
"Don't know what to do?": 'Vous ne savez pas quoi faire?',
'done!': 'fait!',
'Download': 'Téléchargement',
'E-mail': 'E-mail',
'Edit': 'Éditer',
'Edit current record': "Modifier l'enregistrement courant",
'edit profile': 'modifier le profil',
'Edit This App': 'Modifier cette application',
'Email and SMS': 'Email et SMS',
'enter an integer between %(min)g and %(max)g': 'entrez un entier entre %(min)g et %(max)g',
'Errors': 'Erreurs',
'export as csv file': 'exporter sous forme de fichier csv',
'FAQ': 'FAQ',
'First name': 'Prénom',
'Forms and Validators': 'Formulaires et Validateurs',
'Free Applications': 'Applications gratuites',
'Function disabled': 'Fonction désactivée',
'Group ID': 'Groupe ID',
'Groups': 'Groupes',
'Hello World': 'Bonjour le monde',
'Home': 'Accueil',
'How did you get here?': 'Comment êtes-vous arrivé ici?',
'import': 'import',
'Import/Export': 'Importer/Exporter',
'Index': 'Index',
'insert new': 'insérer un nouveau',
'insert new %s': 'insérer un nouveau %s',
'Internal State': 'État interne',
'Introduction': 'Introduction',
'Invalid email': 'E-mail invalide',
'Invalid Query': 'Requête Invalide',
'invalid request': 'requête invalide',
'Is Active': 'Est actif',
'Key': 'Clé',
'Last name': 'Nom',
'Layout': 'Mise en page',
'Layout Plugins': 'Plugins de mise en page',
'Layouts': 'Mises en page',
'Live chat': 'Chat en direct',
'Live Chat': 'Chat en direct',
'login': 'connectez-vous',
'Login': 'Connectez-vous',
'logout': 'déconnectez-vous',
'lost password': 'mot de passe perdu',
'Lost Password': 'Mot de passe perdu',
'Lost password?': 'Mot de passe perdu?',
'lost password?': 'mot de passe perdu?',
'Main Menu': 'Menu principal',
'Manage Cache': 'Gérer le Cache',
'Menu Model': 'Menu modèle',
'Modified By': 'Modifié par',
'Modified On': 'Modifié le',
'My Sites': 'Mes sites',
'Name': 'Nom',
'New Record': 'Nouvel enregistrement',
'new record inserted': 'nouvel enregistrement inséré',
'next 100 rows': '100 prochaines lignes',
'No databases in this application': "Cette application n'a pas de bases de données",
'Object or table name': 'Objet ou nom de table',
'Online examples': 'Exemples en ligne',
'or import from csv file': "ou importer d'un fichier CSV",
'Origin': 'Origine',
'Other Plugins': 'Autres Plugins',
'Other Recipes': 'Autres recettes',
'Overview': 'Présentation',
'Password': 'Mot de passe',
"Password fields don't match": 'Les mots de passe ne correspondent pas',
'Plugins': 'Plugins',
'Powered by': 'Alimenté par',
'Preface': 'Préface',
'previous 100 rows': '100 lignes précédentes',
'Python': 'Python',
'Query:': 'Requête:',
'Quick Examples': 'Exemples Rapides',
'RAM': 'RAM',
'RAM Cache Keys': 'Clés de cache de la RAM',
'Ram Cleared': 'Ram vidée',
'Readme': 'Lisez-moi',
'Recipes': 'Recettes',
'Record': 'enregistrement',
'record does not exist': "l'archive n'existe pas",
'Record ID': "ID d'enregistrement",
'Record id': "id d'enregistrement",
'Register': "S'inscrire",
'register': "s'inscrire",
'Registration identifier': "Identifiant d'enregistrement",
'Registration key': "Clé d'enregistrement",
'Remember me (for 30 days)': 'Se souvenir de moi (pendant 30 jours)',
'Request reset password': 'Demande de réinitialiser le mot clé',
'Reset Password key': 'Réinitialiser le mot clé',
'Resources': 'Ressources',
'Role': 'Rôle',
'Rows in Table': 'Lignes du tableau',
'Rows selected': 'Lignes sélectionnées',
'Semantic': 'Sémantique',
'Services': 'Services',
'Size of cache:': 'Taille du cache:',
'state': 'état',
'Statistics': 'Statistiques',
'Stylesheet': 'Feuille de style',
'submit': 'soumettre',
'Submit': 'Soumettre',
'Support': 'Support',
'Sure you want to delete this object?': 'Êtes-vous sûr de vouloir supprimer cet objet?',
'Table': 'tableau',
'Table name': 'Nom du tableau',
'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': 'La "requête" est une condition comme "db.table1.champ1==\'valeur\'". Quelque chose comme "db.table1.champ1==db.table2.champ2" résulte en un JOIN SQL.',
'The Core': 'Le noyau',
'The output of the file is a dictionary that was rendered by the view %s': 'La sortie de ce fichier est un dictionnaire qui été restitué par la vue %s',
'The Views': 'Les Vues',
'This App': 'Cette Appli',
'This is a copy of the scaffolding application': "Ceci est une copie de l'application échafaudage",
'Time in Cache (h:m:s)': 'Temps en Cache (h:m:s)',
'Timestamp': 'Horodatage',
'Twitter': 'Twitter',
'unable to parse csv file': "incapable d'analyser le fichier cvs",
'Update:': 'Mise à jour:',
'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.': 'Employez (...)&(...) pour AND, (...)|(...) pour OR, and ~(...) pour NOT afin de construire des requêtes plus complexes.',
'User %(id)s Logged-in': 'Utilisateur %(id)s connecté',
'User %(id)s Registered': 'Utilisateur %(id)s enregistré',
'User ID': 'ID utilisateur',
'User Voice': "Voix de l'utilisateur",
'Verify Password': 'Vérifiez le mot de passe',
'Videos': 'Vidéos',
'View': 'Présentation',
'Web2py': 'Web2py',
'Welcome': 'Bienvenue',
'Welcome %s': 'Bienvenue %s',
'Welcome to web2py': 'Bienvenue à web2py',
'Welcome to web2py!': 'Bienvenue à web2py!',
'Which called the function %s located in the file %s': 'Qui a appelé la fonction %s se trouvant dans le fichier %s',
'You are successfully running web2py': 'Vous exécutez avec succès web2py',
'You can modify this application and adapt it to your needs': "Vous pouvez modifier cette application et l'adapter à vos besoins",
'You visited the url %s': "Vous avez visité l'URL %s",
}
| pouyana/teireader | webui/applications/grid/languages/fr.py | Python | mit | 7,935 | [
30522,
1001,
16861,
1024,
21183,
2546,
2620,
1063,
1005,
999,
11374,
16044,
999,
1005,
1024,
1005,
10424,
1005,
1010,
1005,
999,
11374,
18442,
999,
1005,
1024,
1005,
22357,
1005,
1010,
1005,
1000,
10651,
1000,
2003,
2019,
11887,
3670,
2066,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/******************************************************************************
*
* Copyright(c) 2009-2014 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef __RTL92E_HW_H__
#define __RTL92E_HW_H__
void rtl92ee_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val);
void rtl92ee_read_eeprom_info(struct ieee80211_hw *hw);
void rtl92ee_interrupt_recognized(struct ieee80211_hw *hw,
struct rtl_int *int_vec);
int rtl92ee_hw_init(struct ieee80211_hw *hw);
void rtl92ee_card_disable(struct ieee80211_hw *hw);
void rtl92ee_enable_interrupt(struct ieee80211_hw *hw);
void rtl92ee_disable_interrupt(struct ieee80211_hw *hw);
int rtl92ee_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type);
void rtl92ee_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid);
void rtl92ee_set_qos(struct ieee80211_hw *hw, int aci);
void rtl92ee_set_beacon_related_registers(struct ieee80211_hw *hw);
void rtl92ee_set_beacon_interval(struct ieee80211_hw *hw);
void rtl92ee_update_interrupt_mask(struct ieee80211_hw *hw,
u32 add_msr, u32 rm_msr);
void rtl92ee_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val);
void rtl92ee_update_hal_rate_tbl(struct ieee80211_hw *hw,
struct ieee80211_sta *sta, u8 rssi_level,
bool update_bw);
void rtl92ee_update_channel_access_setting(struct ieee80211_hw *hw);
bool rtl92ee_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid);
void rtl92ee_enable_hw_security_config(struct ieee80211_hw *hw);
void rtl92ee_set_key(struct ieee80211_hw *hw, u32 key_index,
u8 *p_macaddr, bool is_group, u8 enc_algo,
bool is_wepkey, bool clear_all);
void rtl92ee_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw,
bool autoload_fail, u8 *hwinfo);
void rtl92ee_bt_reg_init(struct ieee80211_hw *hw);
void rtl92ee_bt_hw_init(struct ieee80211_hw *hw);
void rtl92ee_suspend(struct ieee80211_hw *hw);
void rtl92ee_resume(struct ieee80211_hw *hw);
void rtl92ee_allow_all_destaddr(struct ieee80211_hw *hw, bool allow_all_da,
bool write_into_reg);
void rtl92ee_fw_clk_off_timer_callback(unsigned long data);
#endif
| BPI-SINOVOIP/BPI-Mainline-kernel | linux-4.19/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.h | C | gpl-2.0 | 2,911 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
layout: post
title: Tekton Pipelines in Jenkins X - Part 2 Add Steps Before/After a Stage Lifecycle Or Build Your Own Pipeline
subtitle: Override an entire pipeline | Append or prepend additional steps to a defined Stage.
image: 'https://avatars0.githubusercontent.com/u/47602533?s=400&v=4'
share-img: http://sharepointoscar.com/img/tekton-part-2/tekton_append_steps_to_pipeline.png
published: true
author: Oscar Medina
date: 2019-05-30
tags:
- Docker
- CI/CD Pipeline
- Jenkins X
- Tekton
- K8s
- GKE
- Kubernetes Secrets
---

In [Part 1](http://sharepointoscar.com/2019-04-22-using-tekton-pipelines-in-jenkins-x-part-1/) of our multi-part post, I walked you through adding custom steps to a Tekton pipeline. In this post I'll show you how you can append custom steps to a defined Stage. I will also show you how to override an entire Build-Pack defined pipeline (the ones that come out of the box in Jenkins X), including the ability to specify your own Builder Docker Image.
**Bonus** I show you how to retrieve Kubernetes Secret values and store them as a variable within the pipeline.
For details on the Jenkins X Pipelines that use Build-Packs (which are the default), take a look at [Customizing Pipelines](https://jenkins-x.io/architecture/jenkins-x-pipelines/#customising-the-pipelines)
I won't go into details as to what Tekton is, as I provided an overview in Part 1. This post builds on top of what we did on Part 1, please read it as many typical commands are ommited on this post (viewing jx logs etc.)
# Scenario
I previously installed Jenkins X Serverless on GKE and all is running. I have an existing NodeJS application that has MochaJS tests, and I've already ran it through Jenkins X CI/CD. My app tests ran, and I did absolutely nothing, as Jenkins X detected the NodeJS language, and used the appropriate **Builder**. The app current version is in our staging environent.
However, I want to further have control over the Jenkins X pipelines which use the `build-packs`. I also want to see how I can completely build my own pipeline without relying on the ones provided by Jenkins X.
## What you will learn
In the second part of this series, I will walk you through the following:
1. Append an additional two steps to the given built-in Release pipeline, within the Build Stage. Adding a step before and after the build occurs.
2. Override the entire `Build-Pack` built-in pipeline with my own definition. (this of course means more work for me)
So let's get started!
# Append Steps To The Release Pipeline Build Stage
First, I will modify the `jenkins-x.yaml` file. In order to do that, I will execute a `jx` command as follows:
{% highlight bash %}
> $ jx create step
{% endhighlight %}
I answer the questions related to where I want to add the step. The last prompt is actually a `shell` command. But I just type whatever as I need to properly define it later.
Once finished, the `jenkins-x.yaml` file is immediately modified. It should look like the following:
{% highlight yaml %}
buildPack: javascript
pipelineConfig:
pipelines:
overrides:
- pipeline: release
stage: build
type: after
steps:
- sh: echo ====================================== APPENDING Release Pipeline, Build Stage, Before execution of default stuff ======================================
name: sposcar-appending-step
{% endhighlight %}
You can add additional steps as well, as the `steps` node is an array. You may also opt to add another step at a diffrent time, perhaps in the `type: before` vs the `type: after` as I did and below is the final `yaml`
{% highlight yaml %}
buildPack: javascript
pipelineConfig:
pipelines:
overrides:
- pipeline: release
stage: build
type: before
steps:
- sh: echo ====================================== PREPENDING Release Pipeline, Build Stage, before execution of default stuff ======================================
name: sposcar-prepending-step
- pipeline: release
stage: build
type: after
steps:
- sh: echo ====================================== APPENDING Release Pipeline, Build Stage, after execution of default stuff ======================================
name: sposcar-appending-step
{% endhighlight %}
## Checking the build logs
Once I run the pipeline, the custom steps should be executed, and should appear in the output as shown below.

# Replacing the built-in Pipeline
Because Jenkins X uses `build-packs` to build an app based on the language, it automatically detects this when you import your existing app. Therefore, the first line already containted `buildPack: javascript`. Jenkins X added this for me automatically.
However, in this scenario, I do not want to use the buil-in pipeline, nor do I need to overwrite any steps. I want to completely define my own pipeline. This step shows you an example of what that may look like.
The `yaml` for the entire replacement looks like the following:
{% highlight yaml %}
buildPack: none
pipelineConfig:
pipelines:
release:
pipeline:
options:
containerOptions:
resources:
limits:
cpu: 0.2
memory: 128Mi
requests:
cpu: 0.1
memory: 64Mi
agent:
image: sharepointoscar/node:8
stages:
- name: Oscar Build Stage
steps:
- name: Get Node Version
command: node
args:
- --version
- name: NPM Installar Por Favor
command: npm
args:
- install
options:
containerOptions:
resources:
limits:
cpu: 0.4
memory: 256Mi
requests:
cpu: 0.2
memory: 128Mi
- name: Oscar Test Stage
steps:
- name: Run MochaJS Tests
command: npm
args:
- test
options:
containerOptions:
resources:
limits:
cpu: 0.4
memory: 256Mi
requests:
cpu: 0.2
memory: 128Mi
{% endhighlight %}
Lots going on here. First, you will notice that the first line, tells Jenkins X to *not* use a `buildPack`.
You might notice that I specified container properties and modified them. I am telling Jenkins X that I need specific `cpu` and `memory` for the containers it spins up to run the `Tekton` pipeline.
Another noteworthy item, is that I'm using a custom `Docker` image, in this scenario my app required a specific version of NodeJS, and it was not available in the existing Jenkins X repo (a common scenario), therefore the `agent.image` allows me to point to an image (this one is publicly available) and I host it at [Docker Hub](https://hub.docker.com)
## Working With Secrets and Private Registries
If your registry is private (most are), then you will need to first create a Secret in Kubernetes. I prefer using a command similar to the following:
`kubectl create secret generic my-registry --from-literal=username=userarealname--from-literal=apikey=passwordOrAPIKey --namespace jx`
Once this is created, you can use use the pipeline `env` node to set values from the secret stored in Kubernetes, which you retrieve as shown below.
**NOTE** the sample `yaml` below is not the same as the complete pipeline I defined above. I am merely showing you, how you may retrieve `secrets` and use them within the pipeline.
{% highlight yaml %}
buildPack: javascript
pipelineConfig:
env:
- name: MY_REGISTRY_USERNAME
valueFrom:
secretKeyRef:
key: username
name: my-registry
- name: MY_REGISTRY_APIKEY
valueFrom:
secretKeyRef:
key: apikey
name: my-registry
pipelines:
overrides:
- pipeline: release
stage: build
type: before
steps:
- sh: echo ====================================== MY_REGISTRY_USERNAME= ${MY_REGISTRY_USERNAME} ======================================
name: sposcar-echo-username
- sh: echo ====================================== MY_REGISTRY_APIKEY= ${MY_REGISTRY_APIKEY} ======================================
name: sposcar-echo-apikey
{% endhighlight %}
You will also notice that my steps have unique names. This is helpful when looking at logs to quickly spot them. For example, if I vew the app activities using `jx get activities -f skiapp -w`, or if you use `jx get build logs` at the time the pipeline is executing, this proves to be really helpful.
---
**NOTE**
Many people are confused when they execute `jx get build logs` and see a message like the following: **error: no Tekton pipelines have been triggered which match the current filter** This just means, the pipeline either has not started or never started. I tend to forget to do a Pull Requests to kick it off. Another thing you can do, is check other logs by using `jx logs` and picking an item such as the `pipelinerunner` or `pipeline` which tend to have more insight as to what happened when you ran it.
---
# Part 3 and 4?
There are pipelines in Jenkinx X that are not based on `Build-Packs`. We have not covered those. If you show enough interest via Twitter _(Retweets and Likes)_ when this blog is posted, I'll take the time to write a **Part 3** and **Part 4** which show you how to work with these other type of Pipelines.
# Conclusion
In Part 2 of of the *Tekton Pipelines in Jenkins X* blog post series, we learned how to add steps and augment the NodeJS build-pack Stages and Steps. We also completely replaced the pipeline with our own definition, and even added a custom builder docker image.
I hope you found this helpful.
Do you want to ensure you don't miss posts like this? [Sign up](https://jenkins-x.us7.list-manage.com/subscribe?u=d0c128ac1f69ba2bb20742976&id=84d053b0a0) for the Jenkins X Newsletter!
More soon,
@SharePointOscar | SharePointOscar/sharepointoscar.github.io | _posts/2019-05-29-using-tekton-pipelines-in-jenkins-x-part-2.md | Markdown | mit | 10,402 | [
30522,
1011,
1011,
1011,
9621,
1024,
2695,
2516,
1024,
8915,
25509,
2239,
13117,
2015,
1999,
11098,
1060,
1011,
2112,
1016,
5587,
4084,
2077,
1013,
2044,
1037,
2754,
2166,
23490,
2030,
3857,
2115,
2219,
13117,
4942,
3775,
9286,
1024,
2058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Thorium.Shared.Blender
{
public enum BlenderRenderEngine
{
Native,
Cycles
}
}
*/ | fredlllll/ThoriumRenderFarm | Source/Thorium.Shared/Unused/JobTypes/Blender/BlenderRenderEngine.cs | C# | gpl-3.0 | 240 | [
30522,
1013,
1008,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
3415,
15327,
15321,
5007,
1012,
4207,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/common/child_histogram_message_filter.h"
#include <ctype.h>
#include "base/bind.h"
#include "base/message_loop.h"
#include "base/metrics/statistics_recorder.h"
#include "base/pickle.h"
#include "content/common/child_process.h"
#include "content/common/child_process_messages.h"
#include "content/common/child_thread.h"
namespace content {
ChildHistogramMessageFilter::ChildHistogramMessageFilter()
: channel_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(histogram_snapshot_manager_(this)) {
}
ChildHistogramMessageFilter::~ChildHistogramMessageFilter() {
}
void ChildHistogramMessageFilter::OnFilterAdded(IPC::Channel* channel) {
channel_ = channel;
}
void ChildHistogramMessageFilter::OnFilterRemoved() {
}
bool ChildHistogramMessageFilter::OnMessageReceived(
const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ChildHistogramMessageFilter, message)
IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildHistogramData,
OnGetChildHistogramData)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
void ChildHistogramMessageFilter::SendHistograms(int sequence_number) {
ChildProcess::current()->io_message_loop_proxy()->PostTask(
FROM_HERE, base::Bind(&ChildHistogramMessageFilter::UploadAllHistograms,
this, sequence_number));
}
void ChildHistogramMessageFilter::OnGetChildHistogramData(int sequence_number) {
UploadAllHistograms(sequence_number);
}
void ChildHistogramMessageFilter::UploadAllHistograms(int sequence_number) {
DCHECK_EQ(0u, pickled_histograms_.size());
base::StatisticsRecorder::CollectHistogramStats("ChildProcess");
// Push snapshots into our pickled_histograms_ vector.
// Note: Before serializing, we set the kIPCSerializationSourceFlag for all
// the histograms, so that the receiving process can distinguish them from the
// local histograms.
histogram_snapshot_manager_.PrepareDeltas(
base::Histogram::kIPCSerializationSourceFlag, false);
channel_->Send(new ChildProcessHostMsg_ChildHistogramData(
sequence_number, pickled_histograms_));
pickled_histograms_.clear();
static int count = 0;
count++;
DHISTOGRAM_COUNTS("Histogram.ChildProcessHistogramSentCount", count);
}
void ChildHistogramMessageFilter::RecordDelta(
const base::HistogramBase& histogram,
const base::HistogramSamples& snapshot) {
DCHECK_NE(0, snapshot.TotalCount());
Pickle pickle;
histogram.SerializeInfo(&pickle);
snapshot.Serialize(&pickle);
pickled_histograms_.push_back(
std::string(static_cast<const char*>(pickle.data()), pickle.size()));
}
void ChildHistogramMessageFilter::InconsistencyDetected(
base::Histogram::Inconsistencies problem) {
UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesChildProcess",
problem, base::Histogram::NEVER_EXCEEDED_VALUE);
}
void ChildHistogramMessageFilter::UniqueInconsistencyDetected(
base::Histogram::Inconsistencies problem) {
UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesChildProcessUnique",
problem, base::Histogram::NEVER_EXCEEDED_VALUE);
}
void ChildHistogramMessageFilter::InconsistencyDetectedInLoggedCount(
int amount) {
UMA_HISTOGRAM_COUNTS("Histogram.InconsistentSnapshotChildProcess",
std::abs(amount));
}
} // namespace content
| zcbenz/cefode-chromium | content/common/child_histogram_message_filter.cc | C++ | bsd-3-clause | 3,578 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2262,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Server: Netscape-Communications/1.1
Date: Wednesday, 20-Nov-96 23:24:28 GMT
Last-modified: Monday, 24-Jun-96 14:59:21 GMT
Content-length: 5156
Content-type: text/html
<HTML>
<HEAD>
<TITLE>CIS 510 Handout 1</TITLE>
<BODY><! BODY BGCOLOR = "#000000" TEXT = "#FFFFFF">
<BODY bgcolor="#FFEFDB"> <! AntiqueWhite1>
<H1><CENTER>CIS 510, Spring 96 </CENTER> <P>
<center>
COMPUTER AIDED GEOMETRIC DESIGN
</CENTER>
<CENTER>Course Information</CENTER>
<CENTER>January 9</CENTER></H1>
<P>
<H4>
<H2>Coordinates:</H2> Moore 224, MW 12-1:30
<P>
<H2>Instructor:</H2> <!WA0><A HREF="mailto:jean@saul.cis.upenn.edu">Jean H.
Gallier</A>, MRE 176, 8-4405, jean@saul <P>
<H2>Office Hours:</H2> 2:00-3:00 Tuesday, Thursday, 2:00-3:00, Friday
<P>
<H2>Teaching Assistant:</H2>
TBA <p>
<H2>Office Hours:</H2> TBA<P>
<h2> Prerequesites:</h2>
Basic knowledge of linear algebra, calculus,
and elementary geometry
<br>
(CIS560 NOT required).
<H2>Textbooks (not required):</H2> <I>Computer Aided Geometric Design </I>
Hoschek, J. and Lasser, D., AK Peters, 1993<br>
<BR>Also recommended:<BR>
<BR><I>Curves and Surfaces for Computer Aided Geometric Design</I>,
D. Wood, Wiley<br>
<P>
<H2>Grades:</H2>
<P>
Problem Sets (3 or 4 of them) and a project
<ul>
<li><!WA1><a
href="http://www.cis.upenn.edu/~jean/geom96hm1.dvi.Z"> Homework1 </a>
<li><!WA2><a
href="http://www.cis.upenn.edu/~jean/geom96hm2.dvi.Z"> Homework2 </a>
<li><!WA3><a
href="http://www.cis.upenn.edu/~jean/geom96hm3.dvi.Z"> Homework3 </a>
</ul>
<P>
<H2>Brief description:</H2>
A more appropriate name for the course would be
<h2><center>
Curves and Surfaces for Computer Aided Geometric Design</center></h2>
or perhaps
<h2><center>
Mathematical Foundations of Computer Graphics</center></h2>
(as CS348a is called at Stanford University).
The course should be of interest to anyone who likes
geometry (with an algebraic twist)!<p>
Basically, the course will be about mathematical techniques
used for geometric design in computer graphics
(but also in robotics, vision, and computational geometry).
Such techniques are used in 2D and 3D drawing and plot, object silhouettes,
animating positions, product design (cars, planes, buildings),
topographic data, medical imagery, active surfaces of proteins,
attribute maps (color, texture, roughness), weather data, art(!), ... .
Three broad classes of problems will be considered: <p>
<ul>
<li> <em> Approximating</em> curved shapes, using smooth curves or surfaces.
<li> <em> Interpolating</em> curved shapes, using smooth curves or surfaces.
<li> <em> Rendering</em> smooth curves or surfaces. <p>
</ul> <p>
Specific topics include: basic geometric material
on affine spaces and affine maps.
Be'zier curves will be introduced ``gently'', in terms of
multiaffine symmetric polar forms, also known as ``blossoms''.
We will begin with degree 2, move up to degree 3,
giving lots of examples, and derive the fundamental
``de Casteljau algorithm'', and show where the Bernstein
polynomials come from.
Then, we will consider polynomial curves
of arbitrary degree. It will be shown how a construction
embedding an affine space into a vector space, where points
and vectors can be treated uniformly, together with polar forms,
yield a very elegant and effective treatment of tangents and
osculating flats. The conditions for joining polynomial curves
will be derived using polar forms, and this will lead to
a treatment of B-splines in terms of polar forms. In particular,
the de Boor algorithm will be derived as a natural extension of
the de Casteljau algorithm.
Rectangular (tensor product) Be'zier surfaces, and triangular
Be'zier surfaces will also be introduced using polar forms,
and the de Casteljau algorithm will be derived.
Subdivision algorithms and their application to
rendering will be discussed extensively.
Joining conditions will be derived
using polar forms. <p>
Using the embedding
of an affine space into a vector space, we will contruct the
projective completion of an affine space, and show how
rational curves can be dealt with as central projections
of polynomial curves, with appropriate generalizations
of the de Casteljau algorithm. <p>
Rational surfaces will be obtained as central projections
of polynomial surfaces.
If time permits, NURBS and
geometric continuity will be discussed.
This will require a little bit of
differential geometry. <p>
A class-room treatment of curves and surfaces in terms of polar forms
is rather new (although
used at Stanford by Leo Guibas and Lyle Ramshaw), but should be
illuminating and exciting.
Since books (even recent) do not follow such an approach,
I have written extensive course notes, which will be available. <p>
I will mix assignments not involving programming, and
small programming projects.
There are plenty of opportunities for trying out
the algorithms presented in the course. In particular,
it is fairly easy to program many of these algorithms in Mathematica
(I have done so, and I'm not such a great programmer!). <p>
At the end of the course, you will know how to write your <em> own </em>
algorithms to display the half Klein bottle shown below.<p>
<!WA4><a href="http://www.cis.upenn.edu/~jean/klein5.ps.Z"> Half Klein bottle</a><p>
<P>
</UL>
<P>
<I>published by:
<H2><!WA5><A HREF="mailto:jean@saul.cis.upenn.edu">Jean Gallier</A></H2>
</H4>
<BODY>
<HTML>
| ML-SWAT/Web2KnowledgeBase | webkb/course/misc/http:^^www.cis.upenn.edu^~jean^cis510.html | HTML | mit | 5,366 | [
30522,
8241,
1024,
16996,
19464,
1011,
4806,
1013,
30524,
1011,
5986,
2603,
1024,
2484,
1024,
2654,
13938,
2102,
2197,
1011,
6310,
1024,
6928,
1010,
2484,
1011,
12022,
1011,
5986,
2403,
1024,
5354,
1024,
2538,
13938,
2102,
4180,
1011,
3091,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.