answer
stringlengths 15
1.25M
|
|---|
#ifndef __DEREF_H__
#define __DEREF_H__
/* TLS: Bao changed these derefs to handle attributed variables, since
* a reference chain can, in principle, have a chain of var pointers
* followed by a chain of attv pointers, ending in a free variable.
* Actually, the code here is somewhat more general, and allows more
* intermixture of attv and var pointers. So I may be wrong or the
* code may be a little more general than it needs to be.
*
* XSB_Deref(op) is the same as XSB_CptrDeref(op) except that
* XSB_CptrDeref(op) performs an explicit cast of op to a CPtr. */
#define XSB_Deref(op) XSB_Deref2(op,break)
/* XSB_Deref2 is changed to consider attributed variables */
#define XSB_Deref2(op, stat) { \
while (isref(op)) { \
if (op == follow(op)) \
stat; \
op = follow(op); \
} \
while (isattv(op)) { \
if (cell((CPtr) dec_addr(op)) == dec_addr(op)) \
break; /* end of an attv */ \
else { \
op = cell((CPtr) dec_addr(op)); \
while (isref(op)) { \
if (op == follow(op)) \
stat; \
op = follow(op); \
} \
} \
} \
}
#define XSB_CptrDeref(op) { \
while (isref(op)) { \
if (op == (CPtr) cell(op)) break; \
op = (CPtr) cell(op); \
} \
while (isattv(op)) { \
if (cell((CPtr) dec_addr(op)) == dec_addr(op)) \
break; \
else { \
op = (CPtr) cell((CPtr) dec_addr(op)); \
while (isref(op)) { \
if (op == (CPtr) cell(op)) break; \
op = (CPtr) cell(op); \
} \
} \
} \
}
#define printderef(op) while (isref(op) && op > 0) { \
if (op==follow(op)) \
break; \
op=follow(op); }
#endif /* __DEREF_H__ */
|
// Moodle is free software: you can redistribute it and/or modify
// (at your option) any later version.
// Moodle is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;
(function ($) {
$.booleanEditor = {
defaults: {
rules: [],
change: null
},
paramList: M.enrol_attributes.paramList,
operatorList: [
{label: " = ", value: "=="},
// {label: "=/=", value: "!="},
// {label: "contains", value: "contains"},
]
};
$.fn.extend({
booleanEditor: function (options) {
var isMethodCall = (typeof options == 'string'), // is it a method call or booleanEditor instantiation ?
args = Array.prototype.slice.call(arguments, 1);
if (isMethodCall) switch (options) {
case 'serialize':
var mode = ( args[0] ) ? args[0].mode : '',
ser_obj = serialize(this);
switch (mode) {
case 'json':
return $.toJSON(ser_obj);
break;
case 'object':
default:
return ser_obj;
}
break;
case 'getExpression':
return <API key>(this);
break;
default:
return;
}
settings = $.extend({}, $.booleanEditor.defaults, options);
return this.each(function () {
if (settings.change) {
$(this).data('change', settings.change)
}
$(this)
.addClass("<API key>")
.append(createRuleList($('<ul></ul>'), settings.rules));
changed(this);
});
}
});
function serialize(root_elem) {
var ser_obj = {rules: []};
var group_c_op = $("select:first[name='cond-operator']", root_elem).val();
if (group_c_op)
ser_obj.cond_op = group_c_op;
$("ul:first > li", root_elem).each(function () {
r = $(this);
if (r.hasClass('group')) {
ser_obj['rules'].push(serialize(this));
}
else {
var cond_obj = {
param: $("select[name='comparison-param'] option:selected", r).val(),
comp_op: $("select[name='comparison-operator']", r).val(),
value: $("input[name='value']", r).val()
};
var cond_op = $("select[name='cond-operator']", r).val();
if (cond_op)
cond_obj.cond_op = cond_op;
ser_obj['rules'].push(cond_obj);
}
});
return ser_obj;
}
function <API key>(editor) {
var expression = "";
$("ul:first > li", editor).each(function () {
r = $(this);
var c_op = $("select[name='cond-operator']", r).val();
if (c_op != undefined) c_op = '<span class="cond-op"> ' + c_op + ' </span>';
if (r.hasClass('group')) {
expression += c_op + '<span class="group-op group-group">(</span>' + <API key>(this) + '<span class="group-op group-group">)</span>';
}
else {
expression += [
c_op,
'<span class="group-op group-cond">(</span>',
'<span class="comp-param">' + $("select[name='comparison-param'] option:selected", r).text() + '</span>',
'<span class="comp-op"> ' + $("select[name='comparison-operator']", r).val() + ' </span>',
'<span class="comp-val">' + '\'' + $("input[name='value']", r).val() + '\'' + '</span>',
'<span class="group-op group-cond">)</span>'
].join("");
}
});
return expression;
}
function changed(o) {
$o = $(o);
if (!$o.hasClass('<API key>')) {
$o = $o.parents('.<API key>').eq(0);
}
if ($o.data('change')) {
$o.data('change').apply($o.get(0));
}
}
function createRuleList(list_elem, rules) {
//var list_elem = $(list_elem);
if (list_elem.parent("li").eq(0).hasClass("group")) {
console.log("inside a group");
return;
}
if (rules.length == 0) {
// No rules, create a new one
list_elem.append(<API key>({first: true}));
} else {
// Read all rules
for (var r_idx = 0; r_idx < rules.length; r_idx++) {
var r = rules[r_idx];
r['first'] = (r_idx == 0);
// If the rule is an array, create a group of rules
if (r.rules && (typeof r.rules[0] == 'object')) {
r.group = true;
var rg = <API key>(r);
list_elem.append(rg);
createRuleList($("ul:first", rg), r.rules);
}
else {
list_elem.append(<API key>(r));
}
}
}
return list_elem;
};
/**
* Build the HTML code for editing a rule condition.
* A rule is composed of one or more rule conditions linked by boolean operators
*/
function <API key>(config) {
config = $.extend({},
{
first: false,
group: false,
cond_op: null,
param: null,
comp_op: null,
value: ''
},
config
);
// If group flag is set, wrap content with <ul></ul>, content is obtained by a recursive call
// to the function, passing a copy of config with flag group set to false
var cond_block_content = $('<div class="sre-condition-box"></div>');
if (config.group) {
cond_block_content.append('<ul></ul>');
} else {
cond_block_content
.append(makeSelectList({ // The list of parameters to be compared
name: 'comparison-param',
params: $.booleanEditor.paramList,
selected_value: config.param
}).addClass("comp-param"))
.append($('<span>').addClass("comp-op").text('='))
// .append( makeSelectList({ // The comparison operator
// name: 'comparison-operator',
// params: $.booleanEditor.operatorList,
// selected_value: config.comp_op
// }).addClass("comp-op"))
.append($('<input type="text" name="value" value="' + config.value + '"/>')
.change(function () {
changed(this)
})
); // The value of the comparions
}
var <API key> = $('<li></li>')
.addClass((config.group) ? 'group' : 'rule')
.append(<API key>(config))
.append(cond_block_content)
.append(createButtonPannel())
return <API key>;
};
function <API key>(config) {
return (config.first) ? '' :
makeSelectList({
'name': 'cond-operator',
params: [
{label: 'AND', value: 'and'},
{label: 'OR', value: 'or'}
],
selected_value: config.cond_op
}).addClass('<API key>');
}
function createButtonPannel() {
var buttonPannel = $('<div class="button-pannel"></div>')
.append($('<button type="button" class="button-add-cond">'+ M.util.get_string('addcondition', 'enrol_attributes') +'</button>')
.click(function () {
<API key>($(this).parents('li').get(0));
})
)
.append($('<button type="button" class="button-add-group">'+ M.util.get_string('addgroup', 'enrol_attributes') +'</button>')
.click(function () {
addNewGroupAfter($(this).parents('li').get(0));
})
)
.append($('<button type="button" class="button-del-cond">'+ M.util.get_string('deletecondition', 'enrol_attributes') +'</button>')
.click(function () {
deleteCondition($(this).parents('li').eq(0));
})
);
$('button', buttonPannel).each(function () {
$(this)
.focus(function () {
this.blur()
})
.attr("title", $(this).text())
.wrapInner('<span/>');
});
return buttonPannel;
}
function makeSelectList(config) {
config = $.extend({},
{
name: 'list_name',
params: [{label: 'label', value: 'value'}],
selected_value: null
},
config);
var selectList = $('<select name="' + config.name + '"></select>')
.change(function () {
changed(this);
});
$.each(config.params, function (i, p) {
var p_obj = $('<option></option>')
.attr({label: p.label, value: p.value})
.text(p.label);
if (p.value == config.selected_value) {
p_obj.attr("selected", "selected");
}
p_obj.appendTo(selectList);
});
return selectList;
}
// -->> Conditions manipulation <<--
function <API key>(elem, config) {
<API key>(config)
.hide()
.insertAfter(elem)
.fadeIn("normal", function () {
changed(elem)
});
}
function addNewGroupAfter(elem, config) {
<API key>({group: true})
.hide()
.insertAfter(elem)
.find("ul:first")
.append(<API key>($.extend({}, config, {first: true})))
.end()
.fadeIn("normal", function () {
changed(elem)
});
}
function deleteCondition(elem) {
if (elem.parent().parent().hasClass('<API key>')) {
// Level 1
if (elem.siblings().length == 0) {
return;
}
} else {
// Higher level
if (elem.siblings().length == 0) {
// The last cond of the group, target the group itself, to be removed
elem = elem.parents('li').eq(0);
}
}
p = elem.parent();
elem.fadeOut("normal", function () {
$(this).remove();
$("li:first .<API key>", ".<API key> ul").remove();
changed(p);
});
}
})(jQuery);
|
Gumbe is music content webapp that provide Sierra Leone to quickly access Salone music online. This app is build on # SoundRedux
In an effort to learn es6 and [redux](https:
See it in action at http://soundredux.io
Uses [normalizr](https://github.com/gaearon/normalizr)
1. `npm install`
2. `npm run start`
3. visit `http://localhost:8080`
Feedback, issues, etc. are more than welcome!
|
from flask import json
from unittest.mock import patch, Mock
from urbansearch.gathering.indices_selector import IndicesSelector
from urbansearch.server.main import Server
from urbansearch.server import classify_documents
from urbansearch.server.classify_documents import _join_workers
from urbansearch.workers import Workers
s = Server(run=False)
@patch('urbansearch.server.classify_documents._join_workers')
@patch.object(Workers, '<API key>')
@patch.object(IndicesSelector, 'run_workers')
def <API key>(mock_rcw, mock_rw, mock_jw):
with s.app.test_client() as c:
resp = c.get('/api/v1/classify_documents/log_only?directory=test')
assert mock_rcw.called
assert mock_rw.called
assert mock_jw.called
@patch('urbansearch.server.classify_documents._join_workers')
@patch.object(Workers, '<API key>')
@patch.object(IndicesSelector, 'run_workers')
def <API key>(mock_rcw, mock_rw, mock_jw):
with s.app.test_client() as c:
resp = c.get('/api/v1/classify_documents/to_database?directory=test')
assert mock_rcw.called
assert mock_rw.called
assert mock_jw.called
@patch('urbansearch.server.classify_documents._join_workers')
@patch('urbansearch.server.classify_documents.db_utils')
def <API key>(mock_db, mock_jw):
mock_db.connected_to_db.return_value = False
with s.app.test_client() as c:
resp = c.get('/api/v1/classify_documents/to_database?directory=test')
assert not mock_jw.called
@patch('urbansearch.server.classify_documents._join_file_workers')
@patch.object(Workers, '<API key>')
@patch.object(Workers, '<API key>')
def <API key>(mock_rfw, mock_rw, mock_jw):
classify_documents.<API key>(0, 'test')
assert mock_rfw.called
assert mock_rw.called
assert mock_jw.called
@patch('urbansearch.server.classify_documents._join_workers')
@patch('urbansearch.server.classify_documents.db_utils')
def <API key>(mock_db, mock_jw):
mock_db.connected_to_db.return_value = False
classify_documents.<API key>(0, None)
assert not mock_jw.called
def test_join_workers():
producers = [Mock()]
cworker = Mock()
consumers = [Mock()]
classify_documents._join_workers(cworker, producers, consumers)
for p in producers:
assert p.join.called
assert cworker.set_producers_done.called
for c in consumers:
assert c.join.called
assert cworker.<API key>.called
def <API key>():
producers = [Mock()]
cworker = Mock()
consumers = [Mock()]
classify_documents._join_file_workers(cworker, producers, consumers)
for p in producers:
assert p.join.called
assert cworker.<API key>.called
for c in consumers:
assert c.join.called
assert cworker.<API key>.called
|
#ifndef OM_CAMERA_H
#define OM_CAMERA_H
#include <inttypes.h>
// default pin assignments (nanomoco)
#define OM_DEFSHUTTER1 9 // Trigger 1 pin
#define OM_DEFSHUTTER2 8 // Trigger 2 pin
#define OM_DEFFOCUS1 11 // Focus 1 pin
#define OM_DEFFOCUS2 10 // Focus 2 pin
// callback status codes
#define OM_CAMEXP 1 // Camera exposure has begun
#define OM_CAM_EFIN 2 // Camera exposure has completed
#define OM_CAMFOC 3 // Camera focus has begun
#define OM_CAM_FFIN 4 // Camera focus has completed
#define OM_CAMWAIT 5 // (Exposure) delay has begun
#define OM_CAM_WFIN 6 // (Exposure) delay has completed
#define OM_CAM_INCLR 0 // Camera action is cleared
#define OM_CAM_INEXP 1 // Camera is currently exposing
#define OM_CAM_INFOC 2 // Camera is currently focusing
#define OM_CAM_INDLY 3 // Camera is currently idle
class OMCamera {
private:
unsigned long m_shotsFired;
static uint8_t m_shutter1;
static uint8_t m_shutter2;
static uint8_t m_focus1;
static uint8_t m_focus2;
unsigned long m_interval; // Camera interval in milliseconds
unsigned long m_timeExp;
unsigned int m_timeFoc;
unsigned int m_timeWait;
unsigned int m_maxShots;
bool m_focusShut;
static bool m_debug;
static uint8_t m_curAct;
static bool m_isBzy;
static void(*f_camSignal)(uint8_t);
void _init();
public:
OMCamera();
OMCamera(uint8_t c_shut, uint8_t c_foc);
static bool busy();
void setHandler(void(*)(uint8_t));
void setMaxShots(unsigned int shots);
unsigned int getMaxShots();
bool repeat;
bool enable;
void intervalTime(unsigned long p_interval);
unsigned long intervalTime();
void expose();
void expose(unsigned long p_time);
void triggerTime(unsigned long p_tm);
unsigned long triggerTime();
void exposureFocus(bool);
uint8_t exposureFocus();
void focus();
void focus(unsigned int p_time);
void focusTime(unsigned int p_tm);
unsigned int focusTime();
void wait();
void wait(unsigned int p_time);
void delayTime(unsigned int p_tm);
unsigned int delayTime();
static void stop();
static void debugOutput(bool p_state);
static bool debugOutput();
};
#endif
|
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using dnSpy.Contracts.Debugger;
using dnSpy.Contracts.Debugger.Breakpoints.Code;
using dnSpy.Contracts.Debugger.Code;
using dnSpy.Debugger.Impl;
namespace dnSpy.Debugger.Breakpoints.Code {
abstract class <API key> : <API key> {
public abstract void <API key>(bool newIsDebugging);
public abstract <API key>[] <API key>(IList<<API key>> boundBreakpoints);
public abstract void <API key>(IList<<API key>> boundBreakpoints);
public abstract <API key>[] <API key>(DbgRuntime runtime);
}
[Export(typeof(<API key>))]
[Export(typeof(<API key>))]
sealed class <API key> : <API key> {
readonly object lockObj;
readonly HashSet<<API key>> breakpoints;
readonly Dictionary<DbgCodeLocation, <API key>> <API key>;
readonly <API key> <API key>;
int breakpointId;
bool isDebugging;
public override event EventHandler<<API key>> <API key>;
internal <API key> DbgDispatcher => <API key>;
[<API key>]
<API key>(<API key> <API key>, [ImportMany] IEnumerable<Lazy<<API key>>> <API key>) {
lockObj = new object();
breakpoints = new HashSet<<API key>>();
<API key> = new Dictionary<DbgCodeLocation, <API key>>();
this.<API key> = <API key>;
breakpointId = 0;
isDebugging = false;
foreach (var lz in <API key>)
lz.Value.Initialize(this);
}
void Dbg(Action callback) => <API key>.Dbg(callback);
public override void Modify(<API key>[] settings) {
if (settings is null)
throw new <API key>(nameof(settings));
Dbg(() => ModifyCore(settings));
}
void ModifyCore(<API key>[] settings) {
<API key>.VerifyAccess();
List<<API key>>? updatedBreakpoints = null;
var bps = new List<<API key>>(settings.Length);
lock (lockObj) {
foreach (var info in settings) {
var bpImpl = info.Breakpoint as <API key>;
Debug.Assert(!(bpImpl is null));
if (bpImpl is null)
continue;
Debug.Assert(breakpoints.Contains(bpImpl));
if (!breakpoints.Contains(bpImpl))
continue;
var currentSettings = bpImpl.Settings;
if (currentSettings == info.Settings)
continue;
bps.Add(new <API key>(bpImpl, currentSettings));
if (bpImpl.<API key>(info.Settings)) {
if (updatedBreakpoints is null)
updatedBreakpoints = new List<<API key>>(settings.Length);
updatedBreakpoints.Add(bpImpl);
}
}
}
if (bps.Count > 0)
BreakpointsModified?.Invoke(this, new <API key>(new ReadOnlyCollection<<API key>>(bps)));
if (!(updatedBreakpoints is null)) {
foreach (var bp in updatedBreakpoints)
bp.<API key>();
<API key>?.Invoke(this, new <API key>(new ReadOnlyCollection<DbgCodeBreakpoint>(updatedBreakpoints.ToArray())));
}
}
public override event EventHandler<<API key>> BreakpointsModified;
public override event EventHandler<<API key><DbgCodeBreakpoint>> BreakpointsChanged;
public override DbgCodeBreakpoint[] Breakpoints {
get {
lock (lockObj)
return breakpoints.ToArray();
}
}
public override DbgCodeBreakpoint[] Add(<API key>[] breakpoints) {
if (breakpoints is null)
throw new <API key>(nameof(breakpoints));
var bpImpls = new List<<API key>>(breakpoints.Length);
List<DbgObject>? objsToClose = null;
lock (lockObj) {
for (int i = 0; i < breakpoints.Length; i++) {
var info = breakpoints[i];
var location = info.Location;
if (<API key>.ContainsKey(location)) {
if (objsToClose is null)
objsToClose = new List<DbgObject>();
objsToClose.Add(location);
}
else {
var bp = new <API key>(this, breakpointId++, info.Options, location, info.Settings, isDebugging);
bpImpls.Add(bp);
}
}
Dbg(() => AddCore(bpImpls, objsToClose));
}
return bpImpls.ToArray();
}
void AddCore(List<<API key>> breakpoints, List<DbgObject>? objsToClose) {
<API key>.VerifyAccess();
var added = new List<DbgCodeBreakpoint>(breakpoints.Count);
List<<API key>>? updatedBreakpoints = null;
lock (lockObj) {
foreach (var bp in breakpoints) {
Debug.Assert(!this.breakpoints.Contains(bp));
if (this.breakpoints.Contains(bp))
continue;
if (<API key>.ContainsKey(bp.Location)) {
if (objsToClose is null)
objsToClose = new List<DbgObject>();
objsToClose.Add(bp);
}
else {
added.Add(bp);
this.breakpoints.Add(bp);
<API key>.Add(bp.Location, bp);
if (bp.<API key>(isDebugging)) {
if (updatedBreakpoints is null)
updatedBreakpoints = new List<<API key>>(breakpoints.Count);
updatedBreakpoints.Add(bp);
}
}
}
}
if (!(objsToClose is null)) {
foreach (var obj in objsToClose)
obj.Close(<API key>.Dispatcher);
}
if (added.Count > 0)
BreakpointsChanged?.Invoke(this, new <API key><DbgCodeBreakpoint>(added, added: true));
if (!(updatedBreakpoints is null)) {
foreach (var bp in updatedBreakpoints)
bp.<API key>();
<API key>?.Invoke(this, new <API key>(new ReadOnlyCollection<DbgCodeBreakpoint>(updatedBreakpoints.ToArray())));
}
}
public override void Remove(DbgCodeBreakpoint[] breakpoints) {
if (breakpoints is null)
throw new <API key>(nameof(breakpoints));
Dbg(() => RemoveCore(breakpoints));
}
void RemoveCore(DbgCodeBreakpoint[] breakpoints) {
<API key>.VerifyAccess();
var removed = new List<DbgCodeBreakpoint>(breakpoints.Length);
lock (lockObj) {
foreach (var bp in breakpoints) {
var bpImpl = bp as <API key>;
Debug.Assert(!(bpImpl is null));
if (bpImpl is null)
continue;
if (!this.breakpoints.Contains(bpImpl))
continue;
removed.Add(bpImpl);
this.breakpoints.Remove(bpImpl);
bool b = <API key>.Remove(bpImpl.Location);
Debug.Assert(b);
}
}
if (removed.Count > 0) {
BreakpointsChanged?.Invoke(this, new <API key><DbgCodeBreakpoint>(removed, added: false));
foreach (var bp in removed)
bp.Close(<API key>.Dispatcher);
}
}
public override DbgCodeBreakpoint? TryGetBreakpoint(DbgCodeLocation location) {
if (location is null)
throw new <API key>(nameof(location));
lock (lockObj) {
if (<API key>.TryGetValue(location, out var bp))
return bp;
}
return null;
}
public override void Clear() => Dbg(() => RemoveCore(VisibleBreakpoints.ToArray()));
public override void <API key>(bool newIsDebugging) {
<API key>.VerifyAccess();
List<<API key>> updatedBreakpoints;
lock (lockObj) {
if (isDebugging == newIsDebugging)
return;
isDebugging = newIsDebugging;
updatedBreakpoints = new List<<API key>>(breakpoints.Count);
foreach (var bp in breakpoints) {
bool updated = bp.<API key>(isDebugging);
if (updated)
updatedBreakpoints.Add(bp);
}
}
foreach (var bp in updatedBreakpoints)
bp.<API key>();
if (updatedBreakpoints.Count > 0)
<API key>?.Invoke(this, new <API key>(new ReadOnlyCollection<DbgCodeBreakpoint>(updatedBreakpoints.ToArray())));
}
public override <API key>[] <API key>(IList<<API key>> boundBreakpoints) {
<API key>.VerifyAccess();
var dict = <API key>(boundBreakpoints);
var updatedBreakpoints = new List<(bool raiseMessageChanged, <API key> breakpoint, List<<API key>> boundBreakpoints)>(dict.Count);
List<<API key>>? <API key> = null;
lock (lockObj) {
foreach (var kv in dict) {
var bp = kv.Key;
if (breakpoints.Contains(bp)) {
bool raiseMessageChanged = bp.<API key>(kv.Value);
updatedBreakpoints.Add((raiseMessageChanged, bp, kv.Value));
}
else {
if (<API key> is null)
<API key> = new List<<API key>>();
<API key>.AddRange(kv.Value);
}
}
}
foreach (var info in updatedBreakpoints)
info.breakpoint.<API key>(info.raiseMessageChanged, info.boundBreakpoints, added: true);
if (updatedBreakpoints.Count > 0)
<API key>?.Invoke(this, new <API key>(new ReadOnlyCollection<DbgCodeBreakpoint>(updatedBreakpoints.Where(a => a.raiseMessageChanged).Select(a => a.breakpoint).ToArray())));
return <API key>?.ToArray() ?? Array.Empty<<API key>>();
}
public override void <API key>(IList<<API key>> boundBreakpoints) {
<API key>.VerifyAccess();
var dict = <API key>(boundBreakpoints);
var updatedBreakpoints = new List<(bool raiseMessageChanged, <API key> breakpoint, List<<API key>> boundBreakpoints)>(dict.Count);
lock (lockObj) {
foreach (var kv in dict) {
var bp = kv.Key;
if (breakpoints.Contains(bp)) {
bool raiseMessageChanged = bp.<API key>(kv.Value);
updatedBreakpoints.Add((raiseMessageChanged, bp, kv.Value));
}
}
}
foreach (var info in updatedBreakpoints)
info.breakpoint.<API key>(info.raiseMessageChanged, info.boundBreakpoints, added: false);
if (updatedBreakpoints.Count > 0)
<API key>?.Invoke(this, new <API key>(new ReadOnlyCollection<DbgCodeBreakpoint>(updatedBreakpoints.Where(a => a.raiseMessageChanged).Select(a => a.breakpoint).ToArray())));
}
static Dictionary<<API key>, List<<API key>>> <API key>(IList<<API key>> boundBreakpoints) {
int count = boundBreakpoints.Count;
var dict = new Dictionary<<API key>, List<<API key>>>(count);
for (int i = 0; i < boundBreakpoints.Count; i++) {
var bound = boundBreakpoints[i];
var bpImpl = bound.Breakpoint as <API key>;
Debug.Assert(!(bpImpl is null));
if (bpImpl is null)
continue;
if (!dict.TryGetValue(bpImpl, out var list))
dict.Add(bpImpl, list = new List<<API key>>());
list.Add(bound);
}
return dict;
}
public override <API key>[] <API key>(DbgRuntime runtime) {
<API key>.VerifyAccess();
var list = new List<<API key>>();
lock (lockObj) {
foreach (var bp in breakpoints) {
foreach (var boundBreakpoint in bp.BoundBreakpoints) {
if (boundBreakpoint.Runtime == runtime)
list.Add(boundBreakpoint);
}
}
}
var res = list.ToArray();
<API key>(res);
return res;
}
internal void <API key>(<API key> bp) {
<API key>.VerifyAccess();
bp.<API key>();
<API key>?.Invoke(this, new <API key>(new ReadOnlyCollection<DbgCodeBreakpoint>(new[] { bp })));
}
}
}
|
#-*- coding:utf-8 -*-
from findbilibili import *
#funtion name [checkinfo]
#param array
#return string
def checkinfo2(content):
content[1] = content[1].decode('gbk')
key = content[1].encode('utf-8')
if key == '':
return ''
result = animation(key)
return result
#funtion name [animation]
#param array
#return string
def animation(name):
url = bilibili(name)
try:
result = 'bilibili:'+url[-1][0]+''+url[-1][1]
return result
except IndexError:
return ''
|
# umte
# "uber minimal text editor"
A lightweight python gtk3 text editor.

## Features
* Basic text editor functionality
* Syntax highlighting
* Line numbers
* (in progress)Terminal bottom-window
## Requirements
* *Python 3.1 or higher*
* Gtk3 shtuff
|
<?
// If the form told us to generate a route or if this was a pending entry, re-generate a route.
if ($data[$key] == "generate" || (isset($edit_id) && !is_numeric($edit_id))) {
if ($options["not_unique"]) {
$value = $cms->urlify(strip_tags($data[$options["source"]]));
} else {
$oroute = $cms->urlify(strip_tags($data[$options["source"]]));
$value = $oroute;
$x = 2;
while (sqlrows(sqlquery("SELECT * FROM `".$form["table"]."` WHERE `$key` = '".sqlescape($value)."' AND id != '".sqlescape($_POST["id"])."'"))) {
$value = $oroute."-".$x;
$x++;
}
}
} else {
$no_process = true;
}
?>
|
package qa.AnswerFormation;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Queue;
import qa.IQuestion;
import qa.Utility;
/**
* @author Deepak
*
*/
public class AnswerGenerator implements IAnswerGenerator {
/**
*
* @param <API key>
*/
public AnswerGenerator(Queue<IQuestion> <API key>, List<IQuestion> processedQuestions) {
this.<API key> = <API key>;
this.processedQuestions = processedQuestions;
}
@Override
public void run() {
while(!<API key>.isEmpty() || !Utility.<API key>) {
IQuestion question = <API key>.poll();
if(question == null) continue;
HashSet<String> answers = new HashSet<String>();
for(String passage : question.getRelevantPassages()) {
List<String> output = new ArrayList<String>();
String <API key> = null;
String nerTaggedPassage = Utility.getNERTagging(passage);
String posTaggedPassage = Utility.getPOSTagging(passage);
output.addAll(getDataFromOutput(nerTaggedPassage, question.getAnswerTypes()));
output.addAll(getDataFromOutput(posTaggedPassage, question.getAnswerTypes()));
for(String answer : output) {
if(!question.getQuestion().toLowerCase().contains(answer.toLowerCase()) && !answers.contains(answer)) {
answers.add(answer);
<API key> = Utility.removeKeywords(answer, question.getKeywords());
question.addAnswer(<API key>);
}
}
}
for(String passage : question.getRelevantPassages()) {
List<String> output = new ArrayList<String>();
String <API key> = null;
if(answers.size() >= 10) break;
try{
output.addAll(Utility.getNounPhrases(passage, false));
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
for(String answer : output) {
if(!question.getQuestion().toLowerCase().contains(answer.toLowerCase()) && !answers.contains(answer)) {
answers.add(answer);
<API key> = Utility.removeKeywords(answer, question.getKeywords());
question.addAnswer(<API key>);
}
}
}
// for(String answer : answers) {
// boolean flag = true;
// for(String answer1 : answers) {
// if(!answer.equals(answer1)) {
// if(answer1.toLowerCase().contains(answer.toLowerCase())) {
// flag = false;
// break;
// if(flag) {
// question.addAnswer(answer);
this.processedQuestions.add(question);
}
AnswerWriter writer = new AnswerWriter("answer.txt");
writer.writeAnswers(processedQuestions);
}
/**
*
* @param output
* @param tagName
* @return
*/
private List<String> getDataFromOutput(String output, String tagName) {
List<String> answers = new ArrayList<String>();
StringBuilder temp = new StringBuilder();
String[] outputArray = output.split("[/_\\s]");
String[] tags = tagName.split("\\|");
for(String tag : tags) {
if(tag == null || tag.equals("")) continue;
String[] tagsArray = tag.split(":");
for(int arrayIndex = 1; arrayIndex < outputArray.length; arrayIndex+=2) {
if(outputArray[arrayIndex].trim().equals(tagsArray[1].trim())) {
temp.append(outputArray[arrayIndex - 1] + " ");
} else {
if(!temp.toString().equals("")) {
answers.add(temp.toString().trim());
}
temp = new StringBuilder();
}
}
if(!temp.toString().equals("") ) {
answers.add(temp.toString().trim());
}
}
return answers;
}
private Queue<IQuestion> <API key>;
private List<IQuestion> processedQuestions;
}
|
#pragma once
#include <libide-foundry.h>
G_BEGIN_DECLS
#define <API key> (<API key>())
<API key> (GbpFlatpakRunner, gbp_flatpak_runner, GBP, FLATPAK_RUNNER, IdeRunner)
GbpFlatpakRunner *<API key> (IdeContext *context,
const gchar *build_path,
IdeBuildTarget *build_target,
const gchar *manifest_command);
G_END_DECLS
|
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_25) on Wed Feb 01 21:06:23 MST 2012 -->
<TITLE>
API Help
</TITLE>
<META NAME="date" CONTENT="2012-02-01">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="API Help";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="index.html?help-doc.html" target="_top"><B>FRAMES</B></A>
<A HREF="help-doc.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<CENTER>
<H1>
How This API Document Is Organized</H1>
</CENTER>
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.<H3>
Overview</H3>
<BLOCKQUOTE>
<P>
The <A HREF="overview-summary.html">Overview</A> page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.</BLOCKQUOTE>
<H3>
Package</H3>
<BLOCKQUOTE>
<P>
Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:<UL>
<LI>Interfaces (italic)<LI>Classes<LI>Enums<LI>Exceptions<LI>Errors<LI>Annotation Types</UL>
</BLOCKQUOTE>
<H3>
Class/Interface</H3>
<BLOCKQUOTE>
<P>
Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:<UL>
<LI>Class inheritance diagram<LI>Direct Subclasses<LI>All Known Subinterfaces<LI>All Known Implementing Classes<LI>Class/interface declaration<LI>Class/interface description
<P>
<LI>Nested Class Summary<LI>Field Summary<LI>Constructor Summary<LI>Method Summary
<P>
<LI>Field Detail<LI>Constructor Detail<LI>Method Detail</UL>
Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.</BLOCKQUOTE>
</BLOCKQUOTE>
<H3>
Annotation Type</H3>
<BLOCKQUOTE>
<P>
Each annotation type has its own separate page with the following sections:<UL>
<LI>Annotation Type declaration<LI>Annotation Type description<LI>Required Element Summary<LI>Optional Element Summary<LI>Element Detail</UL>
</BLOCKQUOTE>
</BLOCKQUOTE>
<H3>
Enum</H3>
<BLOCKQUOTE>
<P>
Each enum has its own separate page with the following sections:<UL>
<LI>Enum declaration<LI>Enum description<LI>Enum Constant Summary<LI>Enum Constant Detail</UL>
</BLOCKQUOTE>
<H3>
Use</H3>
<BLOCKQUOTE>
Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.</BLOCKQUOTE>
<H3>
Tree (Class Hierarchy)</H3>
<BLOCKQUOTE>
There is a <A HREF="overview-tree.html">Class Hierarchy</A> page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with <code>java.lang.Object</code>. The interfaces do not inherit from <code>java.lang.Object</code>.<UL>
<LI>When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.<LI>When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.</UL>
</BLOCKQUOTE>
<H3>
Deprecated API</H3>
<BLOCKQUOTE>
The <A HREF="deprecated-list.html">Deprecated API</A> page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.</BLOCKQUOTE>
<H3>
Index</H3>
<BLOCKQUOTE>
The <A HREF="index-files/index-1.html">Index</A> contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.</BLOCKQUOTE>
<H3>
Prev/Next</H3>
These links take you to the next or previous class, interface, package, or related page.<H3>
Frames/No Frames</H3>
These links show and hide the HTML frames. All pages are available with or without frames.
<P>
<H3>
Serialized Form</H3>
Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
<P>
<H3>
Constant Field Values</H3>
The <a href="constant-values.html">Constant Field Values</a> page lists the static final fields and their values.
<P>
<FONT SIZE="-1">
<EM>
This help file applies to API documentation generated using the standard doclet.</EM>
</FONT>
<BR>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="index.html?help-doc.html" target="_top"><B>FRAMES</B></A>
<A HREF="help-doc.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
</BODY>
</HTML>
|
#ifndef MININIM_BRICKS_H
#define MININIM_BRICKS_H
/* dungeon vga */
#define DV_BRICKS_00 "data/bricks/dv-00.png"
#define DV_BRICKS_01 "data/bricks/dv-01.png"
#define DV_BRICKS_02 "data/bricks/dv-02.png"
#define DV_BRICKS_03 "data/bricks/dv-03.png"
/* palace vga */
#define PV_BRICKS_00 "data/bricks/pv-00.png"
#define PV_BRICKS_01 "data/bricks/pv-01.png"
void load_bricks (void);
void unload_bricks (void);
void draw_bricks_00 (ALLEGRO_BITMAP *bitmap, struct pos *p,
enum em em, enum vm vm);
void draw_bricks_01 (ALLEGRO_BITMAP *bitmap, struct pos *p,
enum em em, enum vm vm);
void draw_bricks_02 (ALLEGRO_BITMAP *bitmap, struct pos *p,
enum em em, enum vm vm);
void draw_bricks_03 (ALLEGRO_BITMAP *bitmap, struct pos *p,
enum em em, enum vm vm);
#endif /* MININIM_BRICKS_H */
|
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
__author__ = """Co-Pierre Georg (co-pierre.georg@uct.ac.za)"""
import sys
from src.paralleltools import Parallel
# conftools.py is a simple module to manage .xml configuration files
if __name__ == '__main__':
"""
VARIABLES
"""
args = sys.argv
config_file_name = args[1]
"""
CODE
"""
parallel = Parallel()
parallel.create_config_files(config_file_name)
|
layout: default
{{> h2 text='Clickdummy'}}
{{> h3 text='Lucom Formularmanager'}}
<ul>
<li>
<a href="site/referenzformular.html" title="Referenzformular">Referenzformular</a>
</li>
<li>
<a href="test.html" title="Testseite">Test</a>
</li>
</ul>
|
// File__Duplicate - Duplication of some formats
// This library is free software: you can redistribute it and/or modify it
// any later version.
// This library is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Duplication helper for some specific formats
// Pre-compilation
#include "MediaInfo/PreComp.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "MediaInfo/Setup.h"
#if defined(MEDIAINFO_AVC_YES)
#include "MediaInfo/Video/File_Avc.h"
#include "MediaInfo/MediaInfo_Config.h"
#include "MediaInfo/<API key>.h"
#include "ZenLib/ZtringList.h"
#include "ZenLib/File.h"
#include <cstring>
using namespace ZenLib;
using namespace std;
namespace MediaInfoLib
{
|
(function(){function w(a){for(var f=0,p=0,n=0,q,d=a.$.rows.length;n<d;n++){q=a.$.rows[n];for(var e=f=0,b,c=q.cells.length;e<c;e++)b=q.cells[e],f+=b.colSpan;f>p&&(p=f)}return p}function t(a){return function(){var f=this.getValue(),f=!!(CKEDITOR.dialog.validate.integer().call(this,f)&&0<f);f||(alert(a),this.select());return f}}function r(a,f){var p=function(d){return new CKEDITOR.dom.element(d,a.document)},r=a.editable(),q=a.plugins.dialogadvtab;return{title:a.lang.table.title,minWidth:310,minHeight:CKEDITOR.env.ie?
310:280,getModel:function(d){return"tableProperties"!==this.dialog.getName()?null:(d=(d=d.getSelection())&&d.getRanges()[0])?d._getTableElement({table:1}):null},onLoad:function(){var d=this,a=d.getContentElement("advanced","advStyles");if(a)a.on("change",function(){var a=this.getStyle("width",""),c=d.getContentElement("info","txtWidth");c&&c.setValue(a,!0);a=this.getStyle("height","");(c=d.getContentElement("info","txtHeight"))&&c.setValue(a,!0)})},onShow:function(){var d=a.getSelection(),e=d.getRanges(),
b,c=this.getContentElement("info","txtRows"),h=this.getContentElement("info","txtCols"),u=this.getContentElement("info","txtWidth"),l=this.getContentElement("info","txtHeight");"tableProperties"==f&&((d=d.getSelectedElement())&&d.is("table")?b=d:0<e.length&&(CKEDITOR.env.webkit&&e[0].shrink(CKEDITOR.NODE_ELEMENT),b=a.elementPath(e[0].getCommonAncestor(!0)).contains("table",1)),this._.selectedElement=b);b?(this.setupContent(b),c&&c.disable(),h&&h.disable()):(c&&c.enable(),h&&h.enable());u&&u.onChange();
l&&l.onChange()},onOk:function(){var d=a.getSelection(),e=this._.selectedElement&&d.createBookmarks(),b=this._.selectedElement||p("table"),c={};this.commitContent(c,b);if(c.info){c=c.info;if(!this._.selectedElement)for(var h=b.append(p("tbody")),f=parseInt(c.txtRows,10)||0,l=parseInt(c.txtCols,10)||0,k=0;k<f;k++)for(var g=h.append(p("tr")),m=0;m<l;m++)g.append(p("td")).appendBogus();f=c.selHeaders;if(!b.$.tHead&&("row"==f||"both"==f)){g=b.getElementsByTag("thead").getItem(0);h=b.getElementsByTag("tbody").getItem(0);
l=h.getElementsByTag("tr").getItem(0);g||(g=new CKEDITOR.dom.element("thead"),g.insertBefore(h));for(k=0;k<l.getChildCount();k++)h=l.getChild(k),h.type!=CKEDITOR.NODE_ELEMENT||h.data("cke-bookmark")||(h.renameNode("th"),h.setAttribute("scope","col"));g.append(l.remove())}if(null!==b.$.tHead&&"row"!=f&&"both"!=f){g=new CKEDITOR.dom.element(b.$.tHead);for(h=b.getElementsByTag("tbody").getItem(0);0<g.getChildCount();){l=g.getFirst();for(k=0;k<l.getChildCount();k++)m=l.getChild(k),m.type==CKEDITOR.NODE_ELEMENT&&
(m.renameNode("td"),m.removeAttribute("scope"));h.append(l,!0)}g.remove()}if(!this.hasColumnHeaders&&("col"==f||"both"==f))for(g=0;g<b.$.rows.length;g++)m=new CKEDITOR.dom.element(b.$.rows[g].cells[0]),m.renameNode("th"),m.setAttribute("scope","row");if(this.hasColumnHeaders&&"col"!=f&&"both"!=f)for(k=0;k<b.$.rows.length;k++)g=new CKEDITOR.dom.element(b.$.rows[k]),"tbody"==g.getParent().getName()&&(m=new CKEDITOR.dom.element(g.$.cells[0]),m.renameNode("td"),m.removeAttribute("scope"));c.txtHeight?
b.setStyle("height",c.txtHeight):b.removeStyle("height");c.txtWidth?b.setStyle("width",c.txtWidth):b.removeStyle("width");b.getAttribute("style")||b.removeAttribute("style")}if(this._.selectedElement)try{d.selectBookmarks(e)}catch(n){}else a.insertElement(b),setTimeout(function(){var d=new CKEDITOR.dom.element(b.$.rows[0].cells[0]),c=a.createRange();c.moveToPosition(d,CKEDITOR.<API key>);c.select()},0)},contents:[{id:"info",label:a.lang.table.title,elements:[{type:"hbox",widths:[null,null],
styles:["vertical-align:top"],children:[{type:"vbox",padding:0,children:[{type:"text",id:"txtRows","default":3,label:a.lang.table.rows,required:!0,controlStyle:"width:5em",validate:t(a.lang.table.invalidRows),setup:function(d){this.setValue(d.$.rows.length)},commit:n},{type:"text",id:"txtCols","default":2,label:a.lang.table.columns,required:!0,controlStyle:"width:5em",validate:t(a.lang.table.invalidCols),setup:function(d){this.setValue(w(d))},commit:n},{type:"html",html:"\x26nbsp;"},{type:"select",
id:"selHeaders",requiredContent:"th","default":"",label:a.lang.table.headers,items:[[a.lang.table.headersNone,""],[a.lang.table.headersRow,"row"],[a.lang.table.headersColumn,"col"],[a.lang.table.headersBoth,"both"]],setup:function(d){var a=this.getDialog();a.hasColumnHeaders=!0;for(var b=0;b<d.$.rows.length;b++){var c=d.$.rows[b].cells[0];if(c&&"th"!=c.nodeName.toLowerCase()){a.hasColumnHeaders=!1;break}}null!==d.$.tHead?this.setValue(a.hasColumnHeaders?"both":"row"):this.setValue(a.hasColumnHeaders?
"col":"")},commit:n},{type:"text",id:"txtBorder",requiredContent:"table[border]","default":a.filter.check("table[border]")?1:0,label:a.lang.table.border,controlStyle:"width:3em",validate:CKEDITOR.dialog.validate.number(a.lang.table.invalidBorder),setup:function(d){this.setValue(d.getAttribute("border")||"")},commit:function(d,a){this.getValue()?a.setAttribute("border",this.getValue()):a.removeAttribute("border")}},{id:"cmbAlign",type:"select",requiredContent:"table[align]","default":"",label:a.lang.common.align,
items:[[a.lang.common.notSet,""],[a.lang.common.left,"left"],[a.lang.common.center,"center"],[a.lang.common.right,"right"]],setup:function(a){this.setValue(a.getAttribute("align")||"")},commit:function(a,e){this.getValue()?e.setAttribute("align",this.getValue()):e.removeAttribute("align")}}]},{type:"vbox",padding:0,children:[{type:"hbox",widths:["5em"],children:[{type:"text",id:"txtWidth",requiredContent:"table{width}",controlStyle:"width:5em",label:a.lang.common.width,title:a.lang.common.cssLengthTooltip,
"default":a.filter.check("table{width}")?500>r.getSize("width")?"100%":500:0,getValue:v,validate:CKEDITOR.dialog.validate.cssLength(a.lang.common.invalidCssLength.replace("%1",a.lang.common.width)),onChange:function(){var a=this.getDialog().getContentElement("advanced","advStyles");a&&a.updateStyle("width",this.getValue())},setup:function(a){a=a.getStyle("width");this.setValue(a)},commit:n}]},{type:"hbox",widths:["5em"],children:[{type:"text",id:"txtHeight",requiredContent:"table{height}",controlStyle:"width:5em",
label:a.lang.common.height,title:a.lang.common.cssLengthTooltip,"default":"",getValue:v,validate:CKEDITOR.dialog.validate.cssLength(a.lang.common.invalidCssLength.replace("%1",a.lang.common.height)),onChange:function(){var a=this.getDialog().getContentElement("advanced","advStyles");a&&a.updateStyle("height",this.getValue())},setup:function(a){(a=a.getStyle("height"))&&this.setValue(a)},commit:n}]},{type:"html",html:"\x26nbsp;"},{type:"text",id:"txtCellSpace",requiredContent:"table[cellspacing]",
controlStyle:"width:3em",label:a.lang.table.cellSpace,"default":a.filter.check("table[cellspacing]")?1:0,validate:CKEDITOR.dialog.validate.number(a.lang.table.invalidCellSpacing),setup:function(a){this.setValue(a.getAttribute("cellSpacing")||"")},commit:function(a,e){this.getValue()?e.setAttribute("cellSpacing",this.getValue()):e.removeAttribute("cellSpacing")}},{type:"text",id:"txtCellPad",requiredContent:"table[cellpadding]",controlStyle:"width:3em",label:a.lang.table.cellPad,"default":a.filter.check("table[cellpadding]")?
1:0,validate:CKEDITOR.dialog.validate.number(a.lang.table.invalidCellPadding),setup:function(a){this.setValue(a.getAttribute("cellPadding")||"")},commit:function(a,e){this.getValue()?e.setAttribute("cellPadding",this.getValue()):e.removeAttribute("cellPadding")}}]}]},{type:"html",align:"right",html:""},{type:"vbox",padding:0,children:[{type:"text",id:"txtCaption",requiredContent:"caption",label:a.lang.table.caption,setup:function(a){this.enable();a=a.getElementsByTag("caption");if(0<a.count()){a=
a.getItem(0);var e=a.getFirst(CKEDITOR.dom.walker.nodeType(CKEDITOR.NODE_ELEMENT));e&&!e.equals(a.getBogus())?(this.disable(),this.setValue(a.getText())):(a=CKEDITOR.tools.trim(a.getText()),this.setValue(a))}},commit:function(d,e){if(this.isEnabled()){var b=this.getValue(),c=e.getElementsByTag("caption");if(b)0<c.count()?(c=c.getItem(0),c.setHtml("")):(c=new CKEDITOR.dom.element("caption",a.document),e.append(c,!0)),c.append(new CKEDITOR.dom.text(b,a.document));else if(0<c.count())for(b=c.count()-
1;0<=b;b--)c.getItem(b).remove()}}},{type:"text",id:"txtSummary",bidi:!0,requiredContent:"table[summary]",label:a.lang.table.summary,setup:function(a){this.setValue(a.getAttribute("summary")||"")},commit:function(a,e){this.getValue()?e.setAttribute("summary",this.getValue()):e.removeAttribute("summary")}}]}]},q&&q.createAdvancedTab(a,null,"table")]}}var v=CKEDITOR.tools.cssLength,n=function(a){var f=this.id;a.info||(a.info={});a.info[f]=this.getValue()};CKEDITOR.dialog.add("table",function(a){return r(a,
"table")});CKEDITOR.dialog.add("tableProperties",function(a){return r(a,"tableProperties")})})();
|
package com.wisecityllc.cookedapp.fragments;
import android.app.Activity;
import android.support.v4.app.Fragment;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.parse.ParseQueryAdapter;
import com.segment.analytics.Analytics;
import com.wisecityllc.cookedapp.R;
import com.wisecityllc.cookedapp.adapters.AlertWallAdapter;
import com.wisecityllc.cookedapp.parseClasses.Message;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link AlertsFragment.<API key>} interface
* to handle interaction events.
* Use the {@link AlertsFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class AlertsFragment extends Fragment {
public static final String ALERTS_SCREEN = "AlertsScreen";
private boolean mHasMadeInitialLoad = false;
private AlertWallAdapter mAlertsAdapter;
private ListView mAlertsListView;
private TextView mNoAlertsTextView;
private ProgressBar mLoadingIndicator;
public static AlertsFragment newInstance() {
AlertsFragment fragment = new AlertsFragment();
return fragment;
}
public AlertsFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_alerts, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mLoadingIndicator = (ProgressBar) view.findViewById(R.id.<API key>);
mAlertsAdapter = new AlertWallAdapter(this.getActivity());
mAlertsAdapter.<API key>(new ParseQueryAdapter.OnQueryLoadListener<Message>() {
@Override
public void onLoading() {
mAlertsListView.setVisibility(View.GONE);
mLoadingIndicator.setVisibility(View.VISIBLE);
mNoAlertsTextView.setVisibility(View.GONE);
}
@Override
public void onLoaded(List<Message> list, Exception e) {
mLoadingIndicator.setVisibility(View.GONE);
mNoAlertsTextView.setVisibility(e != null || list == null || list.isEmpty() ? View.VISIBLE : View.GONE);
mAlertsListView.setVisibility(View.VISIBLE);
}
});
if(mAlertsListView == null){
mAlertsListView = (ListView)view.findViewById(R.id.alerts_list_view);
}
mNoAlertsTextView = (TextView) view.findViewById(R.id.<API key>);
// mAlertsListView.<API key>(this);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement <API key>");
}
}
@Override
public void onDetach() {
super.onDetach();
}
public interface <API key> {
// TODO: Update argument type and name
public void <API key>(Uri uri);
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if(isVisibleToUser) {
// Has become visible
Analytics.with(getActivity()).screen(null, ALERTS_SCREEN);
// Delay our loading until we become visible
if(mHasMadeInitialLoad == false && mAlertsAdapter != null) {
mAlertsListView.setAdapter(mAlertsAdapter);
mHasMadeInitialLoad = true;
}
}
}
}
|
#include "keysgeneratorwidget.h"
#include "<API key>.h"
#include "../Global/keygenerator.h"
#include "../Global/keyvalidator.h"
#include <QMessageBox>
KeysGeneratorWidget::KeysGeneratorWidget(QWidget *parent) :
QWidget(parent), ui(new Ui::KeysGeneratorWidget)
{
ui->setupUi(this);
model = new QSqlTableModel;
model->setTable("GeneratedTable");
model->select();
ui->tableView->setModel(model);
ui->tableView-><API key>(true);
ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableView-><API key>(QAbstractItemView::SelectRows);
ui->tableView-><API key>(1);
ui->tableView-><API key>(0);
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
}
KeysGeneratorWidget::~KeysGeneratorWidget()
{
delete ui;
}
void KeysGeneratorWidget:: <API key>() {
QString time = getTime();
QString id = getNextId();
QString constantNumber = "853023";
QString key = KeyGenerator::generateKey(time, id, constantNumber);
if ( !key.endsWith("+") && KeyValidator::validate(key) ) {
ui->serialLineEdit->setText(key);
}
}
void KeysGeneratorWidget::<API key>() {
int count = 0;
for (int i=0; i<100 ; i++ ){
QString time = getTime();
QString id = getNextId();
QString constantNumber = "853023";
QString key = KeyGenerator::generateKey(time, id, constantNumber);
if ( KeyValidator::validate(key) ) {
ui->serialLineEdit->setText(key);
if ( ! existKey (key) && ! key.endsWith("+") ) {
QSqlQuery query;
QString time = QDate::currentDate().toString();
if ( query.exec("insert into GeneratedTable(serial, generateTime) values('" + key + "' , '" + time +"')") ) {
qDebug() << "key: " << key;
count++;
}
}
}
}
qDebug() << "Number of Key Saved: " << count;
}
void KeysGeneratorWidget::<API key>() {
QString key = ui->serialLineEdit->text();
if ( KeyValidator::validate(key) ) {
if ( ! existKey (key) && ! key.endsWith("+") ) {
QSqlQuery query;
QString time = QDate::currentDate().toString();
if ( query.exec("insert into GeneratedTable(serial, generateTime) values('" + key + "' , '" + time +"')") )
QMessageBox::information(this,"inserting Ok","inserting Ok");
else
QMessageBox::warning(this,"cannot inserting key","cannot inserting key");
}
else {
QMessageBox::warning(this,"Key existing in DB","Key existing in DB");
}
}
else {
QMessageBox::warning(this,"is not valid key", key + " is not valid key");
}
model->select();
}
void KeysGeneratorWidget::<API key>() {
int no = model->index(ui->tableView->currentIndex().row(),0).data().toInt();
QSqlQuery query;
query.prepare("DELETE FROM GeneratedTable WHERE id = ?");
query.addBindValue(no);
query.exec();
model->select();
}
bool KeysGeneratorWidget:: existKey (QString key) {
QSqlQuery query;
query.prepare("SELECT * FROM GeneratedTable WHERE serial = ?");
query.addBindValue(key);
query.exec();
while (query.next()) {
return true;
}
return false;
}
QString KeysGeneratorWidget:: getTime () {
QTime time = QTime::currentTime();
QString result = QString::number(time.msec());
return result;
}
QString KeysGeneratorWidget:: getNextId () {
QString id = getRandomChars(5);
return id;
}
QString KeysGeneratorWidget:: getRandomChars (int length) {
int difference = 'Z'-'A';
QString result = "";
for (int i=0; i<length; i++) {
char c = 'A' + ( rand() % difference );
result += c ;
}
return result;
}
|
#define CONFIDENCE_LEVEL 68.0 // 68% confidence level used throughout
// 2D ellipse
typedef struct {
double az1, len1; // semi-minor axis km
double len2; // semi-major axis km
} Ellipse2D;
#define DELTA_CHI_SQR_68_2 2.30 // value for 68% conf (see Num Rec, 2nd ed, sec 15.6, table)
// 3D ellipsoid
typedef struct {
double az1, dip1, len1; // semi-minor axis km
double az2, dip2, len2; // semi-intermediate axis km
double len3; // semi-major axis km
double az3, dip3; // 20150601 AJL - semi-major axis az and dip added to support conversion to QuakeML Tait-Bryan representation
} Ellipsoid3D;
#define DELTA_CHI_SQR_68_3 3.53 // value for 68% conf (see Num Rec, 2nd ed, sec 15.6, table)
char *<API key>();
Vect3D <API key>(float*, int);
Vect3D <API key>(float* fdata, int nSamples);
Vect3D <API key>(float* fdata, int nSamples, double xReference);
Vect3D <API key>(float* fdata, int nSamples, double xReference);
Mtrx3D <API key>(float* fdata, int nSamples, Vect3D* pexpect);
Mtrx3D <API key>(float* fdata, int nSamples, Vect3D* pexpect);
Mtrx3D <API key>(float* fdata, int nSamples, Vect3D* pexpect);
Ellipsoid3D CalcErrorEllipsoid(Mtrx3D *, double);
Ellipse2D <API key>(Mtrx3D *pcov, double del_chi_2);
void ellipsiod2Axes(Ellipsoid3D *, Vect3D *, Vect3D *, Vect3D *);
void <API key>(Ellipsoid3D *pellipsoid,
double* <API key>, double* pmajorAxisPlunge, double* pmajorAxisAzimuth,
double* <API key>, double* <API key>, double* <API key>,
double* <API key>);
int <API key>(Ellipsoid3D *pellipsoid,
double* <API key>,
double* <API key>,
double* <API key>,
double* pmajorAxisAzimuth,
double* pmajorAxisPlunge,
double* pmajorAxisRotation);
|
<?php
require "funciones.php";
CopiarArchivo($_REQUEST["txtRuta"]);
?>
|
package org.aslab.om.metacontrol.action;
import java.util.HashSet;
import java.util.Set;
import org.aslab.om.ecl.action.Action;
import org.aslab.om.ecl.action.ActionFeedback;
import org.aslab.om.ecl.action.ActionResult;
import org.aslab.om.metacontrol.value.CompGoalAtomTracker;
/**
* <!-- begin-UML-doc -->
* <!-- end-UML-doc -->
* @author chcorbato
* @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public class FunctionalAction extends Action {
/**
* <!-- begin-UML-doc -->
* number of ever issued action_list (this way a new number is assigned to everyone upon creation)
* <!-- end-UML-doc -->
* @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
private static short num_of_actions = 0;
@Override
protected short addAction(){
return num_of_actions++;
}
/**
* <!-- begin-UML-doc -->
* <!-- end-UML-doc -->
* @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public Set<CompGoalAtomTracker> atoms = new HashSet<CompGoalAtomTracker>();
/**
* <!-- begin-UML-doc -->
* <!-- end-UML-doc -->
* @param a
* @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public FunctionalAction(Set<CompGoalAtomTracker> a) {
// begin-user-code
atoms = a;
// end-user-code
}
@Override
public ActionResult processResult(ActionFeedback feedback) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean timeOut() {
// TODO Auto-generated method stub
return false;
}
}
|
$(function() {
$("#childGrid").jqGrid(
{
url : "TBCcnsizePrm.html?getGridData",datatype : "json",mtype : "GET",colNames : [ 'Conn Id',getLocalMessage('water.connsize.frmDt'), getLocalMessage('water.connsize.toDt'), getLocalMessage('water.connsize.frm'),getLocalMessage('water.connsize.to'), getLocalMessage('edit.msg'), getLocalMessage('master.view')],
colModel : [ {name : "cnsId",width : 10,sortable : false,searchoptions: { "sopt": [ "eq"] }},
{name : "cnsFrmdt",width : 20,sortable : true,searchoptions: { "sopt": ["bw", "eq"] },formatter : dateTemplate},
{name : "cnsTodt",width : 20,sortable : true, searchoptions: { "sopt": ["bw", "eq"] },formatter : dateTemplate},
{name : "cnsFrom",width : 20,sortable : false,searchoptions: { "sopt": [ "eq"] }},
{name : "cnsTo",width : 20,sortable : false,searchoptions: { "sopt": [ "eq"] }},
{name : 'cnsId',index : 'cnsId',width : 20,align : 'center',formatter : returnEditUrl,editoptions : {value : "Yes:No"},formatoptions : {disabled : false},search:false },
{name : 'cnsId',index : 'cnsId',width : 20,align : 'center',formatter : returnViewUrl,editoptions : {value : "Yes:No"},formatoptions : {disabled : false},search:false}
],
pager : "#pagered",
rowNum : 30,
rowList : [ 5, 10, 20, 30 ],
sortname : "dsgid",
sortorder : "desc",
height : 'auto',
viewrecords : true,
gridview : true,
loadonce : true,
jsonReader : {
root : "rows",
page : "page",
total : "total",
records : "records",
repeatitems : false,
},
autoencode : true,
caption : getLocalMessage('water.connsize.gridTtl')
});
jQuery("#grid").jqGrid('navGrid','#pagered',{edit:false,add:false,del:false,search:true,refresh:false});
$("#pagered_left").css("width", "");
});
function returnEditUrl(cellValue, options, rowdata, action) {
return "<a href='#' return false; class='editClass' value='"+rowdata.cnsId+"' ><img src='css/images/edit.png' width='20px' alt='Edit Charge Master' title='Edit Scrutiny Data' /></a>";
}
function returnViewUrl(cellValue, options, rowdata, action) {
return "<a href='#' return false; class='viewConnectionClass' value='"+rowdata.cnsId+"'><img src='css/images/grid/view-icon.png' width='20px' alt='View Master' title='View Master' /></a>";
}
function returnisdeletedUrl(cellValue, options, rowdata, action) {
if (rowdata.isdeleted == '0') {
return "<a href='#' class='fa fa-check-circle fa-2x green ' value='"+rowdata.isdeleted+"' alt='Designation is Active' title='Designation is Active'></a>";
} else {
return "<a href='#' class='fa fa-times-circle fa-2x red ' value='"+rowdata.isdeleted+"' alt='Designation is INActive' title='Designation is InActive'></a>";
}
}
$(function() {
$(document)
.on('click','.addConnectionClass',function() {
var $link = $(this);
var cnsId = $link.closest('tr').find('td:eq(0)').text();
var url = "TBCcnsizePrm.html?formForUpdate";
var requestData = "cnsId=" + cnsId + "&MODE1=" + "EDIT";
var returnData =__doAjaxRequest(url,'post',requestData,false);
$('.content').html(returnData);
prepareDateTag();
});
});
$(function() {
$(document).on('click', '.editClass', function() {
var $link = $(this);
var cnsId = $link.closest('tr').find('td:eq(0)').text();
var url = "TBCcnsizePrm.html?formForUpdate";
var requestData = "cnsId=" + cnsId + "&MODE1=" + "EDIT";
var returnData =__doAjaxRequest(url,'post',requestData,false);
$('.content').html(returnData);
prepareDateTag();
});
});
$(function() {
$(document).on('click', '.viewConnectionClass', function() {
var $link = $(this);
var cnsId = $link.closest('tr').find('td:eq(0)').text();
var url = "TBCcnsizePrm.html?formForUpdate";
var requestData = "cnsId=" + cnsId + "&MODE1=" + "VIEW";
var returnData =__doAjaxRequest(url,'post',requestData,false);
$('.content').html(returnData);
prepareDateTag();
});
});
/*ADD Form*/
function <API key>(obj){
return saveOrUpdateForm(obj, 'Saved Successfully', 'TBCcnsizePrm.html', 'create');
}
function <API key>(obj){
return saveOrUpdateForm(obj, 'Saved Successfully', 'TBCcnsizePrm.html', 'update');
}
function showConfirmBox(){
var errMsgDiv = '.msg-dialog-box';
var message='';
var cls = 'Yes';
message +='<p>Record Saved Successfully..</p>';
message +='<p style=\'text-align:center;margin: 5px;\'>'+
'<br/><input type=\'button\' value=\''+cls+'\' id=\'btnNo\' class=\'css_btn \' '+
' onclick="ShowView()"/>'+
'</p>';
$(errMsgDiv).addClass('ok-msg').removeClass('warn-msg');
$(errMsgDiv).html(message);
$(errMsgDiv).show();
$('#btnNo').focus();
showModalBox(errMsgDiv);
}
function ShowView(){
window.location.href='TBCcnsizePrm.html';
}
$(".datepicker").datepicker({
dateFormat: 'dd/mm/yy',
changeMonth: true,
changeYear: true
});
$(".warning-div ul").each(function () {
var lines = $(this).html().split("<br>");
$(this).html('<li>' + lines.join("</li><li><i class='fa <API key>'></i> ") + '</li>');
});
$('html,body').animate({ scrollTop: 0 }, 'slow');
|
// Copyleft 2005 Chris Korda
// This program is free software; you can redistribute it and/or modify it
/*
chris korda
revision history:
rev date comments
00 22apr05 initial version
01 07jul05 keep dialog within screen
02 23nov07 support Unicode
03 16dec08 in OnShowWindow, move LoadWnd within bShow block
04 24mar09 add special handling for main accelerators
05 21dec12 in OnShowWindow, don't clamp to work area if maximized
06 24jul15 override DoModal to save and restore focus
07 06jul17 remove update menu method
dialog that saves and restores its position
*/
// PersistDlg.cpp : implementation file
#include "stdafx.h"
#include "Resource.h"
#include "PersistDlg.h"
#include "Persist.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// CPersistDlg dialog
IMPLEMENT_DYNAMIC(CPersistDlg, CDialog);
CPersistDlg::CPersistDlg(UINT nIDTemplate, UINT nIDAccel, LPCTSTR RegKey, CWnd *pParent)
: CDialog(nIDTemplate, pParent), m_RegKey(RegKey)
{
//{{AFX_DATA_INIT(CPersistDlg)
//}}AFX_DATA_INIT
m_WasShown = FALSE;
m_IDAccel = nIDAccel;
m_Accel = nIDAccel != NULL && nIDAccel != IDR_MAINFRAME ?
LoadAccelerators(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(nIDAccel)) : NULL;
}
void CPersistDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPersistDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPersistDlg, CDialog)
//{{AFX_MSG_MAP(CPersistDlg)
ON_WM_DESTROY()
ON_WM_SHOWWINDOW()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// CPersistDlg message handlers
void CPersistDlg::OnDestroy()
{
CDialog::OnDestroy();
if (m_WasShown)
CPersist::SaveWnd(REG_SETTINGS, this, m_RegKey);
}
void CPersistDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
if (bShow) {
if (!m_WasShown && !IsWindowVisible()) {
m_WasShown = TRUE;
int Flags = (GetStyle() & WS_THICKFRAME) ? 0 : CPersist::NO_RESIZE;
CPersist::LoadWnd(REG_SETTINGS, this, m_RegKey, Flags);
}
if (!IsZoomed()) { // unless we're maximized, clamp to work area
// in case LoadWnd's SetWindowPlacement places us off-screen
CRect r, wr;
GetWindowRect(r);
if (<API key>(SPI_GETWORKAREA, 0, wr, 0)) {
CRect br = wr;
br.right -= GetSystemMetrics(SM_CXSMICON);
br.bottom -= GetSystemMetrics(SM_CYCAPTION);
CPoint pt = r.TopLeft();
if (!br.PtInRect(pt)) { // if dialog is off-screen
pt.x = CLAMP(pt.x, wr.left, wr.right - r.Width());
pt.y = CLAMP(pt.y, wr.top, wr.bottom - r.Height());
r = CRect(pt, CSize(r.Width(), r.Height()));
MoveWindow(r);
}
}
}
}
}
BOOL CPersistDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) {
if (m_Accel != NULL) {
if (<API key>(m_hWnd, m_Accel, pMsg))
return(TRUE);
} else { // no local accelerator table
// if non-system key down and main accelerators, give main a try
if (pMsg->message == WM_KEYDOWN && m_IDAccel == IDR_MAINFRAME
&& AfxGetMainWnd()->SendMessage(UWM_HANDLEDLGKEY, (WPARAM)pMsg))
return(TRUE);
}
}
return CDialog::PreTranslateMessage(pMsg);
}
W64INT CPersistDlg::DoModal()
{
HWND hWndFocus = ::GetFocus();
W64INT retc = CDialog::DoModal();
if (IsWindow(hWndFocus) && ::IsWindowVisible(hWndFocus)) // extra cautious
::SetFocus(hWndFocus);
return retc;
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WaterItem : BaseItem {
// Use this for initialization
public override void Start()
{
base.Start();
BulletSpeed = .1f;
ItemSprite = gameObject.GetComponent<SpriteRenderer>().sprite;
NameText = "Water";
PickupText = "Shot Speed up";
}
// Update is called once per frame
void Update () {
}
}
|
package net.ballmerlabs.scatterbrain.network.wifidirect;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import net.ballmerlabs.scatterbrain.network.GlobalNet;
@SuppressWarnings({"FieldCanBeLocal", "DefaultFileTemplate"})
class WifiDirectLooper extends Thread {
private Handler handler;
@SuppressWarnings("unused")
private final GlobalNet globnet;
public WifiDirectLooper(GlobalNet globnet) {
super();
this.globnet = globnet;
handler = new Handler();
}
public Handler getHandler() {
return this.handler;
}
@Override
public void run() {
Looper.prepare();
handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(Message msg) {
return true;
}
});
Looper.loop();
}
}
|
// <auto-generated>
// ReSharper disable <API key>
// ReSharper disable <API key>
// ReSharper disable InconsistentNaming
// ReSharper disable <API key>
// ReSharper disable <API key>
// ReSharper disable <API key>
// ReSharper disable <API key>
// ReSharper disable UseNameofExpression
// <API key> = 4.6
#pragma warning disable 1591 // Ignore "Missing XML Comment" warning
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Pikad.Framework.Repository;
namespace IranMarketer.Domain.Entity
{
// AcademicFields
[Table("AcademicFields", Schema = "dbo")]
public class AcademicField : Entity<int>
{
[Column(@"TitleEn", Order = 2, TypeName = "nvarchar")]
[MaxLength(1000)]
[StringLength(1000)]
[Display(Name = "Title en")]
public string TitleEn { get; set; }
[Column(@"TitleFa", Order = 3, TypeName = "nvarchar")]
[MaxLength(1000)]
[StringLength(1000)]
[Display(Name = "Title fa")]
public string TitleFa { get; set; }
[JsonIgnore]
public virtual System.Collections.Generic.ICollection<PartyUniversity> PartyUniversities { get; set; }
public AcademicField()
{
PartyUniversities = new System.Collections.Generic.List<PartyUniversity>();
}
}
}
// </auto-generated>
|
/**
* @file Map places of interest
* @author Tom Jenkins tom@itsravenous.com
*/
module.exports = {
castle: {
title: 'Rowton Castle',
lat: 52.708739,
lng: -2.9228567,
icon: 'pin_castle.png',
main: true,
description: 'Where it all happens! Rowton Castle is a small castle manor house roughly halfway between Shrewsbury and Welshpool.',
link: 'https://rowtoncastle.com'
},
barns: {
title: 'Rowton Barns',
lat: 52.709265,
lng: -2.9255,
icon: 'pin_hotel.png',
description: 'Just a <del>drunken stumble</del> <ins>short stroll</ins> from the castle, Rowton Barns offers rooms in their beautifully converted farm buildings.',
link: 'http:
},
wollaston: {
title: 'Wollaston Lodge',
lat: 52.7036,
lng: -2.9943,
icon: 'pin_hotel.png',
description: 'A boutique bed and breakfast with individually themed rooms.',
link: 'http:
},
travelodge: {
title: 'Shrewsbury Travelodge',
lat: 52.6817939,
lng: -2.7645268,
icon: 'pin_hotel.png',
description: 'On Bayston Hill services, with free parking.',
link: 'https:
}
};
|
var <API key> =
[
[ "angle", "<API key>.html#<API key>", null ],
[ "buttons", "<API key>.html#<API key>", null ],
[ "distance", "<API key>.html#<API key>", null ],
[ "ir", "<API key>.html#<API key>", null ]
];
|
/* The standard CSS for doxygen 1.8.11 */
body, table, div, p, dl {
font: 400 14px/22px Roboto,sans-serif;
}
/* @group Heading Levels */
h1.groupheader {
font-size: 150%;
}
.title {
font: 400 14px/28px Roboto,sans-serif;
font-size: 150%;
font-weight: bold;
margin: 10px 2px;
}
h2.groupheader {
border-bottom: 1px solid #EBB4B4;
color: #D35858;
font-size: 150%;
font-weight: normal;
margin-top: 1.75em;
padding-top: 8px;
padding-bottom: 4px;
width: 100%;
}
h3.groupheader {
font-size: 100%;
}
h1, h2, h3, h4, h5, h6 {
-webkit-transition: text-shadow 0.5s linear;
-moz-transition: text-shadow 0.5s linear;
-ms-transition: text-shadow 0.5s linear;
-o-transition: text-shadow 0.5s linear;
transition: text-shadow 0.5s linear;
margin-right: 15px;
}
h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow {
text-shadow: 0 0 15px cyan;
}
dt {
font-weight: bold;
}
div.multicol {
-moz-column-gap: 1em;
-webkit-column-gap: 1em;
-moz-column-count: 3;
-webkit-column-count: 3;
}
p.startli, p.startdd {
margin-top: 2px;
}
p.starttd {
margin-top: 0px;
}
p.endli {
margin-bottom: 0px;
}
p.enddd {
margin-bottom: 4px;
}
p.endtd {
margin-bottom: 2px;
}
/* @end */
caption {
font-weight: bold;
}
span.legend {
font-size: 70%;
text-align: center;
}
h3.version {
font-size: 90%;
text-align: center;
}
div.qindex, div.navtab{
background-color: #FCF3F3;
border: 1px solid #F0C7C7;
text-align: center;
}
div.qindex, div.navpath {
width: 100%;
line-height: 140%;
}
div.navtab {
margin-right: 15px;
}
/* @group Link Styling */
a {
color: #D86868;
font-weight: normal;
text-decoration: none;
}
.contents a:visited {
color: #DD7B7B;
}
a:hover {
text-decoration: underline;
}
a.qindex {
font-weight: bold;
}
a.qindexHL {
font-weight: bold;
background-color: #EFC2C2;
color: #ffffff;
border: 1px double #EBB3B3;
}
.contents a.qindexHL:visited {
color: #ffffff;
}
a.el {
font-weight: bold;
}
a.elRef {
}
a.code, a.code:visited, a.line, a.line:visited {
color: #4665A2;
}
a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {
color: #4665A2;
}
/* @end */
dl.el {
margin-left: -1cm;
}
pre.fragment {
border: 1px solid #C4CFE5;
background-color: #FBFCFD;
padding: 4px 6px;
margin: 4px 8px 4px 2px;
overflow: auto;
word-wrap: break-word;
font-size: 9pt;
line-height: 125%;
font-family: monospace, fixed;
font-size: 105%;
}
div.fragment {
padding: 4px 6px;
margin: 4px 8px 4px 2px;
background-color: #FEFDFD;
border: 1px solid #F6DCDC;
}
div.line {
font-family: monospace, fixed;
font-size: 13px;
min-height: 13px;
line-height: 1.0;
text-wrap: unrestricted;
white-space: -moz-pre-wrap; /* Moz */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* CSS3 */
word-wrap: break-word; /* IE 5.5+ */
text-indent: -53px;
padding-left: 53px;
padding-bottom: 0px;
margin: 0px;
-<API key>: background-color, box-shadow;
-<API key>: 0.5s;
-<API key>: background-color, box-shadow;
-<API key>: 0.5s;
-<API key>: background-color, box-shadow;
-<API key>: 0.5s;
-<API key>: background-color, box-shadow;
-<API key>: 0.5s;
transition-property: background-color, box-shadow;
transition-duration: 0.5s;
}
div.line:after {
content:"\000A";
white-space: pre;
}
div.line.glow {
background-color: cyan;
box-shadow: 0 0 10px cyan;
}
span.lineno {
padding-right: 4px;
text-align: right;
border-right: 2px solid #0F0;
background-color: #E8E8E8;
white-space: pre;
}
span.lineno a {
background-color: #D8D8D8;
}
span.lineno a:hover {
background-color: #C8C8C8;
}
div.ah, span.ah {
background-color: black;
font-weight: bold;
color: #ffffff;
margin-bottom: 3px;
margin-top: 3px;
padding: 0.2em;
border: solid thin #333;
border-radius: 0.5em;
-<API key>: .5em;
-moz-border-radius: .5em;
box-shadow: 2px 2px 3px #999;
-webkit-box-shadow: 2px 2px 3px #999;
-moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000 110%);
}
div.classindex ul {
list-style: none;
padding-left: 0;
}
div.classindex span.ai {
display: inline-block;
}
div.groupHeader {
margin-left: 16px;
margin-top: 12px;
font-weight: bold;
}
div.groupText {
margin-left: 16px;
font-style: italic;
}
body {
background-color: white;
color: black;
margin: 0;
}
div.contents {
margin-top: 10px;
margin-left: 12px;
margin-right: 8px;
}
td.indexkey {
background-color: #FCF3F3;
font-weight: bold;
border: 1px solid #F6DCDC;
margin: 2px 0px 2px 0;
padding: 2px 10px;
white-space: nowrap;
vertical-align: top;
}
td.indexvalue {
background-color: #FCF3F3;
border: 1px solid #F6DCDC;
padding: 2px 10px;
margin: 2px 0px;
}
tr.memlist {
background-color: #FCF5F5;
}
p.formulaDsp {
text-align: center;
}
img.formulaDsp {
}
img.formulaInl {
vertical-align: middle;
}
div.center {
text-align: center;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
}
div.center img {
border: 0px;
}
address.footer {
text-align: right;
padding-right: 12px;
}
img.footer {
border: 0px;
vertical-align: middle;
}
/* @group Code Colorization */
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
span.vhdldigit {
color: #ff00ff
}
span.vhdlchar {
color: #000000
}
span.vhdlkeyword {
color: #700070
}
span.vhdllogic {
color: #ff0000
}
blockquote {
background-color: #FDFAFA;
border-left: 2px solid #EFC2C2;
margin: 0 24px 0 4px;
padding: 0 12px 0 16px;
}
/* @end */
/*
.search {
color: #003399;
font-weight: bold;
}
form.search {
margin-bottom: 0px;
margin-top: 0px;
}
input.search {
font-size: 75%;
color: #000080;
font-weight: normal;
background-color: #e8eef2;
}
*/
td.tiny {
font-size: 75%;
}
.dirtab {
padding: 4px;
border-collapse: collapse;
border: 1px solid #F0C7C7;
}
th.dirtab {
background: #FCF3F3;
font-weight: bold;
}
hr {
height: 0px;
border: none;
border-top: 1px solid #DE8282;
}
hr.footer {
height: 1px;
}
/* @group Member Descriptions */
table.memberdecls {
border-spacing: 0px;
padding: 0px;
}
.memberdecls td, .fieldtable tr {
-<API key>: background-color, box-shadow;
-<API key>: 0.5s;
-<API key>: background-color, box-shadow;
-<API key>: 0.5s;
-<API key>: background-color, box-shadow;
-<API key>: 0.5s;
-<API key>: background-color, box-shadow;
-<API key>: 0.5s;
transition-property: background-color, box-shadow;
transition-duration: 0.5s;
}
.memberdecls td.glow, .fieldtable tr.glow {
background-color: cyan;
box-shadow: 0 0 15px cyan;
}
.mdescLeft, .mdescRight,
.memItemLeft, .memItemRight,
.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
background-color: #FEFBFB;
border: none;
margin: 4px;
padding: 1px 0 0 8px;
}
.mdescLeft, .mdescRight {
padding: 0px 8px 4px 8px;
color: #555;
}
.memSeparator {
border-bottom: 1px solid #DEE4F0;
line-height: 1px;
margin: 0px;
padding: 0px;
}
.memItemLeft, .memTemplItemLeft {
white-space: nowrap;
}
.memItemRight {
width: 100%;
}
.memTemplParams {
color: #DD7B7B;
white-space: nowrap;
font-size: 80%;
}
/* @end */
/* @group Member Details */
/* Styles for detailed member documentation */
.memtemplate {
font-size: 80%;
color: #DD7B7B;
font-weight: normal;
margin-left: 9px;
}
.memnav {
background-color: #FCF3F3;
border: 1px solid #F0C7C7;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
.mempage {
width: 100%;
}
.memitem {
padding: 0;
margin-bottom: 10px;
margin-right: 5px;
-webkit-transition: box-shadow 0.5s linear;
-moz-transition: box-shadow 0.5s linear;
-ms-transition: box-shadow 0.5s linear;
-o-transition: box-shadow 0.5s linear;
transition: box-shadow 0.5s linear;
display: table !important;
width: 100%;
}
.memitem.glow {
box-shadow: 0 0 15px cyan;
}
.memname {
font-weight: bold;
margin-left: 6px;
}
.memname td {
vertical-align: bottom;
}
.memproto, dl.reflist dt {
border-top: 1px solid #F1CACA;
border-left: 1px solid #F1CACA;
border-right: 1px solid #F1CACA;
padding: 6px 0px 6px 0px;
color: #C63333;
font-weight: bold;
text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
background-image:url('nav_f.png');
background-repeat:repeat-x;
background-color: #FAEEEE;
/* opera specific markup */
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
<API key>: 4px;
<API key>: 4px;
/* firefox specific markup */
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
-<API key>: 4px;
-<API key>: 4px;
/* webkit specific markup */
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
-<API key>: 4px;
-<API key>: 4px;
}
.memdoc, dl.reflist dd {
border-bottom: 1px solid #F1CACA;
border-left: 1px solid #F1CACA;
border-right: 1px solid #F1CACA;
padding: 6px 10px 2px 10px;
background-color: #FEFDFD;
border-top-width: 0;
background-image:url('nav_g.png');
background-repeat:repeat-x;
background-color: #FFFFFF;
/* opera specific markup */
<API key>: 4px;
<API key>: 4px;
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
/* firefox specific markup */
-<API key>: 4px;
-<API key>: 4px;
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
/* webkit specific markup */
-<API key>: 4px;
-<API key>: 4px;
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
}
dl.reflist dt {
padding: 5px;
}
dl.reflist dd {
margin: 0px 0px 10px 0px;
padding: 5px;
}
.paramkey {
text-align: right;
}
.paramtype {
white-space: nowrap;
}
.paramname {
color: #602020;
white-space: nowrap;
}
.paramname em {
font-style: normal;
}
.paramname code {
line-height: 14px;
}
.params, .retval, .exception, .tparams {
margin-left: 0px;
padding-left: 0px;
}
.params .paramname, .retval .paramname {
font-weight: bold;
vertical-align: top;
}
.params .paramtype {
font-style: italic;
vertical-align: top;
}
.params .paramdir {
font-family: "courier new",courier,monospace;
vertical-align: top;
}
table.mlabels {
border-spacing: 0px;
}
td.mlabels-left {
width: 100%;
padding: 0px;
}
td.mlabels-right {
vertical-align: bottom;
padding: 0px;
white-space: nowrap;
}
span.mlabels {
margin-left: 8px;
}
span.mlabel {
background-color: #E7A4A4;
border-top:1px solid #E18D8D;
border-left:1px solid #E18D8D;
border-right:1px solid #F6DCDC;
border-bottom:1px solid #F6DCDC;
text-shadow: none;
color: white;
margin-right: 4px;
padding: 2px 3px;
border-radius: 3px;
font-size: 7pt;
white-space: nowrap;
vertical-align: middle;
}
/* @end */
/* these are for tree view inside a (index) page */
div.directory {
margin: 10px 0px;
border-top: 1px solid #EFC2C2;
border-bottom: 1px solid #EFC2C2;
width: 100%;
}
.directory table {
border-collapse:collapse;
}
.directory td {
margin: 0px;
padding: 0px;
vertical-align: top;
}
.directory td.entry {
white-space: nowrap;
padding-right: 6px;
padding-top: 3px;
}
.directory td.entry a {
outline:none;
}
.directory td.entry a img {
border: none;
}
.directory td.desc {
width: 100%;
padding-left: 6px;
padding-right: 6px;
padding-top: 3px;
border-left: 1px solid rgba(0,0,0,0.05);
}
.directory tr.even {
padding-left: 6px;
background-color: #FDFAFA;
}
.directory img {
vertical-align: -30%;
}
.directory .levels {
white-space: nowrap;
width: 100%;
text-align: right;
font-size: 9pt;
}
.directory .levels span {
cursor: pointer;
padding-left: 2px;
padding-right: 2px;
color: #D86868;
}
.arrow {
color: #EFC2C2;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
font-size: 80%;
display: inline-block;
width: 16px;
height: 22px;
}
.icon {
font-family: Arial, Helvetica;
font-weight: bold;
font-size: 12px;
height: 14px;
width: 16px;
display: inline-block;
background-color: #E7A4A4;
color: white;
text-align: center;
border-radius: 4px;
margin-left: 2px;
margin-right: 2px;
}
.icona {
width: 24px;
height: 22px;
display: inline-block;
}
.iconfopen {
width: 24px;
height: 18px;
margin-bottom: 4px;
background-image:url('folderopen.png');
background-position: 0px -4px;
background-repeat: repeat-y;
vertical-align:top;
display: inline-block;
}
.iconfclosed {
width: 24px;
height: 18px;
margin-bottom: 4px;
background-image:url('folderclosed.png');
background-position: 0px -4px;
background-repeat: repeat-y;
vertical-align:top;
display: inline-block;
}
.icondoc {
width: 24px;
height: 18px;
margin-bottom: 4px;
background-image:url('doc.png');
background-position: 0px -4px;
background-repeat: repeat-y;
vertical-align:top;
display: inline-block;
}
table.directory {
font: 400 14px Roboto,sans-serif;
}
/* @end */
div.dynheader {
margin-top: 8px;
-<API key>: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
address {
font-style: normal;
color: #CD3E3E;
}
table.doxtable caption {
caption-side: top;
}
table.doxtable {
border-collapse:collapse;
margin-top: 4px;
margin-bottom: 4px;
}
table.doxtable td, table.doxtable th {
border: 1px solid #CE4545;
padding: 3px 7px 2px;
}
table.doxtable th {
background-color: #D45C5C;
color: #FFFFFF;
font-size: 110%;
padding-bottom: 4px;
padding-top: 5px;
}
table.fieldtable {
/*width: 100%;*/
margin-bottom: 10px;
border: 1px solid #F1CACA;
border-spacing: 0px;
-moz-border-radius: 4px;
-<API key>: 4px;
border-radius: 4px;
-moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
-webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
}
.fieldtable td, .fieldtable th {
padding: 3px 7px 2px;
}
.fieldtable td.fieldtype, .fieldtable td.fieldname {
white-space: nowrap;
border-right: 1px solid #F1CACA;
border-bottom: 1px solid #F1CACA;
vertical-align: top;
}
.fieldtable td.fieldname {
padding-top: 3px;
}
.fieldtable td.fielddoc {
border-bottom: 1px solid #F1CACA;
/*width: 100%;*/
}
.fieldtable td.fielddoc p:first-child {
margin-top: 0px;
}
.fieldtable td.fielddoc p:last-child {
margin-bottom: 2px;
}
.fieldtable tr:last-child td {
border-bottom: none;
}
.fieldtable th {
background-image:url('nav_f.png');
background-repeat:repeat-x;
background-color: #FAEEEE;
font-size: 90%;
color: #C63333;
padding-bottom: 4px;
padding-top: 5px;
text-align:left;
-<API key>: 4px;
-<API key>: 4px;
-<API key>: 4px;
-<API key>: 4px;
<API key>: 4px;
<API key>: 4px;
border-bottom: 1px solid #F1CACA;
}
.tabsearch {
top: 0px;
left: 10px;
height: 36px;
background-image: url('tab_b.png');
z-index: 101;
overflow: hidden;
font-size: 13px;
}
.navpath ul
{
font-size: 11px;
background-image:url('tab_b.png');
background-repeat:repeat-x;
background-position: 0 -5px;
height:30px;
line-height:30px;
color:#ECB5B5;
border:solid 1px #F5DADA;
overflow:hidden;
margin:0px;
padding:0px;
}
.navpath li
{
list-style-type:none;
float:left;
padding-left:10px;
padding-right:15px;
background-image:url('bc_s.png');
background-repeat:no-repeat;
background-position:right;
color:#D45A5A;
}
.navpath li.navelem a
{
height:32px;
display:block;
text-decoration: none;
outline: none;
color: #CB3939;
font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif;
text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
text-decoration: none;
}
.navpath li.navelem a:hover
{
color:#E59D9D;
}
.navpath li.footer
{
list-style-type:none;
float:right;
padding-left:10px;
padding-right:15px;
background-image:none;
background-repeat:no-repeat;
background-position:right;
color:#D45A5A;
font-size: 8pt;
}
div.summary
{
float: right;
font-size: 8pt;
padding-right: 5px;
width: 50%;
text-align: right;
}
div.summary a
{
white-space: nowrap;
}
table.classindex
{
margin: 10px;
white-space: nowrap;
margin-left: 3%;
margin-right: 3%;
width: 94%;
border: 0;
border-spacing: 0;
padding: 0;
}
div.ingroups
{
font-size: 8pt;
width: 50%;
text-align: left;
}
div.ingroups a
{
white-space: nowrap;
}
div.header
{
background-image:url('nav_h.png');
background-repeat:repeat-x;
background-color: #FEFBFB;
margin: 0px;
border-bottom: 1px solid #F6DCDC;
}
div.headertitle
{
padding: 5px 5px 5px 10px;
}
dl
{
padding: 0 0 0 10px;
}
/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */
dl.section
{
margin-left: 0px;
padding-left: 0px;
}
dl.note
{
margin-left:-7px;
padding-left: 3px;
border-left:4px solid;
border-color: #D0C000;
}
dl.warning, dl.attention
{
margin-left:-7px;
padding-left: 3px;
border-left:4px solid;
border-color: #FF0000;
}
dl.pre, dl.post, dl.invariant
{
margin-left:-7px;
padding-left: 3px;
border-left:4px solid;
border-color: #00D000;
}
dl.deprecated
{
margin-left:-7px;
padding-left: 3px;
border-left:4px solid;
border-color: #505050;
}
dl.todo
{
margin-left:-7px;
padding-left: 3px;
border-left:4px solid;
border-color: #00C0E0;
}
dl.test
{
margin-left:-7px;
padding-left: 3px;
border-left:4px solid;
border-color: #3030E0;
}
dl.bug
{
margin-left:-7px;
padding-left: 3px;
border-left:4px solid;
border-color: #C08050;
}
dl.section dd {
margin-bottom: 6px;
}
#projectlogo
{
text-align: center;
vertical-align: bottom;
border-collapse: separate;
}
#projectlogo img
{
border: 0px none;
}
#projectalign
{
vertical-align: middle;
}
#projectname
{
font: 300% Tahoma, Arial,sans-serif;
margin: 0px;
padding: 2px 0px;
}
#projectbrief
{
font: 120% Tahoma, Arial,sans-serif;
margin: 0px;
padding: 0px;
}
#projectnumber
{
font: 50% Tahoma, Arial,sans-serif;
margin: 0px;
padding: 0px;
}
#titlearea
{
padding: 0px;
margin: 0px;
width: 100%;
border-bottom: 1px solid #E18D8D;
}
.image
{
text-align: center;
}
.dotgraph
{
text-align: center;
}
.mscgraph
{
text-align: center;
}
.diagraph
{
text-align: center;
}
.caption
{
font-weight: bold;
}
div.zoom
{
border: 1px solid #EDBABA;
}
dl.citelist {
margin-bottom:50px;
}
dl.citelist dt {
color:#D25252;
float:left;
font-weight:bold;
margin-right:10px;
padding:5px;
}
dl.citelist dd {
margin:2px 0;
padding:5px 0;
}
div.toc {
padding: 14px 25px;
background-color: #FDF9F9;
border: 1px solid #F9E8E8;
border-radius: 7px 7px 7px 7px;
float: right;
height: auto;
margin: 0 8px 10px 10px;
width: 200px;
}
div.toc li {
background: url("bdwn.png") no-repeat scroll 0 5px transparent;
font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif;
margin-top: 5px;
padding-left: 10px;
padding-top: 2px;
}
div.toc h3 {
font: bold 12px/1.2 Arial,FreeSans,sans-serif;
color: #DD7B7B;
border-bottom: 0 none;
margin: 0;
}
div.toc ul {
list-style: none outside none;
border: medium none;
padding: 0px;
}
div.toc li.level1 {
margin-left: 0px;
}
div.toc li.level2 {
margin-left: 15px;
}
div.toc li.level3 {
margin-left: 30px;
}
div.toc li.level4 {
margin-left: 45px;
}
.inherit_header {
font-weight: bold;
color: gray;
cursor: pointer;
-<API key>: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.inherit_header td {
padding: 6px 0px 2px 5px;
}
.inherit {
display: none;
}
tr.heading h2 {
margin-top: 12px;
margin-bottom: 4px;
}
/* tooltip related style info */
.ttc {
position: absolute;
display: none;
}
#powerTip {
cursor: default;
white-space: nowrap;
background-color: white;
border: 1px solid gray;
border-radius: 4px 4px 4px 4px;
box-shadow: 1px 1px 7px gray;
display: none;
font-size: smaller;
max-width: 80%;
opacity: 0.9;
padding: 1ex 1em 1em;
position: absolute;
z-index: 2147483647;
}
#powerTip div.ttdoc {
color: grey;
font-style: italic;
}
#powerTip div.ttname a {
font-weight: bold;
}
#powerTip div.ttname {
font-weight: bold;
}
#powerTip div.ttdeci {
color: #006318;
}
#powerTip div {
margin: 0px;
padding: 0px;
font: 12px/16px Roboto,sans-serif;
}
#powerTip:before, #powerTip:after {
content: "";
position: absolute;
margin: 0px;
}
#powerTip.n:after, #powerTip.n:before,
#powerTip.s:after, #powerTip.s:before,
#powerTip.w:after, #powerTip.w:before,
#powerTip.e:after, #powerTip.e:before,
#powerTip.ne:after, #powerTip.ne:before,
#powerTip.se:after, #powerTip.se:before,
#powerTip.nw:after, #powerTip.nw:before,
#powerTip.sw:after, #powerTip.sw:before {
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
}
#powerTip.n:after, #powerTip.s:after,
#powerTip.w:after, #powerTip.e:after,
#powerTip.nw:after, #powerTip.ne:after,
#powerTip.sw:after, #powerTip.se:after {
border-color: rgba(255, 255, 255, 0);
}
#powerTip.n:before, #powerTip.s:before,
#powerTip.w:before, #powerTip.e:before,
#powerTip.nw:before, #powerTip.ne:before,
#powerTip.sw:before, #powerTip.se:before {
border-color: rgba(128, 128, 128, 0);
}
#powerTip.n:after, #powerTip.n:before,
#powerTip.ne:after, #powerTip.ne:before,
#powerTip.nw:after, #powerTip.nw:before {
top: 100%;
}
#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after {
border-top-color: #ffffff;
border-width: 10px;
margin: 0px -10px;
}
#powerTip.n:before {
border-top-color: #808080;
border-width: 11px;
margin: 0px -11px;
}
#powerTip.n:after, #powerTip.n:before {
left: 50%;
}
#powerTip.nw:after, #powerTip.nw:before {
right: 14px;
}
#powerTip.ne:after, #powerTip.ne:before {
left: 14px;
}
#powerTip.s:after, #powerTip.s:before,
#powerTip.se:after, #powerTip.se:before,
#powerTip.sw:after, #powerTip.sw:before {
bottom: 100%;
}
#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after {
border-bottom-color: #ffffff;
border-width: 10px;
margin: 0px -10px;
}
#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before {
border-bottom-color: #808080;
border-width: 11px;
margin: 0px -11px;
}
#powerTip.s:after, #powerTip.s:before {
left: 50%;
}
#powerTip.sw:after, #powerTip.sw:before {
right: 14px;
}
#powerTip.se:after, #powerTip.se:before {
left: 14px;
}
#powerTip.e:after, #powerTip.e:before {
left: 100%;
}
#powerTip.e:after {
border-left-color: #ffffff;
border-width: 10px;
top: 50%;
margin-top: -10px;
}
#powerTip.e:before {
border-left-color: #808080;
border-width: 11px;
top: 50%;
margin-top: -11px;
}
#powerTip.w:after, #powerTip.w:before {
right: 100%;
}
#powerTip.w:after {
border-right-color: #ffffff;
border-width: 10px;
top: 50%;
margin-top: -10px;
}
#powerTip.w:before {
border-right-color: #808080;
border-width: 11px;
top: 50%;
margin-top: -11px;
}
@media print
{
#top { display: none; }
#side-nav { display: none; }
#nav-path { display: none; }
body { overflow:visible; }
h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
.summary { display: none; }
.memitem { page-break-inside: avoid; }
#doc-content
{
margin-left:0 !important;
height:auto !important;
width:auto !important;
overflow:inherit;
display:inline;
}
}
|
#ifndef LAZYLISTVIEW_H
#define LAZYLISTVIEW_H
#include <QQuickItem>
#include <QQmlComponent>
#include <QScopedPointer>
#include <QSharedPointer>
class QQuickFlickable;
class ItemPool;
class LazyListView : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(int orientation READ getOrientation WRITE setOrientation NOTIFY orientationChanged)
Q_PROPERTY(QQmlComponent * delegate READ getDelegate WRITE setDelegate NOTIFY delegateChanged)
Q_PROPERTY(QObject * model READ getModel WRITE setModel NOTIFY modelChanged)
public:
LazyListView();
~LazyListView();
public:
int getOrientation() const;
void setOrientation(int orientation);
QQmlComponent * getDelegate() const;
void setDelegate(QQmlComponent *delegate);
QObject *getModel() const;
void setModel(QObject *model);
signals:
void orientationChanged();
void delegateChanged();
void modelChanged();
private:
void createListItems(QQmlComponent *component);
void rearangeListItems();
private:
QScopedPointer<QQuickFlickable> m_flickable;
int m_cacheSize;
QScopedPointer<ItemPool> m_itemPool;
QObject *m_model; // This limits model types... can't be an int for instance
QList<QQuickItem *> m_visibleItems; // Maybe as a LinkedList this would be more efficient?
QQmlComponent *m_delegate;
};
#endif // LAZYLISTVIEW_H
|
package com.geeksville.aws
import com.amazonaws.auth.AWSCredentials
import com.typesafe.config.ConfigFactory
import grizzled.slf4j.Logging
/**
* Provides AWS credentials from a Typesafe style config db
*
* @param baseKey - we look for AWS keys underneed this root entry
*/
class ConfigCredentials(baseKey: String) extends AWSCredentials with Logging {
private lazy val conf = ConfigFactory.load()
private def prefix = if (baseKey.isEmpty) baseKey else baseKey + "."
def getAWSAccessKeyId() = {
val r = conf.getString(prefix + "aws.accessKey")
//debug(s"Using AWS access key $r")
r
}
def getAWSSecretKey() = {
val r = conf.getString(prefix + "aws.secretKey")
//debug(s"Using AWS secret key $r")
r
}
}
|
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_11) on Mon Jun 16 17:35:51 PDT 2014 -->
<title>DTDConstants (Java Platform SE 8 )</title>
<meta name="date" content="2014-06-16">
<meta name="keywords" content="javax.swing.text.html.parser.DTDConstants interface">
<meta name="keywords" content="CDATA">
<meta name="keywords" content="ENTITY">
<meta name="keywords" content="ENTITIES">
<meta name="keywords" content="ID">
<meta name="keywords" content="IDREF">
<meta name="keywords" content="IDREFS">
<meta name="keywords" content="NAME">
<meta name="keywords" content="NAMES">
<meta name="keywords" content="NMTOKEN">
<meta name="keywords" content="NMTOKENS">
<meta name="keywords" content="NOTATION">
<meta name="keywords" content="NUMBER">
<meta name="keywords" content="NUMBERS">
<meta name="keywords" content="NUTOKEN">
<meta name="keywords" content="NUTOKENS">
<meta name="keywords" content="RCDATA">
<meta name="keywords" content="EMPTY">
<meta name="keywords" content="MODEL">
<meta name="keywords" content="ANY">
<meta name="keywords" content="FIXED">
<meta name="keywords" content="REQUIRED">
<meta name="keywords" content="CURRENT">
<meta name="keywords" content="CONREF">
<meta name="keywords" content="IMPLIED">
<meta name="keywords" content="PUBLIC">
<meta name="keywords" content="SDATA">
<meta name="keywords" content="PI">
<meta name="keywords" content="STARTTAG">
<meta name="keywords" content="ENDTAG">
<meta name="keywords" content="MS">
<meta name="keywords" content="MD">
<meta name="keywords" content="SYSTEM">
<meta name="keywords" content="GENERAL">
<meta name="keywords" content="DEFAULT">
<meta name="keywords" content="PARAMETER">
<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="DTDConstants (Java Platform SE 8 )";
}
}
catch(err) {
}
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar.top">
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/DTDConstants.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><strong>Java™ Platform<br>Standard Ed. 8</strong></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../javax/swing/text/html/parser/DTD.html" title="class in javax.swing.text.html.parser"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../javax/swing/text/html/parser/Element.html" title="class in javax.swing.text.html.parser"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?javax/swing/text/html/parser/DTDConstants.html" target="_top">Frames</a></li>
<li><a href="DTDConstants.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
</div>
<a name="skip.navbar.top">
</a></div>
<div class="header">
<div class="subTitle">javax.swing.text.html.parser</div>
<h2 title="Interface DTDConstants" class="title">Interface DTDConstants</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../../javax/swing/text/html/parser/AttributeList.html" title="class in javax.swing.text.html.parser">AttributeList</a>, <a href="../../../../../javax/swing/text/html/parser/DocumentParser.html" title="class in javax.swing.text.html.parser">DocumentParser</a>, <a href="../../../../../javax/swing/text/html/parser/DTD.html" title="class in javax.swing.text.html.parser">DTD</a>, <a href="../../../../../javax/swing/text/html/parser/Element.html" title="class in javax.swing.text.html.parser">Element</a>, <a href="../../../../../javax/swing/text/html/parser/Entity.html" title="class in javax.swing.text.html.parser">Entity</a>, <a href="../../../../../javax/swing/text/html/parser/Parser.html" title="class in javax.swing.text.html.parser">Parser</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">DTDConstants</span></pre>
<div class="block">SGML constants used in a DTD. The names of the
constants correspond the the equivalent SGML constructs
as described in "The SGML Handbook" by Charles F. Goldfarb.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../javax/swing/text/html/parser/DTD.html" title="class in javax.swing.text.html.parser"><code>DTD</code></a>,
<a href="../../../../../javax/swing/text/html/parser/Element.html" title="class in javax.swing.text.html.parser"><code>Element</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="field.summary">
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#ANY">ANY</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#CDATA">CDATA</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#CONREF">CONREF</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#CURRENT">CURRENT</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#DEFAULT">DEFAULT</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#EMPTY">EMPTY</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#ENDTAG">ENDTAG</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#ENTITIES">ENTITIES</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#ENTITY">ENTITY</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#FIXED">FIXED</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#GENERAL">GENERAL</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#ID">ID</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#IDREF">IDREF</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#IDREFS">IDREFS</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#IMPLIED">IMPLIED</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#MD">MD</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#MODEL">MODEL</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#MS">MS</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#NAME">NAME</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#NAMES">NAMES</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#NMTOKEN">NMTOKEN</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#NMTOKENS">NMTOKENS</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#NOTATION">NOTATION</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#NUMBER">NUMBER</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#NUMBERS">NUMBERS</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#NUTOKEN">NUTOKEN</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#NUTOKENS">NUTOKENS</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#PARAMETER">PARAMETER</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#PI">PI</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#PUBLIC">PUBLIC</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#RCDATA">RCDATA</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#REQUIRED">REQUIRED</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#SDATA">SDATA</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#STARTTAG">STARTTAG</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../javax/swing/text/html/parser/DTDConstants.html#SYSTEM">SYSTEM</a></span></code> </td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="field.detail">
</a>
<h3>Field Detail</h3>
<a name="CDATA">
</a>
<ul class="blockList">
<li class="blockList">
<h4>CDATA</h4>
<pre>static final int CDATA</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.CDATA">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ENTITY">
</a>
<ul class="blockList">
<li class="blockList">
<h4>ENTITY</h4>
<pre>static final int ENTITY</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.ENTITY">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ENTITIES">
</a>
<ul class="blockList">
<li class="blockList">
<h4>ENTITIES</h4>
<pre>static final int ENTITIES</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.ENTITIES">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ID">
</a>
<ul class="blockList">
<li class="blockList">
<h4>ID</h4>
<pre>static final int ID</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.ID">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="IDREF">
</a>
<ul class="blockList">
<li class="blockList">
<h4>IDREF</h4>
<pre>static final int IDREF</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.IDREF">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="IDREFS">
</a>
<ul class="blockList">
<li class="blockList">
<h4>IDREFS</h4>
<pre>static final int IDREFS</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.IDREFS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="NAME">
</a>
<ul class="blockList">
<li class="blockList">
<h4>NAME</h4>
<pre>static final int NAME</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.NAME">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="NAMES">
</a>
<ul class="blockList">
<li class="blockList">
<h4>NAMES</h4>
<pre>static final int NAMES</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.NAMES">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="NMTOKEN">
</a>
<ul class="blockList">
<li class="blockList">
<h4>NMTOKEN</h4>
<pre>static final int NMTOKEN</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.NMTOKEN">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="NMTOKENS">
</a>
<ul class="blockList">
<li class="blockList">
<h4>NMTOKENS</h4>
<pre>static final int NMTOKENS</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.NMTOKENS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="NOTATION">
</a>
<ul class="blockList">
<li class="blockList">
<h4>NOTATION</h4>
<pre>static final int NOTATION</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.NOTATION">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="NUMBER">
</a>
<ul class="blockList">
<li class="blockList">
<h4>NUMBER</h4>
<pre>static final int NUMBER</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.NUMBER">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="NUMBERS">
</a>
<ul class="blockList">
<li class="blockList">
<h4>NUMBERS</h4>
<pre>static final int NUMBERS</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.NUMBERS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="NUTOKEN">
</a>
<ul class="blockList">
<li class="blockList">
<h4>NUTOKEN</h4>
<pre>static final int NUTOKEN</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.NUTOKEN">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="NUTOKENS">
</a>
<ul class="blockList">
<li class="blockList">
<h4>NUTOKENS</h4>
<pre>static final int NUTOKENS</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.NUTOKENS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="RCDATA">
</a>
<ul class="blockList">
<li class="blockList">
<h4>RCDATA</h4>
<pre>static final int RCDATA</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.RCDATA">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="EMPTY">
</a>
<ul class="blockList">
<li class="blockList">
<h4>EMPTY</h4>
<pre>static final int EMPTY</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.EMPTY">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="MODEL">
</a>
<ul class="blockList">
<li class="blockList">
<h4>MODEL</h4>
<pre>static final int MODEL</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.MODEL">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ANY">
</a>
<ul class="blockList">
<li class="blockList">
<h4>ANY</h4>
<pre>static final int ANY</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.ANY">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="FIXED">
</a>
<ul class="blockList">
<li class="blockList">
<h4>FIXED</h4>
<pre>static final int FIXED</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.FIXED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="REQUIRED">
</a>
<ul class="blockList">
<li class="blockList">
<h4>REQUIRED</h4>
<pre>static final int REQUIRED</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.REQUIRED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="CURRENT">
</a>
<ul class="blockList">
<li class="blockList">
<h4>CURRENT</h4>
<pre>static final int CURRENT</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.CURRENT">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="CONREF">
</a>
<ul class="blockList">
<li class="blockList">
<h4>CONREF</h4>
<pre>static final int CONREF</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.CONREF">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="IMPLIED">
</a>
<ul class="blockList">
<li class="blockList">
<h4>IMPLIED</h4>
<pre>static final int IMPLIED</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.IMPLIED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="PUBLIC">
</a>
<ul class="blockList">
<li class="blockList">
<h4>PUBLIC</h4>
<pre>static final int PUBLIC</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.PUBLIC">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SDATA">
</a>
<ul class="blockList">
<li class="blockList">
<h4>SDATA</h4>
<pre>static final int SDATA</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.SDATA">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="PI">
</a>
<ul class="blockList">
<li class="blockList">
<h4>PI</h4>
<pre>static final int PI</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.PI">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="STARTTAG">
</a>
<ul class="blockList">
<li class="blockList">
<h4>STARTTAG</h4>
<pre>static final int STARTTAG</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.STARTTAG">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ENDTAG">
</a>
<ul class="blockList">
<li class="blockList">
<h4>ENDTAG</h4>
<pre>static final int ENDTAG</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.ENDTAG">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="MS">
</a>
<ul class="blockList">
<li class="blockList">
<h4>MS</h4>
<pre>static final int MS</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.MS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="MD">
</a>
<ul class="blockList">
<li class="blockList">
<h4>MD</h4>
<pre>static final int MD</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.MD">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SYSTEM">
</a>
<ul class="blockList">
<li class="blockList">
<h4>SYSTEM</h4>
<pre>static final int SYSTEM</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.SYSTEM">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="GENERAL">
</a>
<ul class="blockList">
<li class="blockList">
<h4>GENERAL</h4>
<pre>static final int GENERAL</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.GENERAL">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="DEFAULT">
</a>
<ul class="blockList">
<li class="blockList">
<h4>DEFAULT</h4>
<pre>static final int DEFAULT</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.DEFAULT">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="PARAMETER">
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>PARAMETER</h4>
<pre>static final int PARAMETER</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#javax.swing.text.html.parser.DTDConstants.PARAMETER">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="bottomNav"><a name="navbar.bottom">
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/DTDConstants.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><strong>Java™ Platform<br>Standard Ed. 8</strong></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../javax/swing/text/html/parser/DTD.html" title="class in javax.swing.text.html.parser"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../javax/swing/text/html/parser/Element.html" title="class in javax.swing.text.html.parser"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?javax/swing/text/html/parser/DTDConstants.html" target="_top">Frames</a></li>
<li><a href="DTDConstants.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
</div>
<a name="skip.navbar.bottom">
</a></div>
<p class="legalCopy"><small><font size="-1"> <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a> <br>For further API reference and developer documentation, see <a href="http://download.oracle.com/javase/8/docs/index.html" target="_blank">Java SE Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> Copyright &
</body>
</html>
|
/** @file
* Base64 encoding and decoding.
*/
#include <cassert>
#include <memory>
#include "src/common/base64.h"
#include "src/common/ustring.h"
#include "src/common/error.h"
#include "src/common/readstream.h"
#include "src/common/memreadstream.h"
#include "src/common/memwritestream.h"
namespace Common {
static const char kBase64Char[65] = "<API key>+/";
static const uint8_t kBase64Values[128] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3E, 0xFF, 0xFF, 0xFF, 0x3F,
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};
/** Write a character into our base64 string, and update the remaining
* string length.
*
* Returns false if we ran out of remaining characters in this string.
*/
static bool writeCharacter(UString &base64, uint32_t c, size_t &maxLength) {
assert(maxLength > 0);
base64 += c;
return --maxLength > 0;
}
/** Write multiple characters into our base64 string, and update the remaining
* string length.
*
* Returns false if we ran out of remaining characters in this string.
*/
static bool writeCharacters(UString &base64, UString &str, size_t &lineLength) {
while (!str.empty()) {
writeCharacter(base64, *str.begin(), lineLength);
str.erase(str.begin());
if (lineLength == 0)
return false;
}
return lineLength > 0;
}
/** Find the raw value of a base64-encoded character. */
static uint8_t findCharacterValue(uint32_t c) {
if ((c >= 128) || (kBase64Values[c] > 0x3F))
throw Exception("Invalid base64 character");
return kBase64Values[c];
}
/** Encode data into base64 and write the result into the string, but only up
* to maxLength characters.
*
* The string overhang is and input/output string of both the overhang from
* the previous run of this function (which will get written into the base64
* string first) and the newly produced overhang.
*
* Returns false if we have written all data there is to write, both from the
* overhang and the input data stream.
*/
static bool encodeBase64(ReadStream &data, UString &base64, size_t maxLength, UString &overhang) {
if (maxLength == 0)
throw Exception("Invalid base64 max line length");
// First write the overhang, and return if we already maxed out the length there
if (!writeCharacters(base64, overhang, maxLength))
return true;
overhang.clear();
uint8_t n;
byte input[3];
// Read up to 3 characters at a time
while ((n = data.read(input, 3)) != 0) {
uint32_t code = 0;
// Concat the input characters
for (uint8_t i = 0; i < n; i++)
code |= input[i] << (24 - i * 8);
// Create up to 4 6-bit base64-characters out of them
for (uint8_t i = 0; i < (n + 1); i++) {
overhang += kBase64Char[(code >> 26) & 0x0000003F];
code <<= 6;
}
// Add padding
for (int i = 0; i < (3 - n); i++)
overhang += '=';
// Write the base64 characters into the string, and return if we maxed out the length
if (!writeCharacters(base64, overhang, maxLength))
return true;
overhang.clear();
}
// We reached the end of input the data
return false;
}
static void decodeBase64(WriteStream &data, const UString &base64, UString &overhang) {
assert(overhang.size() < 4);
for (UString::iterator c = base64.begin(); c != base64.end(); ++c) {
if ((*c != '=') && ((*c >= 128) || (kBase64Values[*c] > 0x3F)))
continue;
overhang += *c;
if (overhang.size() == 4) {
uint32_t code = 0;
uint8_t n = 0;
for (UString::iterator o = overhang.begin(); o != overhang.end(); ++o) {
code <<= 6;
if (*o != '=') {
code += findCharacterValue(*o);
n += 6;
}
}
for (size_t i = 0; i < (n / 8); i++, code <<= 8)
data.writeByte((byte) ((code & 0x00FF0000) >> 16));
overhang.clear();
}
}
}
static size_t countLength(const UString &str, bool partial = false) {
size_t dataLength = 0;
for (const auto &c : str) {
if ((c == '=') || ((c < 128) && kBase64Values[c] <= 0x3F))
++dataLength;
}
if (!partial)
if ((dataLength % 4) != 0)
throw Exception("Invalid length for a base64-encoded string");
return dataLength;
}
static size_t countLength(const std::list<UString> &str) {
size_t dataLength = 0;
for (const auto &s : str)
dataLength += countLength(s, true);
if ((dataLength % 4) != 0)
throw Exception("Invalid length for a base64-encoded string");
return dataLength;
}
void encodeBase64(ReadStream &data, UString &base64) {
UString overhang;
encodeBase64(data, base64, SIZE_MAX, overhang);
}
void encodeBase64(ReadStream &data, std::list<UString> &base64, size_t lineLength) {
UString overhang;
// Base64-encode the data, creating a new string after every lineLength characters
do {
base64.push_back(UString());
} while (encodeBase64(data, base64.back(), lineLength, overhang));
// Trim empty strings from the back
while (!base64.empty() && base64.back().empty())
base64.pop_back();
}
SeekableReadStream *decodeBase64(const UString &base64) {
const size_t dataLength = (countLength(base64) / 4) * 3;
std::unique_ptr<byte[]> data = std::make_unique<byte[]>(dataLength);
MemoryWriteStream output(data.get(), dataLength);
UString overhang;
decodeBase64(output, base64, overhang);
return new MemoryReadStream(data.release(), output.pos(), true);
}
SeekableReadStream *decodeBase64(const std::list<UString> &base64) {
const size_t dataLength = (countLength(base64) / 4) * 3;
std::unique_ptr<byte[]> data = std::make_unique<byte[]>(dataLength);
MemoryWriteStream output(data.get(), dataLength);
UString overhang;
for (std::list<UString>::const_iterator b = base64.begin(); b != base64.end(); ++b)
decodeBase64(output, *b, overhang);
return new MemoryReadStream(data.release(), output.pos(), true);
}
} // End of namespace Common
|
// include/sys/ioctl.h
//
// Portions of this software may have been derived from OpenBSD or other sources,
//
//
// Author(s): gthomas
// Contributors: gthomas
// Purpose:
// Description:
//
/* $OpenBSD: ioctl.h,v 1.3 1996/03/03 12:11:50 niklas Exp $ */
/* $NetBSD: ioctl.h,v 1.20 1996/01/30 18:21:47 thorpej Exp $ */
#ifndef _SYS_IOCTL_H_
#define _SYS_IOCTL_H_
#ifndef __ECOS
#include <sys/ttycom.h>
/*
* Pun for SunOS prior to 3.2. SunOS 3.2 and later support TIOCGWINSZ
* and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented
* nonwithstanding).
*/
struct ttysize {
unsigned short ts_lines;
unsigned short ts_cols;
unsigned short ts_xxx;
unsigned short ts_yyy;
};
#define TIOCGSIZE TIOCGWINSZ
#define TIOCSSIZE TIOCSWINSZ
#endif
#include <sys/ioccom.h>
#ifndef __ECOS
#include <sys/dkio.h>
#include <sys/filio.h>
#endif
#include <sys/sockio.h>
#ifndef _KERNEL
#include <sys/cdefs.h>
__BEGIN_DECLS
int ioctl __P((int, unsigned long, ...));
__END_DECLS
#endif /* !_KERNEL */
#endif /* !_SYS_IOCTL_H_ */
/*
* Keep outside _SYS_IOCTL_H_
* Compatability with old terminal driver
*
* Source level -> #define USE_OLD_TTY
* Kernel level -> options COMPAT_43 or COMPAT_SUNOS or ...
*/
#if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) || \
defined(COMPAT_SVR4) || defined(COMPAT_FREEBSD)
#include <sys/ioctl_compat.h>
#endif
|
using LightDirector.Domain;
namespace LightDirector
{
public interface IEffectView<T> where T : EffectBase
{
}
}
|
package com.xxl.job.database.meta;
import com.xxl.job.database.dboperate.DBManager;
/**
* mysql
*
*/
public class MySQLDatabaseMeta extends DatabaseMeta {
public MySQLDatabaseMeta() {
this.dbType = DBManager.MYSQL_DB;
}
}
|
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<!-- Incluimos los archivos Javascript externos -->
<script src='jquery.js'></script>
<script src='amazingslider.js'></script>
<script src='initslider-1.js'></script>
<style>
a{
font-family:Tahoma;
font-size:13px;
color:#2E2E2E;
text-decoration:none;}
p{
text-align:right;}
</style>
</head>
<body bgcolor="transparent"><br>
<!-- Div contenedor general -->
<div style="margin:70px auto;max-width:900px;">
<div id="amazingslider-1" style="display:block;position:relative;margin:16px auto 86px;">
<ul class="<API key>" style="display:none;">
<?php
$directorio = opendir("imagenes");
while ($archivo = readdir($directorio))//Obtiene archivos sucesivamente
{
if (is_dir($archivo))//verificamos si es o no un directorio
{// si es directorio no hace nada
}
else//si no lo es muestra la imagen y su nombre(alt)
{
echo "<li>
<img src='imagenes/$archivo'/ alt='$archivo'/>
</li> ";
}
}
?>
</ul>
<!-- Div inferior donde se muestran barra con miniaturas-->
<ul class="<API key>" style="display:none;">
<?php
$directorio = opendir("imagenes"); //ruta actual
while ($archivo = readdir($directorio))//Obtiene archivos sucesivamente
{
if (is_dir($archivo))
//verificamos si es o no un directorio
{// si es directorio no hace nada
}
else//si no lo es muestra la imagen
{
echo "<li>
<img src='imagenes/$archivo'/>
</li> ";
}
}
?>
</ul>
</div>
</div><br><br>
<p>
<a href="../../panelGalerias.php"> Volver al panel de Galerías
<img src="../../iconos/flecha.png" height="40px" width="40px" align="right">
</a>
</p>
</body>
</html>
|
<?php
namespace Volantus\FlightBase\Src\General\MSP;
use Volantus\MSPProtocol\Src\Protocol\Response\Response;
/**
* Class MSPResponseMessage
*
* @package Volantus\FlightBase\Src\General\MSP
*/
class MSPResponseMessage
{
/**
* @var string
*/
private $id;
/**
* @var Response
*/
private $mspResponse;
/**
* MSPResponseMessage constructor.
*
* @param string $id
* @param Response $mspResponse
*/
public function __construct(string $id, Response $mspResponse)
{
$this->id = $id;
$this->mspResponse = $mspResponse;
}
/**
* @return string
*/
public function getId(): string
{
return $this->id;
}
/**
* @return Response
*/
public function getMspResponse(): Response
{
return $this->mspResponse;
}
}
|
:: This sets up the bare windows7 system
:: with my basic preferences
:: Installed drivers
:: Installed chrome
:: Installed dropbox
:: Dropbox
"https://github.com/Erotemic/local/archive/master.zip"
set HOME=%USERPROFILE%
set APP_PATH=%HOME%\local\apps
set PATH=%APP_PATH%;%PATH%
:: Install Drivers
:: Install WGET
:: http://gnuwin32.sourceforge.net/packages/wget.htm
set WGET=%APP_PATH%\wget.exe
:: Install GVIM
set GVIM_EXE="ftp://ftp.vim.org/pub/vim/pc/gvim74.exe"
:: TrueCrypt
:: Install Python
wget "http:
wget "http:
md5sum python-2.7.6.msi > tmppymd5
set /p PYMD5_VAL= < tmppymd5
del tmppymd5
set PYMD5=<API key> *python-2.7.6.msi
if "%PYMD5%" NEQ "%PYMD5_VAL%" (
echo "md5 failed"
goto :exit_fail
) else (
echo "md5 passed"
)
gpg --keyserver keys.gnupg.net
gpg --recv-keys 7D9DC8D2 :: martin v lowis's key
:: Install GIT
:: Install 7zip
:: Install MinGW
:: Install AutoHotKey
set AHK_URL="http://l.autohotkey.net/<API key>.exe"
:: Install Chrome
:: Install Steam
:: Install Windows Updates
:: Install Other:
:: FileZilla
:: WinSplit Revolution
:: Spotify
:: RapidEE
:: Cisco VPN
:: Microsoft Security Essentials
:: Flux
:: VLC
:: Sumatra
:: Dropbox
:: Zotero
:: Dia
:: Flux
:: Inno Setup 5
::
:: PeerBlock
:: Reaper
:: Audacity
:: LibreOffice
:: PS
::
:: MiTeX 2.9
:: GhostScript
::
:: StarCraft2
:: GnuWin32?
:: Github?
:: Skype?
:exit_success
echo "SUCCESS"
:exit_fail
echo "FAILURE!"
|
#include "if_expression.h"
#include <glog/logging.h>
#include "../internal/compilation.h"
#include "../public/value.h"
namespace afc {
namespace vm {
namespace {
class IfExpression : public Expression {
public:
IfExpression(std::shared_ptr<Expression> cond,
std::shared_ptr<Expression> true_case,
std::shared_ptr<Expression> false_case,
std::unordered_set<VMType> return_types)
: cond_(std::move(cond)),
true_case_(std::move(true_case)),
false_case_(std::move(false_case)),
return_types_(std::move(return_types)) {
CHECK(cond_ != nullptr);
CHECK(cond_->IsBool());
CHECK(true_case_ != nullptr);
CHECK(false_case_ != nullptr);
}
std::vector<VMType> Types() override { return true_case_->Types(); }
std::unordered_set<VMType> ReturnTypes() const override {
return return_types_;
}
PurityType purity() override {
return cond_->purity() == PurityType::kPure &&
true_case_->purity() == PurityType::kPure &&
false_case_->purity() == PurityType::kPure
? PurityType::kPure
: PurityType::kUnknown;
}
futures::Value<EvaluationOutput> Evaluate(Trampoline* trampoline,
const VMType& type) override {
return trampoline->Bounce(cond_.get(), VMType::Bool())
.Transform([type, true_case = true_case_, false_case = false_case_,
trampoline](EvaluationOutput cond_output) {
switch (cond_output.type) {
case EvaluationOutput::OutputType::kReturn:
case EvaluationOutput::OutputType::kAbort:
return futures::Past(std::move(cond_output));
case EvaluationOutput::OutputType::kContinue:
return trampoline->Bounce(cond_output.value->boolean
? true_case.get()
: false_case.get(),
type);
}
auto error = afc::editor::Error(L"Unhandled OutputType case.");
LOG(FATAL) << error;
return futures::Past(EvaluationOutput::Abort(error));
});
}
std::unique_ptr<Expression> Clone() override {
return std::make_unique<IfExpression>(cond_, true_case_, false_case_,
return_types_);
}
private:
const std::shared_ptr<Expression> cond_;
const std::shared_ptr<Expression> true_case_;
const std::shared_ptr<Expression> false_case_;
const std::unordered_set<VMType> return_types_;
};
} // namespace
std::unique_ptr<Expression> NewIfExpression(
Compilation* compilation, std::unique_ptr<Expression> condition,
std::unique_ptr<Expression> true_case,
std::unique_ptr<Expression> false_case) {
if (condition == nullptr || true_case == nullptr || false_case == nullptr) {
return nullptr;
}
if (!condition->IsBool()) {
compilation->errors.push_back(
L"Expected bool value for condition of \"if\" expression but found " +
TypesToString(condition->Types()) + L".");
return nullptr;
}
if (!(true_case->Types() == false_case->Types())) {
compilation->errors.push_back(
L"Type mismatch between branches of conditional expression: " +
TypesToString(true_case->Types()) + L" and " +
TypesToString(false_case->Types()) + L".");
return nullptr;
}
std::wstring error;
auto return_types = CombineReturnTypes(true_case->ReturnTypes(),
false_case->ReturnTypes(), &error);
if (!return_types.has_value()) {
compilation->errors.push_back(error);
return nullptr;
}
return std::make_unique<IfExpression>(
std::move(condition), std::move(true_case), std::move(false_case),
std::move(return_types.value()));
}
} // namespace vm
} // namespace afc
|
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="de">
<head>
<!-- Generated by javadoc (version 1.7.0_80) on Sat Dec 19 22:20:05 CET 2015 -->
<title><API key> (Genji Scrum Tool & Issue Tracking API Documentation 5.0.1)</title>
<meta name="date" content="2015-12-19">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="<API key> (Genji Scrum Tool & Issue Tracking API Documentation 5.0.1)";
}
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar_top">
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/aurel/track/item/action/<API key>.html" title="class in com.aurel.track.item.action"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../com/aurel/track/item/action/<API key>.html" title="class in com.aurel.track.item.action"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/aurel/track/item/action/<API key>.html" target="_top">Frames</a></li>
<li><a href="<API key>.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
</a></div>
<div class="header">
<div class="subTitle">com.aurel.track.item.action</div>
<h2 title="Class <API key>" class="title">Class <API key></h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../../com/aurel/track/item/action/<API key>.html" title="class in com.aurel.track.item.action">com.aurel.track.item.action.<API key></a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../com/aurel/track/item/action/NewItemActionPlugin.html" title="class in com.aurel.track.item.action">com.aurel.track.item.action.NewItemActionPlugin</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../com/aurel/track/item/action/<API key>.html" title="class in com.aurel.track.item.action">com.aurel.track.item.action.<API key></a></li>
<li>
<ul class="inheritance">
<li>com.aurel.track.item.action.<API key></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../../com/aurel/track/item/action/IPluginItemAction.html" title="interface in com.aurel.track.item.action">IPluginItemAction</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong"><API key></span>
extends <a href="../../../../../com/aurel/track/item/action/<API key>.html" title="class in com.aurel.track.item.action"><API key></a></pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../com/aurel/track/item/action/<API key>.html#<API key>()"><API key></a></strong>()</code> </td>
</tr>
</table>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="method_summary">
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected <a href="../../../../../com/aurel/track/fieldType/runtime/base/WorkItemContext.html" title="class in com.aurel.track.fieldType.runtime.base">WorkItemContext</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../com/aurel/track/item/action/<API key>.html#createCtx(com.aurel.track.item.ItemLocationForm,%20java.lang.Integer,%20java.util.Locale)">createCtx</a></strong>(<a href="../../../../../com/aurel/track/item/ItemLocationForm.html" title="class in com.aurel.track.item">ItemLocationForm</a> form,
java.lang.Integer personID,
java.util.Locale locale)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/aurel/track/item/action/<API key>.html#isEnabled(java.lang.Integer,%20com.aurel.track.beans.TWorkItemBean,%20boolean,%20boolean,%20int)">isEnabled</a></strong>(java.lang.Integer personID,
<a href="../../../../../com/aurel/track/beans/TWorkItemBean.html" title="class in com.aurel.track.beans">TWorkItemBean</a> workItemBean,
boolean allowedToChange,
boolean allowedToCreate,
int appEdition)</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="<API key>.aurel.track.item.action.<API key>">
</a>
<h3>Methods inherited from class com.aurel.track.item.action.<a href="../../../../../com/aurel/track/item/action/<API key>.html" title="class in com.aurel.track.item.action"><API key></a></h3>
<code><a href="../../../../../com/aurel/track/item/action/<API key>.html#editItem(java.util.Map,%20java.lang.Integer,%20java.util.Map,%20java.lang.Integer,%20java.lang.Integer)">editItem</a>, <a href="../../../../../com/aurel/track/item/action/<API key>.html#encodeJsonDataStep1(java.util.Locale,%20com.aurel.track.beans.TPersonBean,%20java.lang.Integer,%20java.lang.Integer,%20java.lang.Integer,%20java.lang.Integer,%20java.lang.String,%20java.lang.String)">encodeJsonDataStep1</a>, <a href="../../../../../com/aurel/track/item/action/<API key>.html#extractItemLocation(java.util.Locale,%20com.aurel.track.beans.TPersonBean,%20java.util.Map,%20java.lang.Integer,%20java.lang.Integer)">extractItemLocation</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="<API key>.aurel.track.item.action.NewItemActionPlugin">
</a>
<h3>Methods inherited from class com.aurel.track.item.action.<a href="../../../../../com/aurel/track/item/action/NewItemActionPlugin.html" title="class in com.aurel.track.item.action">NewItemActionPlugin</a></h3>
<code><a href="../../../../../com/aurel/track/item/action/NewItemActionPlugin.html#<API key>()"><API key></a>, <a href="../../../../../com/aurel/track/item/action/NewItemActionPlugin.html#next(java.util.Locale,%20com.aurel.track.beans.TPersonBean,%20java.lang.Integer,%20java.lang.Integer,%20java.util.Map,%20java.lang.String,%20java.lang.String)">next</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="<API key>.aurel.track.item.action.<API key>">
</a>
<h3>Methods inherited from class com.aurel.track.item.action.<a href="../../../../../com/aurel/track/item/action/<API key>.html" title="class in com.aurel.track.item.action"><API key></a></h3>
<code><a href="../../../../../com/aurel/track/item/action/<API key>.html#parseBoolean(java.lang.Object)">parseBoolean</a>, <a href="../../../../../com/aurel/track/item/action/<API key>.html#parseInt(java.lang.Object)">parseInt</a>, <a href="../../../../../com/aurel/track/item/action/<API key>.html#saveInFirsStep(java.util.Locale,%20com.aurel.track.beans.TPersonBean,%20java.lang.Integer,%20java.util.Map)">saveInFirsStep</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="<API key>.lang.Object">
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
</a>
<h3>Constructor Detail</h3>
<a name="<API key>()">
</a>
<ul class="blockListLast">
<li class="blockList">
<h4><API key></h4>
<pre>public <API key>()</pre>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="method_detail">
</a>
<h3>Method Detail</h3>
<a name="createCtx(com.aurel.track.item.ItemLocationForm, java.lang.Integer, java.util.Locale)">
</a>
<ul class="blockList">
<li class="blockList">
<h4>createCtx</h4>
<pre>protected <a href="../../../../../com/aurel/track/fieldType/runtime/base/WorkItemContext.html" title="class in com.aurel.track.fieldType.runtime.base">WorkItemContext</a> createCtx(<a href="../../../../../com/aurel/track/item/ItemLocationForm.html" title="class in com.aurel.track.item">ItemLocationForm</a> form,
java.lang.Integer personID,
java.util.Locale locale)</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../../../com/aurel/track/item/action/<API key>.html#createCtx(com.aurel.track.item.ItemLocationForm,%20java.lang.Integer,%20java.util.Locale)">createCtx</a></code> in class <code><a href="../../../../../com/aurel/track/item/action/<API key>.html" title="class in com.aurel.track.item.action"><API key></a></code></dd>
</dl>
</li>
</ul>
<a name="isEnabled(java.lang.Integer, com.aurel.track.beans.TWorkItemBean, boolean, boolean, int)">
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>isEnabled</h4>
<pre>public boolean isEnabled(java.lang.Integer personID,
<a href="../../../../../com/aurel/track/beans/TWorkItemBean.html" title="class in com.aurel.track.beans">TWorkItemBean</a> workItemBean,
boolean allowedToChange,
boolean allowedToCreate,
int appEdition)</pre>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../com/aurel/track/item/action/IPluginItemAction.html#isEnabled(java.lang.Integer,%20com.aurel.track.beans.TWorkItemBean,%20boolean,%20boolean,%20int)">isEnabled</a></code> in interface <code><a href="../../../../../com/aurel/track/item/action/IPluginItemAction.html" title="interface in com.aurel.track.item.action">IPluginItemAction</a></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../../../com/aurel/track/item/action/<API key>.html#isEnabled(java.lang.Integer,%20com.aurel.track.beans.TWorkItemBean,%20boolean,%20boolean,%20int)">isEnabled</a></code> in class <code><a href="../../../../../com/aurel/track/item/action/<API key>.html" title="class in com.aurel.track.item.action"><API key></a></code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="bottomNav"><a name="navbar_bottom">
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/aurel/track/item/action/<API key>.html" title="class in com.aurel.track.item.action"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../com/aurel/track/item/action/<API key>.html" title="class in com.aurel.track.item.action"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/aurel/track/item/action/<API key>.html" target="_top">Frames</a></li>
<li><a href="<API key>.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
</a></div>
<p class="legalCopy"><small><a href="http://www.trackplus.com">Genji Scrum Tool & Issue Tracking API Documentation</a> <i>Copyright &
</body>
</html>
|
using System;
using System.Diagnostics;
using EasyRemote.Spec;
namespace EasyRemote.Impl.Extension
{
public static class PathExt
{
<summary>
Get path for program
</summary>
<param name="program">Program</param>
<returns>Full path</returns>
public static string GetPath(this IProgram program)
{
if (String.IsNullOrEmpty(program.Path))
{
return null;
}
Debug.Print("{0} => {1}", program.Path, Environment.<API key>(program.Path));
return Environment.<API key>(program.Path);
}
}
}
|
// Sound file format definition -- A. Amiruddin -- 25/12/2016
// REVISION HISTORY
// None
// This program is free software: you can redistribute it and/or modify
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#ifndef <API key>
#define <API key>
|
# This program is free software; you can redistribute it and/or
# published by the Free Software Foundation.
# This program is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# along with this program; if not, contact SUSE LLC.
# To contact SUSE about this file by physical or electronic mail,
module Pennyworth
class Command
def initialize
Cheetah.default_options = { :logger => logger }
end
def config
@config ||= YAML.load_file(File.dirname(__FILE__) + "/../../../config/setup.yml")
end
def logger
@logger ||= Logger.new("/tmp/pennyworth.log")
end
private
def print_ssh_config(vagrant, vm_name)
config = vagrant.ssh_config(vm_name)
config.each_pair do |host, host_config|
puts "#{host}\t#{host_config["HostName"]}"
end
end
end
end
|
# This file is part of ProbeDock.
# ProbeDock is free software: you can redistribute it and/or modify
# (at your option) any later version.
# ProbeDock is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
class TestPayloadPolicy < ApplicationPolicy
def index?
user.is?(:admin) || user.member_of?(organization)
end
class Scope < Scope
def resolve
if user.is? :admin
scope
else
scope.joins(project_version: :project).where('projects.organization_id = ?', organization.id)
end
end
end
class Serializer < Serializer
def to_builder options = {}
Jbuilder.new do |json|
json.id record.api_id
json.bytes record.contents_bytesize
json.state record.state
json.endedAt record.ended_at.iso8601(3)
json.receivedAt record.received_at.iso8601(3)
json.processingAt record.processing_at.iso8601(3) if record.processing_at
json.processedAt record.processed_at.iso8601(3) if record.processed_at
end
end
end
end
|
import net.sf.javabdd.*;
/**
* @author John Whaley
*/
public class NQueens {
static BDDFactory B;
static boolean TRACE;
static int N; /* Size of the chess board */
static BDD[][] X; /* BDD variable array */
static BDD queen; /* N-queen problem expressed as a BDD */
static BDD solution; /* One solution */
public static void main(String[] args) {
if (args.length != 1) {
System.err.println("USAGE: java NQueens N");
return;
}
N = Integer.parseInt(args[0]);
if (N <= 0) {
System.err.println("USAGE: java NQueens N");
return;
}
TRACE = true;
long time = System.currentTimeMillis();
runTest();
freeAll();
time = System.currentTimeMillis() - time;
System.out.println("Time: "+time/1000.+" seconds");
BDDFactory.CacheStats cachestats = B.getCacheStats();
if (cachestats != null && cachestats.uniqueAccess > 0) {
System.out.println(cachestats);
}
B.done();
B = null;
}
public static double runTest() {
if (B == null) {
/* Initialize with reasonable nodes and cache size and NxN variables */
String numOfNodes = System.getProperty("bddnodes");
int numberOfNodes;
if (numOfNodes == null)
numberOfNodes = (int) (Math.pow(4.42, N-6))*1000;
else
numberOfNodes = Integer.parseInt(numOfNodes);
String cache = System.getProperty("bddcache");
int cacheSize;
if (cache == null)
cacheSize = 1000;
else
cacheSize = Integer.parseInt(cache);
numberOfNodes = Math.max(1000, numberOfNodes);
B = BDDFactory.init(numberOfNodes, cacheSize);
}
if (B.varNum() < N * N) B.setVarNum(N * N);
queen = B.universe();
int i, j;
/* Build variable array */
X = new BDD[N][N];
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
X[i][j] = B.ithVar(i * N + j);
/* Place a queen in each row */
for (i = 0; i < N; i++) {
BDD e = B.zero();
for (j = 0; j < N; j++) {
e.orWith(X[i][j].id());
}
queen.andWith(e);
}
/* Build requirements for each variable(field) */
for (i = 0; i < N; i++)
for (j = 0; j < N; j++) {
if (TRACE) System.out.print("Adding position " + i + "," + j+" \r");
build(i, j);
}
solution = queen.satOne();
double result = queen.satCount();
/* Print the results */
if (TRACE) {
System.out.println("There are " + (long) result + " solutions.");
double result2 = solution.satCount();
System.out.println("Here is "+(long) result2 + " solution:");
solution.printSet();
System.out.println();
}
return result;
}
public static void freeAll() {
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++)
X[i][j].free();
queen.free();
solution.free();
}
static void build(int i, int j) {
BDD a = B.universe(), b = B.universe(), c = B.universe(), d = B.universe();
int k, l;
/* No one in the same column */
for (l = 0; l < N; l++) {
if (l != j) {
BDD u = X[i][l].apply(X[i][j], BDDFactory.nand);
a.andWith(u);
}
}
/* No one in the same row */
for (k = 0; k < N; k++) {
if (k != i) {
BDD u = X[i][j].apply(X[k][j], BDDFactory.nand);
b.andWith(u);
}
}
/* No one in the same up-right diagonal */
for (k = 0; k < N; k++) {
int ll = k - i + j;
if (ll >= 0 && ll < N) {
if (k != i) {
BDD u = X[i][j].apply(X[k][ll], BDDFactory.nand);
c.andWith(u);
}
}
}
/* No one in the same down-right diagonal */
for (k = 0; k < N; k++) {
int ll = i + j - k;
if (ll >= 0 && ll < N) {
if (k != i) {
BDD u = X[i][j].apply(X[k][ll], BDDFactory.nand);
d.andWith(u);
}
}
}
c.andWith(d);
b.andWith(c);
a.andWith(b);
queen.andWith(a);
}
}
|
using CP77.CR2W.Reflection;
using FastMember;
using static CP77.CR2W.Types.Enums;
namespace CP77.CR2W.Types
{
[REDMeta]
public class ItemCompareBuilder : IScriptable
{
[Ordinal(0)] [RED("item1")] public InventoryItemData Item1 { get; set; }
[Ordinal(1)] [RED("item2")] public InventoryItemData Item2 { get; set; }
[Ordinal(2)] [RED("compareBuilder")] public CHandle<CompareBuilder> CompareBuilder { get; set; }
public ItemCompareBuilder(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name) { }
}
}
|
<?php
namespace controllers\bases;
abstract class HttpBase extends UriMethodBase {
/**
* @var array
*/
protected $params;
function __construct() {
$uriSections = \Request::getInstance()->getUriSections();
$paramsUri = array_slice($uriSections, <API key>);
//This is not a magical number, we quit the empty one (0), controllers (1), method(2)
foreach ($this->getParamsNames() as $ind => $field) {
if (isset($paramsUri[$ind])) {
$this->params[$field] = \Sanitizer::cleanString($paramsUri[$ind]);
}
}
}
public function execute() {
$action = $this->getMethodCalled();
if (!method_exists($this, $action)) {
_logErr("Action '$action' not found, changing to 'render'");
$action = DEFAULT_METHOD;
}
return $this->$action();
}
public function getParam($type, $nameParam, $defaultValue) {
if(!isset($this->params[$nameParam])) {
return \Sanitizer::defineType($type, $defaultValue);
}
return \Sanitizer::defineType($type, $this->params[$nameParam]);
}
public abstract function getParamsNames();
public abstract function error();
}
|
<?php
$return_value = 0;
if(isset($_FILES['photo']))
{
$target_dir = "../../upload/news/doc/";
require "../config.php";
$total_files = sizeof($_FILES['photo']['name']);
$resp = '';
for($i = 0; $i < $total_files; $i++)
{
$tmp_name = $_FILES['photo']["tmp_name"][$i];
$name = $_FILES['photo']["name"][$i];
$cfg = new config();
$p_index = $cfg->index_of($name, ".");
$new_name = md5(date('Y-m-d H:i:s:u').$i);
$ext = substr($name, $p_index + 1, strlen($name));
$target_file = $target_dir.$new_name.".".$ext;
if (move_uploaded_file($tmp_name, $target_file))
{
$handle = fopen($target_file, "r");
$content = fread($handle, 4);
fclose($handle);
if($content == "%PDF")
{
$resp = $resp.'|'.str_replace(":", "$", $target_file);
}
else
{
$real_path = $_SERVER["DOCUMENT_ROOT"]."/gov_portal/backgp/upload/news/doc/".$new_name.".".$ext;
unlink($real_path);
}
$return_value = "y";
}
else {
$resp = 'Falha t: '.$name;
$return_value = "n";
}
}
}
else
{
$return_value = "n";
$resp = 'Não entrou no if!';
}
echo json_encode(array($return_value => $resp));
?>
|
package it.unimi.di.big.mg4j.query;
import it.unimi.di.big.mg4j.document.Document;
import it.unimi.di.big.mg4j.document.DocumentCollection;
import it.unimi.di.big.mg4j.document.DocumentFactory;
import it.unimi.di.big.mg4j.document.DocumentFactory.FieldType;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.io.<API key>;
import java.io.IOException;
import java.io.Reader;
import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.collections.ExtendedProperties;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.velocity.Template;
import org.apache.velocity.context.Context;
import org.apache.velocity.tools.view.servlet.VelocityViewServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** An generic item, displaying all document fields.
*
* <P>This kind of {@link it.unimi.di.big.mg4j.query.QueryServlet} item will display each field
* of a document inside a <samp>FIELDSET</samp> element. It is mainly useful for debugging purposes.
*/
public class GenericItem extends VelocityViewServlet {
private static final long serialVersionUID = 1L;
private static final Logger LOGGER = LoggerFactory.getLogger( GenericItem.class );
@Override
protected ExtendedProperties loadConfiguration( final ServletConfig config ) throws <API key>, IOException {
return HttpQueryServer.<API key>( super.loadConfiguration( config ) );
}
public Template handleRequest( final HttpServletRequest request, final HttpServletResponse response, final Context context ) throws Exception {
if ( request.getParameter( "doc" ) != null ) {
DocumentCollection collection = (DocumentCollection)getServletContext().getAttribute( "collection" );
response.setContentType( request.getParameter( "m" ) );
response.<API key>( "UTF-8" );
final Document document = collection.document( Long.parseLong( request.getParameter( "doc" ) ) );
final DocumentFactory factory = collection.factory();
final ObjectArrayList<String> fields = new ObjectArrayList<String>();
final int numberOfFields = factory.numberOfFields();
LOGGER.debug( "ParsingFactory declares " + numberOfFields + " fields" );
for( int field = 0; field < numberOfFields; field++ ) {
if ( factory.fieldType( field ) != FieldType.TEXT ) fields.add( StringEscapeUtils.escapeHtml( document.content( field ).toString() ) );
else fields.add( StringEscapeUtils.escapeHtml( IOUtils.toString( (Reader)document.content( field ) ) ).replaceAll( "\n", "<br>\n" ) );
}
context.put( "title", document.title() );
context.put( "fields", fields );
context.put( "factory", factory );
return getTemplate( "it/unimi/dsi/mg4j/query/generic.velocity" );
}
return null;
}
}
|
# noinspection <API key>
import wx
import gui.globalEvents as GE
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class AmmoToDmgPattern(ContextMenuSingle):
visibilitySetting = 'ammoPattern'
def __init__(self):
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
def display(self, callingWindow, srcContext, mainItem):
if srcContext not in ("marketItemGroup", "marketItemMisc") or self.mainFrame.getActiveFit() is None:
return False
if mainItem is None:
return False
for attr in ("emDamage", "thermalDamage", "explosiveDamage", "kineticDamage"):
if mainItem.getAttribute(attr) is not None:
return True
return False
def getText(self, callingWindow, itmContext, mainItem):
return "Set {} as Damage Pattern".format(itmContext if itmContext is not None else "Item")
def activate(self, callingWindow, fullContext, mainItem, i):
fitID = self.mainFrame.getActiveFit()
Fit.getInstance().setAsPattern(fitID, mainItem)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=(fitID,)))
def getBitmap(self, callingWindow, context, mainItem):
return None
AmmoToDmgPattern.register()
|
package net.adanicx.cyancraft.client.model;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.adanicx.cyancraft.client.OpenGLHelper;
import net.adanicx.cyancraft.entities.EntityArmorStand;
@SideOnly(Side.CLIENT)
public class ModelArmorStand extends <API key> {
public ModelRenderer standRightSide;
public ModelRenderer standLeftSide;
public ModelRenderer standWaist;
public ModelRenderer standBase;
public ModelArmorStand() {
this(0.0F);
}
public ModelArmorStand(float size) {
super(size, 64, 64);
bipedHead = new ModelRenderer(this, 0, 0);
bipedHead.addBox(-1.0F, -7.0F, -1.0F, 2, 7, 2, size);
bipedHead.setRotationPoint(0.0F, 0.0F, 0.0F);
bipedBody = new ModelRenderer(this, 0, 26);
bipedBody.addBox(-6.0F, 0.0F, -1.5F, 12, 3, 3, size);
bipedBody.setRotationPoint(0.0F, 0.0F, 0.0F);
bipedRightArm = new ModelRenderer(this, 24, 0);
bipedRightArm.addBox(-2.0F, -2.0F, -1.0F, 2, 12, 2, size);
bipedRightArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
bipedLeftArm = new ModelRenderer(this, 32, 16);
bipedLeftArm.mirror = true;
bipedLeftArm.addBox(0.0F, -2.0F, -1.0F, 2, 12, 2, size);
bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F);
bipedRightLeg = new ModelRenderer(this, 8, 0);
bipedRightLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 11, 2, size);
bipedRightLeg.setRotationPoint(-1.9F, 12.0F, 0.0F);
bipedLeftLeg = new ModelRenderer(this, 40, 16);
bipedLeftLeg.mirror = true;
bipedLeftLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 11, 2, size);
bipedLeftLeg.setRotationPoint(1.9F, 12.0F, 0.0F);
standRightSide = new ModelRenderer(this, 16, 0);
standRightSide.addBox(-3.0F, 3.0F, -1.0F, 2, 7, 2, size);
standRightSide.setRotationPoint(0.0F, 0.0F, 0.0F);
standRightSide.showModel = true;
standLeftSide = new ModelRenderer(this, 48, 16);
standLeftSide.addBox(1.0F, 3.0F, -1.0F, 2, 7, 2, size);
standLeftSide.setRotationPoint(0.0F, 0.0F, 0.0F);
standWaist = new ModelRenderer(this, 0, 48);
standWaist.addBox(-4.0F, 10.0F, -1.0F, 8, 2, 2, size);
standWaist.setRotationPoint(0.0F, 0.0F, 0.0F);
standBase = new ModelRenderer(this, 0, 32);
standBase.addBox(-6.0F, 11.0F, -6.0F, 12, 1, 12, size);
standBase.setRotationPoint(0.0F, 12.0F, 0.0F);
}
@Override
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entity) {
super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entity);
if (entity instanceof EntityArmorStand) {
EntityArmorStand stand = (EntityArmorStand) entity;
bipedLeftArm.showModel = stand.getShowArms();
bipedRightArm.showModel = stand.getShowArms();
standBase.showModel = !stand.hasNoBasePlate();
bipedLeftLeg.setRotationPoint(1.9F, 12.0F, 0.0F);
bipedRightLeg.setRotationPoint(-1.9F, 12.0F, 0.0F);
standRightSide.rotateAngleX = 0.017453292F * stand.getBodyRotation().getX();
standRightSide.rotateAngleY = 0.017453292F * stand.getBodyRotation().getY();
standRightSide.rotateAngleZ = 0.017453292F * stand.getBodyRotation().getZ();
standLeftSide.rotateAngleX = 0.017453292F * stand.getBodyRotation().getX();
standLeftSide.rotateAngleY = 0.017453292F * stand.getBodyRotation().getY();
standLeftSide.rotateAngleZ = 0.017453292F * stand.getBodyRotation().getZ();
standWaist.rotateAngleX = 0.017453292F * stand.getBodyRotation().getX();
standWaist.rotateAngleY = 0.017453292F * stand.getBodyRotation().getY();
standWaist.rotateAngleZ = 0.017453292F * stand.getBodyRotation().getZ();
standBase.rotateAngleX = 0.0F;
standBase.rotateAngleY = 0.017453292F * -entity.rotationYaw;
standBase.rotateAngleZ = 0.0F;
}
}
@Override
public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) {
super.render(p_78088_1_, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_);
OpenGLHelper.pushMatrix();
if (isChild) {
float f6 = 2.0F;
OpenGLHelper.scale(1.0F / f6, 1.0F / f6, 1.0F / f6);
OpenGLHelper.translate(0.0F, 24.0F * p_78088_7_, 0.0F);
standRightSide.render(p_78088_7_);
standLeftSide.render(p_78088_7_);
standWaist.render(p_78088_7_);
standBase.render(p_78088_7_);
} else {
if (p_78088_1_.isSneaking())
OpenGLHelper.translate(0.0F, 0.2F, 0.0F);
standRightSide.render(p_78088_7_);
standLeftSide.render(p_78088_7_);
standWaist.render(p_78088_7_);
standBase.render(p_78088_7_);
}
OpenGLHelper.popMatrix();
}
}
|
<?php include 'common_header.php'; ?>
<!-- Settings View Title -->
<h3><?php e($title); ?></h3>
<!-- Pasephrase Reset Form -->
<form id="<API key>" class="rounded" action="<?php u('/settings/accounts/reset'); ?>" method="post" accept-charset="UTF-8" enctype="multipart/form-data">
<fieldset>
<?php $alias = $account->get_default_alias(); ?>
Do you want to <strong>RESET</strong> the passphrase for <strong><?php e($alias->name); ?></strong> (<?php e($alias->email); ?>) ?
<br />
<?php e($alias->name); ?> will no longer be able to log in using the old passphrase.
<br /><br />
</fieldset>
<fieldset>
<p style="margin-bottom: 16px">
<label for="pass1">New Passphrase</label><br />
<input type="password" id="pass1" name="pass1" value="" />
</p>
<p style="margin-bottom: 32px">
<label for="pass2">New Passphrase (Repeat)</label><br />
<input type="password" id="pass2" name="pass2" value="" />
</p>
</fieldset>
<fieldset>
<?php \Common\Session::add_token($token = \Common\Security::get_random(16)); ?>
<input type="hidden" name="account_id" value="<?php e($account->id); ?>" />
<input type="hidden" name="csrf_token" id="csrf_token" value="<?php e($token); ?>" />
</fieldset>
<fieldset>
<button type="submit" class="rounded" name="button" value="yes">Reset Passphrase</button>
<button type="submit" class="rounded" name="button" value="no">Cancel</button>
</fieldset>
</form>
<!-- Standard Footers -->
<?php include 'common_footer.php'; ?>
|
"""import portalocker
with portalocker.Lock('text.txt', timeout=5) as fh:
fh.write("Sono in testLoxk2.py")
"""
from lockfile import LockFile
lock = LockFile('text.txt')
with lock:
print lock.path, 'is locked.'
with open('text.txt', "a") as file:
file.write("Sono in testLock2.py")
|
package ctlmc.bddgraph
import ctlmc.spec._
import ctlmc._
class GraphFactorySpec extends UnitSpec {
test("Creation") {
val factory = new GraphFactory()
}
}
class GraphSpec extends UnitSpec {
val factory = new GraphFactory()
factory.setParameters(Array(
("v1", (Array("F", "T").zipWithIndex.toMap, 0)),
("v2", (Array("F", "T").zipWithIndex.toMap, 1)),
("v3", (Array("F", "T").zipWithIndex.toMap, 2)),
("v4", (Array("F", "T").zipWithIndex.toMap, 3)),
("v5", (Array("F", "T").zipWithIndex.toMap, 4))
).toMap)
val params = Array[Int](0, 0, 0, 0, 0)
test("Single var State comparison, positive") {
assert(factory.createState(params).set(1, 1)
== factory.createState(params).set(1, 1))
}
test("Single var State comparison, negative") {
assert(factory.createState(params).set(1, 1)
!= factory.createState(params).set(2, 1))
}
test("Full StateSet comparison") {
assert(factory.createFullStateSet() == factory.createFullStateSet())
}
test("Empty StateSet comparison") {
assert(factory.createEmptyStateSet() == factory.createEmptyStateSet())
}
test("Custom StateSet comparison, positive 1") {
val s0 = factory.createState(params).set(1, 1)
assert(factory.createStateSet(s0) == factory.createStateSet(s0))
}
test("Custom StateSet comparison, positive 2") {
val s0 = factory.createState(params).set(0, 1)
val s1 = factory.createState(params).set(1, 1)
assert(factory.createStateSet(Array(s0, s1))
== factory.createStateSet(Array(s1, s0)))
}
test("Custom StateSet comparison, negative") {
val s0 = factory.createState(params).set(0, 1)
val s1 = factory.createState(params).set(1, 1)
assert(factory.createStateSet(s0) != factory.createStateSet(s1))
}
test("Graph size") {
val s0 = factory.createState(params).set(0, 1)
val s1 = factory.createState(params).set(1, 1)
val s2 = factory.createState(params).set(2, 1)
val graph = factory.createGraph(Array(
factory.createEdge(s0, s1),
factory.createEdge(s1, s2),
factory.createEdge(s2, s0)
))
assert(graph.countEdges == 3)
}
test("Preimage, segment") {
val s0 = factory.createState(params).set(0, 1)
val s1 = factory.createState(params).set(1, 1)
val graph = factory.createGraph(Array(
factory.createEdge(s0, s1)
))
val set = factory.createStateSet(s1)
val pre = graph.preimage(set)
assert(pre == factory.createStateSet(s0))
}
test("Preimage, line") {
val s0 = factory.createState(params).set(0, 1)
val s1 = factory.createState(params).set(1, 1)
val s2 = factory.createState(params).set(2, 1)
val graph = factory.createGraph(Array(
factory.createEdge(s0, s1),
factory.createEdge(s1, s2),
factory.createEdge(s2, s0)
))
val set = factory.createStateSet(s2)
val pre = graph.preimage(set)
assert(pre == factory.createStateSet(s1))
}
test("Preimage, triangle") {
val s0 = factory.createState(params).set(0, 1)
val s1 = factory.createState(params).set(1, 1)
val s2 = factory.createState(params).set(2, 1)
val graph = factory.createGraph(Array(
factory.createEdge(s0, s1),
factory.createEdge(s1, s2),
factory.createEdge(s2, s0)
))
val set = factory.createStateSet(s0)
val pre = graph.preimage(set)
assert(pre == factory.createStateSet(s2))
}
}
|
# This module is for compatibility only. All functions are defined elsewhere.
__all__ = ['rand', 'tril', 'trapz', 'hanning', 'rot90', 'triu', 'diff', 'angle',
'roots', 'ptp', 'kaiser', 'randn', 'cumprod', 'diag', 'msort',
'LinearAlgebra', 'RandomArray', 'prod', 'std', 'hamming', 'flipud',
'max', 'blackman', 'corrcoef', 'bartlett', 'eye', 'squeeze', 'sinc',
'tri', 'cov', 'svd', 'min', 'median', 'fliplr', 'eig', 'mean']
import numpy.oldnumeric.linear_algebra as LinearAlgebra
import numpy.oldnumeric.random_array as RandomArray
from numpy import tril, trapz as _Ntrapz, hanning, rot90, triu, diff, \
angle, roots, ptp as _Nptp, kaiser, cumprod as _Ncumprod, \
diag, msort, prod as _Nprod, std as _Nstd, hamming, flipud, \
amax as _Nmax, amin as _Nmin, blackman, bartlett, \
squeeze, sinc, median, fliplr, mean as _Nmean, transpose
from numpy.linalg import eig, svd
from numpy.random import rand, randn
import numpy as np
from typeconv import convtypecode
def eye(N, M=None, k=0, typecode=None, dtype=None):
""" eye returns a N-by-M 2-d array where the k-th diagonal is all ones,
and everything else is zeros.
"""
dtype = convtypecode(typecode, dtype)
if M is None: M = N
m = np.equal(np.subtract.outer(np.arange(N), np.arange(M)),-k)
if m.dtype != dtype:
return m.astype(dtype)
def tri(N, M=None, k=0, typecode=None, dtype=None):
""" returns a N-by-M array where all the diagonals starting from
lower left corner up to the k-th are all ones.
"""
dtype = convtypecode(typecode, dtype)
if M is None: M = N
m = np.greater_equal(np.subtract.outer(np.arange(N), np.arange(M)),-k)
if m.dtype != dtype:
return m.astype(dtype)
def trapz(y, x=None, axis=-1):
return _Ntrapz(y, x, axis=axis)
def ptp(x, axis=0):
return _Nptp(x, axis)
def cumprod(x, axis=0):
return _Ncumprod(x, axis)
def max(x, axis=0):
return _Nmax(x, axis)
def min(x, axis=0):
return _Nmin(x, axis)
def prod(x, axis=0):
return _Nprod(x, axis)
def std(x, axis=0):
N = asarray(x).shape[axis]
return _Nstd(x, axis)*sqrt(N/(N-1.))
def mean(x, axis=0):
return _Nmean(x, axis)
# This is exactly the same cov function as in MLab
def cov(m, y=None, rowvar=0, bias=0):
if y is None:
y = m
else:
y = y
if rowvar:
m = transpose(m)
y = transpose(y)
if (m.shape[0] == 1):
m = transpose(m)
if (y.shape[0] == 1):
y = transpose(y)
N = m.shape[0]
if (y.shape[0] != N):
raise ValueError("x and y must have the same number of observations")
m = m - _Nmean(m,axis=0)
y = y - _Nmean(y,axis=0)
if bias:
fact = N*1.0
else:
fact = N-1.0
return squeeze(dot(transpose(m), conjugate(y)) / fact)
from numpy import sqrt, multiply
def corrcoef(x, y=None):
c = cov(x, y)
d = diag(c)
return c/sqrt(multiply.outer(d,d))
from compat import *
from functions import *
from precision import *
from ufuncs import *
from misc import *
import compat
import precision
import functions
import misc
import ufuncs
import numpy
__version__ = numpy.__version__
del numpy
__all__ += ['__version__']
__all__ += compat.__all__
__all__ += precision.__all__
__all__ += functions.__all__
__all__ += ufuncs.__all__
__all__ += misc.__all__
del compat
del functions
del precision
del ufuncs
del misc
|
<?php
$NAME='<API key> malware_signature- ID 2369';
$TAGCLEAR='WSOsetcookie(md5(@?$_SERVER[[\'"]HTTP_HOST[\'"]])';
$TAGBASE64='<API key>==';
$TAGHEX='57534f736574636f6f6b6965286d643528403f245f5345525645525b5b5c27225d485454505f484f53545b5c27225d5d29';
$TAGHEXPHP='';
$TAGURI='WSOsetcookie%28md5%28%40%3F%24_SERVER%5B%5B%5C%27%22%5DHTTP_HOST%5B%5C%27%22%5D%5D%29';
$TAGCLEAR2='';
$TAGBASE642='';
$TAGHEX2='';
$TAGHEXPHP2='';
$TAGURI2='';
$DATEADD='10/09/2019';
$LINK='Webexploitscan.org ;<API key> malware_signature- ID 2369 ';
$ACTIVED='1';
$VSTATR='malware_signature';
|
#include "config.h"
#include "hardware.h"
#include "data.h"
#include "instruction.h"
#include "rung.h"
#include "plclib.h"
#include "project.h"
int project_task(plc_t p)
{
BYTE one, two, three;
one = resolve(p, BOOL_DI, 1);
two = fe(p, BOOL_DI, 2);
three = re(p, BOOL_DI, 3);
/* contact(p,BOOL_DQ,1,one);
contact(p,BOOL_DQ,2,two);
contact(p,BOOL_DQ,3,three); */
if (one)
set(p, BOOL_TIMER, 0);
if (three)
reset(p, BOOL_TIMER, 0);
if (two)
down_timer(p, 0);
return 0;
}
int project_init()
{
return 0;
}
|
#include <vgStableHeaders.h>
#include "vgentry/vgSound3DEntry.h"
#include <vgUIController/vgPropertyPage.h>
#include <vgUIController/vgUIController.h>
#include <vgKernel/vgkVec3.h>
#include <vgMesh/vgmMeshManager.h>
//#include <vgMath/vgfVector3.h>
#include <vgKernel/vgkSelectManager.h>
PropertiesParam vgSound3DEntry::s_ParamArray[s_NumOfParam];
vgSound3DEntry::vgSound3DEntry(vgSound::Sound3D* renderer)
:vgBaseEntry( renderer )
{
sound= (vgSound::Sound3D *)renderer;
if (sound)
{
m_sCaption = sound->getName();
b_play = sound->getPlayFlag();
x = sound->getSoundPos().x + vgKernel::CoordSystem::getSingleton().getProjectionCoord().x;
y = sound->getSoundPos().y + vgKernel::CoordSystem::getSingleton().getProjectionCoord().y;
z = sound->getSoundPos().z + vgKernel::CoordSystem::getSingleton().getProjectionCoord().z;
zMinus = -z;
sound->registerObserver( this );
vgKernel::CoordSystem::getSingleton().registerObserver(this);
}
}
vgSound3DEntry::~vgSound3DEntry(void)
{
sound->unregisterObserver( this );
sound = NULL;
}
void vgSound3DEntry::OnPropertyChanged(string paramName)
{
z = - zMinus;
vgSound::Sound3D *sound = (vgSound::Sound3D *)m_Renderer;
vgKernel::Vec3 aa = vgKernel::CoordSystem::getSingleton().getProjectionCoord();
sound->setAbsolutePos( x - aa.x, y - aa.y ,z - aa.z);
/* sound->GenBoundaryBox(sound->getSoundPos());*/
sound->setPlayFlag( b_play );
if (b_play)
{
sound->startPlaying( true );
}
else
sound->stopPlaying();
vgUI::UIController::getSingleton().GetWorkSpaceBar()->SetItemText(hTreeItem, m_Renderer->getName());
vgKernel::SelectManager::getSingleton().updateBox();
}
void vgSound3DEntry::onChanged(int eventId, void *param)
{
if (eventId == vgKernel::VG_OBS_PROPCHANGED)
{
vgSound::Sound3D *sound = (vgSound::Sound3D *)m_Renderer;
vgKernel::Vec3 xx = sound->getSoundPos();
x = xx.x + vgKernel::CoordSystem::getSingleton().getProjectionCoord().x;
y = xx.y + vgKernel::CoordSystem::getSingleton().getProjectionCoord().y;
z = xx.z + vgKernel::CoordSystem::getSingleton().getProjectionCoord().z;
//TRACE("New Camera Position %.2f %.2f %.2f \n", posPtr->x, posPtr->y, posPtr->z);
if (this == vgUI::UIController::getSingleton().<API key>())
{
s_ParamArray[1].pProp->SetValue(x);
s_ParamArray[2].pProp->SetValue(y);
zMinus = -z;
s_ParamArray[3].pProp->SetValue(zMinus);
}
}
if (eventId == vgKernel::<API key>)
{
vgUI::UIController::getSingleton().SelectNode(this);
}
if (eventId == vgKernel::VG_OBS_ADDSELECTION)
{
vgUI::UIController::getSingleton().AddSelection(this);
return ;
}
}
void vgSound3DEntry::AddNodeTabs()
{
vgUI::UIController::getSingleton().RemoveAllPages();
vgPropertiesViewBar* pageViewBar = vgUI::UIController::getSingleton().<API key>();
s_ParamArray[0].label = "×ø±êÖµÉèÖÃ";
s_ParamArray[0].typeId = PROP_ITEM_GROUP;
s_ParamArray[0].dataType = PROP_DATA_NONE;
s_ParamArray[0].connectedPtr = NULL;
s_ParamArray[0].comment = "ÉèÖÃÏà»úµÄ×ø±ê";
s_ParamArray[1].label = "X ×ø±ê";
s_ParamArray[1].typeId = PROP_ITEM_DATA;
s_ParamArray[1].dataType = PROP_DATA_FLOAT;
s_ParamArray[1].connectedPtr = &x;
s_ParamArray[1].comment = "ÉèÖÃX×ø±ê";
s_ParamArray[2].label = "Y ×ø±ê";
s_ParamArray[2].typeId = PROP_ITEM_DATA;
s_ParamArray[2].dataType = PROP_DATA_FLOAT;
s_ParamArray[2].connectedPtr = &y;
s_ParamArray[2].comment = "ÉèÖÃY×ø±ê";
s_ParamArray[3].label = "Z ×ø±ê";
s_ParamArray[3].typeId = PROP_ITEM_DATA;
s_ParamArray[3].dataType = PROP_DATA_FLOAT;
s_ParamArray[3].connectedPtr = &zMinus;
s_ParamArray[3].comment = "ÉèÖÃZ×ø±ê";
s_ParamArray[4].label = "ÆäËûÉèÖÃ";
s_ParamArray[4].typeId = PROP_ITEM_GROUP;
s_ParamArray[4].dataType = PROP_DATA_NONE;
s_ParamArray[4].connectedPtr = NULL;
s_ParamArray[4].comment = string();
s_ParamArray[5].label = "ÒôЧÃû³Æ";
s_ParamArray[5].typeId = PROP_ITEM_DATA;
s_ParamArray[5].dataType = PROP_DATA_STR;
s_ParamArray[5].connectedPtr = m_Renderer->getNamePtr();
s_ParamArray[5].comment = "ÎïÌåµÄÃû³Æ";
s_ParamArray[6].label = "ÊÇ·ñ²¥·Å";
s_ParamArray[6].typeId = PROP_ITEM_DATA;
s_ParamArray[6].dataType = PROP_DATA_BOOL;
s_ParamArray[6].connectedPtr = &b_play;
s_ParamArray[6].comment = "ÊÇ·ñ²¥·Å";
vgPropertyPage* propPage = vgUI::UIController::getSingleton().GetPropPage();
propPage->Create(NIDD_PROPERTY, pageViewBar->GetTabControl());
propPage->ConnectNode(this, s_ParamArray, s_NumOfParam);
pageViewBar->AddTab("×Ô¶¯ÊôÐÔ", propPage);
}
CMenu* vgSound3DEntry::GetContextMenu()
{
CMenu *menu = new CMenu;
VERIFY(menu->CreatePopupMenu());
VERIFY(menu->AppendMenu(MF_STRING, NID_MESH_DELETE,_T("ɾ³ý")));
return menu;
}
|
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>CommandManager xref</title>
<link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" />
</head>
<body>
<div id="overview"><a href="../../../../../apidocs/fspotcloud/server/model/command/CommandManager.html">View Javadoc</a></div><pre>
<a class="jxr_linenumber" name="1" href="#1">1</a> <strong class="jxr_keyword">package</strong> fspotcloud.server.model.command;
<a class="jxr_linenumber" name="2" href="#2">2</a>
<a class="jxr_linenumber" name="3" href="#3">3</a> <strong class="jxr_keyword">import</strong> java.util.List;
<a class="jxr_linenumber" name="4" href="#4">4</a>
<a class="jxr_linenumber" name="5" href="#5">5</a> <strong class="jxr_keyword">import</strong> javax.jdo.PersistenceManager;
<a class="jxr_linenumber" name="6" href="#6">6</a> <strong class="jxr_keyword">import</strong> javax.jdo.Query;
<a class="jxr_linenumber" name="7" href="#7">7</a>
<a class="jxr_linenumber" name="8" href="#8">8</a> <strong class="jxr_keyword">import</strong> com.google.inject.Inject;
<a class="jxr_linenumber" name="9" href="#9">9</a> <strong class="jxr_keyword">import</strong> com.google.inject.Provider;
<a class="jxr_linenumber" name="10" href="#10">10</a>
<a class="jxr_linenumber" name="11" href="#11">11</a> <strong class="jxr_keyword">import</strong> fspotcloud.server.model.api.Command;
<a class="jxr_linenumber" name="12" href="#12">12</a> <strong class="jxr_keyword">import</strong> fspotcloud.server.model.api.Commands;
<a class="jxr_linenumber" name="13" href="#13">13</a>
<a class="jxr_linenumber" name="14" href="#14">14</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../fspotcloud/server/model/command/CommandManager.html">CommandManager</a> <strong class="jxr_keyword">implements</strong> <a href="../../../../fspotcloud/server/model/api/Commands.html">Commands</a> {
<a class="jxr_linenumber" name="15" href="#15">15</a>
<a class="jxr_linenumber" name="16" href="#16">16</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> Provider<PersistenceManager> pmProvider;
<a class="jxr_linenumber" name="17" href="#17">17</a>
<a class="jxr_linenumber" name="18" href="#18">18</a> @Inject
<a class="jxr_linenumber" name="19" href="#19">19</a> <strong class="jxr_keyword">public</strong> <a href="../../../../fspotcloud/server/model/command/CommandManager.html">CommandManager</a>(Provider<PersistenceManager> pmProvider) {
<a class="jxr_linenumber" name="20" href="#20">20</a> <strong class="jxr_keyword">this</strong>.pmProvider = pmProvider;
<a class="jxr_linenumber" name="21" href="#21">21</a> }
<a class="jxr_linenumber" name="22" href="#22">22</a>
<a class="jxr_linenumber" name="23" href="#23">23</a> <em class="jxr_comment">/*</em>
<a class="jxr_linenumber" name="24" href="#24">24</a> <em class="jxr_comment"> * (non-Javadoc)</em>
<a class="jxr_linenumber" name="25" href="#25">25</a> <em class="jxr_comment"> * </em>
<a class="jxr_linenumber" name="26" href="#26">26</a> <em class="jxr_comment"> * @see fspotcloud.server.model.command.Commands#create()</em>
<a class="jxr_linenumber" name="27" href="#27">27</a> <em class="jxr_comment"> */</em>
<a class="jxr_linenumber" name="28" href="#28">28</a> <strong class="jxr_keyword">public</strong> <a href="../../../../fspotcloud/server/model/api/Command.html">Command</a> create() {
<a class="jxr_linenumber" name="29" href="#29">29</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../fspotcloud/server/model/command/CommandDO.html">CommandDO</a>();
<a class="jxr_linenumber" name="30" href="#30">30</a> }
<a class="jxr_linenumber" name="31" href="#31">31</a>
<a class="jxr_linenumber" name="32" href="#32">32</a> <em class="jxr_comment">/*</em>
<a class="jxr_linenumber" name="33" href="#33">33</a> <em class="jxr_comment"> * (non-Javadoc)</em>
<a class="jxr_linenumber" name="34" href="#34">34</a> <em class="jxr_comment"> * </em>
<a class="jxr_linenumber" name="35" href="#35">35</a> <em class="jxr_comment"> * @see fspotcloud.server.model.command.Commands#popOldestCommand()</em>
<a class="jxr_linenumber" name="36" href="#36">36</a> <em class="jxr_comment"> */</em>
<a class="jxr_linenumber" name="37" href="#37">37</a> @SuppressWarnings(<span class="jxr_string">"unchecked"</span>)
<a class="jxr_linenumber" name="38" href="#38">38</a> <strong class="jxr_keyword">public</strong> Object[] popOldestCommand() {
<a class="jxr_linenumber" name="39" href="#39">39</a> PersistenceManager pm = pmProvider.get();
<a class="jxr_linenumber" name="40" href="#40">40</a> <strong class="jxr_keyword">try</strong> {
<a class="jxr_linenumber" name="41" href="#41">41</a> Query query = pm.newQuery(CommandDO.<strong class="jxr_keyword">class</strong>);
<a class="jxr_linenumber" name="42" href="#42">42</a> query.setOrdering(<span class="jxr_string">"ctime"</span>);
<a class="jxr_linenumber" name="43" href="#43">43</a> query.setRange(0, 1);
<a class="jxr_linenumber" name="44" href="#44">44</a> List<CommandDO> cmdList = (List<CommandDO>) query.execute();
<a class="jxr_linenumber" name="45" href="#45">45</a> <strong class="jxr_keyword">if</strong> (cmdList.size() > 0) {
<a class="jxr_linenumber" name="46" href="#46">46</a> Command oldest = cmdList.get(0);
<a class="jxr_linenumber" name="47" href="#47">47</a> Object[] result = <strong class="jxr_keyword">new</strong> Object[2];
<a class="jxr_linenumber" name="48" href="#48">48</a> result[0] = oldest.getCmd();
<a class="jxr_linenumber" name="49" href="#49">49</a> result[1] = oldest.getArgs().toArray();
<a class="jxr_linenumber" name="50" href="#50">50</a> pm.deletePersistent(oldest);
<a class="jxr_linenumber" name="51" href="#51">51</a> <strong class="jxr_keyword">return</strong> result;
<a class="jxr_linenumber" name="52" href="#52">52</a> } <strong class="jxr_keyword">else</strong> {
<a class="jxr_linenumber" name="53" href="#53">53</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> Object[] {};
<a class="jxr_linenumber" name="54" href="#54">54</a> }
<a class="jxr_linenumber" name="55" href="#55">55</a> } <strong class="jxr_keyword">finally</strong> {
<a class="jxr_linenumber" name="56" href="#56">56</a> pm.close();
<a class="jxr_linenumber" name="57" href="#57">57</a> }
<a class="jxr_linenumber" name="58" href="#58">58</a> }
<a class="jxr_linenumber" name="59" href="#59">59</a>
<a class="jxr_linenumber" name="60" href="#60">60</a> <em class="jxr_comment">/*</em>
<a class="jxr_linenumber" name="61" href="#61">61</a> <em class="jxr_comment"> * (non-Javadoc)</em>
<a class="jxr_linenumber" name="62" href="#62">62</a> <em class="jxr_comment"> * </em>
<a class="jxr_linenumber" name="63" href="#63">63</a> <em class="jxr_comment"> * @see</em>
<a class="jxr_linenumber" name="64" href="#64">64</a> <em class="jxr_comment"> * fspotcloud.server.model.command.Commands#allReadyExists(java.lang.String,</em>
<a class="jxr_linenumber" name="65" href="#65">65</a> <em class="jxr_comment"> * java.util.List)</em>
<a class="jxr_linenumber" name="66" href="#66">66</a> <em class="jxr_comment"> */</em>
<a class="jxr_linenumber" name="67" href="#67">67</a> @SuppressWarnings(<span class="jxr_string">"unchecked"</span>)
<a class="jxr_linenumber" name="68" href="#68">68</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> allReadyExists(String cmd, List<String> args) {
<a class="jxr_linenumber" name="69" href="#69">69</a> PersistenceManager pm = pmProvider.get();
<a class="jxr_linenumber" name="70" href="#70">70</a> <strong class="jxr_keyword">try</strong> {
<a class="jxr_linenumber" name="71" href="#71">71</a> Query query = pm.newQuery(CommandDO.<strong class="jxr_keyword">class</strong>);
<a class="jxr_linenumber" name="72" href="#72">72</a> query.setFilter(<span class="jxr_string">"cmd == cmdParam && argsString == argsStringParam"</span>);
<a class="jxr_linenumber" name="73" href="#73">73</a> query.declareParameters(<span class="jxr_string">"String cmdParam, String argsStringParam"</span>);
<a class="jxr_linenumber" name="74" href="#74">74</a> List<CommandDO> rs = (List<CommandDO>) query.execute(cmd,
<a class="jxr_linenumber" name="75" href="#75">75</a> String.valueOf(args));
<a class="jxr_linenumber" name="76" href="#76">76</a> <strong class="jxr_keyword">return</strong> rs.size() > 0;
<a class="jxr_linenumber" name="77" href="#77">77</a> } <strong class="jxr_keyword">finally</strong> {
<a class="jxr_linenumber" name="78" href="#78">78</a> pm.close();
<a class="jxr_linenumber" name="79" href="#79">79</a> }
<a class="jxr_linenumber" name="80" href="#80">80</a> }
<a class="jxr_linenumber" name="81" href="#81">81</a>
<a class="jxr_linenumber" name="82" href="#82">82</a> <em class="jxr_comment">/*</em>
<a class="jxr_linenumber" name="83" href="#83">83</a> <em class="jxr_comment"> * (non-Javadoc)</em>
<a class="jxr_linenumber" name="84" href="#84">84</a> <em class="jxr_comment"> * </em>
<a class="jxr_linenumber" name="85" href="#85">85</a> <em class="jxr_comment"> * @see</em>
<a class="jxr_linenumber" name="86" href="#86">86</a> <em class="jxr_comment"> * fspotcloud.server.model.command.Commands#save(fspotcloud.server.model</em>
<a class="jxr_linenumber" name="87" href="#87">87</a> <em class="jxr_comment"> * .command.Command)</em>
<a class="jxr_linenumber" name="88" href="#88">88</a> <em class="jxr_comment"> */</em>
<a class="jxr_linenumber" name="89" href="#89">89</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> save(<a href="../../../../fspotcloud/server/model/api/Command.html">Command</a> c) {
<a class="jxr_linenumber" name="90" href="#90">90</a> PersistenceManager pm = pmProvider.get();
<a class="jxr_linenumber" name="91" href="#91">91</a> <strong class="jxr_keyword">try</strong> {
<a class="jxr_linenumber" name="92" href="
<a class="jxr_linenumber" name="93" href="#93">93</a> } <strong class="jxr_keyword">finally</strong> {
<a class="jxr_linenumber" name="94" href="#94">94</a> pm.close();
<a class="jxr_linenumber" name="95" href="#95">95</a> }
<a class="jxr_linenumber" name="96" href="#96">96</a> }
<a class="jxr_linenumber" name="97" href="#97">97</a>
<a class="jxr_linenumber" name="98" href="#98">98</a> @Override
<a class="jxr_linenumber" name="99" href="#99">99</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">int</strong> <API key>() {
<a class="jxr_linenumber" name="100" href="#100">100</a> PersistenceManager pm = pmProvider.get();
<a class="jxr_linenumber" name="101" href="#101">101</a> <strong class="jxr_keyword">int</strong> count = -1;
<a class="jxr_linenumber" name="102" href="#102">102</a> <strong class="jxr_keyword">try</strong> {
<a class="jxr_linenumber" name="103" href="#103">103</a> Query query = pm.newQuery(CommandDO.<strong class="jxr_keyword">class</strong>);
<a class="jxr_linenumber" name="104" href="#104">104</a> List<CommandDO> rs = (List<CommandDO>) query.execute();
<a class="jxr_linenumber" name="105" href="#105">105</a> count = rs.size();;
<a class="jxr_linenumber" name="106" href="#106">106</a> } <strong class="jxr_keyword">finally</strong> {
<a class="jxr_linenumber" name="107" href="#107">107</a> pm.close();
<a class="jxr_linenumber" name="108" href="#108">108</a> }
<a class="jxr_linenumber" name="109" href="#109">109</a>
<a class="jxr_linenumber" name="110" href="#110">110</a> <strong class="jxr_keyword">return</strong> count;
<a class="jxr_linenumber" name="111" href="#111">111</a> }
<a class="jxr_linenumber" name="112" href="#112">112</a>
<a class="jxr_linenumber" name="113" href="#113">113</a> }
</pre>
<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
</html>
|
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<title>Natural Europe Pathways <?php echo isset($title) ? ' | ' . strip_formatting($title) : ''; ?></title>
<!-- Meta -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Pathway test!" />
<meta name="Keywords" content="pathways">
<?php //echo <API key>(); ?>
<?php
$findme="students"; $pos = stripos($_SERVER['REQUEST_URI'],$findme);
$findme_exh="exhibits"; $pos_exhib = stripos($_SERVER['REQUEST_URI'],$findme_exh);
$findme_exh2="/exhibits/"; $pos_exhib2 = stripos($_SERVER['REQUEST_URI'],$findme_exh2);
$findme_resources = "resources"; $pos_resources = stripos($_SERVER['REQUEST_URI'],$findme_resources);
$findme_home = "home"; $pos_home = stripos($_SERVER['REQUEST_URI'],$findme_home);
$findme_collections = "collection"; $pos_collections = 0; $pos_collections = stripos($_SERVER['REQUEST_URI'],$findme_collections);
$findme_edu="educators"; $pos_edu = stripos($_SERVER['REQUEST_URI'],$findme_edu);
$findme_search="search"; $pos_search = stripos($_SERVER['REQUEST_URI'],$findme_search);
$findme_users="users"; $pos_users = stripos($_SERVER['REQUEST_URI'],$findme_users);
$findme_glos="glossary"; $pos_glos = stripos($_SERVER['REQUEST_URI'],$findme_glos);
$findme_res="research"; $pos_res = stripos($_SERVER['REQUEST_URI'],$findme_res);
$findme_disc="eid"; $pos_disc = stripos($_SERVER['REQUEST_URI'],$findme_disc);
?>
<!-- Stylesheets -->
<?php if(isset($_GET['nhm']) and $_GET['nhm']=='MNHN'){ ?>
<link rel="stylesheet" type="text/css" href="<?php echo uri('themes/natural/css/page_mnhn.css'); ?>"/>
<?php } elseif(isset($_GET['nhm']) and $_GET['nhm']=='TNHM'){ ?>
<link rel="stylesheet" type="text/css" href="<?php echo uri('themes/natural/css/page_tnhm.css'); ?>"/>
<?php } elseif(isset($_GET['nhm']) and $_GET['nhm']=='NHMC'){ ?>
<link rel="stylesheet" type="text/css" href="<?php echo uri('themes/natural/css/page_tnhm.css'); ?>"/>
<?php } elseif(isset($_GET['nhm']) and $_GET['nhm']=='HNHM'){ ?>
<link rel="stylesheet" type="text/css" href="<?php echo uri('themes/natural/css/page_tnhm.css'); ?>"/>
<?php } elseif(isset($_GET['nhm']) and $_GET['nhm']=='JME'){ ?>
<link rel="stylesheet" type="text/css" href="<?php echo uri('themes/natural/css/page_tnhm.css'); ?>"/>
<?php } elseif(isset($_GET['nhm']) and $_GET['nhm']=='AC'){ ?>
<link rel="stylesheet" type="text/css" href="<?php echo uri('themes/natural/css/page_tnhm.css'); ?>"/>
<?php } else{ ?>
<link rel="stylesheet" type="text/css" href="<?php echo uri('themes/natural/css/page.css'); ?>"/>
<?php } ?>
<link rel="shortcut icon" href="./images/fav.ico" />
<link rel="stylesheet" type="text/css" href="<?php echo uri('themes/natural/lightview/css/lightview.css');?>" />
<link rel="stylesheet" type="text/css" href="<?php echo uri('themes/natural/css/typography.css');?>"/>
<!--[if lt IE 8]><link href="<?php echo uri('themes/natural/css/page_ie7.css');?>" rel="stylesheet" type="text/css" media="screen" /><![endif]-->
<!-- JavaScripts -->
<script type="text/javascript" src="<?php echo uri('themes/natural/scripts/ajax/ajax.js');?>"></script>
<script type="text/javascript" src="<?php echo uri('themes/natural/scripts/ajax/ajax_chained.js');?>"></script>
<?php if ($pos_collections>'0'){ } else{
echo '<script type="text/javascript" src="'.uri('themes/natural/lightview/prototype.js').'"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/scriptaculous.js"></script>';
}
?>
<script type='text/javascript' src="<?php echo uri('themes/natural/lightview/js/lightview.js');?>"></script>
<script type='text/javascript' src="<?php echo uri('themes/natural/scripts/functions.js');?>"></script>
<?php if ($pos_exhib2>0){ ?>
<link rel="stylesheet" type="text/css" href="<?php echo uri('themes/natural/css/jquery.jscrollpane.css'); ?>"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>jQuery.noConflict();</script>
<?php } else{ ?>
<script type="text/javascript" language="javascript" src="<?php echo uri('themes/natural/javascripts/jquery.js'); ?>"></script>
<script>
jQuery.noConflict();
</script>
<?php } ?>
<script type="text/javascript" language="javascript" src="<?php echo uri('themes/natural/javascripts/main_tooltip.js'); ?>"></script>
<!-- Plugin Stuff -->
<?php echo plugin_header(); ?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-28875549-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https:
var s = document.<API key>('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<?php
session_start();
// store session data
$locale = Zend_Registry::get('Zend_Locale');
$_SESSION['get_language']=<API key>();
$_SESSION['get_language_omeka']=<API key>();
$_SESSION['<API key>']=<API key>();
?>
<div id="page-container">
<?php if(isset($_GET['nhm']) and ($_GET['nhm']=='MNHN' or $_GET['nhm']=='TNHM' or $_GET['nhm']=='NHMC' or $_GET['nhm']=='JME' or $_GET['nhm']=='HNHM' or $_GET['nhm']=='AC')){ ?>
<?php } else{ ?>
<div id="page-header">
<div style="float:left;"><h1><a href="<?php echo uri('index');?>"><img src="<?php echo uri('themes/natural/images/interface/logonatural.png'); ?>"></a></a></h1></div><!--end rx div
<div id="<API key>" class="menubar">
<ul id="<API key>">
<li><a href="<?php echo uri('admin/users/login');?>" title="Sign-in"><?php echo __('Sign-in'); ?></a></li>
</ul><!--end <API key> ul
</div><!--end <API key> div
</div><!--end page-header div
<div id="languages" style="position: absolute; top: 150px; right: 10px; width: 200px;">
<?php echo language_switcher(); ?>
</div>
<?php } ?>
|
!function(namespace) {
'use strict';
function Modal(elem, params) {
this.$element = jQuery(elem);
this.params = params || {};
this.cssReadyElement = this.params.cssReadyElement || 'JS-Modal-ready';
this.cssActiveElement = this.params.cssActiveElement || 'JS-Modal-active';
this.__construct();
}
Modal.prototype.__construct = function __construct() {
this.$box = this.$element.find('.JS-Modal-Box');
this.$close = this.$element.find('.JS-Modal-Close');
this.$title = this.$element.find('.JS-Modal-Title');
this.$container = this.$element.find('.JS-Modal-Container');
this._init();
};
Modal.prototype._init = function _init() {
var _this = this;
this.$close.on('click.JS-Modal', function() { _this._close.apply(_this, []); });
$('body').on("keyup", function(e) {
if ((e.keyCode == 27)) {
_this._close.apply(_this, []);
}
});
$('.JS-Gannt-Modal').click(function() {
if (_this.$element.hasClass('JS-Modal-active'))
_this._close.apply(_this, []);
});
$('.JS-Modal-Box').click(function(event){
event.stopPropagation();
});
/* API. Events */
this.$element.on('modal:setContent', function(e, data) { _this.setContent.apply(_this, [data]); });
this.$element.on('modal:open', function() { _this.open.apply(_this, []); });
this.$element.on('modal:close', function() { _this.close.apply(_this, []); });
this.$element.on('modal:clear', function() { _this.clear.apply(_this, []); });
this._ready();
} ;
Modal.prototype._ready = function _ready() {
this.$element
.addClass(this.cssReadyElement)
.addClass('JS-Modal-ready');
};
Modal.prototype._setContent = function _setContent(content) {
this.$container.html(content);
};
Modal.prototype._open = function _open() {
if (!this.$element.hasClass('JS-Modal-active')) {
this.$element
.addClass(this.cssActiveElement)
.addClass('JS-Modal-active')
}
};
Modal.prototype._close = function _close() {
if (this.$element.hasClass('JS-Modal-active')) {
this.$element
.removeClass(this.cssActiveElement)
.removeClass('JS-Modal-active');
}
};
Modal.prototype._clear = function _clear() {
};
/* API. Methods */
Modal.prototype.setContent = function setContent(content) {
if (!arguments.length) {
return false;
}
this._setContent(content);
};
Modal.prototype.open = function open() {
this._open();
};
Modal.prototype.close = function close() {
this._close();
};
Modal.prototype.clear = function clear() {
this._clear();
};
namespace.Modal = Modal;
}(this);
|
#include "hero/HookshotState.h"
#include "hero/FreeState.h"
#include "hero/HeroSprites.h"
#include "entities/MapEntities.h"
#include "entities/Hookshot.h"
/**
* @brief Constructor.
* @param hero the hero controlled by this state
*/
Hero::HookshotState::HookshotState(Hero &hero):
State(hero),
hookshot(NULL) {
}
/**
* @brief Destructor.
*/
Hero::HookshotState::~HookshotState() {
}
/**
* @brief Starts this state.
* @param previous_state the previous state
*/
void Hero::HookshotState::start(State *previous_state) {
State::start(previous_state);
get_sprites().<API key>();
hookshot = new Hookshot(hero);
get_entities().add_entity(hookshot);
}
/**
* @brief Ends this state.
* @param next_state the next state (for information)
*/
void Hero::HookshotState::stop(State *next_state) {
State::stop(next_state);
if (!hookshot->is_being_removed()) {
// the hookshot state was stopped by something other than the hookshot (e.g. an enemy)
hookshot->remove_from_map();
hero.clear_movement();
}
}
/**
* @brief Returns whether the hero is touching the ground in the current state.
* @return true if the hero is touching the ground in the current state
*/
bool Hero::HookshotState::is_touching_ground() {
return false;
}
/**
* @brief Returns whether the hero ignores the effect of deep water in this state.
* @return true if the hero ignores the effect of deep water in the current state
*/
bool Hero::HookshotState::<API key>() {
return true;
}
/**
* @brief Returns whether the hero ignores the effect of holes in this state.
* @return true if the hero ignores the effect of holes in the current state
*/
bool Hero::HookshotState::can_avoid_hole() {
return true;
}
/**
* @brief Returns whether the hero ignores the effect of lava in this state.
* @return true if the hero ignores the effect of lava in the current state
*/
bool Hero::HookshotState::can_avoid_lava() {
return true;
}
/**
* @brief Returns whether the hero ignores the effect of prickles in this state.
* @return true if the hero ignores the effect of prickles in the current state
*/
bool Hero::HookshotState::can_avoid_prickle() {
return true;
}
/**
* @brief Returns whether the hero ignores the effect of teletransporters in this state.
* @return true if the hero ignores the effect of teletransporters in this state
*/
bool Hero::HookshotState::<API key>() {
return true;
}
/**
* @brief Returns whether the hero ignores the effect of conveyor belts in this state.
* @return true if the hero ignores the effect of conveyor belts in this state
*/
bool Hero::HookshotState::<API key>() {
return true;
}
/**
* @brief Returns whether some stairs are considered as obstacle in this state.
* @param stairs some stairs
* @return true if the stairs are obstacle in this state
*/
bool Hero::HookshotState::is_stairs_obstacle(Stairs& stairs) {
// allow to fly over stairs covered by water
return hero.get_ground() != GROUND_DEEP_WATER;
}
/**
* @brief Returns whether a sensor is considered as an obstacle in this state.
* @param sensor a sensor
* @return true if the sensor is an obstacle in this state
*/
bool Hero::HookshotState::is_sensor_obstacle(Sensor& sensor) {
return true;
}
/**
* @brief Returns whether a jump sensor is considered as an obstacle in this state.
* @param jump_sensor a jump sensor
* @return true if the sensor is an obstacle in this state
*/
bool Hero::HookshotState::<API key>(JumpSensor& jump_sensor) {
return false;
}
/**
* @brief Returns whether the hero ignores the effect of switches in this state.
* @return true if the hero ignores the effect of switches in this state
*/
bool Hero::HookshotState::can_avoid_switch() {
return true;
}
/**
* @brief Returns whether the hero can be hurt in this state.
* @return true if the hero can be hurt in this state
*/
bool Hero::HookshotState::can_be_hurt() {
return true;
}
/**
* @brief Notifies this state that the hero has just tried to change his position.
* @param success true if the position has actually just changed
*/
void Hero::HookshotState::<API key>(bool success) {
if (!success) {
// an unexpected obstacle was reached (e.g. a moving NPC)
hero.set_state(new FreeState(hero));
}
}
|
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>BlenderFDS: blenderfds28x.lang.OP_XB_export Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="blenderfds_128.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">BlenderFDS
</div>
<div id="projectbrief">BlenderFDS, the open user interface for NIST Fire Dynamics Simulator (FDS), as an addon for Blender 2.8x</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="<API key>">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>blenderfds28x</b></li><li class="navelem"><b>lang</b></li><li class="navelem"><a class="el" href="<API key>.html">OP_XB_export</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-static-attribs">Static Public Attributes</a> |
<a href="<API key>.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">blenderfds28x.lang.OP_XB_export Class Reference</div> </div>
</div><!--header
<div class="contents">
<p>Blender representation to set if XB shall be exported to FDS.
<a href="<API key>.html#details">More...</a></p>
<div class="dynheader">
Inheritance diagram for blenderfds28x.lang.OP_XB_export:</div>
<div class="dyncontent">
<div class="center"><img src="<API key>.png" border="0" usemap="#<API key>" alt="Inheritance graph"/></div>
<map name="<API key>" id="<API key>">
<area shape="rect" title="Blender representation to set if XB shall be exported to FDS." alt="" coords="27,80,182,121"/>
<area shape="rect" href="<API key>.html" title="Blender representation of an FDS parameter." alt="" coords="5,5,204,32"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for blenderfds28x.lang.OP_XB_export:</div>
<div class="dyncontent">
<div class="center"><img src="<API key>.png" border="0" usemap="#<API key>" alt="Collaboration graph"/></div>
<map name="<API key>" id="<API key>">
<area shape="rect" title="Blender representation to set if XB shall be exported to FDS." alt="" coords="27,80,182,121"/>
<area shape="rect" href="<API key>.html" title="Blender representation of an FDS parameter." alt="" coords="5,5,204,32"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
string </td><td class="memItemRight" valign="bottom"><b>label</b> = "Export XB"</td></tr>
<tr class="separator:<API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
string </td><td class="memItemRight" valign="bottom"><b>description</b> = "Set if XB shall be <a class="el" href="<API key>.html#<API key>">exported</a> to FDS"</td></tr>
<tr class="separator:<API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
 </td><td class="memItemRight" valign="bottom"><b>bpy_type</b> = Object</td></tr>
<tr class="separator:<API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
string </td><td class="memItemRight" valign="bottom"><b>bpy_idname</b> = "bf_xb_export"</td></tr>
<tr class="separator:<API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
 </td><td class="memItemRight" valign="bottom"><b>bpy_prop</b> = BoolProperty</td></tr>
<tr class="separator:<API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
bool </td><td class="memItemRight" valign="bottom"><b>bpy_default</b> = True</td></tr>
<tr class="separator:<API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
dictionary </td><td class="memItemRight" valign="bottom"><b>bpy_other</b> = {"update": update_bf_xb}</td></tr>
<tr class="separator:<API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header <API key>"><td colspan="2" onclick="javascript:toggleInherit('<API key>')"><img src="closed.png" alt="-"/> Static Public Attributes inherited from <a class="el" href="<API key>.html">blenderfds28x.types.BFParam</a></td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
string </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">label</a> = "No Label"</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Object label. <br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">description</a> = None</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Object description. <br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">enum_id</a> = None</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Unique integer id for EnumProperty. <br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
dictionary </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">bf_other</a> = {}</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Other BlenderFDS parameters, eg: {'draw_type': 'WIRE', ...}. <br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">bf_params</a> = tuple()</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">My sub params, tuple of classes of type <a class="el" href="<API key>.html" title="Blender representation of an FDS parameter.">BFParam</a>. <br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">fds_label</a> = None</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">FDS label, eg. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">fds_default</a> = None</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">FDS default value. <br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">bpy_type</a> = None</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">type in bpy.types for Blender property, eg. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">bpy_idname</a> = None</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">idname of related bpy.types Blender property, eg. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">bpy_prop</a> = None</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">prop in bpy.props of Blender property, eg. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">bpy_default</a> = None</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Blender property default. <br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">dictionary </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">bpy_other</a> = {}</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Other optional Blender property parameters, eg. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">bpy_export</a> = None</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">idname of export toggle Blender property <br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">bpy_export_default</a> = None</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">default value for export toggle Blender property <br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header <API key>"><td colspan="2" onclick="javascript:toggleInherit('<API key>')"><img src="closed.png" alt="-"/> Public Member Functions inherited from <a class="el" href="<API key>.html">blenderfds28x.types.BFParam</a></td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">__init__</a> (self, <a class="el" href="<API key>.html#<API key>">element</a>)</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Class constructor. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
def </td><td class="memItemRight" valign="bottom"><b>__str__</b> (self)</td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">register</a> (cls)</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Register related Blender properties. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">unregister</a> (cls)</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Unregister related Blender properties. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">value</a> (self)</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Return value from element instance. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">set_value</a> (self, context, <a class="el" href="<API key>.html#<API key>">value</a>=None)</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Set element instance value. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
def </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">exported</a> (self)</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Return True if self is exported to FDS. <br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">set_exported</a> (self, context, <a class="el" href="<API key>.html#<API key>">value</a>=None)</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Set if self is exported to FDS. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">check</a> (self, context)</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Check self validity for FDS, in case of error raise BFException. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">draw_operators</a> (self, context, layout)</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Draw my operators on layout. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">draw</a> (self, context, layout)</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Draw my UI on layout. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">to_fds_param</a> (self, context)</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Return the <a class="el" href="<API key>.html" title="Datastructure representing an FDS parameter.">FDSParam</a> representation of element instance. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">from_fds</a> (self, context, <a class="el" href="<API key>.html#<API key>">value</a>)</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Set self.value from py value, on error raise BFException. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">copy_to</a> (self, dest_element)</td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">Copy self values to destination element. <a href="<API key>.html#<API key>">More...</a><br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header <API key>"><td colspan="2" onclick="javascript:toggleInherit('<API key>')"><img src="closed.png" alt="-"/> Public Attributes inherited from <a class="el" href="<API key>.html">blenderfds28x.types.BFParam</a></td></tr>
<tr class="memitem:<API key> inherit <API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">element</a></td></tr>
<tr class="memdesc:<API key> inherit <API key>"><td class="mdescLeft"> </td><td class="mdescRight">FDS element represented by this class instance. <br /></td></tr>
<tr class="separator:<API key> inherit <API key>"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Blender representation to set if XB shall be exported to FDS. </p>
</div><hr/>The documentation for this class was generated from the following file:<ul>
<li>/home/egissi/github/firetools/blenderfds28x/lang.py</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
|
# Written by Tomaz Solc, tomaz.solc@ijs.si
# This work has been partially funded by the European Community through the
# 7th Framework Programme project CREW (FP7-ICT-2009-258301).
# This program is free software: you can redistribute it and/or modify it
# any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# more details.
import logging
import Queue
import random
import time
from spectrumwars.testbed import TestbedBase, RadioBase, RadioTimeout, RadioError, TestbedError, RadioPacket
log = logging.getLogger(__name__)
class Radio(RadioBase):
RECEIVE_TIMEOUT = 2.
def __init__(self, addr, dispatcher, send_delay):
super(Radio, self).__init__()
self.addr = addr
self.neighbor = None
self.dispatcher = dispatcher
self.q = Queue.Queue()
self.frequency = 0
self.bandwidth = 0
self.send_delay = send_delay
def _recv(self, addr, bindata, frequency, bandwidth):
if self.frequency == frequency and self.bandwidth == bandwidth and self.addr == addr:
self.q.put(bindata)
def set_configuration(self, frequency, bandwidth, power):
self.frequency = frequency
self.bandwidth = bandwidth
def binsend(self, bindata):
self.dispatcher(self.neighbor, bindata, self.frequency, self.bandwidth)
time.sleep(self.send_delay)
def binrecv(self, timeout=None):
if timeout is None:
timeout = self.RECEIVE_TIMEOUT
try:
bindata = self.q.get(True, timeout)
except Queue.Empty:
raise RadioTimeout
else:
return bindata
class Testbed(TestbedBase):
RADIO_CLASS = Radio
def __init__(self, send_delay=.1, frequency_range=64, bandwidth_range=10, power_range=10, packet_size=1024):
self.send_delay = float(send_delay)
self.frequency_range = int(frequency_range)
self.bandwidth_range = int(bandwidth_range)
self.power_range = int(power_range)
self.RADIO_CLASS.PACKET_SIZE = int(packet_size) + 1
self.radios = []
# for each channel, we keep the timestamp of the last
# transmission. we use this for simulated spectrum sensing and
# for detecting collisions.
self.channels = [0] * self.frequency_range
self.i = 0
def _get_radio(self):
r = Radio(self.i, self._dispatcher, self.send_delay)
self.radios.append(r)
self.i += 1
return r
def _dispatcher(self, addr, bindata, frequency, bandwidth):
now = self.time()
has_collision = (now - self.channels[frequency]) > self.send_delay
self.channels[frequency] = now
if has_collision:
# note that when packets collide, the first one goes
# through while the later ones fail. this is different
# than in reality: all should fail. But this would
# be complicated to implement in practice.
for radio in self.radios:
radio._recv(addr, bindata, frequency, bandwidth)
else:
log.debug("packet collision detected on channel %d" % (frequency,))
def get_radio_pair(self):
dst = self._get_radio()
src = self._get_radio()
dst.neighbor = src.addr
src.neighbor = dst.addr
return dst, src
def get_spectrum(self):
spectrum = []
now = self.time()
for time in self.channels:
if now - time < .5:
p = random.randint(-40, -20)
else:
p = random.randint(-90, -80)
spectrum.append(p)
return tuple(spectrum)
def get_frequency_range(self):
return self.frequency_range
def get_bandwidth_range(self):
return self.bandwidth_range
def get_power_range(self):
return self.power_range
|
body, html{
margin: 0;
background: #fff;
}
h1{
font-size: 4em;
text-align: center;
font-family: sans-serif;
vertical-align: middle;
}
p{
font-size: 2em;
font-family: serif;
color: green;
text-align: center;
vertical-align: middle;
}
#only_section{
vertical-align: middle;
}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dirent.h>
#include <fcntl.h>
#include <assert.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <bcm2835.h>
#include <unistd.h>
#include <iostream>
//#define BCM2708_PERI_BASE 0x20000000
#define BCM2708_PERI_BASE 0x3F000000
#define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO controller */
#define MAXTIMINGS 100
#define PIN_DHT 4 //GPIO Mapping DHT Sensor
#define PIN_LED RPI_GPIO_P1_12 //GPIO Mapping LED
//#define DEBUG
using namespace std;
int readDHT(int pin, float *humid0, float *temp0);
int cosmput(float humid, float temp, int *feedid, char *key, char *feed_name, char *field0_name, char *field1_name);
int readconfig(char *pFileName, int *feedid, char *key, char *feed_name, char *field0_name, char *field1_name);
int main(int argc, char **argv) {
long cnt = 1;
if(argc > 1){
cnt = atol(argv[1]);
}
int dhtpin = PIN_DHT;
int ledpin = PIN_LED;
float humid0, temp0, ahumid, atemp,otemp = 0;
int feedid = 0;
char key[100];
char feed_name[100];
char field0_name[100];
char field1_name[100];
// char pFileName[]="config.ini";
// readconfig(pFileName, &feedid, key, feed_name, field0_name, field1_name);
if (!bcm2835_init())
return 1;
bcm2835_gpio_fsel(ledpin, <API key>);
bcm2835_gpio_write(ledpin, HIGH); //LED an
fprintf(stderr,"Using pin #%d\n", dhtpin);
while(cnt > 0) {
ahumid = atemp = 0.0;
for (int i=0; i< 5; i++) { // Mittelwert bilden, um "zittern" der Kurve zu minimieren
readDHT(dhtpin, &humid0, &temp0);
ahumid = ahumid + humid0;
atemp = atemp + temp0;
sleep(1);
}
ahumid = ahumid / 5;
atemp = atemp / 5;
if(ahumid < 5 || atemp < 5 || ahumid >100 || atemp > 100)// || (otemp > 0 && (atemp < otemp - 5 || atemp > otemp +5))){
{
fprintf(stderr,"Invalid values. Still calibrating?\n");
continue;
}
time_t tr = time(NULL);
//char *t = asctime(localtime(&tr));
cnt
printf("TIME=%d\nTEMP=%0.1f\nHUMID=%0.1f\n", tr, atemp, ahumid);
otemp = atemp;
//cosmput(ahumid, atemp, &feedid, key, feed_name, field0_name, field1_name);
}
bcm2835_gpio_fsel(ledpin, <API key>);
bcm2835_gpio_write(ledpin, LOW); //LED aus
return 0;
} // main
int readDHT(int pin, float *humid0, float *temp0) {
int counter = 0;
int laststate = HIGH;
int j=0;
int bits[250], data[100];
int bitidx = 0;
// Set GPIO pin to output
bcm2835_gpio_fsel(pin, <API key>);
bcm2835_gpio_write(pin, HIGH);
usleep(500000); // 500 ms
bcm2835_gpio_write(pin, LOW);
usleep(20000);
bcm2835_gpio_fsel(pin, <API key>);
data[0] = data[1] = data[2] = data[3] = data[4] = 0;
// wait for pin to drop?
while (bcm2835_gpio_lev(pin) == 1) {
usleep(1);
}
// read data!
for (int i=0; i< MAXTIMINGS; i++) {
counter = 0;
while ( bcm2835_gpio_lev(pin) == laststate) {
counter++;
//nanosleep(1); // overclocking might change this?
if (counter == 1000)
break;
}
laststate = bcm2835_gpio_lev(pin);
if (counter == 1000) break;
bits[bitidx++] = counter;
if ((i>3) && (i%2 == 0)) {
// shove each bit into the storage bytes
data[j/8] <<= 1;
if (counter > 200)
data[j/8] |= 1;
j++;
}
}
#ifdef DEBUG
for (int i=3; i<bitidx; i+=2) {
printf("bit %d: %d\n", i-3, bits[i]);
printf("bit %d: %d (%d)\n", i-2, bits[i+1], bits[i+1] > 200);
}
printf("Data (%d): 0x%x 0x%x 0x%x 0x%x 0x%x\n", j, data[0], data[1], data[2], data[3], data[4]);
#endif
if ((j >= 39) && (data[4] == ((data[0] + data[1] + data[2] + data[3]) & 0xFF)) ) { // yay!
float f, h;
h = data[0] * 256 + data[1];
h /= 10;
f = (data[2] & 0x7F)* 256 + data[3];
f /= 10.0;
if (data[2] & 0x80) {
f *= -1;
}
//printf("Temp = %.1f *C, Hum = %.1f \%\n", f, h);
*humid0 = h;
*temp0 = f;
}
return 0;
}
int cosmput(float humid, float temp, int *feedid, char *key, char *feed_name, char *field0_name, char *field1_name) {
// CURL *curl;
// CURLcode res;
char xapikey[60];
sprintf(xapikey, "X-ApiKey: %s",key);
char url[50];
sprintf(url, "http://api.cosm.com/v2/feeds/%d.json", *feedid);
char payload[200];
sprintf(payload, "{\"title\":\"%s\",\"version\":\"1.0.0\",\"datastreams\":[{\"id\":\"%s\",\"current_value\":%0.1f},{\"id\":\"%s\",\"current_value\":%0.1f}]}", feed_name, field0_name, humid, field1_name, temp);
// struct curl_slist *header=NULL;
// header = curl_slist_append(header, xapikey);
// curl_global_init(CURL_GLOBAL_ALL);
// curl = curl_easy_init();
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 0);
// curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);
// curl_easy_setopt(curl, <API key>, "PUT");
// curl_easy_setopt(curl, CURLOPT_URL, url);
// curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
// res = curl_easy_perform(curl);
// if(res != CURLE_OK) {
// fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
// curl_easy_cleanup(curl);
// curl_slist_free_all(header);
// curl_global_cleanup();
return 0;
}
int readconfig(char *pFileName, int *feedid, char *key, char *feed_name, char *field0_name, char *field1_name) {
char buffer[1024];
char label[120];
char value[100];
int allread = 0;
FILE* fp;
fp = fopen(pFileName, "r");
if (!fp) {
printf("Error opening config_file %s!\n", pFileName);
return 1;
}
printf("Opening config file: %s\n", pFileName);
fflush(stdout);
while (feof(fp) == 0) {
fgets(buffer, 1024, fp);
if ((buffer[0] != '#')) // && (no>2))
{
if (sscanf(buffer, "%[^'=']=%[^'\n']%s", &label, &value) >= 2){
if (strcmp(label, "FEEDID") == 0)
*feedid = atoi(value);
if (strcmp(label, "KEY") == 0)
sprintf(key, "%s", value);
if (strcmp(label, "FEED_NAME") == 0)
sprintf(feed_name, "%s", value);
if (strcmp(label, "FIELD0_NAME") == 0)
sprintf(field0_name, "%s", value);
if (strcmp(label, "FIELD1_NAME") == 0)
sprintf(field1_name, "%s", value);
}
}
}
fclose(fp);
return 0;
}
|
# PickAMovie
This app gets movies from moviedb, using their API. For this to work you must insert your API key in the NetworkUtils class.
|
// This file is part of BOINC.
// BOINC is free software; you can redistribute it and/or modify it
// as published by the Free Software Foundation,
// BOINC is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// The BOINC API and runtime system.
// Notes:
// 1) Thread structure:
// Sequential apps
// Unix
// getting CPU time and suspend/resume have to be done
// in the worker thread, so we use a SIGALRM signal handler.
// However, many library functions and system calls
// are not "asynch signal safe": see, e.g.
// http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
// (e.g. sprintf() in a signal handler hangs Mac OS X)
// so we do as little as possible in the signal handler,
// and do the rest in a separate "timer thread".
// Win
// the timer thread does everything
// Multi-thread apps:
// Unix:
// fork
// original process runs timer loop:
// handle suspend/resume/quit, heartbeat (use signals)
// new process call boinc_init_options() with flags to
// send status messages and handle checkpoint stuff,
// and returns from boinc_init_parallel()
// NOTE: THIS DOESN'T RESPECT CRITICAL SECTIONS.
// NEED TO MASK SIGNALS IN CHILD DURING CRITICAL SECTIONS
// Win:
// like sequential case, except suspend/resume must enumerate
// all threads (except timer) and suspend/resume them all
// 2) All variables that are accessed by two threads (i.e. worker and timer)
// MUST be declared volatile.
// 3) For compatibility with C, we use int instead of bool various places
// 4) We must periodically check that the client is still alive and exit if not.
// Originally this was done using heartbeat msgs from client.
// This is unreliable, e.g. if the client is blocked for a long time.
// As of Oct 11 2012 we use a different mechanism:
// the client passes its PID and we periodically check whether it exists.
// But we need to support the heartbeat mechanism also for compatibility.
// Terminology:
// The processing of a result can be divided
// into multiple "episodes" (executions of the app),
// each of which resumes from the checkpointed state of the previous episode.
// Unless otherwise noted, "CPU time" refers to the sum over all episodes
// (not counting the part after the last checkpoint in an episode).
#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_)
#include "boinc_win.h"
#endif
#ifdef _WIN32
#include "version.h"
#include "win_util.h"
#else
#include "config.h"
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cstdarg>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <pthread.h>
#include <vector>
#ifndef __EMX__
#include <sched.h>
#endif
#endif
#include "app_ipc.h"
#include "common_defs.h"
#include "diagnostics.h"
#include "error_numbers.h"
#include "filesys.h"
#include "mem_usage.h"
#include "parse.h"
#include "proc_control.h"
#include "shmem.h"
#include "str_replace.h"
#include "str_util.h"
#include "util.h"
#include "boinc_api.h"
using std::vector;
//#define DEBUG_BOINC_API
#ifdef __APPLE__
#include "mac_backtrace.h"
#define <API key>
// call getrusage() in the timer thread,
// rather than in the worker thread's signal handler
// (which can cause crashes on Mac)
// If you want, you can set this for Linux too:
// CPPFLAGS=-<API key>
#endif
const char* api_version = "API_VERSION_" PACKAGE_VERSION;
static APP_INIT_DATA aid;
static FILE_LOCK file_lock;
APP_CLIENT_SHM* app_client_shm = 0;
static volatile int <API key>;
// time until enable checkpoint
static volatile double fraction_done;
static volatile double <API key>;
static volatile bool ready_to_checkpoint = false;
static volatile int in_critical_section = 0;
static volatile double last_wu_cpu_time;
static volatile bool standalone = false;
static volatile double initial_wu_cpu_time;
static volatile bool have_new_trickle_up = false;
static volatile bool have_trickle_down = true;
// on first call, scan slot dir for msgs
static volatile int <API key>;
// interrupt count value at which to give up on core client
#ifdef _WIN32
static volatile int nrunning_ticks = 0;
#endif
static volatile int interrupt_count = 0;
// number of timer interrupts
// used to measure elapsed time in a way that's
// not affected by user changing system clock,
// and doesn't have big jump after hibernation
static volatile int <API key> = 0;
// number of timer interrupts while not suspended.
// Used to compute elapsed time
static volatile bool finishing;
// used for worker/timer synch during boinc_finish();
static int want_network = 0;
static int have_network = 1;
static double bytes_sent = 0;
static double bytes_received = 0;
bool <API key> = false;
// simulate unresponsive app by setting to true (debugging)
static FUNC_PTR timer_callback = 0;
char web_graphics_url[256];
bool <API key> = false;
char remote_desktop_addr[256];
bool <API key> = false;
int <API key> = 0;
// min checkpoint period requested by app
#define TIMER_PERIOD 0.1
// Sleep interval for timer thread;
// determines max rate of handling messages from client.
// Unix: period of worker-thread timer interrupts.
#define TIMERS_PER_SEC 10
// reciprocal of TIMER_PERIOD
// This determines the resolution of fraction done and CPU time reporting
// to the client, and of checkpoint enabling.
#define <API key> 30
#define <API key> ((int)(<API key>/TIMER_PERIOD))
// quit if no heartbeat from core in this #interrupts
#define <API key> 35
// quit if we cannot aquire slot lock file in this #secs after startup
#ifdef _WIN32
static HANDLE hSharedMem;
HANDLE <API key>;
// used to suspend worker thread, and to measure its CPU time
DWORD timer_thread_id;
#else
static volatile bool <API key> = false;
static volatile int <API key>;
// the above are used by the timer thread to tell
// the worker thread to exit
static pthread_t <API key>;
static pthread_t timer_thread_handle;
#ifndef <API key>
static struct rusage worker_thread_ru;
#endif
#endif
static BOINC_OPTIONS options;
volatile BOINC_STATUS boinc_status;
// vars related to intermediate file upload
struct UPLOAD_FILE_STATUS {
std::string name;
int status;
};
static bool <API key>;
static std::vector<UPLOAD_FILE_STATUS> upload_file_status;
static int resume_activities();
static void boinc_exit(int);
static void block_sigalrm();
static int <API key>();
char* boinc_msg_prefix(char* sbuf, int len) {
char buf[256];
struct tm tm;
struct tm *tmp = &tm;
int n;
time_t x = time(0);
if (x == -1) {
strlcpy(sbuf, "time() failed", len);
return sbuf;
}
#ifdef _WIN32
#ifdef __MINGW32__
if ((tmp = localtime(&x)) == NULL) {
#else
if (localtime_s(&tm, &x) == EINVAL) {
#endif
#else
if (localtime_r(&x, &tm) == NULL) {
#endif
strlcpy(sbuf, "localtime() failed", len);
return sbuf;
}
if (strftime(buf, sizeof(buf)-1, "%H:%M:%S", tmp) == 0) {
strlcpy(sbuf, "strftime() failed", len);
return sbuf;
}
#ifdef _WIN32
n = _snprintf(sbuf, len, "%s (%d):", buf, GetCurrentProcessId());
#else
n = snprintf(sbuf, len, "%s (%d):", buf, getpid());
#endif
if (n < 0) {
strlcpy(sbuf, "sprintf() failed", len);
return sbuf;
}
sbuf[len-1] = 0; // just in case
return sbuf;
}
static int setup_shared_mem() {
char buf[256];
if (standalone) {
fprintf(stderr,
"%s Standalone mode, so not using shared memory.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
return 0;
}
app_client_shm = new APP_CLIENT_SHM;
#ifdef _WIN32
sprintf(buf, "%s%s", SHM_PREFIX, aid.shmem_seg_name);
hSharedMem = attach_shmem(buf, (void**)&app_client_shm->shm);
if (hSharedMem == NULL) {
delete app_client_shm;
app_client_shm = NULL;
}
#else
#ifdef __EMX__
if (attach_shmem(aid.shmem_seg_name, (void**)&app_client_shm->shm)) {
delete app_client_shm;
app_client_shm = NULL;
}
#else
if (aid.shmem_seg_name == -1) {
// Version 6 Unix/Linux/Mac client
if (attach_shmem_mmap(MMAPPED_FILE_NAME, (void**)&app_client_shm->shm)) {
delete app_client_shm;
app_client_shm = NULL;
}
} else {
// version 5 Unix/Linux/Mac client
if (attach_shmem(aid.shmem_seg_name, (void**)&app_client_shm->shm)) {
delete app_client_shm;
app_client_shm = NULL;
}
}
#endif
#endif // ! _WIN32
if (app_client_shm == NULL) return -1;
return 0;
}
// a mutex for data structures shared between time and worker threads
#ifdef _WIN32
static HANDLE mutex;
static void init_mutex() {
mutex = CreateMutex(NULL, FALSE, NULL);
}
static inline void acquire_mutex() {
WaitForSingleObject(mutex, INFINITE);
}
static inline void release_mutex() {
ReleaseMutex(mutex);
}
#else
pthread_mutex_t mutex = <API key>;
static void init_mutex() {}
static inline void acquire_mutex() {
#ifdef DEBUG_BOINC_API
char buf[256];
fprintf(stderr, "%s acquiring mutex\n",
boinc_msg_prefix(buf, sizeof(buf))
);
#endif
pthread_mutex_lock(&mutex);
}
static inline void release_mutex() {
#ifdef DEBUG_BOINC_API
char buf[256];
fprintf(stderr, "%s releasing mutex\n",
boinc_msg_prefix(buf, sizeof(buf))
);
#endif
<API key>(&mutex);
}
#endif
// Return CPU time of process.
double <API key>() {
double cpu;
#ifdef _WIN32
int retval;
retval = <API key>(GetCurrentProcess(), cpu);
if (retval) {
cpu = nrunning_ticks * TIMER_PERIOD; // for Win9x
}
#else
#ifdef <API key>
struct rusage worker_thread_ru;
getrusage(RUSAGE_SELF, &worker_thread_ru);
#endif
cpu = (double)worker_thread_ru.ru_utime.tv_sec
+ (((double)worker_thread_ru.ru_utime.tv_usec)/1000000.0);
cpu += (double)worker_thread_ru.ru_stime.tv_sec
+ (((double)worker_thread_ru.ru_stime.tv_usec)/1000000.0);
#endif
return cpu;
}
// Communicate to the core client (via shared mem)
// the current CPU time and fraction done.
// NOTE: various bugs could cause some of these FP numbers to be enormous,
// possibly overflowing the buffer.
// So use strlcat() instead of strcat()
// This is called only from the timer thread (so no need for synch)
static bool update_app_progress(double cpu_t, double cp_cpu_t) {
char msg_buf[MSG_CHANNEL_SIZE], buf[256];
if (standalone) return true;
sprintf(msg_buf,
"<current_cpu_time>%e</current_cpu_time>\n"
"<checkpoint_cpu_time>%e</checkpoint_cpu_time>\n",
cpu_t, cp_cpu_t
);
if (want_network) {
strlcat(msg_buf, "<want_network>1</want_network>\n", sizeof(msg_buf));
}
if (fraction_done >= 0) {
double range = aid.fraction_done_end - aid.fraction_done_start;
double fdone = aid.fraction_done_start + fraction_done*range;
sprintf(buf, "<fraction_done>%e</fraction_done>\n", fdone);
strlcat(msg_buf, buf, sizeof(msg_buf));
}
if (bytes_sent) {
sprintf(buf, "<bytes_sent>%f</bytes_sent>\n", bytes_sent);
strlcat(msg_buf, buf, sizeof(msg_buf));
}
if (bytes_received) {
sprintf(buf, "<bytes_received>%f</bytes_received>\n", bytes_received);
strlcat(msg_buf, buf, sizeof(msg_buf));
}
return app_client_shm->shm->app_status.send_msg(msg_buf);
}
static void <API key>() {
char buf[MSG_CHANNEL_SIZE];
double dtemp;
bool btemp;
if (app_client_shm->shm->heartbeat.get_msg(buf)) {
boinc_status.network_suspended = false;
if (match_tag(buf, "<heartbeat/>")) {
<API key> = interrupt_count + <API key>;
}
if (parse_double(buf, "<wss>", dtemp)) {
boinc_status.working_set_size = dtemp;
}
if (parse_double(buf, "<max_wss>", dtemp)) {
boinc_status.<API key> = dtemp;
}
if (parse_bool(buf, "suspend_network", btemp)) {
boinc_status.network_suspended = btemp;
}
}
}
static bool client_dead() {
char buf[256];
bool dead;
if (aid.client_pid) {
// check every 10 sec
if (interrupt_count%(TIMERS_PER_SEC*10)) return false;
#ifdef _WIN32
HANDLE h = OpenProcess(<API key>, FALSE, aid.client_pid);
// If the process exists but is running under a different user account (boinc_master)
// then the handle returned is NULL and GetLastError() returns ERROR_ACCESS_DENIED.
if ((h == NULL) && (GetLastError() != ERROR_ACCESS_DENIED)) {
dead = true;
} else {
if (h) CloseHandle(h);
dead = false;
}
#else
int retval = kill(aid.client_pid, 0);
dead = (retval == -1 && errno == ESRCH);
#endif
} else {
dead = (interrupt_count > <API key>);
}
if (dead) {
boinc_msg_prefix(buf, sizeof(buf));
fputs(buf, stderr); // don't use fprintf() here
if (aid.client_pid) {
fputs(" BOINC client no longer exists - exiting\n", stderr);
} else {
fputs(" No heartbeat from client for 30 sec - exiting\n", stderr);
}
return true;
}
return false;
}
#ifndef _WIN32
// For multithread apps on Unix, the main process executes the following.
static void parallel_master(int child_pid) {
char buf[MSG_CHANNEL_SIZE];
int exit_status;
while (1) {
boinc_sleep(TIMER_PERIOD);
interrupt_count++;
if (app_client_shm) {
<API key>();
if (app_client_shm->shm-><API key>.get_msg(buf)) {
if (match_tag(buf, "<suspend/>")) {
kill(child_pid, SIGSTOP);
} else if (match_tag(buf, "<resume/>")) {
kill(child_pid, SIGCONT);
} else if (match_tag(buf, "<quit/>")) {
kill(child_pid, SIGKILL);
exit(0);
} else if (match_tag(buf, "<abort/>")) {
kill(child_pid, SIGKILL);
exit(<API key>);
}
}
if (client_dead()) {
kill(child_pid, SIGKILL);
exit(0);
}
}
if (interrupt_count % TIMERS_PER_SEC) continue;
if (waitpid(child_pid, &exit_status, WNOHANG) == child_pid) break;
}
boinc_finish(exit_status);
}
#endif
int boinc_init() {
int retval;
if (!<API key>()) {
retval = <API key>(BOINC_DIAG_DEFAULTS);
if (retval) return retval;
}
<API key>(options);
return boinc_init_options(&options);
}
int boinc_init_options(BOINC_OPTIONS* opt) {
int retval;
#ifndef _WIN32
if (options.multi_thread) {
int child_pid = fork();
if (child_pid) {
// original process - master
options.send_status_msgs = false;
retval = <API key>(options);
if (retval) {
kill(child_pid, SIGKILL);
return retval;
}
parallel_master(child_pid);
}
// new process - slave
options.main_program = false;
options.check_heartbeat = false;
options.<API key> = false;
options.multi_thread = false;
options.multi_process = false;
return boinc_init_options(&options);
}
#endif
retval = <API key>(*opt);
if (retval) return retval;
retval = start_timer_thread();
if (retval) return retval;
#ifndef _WIN32
retval = <API key>();
if (retval) return retval;
#endif
return 0;
}
int boinc_init_parallel() {
BOINC_OPTIONS _options;
<API key>(_options);
_options.multi_thread = true;
return boinc_init_options(&_options);
}
static int <API key>() {
int x = (int)aid.checkpoint_period;
if (<API key> > x) {
x = <API key>;
}
if (x == 0) x = <API key>;
return x;
}
int <API key>(int x) {
<API key> = x;
if (x > <API key>) {
<API key> = x;
}
return 0;
}
int <API key>(BOINC_OPTIONS& opt) {
int retval;
char buf[256];
options = opt;
if (!<API key>()) {
retval = <API key>(BOINC_DIAG_DEFAULTS);
if (retval) return retval;
}
boinc_status.no_heartbeat = false;
boinc_status.suspended = false;
boinc_status.quit_request = false;
boinc_status.abort_request = false;
if (options.main_program) {
// make sure we're the only app running in this slot
retval = file_lock.lock(LOCKFILE);
if (retval) {
// give any previous occupant a chance to timeout and exit
fprintf(stderr, "%s Can't acquire lockfile (%d) - waiting %ds\n",
boinc_msg_prefix(buf, sizeof(buf)),
retval, <API key>
);
boinc_sleep(<API key>);
retval = file_lock.lock(LOCKFILE);
}
if (retval) {
fprintf(stderr, "%s Can't acquire lockfile (%d) - exiting\n",
boinc_msg_prefix(buf, sizeof(buf)),
retval
);
#ifdef _WIN32
char buf2[256];
<API key>(GetLastError(), buf2, 256);
fprintf(stderr, "%s Error: %s\n", boinc_msg_prefix(buf, sizeof(buf)), buf2);
#endif
// if we can't acquire the lock file there must be
// another app instance running in this slot.
// If we exit(0), the client will keep restarting us.
// Instead, tell the client not to restart us for 10 min.
<API key>(600, "Waiting to acquire lock");
}
}
retval = <API key>();
if (retval) {
standalone = true;
} else {
retval = setup_shared_mem();
if (retval) {
fprintf(stderr,
"%s Can't set up shared mem: %d. Will run in standalone mode.\n",
boinc_msg_prefix(buf, sizeof(buf)), retval
);
standalone = true;
}
}
// copy the WU CPU time to a separate var,
// since we may reread the structure again later.
initial_wu_cpu_time = aid.wu_cpu_time;
fraction_done = -1;
<API key> = <API key>();
<API key> = aid.wu_cpu_time;
last_wu_cpu_time = aid.wu_cpu_time;
if (standalone) {
options.check_heartbeat = false;
}
<API key> = interrupt_count + <API key>;
init_mutex();
return 0;
}
int boinc_get_status(BOINC_STATUS *s) {
s->no_heartbeat = boinc_status.no_heartbeat;
s->suspended = boinc_status.suspended;
s->quit_request = boinc_status.quit_request;
s-><API key> = boinc_status.<API key>;
s->abort_request = boinc_status.abort_request;
s->working_set_size = boinc_status.working_set_size;
s-><API key> = boinc_status.<API key>;
s->network_suspended = boinc_status.network_suspended;
return 0;
}
// if we have any new trickle-ups or file upload requests,
// send a message describing them
static void send_trickle_up_msg() {
char buf[MSG_CHANNEL_SIZE];
BOINCINFO("Sending Trickle Up Message");
if (standalone) return;
strcpy(buf, "");
if (have_new_trickle_up) {
strcat(buf, "<have_new_trickle_up/>\n");
}
if (<API key>) {
strcat(buf, "<<API key>/>\n");
}
if (strlen(buf)) {
if (app_client_shm->shm->trickle_up.send_msg(buf)) {
have_new_trickle_up = false;
<API key> = false;
}
}
}
// NOTE: a non-zero status tells the core client that we're exiting with
// an "unrecoverable error", which will be reported back to server.
// A zero exit-status tells the client we've successfully finished the result.
int boinc_finish(int status) {
char buf[256];
fraction_done = 1;
fprintf(stderr,
"%s called boinc_finish(%d)\n",
boinc_msg_prefix(buf, sizeof(buf)), status
);
finishing = true;
boinc_sleep(2.0); // let the timer thread send final messages
<API key> = true; // then disable it
if (options.main_program && status==0) {
FILE* f = fopen(<API key>, "w");
if (f) fclose(f);
}
boinc_exit(status);
return 0; // never reached
}
int <API key>(int delay, const char* reason) {
FILE* f = fopen(TEMPORARY_EXIT_FILE, "w");
if (!f) {
return ERR_FOPEN;
}
fprintf(f, "%d\n", delay);
if (reason) {
fprintf(f, "%s\n", reason);
}
fclose(f);
boinc_exit(0);
return 0;
}
// unlock the lockfile and call the appropriate exit function
// Unix: called only from the worker thread.
// Win: called from the worker or timer thread.
// make static eventually
void boinc_exit(int status) {
int retval;
char buf[256];
if (options.main_program && file_lock.locked) {
retval = file_lock.unlock(LOCKFILE);
if (retval) {
#ifdef _WIN32
<API key>(GetLastError(), buf, 256);
fprintf(stderr,
"%s Can't unlock lockfile (%d): %s\n",
boinc_msg_prefix(buf, sizeof(buf)), retval, buf
);
#else
fprintf(stderr,
"%s Can't unlock lockfile (%d)\n",
boinc_msg_prefix(buf, sizeof(buf)), retval
);
perror("file unlock failed");
#endif
}
}
// kill any processes the app may have created
if (options.multi_process) {
kill_descendants();
}
boinc_finish_diag();
// various platforms have problems shutting down a process
// while other threads are still executing,
// or triggering endless exit()/atexit() loops.
BOINCINFO("Exit Status: %d", status);
fflush(NULL);
#if defined(_WIN32)
// Halt all the threads and clean up.
TerminateProcess(GetCurrentProcess(), status);
// note: the above CAN return!
Sleep(1000);
DebugBreak();
#elif defined(__APPLE_CC__)
// stops endless exit()/atexit() loops.
_exit(status);
#else
// arrange to exit with given status even if errors happen
// in atexit() functions
<API key>(status);
exit(status);
#endif
}
void boinc_network_usage(double sent, double received) {
bytes_sent = sent;
bytes_received = received;
}
int boinc_is_standalone() {
if (standalone) return 1;
return 0;
}
static void <API key>(int status) {
#ifdef DEBUG_BOINC_API
char buf[256];
fprintf(stderr, "%s <API key>(%d) called\n",
boinc_msg_prefix(buf, sizeof(buf)), status
);
#endif
#ifdef _WIN32
// TerminateProcess() doesn't work if there are suspended threads?
if (boinc_status.suspended) {
resume_activities();
}
// this seems to work OK on Windows
boinc_exit(status);
#else
// but on Unix there are synchronization problems;
// set a flag telling the worker thread to exit
<API key> = status;
<API key> = true;
pthread_exit(NULL);
#endif
}
// parse the init data file.
// This is done at startup, and also if a "reread prefs" message is received
int <API key>() {
FILE* f;
int retval;
char buf[256];
if (aid.project_preferences) {
free(aid.project_preferences);
aid.project_preferences = NULL;
}
aid.clear();
aid.checkpoint_period = <API key>;
if (!boinc_file_exists(INIT_DATA_FILE)) {
fprintf(stderr,
"%s Can't open init data file - running in standalone mode\n",
boinc_msg_prefix(buf, sizeof(buf))
);
return ERR_FOPEN;
}
f = boinc_fopen(INIT_DATA_FILE, "r");
retval = <API key>(f, aid);
fclose(f);
if (retval) {
fprintf(stderr,
"%s Can't parse init data file - running in standalone mode\n",
boinc_msg_prefix(buf, sizeof(buf))
);
return retval;
}
return 0;
}
int <API key>(
double cpu_time,
double checkpoint_cpu_time,
double _fraction_done,
int other_pid,
double _bytes_sent,
double _bytes_received
) {
char msg_buf[MSG_CHANNEL_SIZE], buf[1024];
if (standalone) return 0;
sprintf(msg_buf,
"<current_cpu_time>%e</current_cpu_time>\n"
"<checkpoint_cpu_time>%e</checkpoint_cpu_time>\n"
"<fraction_done>%e</fraction_done>\n",
cpu_time,
checkpoint_cpu_time,
_fraction_done
);
if (other_pid) {
sprintf(buf, "<other_pid>%d</other_pid>\n", other_pid);
strcat(msg_buf, buf);
}
if (_bytes_sent) {
sprintf(buf, "<bytes_sent>%f</bytes_sent>\n", _bytes_sent);
strcat(msg_buf, buf);
}
if (_bytes_received) {
sprintf(buf, "<bytes_received>%f</bytes_received>\n", _bytes_received);
strcat(msg_buf, buf);
}
if (app_client_shm->shm->app_status.send_msg(msg_buf)) {
return 0;
}
return ERR_WRITE;
}
int <API key>(
double cpu_time,
double checkpoint_cpu_time,
double _fraction_done
){
return <API key>(
cpu_time, checkpoint_cpu_time, _fraction_done, 0, 0, 0
);
}
int <API key>(APP_INIT_DATA* app_init_data) {
*app_init_data = aid;
return 0;
}
int boinc_get_init_data(APP_INIT_DATA& app_init_data) {
app_init_data = aid;
return 0;
}
int boinc_wu_cpu_time(double& cpu_t) {
cpu_t = last_wu_cpu_time;
return 0;
}
// Suspend this job.
// Can be called from either timer or worker thread.
static int suspend_activities(bool called_from_worker) {
#ifdef DEBUG_BOINC_API
char log_buf[256];
fprintf(stderr, "%s suspend_activities() called from %s\n",
boinc_msg_prefix(log_buf, sizeof(log_buf)),
called_from_worker?"worker thread":"timer thread"
);
#endif
#ifdef _WIN32
static vector<int> pids;
if (options.multi_thread) {
if (pids.size() == 0) {
pids.push_back(GetCurrentProcessId());
}
<API key>(pids, timer_thread_id, false, true);
} else {
SuspendThread(<API key>);
}
#else
if (options.multi_process) {
<API key>(false);
}
// if called from worker thread, sleep until suspension is over
// if called from time thread, don't need to do anything;
// suspension is done by signal handler in worker thread
if (called_from_worker) {
while (boinc_status.suspended) {
sleep(1);
}
}
#endif
return 0;
}
int resume_activities() {
#ifdef DEBUG_BOINC_API
char log_buf[256];
fprintf(stderr, "%s resume_activities()\n",
boinc_msg_prefix(log_buf, sizeof(log_buf))
);
#endif
#ifdef _WIN32
static vector<int> pids;
if (options.multi_thread) {
if (pids.size() == 0) pids.push_back(GetCurrentProcessId());
<API key>(pids, timer_thread_id, true, true);
} else {
ResumeThread(<API key>);
}
#else
if (options.multi_process) {
<API key>(true);
}
#endif
return 0;
}
static void <API key>() {
char path[MAXPATHLEN], buf[256], log_name[256], *p, log_buf[256];
std::string filename;
int status;
<API key>("", path);
DirScanner dirscan(path);
while (dirscan.scan(filename)) {
strlcpy(buf, filename.c_str(), sizeof(buf));
if (strstr(buf, <API key>) != buf) continue;
strlcpy(log_name, buf+strlen(<API key>), sizeof(log_name));
FILE* f = boinc_fopen(filename.c_str(), "r");
if (!f) {
fprintf(stderr,
"%s <API key>: can't open %s\n",
boinc_msg_prefix(buf, sizeof(buf)), filename.c_str()
);
continue;
}
p = fgets(buf, sizeof(buf), f);
fclose(f);
if (p && parse_int(buf, "<status>", status)) {
UPLOAD_FILE_STATUS uf;
uf.name = std::string(log_name);
uf.status = status;
upload_file_status.push_back(uf);
} else {
fprintf(stderr, "%s <API key>: can't parse %s\n",
boinc_msg_prefix(log_buf, sizeof(log_buf)), buf
);
}
}
}
// handle trickle and file upload messages
static void <API key>() {
char buf[MSG_CHANNEL_SIZE];
if (app_client_shm->shm->trickle_down.get_msg(buf)) {
BOINCINFO("Received Trickle Down Message");
if (match_tag(buf, "<have_trickle_down/>")) {
have_trickle_down = true;
}
if (match_tag(buf, "<upload_file_status/>")) {
<API key>();
}
}
}
// This flag is set of we get a suspend request while in a critical section,
// and options.<API key> is set.
// As soon as we're not in the critical section we'll do the suspend.
static bool suspend_request = false;
// runs in timer thread
static void <API key>() {
char buf[MSG_CHANNEL_SIZE];
if (app_client_shm->shm-><API key>.get_msg(buf)) {
acquire_mutex();
#ifdef DEBUG_BOINC_API
char log_buf[256];
fprintf(stderr, "%s got process control msg %s\n",
boinc_msg_prefix(log_buf, sizeof(log_buf)), buf
);
#endif
if (match_tag(buf, "<suspend/>")) {
BOINCINFO("Received suspend message");
if (options.<API key>) {
if (in_critical_section) {
suspend_request = true;
} else {
boinc_status.suspended = true;
suspend_request = false;
suspend_activities(false);
}
} else {
boinc_status.suspended = true;
}
}
if (match_tag(buf, "<resume/>")) {
BOINCINFO("Received resume message");
if (options.<API key>) {
if (boinc_status.suspended) {
resume_activities();
} else if (suspend_request) {
suspend_request = false;
}
}
boinc_status.suspended = false;
}
if (boinc_status.quit_request || match_tag(buf, "<quit/>")) {
BOINCINFO("Received quit message");
boinc_status.quit_request = true;
if (!in_critical_section && options.<API key>) {
<API key>(0);
}
}
if (boinc_status.abort_request || match_tag(buf, "<abort/>")) {
BOINCINFO("Received abort message");
boinc_status.abort_request = true;
if (!in_critical_section && options.<API key>) {
<API key>();
#if defined(_WIN32)
// Cause a controlled assert and dump the callstacks.
DebugBreak();
#elif defined(__APPLE__)
PrintBacktrace();
#endif
release_mutex();
<API key>(<API key>);
}
}
if (match_tag(buf, "<reread_app_info/>")) {
boinc_status.<API key> = true;
}
if (match_tag(buf, "<network_available/>")) {
have_network = 1;
}
release_mutex();
}
}
// timer handler; runs in the timer thread
static void timer_handler() {
char buf[512];
#ifdef DEBUG_BOINC_API
fprintf(stderr, "%s timer handler: disabled %s; in critical section %s; finishing %s\n",
boinc_msg_prefix(buf, sizeof(buf)),
<API key>?"yes":"no",
in_critical_section?"yes":"no",
finishing?"yes":"no"
);
#endif
if (<API key>) {
return;
}
if (finishing) {
if (options.send_status_msgs) {
double cur_cpu = <API key>();
last_wu_cpu_time = cur_cpu + initial_wu_cpu_time;
update_app_progress(last_wu_cpu_time, <API key>);
}
<API key> = true;
return;
}
interrupt_count++;
if (!boinc_status.suspended) {
<API key>++;
}
// handle messages from the core client
if (app_client_shm) {
if (options.check_heartbeat) {
<API key>();
}
if (options.<API key>) {
<API key>();
}
if (options.<API key>) {
<API key>();
}
}
if (interrupt_count % TIMERS_PER_SEC) return;
#ifdef DEBUG_BOINC_API
fprintf(stderr, "%s 1 sec elapsed - doing slow actions\n", boinc_msg_prefix(buf, sizeof(buf)));
#endif
// here if we're at a one-second boundary; do slow stuff
if (!ready_to_checkpoint) {
<API key> -= 1;
if (<API key> <= 0) {
ready_to_checkpoint = true;
}
}
// see if the core client has died, which means we need to die too
// (unless we're in a critical section)
if (in_critical_section==0 && options.check_heartbeat) {
if (client_dead()) {
fprintf(stderr, "%s timer handler: client dead, exiting\n",
boinc_msg_prefix(buf, sizeof(buf))
);
if (options.<API key>) {
<API key>(0);
} else {
boinc_status.no_heartbeat = true;
}
}
}
// don't bother reporting CPU time etc. if we're suspended
if (options.send_status_msgs && !boinc_status.suspended) {
double cur_cpu = <API key>();
last_wu_cpu_time = cur_cpu + initial_wu_cpu_time;
update_app_progress(last_wu_cpu_time, <API key>);
}
if (options.handle_trickle_ups) {
send_trickle_up_msg();
}
if (timer_callback) {
timer_callback();
}
// send graphics-related messages
if (<API key> && !app_client_shm->shm->graphics_reply.has_msg()) {
sprintf(buf,
"<web_graphics_url>%s</web_graphics_url>",
web_graphics_url
);
app_client_shm->shm->graphics_reply.send_msg(buf);
<API key> = false;
}
if (<API key> && !app_client_shm->shm->graphics_reply.has_msg()) {
sprintf(buf,
"<remote_desktop_addr>%s</remote_desktop_addr>",
remote_desktop_addr
);
app_client_shm->shm->graphics_reply.send_msg(buf);
<API key> = false;
}
}
#ifdef _WIN32
DWORD WINAPI timer_thread(void *) {
while (1) {
Sleep((int)(TIMER_PERIOD*1000));
timer_handler();
// poor man's CPU time accounting for Win9x
if (!boinc_status.suspended) {
nrunning_ticks++;
}
}
return 0;
}
#else
static void* timer_thread(void*) {
block_sigalrm();
while(1) {
boinc_sleep(TIMER_PERIOD);
timer_handler();
}
return 0;
}
// This SIGALRM handler gets handled only by the worker thread.
// It gets CPU time and implements sleeping.
// It must call only signal-safe functions, and must not do FP math
static void <API key>(int) {
#ifndef <API key>
getrusage(RUSAGE_SELF, &worker_thread_ru);
#endif
if (<API key>) {
boinc_exit(<API key>);
}
if (options.<API key>) {
while (boinc_status.suspended && in_critical_section==0) {
#ifdef ANDROID
// per-thread signal masking doesn't work
// on old (pre-4.1) versions of Android.
// If we're handling this signal in the timer thread,
// send signal explicitly to worker thread.
if (pthread_self() == timer_thread_handle) {
pthread_kill(<API key>, SIGALRM);
return;
}
#endif
sleep(1); // don't use boinc_sleep() because it does FP math
}
}
}
#endif
// Called from the worker thread; create the timer thread
int start_timer_thread() {
char buf[256];
#ifdef _WIN32
// get the worker thread handle
DuplicateHandle(
GetCurrentProcess(),
GetCurrentThread(),
GetCurrentProcess(),
&<API key>,
0,
FALSE,
<API key>
);
// Create the timer thread
if (!CreateThread(NULL, 0, timer_thread, 0, 0, &timer_thread_id)) {
fprintf(stderr,
"%s start_timer_thread(): CreateThread() failed, errno %d\n",
boinc_msg_prefix(buf, sizeof(buf)), errno
);
return errno;
}
if (!options.<API key>) {
// lower our (worker thread) priority
SetThreadPriority(<API key>, <API key>);
}
#else
<API key> = pthread_self();
pthread_attr_t thread_attrs;
pthread_attr_init(&thread_attrs);
<API key>(&thread_attrs, 32768);
int retval = pthread_create(&timer_thread_handle, &thread_attrs, timer_thread, NULL);
if (retval) {
fprintf(stderr,
"%s start_timer_thread(): pthread_create(): %d",
boinc_msg_prefix(buf, sizeof(buf)), retval
);
return retval;
}
#endif
return 0;
}
#ifndef _WIN32
// set up a periodic SIGALRM, to be handled by the worker thread
static int <API key>() {
int retval;
struct sigaction sa;
itimerval value;
sa.sa_handler = <API key>;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
retval = sigaction(SIGALRM, &sa, NULL);
if (retval) {
perror("boinc start_timer_thread() sigaction");
return retval;
}
value.it_value.tv_sec = 0;
value.it_value.tv_usec = (int)(TIMER_PERIOD*1e6);
value.it_interval = value.it_value;
retval = setitimer(ITIMER_REAL, &value, NULL);
if (retval) {
perror("boinc start_timer_thread() setitimer");
return retval;
}
return 0;
}
#endif
int <API key>(char* variety, char* p) {
if (!options.handle_trickle_ups) return ERR_NO_OPTION;
FILE* f = boinc_fopen(TRICKLE_UP_FILENAME, "wb");
if (!f) return ERR_FOPEN;
fprintf(f, "<variety>%s</variety>\n", variety);
size_t n = fwrite(p, strlen(p), 1, f);
fclose(f);
if (n != 1) return ERR_WRITE;
have_new_trickle_up = true;
return 0;
}
int <API key>() {
if (ready_to_checkpoint) {
<API key>();
return 1;
}
return 0;
}
int <API key>() {
double cur_cpu;
cur_cpu = <API key>();
last_wu_cpu_time = cur_cpu + aid.wu_cpu_time;
<API key> = last_wu_cpu_time;
<API key> = <API key>();
<API key>();
ready_to_checkpoint = false;
return 0;
}
void <API key>() {
#ifdef DEBUG_BOINC_API
char buf[256];
fprintf(stderr,
"%s <API key>\n",
boinc_msg_prefix(buf, sizeof(buf))
);
#endif
in_critical_section++;
}
void <API key>() {
#ifdef DEBUG_BOINC_API
char buf[256];
fprintf(stderr,
"%s <API key>\n",
boinc_msg_prefix(buf, sizeof(buf))
);
#endif
in_critical_section
if (in_critical_section < 0) {
in_critical_section = 0; // just in case
}
if (in_critical_section) return;
// We're out of the critical section.
// See if we got suspend/quit/abort while in critical section,
// and handle them here.
if (boinc_status.quit_request) {
boinc_exit(0);
}
if (boinc_status.abort_request) {
boinc_exit(<API key>);
}
if (options.<API key>) {
acquire_mutex();
if (suspend_request) {
suspend_request = false;
boinc_status.suspended = true;
release_mutex();
suspend_activities(true);
} else {
release_mutex();
}
}
}
int boinc_fraction_done(double x) {
fraction_done = x;
return 0;
}
int <API key>(char* buf, int len) {
std::string filename;
char path[MAXPATHLEN];
if (!options.<API key>) return false;
if (have_trickle_down) {
<API key>("", path);
DirScanner dirscan(path);
while (dirscan.scan(filename)) {
if (strstr(filename.c_str(), "trickle_down")) {
strncpy(buf, filename.c_str(), len);
return true;
}
}
have_trickle_down = false;
}
return false;
}
int boinc_upload_file(std::string& name) {
char buf[256];
std::string pname;
int retval;
retval = <API key>(name.c_str(), pname);
if (retval) return retval;
sprintf(buf, "%s%s", <API key>, name.c_str());
FILE* f = boinc_fopen(buf, "w");
if (!f) return ERR_FOPEN;
<API key> = true;
fclose(f);
return 0;
}
int boinc_upload_status(std::string& name) {
for (unsigned int i=0; i<upload_file_status.size(); i++) {
UPLOAD_FILE_STATUS& ufs = upload_file_status[i];
if (ufs.name == name) {
return ufs.status;
}
}
return ERR_NOT_FOUND;
}
void boinc_need_network() {
want_network = 1;
have_network = 0;
}
int boinc_network_poll() {
return have_network?0:1;
}
void boinc_network_done() {
want_network = 0;
}
#ifndef _WIN32
// block SIGALRM, so that the worker thread will be forced to handle it
static void block_sigalrm() {
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGALRM);
pthread_sigmask(SIG_BLOCK, &mask, NULL);
}
#endif
void <API key>(FUNC_PTR p) {
timer_callback = p;
}
double <API key>() {
return fraction_done;
}
double boinc_elapsed_time() {
return <API key>*TIMER_PERIOD;
}
void <API key>(char* url) {
if (standalone) return;
strlcpy(web_graphics_url, url, sizeof(web_graphics_url));
<API key> = true;
}
void <API key>(char* addr) {
if (standalone) return;
strlcpy(remote_desktop_addr, addr, sizeof(remote_desktop_addr));
<API key> = true;
}
|
"""add graphql ACL to users
Revision ID: 2d4882d39dbb
Revises: c4d0e9ec46a9
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2d4882d39dbb'
down_revision = 'dc2848563b53'
POLICY_NAME = '<API key>'
ACL_TEMPLATES = ['dird.graphql.me']
policy_table = sa.sql.table(
'auth_policy', sa.Column('uuid', sa.String(38)), sa.Column('name', sa.String(80))
)
acl_template_table = sa.sql.table(
'auth_acl_template', sa.Column('id', sa.Integer), sa.Column('template', sa.Text)
)
policy_template = sa.sql.table(
'<API key>,
sa.Column('policy_uuid', sa.String(38)),
sa.Column('template_id', sa.Integer),
)
def _find_acl_template(conn, acl_template):
query = (
sa.sql.select([acl_template_table.c.id])
.where(acl_template_table.c.template == acl_template)
.limit(1)
)
return conn.execute(query).scalar()
def _find_acl_templates(conn, acl_templates):
acl_template_ids = []
for acl_template in acl_templates:
acl_template_id = _find_acl_template(conn, acl_template)
if acl_template_id:
acl_template_ids.append(acl_template_id)
return acl_template_ids
def _get_policy_uuid(conn, policy_name):
policy_query = sa.sql.select([policy_table.c.uuid]).where(
policy_table.c.name == policy_name
)
for policy in conn.execute(policy_query).fetchall():
return policy[0]
def <API key>(conn, acl_templates):
acl_template_ids = []
for acl_template in acl_templates:
acl_template_id = _find_acl_template(conn, acl_template)
if not acl_template_id:
query = (
acl_template_table.insert()
.returning(acl_template_table.c.id)
.values(template=acl_template)
)
acl_template_id = conn.execute(query).scalar()
acl_template_ids.append(acl_template_id)
return acl_template_ids
def <API key>(conn, policy_uuid):
query = sa.sql.select([policy_template.c.template_id]).where(
policy_template.c.policy_uuid == policy_uuid
)
return [acl_template_id for (acl_template_id,) in conn.execute(query).fetchall()]
def upgrade():
conn = op.get_bind()
policy_uuid = _get_policy_uuid(conn, POLICY_NAME)
if not policy_uuid:
return
acl_template_ids = <API key>(conn, ACL_TEMPLATES)
<API key> = <API key>(conn, policy_uuid)
for template_id in set(acl_template_ids) - set(<API key>):
query = policy_template.insert().values(
policy_uuid=policy_uuid, template_id=template_id
)
conn.execute(query)
def downgrade():
conn = op.get_bind()
acl_template_ids = _find_acl_templates(conn, ACL_TEMPLATES)
if not acl_template_ids:
return
policy_uuid = _get_policy_uuid(conn, POLICY_NAME)
if not policy_uuid:
return
delete_query = policy_template.delete().where(
sa.sql.and_(
policy_template.c.policy_uuid == policy_uuid,
policy_template.c.template_id.in_(acl_template_ids),
)
)
op.execute(delete_query)
|
#include "VCL.h"
#include "Unit1.h"
#include "GridMap.h"
#include "defines.h"
#include "matrix_utils.h"
#include "bat_run.h"
#include "LoadData.h"
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cmath>
// special LSM mode with "-1 distance" = no aggregation of spots, just statistics per unit
bool LSM_minus1_mode = false;
float top_percent, min_percent, max_dist, min_simil;
String LSIRfn, LSIDfn, LSImask;
int spot_cnt, nwc, ccnt;
int **cm=0, **nwm, nwns_cnt;
std::vector<struct spot> spots;
std::vector<int> s_in_nw;
std::vector<bool> nw_in_min;
std::vector<float> Ebd;
class GridMap LSI_maskmap;
void get_candidate_cells()
{
float val_th;
int x, y;
val_th = 1.0f-top_percent;
ccnt=0;
for(y=0; y<yd; y++)
{
for(x=0; x<xd; x++)
{
if (sol[y][x]>=val_th)
{
cm[y][x]=0;
ccnt++;
}
else
cm[y][x]=-1;
}
}
Form1->Memo1->Lines->Add("Potential cells count = "+IntToStr(ccnt));
}
bool nb_in_s(int x, int y, int s)
{
int minx, miny, maxx, maxy, gx,gy;
minx=max(0, x-1);
miny=max(0, y-1);
maxx=min(xd,x+1);
maxy=min(yd,y+1);
for(gy=miny; gy<=maxy; gy++)
{
for(gx=minx; gx<=maxx; gx++)
if (cm[gy][gx]==s)
return true;
}
return false;
}
bool add_to_spot(int s)
{
int minx, maxx, miny, maxy, x, y, loop;
bool added;
float val, *rowp;
minx=max(0, spots[s].min_gx-1);
miny=max(0, spots[s].min_gy-1);
maxx=min(xd,spots[s].max_gx+1);
maxy=min(yd,spots[s].max_gy+1);
added=false;
for(y=miny; y<=maxy; y++)
{
for(x=minx; x<=maxx; x++)
{
// if (cm[y][x]==0)
if ((cm[y][x]!=s) && (cm[y][x]!=-1))
{
// Form1->Memo1->Lines->Add("HERE");
if (nb_in_s(x,y,s))
{
// Form1->Memo1->Lines->Add("YES");
cm[y][x]=s;
spots[s].area++;
spots[s].rank += sol[y][x];
spots[s].mean_gx += x;
spots[s].mean_gy += y;
spots[s].min_gx=min(spots[s].min_gx, x);
spots[s].min_gy=min(spots[s].min_gy, y);
spots[s].max_gx=max(spots[s].max_gx, x);
spots[s].max_gy=max(spots[s].max_gy, y);
if (sol[y][x]>(1.0f-min_percent))
spots[s].in_min_percent=true;
// rowp=&vmat[y][x][0]; // COMPACT_VMAT
<API key>& rowp = vmat[y][x];
for(loop=0; loop<map_cnt; loop++)
{
//std::cerr << "rowp: " << rowp.size() << std::endl;
val = rowp[loop];
if (val!=-1)
spots[s].bdv[loop] += val;
// else
// spots[s].bdv[loop] = 0.0f;
}
added=true;
}
}
}
}
return added;
}
void expand_spot(int x, int y)
{
bool added;
int loop;
spots[spot_cnt].bdv = 0;
spots[spot_cnt].min_gx = x;
spots[spot_cnt].min_gy = y;
spots[spot_cnt].max_gx = x;
spots[spot_cnt].max_gy = y;
spots[spot_cnt].mean_gx = static_cast<float>(x);
spots[spot_cnt].mean_gy = static_cast<float>(y);
spots[spot_cnt].area = 1;
spots[spot_cnt].rank = sol[y][x];
if (sol[y][x]>=(1.0f-min_percent))
spots[spot_cnt].in_min_percent=true;
else
spots[spot_cnt].in_min_percent=false;
spots[spot_cnt].bdv = new float[map_cnt];
for(loop=0; loop<map_cnt; loop++)
spots[spot_cnt].bdv[loop] =0.0f;
cm[y][x]=spot_cnt;
do {
added = add_to_spot(spot_cnt);
Application->ProcessMessages();
} while(added);
#if 0
char txt[255];
sprintf(txt,"Spot %i A=%i Xmin=%i xmax=%i ymin=%i ymax=%i mean-x=%0.3f mean-y=%0.3f",
spot_cnt, spots[spot_cnt].area, spots[spot_cnt].min_gx,
spots[spot_cnt].max_gx, spots[spot_cnt].min_gy,
spots[spot_cnt].max_gy,
spots[spot_cnt].mean_gx, spots[spot_cnt].mean_gy);
// if ((spot_cnt%10)==0)
Form1->Memo1->Lines->Add(txt);
#endif
}
void get_spots()
{
float val_th;
int x, y, in_cnt;
spot_cnt=1;
const size_t DEF_MAX_SPOTS = 2048;
spots.reserve(DEF_MAX_SPOTS);
try {
spots.resize(spot_cnt+1);
} catch(std::bad_alloc const& ex) {
Form1->Memo1->Lines->Add("Out of memory in landscape identification: "+String(ex.what()));
}
in_cnt =0;
for(y=0; y<yd; y++)
{
for(x=0; x<xd; x++)
{
if (cm[y][x]==0)
{
Application->ProcessMessages();
expand_spot(x,y);
if (spots[spot_cnt].in_min_percent)
in_cnt++;
// Form1->Memo1->Lines->Add("New spot, area = "
// +IntToStr(spots[spot_cnt].area));
spot_cnt++;
spots.resize(spots.size()+1);
if ((spot_cnt%1000)==0)
Form1->Memo1->Lines->Add("Spot count = "+IntToStr(spot_cnt-1));
}
}
}
Form1->Memo1->Lines->Add("Spot count = "+IntToStr(spot_cnt-1));
Form1->Memo1->Lines->Add("Spots including best areas count = "+IntToStr(in_cnt));
}
float calc_dist(int s1, int s2)
{
float dij, dx, dy, dm2;
float minx1, minx2, maxx1, maxx2, miny1, miny2, maxy1, maxy2;
int x1, x2, y1, y2;
dm2 = max_dist*max_dist;
if (dm2==0)
return (max_dist+1.0f); // with zero dist, separate spots cannot be joined
minx1=static_cast<float>(spots[s1].min_gx);
maxx1=static_cast<float>(spots[s1].max_gx);
miny1=static_cast<float>(spots[s1].min_gy);
maxy1=static_cast<float>(spots[s1].max_gy);
minx2=static_cast<float>(spots[s2].min_gx);
maxx2=static_cast<float>(spots[s2].max_gx);
miny2=static_cast<float>(spots[s2].min_gy);
maxy2=static_cast<float>(spots[s2].max_gy);
// Form1->Memo1->Lines->Add("corners");
// sprintf(txt, "minx1=%f maxx1=%f miny1=%f maxy1=%f", minx1, maxx1, miny1, maxy1);
// Form1->Memo1->Lines->Add(txt);
// sprintf(txt, "minx2=%f maxx2=%f miny2=%f maxy2=%f", minx2, maxx2, miny2, maxy2);
// Form1->Memo1->Lines->Add(txt);
// Form1->Memo1->Lines->Add("yxxxvc");
if (minx1>(maxx2+max_dist))
return (max_dist+1.0f);
if (minx2>(maxx1+max_dist))
return (max_dist+1.0f);
if (miny1>(maxy2+max_dist))
return (max_dist+1.0f);
if (miny2>(maxy1+max_dist))
return (max_dist+1.0f);
// Form1->Memo1->Lines->Add("here");
for(y1=static_cast<int>(miny1); y1<=maxy1;y1++)
for(x1=static_cast<int>(minx1); x1<=maxx1;x1++)
{
// Form1->Memo1->Lines->Add("y1loop"+IntToStr(y1));
if (cm[y1][x1]==s1)
{
for(y2=static_cast<int>(miny2); y2<=maxy2;y2++)
for(x2=static_cast<int>(minx2); x2<=maxx2;x2++) // xxx stuck in this loop.
{
if (cm[y2][x2]==s2)
{
dij = z_pow(x1-x2,2)+z_pow(y1-y2,2);
if (dij<=dm2)
return 0.0f;
}
}
}
}
return (max_dist+1.0f);
}
float calc_sim(int s1, int s2)
{
int loop, s, lvl1, lvl2;
float diff, val;
diff=0.0f;
for(loop=0; loop<map_cnt; loop++)
{
val = spots[s1].bdv[loop];
if (val<0.01f*Ebd[loop])
lvl1=0;
else if (val<0.1f*Ebd[loop])
lvl1=1;
else if (val<Ebd[loop])
lvl1=2;
else if (val<10*Ebd[loop])
lvl1=3;
else if (val<100*Ebd[loop])
lvl1=4;
else
lvl1=5;
val = spots[s2].bdv[loop];
if (val<0.01f*Ebd[loop])
lvl2=0;
else if (val<0.1f*Ebd[loop])
lvl2=1;
else if (val<Ebd[loop])
lvl2=2;
else if (val<10*Ebd[loop])
lvl2=3;
else if (val<100*Ebd[loop])
lvl2=4;
else
lvl2=5;
diff += fabs(lvl1-lvl2);
}
diff/=map_cnt;
return diff;
}
void add_nb_to_nw(int spot)
{
int loop;
float dist, diff;
for(loop=1; loop<spot_cnt; loop++)
{
// Form1->Memo1->Lines->Add("spot = "+IntToStr(loop));
if (spots[loop].nwn==-1)
{
// Form1->Memo1->Lines->Add("dist next");
dist = calc_dist(spot, loop);
// Form1->Memo1->Lines->Add("sim next");
diff = calc_sim(spot, loop);
if ((dist<=max_dist) && (diff<min_simil))
{
spots[loop].nwn = nwc;
nw_in_min[nwc] = (nw_in_min[nwc] || spots[loop].in_min_percent);
s_in_nw[nwns_cnt] = loop;
nwns_cnt++;
// Form1->Memo1->Lines->Add("joined");
}
}
}
}
void expand_network(int s)
{
int pos;
spots[s].nwn = nwc;
nwns_cnt = 1;
s_in_nw[0] = s;
nw_in_min[nwc] = (nw_in_min[nwc] || spots[s].in_min_percent);
pos=0;
while(pos<nwns_cnt)
{
// Form1->Memo1->Lines->Add("pos="+IntToStr(pos));
add_nb_to_nw(s_in_nw[pos]);
pos++;
}
}
void Fix_bd_values()
{
int loop, s;
for(loop=0; loop<map_cnt; loop++)
Ebd[loop]=0.0f;
for(s=1;s<spot_cnt;s++)
{
for(loop=0; loop<map_cnt; loop++)
{
Ebd[loop] += spots[s].bdv[loop];
spots[s].bdv[loop] /= spots[s].area;
}
}
for(loop=0; loop<map_cnt; loop++)
Ebd[loop] /= ccnt; // Ebd[loop]=average over cells in cut
}
void get_networks()
{
int loop, x, y, cilcnt;
/*
const size_t DEF_MAX_NW = 2048;
nw_in_min.reserve(DEF_MAX_NW);
nw_in_min.assign(2, false);
*/
// get_networks always called after get_spots() -> spot_cnt known
try {
s_in_nw.resize(spot_cnt, 0);
Ebd.resize(map_cnt, 0);
nw_in_min.resize(spot_cnt+1, false);
} catch(std::bad_alloc const& ex) {
Form1->Memo1->Lines->Add("Out of memory in landscape identification: "+String(ex.what()));
}
nwc = 1; // xxx
for(loop=0; loop<spot_cnt; loop++) {
spots[loop].nwn=-1;
}
// uses Ebd[]
Fix_bd_values();
for(loop=1; loop<spot_cnt; loop++)
{
if ((spots[loop].nwn==-1) && (spots[loop].in_min_percent))
{
// Form1->Memo1->Lines->Add(IntToStr(loop));
expand_network(loop);
nwc++;
nw_in_min.push_back(false);
}
}
for(y=0; y<yd; y++) {
for(x=0; x<xd; x++) {
if (false && cm[y][x] >0 && spots[cm[y][x]].nwn >= nw_in_min.size()) {
Form1->Memo1->Lines->Add("<API key>, cm: "+ IntToStr(cm[y][x]));
Form1->Memo1->Lines->Add("<API key>, cm: "+ IntToStr(cm[y][x]) + ", spots:"+IntToStr(spots[cm[y][x]].nwn));
}
//if (Rmax[y][x]==-1)
if (-1 == status[y][x])
nwm[y][x]=-1;
else if (cm[y][x]==0)
nwm[y][x]=-2;
else if (cm[y][x]==-1)
nwm[y][x]=-2;
// the -1== check is critical, or likely segfault!
else if ((cm[y][x]>0) && (-1==spots[cm[y][x]].nwn || (!nw_in_min[spots[cm[y][x]].nwn])))
nwm[y][x]=-2;
else
nwm[y][x]=spots[cm[y][x]].nwn; // xxx error
}
}
Form1->Memo1->Lines->Add("Found networks count = "+IntToStr(nwc-1));
std::vector<float> spdat;
try {
spdat.resize(map_cnt, 0.0);
} catch(std::bad_alloc const& ex) {
Form1->Memo1->Lines->Add("Out of memory in landscape identification: "+String(ex.what()));
}
cilcnt=0;
for(y=0; y<yd; y++) {
for(x=0; x<xd; x++) {
//if (Rmax[y][x]==-1)
if (-1 == status[y][x])
continue;
if (nwm[y][x]>0) {
// rowp=&vmat[y][x][0]; // COMPACT_VMAT
<API key>& rowp = vmat[y][x];
//for(loop=0;loop<map_cnt;loop++)
for(loop=rowp.first(); loop!=rowp.overflow(); loop=rowp.next(loop)) {
if (rowp[loop]>0.0f)
spdat[loop] += rowp[loop];
}
cilcnt++;
}
}
}
Form1->Memo1->Lines->Add("Cells in classified landscapes = "+IntToStr(cilcnt));
const size_t MAX_STR_LEN = 512;
char txt[MAX_STR_LEN];
for(loop=0;loop<map_cnt;loop++)
{
sprintf(txt, "%-6.3f %-5.3f %s\n", spp[loop].weight, spdat[loop], spp[loop].fname.toUtf8().constData());
Form1->Memo1->Lines->Add(txt);
}
}
// Gets statistics for units specified in the PPA mask,
// so networks will actually be the units
// all the nwarea, nwx, nwy, nwrank are aggregated (not normalized) and will be divided by nwarea[] later on
void
<API key>(std::vector<int>& nwarea, std::vector<float>& nwx, std::vector<float>& nwy,
std::vector<float>& nwrank, float**& mat)
{
// max_val pre-calculated in load_from_file...
spot_cnt = (int)LSI_maskmap.max_val+1;
try {
spots.resize(spot_cnt);
} catch(std::bad_alloc const& ex) {
Form1->Memo1->Lines->Add("Out of memory in landscape identification: "+String(ex.what()));
}
/*
// Init to 0. units have numbers >=1
for (size_t i=0; i<spot_cnt; i++)
spots[i].num = 0;
// Find used unit numbers. Use the array spots[].num
// for the unit numbers
for (size_t y=0; y<yd; y++) {
for (size_t x=0; x<xd; x++) {
// make sure the mask doesn't include "missing" cells
if (sol[y][x] < 0.0f)
continue;
int unit_idx = LSI_maskmap.m[y][x];
if (unit_idx > 0 && unit_idx <= spots.size())
if (0==spots[unit_idx].num)
spots[unit_idx].num++;
}
}
// unit numbers actually used in the LSI analysis mask
std::vector<int> unit_nums;
nwc = 0;
for (size_t i=0; i<spot_cnt; i++) {
if (0 < spots[i].num) {
nwc++; // nwc is global
unit_nums.push_back(i);
}
}
nwc++; // yes, it is number of networks/units +1
*/
// bypass the 2 loops above. Use as many networks as the biggest number in the planning
// units layer/mask. This avoids crashes if non-consecutive numbers are used.
nwc = spot_cnt;
try {
nwarea.resize(nwc+1, 0);
nwrank.resize(nwc+1, 0);
nwrank.resize(nwc+1, 0);
nwx.resize(nwc+1, 0);
nwy.resize(nwc+1, 0);
} catch(std::bad_alloc const& ex) {
Form1->Memo1->Lines->Add("Out of memory in landscape identification: "+String(ex.what()));
}
mat = matrix(0, nwc+1, 0, map_cnt);
if (!mat) {
ShowMessage("Out of memory when doing LSIdent");
return;
}
for(int nw=0; nw<=nwc; nw++) {
nwarea[nw]=0;
nwrank[nw]=0.0f;
nwx[nw]=0.0f;
nwy[nw]=0.0f;
for(int sp=0; sp<map_cnt; sp++)
mat[nw][sp]=0.0f;
}
for (size_t y=0; y<yd; y++) {
for (size_t x=0; x<xd; x++) {
// make sure the mask doesn't include "missing" cells
if (sol[y][x] < 0.0f)
continue;
int unit_idx = LSI_maskmap.m[y][x];
if (unit_idx <= 0 || unit_idx >= spot_cnt)
continue;
nwarea[unit_idx]++;
nwx[unit_idx] += x;
nwy[unit_idx] += y;
nwrank[unit_idx] += sol[y][x];
// float* rowp = &vmat[y][x][0]; // COMPACT_VMAT
<API key>& rowp = vmat[y][x];
if (rowp)
//for(size_t spp_idx=0; spp_idx<map_cnt; spp_idx++)
for(size_t spp_idx=rowp.first(); spp_idx!=rowp.overflow(); spp_idx=rowp.next(spp_idx))
if (rowp[spp_idx] > .0f)
mat[unit_idx][spp_idx] += rowp[spp_idx];
}
}
// And the nwout raster (variable nwm) is not generated (it's = LSImask)
}
void print_network_data()
{
int loop, nw, sp, num, c10, c1, c01, c001, c0001, sp_at_zero;
float **mat, nwtot;
FILE *f;
f=fopen(LSIDfn.toUtf8().constData(), "w+t");
if (!f)
{
ShowMessage("Could not open output file " + LSIDfn);
return;
}
std::vector<int> nwarea;
std::vector<float> nwrank, nwx, nwy;
if (LSM_minus1_mode) {
// All params by ref./output
<API key>(nwarea, nwx, nwy, nwrank, mat);
} else {
try {
nwarea.resize(nwc+1, 0);
nwrank.resize(nwc+1, 0);
nwrank.resize(nwc+1, 0);
nwx.resize(nwc+1, 0);
nwy.resize(nwc+1, 0);
} catch(std::bad_alloc const& ex) {
Form1->Memo1->Lines->Add("Out of memory in landscape identification: "+String(ex.what()));
}
// sprintf(txt, "nwc=%i spots=%i",nwc, spot_cnt);
// ShowMessage(txt);
mat = matrix(0, nwc+1, 0, map_cnt);
if (!mat)
{
ShowMessage("Out of memory when doing LSIdent");
fclose(f);
return;
}
for(nw=0; nw<=nwc; nw++)
{
nwarea[nw]=0;
nwrank[nw]=0.0f;
nwx[nw]=0.0f;
nwy[nw]=0.0f;
for(sp=0; sp<map_cnt; sp++)
mat[nw][sp]=0.0f;
}
for(loop=1; loop<spot_cnt; loop++)
{
num = spots[loop].nwn;
if (num == -1)
continue;
for(sp=0; sp<map_cnt; sp++)
mat[num][sp] += spots[loop].bdv[sp]*spots[loop].area;
nwarea[num] += spots[loop].area;
nwrank[num] += spots[loop].rank;
nwx[num] += spots[loop].mean_gx;
nwy[num] += spots[loop].mean_gy;
}
}
std::string nets_or_units;
if (LSM_minus1_mode)
nets_or_units = "units";
else
nets_or_units = "networks";
fprintf(f, "Most important biodiversity features (e.g. species) in %s; those occurring at a 1%%+ level\n", nets_or_units.c_str());
fprintf(f, "of original distribution\n");
std::string net_or_unit;
if (LSM_minus1_mode)
net_or_unit = "Unit";
else
net_or_unit = "Network";
fprintf(f, "%s Area Mean-Rank X Y <API key> spp occurring at >10%% >1%% >0.1%% >0.01%% >0.001%%\n", net_or_unit.c_str());
std::vector<float> sptot;
try {
sptot.resize(map_cnt, 0);
} catch(std::bad_alloc const& ex) {
Form1->Memo1->Lines->Add("Out of memory in landscape identification: "+String(ex.what()));
}
float tottot=0.0f;
for(nw=1; nw<nwc; nw++)
{
// do not calc/output results for empty/missing unit numbers
if (LSM_minus1_mode && nwarea[nw]<=0)
continue;
c10 = c1 = c01 = c001 = c0001 = 0;
nwtot=0.0f;
for(sp=0; sp<map_cnt; sp++)
{
nwtot += mat[nw][sp];
sptot[sp] += mat[nw][sp];
if (mat[nw][sp]>0.1f)
{
c10++;
c1++;
c01++;
c001++;
c0001++;
}
else if (mat[nw][sp]>0.01f)
{
c1++;
c01++;
c001++;
c0001++;
}
else if (mat[nw][sp]>0.001f)
{
c01++;
c001++;
c0001++;
}
else if (mat[nw][sp]>0.0001f)
{
c001++;
c0001++;
}
else if (mat[nw][sp]>0.00001f)
{
c0001++;
}
}
tottot += nwtot;
// nw area rnk x y tot
fprintf(f, "%-5i %-6i %-6.3f %-6.3f %-6.3f %-6.3f %-5i %-5i %-5i %-5i %-5i\n",
nw, nwarea[nw], nwrank[nw]/nwarea[nw], nwx[nw]/nwarea[nw], nwy[nw]/nwarea[nw],
nwtot, c10, c1, c01, c001, c0001);
for(sp=0; sp<map_cnt; sp++)
{
if (mat[nw][sp]>0.01f)
fprintf(f, " Feature %s, %-5.2f%% of full distribution\n",
spp[sp].fname.toUtf8().constData(),100*mat[nw][sp]);
}
// fprintf(f, "\n");
}
fprintf(f, "Repeat without spp info for easy import\n");
fprintf(f,"%s Area Mean-Rank X Y <API key> spp occurring at >10%% >1%% >0.1%% >0.01%% >0.001%%\n", net_or_unit.c_str());
//tottot=0.0f;
for(nw=1; nw<nwc; nw++)
{
// do not cal/output results for empty/missing unit numbers
if (LSM_minus1_mode && nwarea[nw]<=0)
continue;
c10 = c1 = c01 = c001 = c0001 = 0;
nwtot=0.0f;
for(sp=0; sp<map_cnt; sp++)
{
nwtot += mat[nw][sp];
// would be the second time!
//sptot[sp] += mat[nw][sp];
if (mat[nw][sp]>0.1f)
{
c10++;
c1++;
c01++;
c001++;
c0001++;
}
else if (mat[nw][sp]>0.01f)
{
c1++;
c01++;
c001++;
c0001++;
}
else if (mat[nw][sp]>0.001f)
{
c01++;
c001++;
c0001++;
}
else if (mat[nw][sp]>0.0001f)
{
c001++;
c0001++;
} else if (mat[nw][sp]>0.00001f)
{
c0001++;
}
}
// this would make tottot 2x the true totot
//tottot += nwtot;
// nw area rnk x y tot
fprintf(f, "%-5i %-6i %-6.3f %-6.3f %-6.3f %-6.3f %-5i %-5i %-5i %-5i %-5i\n",
nw, nwarea[nw], nwrank[nw]/nwarea[nw], nwx[nw]/nwarea[nw], nwy[nw]/nwarea[nw],
nwtot, c10, c1, c01, c001, c0001);
}
fprintf(f, "\n\nAverage proportion remaining over all spp in %s = %f\n",nets_or_units.c_str(), tottot/map_cnt);
sp_at_zero=0;
for(sp=0; sp<map_cnt; sp++)
{
if (sptot[sp]<=0.0f)
sp_at_zero++;
}
fprintf(f, "Count of biodiversity features (e.g. species) with nothing remaining in the network = %i\n",sp_at_zero);
fprintf(f, "Total proportion and sum remaining for biodiversity features\n");
for(sp=0; sp<map_cnt; sp++)
{
fprintf(f, "%s %-5.4f %0.4f\n",
spp[sp].fname.toUtf8().constData(), sptot[sp], sptot[sp]*spp[sp].prob_sum);
}
if (LSM_minus1_mode)
fprintf(f, "\n\nBiological data of %i %s.\n",nwc-1, nets_or_units.c_str());
else
fprintf(f, "\n\nBiological data of %i %s (spots=%i).\n",nwc-1, nets_or_units.c_str(), spot_cnt-1);
fprintf(f, "%s x biodiversity features matrix\n", nets_or_units.c_str());
if (LSM_minus1_mode)
fprintf(f, "Unit_number area[cells] sp_data .....\n");
else
fprintf(f, "Nw_number area[cells] sp_data .....\n");
for(nw=1; nw<nwc; nw++)
{
// do not calc/output results for empty/missing unit numbers
if (LSM_minus1_mode && nwarea[nw]<=0)
continue;
fprintf(f, "%-5i %-6i ", nw, nwarea[nw]);
for(sp=0; sp<map_cnt; sp++)
fprintf(f,"%-6.4f ", mat[nw][sp]);
fprintf(f, "\n");
}
fclose(f);
free_matrix(mat, 0, nwc+1, 0, map_cnt);
}
bool read_LSI_mask(int top_fraction_mode)
{
int x, y;
LSI_maskmap.normalize=false;
if (!LSI_maskmap.load_from_file(LSImask, mask_data, area_mask.m))
{
Form1->Memo1->Lines->Add("************** ERROR ***************");
Form1->Memo1->Lines->Add(" FAILURE attempting LSI mask map load.");
return false;
}
Form1->Memo1->Lines->Add("LSI mask map loaded.");
val_th = 1.0f-top_percent;
ccnt = 0;
for(y=0; y<yd; y++)
{
for(x=0; x<xd; x++)
{
if (LSI_maskmap.m[y][x]>=1)
{
if (top_fraction_mode)
{
if (sol[y][x]>=val_th)
{
cm[y][x]=0;
ccnt++;
}
else
cm[y][x]=-1;
}
else
{
cm[y][x]=0;
ccnt++;
}
}
else
cm[y][x]=-1;
}
}
Form1->Memo1->Lines->Add("Potential cells count = "+IntToStr(ccnt));
return true;
}
int LSIdent(int LSI_mode)
{
const size_t MAX_STRLEN = 2048;
char txt[MAX_STRLEN];
Form1->Memo1->Lines->Add("");
Form1->Memo1->Lines->Add("");
Form1->Memo1->Lines->Add("NEW LANDSCAPE IDENTIFICATION ANALYSIS");
// This is done now in the visitor class in post_process.cpp
//top_percent = StrToFloat(Form1->Edit4->Text)/100.0f;
//min_percent = StrToFloat(Form1->Edit5->Text)/100.0f;
//max_dist = StrToFloat(Form1->Edit6->Text);
//min_simil = StrToFloat(Form1->Edit7->Text);
//LSIRfn = Form1->Edit8->Text;
bool lsi_mask_ok = true;
if (LSI_mode==0) // "LSB"
{
sprintf(txt, "Running LSIdent with top%%=%0.3f min%%=%0.3f max-d=%0.3f min-s=%0.3f",
top_percent*100, min_percent*100, max_dist, min_simil);
Form1->Memo1->Lines->Add(txt);
Form1->Memo1->Lines->Add("1. Getting candidate cells.");
get_candidate_cells();
}
else if (LSI_mode==1) // "LSM"
{
if (0.0f > max_dist)
{
LSM_minus1_mode = true;
sprintf(txt, "Running LSIdent with mask file (%s). Note: LSM special case with max. distance -1, ignoring top%%=%0.3f and using whole landscape",
LSImask.toStdString().c_str(), top_percent*100);
Form1->Memo1->Lines->Add(txt);
top_percent = 1.0f;
}
else
{
sprintf(txt, "Running LSIdent with mask file (%s) max-d=%0.3f min-s=%0.3f",
LSImask.toStdString().c_str(), max_dist, min_simil);
Form1->Memo1->Lines->Add(txt);
Form1->Memo1->Lines->Add("1. Reading relevant areas from mask file "+Form1->Edit42->Text);
}
lsi_mask_ok = read_LSI_mask(0);
if (!lsi_mask_ok) {
Form1->Memo1->Lines->Add("ERROR! failed to read LSM areas from mask file: " + LSImask);
}
}
else // 2==LSI_mode "LSB"
{
sprintf(txt, "Running LSIdent for top fraction within masked area, mask file %s fract=%0.4f max-d=%0.3f min-s=%0.3f",
LSImask.toStdString().c_str(), top_percent, max_dist, min_simil);
Form1->Memo1->Lines->Add(txt);
Form1->Memo1->Lines->Add("1. Reading relevant areas from mask file "+Form1->Edit42->Text);
lsi_mask_ok = read_LSI_mask(1);
if (!lsi_mask_ok) {
Form1->Memo1->Lines->Add("ERROR! failed to read LSB areas from mask file: " + LSImask);
}
}
if (!lsi_mask_ok) {
Form1->Memo1->Lines->Add("Please fix the mask file name. No results will be generated for this post-processing analysis.");
return false;
}
if (!LSM_minus1_mode) {
// free only if traditional modes
LSI_maskmap.free_matrix_m();
Form1->Memo1->Lines->Add("2. Identifying spots.");
get_spots(); // spots[s].bdv[sp] = 0.0f; sisaltaa prop of sp spotissa
Form1->Memo1->Lines->Add("3. Finding networks.");
get_networks();
}
print_network_data();
if (LSM_minus1_mode) {
LSI_maskmap.free_matrix_m();
} else {
#if 0
// obsmap[0].show_spots(Form1->Image1->Picture->Bitmap, cm);
obsmap[0].show_spots(Form1->Image1->Picture->Bitmap, nwm, 0);
#endif
obsmap[0].export_GIS_INT(nwm, LSIRfn);
// the spots[].bdv are not allocated in LSM "-1 distance" mode
for(int loop=0; loop<spots.size(); loop++)
{
if (spots[loop].bdv)
delete[] spots[loop].bdv;
spots[loop].bdv=0;
}
}
Screen->Cursor=crDefault;
return true;
}
void LSCAnalysis(float f1, float f2, const String& cfn, const String& comp_outfn)
{
//float f1, f2;
//String cfn, comp_outfn;
float f1cells, f2cells, bothcells, rodiff;
class GridMap cmpmap;
int x, y, z1, z2, rcnt;
bool f1ok, f2ok;
DecimalSeparator='.';
//cfn = Edit23->Text;
cmpmap.set_no_normalize();
if (!cmpmap.load_from_file(cfn, mask_data, area_mask.m))
{
ShowMessage("Could not load given comparison solution");
return;
}
Form1->Memo1->Lines->Add("");
Form1->Memo1->Lines->Add("Solution comparison stats");
//f1 = StrToFloat(Edit22->Text);
//f2 = StrToFloat(Edit24->Text);
Form1->Memo1->Lines->Add("S1 cut level = "+FloatToStrF(f1, ffFixed, 7, 4));
Form1->Memo1->Lines->Add("S2 cut level = "+FloatToStrF(f2, ffFixed, 7, 4));
f1cells=f2cells=bothcells=rodiff=0.0f;
z1=z2=rcnt=0;
for(y=0; y<yd; y++)
for(x=0; x<xd; x++)
{
f1ok=f2ok=false;
if (f1>0.0f)
{
if ((sol[y][x]!=-1) && (sol[y][x]>=(1.0f-f1)))
f1ok=true;
}
else
{
if ((sol[y][x]!=-1) && (sol[y][x]<=(-f1)))
f1ok=true;
}
if (f2>0.0f)
{
if ((cmpmap.m[y][x]!=-1) && (cmpmap.m[y][x]>=(1.0f-f2)))
f2ok=true;
}
else
{
if ((cmpmap.m[y][x]>0.0f) && (cmpmap.m[y][x]<=(-f2)))
f2ok=true;
}
if (f1ok)
f1cells++;
if (f2ok)
f2cells++;
if (f1ok && f2ok)
bothcells++;
if (sol[y][x]==0.0f)
z1++;
if (cmpmap.m[y][x]==0.0f)
z2++;
if ((sol[y][x]!=-1) && (cmpmap.m[y][x]!=0.0f))
{
++rcnt;
rodiff+= fabs(sol[y][x]-cmpmap.m[y][x]);
}
nwm[y][x] = 0;
//if (Rmax[y][x]==-1)
if (-1 == status[y][x])
nwm[y][x] = -1;
else if (f1ok && f2ok)
nwm[y][x] = 1;
else if (f1ok)
nwm[y][x] = 2;
else if (f2ok)
nwm[y][x] = 3;
}
Form1->Memo1->Lines->Add("Cells in present solution fraction = " +IntToStr((int)f1cells));
Form1->Memo1->Lines->Add("Cells in comparison solution fraction = " +IntToStr((int)f2cells));
Form1->Memo1->Lines->Add("Cells included in both solutions = " +IntToStr((int)bothcells));
Form1->Memo1->Lines->Add("Initially removed in present solution = " +IntToStr(z1));
Form1->Memo1->Lines->Add("Initially removed in comparison solution = "+IntToStr(z2));
Form1->Memo1->Lines->Add("Similarity f1 = "+FloatToStrF(bothcells/f1cells, ffFixed, 7, 4));
Form1->Memo1->Lines->Add("Similarity f2 = "+FloatToStrF(bothcells/f2cells, ffFixed, 7, 4));
Form1->Memo1->Lines->Add("Average difference in removal order = "+FloatToStrF(rodiff/rcnt, ffFixed, 7, 4));
const size_t MAX_STR_LEN = 512;
char txt[MAX_STR_LEN];
sprintf(txt, "Overlap f1 = %0.4f, f1 = %0.4f. Average order diff=%0.4f. See also memo.",
bothcells/f1cells,bothcells/f2cells, rodiff/rcnt);
Form1->Memo1->Lines->Add(txt);
if (!bat_mode)
ShowMessage(txt);
if (Form1->CheckBox7->Checked)
{
#if 0
//comp_outfn = Edit29->Text;
obsmap[0].show_spots(Form1->Image1->Picture->Bitmap, nwm, 1);
#endif
obsmap[0].export_GIS_INT(nwm, comp_outfn);
}
}
|
/* vim: set ts=8 sw=4 sts=4 et: */
#include "rtpsniff.h"
#include <assert.h>
#include <sys/time.h>
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
/* Settings */
#ifndef INTERVAL_SECONDS
# define INTERVAL_SECONDS 10 /* wake the storage engine every N seconds */
#endif /* INTERVAL_SECONDS */
#if INTERVAL_SECONDS < 2
# error INTERVAL_SECONDS be too low
#endif
#define <API key> 1
#define <API key> 2
#if !defined(USE_NSLEEP_TIMER) && (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)
# define TIMER__METHOD <API key>
# include <errno.h>
# include <semaphore.h>
#else
# define TIMER__METHOD <API key>
#endif
static pthread_t timer__thread;
static struct memory_t *timer__memory;
#if TIMER__METHOD == <API key>
static volatile int timer__done; /* whether we're done */
#elif TIMER__METHOD == <API key>
static sem_t timer__semaphore; /* semaphore to synchronize the threads */
#endif /* TIMER__METHOD == <API key> */
static void *timer__run(void *thread_arg);
void timer_help() {
printf(
"#%s USE_NSLEEP_TIMER\n"
"#define INTERVAL_SECONDS %" SCNu32 "\n"
"\n"
"Sleeps until the specified interval of %.2f minutes have passed and wakes up\n"
"to tell the storage engine to write averages.\n"
"\n"
"The USE_NSLEEP_TIMER define forces the module to use a polling sleep loop even\n"
"when the (probably) less cpu intensive and more accurate sem_timedwait()\n"
"function is available. The currently compiled in timer method is: %s\n"
"\n",
#ifdef USE_NSLEEP_TIMER
"define",
#else /* !USE_NSLEEP_TIMER */
"undef",
#endif
(uint32_t)INTERVAL_SECONDS, (float)INTERVAL_SECONDS / 60,
#if TIMER__METHOD == <API key>
"n_sleep"
#elif TIMER__METHOD == <API key>
"semaphore"
#endif /* TIMER__METHOD == <API key> */
);
}
int timer_loop_bg(struct memory_t *memory) {
pthread_attr_t attr;
/* Set internal config */
timer__memory = memory;
#if TIMER__METHOD == <API key>
/* Initialize polling variable */
timer__done = 0;
#elif TIMER__METHOD == <API key>
/* Initialize semaphore */
if (sem_init(&timer__semaphore, 0, 0) != 0) {
perror("sem_init");
return -1;
}
#endif /* TIMER__METHOD == <API key> */
/* We want default pthread attributes */
if (pthread_attr_init(&attr) != 0) {
perror("pthread_attr_init");
return -1;
}
/* Run thread */
if (pthread_create(&timer__thread, &attr, &timer__run, NULL) != 0) {
perror("pthread_create");
return -1;
}
#ifndef NDEBUG
fprintf(stderr, "timer_loop_bg: Thread %p started.\n", (void*)timer__thread);
#endif
return 0;
}
void timer_loop_stop() {
void *ret;
/* Tell our thread that it is time */
#if TIMER__METHOD == <API key>
timer__done = 1;
#elif TIMER__METHOD == <API key>
sem_post(&timer__semaphore);
#endif /* TIMER__METHOD == <API key> */
/* Get its exit status */
if (pthread_join(timer__thread, &ret) != 0)
perror("pthread_join");
#ifndef NDEBUG
fprintf(stderr, "timer_loop_stop: Thread %p joined.\n", (void*)timer__thread);
#endif
#if TIMER__METHOD == <API key>
/* Destroy semaphore */
if (sem_destroy(&timer__semaphore) != 0)
perror("sem_destroy");
#endif /* TIMER__METHOD == <API key> */
}
/* The timers job is to run storage function after after every INTERVAL_SECONDS time. */
static void *timer__run(void *thread_arg) {
int first_run_skipped = 0; /* do not store the first run because the interval is wrong */
#ifndef NDEBUG
fprintf(stderr, "timer__run: Thread started.\n");
#endif
while (1) {
struct timeval current_time; /* current time is in UTC */
int sample_begin_time;
#if TIMER__METHOD == <API key>
int sleep_useconds;
#elif TIMER__METHOD == <API key>
struct timespec new_time;
int ret;
#endif /* TIMER__METHOD == <API key> */
int previously_active;
/* Get current time */
if (gettimeofday(¤t_time, NULL) != 0) {
perror("gettimeofday");
return (void*)-1;
}
/* Yes, we started sampling when SIGUSR1 fired, so this is correct */
sample_begin_time = current_time.tv_sec - (current_time.tv_sec % INTERVAL_SECONDS);
/* Calculate how long to sleep */
#if TIMER__METHOD == <API key>
sleep_useconds = (1000000 *
(INTERVAL_SECONDS - (current_time.tv_sec % INTERVAL_SECONDS)) -
current_time.tv_usec);
# ifndef NDEBUG
fprintf(stderr, "timer__run: Current time is %i (%02i:%02i:%02i.%06i), "
"sleep planned for %i useconds.\n",
(int)current_time.tv_sec,
(int)(current_time.tv_sec / 3600) % 24,
(int)(current_time.tv_sec / 60) % 60,
(int)current_time.tv_sec % 60,
(int)current_time.tv_usec, sleep_useconds);
# endif /* NDEBUG */
#elif TIMER__METHOD == <API key>
new_time.tv_sec = sample_begin_time + INTERVAL_SECONDS;
new_time.tv_nsec = 0;
# ifndef NDEBUG
fprintf(stderr, "timer__run: Current time is %i (%02i:%02i:%02i.%06i), "
"sleep planned until %02i:%02i:%02i.\n",
(int)current_time.tv_sec,
(int)(current_time.tv_sec / 3600) % 24,
(int)(current_time.tv_sec / 60) % 60,
(int)current_time.tv_sec % 60,
(int)current_time.tv_usec,
(int)(new_time.tv_sec / 3600) % 24,
(int)(new_time.tv_sec / 60) % 60,
(int)new_time.tv_sec % 60);
# endif /* NDEBUG */
#endif /* TIMER__METHOD == <API key> */
#if TIMER__METHOD == <API key>
/* The sleep in this thread won't wake up (EINTR) from a SIGALRM in the other
* thread. Pause/alarm won't work either. We use this crappy polling loop as
* an alternative. Observe that the semaphore below method is way more
* accurate and probably uses less cpu. */
while (!timer__done && sleep_useconds > 999999) {
sleep(1);
sleep_useconds -= 1000000;
}
if (timer__done)
break;
usleep(sleep_useconds);
#elif TIMER__METHOD == <API key>
/* The sem_timedwait function will sleep happily until the absolutely specified
* time has been reached. */
while ((ret = sem_timedwait(&timer__semaphore, &new_time)) == -1 && errno == EINTR)
continue; /* restart if interrupted by handler */
if (ret == 0)
break; /* if the semaphore was hit, we're done */
if (errno != ETIMEDOUT)
perror("sem_timedwait");
#endif /* TIMER__METHOD == <API key> */
#ifndef NDEBUG
if (gettimeofday(¤t_time, NULL) != 0) {
perror("gettimeofday");
return (void*)-1;
}
fprintf(stderr, "timer__run: Awake! Time is now %i (%02i:%02i:%02i.%06i).\n",
(int)current_time.tv_sec,
(int)(current_time.tv_sec / 3600) % 24,
(int)(current_time.tv_sec / 60) % 60,
(int)current_time.tv_sec % 60,
(int)current_time.tv_usec);
#endif
/* Poke other thread to switch memory */
previously_active = timer__memory->active;
raise(SIGUSR1);
sleep(1); /* wait a second to let other thread finish switching memory */
assert(previously_active != timer__memory->active);
if (first_run_skipped) {
/* Delegate the actual writing to storage. */
out_write(sample_begin_time, INTERVAL_SECONDS,
timer__memory->rtphash[previously_active]);
} else {
/* On first run, we started too late in the interval. Ignore those counts. */
first_run_skipped = 1;
}
/* Reset mem for next run */
sniff_release(&timer__memory->rtphash[previously_active]);
}
#ifndef NDEBUG
fprintf(stderr, "timer__run: Thread done.\n");
#endif
return 0;
}
|
<?php
session_start();
include_once 'inc/vcode.inc.php';
$_SESSION['vcode']=vcode(100,40,30,4);
?>
|
#!/bin/bash
version=$1
out=${2:-"copyq-${version}.tar.gz"}
version_file="src/common/version.cpp"
set -e
die () {
echo "ERROR: $*"
exit 1
}
grep -q '^# v'"$version"'$' "CHANGES.md" ||
die "CHANGES file doesn't contain changes for given version!"
grep -q '"'"$version"'"' "$version_file" ||
die "String for given version is missing in \"$version_file\" file!"
git archive --format=tar.gz --prefix="copyq-$version/" --output="$out" "v$version" ||
die "First arguments must be existing version (tag v<VERSION> must exist in repository)!"
echo "Created source package for version $version: $out"
size=$(stat --format="%s" "$out")
hash=$(md5sum "$out" | cut -d' ' -f 1)
echo " $hash $size $out"
|
package com.openkm.servlet;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.openkm.util.FormatUtil;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.openkm.api.OKMDocument;
import com.openkm.api.OKMRepository;
import com.openkm.bean.Document;
import com.openkm.core.Config;
import com.openkm.core.<API key>;
import com.openkm.core.RepositoryException;
import com.openkm.util.PathUtils;
import com.openkm.util.WebUtils;
/**
* Download Servlet
*/
public class DownloadServlet extends BasicSecuredServlet {
private static Logger log = LoggerFactory.getLogger(DownloadServlet.class);
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.<API key>("UTF-8");
String userId = request.getRemoteUser();
String path = WebUtils.getString(request, "path");
String uuid = WebUtils.getString(request, "uuid");
boolean inline = WebUtils.getBoolean(request, "inline");
InputStream is = null;
try {
// Now an document can be located by UUID
if (uuid != null && !uuid.isEmpty()) {
uuid = FormatUtil.sanitizeInput(uuid);
path = OKMRepository.getInstance().getNodePath(null, uuid);
} else if (path != null && !path.isEmpty()) {
path = FormatUtil.sanitizeInput(path);
}
if (path != null) {
Document doc = OKMDocument.getInstance().getProperties(null, path);
String fileName = PathUtils.getName(doc.getPath());
// Optinal append version to download ( not when doing checkout )
if (Config.<API key>) {
String versionToAppend = " rev " + OKMDocument.getInstance().getProperties(null,uuid).getActualVersion().getName();
String[] nameParts = fileName.split("\\.(?=[^\\.]+$)");
fileName = nameParts[0] + versionToAppend + "." + nameParts[1];
}
log.info("Download {} by {} ({})", new Object[] { path, userId, (inline ? "inline" : "attachment") });
is = OKMDocument.getInstance().getContent(null, path, false);
WebUtils.sendFile(request, response, fileName, doc.getMimeType(), inline, is);
} else {
response.setContentType("text/plain; charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("Missing document reference");
out.close();
}
} catch (<API key> e) {
log.warn(e.getMessage(), e);
response.sendError(HttpServletResponse.<API key>, "<API key>: " + e.getMessage());
} catch (RepositoryException e) {
log.warn(e.getMessage(), e);
response.sendError(HttpServletResponse.<API key>, "RepositoryException: " + e.getMessage());
} catch (Exception e) {
log.warn(e.getMessage(), e);
response.sendError(HttpServletResponse.<API key>, e.getMessage());
} finally {
IOUtils.closeQuietly(is);
}
}
}
|
package mysqlgoutils
import (
"testing"
)
func <API key>(t *testing.T) {
assertSplit := func(addr, expectHost string, expectPort int, expectSchema string, expectErr bool) {
host, port, schema, err := <API key>(addr)
if host != expectHost {
t.Errorf("Expected <API key>(\"%s\") to return host of \"%s\", instead found \"%s\"", addr, expectHost, host)
}
if port != expectPort {
t.Errorf("Expected <API key>(\"%s\") to return port of %d, instead found %d", addr, expectPort, port)
}
if schema != expectSchema {
t.Errorf("Expected <API key>(\"%s\") to return schema of %d, instead found \"%s\"", addr, expectSchema, schema)
}
if expectErr && err == nil {
t.Errorf("Expected <API key>(\"%s\") to return an error, but instead found nil", addr)
} else if !expectErr && err != nil {
t.Errorf("Expected <API key>(\"%s\") to return NOT return an error, but instead found %s", addr, err)
}
}
assertSplit("", "", 0, "", true)
assertSplit("foo", "foo", 0, "", false)
assertSplit("1.2.3.4", "1.2.3.4", 0, "", false)
assertSplit("some.host:1234", "some.host", 1234, "", false)
assertSplit("some.host:text", "", 0, "", true)
assertSplit("some.host:1234:5678", "", 0, "", true)
assertSplit("some.host:0", "", 0, "", true)
assertSplit("some.host:-5", "", 0, "", true)
assertSplit("fe80::1", "", 0, "", true)
assertSplit("[fe80::1]", "[fe80::1]", 0, "", false)
assertSplit("[fe80::1]:3306", "[fe80::1]", 3306, "", false)
assertSplit("[fe80::bd0f:a8bc:6480:238b%11]", "[fe80::bd0f:a8bc:6480:238b%11]", 0, "", false)
assertSplit("[fe80::bd0f:a8bc:6480:238b%11]:443", "[fe80::bd0f:a8bc:6480:238b%11]", 443, "", false)
assertSplit("[fe80::bd0f:a8bc:6480:238b%11]:sup", "", 0, "", true)
assertSplit("[fe80::bd0f:a8bc:6480:238b%11]:123:456", "", 0, "", true)
assertSplit("|dbtest", "", 0, "", true)
assertSplit("1.2.3.4|", "", 0, "", true)
assertSplit("1.2.3.4|dbtest", "1.2.3.4", 0, "dbtest", false)
assertSplit("1.2.3.4:1234|dbtest", "1.2.3.4", 1234, "dbtest", false)
assertSplit("1.2.3.4:1234|dbtest|foo", "", 0, "", true)
assertSplit("some.host", "some.host", 0, "", false)
assertSplit("some.host|dbtest", "some.host", 0, "dbtest", false)
assertSplit("some.host:1234|dbtest", "some.host", 1234, "dbtest", false)
}
|
# This program is free software: you can redistribute it and/or modify
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
try:
from setuptools import setup
from setuptools import find_packages
except ImportError:
from distutils.core import setup
from pkgutil import walk_packages
import mn
# many pypy installs don't have setuptools (?)
def _find_packages(path='.', prefix=''):
yield prefix
prefix = prefix + "."
for _, name, ispkg in walk_packages(path,
prefix,
onerror=lambda x: x):
if ispkg:
yield name
def find_packages():
return list(_find_packages(mn.__path__, mn.__name__))
setup(name = "minnesota",
version = "0.1pre",
description = "collection of HDL cores ",
license = "LGPL",
platforms = ["Any"],
keywords = "DSP HDL MyHDL FPGA FX2 USB",
packages = find_packages(),
# @todo need to add the examples and test directories,
# copy it over ...
)
|
#ifndef <API key>
#define <API key>
#define <API key> GENETIC_BASE + 2
#define <API key> "GeneticDistribution"
#define GENETIC_STDDEV_ID GENETIC_BASE + 3
#define GENETIC_STDDEV_NAME "GeneticStdDev"
#define GENETIC_INTERVAL_ID GENETIC_BASE + 4
#define <API key> "GeneticInterval"
#define GENETIC_CONSTANT_ID GENETIC_BASE + 6
#define <API key> "GeneticConstant"
#define <API key> GENETIC_BASE + 5
#define <API key> "<API key>"
#define SET_NAME1 "C1"
#define SET_NAME2 "C2"
/*I . . . INCLUDES . . . . . . . . . . . . . . . . . . . . . . . . . . . .
*/
#include "<API key>.hh"
/*P . . . PROTOTYPES . . . . . . . . . . . . . . . . . . . . . . . . . . .
*/
extern void <API key>();
void AddGeneticClasses(<API key>& set);
<API key> *PairSet(DataObjectClass *popobjectbase);
#endif
|
<?php
/** <API key> */
require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php';
class <API key> extends <API key>
{
/**#@+
* Script type contants
* @const string
*/
const FILE = 'FILE';
const SCRIPT = 'SCRIPT';
/**
* Registry key for placeholder
* @var string
*/
protected $_regKey = '<API key>';
/**
* Are arbitrary attributes allowed?
* @var bool
*/
protected $<API key> = false;
/**#@+
* Capture type and/or attributes (used for hinting during capture)
* @var string
*/
protected $_captureLock;
protected $_captureScriptType = null;
protected $_captureScriptAttrs = null;
protected $_captureType;
/**
* Optional allowed attributes for script tag
* @var array
*/
protected $_optionalAttributes = array('charset', 'defer', 'language',
'src');
/**
* Required attributes for script tag
* @var string
*/
protected $_requiredAttributes = array('type');
/**
* Whether or not to format scripts using CDATA; used only if doctype
* helper is not accessible
* @var bool
*/
public $useCdata = false;
/**
* Constructor
*
* Set separator to PHP_EOL.
*
* @return void
*/
public function __construct ()
{
parent::__construct();
$this->setSeparator(PHP_EOL);
}
/**
* Return headScript object
*
* Returns headScript helper object; optionally, allows specifying a script
* or script file to include.
*
* @param string $mode Script or file
* @param string $spec Script/url
* @param string $placement Append, prepend, or set
* @param array $attrs Array of script attributes
* @param string $type Script type and/or array of script attributes
* @return <API key>
*/
public function headScript ($mode = <API key>::FILE, $spec = null, $placement = 'APPEND',
array $attrs = array(), $type = 'text/javascript')
{
if ((null !== $spec) && is_string($spec)) {
$action = ucfirst(strtolower($mode));
$placement = strtolower($placement);
switch ($placement) {
case 'set':
case 'prepend':
case 'append':
$action = $placement . $action;
break;
default:
$action = 'append' . $action;
break;
}
$this->$action($spec, $type, $attrs);
}
return $this;
}
/**
* Start capture action
*
* @param mixed $captureType
* @param string $typeOrAttrs
* @return void
*/
public function captureStart (
$captureType = <API key>::APPEND, $type = 'text/javascript', $attrs = array())
{
if ($this->_captureLock) {
require_once 'Zend/View/Helper/Placeholder/Container/Exception.php';
$e = new <API key>(
'Cannot nest headScript captures');
$e->setView($this->view);
throw $e;
}
$this->_captureLock = true;
$this->_captureType = $captureType;
$this->_captureScriptType = $type;
$this->_captureScriptAttrs = $attrs;
ob_start();
}
/**
* End capture action and store
*
* @return void
*/
public function captureEnd ()
{
$content = ob_get_clean();
$type = $this->_captureScriptType;
$attrs = $this->_captureScriptAttrs;
$this->_captureScriptType = null;
$this->_captureScriptAttrs = null;
$this->_captureLock = false;
switch ($this->_captureType) {
case <API key>::SET:
case <API key>::PREPEND:
case <API key>::APPEND:
$action = strtolower($this->_captureType) . 'Script';
break;
default:
$action = 'appendScript';
break;
}
$this->$action($content, $type, $attrs);
}
/**
* Overload method access
*
* Allows the following method calls:
* - appendFile($src, $type = 'text/javascript', $attrs = array())
* - offsetSetFile($index, $src, $type = 'text/javascript', $attrs = array())
* - prependFile($src, $type = 'text/javascript', $attrs = array())
* - setFile($src, $type = 'text/javascript', $attrs = array())
* - appendScript($script, $type = 'text/javascript', $attrs = array())
* - offsetSetScript($index, $src, $type = 'text/javascript', $attrs = array())
* - prependScript($script, $type = 'text/javascript', $attrs = array())
* - setScript($script, $type = 'text/javascript', $attrs = array())
*
* @param string $method
* @param array $args
* @return <API key>
* @throws Zend_View_Exception if too few arguments or invalid method
*/
public function __call ($method, $args)
{
if (preg_match(
'/^(?P<action>set|(ap|pre)pend|offsetSet)(?P<mode>File|Script)$/',
$method, $matches)) {
if (1 > count($args)) {
require_once 'Zend/View/Exception.php';
$e = new Zend_View_Exception(
sprintf('Method "%s" requires at least one argument', $method));
$e->setView($this->view);
throw $e;
}
$action = $matches['action'];
$mode = strtolower($matches['mode']);
$type = 'text/javascript';
$attrs = array();
if ('offsetSet' == $action) {
$index = array_shift($args);
if (1 > count($args)) {
require_once 'Zend/View/Exception.php';
$e = new Zend_View_Exception(
sprintf(
'Method "%s" requires at least two arguments, an index and source',
$method));
$e->setView($this->view);
throw $e;
}
}
$content = $args[0];
if (isset($args[1])) {
$type = (string) $args[1];
}
if (isset($args[2])) {
$attrs = (array) $args[2];
}
switch ($mode) {
case 'script':
$item = $this->createData($type, $attrs, $content);
if ('offsetSet' == $action) {
$this->offsetSet($index, $item);
} else {
$this->$action($item);
}
break;
case 'file':
default:
if (! $this->_isDuplicate($content)) {
$attrs['src'] = $content;
$item = $this->createData($type, $attrs);
if ('offsetSet' == $action) {
$this->offsetSet($index, $item);
} else {
$this->$action($item);
}
}
break;
}
return $this;
}
return parent::__call($method, $args);
}
/**
* Is the file specified a duplicate?
*
* @param string $file
* @return bool
*/
protected function _isDuplicate ($file)
{
foreach ($this->getContainer() as $item) {
if (($item->source === null) &&
array_key_exists('src', $item->attributes) &&
($file == $item->attributes['src'])) {
return true;
}
}
return false;
}
/**
* Is the script provided valid?
*
* @param mixed $value
* @param string $method
* @return bool
*/
protected function _isValid ($value)
{
if ((! $value instanceof stdClass) || ! isset($value->type) ||
(! isset($value->source) && ! isset($value->attributes))) {
return false;
}
return true;
}
/**
* Override append
*
* @param string $value
* @return void
*/
public function append ($value)
{
if (! $this->_isValid($value)) {
require_once 'Zend/View/Exception.php';
$e = new Zend_View_Exception(
'Invalid argument passed to append(); please use one of the helper methods, appendScript() or appendFile()');
$e->setView($this->view);
throw $e;
}
return $this->getContainer()->append($value);
}
/**
* Override prepend
*
* @param string $value
* @return void
*/
public function prepend ($value)
{
if (! $this->_isValid($value)) {
require_once 'Zend/View/Exception.php';
$e = new Zend_View_Exception(
'Invalid argument passed to prepend(); please use one of the helper methods, prependScript() or prependFile()');
$e->setView($this->view);
throw $e;
}
return $this->getContainer()->prepend($value);
}
/**
* Override set
*
* @param string $value
* @return void
*/
public function set ($value)
{
if (! $this->_isValid($value)) {
require_once 'Zend/View/Exception.php';
$e = new Zend_View_Exception(
'Invalid argument passed to set(); please use one of the helper methods, setScript() or setFile()');
$e->setView($this->view);
throw $e;
}
return $this->getContainer()->set($value);
}
/**
* Override offsetSet
*
* @param string|int $index
* @param mixed $value
* @return void
*/
public function offsetSet ($index, $value)
{
if (! $this->_isValid($value)) {
require_once 'Zend/View/Exception.php';
$e = new Zend_View_Exception(
'Invalid argument passed to offsetSet(); please use one of the helper methods, offsetSetScript() or offsetSetFile()');
$e->setView($this->view);
throw $e;
}
return $this->getContainer()->offsetSet($index, $value);
}
/**
* Set flag indicating if arbitrary attributes are allowed
*
* @param bool $flag
* @return <API key>
*/
public function <API key> ($flag)
{
$this-><API key> = (bool) $flag;
return $this;
}
/**
* Are arbitrary attributes allowed?
*
* @return bool
*/
public function <API key> ()
{
return $this-><API key>;
}
/**
* Create script HTML
*
* @param string $type
* @param array $attributes
* @param string $content
* @param string|int $indent
* @return string
*/
public function itemToString ($item, $indent, $escapeStart, $escapeEnd)
{
$attrString = '';
if (! empty($item->attributes)) {
foreach ($item->attributes as $key => $value) {
if (! $this-><API key>() &&
! in_array($key, $this->_optionalAttributes)) {
continue;
}
if ('defer' == $key) {
$value = 'defer';
}
$attrString .= sprintf(' %s="%s"', $key,
($this->_autoEscape) ? $this->_escape($value) : $value);
}
}
$type = ($this->_autoEscape) ? $this->_escape($item->type) : $item->type;
$html = '<script type="' . $type . '"' . $attrString . '>';
if (! empty($item->source)) {
$html .= PHP_EOL . $indent . ' ' . $escapeStart . PHP_EOL .
$item->source . $indent . ' ' . $escapeEnd . PHP_EOL . $indent;
}
$html .= '</script>';
if (isset($item->attributes['conditional']) &&
! empty($item->attributes['conditional']) &&
is_string($item->attributes['conditional'])) {
$html = $indent . '<!--[if ' . $item->attributes['conditional'] .
']> ' . $html . '<![endif]
} else {
$html = $indent . $html;
}
return $html;
}
/**
* Retrieve string representation
*
* @param string|int $indent
* @return string
*/
public function toString ($indent = null)
{
$indent = (null !== $indent) ? $this->getWhitespace($indent) : $this->getIndent();
if ($this->view) {
$useCdata = $this->view->doctype()->isXhtml() ? true : false;
} else {
$useCdata = $this->useCdata ? true : false;
}
$escapeStart = ($useCdata) ? '//<![CDATA[' : '//<!--';
$escapeEnd = ($useCdata) ? '
$items = array();
$this->getContainer()->ksort();
foreach ($this as $item) {
if (! $this->_isValid($item)) {
continue;
}
$items[] = $this->itemToString($item, $indent, $escapeStart,
$escapeEnd);
}
$return = implode($this->getSeparator(), $items);
return $return;
}
/**
* Create data item containing all necessary components of script
*
* @param string $type
* @param array $attributes
* @param string $content
* @return stdClass
*/
public function createData ($type, array $attributes, $content = null)
{
$data = new stdClass();
$data->type = $type;
$data->attributes = $attributes;
$data->source = $content;
return $data;
}
}
|
function onStepIn(cid, item, pos)
if <API key>(cid,10001) == 1 and <API key>(cid,10002) == 1 and <API key>(cid,10003) == 1 and <API key>(cid,10004) == 1 and <API key>(cid,10005) == 1 and <API key>(cid,10006) == 1 and <API key>(cid,10007) == 1 and <API key>(cid,10008) == 1 then
<API key>(cid,83422,1)
end
|
<?php
namespace Minsal\ModeloBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
class <API key> extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this-><API key>($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
}
}
|
# Name
Aswin M Guptha
Academics
BTech CSE from [Amrita University](https:
Projects
[My Projects](https:
Links to my projects
Profile Link
[GitHub](https://github.com/aswinmguptha)
[GitLab](https://gitlab.com/aswinmguptha)
[Twitter](https://twitter.com/aswinmguptha)
|
#include "get_user_input.h"
#include <QTextCodec>
GetUserInput::GetUserInput(QObject *parent) :
Action(parent)
{
init();
}
GetUserInput::GetUserInput(const QVariantMap& data, QObject *parent):
Action(data, parent)
{
init();
loadInternal(data);
}
void GetUserInput::init()
{
setType(GameObjectMetaType::GetUserInput);
}
void GetUserInput::loadData(const QVariantMap & data, bool internal)
{
if (!internal)
Action::loadData(data, internal);
if (data.contains("message") && data.value("message").type() == QVariant::String)
setMessage(data.value("message").toString());
if (data.contains("variable") && data.value("variable").type() == QVariant::String)
setVariable(data.value("variable").toString());
if (data.contains("defaultValue") && data.value("defaultValue").type() == QVariant::String)
setDefaultValue(data.value("defaultValue").toString());
}
QString GetUserInput::variable()
{
return mVariable;
}
void GetUserInput::setVariable(const QString & var)
{
if (var != mVariable) {
mVariable = var;
notify("variable", mVariable);
}
}
QString GetUserInput::message()
{
return mMessage;
}
void GetUserInput::setMessage(const QString & msg)
{
if (msg != mMessage) {
mMessage = msg;
notify("message", mMessage);
}
}
QString GetUserInput::defaultValue()
{
return mDefaultValue;
}
void GetUserInput::setDefaultValue(const QString & value)
{
if (value != mDefaultValue) {
mDefaultValue = value;
notify("defaultValue", mDefaultValue);
}
}
QString GetUserInput::displayText() const
{
QString var("");
QString text(tr("Prompt") + " ");
text += QString("\"%1\"").arg(mMessage);
if (mVariable.size())
var = " " + tr("and store reply in") + " $" + mVariable;
text += var;
return text;
}
QVariantMap GetUserInput::toJsonObject(bool internal) const
{
QVariantMap object = Action::toJsonObject(internal);
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
if (! codec)
codec = QTextCodec::codecForLocale();
object.insert("message", mMessage);
object.insert("variable", mVariable);
object.insert("defaultValue", mDefaultValue);
return object;
}
|
#include<stdio.h>
#include<big_integer.h>
#include<string.h>
#include<time.h>
#include"gen_lib.h"
int main(int argc,char** argv)
{
if(argc<3)
{
printf("usage %s <length> <num> \n",argv[0]);
exit(-1);
}
FILE* bash=fopen("bash.dat","w+");
FILE* python=fopen("py.dat","w+");
int length=atoi(argv[1]);
int num=atoi(argv[2]);
srand(time(NULL));
set_exe_name("");
gen_cmp(bash,python,length,num);
fwrite("\nquit\n",1,strlen("\nquit"),bash);
fclose(bash);
fclose(python);
return 0;
}
|
Imports System.Globalization
Imports P3D.Legacy.Core.Screens
Namespace ScriptVersion2
Partial Class ScriptComparer
'
'Contains the <environment> constructs.
'
Private Shared Function DoEnvironment(ByVal subClass As String) As Object
Dim command As String = <API key>(subClass).Command
Dim argument As String = <API key>(subClass).Argument
Select Case command.ToLower()
Case "daytime"
Return World.GetTime.ToString(CultureInfo.InvariantCulture)
Case "daytimeid"
Return int(CInt(World.GetTime)).ToString(CultureInfo.InvariantCulture)
Case "season"
Return World.CurrentSeason.ToString(CultureInfo.InvariantCulture)
Case "seasonid"
Return int(CInt(World.CurrentSeason)).ToString(CultureInfo.InvariantCulture)
Case "day"
Return My.Computer.Clock.LocalTime.DayOfWeek.ToString(CultureInfo.InvariantCulture)
Case "dayofyear"
Return My.Computer.Clock.LocalTime.DayOfYear().ToString(CultureInfo.InvariantCulture)
Case "dayinformation"
Return My.Computer.Clock.LocalTime.DayOfWeek.ToString(CultureInfo.InvariantCulture) & "," & World.GetTime.ToString(CultureInfo.InvariantCulture)
Case "week"
Return World.WeekOfYear.ToString(CultureInfo.InvariantCulture)
Case "hour"
Return My.Computer.Clock.LocalTime.Hour.ToString(CultureInfo.InvariantCulture)
Case "year"
Return My.Computer.Clock.LocalTime.Year.ToString(CultureInfo.InvariantCulture)
Case "weather", "mapweather", "currentmapweather"
Return Screen.Level.World.CurrentWeather.ToString(CultureInfo.InvariantCulture)
Case "weatherid", "mapweatherid", "currentmapweatherid"
Return int(CInt(Screen.Level.World.CurrentWeather)).ToString(CultureInfo.InvariantCulture)
Case "regionweather"
Return World.<API key>().ToString(CultureInfo.InvariantCulture)
Case "regionweatherid"
Return int(CInt(World.<API key>())).ToString(CultureInfo.InvariantCulture)
Case "canfly"
Return ReturnBoolean(Screen.Level.CanFly)
Case "candig"
Return ReturnBoolean(Screen.Level.CanDig)
Case "canteleport"
Return ReturnBoolean(Screen.Level.CanTeleport)
Case "wildpokemongrass"
Return ReturnBoolean(Screen.Level.WildPokemonGrass)
Case "wildpokemonwater"
Return ReturnBoolean(Screen.Level.WildPokemonWater)
Case "<API key>"
Return ReturnBoolean(Screen.Level.WildPokemonFloor)
Case "isdark"
Return ReturnBoolean(Screen.Level.IsDark)
End Select
Return DEFAULTNULL
End Function
End Class
End Namespace
|
#include "buildconfiguration.h"
#include "<API key>.h"
#include "buildinfo.h"
#include "buildsteplist.h"
#include "kit.h"
#include "kitinformation.h"
#include "kitmanager.h"
#include "project.h"
#include "projectexplorer.h"
#include "<API key>.h"
#include "<API key>.h"
#include "projecttree.h"
#include "target.h"
#include <coreplugin/idocument.h>
#include <utils/qtcassert.h>
#include <utils/macroexpander.h>
#include <utils/algorithm.h>
#include <utils/mimetypes/mimetype.h>
#include <utils/mimetypes/mimedatabase.h>
#include <QDebug>
static const char <API key>[] = "ProjectExplorer.BuildConfiguration.BuildStepListCount";
static const char <API key>[] = "ProjectExplorer.BuildConfiguration.BuildStepList.";
static const char <API key>[] = "ProjectExplorer.BuildConfiguration.<API key>";
static const char <API key>[] = "ProjectExplorer.BuildConfiguration.<API key>";
static const char BUILDDIRECTORY_KEY[] = "ProjectExplorer.BuildConfiguration.BuildDirectory";
namespace ProjectExplorer {
BuildConfiguration::BuildConfiguration(Target *target, Core::Id id)
: <API key>(target, id)
{
Utils::MacroExpander *expander = macroExpander();
expander->setDisplayName(tr("Build Settings"));
expander->setAccumulating(true);
expander->registerSubProvider([target] { return target->macroExpander(); });
expander->registerVariable("buildDir", tr("Build directory"),
[this] { return buildDirectory().toUserOutput(); });
expander->registerVariable(Constants::<API key>, tr("Name of current build"),
[this] { return displayName(); }, false);
expander->registerPrefix(Constants::<API key>,
tr("Variables in the current build environment"),
[this](const QString &var) { return environment().value(var); });
<API key>();
connect(target, &Target::kitChanged,
this, &BuildConfiguration::<API key>);
connect(this, &BuildConfiguration::environmentChanged,
this, &BuildConfiguration::<API key>);
// Many macroexpanders are based on the current project, so they may change the environment:
connect(ProjectTree::instance(), &ProjectTree::<API key>,
this, &BuildConfiguration::<API key>);
}
Utils::FileName BuildConfiguration::buildDirectory() const
{
const QString path = macroExpander()->expand(QDir::cleanPath(environment().expandVariables(m_buildDirectory.toString())));
return Utils::FileName::fromString(QDir::cleanPath(QDir(target()->project()->projectDirectory().toString()).absoluteFilePath(path)));
}
Utils::FileName BuildConfiguration::rawBuildDirectory() const
{
return m_buildDirectory;
}
void BuildConfiguration::setBuildDirectory(const Utils::FileName &dir)
{
if (dir == m_buildDirectory)
return;
m_buildDirectory = dir;
<API key>();
}
void BuildConfiguration::initialize(const BuildInfo *info)
{
setDisplayName(info->displayName);
<API key>(info->displayName);
setBuildDirectory(info->buildDirectory);
m_stepLists.append(new BuildStepList(this, Constants::BUILDSTEPS_BUILD));
m_stepLists.append(new BuildStepList(this, Constants::BUILDSTEPS_CLEAN));
}
QList<NamedWidget *> BuildConfiguration::<API key>()
{
return QList<NamedWidget *>() << new <API key>(this);
}
QList<Core::Id> BuildConfiguration::knownStepLists() const
{
return Utils::transform(m_stepLists, &BuildStepList::id);
}
BuildStepList *BuildConfiguration::stepList(Core::Id id) const
{
return Utils::findOrDefault(m_stepLists, Utils::equal(&BuildStepList::id, id));
}
QVariantMap BuildConfiguration::toMap() const
{
QVariantMap map(<API key>::toMap());
map.insert(QLatin1String(<API key>), <API key>);
map.insert(QLatin1String(<API key>), Utils::EnvironmentItem::toStringList(<API key>));
map.insert(QLatin1String(BUILDDIRECTORY_KEY), m_buildDirectory.toString());
map.insert(QLatin1String(<API key>), m_stepLists.count());
for (int i = 0; i < m_stepLists.count(); ++i)
map.insert(QLatin1String(<API key>) + QString::number(i), m_stepLists.at(i)->toMap());
return map;
}
bool BuildConfiguration::fromMap(const QVariantMap &map)
{
<API key> = map.value(QLatin1String(<API key>)).toBool();
<API key> = Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(<API key>)).toStringList());
m_buildDirectory = Utils::FileName::fromString(map.value(QLatin1String(BUILDDIRECTORY_KEY)).toString());
<API key>();
qDeleteAll(m_stepLists);
m_stepLists.clear();
int maxI = map.value(QLatin1String(<API key>), 0).toInt();
for (int i = 0; i < maxI; ++i) {
QVariantMap data = map.value(QLatin1String(<API key>) + QString::number(i)).toMap();
if (data.isEmpty()) {
qWarning() << "No data for build step list" << i << "found!";
continue;
}
auto list = new BuildStepList(this, idFromMap(data));
if (!list->fromMap(data)) {
qWarning() << "Failed to restore build step list" << i;
delete list;
return false;
}
m_stepLists.append(list);
}
// We currently assume there to be at least a clean and build list!
QTC_CHECK(knownStepLists().contains(Core::Id(Constants::BUILDSTEPS_BUILD)));
QTC_CHECK(knownStepLists().contains(Core::Id(Constants::BUILDSTEPS_CLEAN)));
return <API key>::fromMap(map);
}
void BuildConfiguration::<API key>()
{
Utils::Environment env = baseEnvironment();
env.modify(<API key>());
if (env == m_cachedEnvironment)
return;
m_cachedEnvironment = env;
emit environmentChanged(); // might trigger <API key> signal!
}
void BuildConfiguration::<API key>()
{
if (buildDirectory() != <API key>) {
<API key> = buildDirectory();
emit <API key>();
}
}
Target *BuildConfiguration::target() const
{
return static_cast<Target *>(parent());
}
Project *BuildConfiguration::project() const
{
return target()->project();
}
Utils::Environment BuildConfiguration::baseEnvironment() const
{
Utils::Environment result;
if (<API key>())
result = Utils::Environment::systemEnvironment();
addToEnvironment(result);
target()->kit()->addToEnvironment(result);
return result;
}
QString BuildConfiguration::baseEnvironmentText() const
{
if (<API key>())
return tr("System Environment");
else
return tr("Clean Environment");
}
Utils::Environment BuildConfiguration::environment() const
{
return m_cachedEnvironment;
}
void BuildConfiguration::<API key>(bool b)
{
if (<API key>() == b)
return;
<API key> = !b;
<API key>();
}
void BuildConfiguration::addToEnvironment(Utils::Environment &env) const
{
Q_UNUSED(env);
}
bool BuildConfiguration::<API key>() const
{
return !<API key>;
}
QList<Utils::EnvironmentItem> BuildConfiguration::<API key>() const
{
return <API key>;
}
void BuildConfiguration::<API key>(const QList<Utils::EnvironmentItem> &diff)
{
if (<API key> == diff)
return;
<API key> = diff;
<API key>();
}
bool BuildConfiguration::isEnabled() const
{
return true;
}
QString BuildConfiguration::disabledReason() const
{
return QString();
}
bool BuildConfiguration::<API key>(Node *node)
{
Q_UNUSED(node);
return false;
}
QString BuildConfiguration::buildTypeName(BuildConfiguration::BuildType type)
{
switch (type) {
case ProjectExplorer::BuildConfiguration::Debug:
return QLatin1String("debug");
case ProjectExplorer::BuildConfiguration::Profile:
return QLatin1String("profile");
case ProjectExplorer::BuildConfiguration::Release:
return QLatin1String("release");
case ProjectExplorer::BuildConfiguration::Unknown: // fallthrough
default:
return QLatin1String("unknown");
}
}
bool BuildConfiguration::isActive() const
{
return target()->isActive() && target()-><API key>() == this;
}
/*!
* Helper function that prepends the directory containing the C++ toolchain to
* PATH. This is used to in build configurations targeting broken build systems
* to provide hints about which compiler to use.
*/
void BuildConfiguration::<API key>(Utils::Environment &env) const
{
return <API key>(target()->kit(), env);
}
void BuildConfiguration::<API key>(Kit *k, Utils::Environment &env)
{
const ToolChain *tc
= <API key>::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
if (!tc)
return;
const Utils::FileName compilerDir = tc->compilerCommand().parentDir();
if (!compilerDir.isEmpty())
env.prependOrSetPath(compilerDir.toString());
}
// <API key>
static QList<<API key> *> <API key>;
<API key>::<API key>()
{
<API key>.append(this);
}
<API key>::~<API key>()
{
<API key>.removeOne(this);
}
int <API key>::priority(const Target *parent) const
{
return canHandle(parent) ? m_basePriority : -1;
}
bool <API key>::<API key>(Core::Id id) const
{
if (<API key>.isEmpty())
return true;
return <API key>.contains(id);
}
int <API key>::priority(const Kit *k, const QString &projectPath) const
{
QTC_ASSERT(!<API key>.isEmpty(), return -1);
if (k && Utils::mimeTypeForFile(projectPath).matchesName(<API key>)
&& <API key>(<API key>::deviceTypeId(k))) {
return m_basePriority;
}
return -1;
}
// setup
<API key> *<API key>::find(const Kit *k, const QString &projectPath)
{
<API key> *factory = nullptr;
int priority = -1;
for (<API key> *i : <API key>) {
int iPriority = i->priority(k, projectPath);
if (iPriority > priority) {
factory = i;
priority = iPriority;
}
}
return factory;
}
// create
<API key> * <API key>::find(Target *parent)
{
<API key> *factory = nullptr;
int priority = -1;
for (<API key> *i : <API key>) {
int iPriority = i->priority(parent);
if (iPriority > priority) {
factory = i;
priority = iPriority;
}
}
return factory;
}
void <API key>::<API key>(Core::Id id)
{
<API key> = id;
}
void <API key>::<API key>(const QString &mimeTypeName)
{
<API key> = mimeTypeName;
}
void <API key>::<API key>(const QList<Core::Id> &ids)
{
<API key> = ids;
}
void <API key>::setBasePriority(int basePriority)
{
m_basePriority = basePriority;
}
bool <API key>::canHandle(const Target *target) const
{
if (<API key>.isValid() && <API key> != target->project()->id())
return false;
if (containsType(target->project()->projectIssues(target->kit()), Task::TaskType::Error))
return false;
if (!<API key>(<API key>::deviceTypeId(target->kit())))
return false;
return true;
}
BuildConfiguration *<API key>::create(Target *parent, const BuildInfo *info) const
{
if (!canHandle(parent))
return nullptr;
QTC_ASSERT(m_creator, return nullptr);
BuildConfiguration *bc = m_creator(parent);
if (!bc)
return nullptr;
bc->initialize(info);
return bc;
}
BuildConfiguration *<API key>::restore(Target *parent, const QVariantMap &map)
{
<API key> *factory = nullptr;
int priority = -1;
for (<API key> *i : <API key>) {
if (!i->canHandle(parent))
continue;
const Core::Id id = idFromMap(map);
if (!id.name().startsWith(i->m_buildConfigId.name()))
continue;
int iPriority = i->priority(parent);
if (iPriority > priority) {
factory = i;
priority = iPriority;
}
}
if (!factory)
return nullptr;
QTC_ASSERT(factory->m_creator, return nullptr);
BuildConfiguration *bc = factory->m_creator(parent);
QTC_ASSERT(bc, return nullptr);
if (!bc->fromMap(map)) {
delete bc;
bc = nullptr;
}
return bc;
}
BuildConfiguration *<API key>::clone(Target *parent,
const BuildConfiguration *source)
{
return restore(parent, source->toMap());
}
} // namespace ProjectExplorer
|
package com.example.heregpsloc;
import java.security.SecureRandom;
import java.math.BigInteger;
public final class <API key> {
private SecureRandom random = new SecureRandom();
public String nextSessionId() {
return new BigInteger(130, random).toString(32);
}
}
|
using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using DeanCCCore.Core._2ch.Jane;
using DeanCCCore.Core.Utility;
namespace DeanCCCore.Core
{
[Serializable]
public class ZipFileHeader : ImageHeader
{
public ZipFileHeader()
{
}
public ZipFileHeader(int sourceResIndex , string url)
{
SourceResIndex = sourceResIndex;
OriginalUrl = url;
}
public override bool IsZip
{
get
{
return true;
}
}
}
}
|
// ResInsight is free software: you can redistribute it and/or modify
// (at your option) any later version.
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// FITNESS FOR A PARTICULAR PURPOSE.
// for more details.
#include "RivGridPartMgr.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "<API key>.h"
#include "RigCaseData.h"
#include "<API key>.h"
#include "RimEclipseCase.h"
#include "<API key>.h"
#include "<API key>.h"
#include "RimReservoirView.h"
#include "RimResultSlot.h"
#include "<API key>.h"
#include "RimWellCollection.h"
#include "<API key>.h"
#include "<API key>.h"
#include "<API key>.h"
#include "RivSourceInfo.h"
#include "<API key>.h"
#include "<API key>.h"
#include "<API key>.h"
#include "cafEffectGenerator.h"
#include "cafPdmFieldCvfColor.h"
#include "cafPdmFieldCvfMat4d.h"
#include "cafProgressInfo.h"
#include "cvfDrawableGeo.h"
#include "cvfMath.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "<API key>.h"
#include "<API key>.h"
#include "cvfRenderState_FF.h"
#include "cvfShaderProgram.h"
#include "<API key>.h"
#include "<API key>.h"
#include "<API key>.h"
#include "cvfStructGrid.h"
#include "cvfUniform.h"
RivGridPartMgr::RivGridPartMgr(const RigGridBase* grid, size_t gridIdx)
: m_surfaceGenerator(grid),
m_gridIdx(gridIdx),
m_grid(grid),
m_surfaceFaceFilter(grid),
m_opacityLevel(1.0f),
m_defaultColor(cvf::Color3::WHITE)
{
CVF_ASSERT(grid);
m_cellVisibility = new cvf::UByteArray;
<API key> = new cvf::Vec2fArray;
}
void RivGridPartMgr::setTransform(cvf::Transform* scaleTransform)
{
m_scaleTransform = scaleTransform;
}
void RivGridPartMgr::setCellVisibility(cvf::UByteArray* cellVisibilities)
{
CVF_ASSERT(m_scaleTransform.notNull());
CVF_ASSERT(cellVisibilities);
m_cellVisibility = cellVisibilities;
m_surfaceGenerator.setCellVisibility(cellVisibilities);
m_surfaceGenerator.<API key>(&m_surfaceFaceFilter);
<API key>(m_surfaceGenerator);
}
void RivGridPartMgr::<API key>(cvf::<API key>& geoBuilder)
{
bool useBufferObjects = true;
// Surface geometry
{
cvf::ref<cvf::DrawableGeo> geo = geoBuilder.generateSurface();
if (geo.notNull())
{
geo->computeNormals();
if (useBufferObjects)
{
geo->setRenderMode(cvf::DrawableGeo::BUFFER_OBJECT);
}
cvf::ref<cvf::Part> part = new cvf::Part;
part->setName("Grid " + cvf::String(static_cast<int>(m_gridIdx)));
part->setId(m_gridIdx); // !! For now, use grid index as part ID (needed for pick info)
part->setDrawable(geo.p());
part->setTransform(m_scaleTransform.p());
// Set mapping from triangle face index to cell index
cvf::ref<RivSourceInfo> si = new RivSourceInfo;
si-><API key> = geoBuilder.<API key>();
part->setSourceInfo(si.p());
part->updateBoundingBox();
// Set default effect
caf::<API key> geometryEffgen(cvf::Color4f(cvf::Color3f::WHITE), caf::PO_1);
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateEffect();
part->setEffect(geometryOnlyEffect.p());
part->setEnableMask(surfaceBit);
m_surfaceFaces = part;
}
}
// Mesh geometry
{
cvf::ref<cvf::DrawableGeo> geoMesh = geoBuilder.createMeshDrawable();
if (geoMesh.notNull())
{
if (useBufferObjects)
{
geoMesh->setRenderMode(cvf::DrawableGeo::BUFFER_OBJECT);
}
cvf::ref<cvf::Part> part = new cvf::Part;
part->setName("Grid mesh " + cvf::String(static_cast<int>(m_gridIdx)));
part->setDrawable(geoMesh.p());
part->setTransform(m_scaleTransform.p());
part->updateBoundingBox();
RiaPreferences* prefs = RiaApplication::instance()->preferences();
cvf::ref<cvf::Effect> eff;
caf::MeshEffectGenerator effGen(prefs-><API key>());
eff = effGen.generateEffect();
// Set priority to make sure fault lines are rendered first
part->setPriority(10);
part->setEnableMask(meshSurfaceBit);
part->setEffect(eff.p());
m_surfaceGridLines = part;
}
}
}
void RivGridPartMgr::appendPartsToModel(cvf::ModelBasicList* model)
{
CVF_ASSERT(model != NULL);
if(m_surfaceFaces.notNull() ) model->addPart(m_surfaceFaces.p() );
if(m_surfaceGridLines.notNull()) model->addPart(m_surfaceGridLines.p());
}
void RivGridPartMgr::updateCellColor(cvf::Color4f color)
{
if (m_surfaceFaces.isNull()) return;
// Set default effect
caf::<API key> geometryEffgen(color, caf::PO_1);
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateEffect();
if (m_surfaceFaces.notNull()) m_surfaceFaces->setEffect(geometryOnlyEffect.p());
if (color.a() < 1.0f)
{
// Set priority to make sure this transparent geometry are rendered last
if (m_surfaceFaces.notNull()) m_surfaceFaces->setPriority(100);
}
m_opacityLevel = color.a();
m_defaultColor = color.toColor3f();
// Update mesh colors as well, in case of change
RiaPreferences* prefs = RiaApplication::instance()->preferences();
cvf::ref<cvf::Effect> eff;
if (m_surfaceFaces.notNull())
{
caf::MeshEffectGenerator effGen(prefs-><API key>());
eff = effGen.generateEffect();
m_surfaceGridLines->setEffect(eff.p());
}
}
void RivGridPartMgr::<API key>(size_t timeStepIndex, RimResultSlot* cellResultSlot)
{
CVF_ASSERT(cellResultSlot);
RigCaseData* eclipseCase = cellResultSlot->reservoirView()->eclipseCase()->reservoirData();
cvf::ref<cvf::Color3ubArray> <API key>;
// Outer surface
if (m_surfaceFaces.notNull())
{
if (cellResultSlot-><API key>())
{
<API key> texturer(cellResultSlot, cellResultSlot->ternaryLegendConfig(),
timeStepIndex,
m_grid->gridIndex(),
m_surfaceGenerator.<API key>());
texturer.createTextureCoords(<API key>.p());
const <API key>* mapper = cellResultSlot->ternaryLegendConfig()->scalarMapper();
<API key>::<API key>(m_surfaceFaces.p(), <API key>.p(), mapper, m_opacityLevel, caf::FC_NONE);
}
else
{
<API key> texturer(cellResultSlot,
timeStepIndex,
m_grid->gridIndex(),
m_surfaceGenerator.<API key>());
if (!texturer.isValid())
{
return;
}
texturer.createTextureCoords(<API key>.p());
const cvf::ScalarMapper* mapper = cellResultSlot->legendConfig()->scalarMapper();
<API key>::<API key>(m_surfaceFaces.p(), <API key>.p(), mapper, m_opacityLevel, caf::FC_NONE);
}
}
}
void RivGridPartMgr::<API key>(size_t timeStepIndex, RimResultSlot* cellResultSlot, <API key>* cellEdgeResultSlot)
{
if (m_surfaceFaces.notNull())
{
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_surfaceFaces->drawable());
if (dg)
{
cvf::ref<cvf::Effect> eff = <API key>::<API key>(dg, m_surfaceGenerator.<API key>(), m_grid->gridIndex(),
timeStepIndex, cellResultSlot, cellEdgeResultSlot, m_opacityLevel, m_defaultColor, caf::FC_NONE);
m_surfaceFaces->setEffect(eff.p());
}
}
}
RivGridPartMgr::~RivGridPartMgr()
{
#if 0
if (m_faultFaces.notNull()) m_faultFaces-><API key>();
if (m_faultGridLines.notNull()) m_faultGridLines-><API key>();
if (m_surfaceGridLines.notNull()) m_surfaceGridLines-><API key>();
if (m_surfaceFaces.notNull()) m_surfaceFaces-><API key>();
#endif
}
|
ALTER TABLE Tag ADD (version INT DEFAULT '0' NOT NULL);
|
# Manage yum repos
## in any.yaml
repos::default:
gpgcheck: 0
enabled: 1
mirrorlist_expire: 7200
failovermethod: priority
repos::list:
name1:
descr: name-1
mirrorlist: 'http://url/?release=$releasever&arch=$basearch&repo=os&infra=$infra'
priority: 50
name2:
descr: name-2
mirrorlist: 'http://url/?release=$releasever&arch=$basearch&repo=updates&infra=$infra'
priority: 51
if `:merge_behavior: deeper` all found hashes will be merged in accordance with the priority.
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Database Error</title>
<style type="text/css">
::selection{ background-color: #E13300; color: white; }
::moz-selection{ background-color: #E13300; color: white; }
::webkit-selection{ background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
-webkit-box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>
|
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<div class="glfwheader">
<a href="http:
<ul class="glfwnavbar">
<li><a href="http:
<li><a href="http:
<li><a href="http:
<li><a href="http:
</ul>
</div>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li class="current"><a href="globals_defs.html"><span>Macros</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_defs.html#index_a"><span>a</span></a></li>
<li><a href="globals_defs_b.html#index_b"><span>b</span></a></li>
<li><a href="globals_defs_c.html#index_c"><span>c</span></a></li>
<li><a href="globals_defs_d.html#index_d"><span>d</span></a></li>
<li><a href="globals_defs_e.html#index_e"><span>e</span></a></li>
<li><a href="globals_defs_f.html#index_f"><span>f</span></a></li>
<li><a href="globals_defs_g.html#index_g"><span>g</span></a></li>
<li><a href="globals_defs_h.html#index_h"><span>h</span></a></li>
<li><a href="globals_defs_i.html#index_i"><span>i</span></a></li>
<li><a href="globals_defs_j.html#index_j"><span>j</span></a></li>
<li><a href="globals_defs_k.html#index_k"><span>k</span></a></li>
<li><a href="globals_defs_l.html#index_l"><span>l</span></a></li>
<li class="current"><a href="globals_defs_m.html#index_m"><span>m</span></a></li>
<li><a href="globals_defs_n.html#index_n"><span>n</span></a></li>
<li><a href="globals_defs_o.html#index_o"><span>o</span></a></li>
<li><a href="globals_defs_p.html#index_p"><span>p</span></a></li>
<li><a href="globals_defs_r.html#index_r"><span>r</span></a></li>
<li><a href="globals_defs_s.html#index_s"><span>s</span></a></li>
<li><a href="globals_defs_t.html#index_t"><span>t</span></a></li>
<li><a href="globals_defs_v.html#index_v"><span>v</span></a></li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="<API key>">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_m"></a>- m -</h3><ul>
<li>GLFW_MAXIMIZED
: <a class="el" href="glfw3_8h.html#<API key>">glfw3.h</a>
</li>
<li>GLFW_MOD_ALT
: <a class="el" href="group__mods.html#<API key>">glfw3.h</a>
</li>
<li>GLFW_MOD_CONTROL
: <a class="el" href="group__mods.html#<API key>">glfw3.h</a>
</li>
<li>GLFW_MOD_SHIFT
: <a class="el" href="group__mods.html#<API key>">glfw3.h</a>
</li>
<li>GLFW_MOD_SUPER
: <a class="el" href="group__mods.html#<API key>">glfw3.h</a>
</li>
<li>GLFW_MOUSE_BUTTON_1
: <a class="el" href="group__buttons.html#<API key>">glfw3.h</a>
</li>
<li>GLFW_MOUSE_BUTTON_2
: <a class="el" href="group__buttons.html#<API key>">glfw3.h</a>
</li>
<li>GLFW_MOUSE_BUTTON_3
: <a class="el" href="group__buttons.html#<API key>">glfw3.h</a>
</li>
<li>GLFW_MOUSE_BUTTON_4
: <a class="el" href="group__buttons.html#<API key>">glfw3.h</a>
</li>
<li>GLFW_MOUSE_BUTTON_5
: <a class="el" href="group__buttons.html#<API key>">glfw3.h</a>
</li>
<li>GLFW_MOUSE_BUTTON_6
: <a class="el" href="group__buttons.html#<API key>">glfw3.h</a>
</li>
<li>GLFW_MOUSE_BUTTON_7
: <a class="el" href="group__buttons.html#<API key>">glfw3.h</a>
</li>
<li>GLFW_MOUSE_BUTTON_8
: <a class="el" href="group__buttons.html#<API key>">glfw3.h</a>
</li>
<li><API key>
: <a class="el" href="group__buttons.html#<API key>">glfw3.h</a>
</li>
<li><API key>
: <a class="el" href="group__buttons.html#<API key>">glfw3.h</a>
</li>
<li><API key>
: <a class="el" href="group__buttons.html#<API key>">glfw3.h</a>
</li>
<li><API key>
: <a class="el" href="group__buttons.html#<API key>">glfw3.h</a>
</li>
</ul>
</div><!-- contents -->
<address class="footer">
<p>
Last update on Wed Feb 1 2017 for GLFW 3.2.1
</p>
</address>
</body>
</html>
|
#include "paneldamageskind.h"
#include "ui_paneldamageskind.h"
#include "damageskind.h"
#include "common.h"
#include "rpm.h"
// CONSTRUCTOR / DESTRUCTOR / GET / SET
PanelDamagesKind::PanelDamagesKind(QWidget *parent) :
QWidget(parent),
ui(new Ui::PanelDamagesKind)
{
ui->setupUi(this);
}
PanelDamagesKind::~PanelDamagesKind()
{
delete ui;
}
// INTERMEDIARY FUNCTIONS
void PanelDamagesKind::initialize(PrimitiveValue *statisticID, PrimitiveValue
*currencyID, SuperListItem *variableID, SuperListItem *kind)
{
m_statisticID = statisticID;
m_currencyID = currencyID;
m_variableID = variableID;
m_kind = kind;
int index = m_kind->id();
ui->comboBoxChoice->clear();
ui->comboBoxChoice->addItems(RPM::<API key>);
ui->comboBoxChoice->setCurrentIndex(index);
ui-><API key>-><API key>(m_statisticID
->modelDataBase());
ui-><API key>->initializeModel(m_statisticID);
ui-><API key>->updateModel();
ui-><API key>-><API key>(m_currencyID
->modelDataBase());
ui-><API key>->initializeModel(m_currencyID);
ui-><API key>->updateModel();
ui->widgetVariable->initializeSuper(m_variableID);
showElement();
}
void PanelDamagesKind::hideAll() {
ui-><API key>->hide();
ui-><API key>->hide();
ui->widgetVariable->hide();
}
void PanelDamagesKind::showElement() {
hideAll();
switch (static_cast<DamagesKind>(m_kind->id())) {
case DamagesKind::Stat:
ui-><API key>->show();
break;
case DamagesKind::Currency:
ui-><API key>->show();
break;
case DamagesKind::Variable:
ui->widgetVariable->show();
break;
}
}
// SLOTS
void PanelDamagesKind::<API key>(int index) {
m_kind->setId(index);
showElement();
}
|
#! /bin/sh
dirs="$*"
if test _"$dirs" = _
then dirs="."
fi
for dir in $dirs
do
if test -d $dir
then
aclocal=""
autoconf=" && autoconf"
autoheader=""
automake=""
if test -f $dir/Makefile.am
then
aclocal=" && aclocal -I build-aux"
automake=" && automake --copy --add-missing"
if egrep 'A[CM]_PROG_LIBTOOL' $dir/configure.ac >/dev/null
then
libtoolize=" && libtoolize --copy --automake"
fi
fi
if egrep 'A[CM]_CONFIG_HEADER' $dir/configure.ac >/dev/null
then autoheader=" && autoheader"
fi
commands="cd $dir${libtoolize}${aclocal}${autoheader}${autoconf}${automake}"
echo "$commands"
eval "($commands)"
result=$?
if test $result -ne 0
then exit $result
fi
fi
done
exit $result
|
require 'memoist'
module ClaimsReporting::Health
module PatientExtension
extend ActiveSupport::Concern
included do
extend Memoist
has_many :medical_claims, class_name: 'ClaimsReporting::MedicalClaim', foreign_key: :member_id, primary_key: :medicaid_id
def <API key>(qa, denied: false) # rubocop:disable Naming/MethodParameterName
activity_date_range = Range.new(*<API key>.map(&:date_of_activity).minmax)
(
<API key>(date_range: activity_date_range)[qa.date_of_activity] || []
).select do |c|
procedure_matches = qa.<API key> == c.<API key>
procedure_matches &&= c.claim_status == 'D' if denied
procedure_matches
end
end
def <API key>(qa, denied: false) # rubocop:disable Naming/MethodParameterName
matching_claims = <API key>(qa, denied: denied)
return matching_claims.first if matching_claims.size <= 1
# slow path -- more that one matching claim for the same day
# we can try to assign them in matching order by id
matching_qa = <API key>.select do |qa2|
(
qa2.claim_submitted_on.present? &&
qa2.date_of_activity == qa.date_of_activity &&
qa2.<API key> == qa.<API key>
)
end
return nil unless matching_qa.size == matching_claims.size
return nil if matching_qa.index(qa).nil?
matching_claims[matching_qa.index(qa)]
end
def <API key>(date_range:)
medical_claims.where(
service_start_date: date_range,
).group_by(&:service_start_date)
end
memoize :<API key>
end
end
end
|
<?php
/* PHP-NUKE: Advanced Content Management System */
/* This is the language module with all the system messages */
/* If you made a translation go to the my website and send to me */
/* the translated file. Please keep the original text order by modules, */
/* and just one message per line, also double check your translation! */
/* You need to change the second quoted phrase, not the capital one! */
/* If you need to use double quotes (") remember to add a backslash (\), */
/* so your entry will look like: This is \"double quoted\" text. */
/* And, if you use HTML code, please double check it. */
define("_URL","URL");
define("_FUNCTIONS","Functions");
define("_YES","Yes");
define("_NO","No");
define("_CATEGORY","Category");
define("_SAVECHANGES","Save Changes");
define("_OK","Ok!");
define("_HITS","Hits");
define("_THEREARE","There are");
define("_CHECK","Check");
define("_AUTHORNAME","Author's Name");
define("_AUTHOREMAIL","Author's Email");
define("_DOWNLOADNAME","Program Name");
define("_INBYTES","in bytes");
define("_FILESIZE","Filesize");
define("_VERSION","Version");
define("_DESCRIPTION","Description");
define("_AUTHOR","Author");
define("_HOMEPAGE","HomePage");
define("_NAME","Name");
define("_FILEURL","File Link");
define("_DOWNLOADID","Download ID");
define("_PAGETITLE","Page Title");
define("_PAGEURL","Page URL");
define("_ADDURL","Add this URL");
define("_DOWNLOAD","Downloads");
define("_TITLE","Title");
define("_STATUS","Status");
define("_ADD","Add");
define("_MODIFY","Modify");
define("_DOWNLOADSINDB","Downloads in our Database");
define("<API key>","Downloads Waiting for Validation");
define("_CLEANDOWNLOADSDB","Clean Downloads Votes");
define("_BROKENDOWNLOADSREP","Broken Downloads Reports");
define("_DOWNLOADMODREQUEST","Download Modification Requests");
define("_ADDNEWDOWNLOAD","Add a New Download");
define("_MODDOWNLOAD","Modify a Download");
define("_WEBDOWNLOADSADMIN","Web Downloads Administration");
define("_DNOREPORTEDBROKEN","No reported broken downloads.");
define("_DUSERREPBROKEN","User Reported Broken Downloads");
define("_DIGNOREINFO","Ignore (Deletes all <strong><i>requests</i></strong> for a given download)");
define("_DDELETEINFO","Delete (Deletes <strong><i>broken download</i></strong> and <strong><i>requests</i></strong> for a given download)");
define("_DOWNLOADOWNER","Download Owner");
define("_DUSERMODREQUEST","User Download Modification Requests");
define("_DOWNLOADVALIDATION","Download Validation");
define("_CHECKALLDOWNLOADS","Check ALL Downloads");
define("_VALIDATEDOWNLOADS","Validate Downloads");
define("_NEWDOWNLOADADDED","New Download added to the Database");
define("_SUBMITTER","Submitter");
define("_VISIT","Visit");
define("_ADDMAINCATEGORY","Add a MAIN Category");
define("_ADDSUBCATEGORY","Add a SUB-Category");
define("_IN","in");
define("_DESCRIPTION255","Description: (255 characters max)");
define("_MODCATEGORY","Modify a Category");
define("_ADDEDITORIAL","Add Editorial");
define("_EDITORIALTITLE","Editorial Title");
define("_EDITORIALTEXT","Editorial Text");
define("_DATEWRITTEN","Date Written");
define("_IGNORE","Ignore");
define("_ORIGINAL","Original");
define("_PROPOSED","Proposed");
define("_NOMODREQUESTS","There are not any modification requests right now");
define("_SUBCATEGORY","Sub-Category");
define("_OWNER","Owner");
define("_ACCEPT","Accept");
define("_ERRORTHECATEGORY","ERROR: The Category");
define("_ALREADYEXIST","already exist!");
define("<API key>","ERROR: The Sub-Category");
define("_EDITORIALADDED","Editorial added to the Database");
define("_EDITORIALMODIFIED","Editorial Modified");
define("_EDITORIALREMOVED","Editorial removed from the Database");
define("_CHECKCATEGORIES","Check Categories");
define("<API key>","(include Sub-Categories)");
define("_FAILED","Failed!");
define("_BEPATIENT","(please be patient)");
define("_VALIDATINGCAT","Validating Category (and all subcategories)");
define("_VALIDATINGSUBCAT","Validating Sub-Category");
define("_ERRORURLEXIST","ERROR: This URL is already listed in the Database!");
define("_ERRORNOTITLE","ERROR: You need to type a TITLE for your URL!");
define("_ERRORNOURL","ERROR: You need to type a URL for your URL!");
define("_ERRORNODESCRIPTION","ERROR: You need to type a DESCRIPTION for your URL!");
define("_EZTRANSFER","Transfer");
define("_EZTHEREIS","There is");
define("_EZSUBCAT","sub-categories");
define("_EZATTACHEDTOCAT","under this category");
define("<API key>","Transfer all downloads from category");
define("<API key>","WARNING : Are you sure you want to delete this category? You will delete all sub-categories and attached downloads as well!");
define("_DOWNLOADTITLE","Download Title");
?>
|
package com.hackatoncivico.rankingpolitico;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.util.LogWriter;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.hackatoncivico.rankingpolitico.models.Candidato;
import com.hackatoncivico.rankingpolitico.models.Criterio;
import com.hackatoncivico.rankingpolitico.models.CriterioCandidato;
import com.hackatoncivico.rankingpolitico.models.RegistroCandidato;
import com.hackatoncivico.rankingpolitico.models.RegistroCandidatos;
import com.hackatoncivico.rankingpolitico.utils.ApiAccess;
import com.hackatoncivico.rankingpolitico.utils.Utils;
import com.squareup.picasso.Picasso;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
public class ProfileActivity extends AppCompatActivity {
private static final String TAG = "ProfileActivity";
public static final String ID_CANDIDATO = "ID_CANDIDATO";
private String idCandidato;
private Candidato candidato;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
// Add Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar);
toolbar.setTitle(getString(R.string.<API key>));
setSupportActionBar(toolbar);
getSupportActionBar().<API key>(true);
getSupportActionBar().<API key>(true);
SharedPreferences sharedPref = PreferenceManager.<API key>(this);
idCandidato = sharedPref.getString(Utils.SELECTED_CANDIDATE, "");
GetCandidato data = new GetCandidato();
data.execute();
}
@Override
public void onResume() {
super.onResume();
if (candidato != null) {
handleCandidato(candidato);
}
}
private void handleCandidato(final Candidato candidato){
this.candidato = candidato;
Button btn_logros = (Button) findViewById(R.id.btn_logros);
btn_logros.setOnClickListener(Utils.<API key>(this, LogrosActivity.class, LogrosActivity.ID_CANDIDATO, String.valueOf(candidato.id)));
Button btn_criterios = (Button) findViewById(R.id.btn_criterios);
btn_criterios.setOnClickListener(Utils.<API key>(this, CriteriosActivity.class, CriteriosActivity.ID_CANDIDATO, String.valueOf(candidato.id)));
runOnUiThread(new Runnable() {
@Override
public void run() {
//progressBar.setVisibility(View.GONE);
ImageView avatar = (ImageView) findViewById(R.id.profile_avatar);
Picasso.with(getBaseContext())
.load(ApiAccess.DOMINIO_URL + candidato.foto)
.placeholder(R.drawable.avatar)
.into(avatar);
TextView full_name = (TextView) findViewById(R.id.profile_full_name);
full_name.setText(candidato.nombres + " " + candidato.apellidos);
TextView logros = (TextView) findViewById(R.id.<API key>);
logros.setText(String.valueOf(candidato.logros.size()));
int criterios_count = 0;
for (int i = 0; i < candidato.criterios.size(); i++) {
CriterioCandidato criterioCandidato = candidato.criterios.get(i);
Criterio criterio = criterioCandidato.criterio;
try{
criterios_count = criterios_count + Integer.parseInt(criterio.puntuacion);
} catch (<API key> nfe){
nfe.printStackTrace();
}
}
TextView criterios = (TextView) findViewById(R.id.<API key>);
criterios.setText(String.valueOf(criterios_count));
}
});
}
private class GetCandidato extends AsyncTask<String, Void, Void> {
@Override
protected Void doInBackground(String... params) {
try {
//Create an HTTP client
HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(ApiAccess.CANDIDATOS_URL + '/' + idCandidato);
//Perform the request and check the status code
HttpResponse response = client.execute(get);
StatusLine statusLine = response.getStatusLine();
if(statusLine.getStatusCode() == 200) {
HttpEntity entity = response.getEntity();
InputStream content = entity.getContent();
try {
//Read the server response and attempt to parse it as JSON
Reader reader = new InputStreamReader(content);
GsonBuilder gsonBuilder = new GsonBuilder();
//gsonBuilder.setDateFormat("M/d/yy hh:mm a");
Gson gson = gsonBuilder.create();
//List<Candidato> posts = new ArrayList<Candidato>();
//posts = Arrays.asList(gson.fromJson(reader, Candidato[].class));
RegistroCandidato registroCandidato = gson.fromJson(reader, RegistroCandidato.class);
content.close();
handleCandidato(registroCandidato.registros);
} catch (Exception ex) {
Log.e(TAG, "Failed to parse JSON due to: " + ex);
//failedLoadingPosts();
}
} else {
Log.e(TAG, "Server responded with status code: " + statusLine.getStatusCode());
//failedLoadingPosts();
}
} catch(Exception ex) {
Log.e(TAG, "Failed to send HTTP POST request due to: " + ex);
//failedLoadingPosts();
}
return null;
}
}
}
|
#ifndef <API key>
#define <API key>
#include <stdint.h>
#include <stdio.h>
#include "iterator.h"
#include "options.h"
namespace leveldb {
// Update Makefile if you change these
static const int kMajorVersion = 1;
static const int kMinorVersion = 19;
struct Options;
struct ReadOptions;
struct WriteOptions;
class WriteBatch;
// Abstract handle to particular state of a DB.
// A Snapshot is an immutable object and can therefore be safely
// accessed from multiple threads without any external synchronization.
class Snapshot {
protected:
virtual ~Snapshot();
};
// A range of keys
struct Range {
Slice start; // Included in the range
Slice limit; // Not included in the range
Range() { }
Range(const Slice& s, const Slice& l) : start(s), limit(l) { }
};
// A DB is a persistent ordered map from keys to values.
// A DB is safe for concurrent access from multiple threads without
// any external synchronization.
class DB {
public:
// Open the database with the specified "name".
// Stores a pointer to a heap-allocated database in *dbptr and returns
// OK on success.
// Stores NULL in *dbptr and returns a non-OK status on error.
// Caller should delete *dbptr when it is no longer needed.
static Status Open(const Options& options,
const std::string& name,
DB** dbptr);
DB() { }
virtual ~DB();
// Set the database entry for "key" to "value". Returns OK on success,
// and a non-OK status on error.
// Note: consider setting options.sync = true.
virtual Status Put(const WriteOptions& options,
const Slice& key,
const Slice& value) = 0;
// Remove the database entry (if any) for "key". Returns OK on
// success, and a non-OK status on error. It is not an error if "key"
// did not exist in the database.
// Note: consider setting options.sync = true.
virtual Status Delete(const WriteOptions& options, const Slice& key) = 0;
// Apply the specified updates to the database.
// Returns OK on success, non-OK on failure.
// Note: consider setting options.sync = true.
virtual Status Write(const WriteOptions& options, WriteBatch* updates) = 0;
// If the database contains an entry for "key" store the
// corresponding value in *value and return OK.
// If there is no entry for "key" leave *value unchanged and return
// a status for which Status::IsNotFound() returns true.
// May return some other Status on an error.
virtual Status Get(const ReadOptions& options,
const Slice& key, std::string* value) = 0;
// Return a heap-allocated iterator over the contents of the database.
// The result of NewIterator() is initially invalid (caller must
// call one of the Seek methods on the iterator before using it).
// Caller should delete the iterator when it is no longer needed.
// The returned iterator should be deleted before this db is deleted.
virtual Iterator* NewIterator(const ReadOptions& options) = 0;
// Return a handle to the current DB state. Iterators created with
// this handle will all observe a stable snapshot of the current DB
// state. The caller must call ReleaseSnapshot(result) when the
// snapshot is no longer needed.
virtual const Snapshot* GetSnapshot() = 0;
// Release a previously acquired snapshot. The caller must not
// use "snapshot" after this call.
virtual void ReleaseSnapshot(const Snapshot* snapshot) = 0;
// DB implementations can export properties about their state
// via this method. If "property" is a valid property understood by this
// DB implementation, fills "*value" with its current value and returns
// true. Otherwise returns false.
// Valid property names include:
// "leveldb.num-files-at-level<N>" - return the number of files at level <N>,
// where <N> is an ASCII representation of a level number (e.g. "0").
// "leveldb.stats" - returns a multi-line string that describes statistics
// about the internal operation of the DB.
// "leveldb.sstables" - returns a multi-line string that describes all
// of the sstables that make up the db contents.
// "leveldb.<API key>" - returns the approximate number of
// bytes of memory in use by the DB.
virtual bool GetProperty(const Slice& property, std::string* value) = 0;
// For each i in [0,n-1], store in "sizes[i]", the approximate
// file system space used by keys in "[range[i].start .. range[i].limit)".
// Note that the returned sizes measure file system space usage, so
// if the user data compresses by a factor of ten, the returned
// sizes will be one-tenth the size of the corresponding user data size.
// The results may not include the sizes of recently written data.
virtual void GetApproximateSizes(const Range* range, int n,
uint64_t* sizes) = 0;
// Compact the underlying storage for the key range [*begin,*end].
// In particular, deleted and overwritten versions are discarded,
// and the data is rearranged to reduce the cost of operations
// needed to access the data. This operation should typically only
// be invoked by users who understand the underlying implementation.
// begin==NULL is treated as a key before all keys in the database.
// end==NULL is treated as a key after all keys in the database.
// Therefore the following call will compact the entire database:
// db->CompactRange(NULL, NULL);
virtual void CompactRange(const Slice* begin, const Slice* end) = 0;
private:
// No copying allowed
DB(const DB&);
void operator=(const DB&);
};
// Destroy the contents of the specified database.
// Be very careful using this method.
Status DestroyDB(const std::string& name, const Options& options);
// If a DB cannot be opened, you may attempt to call this method to
// resurrect as much of the contents of the database as possible.
// Some data may be lost, so be careful when calling this function
// on a database that contains important information.
Status RepairDB(const std::string& dbname, const Options& options);
} // namespace leveldb
#endif // <API key>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.