answer stringlengths 15 1.25M |
|---|
if (typeof AgileTracker == 'undefined') {
AgileTracker = {};
}
AgileTracker.ColumnView = Backbone.View.extend({
template: JST['templates/column'],
tagName: 'td',
events: {
'click a.toggle-column': 'toggle'
},
name: function() {
return this.options.name;
},
render: function() {
this.$el.html(this.template({id: this.id, name: this.name()}));
if (this.options.sortable) {
this.setSortable();
}
return this;
},
toggle: function() {
this.$el.toggle();
this.trigger('visibilityChanged');
},
// Returns the child div containing the story and iteration elements.
storyColumn: function() {
return this.$('.storycolumn');
},
// Append a Backbone.View to this column
appendView: function(view) {
this.storyColumn().append(view.el);
},
// Adds the sortable behaviour to the column.
setSortable: function() {
this.storyColumn().sortable({
handle: '.story-title', opacity: 0.6, items: ".story:not(.accepted)",
update: function(ev, ui) {
ui.item.trigger("sortupdate", ev, ui);
}
});
},
// Returns the current visibility state of the column.
hidden: function() {
return this.$el.is(':hidden');
}
}); |
package com.rapidminer.gui.new_plotter.engine.jfreechart.legend;
import java.awt.Paint;
import java.awt.Shape;
import java.awt.Stroke;
import java.text.AttributedString;
/**
* A LegendItem which has a label left and right of the shape in addition to the default label.
*
* @author Marius Helf
* @deprecated since 9.2.0
*/
@Deprecated
public class <API key> extends CustomLegendItem {
private static final long serialVersionUID = 1L;
private String leftShapeLabel = null;
private String rightShapeLabel = null;
public <API key>(AttributedString label, String description, String toolTipText, String urlText,
boolean shapeVisible, Shape shape, boolean shapeFilled, Paint fillPaint, boolean shapeOutlineVisible,
Paint outlinePaint, Stroke outlineStroke, boolean lineVisible, Shape line, Stroke lineStroke, Paint linePaint) {
super(label, description, toolTipText, urlText, shapeVisible, shape, shapeFilled, fillPaint, shapeOutlineVisible,
outlinePaint, outlineStroke, lineVisible, line, lineStroke, linePaint);
}
public <API key>(AttributedString label, String description, String toolTipText, String urlText,
Shape shape, Paint fillPaint, Stroke outlineStroke, Paint outlinePaint) {
super(label, description, toolTipText, urlText, shape, fillPaint, outlineStroke, outlinePaint);
}
public <API key>(AttributedString label, String description, String toolTipText, String urlText,
Shape shape, Paint fillPaint) {
super(label, description, toolTipText, urlText, shape, fillPaint);
}
public <API key>(AttributedString label, String description, String toolTipText, String urlText,
Shape line, Stroke lineStroke, Paint linePaint) {
super(label, description, toolTipText, urlText, line, lineStroke, linePaint);
}
public <API key>(String label, Paint paint) {
super(label, paint);
}
public <API key>(String label, String description, String toolTipText, String urlText,
boolean shapeVisible, Shape shape, boolean shapeFilled, Paint fillPaint, boolean shapeOutlineVisible,
Paint outlinePaint, Stroke outlineStroke, boolean lineVisible, Shape line, Stroke lineStroke, Paint linePaint) {
super(label, description, toolTipText, urlText, shapeVisible, shape, shapeFilled, fillPaint, shapeOutlineVisible,
outlinePaint, outlineStroke, lineVisible, line, lineStroke, linePaint);
}
public <API key>(String label, String description, String toolTipText, String urlText, Shape shape,
Paint fillPaint, Stroke outlineStroke, Paint outlinePaint) {
super(label, description, toolTipText, urlText, shape, fillPaint, outlineStroke, outlinePaint);
}
public <API key>(String label, String description, String toolTipText, String urlText, Shape shape,
Paint fillPaint) {
super(label, description, toolTipText, urlText, shape, fillPaint);
}
public <API key>(String label, String description, String toolTipText, String urlText, Shape line,
Stroke lineStroke, Paint linePaint) {
super(label, description, toolTipText, urlText, line, lineStroke, linePaint);
}
public <API key>(String label) {
super(label);
}
public <API key>(String leftShapeLabel, String rightShapeLabel, String label) {
super(label);
this.leftShapeLabel = leftShapeLabel;
this.rightShapeLabel = rightShapeLabel;
}
public String getLeftShapeLabel() {
return leftShapeLabel;
}
public void setLeftShapeLabel(String leftShapeLabel) {
this.leftShapeLabel = leftShapeLabel;
}
public String getRightShapeLabel() {
return rightShapeLabel;
}
public void setRightShapeLabel(String rightShapeLabel) {
this.rightShapeLabel = rightShapeLabel;
}
} |
DELETE FROM `weenie` WHERE `class_Id` = 37196;
INSERT INTO `weenie` (`class_Id`, `class_Name`, `type`, `last_Modified`)
VALUES (37196, '<API key>', 2, '2019-02-10 00:00:00') /* Clothing */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (37196, 1, 2) /* ItemType - Armor */
, (37196, 4, 16384) /* ClothingPriority - Head */
, (37196, 5, 322) /* EncumbranceVal */
, (37196, 9, 1) /* ValidLocations - HeadWear */
, (37196, 16, 1) /* ItemUseable - No */
, (37196, 18, 1) /* UiEffects - Magical */
, (37196, 19, 28317) /* Value */
, (37196, 28, 338) /* ArmorLevel */
, (37196, 93, 1044) /* PhysicsState - Ethereal, IgnoreCollisions, Gravity */
, (37196, 105, 9) /* ItemWorkmanship */
, (37196, 106, 362) /* ItemSpellcraft */
, (37196, 107, 1361) /* ItemCurMana */
, (37196, 108, 1361) /* ItemMaxMana */
, (37196, 109, 95) /* ItemDifficulty */
, (37196, 110, 0) /* <API key> */
, (37196, 115, 382) /* ItemSkillLevelLimit */
, (37196, 131, 57) /* MaterialType - Brass */
, (37196, 151, 2) /* HookType - Wall */
, (37196, 158, 7) /* WieldRequirements - Level */
, (37196, 159, 1) /* WieldSkillType - Axe */
, (37196, 160, 180) /* WieldDifficulty */
, (37196, 177, 3) /* GemCount */
, (37196, 178, 21) /* GemType */
, (37196, 8041, 101) /* <API key> - Resting */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (37196, 22, True ) /* Inscribable */
, (37196, 100, True ) /* Dyable */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (37196, 5, -0.067) /* ManaRate */
, (37196, 13, 1.3) /* ArmorModVsSlash */
, (37196, 14, 1) /* ArmorModVsPierce */
, (37196, 15, 1) /* ArmorModVsBludgeon */
, (37196, 16, 0.836) /* ArmorModVsCold */
, (37196, 17, 0.4) /* ArmorModVsFire */
, (37196, 18, 1.229) /* ArmorModVsAcid */
, (37196, 19, 0.4) /* ArmorModVsElectric */
, (37196, 165, 1) /* ArmorModVsNether */
, (37196, 8004, 7) /* <API key> */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (37196, 1, 'Olthoi Amuli Helm') /* Name */
, (37196, 16, 'Olthoi Amuli Helm') /* LongDesc */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (37196, 1, 33558419) /* Setup */
, (37196, 3, 536870932) /* SoundTable */
, (37196, 6, 67108990) /* PaletteBase */
, (37196, 8, 100690070) /* Icon */
, (37196, 22, 872415275) /* PhysicsEffectTable */
, (37196, 37, 6) /* ItemSkillLimit - MeleeDefense */
, (37196, 8001, 2435137688) /* <API key> - Value, Usable, UiEffects, Container, ValidLocations, Priority, Burden, Workmanship, HookType, MaterialType */
, (37196, 8003, 18) /* <API key> - Inscribable, Attackable */
, (37196, 8005, 137217) /* <API key> - CSetup, STable, PeTable, AnimationFrame */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (37196, 8000, 2174502533) /* <API key> */;
INSERT INTO `<API key>` (`object_Id`, `spell`, `probability`)
VALUES (37196, 2108, 2) /* Impenetrability7 */
, (37196, 2110, 2) /* LightningBane7 */
, (37196, 2612, 2) /* CANTRIPFROSTWARD2 */
, (37196, 4391, 2) /* AcidBane8 */
, (37196, 4393, 2) /* BladeBane8 */;
INSERT INTO `<API key>` (`object_Id`, `sub_Palette_Id`, `offset`, `length`)
VALUES (37196, 67116548, 250, 6)
, (37196, 67116571, 240, 10);
INSERT INTO `<API key>` (`object_Id`, `index`, `animation_Id`)
VALUES (37196, 0, 16794117); |
const verbose = require('debug')('ha:initializations:express:verbose')
const info = require('debug')('ha:initializations:express:info')
const warn = require('debug')('ha:initializations:express:warn')
const error = require('debug')('ha:initializations:express:error')
const {authenticated, unauthenticated} = require('./../routes/login')
const authToken = require('./../middleware/auth_token')
const bodyParser = require('body-parser')
const config = require('./../config')
const cookieParser = require('cookie-parser')
const cookieSession = require('cookie-session')
const cors = require('cors')
const diehard = require('diehard')
const express = require('express')
const favicon = require('serve-favicon')
const groups = require('./../routes/groups')
const machines = require('./../middleware/machines')
const path = require('path')
const ping = require('./../middleware/ping')
const Promise = require('bluebird')
const redirectToHttps = require('./../middleware/redirect_to_https')
const stylus = require('stylus')
const tokens = require('./../routes/tokens')
const users = require('./../routes/users')
const xHeaders = require('./../middleware/x_headers')
const app = express()
module.exports = {
initialize () {
return new Promise(resolve => {
app.set('views', path.join(__dirname, '../../views'))
app.set('view engine', 'pug')
app.use(redirectToHttps)
app.use(xHeaders)
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended: true}))
app.use(favicon(path.join(__dirname, '../../public/favicon.ico')))
app.use(stylus.middleware(path.join(__dirname, '../../public')))
app.use(express.static(path.join(__dirname, '../../public')))
app.use('/ping', ping)
app.use(cookieSession({
secret: config.sessionSecret,
secureProxy: config.production,
maxage: 1000 * 60 * 60
}))
app.use(unauthenticated)
app.use('/groups', groups)
app.use(machines)
app.use('/tokens', tokens)
app.use(cookieParser())
app.use(cors({
origin: config.uiUrl,
credentials: true,
maxAge: 10 * 60
}))
app.use(authToken)
app.use(authenticated)
app.use('/users', users)
app.use((err, req, res) => {
if (!(err instanceof Error)) {
// req is actually res.
warn('unknown request. See logs for more details.')
return req.sendStatus(404)
}
error('sending Error. Err: ', err)
return res.sendStatus(err.status || 500)
})
const server = app.listen(config.port, () => {
info(`Express server listening on port ${server.address().port}`)
diehard.register(done => {
verbose('Shutting down http server')
server.close(() => {
verbose('Http server was shutdown successfully.')
done()
})
})
resolve({server: server, express: app})
})
})
}
} |
module OSRIC.DM where
import EasyIRCBot
import OSRIC.State
setDM :: String -> IRC OSRICState Message
setDM n = do
s <- get
let cs = concrete $ customState s
put $ s { customState = cs { dm = n } }
return $ privmsg $ "Set DM to " ++ n ++"."
tellDM :: IRC OSRICState Message
tellDM = gets (dm.customState) >>= \d -> return $ privmsg $ "The DM is: "++d++"." |
package placebooks.client.ui.dialogs;
import java.util.ArrayList;
import java.util.List;
import placebooks.client.controllers.<API key>;
import placebooks.client.logger.Log;
import placebooks.client.ui.UIMessages;
import placebooks.client.ui.images.markers.Markers;
import placebooks.client.ui.items.MapItem;
import placebooks.client.ui.items.frames.PlaceBookItemFrame;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ResourcePrototype;
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.cellview.client.CellList;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.<API key>;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.view.client.<API key>;
import com.google.gwt.view.client.<API key>;
public class PlaceBookMapsDialog extends PlaceBookDialog
{
public interface MarkerTemplates extends SafeHtmlTemplates
{
@Template("<div style=\"text-align: center; padding-top: 2px;\">{0}</div>")
SafeHtml centeredDiv(SafeHtml image);
}
interface <API key> extends UiBinder<Widget, PlaceBookMapsDialog>
{
}
private static class MarkerCell extends AbstractCell<ImageResource>
{
private static <API key> renderer = new <API key>();
@Override
public void render(final com.google.gwt.cell.client.Cell.Context context, final ImageResource value,
final SafeHtmlBuilder sb)
{
sb.append(MARKER_TEMPLATES.centeredDiv(renderer.render(value)));
}
}
private static final UIMessages uiMessages = GWT.create(UIMessages.class);
private static final MarkerTemplates MARKER_TEMPLATES = GWT.create(MarkerTemplates.class);
private static <API key> uiBinder = GWT.create(<API key>.class);
@UiField
Panel mapPanel;
@UiField
ListBox mapSelect;
@UiField
Label mapLabel;
@UiField
CheckBox markerShow;
@UiField
Panel mapRootPanel;
@UiField
Panel markerListPanel;
private MapItem map;
private final <API key> item;
private final List<PlaceBookItemFrame> mapItems;
private final CellList<ImageResource> markers;
public PlaceBookMapsDialog(final <API key> item, final List<PlaceBookItemFrame> mapItems)
{
setWidget(uiBinder.createAndBindUi(this));
this.item = item;
this.mapItems = mapItems;
setTitle(uiMessages.locateOnMap(item.getItem().getMetadata("title", "Item")));
onInitialize();
final int mapPage = item.getItem().getParameter("mapPage", -1);
if (mapPage != -1)
{
final String mapPageString = Integer.toString(mapPage);
for (int index = 0; index < mapSelect.getItemCount(); index++)
{
if (mapPageString.equals(mapSelect.getValue(index)))
{
mapSelect.setSelectedIndex(index);
}
}
}
markers = new CellList<ImageResource>(new MarkerCell());
final List<ImageResource> markerList = new ArrayList<ImageResource>();
for (final ResourcePrototype resource : Markers.IMAGES.getResources())
{
if (resource instanceof ImageResource)
{
markerList.add((ImageResource) resource);
}
}
markers.setRowData(markerList);
final <API key><ImageResource> selectionModel = new <API key><ImageResource>();
selectionModel.setSelected(item.getItem().getMarkerImage(), true);
selectionModel.<API key>(new <API key>.Handler()
{
@Override
public void onSelectionChange(final <API key> event)
{
final ImageResource marker = selectionModel.getSelectedObject();
try
{
if (marker.getName().equals("marker"))
{
item.removeParameter("marker");
}
else
{
final int markerIndex = marker.getName().charAt(6);
item.setParameter("marker", markerIndex);
}
}
catch (final Exception e)
{
item.removeParameter("marker");
}
markerShow(null);
if (map != null)
{
map.refreshMarkers();
}
}
});
markers.setSelectionModel(selectionModel);
markerListPanel.add(markers);
// markerSelect.setSelectedIndex(item.getItem().getParameter("marker", 0));
markerShow.setValue(item.getItem().getParameter("markerShow", 0) == 1);
selectMap(mapPage);
}
@UiHandler("mapSelect")
void mapSelected(final ChangeEvent event)
{
final int index = mapSelect.getSelectedIndex();
final String value = mapSelect.getValue(index);
if ("".equals(value))
{
selectMap(-1);
}
else
{
selectMap(Integer.parseInt(value));
}
Log.info("Map Select");
item.markChanged();
// item.getItem().setMetadata("mapItemID", mapItems.iterator().next().getKey());
// item.getItemWidget().refresh();
// controller.getContext().markChanged();
}
@UiHandler("markerShow")
void markerShow(final ValueChangeEvent<Boolean> event)
{
if (markerShow.getValue())
{
item.setParameter("markerShow", 1);
}
else
{
item.removeParameter("markerShow");
}
}
private void onInitialize()
{
mapSelect.clear();
mapSelect.addItem(uiMessages.itemNotOnMap(), "");
mapPanel.clear();
for (final PlaceBookItemFrame item : mapItems)
{
final String title = item.getItem().getMetadata("title");
if (title == null || title.equals("Map"))
{
mapSelect.addItem( uiMessages.onMap(item.getColumn().getPage().getIndex() + 1),
Integer.toString(item.getColumn().getPage().getIndex()));
}
else
{
mapSelect.addItem( uiMessages.onMap(title, item.getColumn().getPage().getIndex() + 1),
Integer.toString(item.getColumn().getPage().getIndex()));
}
}
}
private void selectMap(final int page)
{
if (page == -1)
{
item.removeParameter("mapPage");
}
else
{
item.setParameter("mapPage", page);
}
mapPanel.clear();
mapRootPanel.setVisible(page != -1);
markerShow.setVisible(page != -1);
if (item.getItem().getGeometry() == null)
{
mapLabel.setText(uiMessages.clickMapPlace(item.getItem().getMetadata("title", "Untitled")));
}
else
{
mapLabel.setText(uiMessages.clickMapMove(item.getItem().getMetadata("title", "Untitled")));
}
if (page != -1)
{
for (final PlaceBookItemFrame mapItem : mapItems)
{
if (page == mapItem.getColumn().getPage().getIndex())
{
map = new MapItem(mapItem.getItemWidget().getController());
map.refreshMarkers();
mapPanel.add(map);
map.moveMarker(item, new ChangeHandler()
{
@Override
public void onChange(final ChangeEvent event)
{
mapItem.getItemWidget().refresh();
}
});
break;
}
}
}
center();
}
} |
local ObjectManager = require("managers.object.object_manager")
includeFile("dungeon/geonosian_lab/conversations/<API key>.lua")
<API key> = ScreenPlay:new {
numberOfActs = 1,
keypadCodes = { 32281, 12872, 51892, 12753, 86332, 11380, 52577, 78660 },
lockedCells = { 1627785, 1627786, 1627790, 1627805, 1627812, 1627815, 1627822, 1627823 },
--debris fields, all respawns are set to 4 minutes
debris = {
{ template = "object/static/destructible/<API key>.iff", x = -105.8, z = -29.6, y = -368.3, cell = 1627818 },
{ template = "object/static/destructible/<API key>.iff", x = 37.5, z = -34.0, y = -333.5, cell = 1627822 },
{ template = "object/static/destructible/<API key>.iff", x = 37.6, z = -34.0, y = -334.4, cell = 1627822 },
{ template = "object/static/destructible/<API key>.iff", x = 37.2, z = -34.0, y = -335.2, cell = 1627822 },
{ template = "object/static/destructible/<API key>.iff", x = 36.4, z = -34.0, y = -335.7, cell = 1627822 },
{ template = "object/static/destructible/<API key>.iff", x = -121.3, z = -33.5, y = -226.5, cell = 1627809 },
{ template = "object/static/destructible/<API key>.iff", x = -121.8, z = -33.6, y = -227.7, cell = 1627809 },
{ template = "object/static/destructible/<API key>.iff", x = -121.5, z = -33.6, y = -228.4, cell = 1627809 },
{ template = "object/static/destructible/<API key>.iff", x = -122.0, z = -33.6, y = -229.1, cell = 1627809 },
{ template = "object/static/destructible/<API key>.iff", x = -122.3, z = -33.6, y = -228.4, cell = 1627809 },
{ template = "object/static/destructible/<API key>.iff", x = -74.5, z = -21.9, y = -109.7, cell = 1627792 },
{ template = "object/static/destructible/<API key>.iff", x = -75.0, z = -21.9, y = -110.3, cell = 1627792 },
{ template = "object/static/destructible/<API key>.iff", x = -75.2, z = -22.0, y = -111.0, cell = 1627792 },
{ template = "object/static/destructible/<API key>.iff", x = -75.3, z = -22.0, y = -111.6, cell = 1627792 },
{ template = "object/static/destructible/<API key>.iff", x = -74.1, z = -22.5, y = -110.7, cell = 1627792 }
},
keypads = {
{ x = -34, z = -18, y = -31, cell = 1627784, dw = 0.707107, dx = 0, dy = 0.707107, dz = 0 },
{ x = -47, z = -18, y = -56, cell = 1627785, dw = 1, dx = 0, dy = 0, dz = 0 },
{ x = -105, z = -18, y = -64, cell = 1627789, dw = 0, dx = 0, dy = -1, dz = 0 },
{ x = -79, z = -22, y = -146, cell = 1627804, dw = 1, dx = 0, dy = 0, dz = 0 },
{ x = -67, z = -34, y = -260, cell = 1627811, dw = 1, dx = 0, dy = 0, dz = 0 },
{ x = -133, z = -34, y = -204, cell = 1627814, dw = 0, dx = 0, dy = -1, dz = 0 },
{ x = -4, z = -34, y = -417, cell = 1627821, dw = 0.707107, dx = 0, dy = -0.707107, dz = 0 },
{ x = 38, z = -34, y = -333, cell = 1627822, dw = 0.707107, dx = 0, dy = -0.707107, dz = 0 }
},
doorActiveAreas = {
{ worldX = -6404.5, worldZ = 64.3, worldY = -412.4, cell = 1627784 },
{ worldX = -6376.5, worldZ = 64.3, worldY = -413.6, cell = 1627785 },
{ worldX = -6338.8, worldZ = 64.3, worldY = -457.9, cell = 1627789 },
{ worldX = -6284.8, worldZ = 60.3, worldY = -392.6, cell = 1627804 },
{ worldX = -6193.3, worldZ = 48.3, worldY = -324.1, cell = 1627811 },
{ worldX = -6204.7, worldZ = 48.3, worldY = -410.2, cell = 1627814 },
{ worldX = -6089.5, worldZ = 48.3, worldY = -191.4, cell = 1627821 },
{ worldX = -6181.5, worldZ = 48.3, worldY = -196.5, cell = 1627822 },
},
<API key> = 30000, --30 seconds
geoDatapad = "object/tangible/loot/dungeon/<API key>/engineering_datapad.iff",
geoTenloss = "object/tangible/loot/loot_schematic/<API key>.iff"
}
registerScreenPlay("<API key>", true)
function <API key>:start()
if (isZoneEnabled("yavin4")) then
self:spawnActiveAreas()
self:spawnSceneObjects()
self:spawnMobiles()
self:<API key>()
end
end
function <API key>:spawnActiveAreas()
local pActiveArea = spawnActiveArea("yavin4", "object/active_area.iff", -6435.5, 85.6, -367, 10, 1627783)
if pActiveArea ~= nil then
createObserver(ENTEREDAREA, "<API key>", "<API key>", pActiveArea)
end
local pGasArea = spawnActiveArea("yavin4", "object/active_area.iff", -6181.9, 48.3, -197.2, 4, 1627822)
if pGasArea ~= nil then
createObserver(ENTEREDAREA, "<API key>", "<API key>", pGasArea)
end
local pShockArea = spawnActiveArea("yavin4", "object/active_area.iff", -6169.0, 48.3, -382.3, 4, 1627813)
if pShockArea ~= nil then
createObserver(ENTEREDAREA, "<API key>", "notifyElectroShock", pShockArea)
end
end
function <API key>:spawnSceneObjects()
local pGasLeak = spawnSceneObject("yavin4", "object/tangible/dungeon/poison_gas_cloud.iff", 21.7, 3.3, -29.1, 1627783, 0, 0, 0, 0)
if (pGasLeak ~= nil) then
writeData("geonosian_lab:gasLeakID", SceneObject(pGasLeak):getObjectID()) --set the gas leak as started
end
spawnSceneObject("yavin4", "object/tangible/dungeon/poison_gas_cloud.iff", 37.6, -34.0, -334.7, 1627822, 0, 0, 0, 0)
--Building observer to lock all security doors.
local pBuilding = getSceneObject(1627780) -- Geo lab building
if (pBuilding ~= nil) then
createObserver(ENTEREDBUILDING, "<API key>", "notifyEnteredLab", pBuilding)
end
--Gas Valve
local pSceneObject = spawnSceneObject("yavin4", "object/tangible/dungeon/wall_terminal_s1.iff", 2.27, -1.9, -15.73, 1627824, 0.701707, 0, -0.701707, 0)
if (pSceneObject ~= nil) then
createObserver(OBJECTRADIALUSED, "<API key>", "notifyGasValveUsed", pSceneObject);
end
writeData("geonosian_lab:gasleak", 1) --set the gas leak as started
--Keypads
for i = 1, 8, 1 do
local kp = self.keypads[i]
pSceneObject = spawnSceneObject("yavin4", "object/tangible/dungeon/wall_terminal_s3.iff", kp.x, kp.z, kp.y, kp.cell, kp.dw, kp.dx, kp.dy, kp.dz)
if (pSceneObject ~= nil) then
writeData(SceneObject(pSceneObject):getObjectID() .. ":geonosian_lab:keypad_index", i)
createObserver(OBJECTRADIALUSED, "<API key>", "notifyKeypadUsed", pSceneObject)
end
local aa = self.doorActiveAreas[i]
local pActiveArea = spawnActiveArea("yavin4", "object/active_area.iff", aa.worldX, aa.worldZ, aa.worldY, 4, aa.cell)
if pActiveArea ~= nil then
writeData(SceneObject(pActiveArea):getObjectID() .. ":GeoLabKeypad", i)
createObserver(ENTEREDAREA, "<API key>", "<API key>", pActiveArea)
end
end
for i = 1, 15, 1 do
local debrisData = self.debris[i]
local pDebris = spawnSceneObject("yavin4", debrisData.template, debrisData.x, debrisData.z, debrisData.y, debrisData.cell, 1, 0, 0, 0)
if (pDebris ~= nil) then
writeData(SceneObject(pDebris):getObjectID() .. ":geonosian_lab:debris_index", i)
createObserver(OBJECTDESTRUCTION, "<API key>", "<API key>", pDebris)
end
end
end
function <API key>:spawnMobiles()
spawnMobile("yavin4", "biogenic_crazyguy", 1, -2.8, 10.8, 10.2, 69, 1627781)--biogen_crazy
spawnMobile("yavin4", "<API key>", 1, -48, -18, -31, -180, 1627785)--biogen_security
spawnMobile("yavin4", "<API key>", 1, 23.8, -32, -83.2, 130, 1627798)--biogen_human
spawnMobile("yavin4", "<API key>", 1, -134.5, -21.7, -74.8, 90, 1627794)--biogen_constuc
spawnMobile("yavin4", "<API key>", 1,-107.7,-18,-33.8,176,1627790)--biogen_engineer
spawnMobile("yavin4", "biogenic_assistant", 1, -36, -21.9, -162.8, 0, 1627803)--biogen_assistant
spawnMobile("yavin4", "<API key>", 1, -72.0, -34, -272.9, 0, 1627812)--biogen_gen01
spawnMobile("yavin4", "<API key>", 1, -127.2, -34, -189.0, -93, 1627815)--biogen_gen02
spawnMobile("yavin4", "<API key>", 1, 7.4, -22, -333, 180, 1627822) -- biogen_geo
spawnMobile("yavin4", "acklay",7200,101.1,-34.3,-321.6,-136,1627823, true) --Randomized respawn
spawnMobile("yavin4", "<API key>",3600,-130,-22.1,-85,-180,1627794, true) -- Randomized respawn
spawnMobile("yavin4", "imperial_observer",300,-23,-22,-116,-90,1627802)
spawnMobile("yavin4", "imperial_observer",300,-16.4,-22,-114.5,-150,1627802)
spawnMobile("yavin4", "<API key>",300,1.2,9.1,-8.1,63,1627781)
spawnMobile("yavin4", "<API key>",300,0.6,9.5,-3.5,99,1627781)
spawnMobile("yavin4", "<API key>",300,26.6,10.3,-13.3,-8,1627782)
spawnMobile("yavin4", "<API key>",300,32.3,9.5,-8.1,-105,1627782)
spawnMobile("yavin4", "<API key>",300,34.7,10.3,-14.4,-70,1627782)
spawnMobile("yavin4", "<API key>",300,37.4,9.8,-8.2,-109,1627782)
spawnMobile("yavin4", "<API key>",300,-55.9,-18,-33.9,95,1627785)
spawnMobile("yavin4", "<API key>",300,-55.6,-18,-43.2,72,1627785)
spawnMobile("yavin4", "<API key>",300,-38.7,-18,-47.5,-75,1627785)
spawnMobile("yavin4", "<API key>",300,-66.7,-19,-41.2,-77,1627788)
spawnMobile("yavin4", "<API key>",300,-70.5,-18.9,-34.5,-161,1627788)
spawnMobile("yavin4", "<API key>",300,-83.9,-18.5,-42.3,85,1627788)
spawnMobile("yavin4", "<API key>",300,-36,-22,-151.4,180,1627803)
spawnMobile("yavin4", "<API key>",300,-26.8,-22.9,-158,-90,1627803)
spawnMobile("yavin4", "<API key>",300,-19.4,-22.6,-151.7,-135,1627803)
spawnMobile("yavin4", "cavern_spider",300,-62,-21.8,-109.6,0,1627792)
spawnMobile("yavin4", "cavern_spider",300,-48,-21.8,-158,0,1627800)
spawnMobile("yavin4", "cavern_spider",300,-48,-21.8,-143,0,1627800)
spawnMobile("yavin4", "cavern_spider",300,-41,-21.8,-136,-90,1627801)
spawnMobile("yavin4", "cavern_spider",300,-88.3,-21.8,-110.3,210,1627793)
spawnMobile("yavin4", "cavern_spider",300,-98,-21.9,-114.7,50,1627793)
spawnMobile("yavin4", "cavern_spider",300,-107.3,-22.2,-96.6,180,1627793)
spawnMobile("yavin4", "cavern_spider",300,-108,-21.8,-126,0,1627793)
spawnMobile("yavin4", "cavern_spider",300,-123,-22,-109.5,80,1627793)
spawnMobile("yavin4", "cavern_spider",300,-134.7,-20.9,-112.2,77,1627793)
spawnMobile("yavin4", "alert_droideka",300,-34.2,-22,-128,-180,1627801)
spawnMobile("yavin4", "alert_droideka",300,-3.8,-30.2,-92,-180,1627796)
spawnMobile("yavin4", "cavern_spider",300,-16.8,-30.2,-115.1,22,1627796)
spawnMobile("yavin4", "alert_droideka",300,-18,-18,-36,0,1627784)
spawnMobile("yavin4", "alert_droideka",300,-62,-18,-59.5,-180,1627786)
spawnMobile("yavin4", "alert_droideka",300,-90.5,-18,-76,0,1627789)
spawnMobile("yavin4", "alert_droideka",300,-53.5,-18.2,-81.7,-90,1627791)
spawnMobile("yavin4", "alert_droideka",300,-108,-34,-214,89,1627808)
spawnMobile("yavin4", "alert_droideka",300,-61.5,-34,-252,-90,1627811)
spawnMobile("yavin4", "geonosian_scientist",300,-116.5,-20,-38.4,88,1627790)
spawnMobile("yavin4", "enhanced_kwi",300,9.5,-16.0,-27.9,89,1627824)
spawnMobile("yavin4", "enhanced_kwi",300,10.8,-6.3,-7.8,-93,1627824)
spawnMobile("yavin4", "enhanced_kwi",300,-104.2,-28.7,-193.4,0,1627807)
spawnMobile("yavin4", "enhanced_kwi",300,-143.2,-34,-180.8,-139,1627815)
spawnMobile("yavin4", "enhanced_kliknik",300,-129.0,-34,-192.6,-32,1627815)
spawnMobile("yavin4", "geonosian_scientist",300,-124.3,-34.0,-199.5,-60,1627815)
spawnMobile("yavin4", "geonosian_scientist",300,-60.0,-34.0,-273.7,0,1627812)
spawnMobile("yavin4", "alert_droideka",300,-63.9,-22.0,-143.0,-3,1627804)
spawnMobile("yavin4", "alert_droideka",300,-129.8,-34.0,-267.9,87,1627816)
spawnMobile("yavin4", "enhanced_kliknik",300,26,-31.5,-78,170,1627798)
spawnMobile("yavin4", "enhanced_kliknik",300,36.5,-29.9,-82.7,-120,1627798)
spawnMobile("yavin4", "enhanced_kliknik",300,29.5,-30.1,-88,-45,1627798)
spawnMobile("yavin4", "enhanced_kliknik",300,-139.8,-34,-194.3,57,1627815)
spawnMobile("yavin4", "enhanced_kliknik",300,-64.9,-34,-266.5,-143,1627812)
spawnMobile("yavin4", "enhanced_kwi",300,-66.5,-34,-283.1,35,1627812)
spawnMobile("yavin4", "enhanced_kliknik",300,-87,-34.1,-386.5,210,1627819)
spawnMobile("yavin4", "cavern_spider",300,-128.2,-34.4,-322.4,-30,1627817)
spawnMobile("yavin4", "cavern_spider",300,-143.5,-33.5,-321.7,134,1627817)
spawnMobile("yavin4", "cavern_spider",300,-131.1,-33.9,-339.0,145,1627817)
spawnMobile("yavin4", "cavern_spider",300,-135.5,-33.8,-342.8,-1,1627817)
spawnMobile("yavin4", "cavern_spider",300,-118.9,-34.0,-349.2,-98,1627818)
spawnMobile("yavin4", "cavern_spider",300,-134.5,-34.0,-373.2,-2,1627818)
spawnMobile("yavin4", "enhanced_kliknik",300,-129.4,-33.6,-384.1,-2,1627818)
spawnMobile("yavin4", "<API key>",300,-86.5,-33.9,-372.8,-91,1627819)
spawnMobile("yavin4", "<API key>",300,-88.0,-34.6,-365.9,-102,1627819)
spawnMobile("yavin4", "<API key>",300,-71.5,-34,-348.1,-95,1627819)
spawnMobile("yavin4", "<API key>",300,-72.6,-33.8,-376.0,-168,1627819)
spawnMobile("yavin4", "<API key>",300,-72.7,-34.2,-382.5,-179,1627819)
spawnMobile("yavin4", "<API key>",300,-69.0,-34.0,-407.2,-7,1627820)
spawnMobile("yavin4", "<API key>",300,-46.8,-34.0,-407.5,92,1627820)
spawnMobile("yavin4", "<API key>",300,-28.5,-34.2,-408.4,-27,1627820)
spawnMobile("yavin4", "alert_droideka",300,-11.9,-34.0,-412.5,179,1627821)
spawnMobile("yavin4", "cavern_spider",300,4.1,-34.0,-402.4,171,1627822)
spawnMobile("yavin4", "<API key>",300,16.5,-34.0,-368.3,161,1627822)
spawnMobile("yavin4", "enhanced_kliknik",300,24.0,-34.0,-397.1,117,1627822)
spawnMobile("yavin4", "<API key>",300,22.9,-34.0,-370.1,11,1627822)
spawnMobile("yavin4", "cavern_spider",300,24.8,-24.0,-333.8,87,1627822)
spawnMobile("yavin4", "cavern_spider",300,13.3,-24.0,-341.6,89,1627822)
spawnMobile("yavin4", "cavern_spider",300,13.4,-22.0,-337.3,-179,1627822)
spawnMobile("yavin4", "enhanced_kwi",300,48.0,-34.0,-334.4,0,1627823)
spawnMobile("yavin4", "cavern_spider",300,91.2,-33.9,-347.9,5,1627823)
spawnMobile("yavin4", "enhanced_kliknik",300,98.0,-34.1,-334.4,-53,1627823)
spawnMobile("yavin4", "enhanced_kliknik",300,120.2,-33.9,-330.6,-33,1627823)
spawnMobile("yavin4", "cavern_spider",300,85.0,-33.8,-309.1,143,1627823)
spawnMobile("yavin4", "cavern_spider",300,74.7,-34.1,-329.0,-90,1627823)
spawnMobile("yavin4", "mercenary_sentry",300,-74.9,-22,-153.7,-119,1627805)
spawnMobile("yavin4", "mercenary_sentry",300,-74.3,-22,-162.3,-40,1627805)
spawnMobile("yavin4", "mercenary_sentry",300,-82.3,-22,-161.7,74,1627805)
spawnMobile("yavin4", "mercenary_sentry",300,-82.2,-22,-155.1,106,1627805)
end
function <API key>:notifyGasValveUsed(pGasValve, pPlayer, radialSelected)
if (pPlayer == nil) then
return 0
end
if (radialSelected == 20) then
local isGasLeaking = readData("geonosian_lab:gasleak")
if (isGasLeaking == 1) then
CreatureObject(pPlayer):sendSystemMessage("@dungeon/geonosian_madbio:gas_off") --You have shut off the gas leak.
local gasLeakID = readData("geonosian_lab:gasLeakID")
local pGasLeak = getSceneObject(gasLeakID)
if (pGasLeak ~= nil) then
SceneObject(pGasLeak):<API key>()
end
deleteData("geonosian_lab:gasLeakID")
writeData("geonosian_lab:gasleak", 0)
createServerEvent(self.<API key>, "<API key>", "restartGasLeak", "GasLeakRestart")
else
CreatureObject(pPlayer):sendSystemMessage("@dungeon/geonosian_madbio:gas_already_off") --The gas leak has already been repaired...
end
end
return 0
end
function <API key>:notifyKeypadUsed(pKeypad, pPlayer, radialSelected)
if (pKeypad == nil or pPlayer == nil) then
return 0
end
if (radialSelected == 20) then
local suiManager = LuaSuiManager()
suiManager:sendKeypadSui(pKeypad, pPlayer, "<API key>", "keypadSuiCallback")
end
return 0
end
function <API key>:restartGasLeak()
local pGasLeak = spawnSceneObject("yavin4", "object/tangible/dungeon/poison_gas_cloud.iff", 21.7, 3.3, -29.1, 1627783, 0, 0, 0, 0)
if (pGasLeak ~= nil) then
writeData("geonosian_lab:gasLeakID", SceneObject(pGasLeak):getObjectID())
writeData("geonosian_lab:gasleak", 1)
end
end
function <API key>:keypadSuiCallback(pCreature, pSui, cancelPressed, enteredCode, pressedButton)
if (pCreature == nil or pSui == nil) then
return
end
local suiBox = LuaSuiBox(pSui)
local pUsingObject = suiBox:getUsingObject()
if (pUsingObject == nil) then
return
end
local keypadIndex = readData(SceneObject(pUsingObject):getObjectID() .. ":geonosian_lab:keypad_index")
local keypadCode = self.keypadCodes[keypadIndex]
if (pressedButton == "enter") then
if (tonumber(enteredCode) == keypadCode) then
CreatureObject(pCreature):sendSystemMessage("@dungeon/geonosian_madbio:right_code") --You have successfully entered the code for this door.
self:givePermission(pCreature, "GeoLabKeypad" .. keypadIndex)
else
CreatureObject(pCreature):sendSystemMessage("@dungeon/geonosian_madbio:bad_code") --The number that you entered is not a valid code for this door.
end
elseif (pressedButton == "slice") then
if (CreatureObject(pCreature):hasSkill("<API key>")) then
CreatureObject(pCreature):sendSystemMessage("@dungeon/geonosian_madbio:hack_success") --You have successfully hacked this terminal.
self:givePermission(pCreature, "GeoLabKeypad" .. keypadIndex)
else
CreatureObject(pCreature):sendSystemMessage("@dungeon/geonosian_madbio:hack_fail") --Unable to successfully slice the keypad, you realize that the only way to reset it is to carefully repair what damage you have done.
end
elseif (pressedButton == "keycard") then
if (keypadIndex ~= 4 and self:hasGeoItem(pCreature, "object/tangible/loot/dungeon/<API key>/passkey.iff")) then
self:removeGeoItem(pCreature, "object/tangible/loot/dungeon/<API key>/passkey.iff")
CreatureObject(pCreature):sendSystemMessage("@dungeon/geonosian_madbio:keycard_success") --You have successfully used a keycard on this door.
self:givePermission(pCreature, "GeoLabKeypad" .. keypadIndex)
elseif (keypadIndex == 4 and self:hasGeoItem(pCreature, "object/tangible/loot/dungeon/<API key>/engineering_key.iff")) then
self:removeGeoItem(pCreature, "object/tangible/loot/dungeon/<API key>/engineering_key.iff")
CreatureObject(pCreature):sendSystemMessage("@dungeon/geonosian_madbio:keycard_success") --You have successfully used a keycard on this door.
self:givePermission(pCreature, "GeoLabKeypad" .. keypadIndex)
end
end
end
function <API key>:notifyEnteredLab(pBuilding, pPlayer)
if pPlayer == nil or not SceneObject(pPlayer):isCreatureObject() then
return 0
end
if (CreatureObject(pPlayer):isAiAgent()) then
return 0
end
for i = 1, #self.lockedCells, 1 do
self:removePermission(pPlayer, "GeoLabKeypad" .. i)
end
local playerID = SceneObject(pPlayer):getObjectID()
deleteData(playerID .. ":<API key>")
deleteData(playerID .. ":<API key>")
deleteData(playerID .. ":<API key>")
CreatureObject(pPlayer):<API key>(1, "<API key>")
CreatureObject(pPlayer):<API key>(1, "<API key>")
CreatureObject(pPlayer):sendSystemMessage("@dungeon/geonosian_madbio:relock") --Security systems at this facility have been cycled and reset.
return 0
end
function <API key>:<API key>(pArea, pPlayer)
if (pPlayer == nil or not SceneObject(pPlayer):isCreatureObject()) then
return 0
end
if (CreatureObject(pPlayer):isAiAgent()) then
return 0
end
local areaDoor = readData(SceneObject(pArea):getObjectID() .. ":GeoLabKeypad")
if not self:hasPermission(pPlayer, "GeoLabKeypad" .. areaDoor) then
CreatureObject(pPlayer):sendSystemMessage("@dungeon/geonosian_madbio:door_locked") -- This door is locked.
end
return 0
end
function <API key>:<API key>()
for i = 1, #self.lockedCells, 1 do
local pCell = getSceneObject(self.lockedCells[i])
if pCell ~= nil then
ObjectManager.withSceneObject(pCell, function(cell)
cell:<API key>(false)
cell:<API key>(WALKIN)
cell:<API key>(WALKIN)
cell:<API key>("GeoLabKeypad" .. i, WALKIN)
cell:<API key>("GeoLabKeypad" .. i, MOVEIN)
end)
end
end
end
function <API key>:givePermission(pPlayer, permissionGroup)
ObjectManager.<API key>(pPlayer, function(ghost)
ghost:addPermissionGroup(permissionGroup, true)
end)
end
function <API key>:removePermission(pPlayer, permissionGroup)
ObjectManager.<API key>(pPlayer, function(ghost)
if (ghost:hasPermissionGroup(permissionGroup)) then
ghost:<API key>(permissionGroup, true)
end
end)
end
function <API key>:hasPermission(pPlayer, permissionGroup)
return ObjectManager.<API key>(pPlayer, function(ghost)
return ghost:hasPermissionGroup(permissionGroup)
end)
end
function <API key>:<API key>(pActiveArea, pMovingObject)
if (pMovingObject == nil or pActiveArea == nil or not SceneObject(pMovingObject):isCreatureObject()) then
return 0
end
if (CreatureObject(pMovingObject):isAiAgent() and not AiAgent(pMovingObject):isPet()) then
return 0
end
local objectID = CreatureObject(pMovingObject):getObjectID()
local isGasLeaking = readData("geonosian_lab:gasleak")
if (isGasLeaking == 0) then
return 0
end
if (self:hasRebreather(pMovingObject)) then
CreatureObject(pMovingObject):sendSystemMessage("@dungeon/geonosian_madbio:gasmask") --Your gasmask diffuses the poison gas and you are able to breathe with no difficulty.
else
local areaID = SceneObject(pActiveArea):getObjectID()
if (ActiveArea(pActiveArea):getCellObjectID() == 1627783) then
CreatureObject(pMovingObject):addDotState(pMovingObject, POISONED, getRandomNumber(20) + 80, HEALTH, 1000, 2000, areaID, 0)
else
CreatureObject(pMovingObject):addDotState(pMovingObject, POISONED, getRandomNumber(100) + 200, HEALTH, 1000, 2000, areaID, 0)
end
CreatureObject(pMovingObject):sendSystemMessage("@dungeon/geonosian_madbio:toxic_fumes") --You breathe in toxic fumes!
end
return 0
end
function <API key>:notifyElectroShock(pActiveArea, pMovingObject)
if (pMovingObject == nil or pActiveArea == nil or not SceneObject(pMovingObject):isCreatureObject()) then
return 0
end
if (SceneObject(pMovingObject):isAiAgent() and not AiAgent(pMovingObject):isPet()) then
return 0
end
CreatureObject(pMovingObject):inflictDamage(pMovingObject, 0, 1000, 0)
CreatureObject(pMovingObject):sendSystemMessage("@dungeon/geonosian_madbio:shock") --You feel electricity coursing through your body!
return 0
end
function <API key>:hasRebreather(pCreature)
if (pCreature == nil) then
return false
end
--TODO: Change this to be a skill mod check for <API key>
local pRebreather = CreatureObject(pCreature):getSlottedObject("eyes")
if pRebreather == nil then
return false
end
local headSlot = SceneObject(pRebreather):<API key>()
return (headSlot == "object/tangible/wearables/goggles/rebreather.iff" or headSlot == "object/tangible/wearables/armor/mandalorian/<API key>.iff")
end
function <API key>:respawnDebris(pDebris)
if (pDebris == nil) then
return
end
TangibleObject(pDebris):setConditionDamage(0, false)
local debrisData = self.debris[readData(SceneObject(pDebris):getObjectID() .. ":geonosian_lab:debris_index")]
local pCell = getSceneObject(debrisData.cell)
if (pCell ~= nil) then
SceneObject(pCell):transferObject(pDebris, -1, true)
end
end
function <API key>:<API key>(pDebris, pPlayer)
if (pPlayer == nil or pDebris == nil) then
return 0
end
createEvent(240000, "<API key>", "respawnDebris", pDebris)
SceneObject(pDebris):<API key>()
CreatureObject(pPlayer):clearCombatState(1)
return 0
end
function <API key>:hasGeoItem(pPlayer, itemTemplate)
local pInventory = SceneObject(pPlayer):getSlottedObject("inventory")
if (pInventory == nil) then
return 0
end
local pItem = <API key>(pInventory, itemTemplate, true)
return pItem ~= nil
end
function <API key>:removeGeoItem(pPlayer, itemTemplate)
local pInventory = SceneObject(pPlayer):getSlottedObject("inventory")
if (pInventory == nil) then
return
end
local pItem = <API key>(pInventory, itemTemplate, true)
if (pItem ~= nil) then
SceneObject(pItem):<API key>()
SceneObject(pItem):<API key>()
end
end
function <API key>:giveGeoItem(pPlayer, itemTemplate)
local pInventory = SceneObject(pPlayer):getSlottedObject("inventory")
if (not self:hasGeoItem(pPlayer, itemTemplate)) then
local pItem = giveItem(pInventory, itemTemplate, -1)
if (pItem ~= nil) then
SceneObject(pItem):sendTo(pPlayer)
end
end
end |
package com.gallatinsystems.survey.dao;
import com.gallatinsystems.survey.domain.Translation;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.logging.Level;
import javax.jdo.PersistenceManager;
import com.gallatinsystems.framework.dao.BaseDAO;
import com.gallatinsystems.framework.exceptions.<API key>;
import com.gallatinsystems.framework.servlet.PersistenceFilter;
import com.gallatinsystems.survey.domain.QuestionGroup;
/**
* Dao for question groups
*/
public class QuestionGroupDao extends BaseDAO<QuestionGroup> {
private final TranslationDao translationDao;
public QuestionGroupDao() {
super(QuestionGroup.class);
this.translationDao = new TranslationDao();
}
public void <API key>(QuestionGroup item) {
try {
Map<String, Translation> translations = item.getTranslations();
if (translations != null) {
for (Translation t : translations.values()) {
t.setParentId(item.getKey().getId());
t.setSurveyId(item.getSurveyId());
t.setQuestionGroupId(item.getKey().getId());
}
super.save(translations.values());
}
} catch (Exception e) {
log.log(Level.SEVERE, "Error saving translations", e);
}
}
/**
* saves a question group and associates it with the survey specified
*
* @param item
* @param surveyId
* @return
*/
public QuestionGroup save(QuestionGroup item, Long surveyId) {
if (item.getSurveyId() == null || item.getSurveyId() == 0) {
item.setSurveyId(surveyId);
}
item = save(item);
return item;
}
/**
* Deletes all question groups associated with a survey
*
* @param surveyId
* @throws <API key>
*/
public void <API key>(Long surveyId) throws <API key> {
for (QuestionGroup group : <API key>(surveyId)) {
delete(group);
}
}
public List<QuestionGroup> <API key>(String code) {
return listByProperty("name", code, "String");
}
/**
* lists all question groups within a survey.
* All groups will have a unique order field, even if datastore is messed up.
*
* @param surveyId
* @return
*/
public TreeMap<Integer, QuestionGroup> <API key>(Long surveyId) {
List<QuestionGroup> groups = listByProperty("surveyId", surveyId, "Long");
TreeMap<Integer, QuestionGroup> map = new TreeMap<Integer, QuestionGroup>();
if (groups != null) {
int i = 1;
for (QuestionGroup group : groups) {
List<Translation> translations = translationDao.findTranslations(
group.getKey().getId(), Translation.ParentType.QUESTION_GROUP_NAME);
HashMap<String, Translation> translationMap = new HashMap<>();
if (translations != null) {
for (Translation t: translations) {
translationMap.put(t.getLanguageCode(), t);
}
}
group.setTranslations(translationMap);
// TODO: Hack because we seem to have questiongroups with same
// order key so put an arbitrary value there for now since it
// isn't used.
if (map.containsKey(group.getOrder())) {
map.put(i, group);
group.setOrder(i);
} else {
map.put(group.getOrder() != null ? group.getOrder() : i,
group);
}
i++;
}
}
return map;
}
/**
* lists all question groups by survey, ordered by the order field
*
* @param surveyId
* @return
*/
public List<QuestionGroup> <API key>(Long surveyId) {
return super.listByProperty("surveyId", surveyId, "Long", "order",
"asc");
}
/**
* gets a group by its code and survey id
*
* @param code
* @param surveyId
* @return
*/
@SuppressWarnings("unchecked")
public QuestionGroup <API key>(String code, Long surveyId) {
PersistenceManager pm = PersistenceFilter.getManager();
javax.jdo.Query query = pm.newQuery(QuestionGroup.class);
query.setFilter(" code==codeParam && surveyId == surveyIdParam");
query.declareParameters("String codeParam, Long surveyIdParam");
List<QuestionGroup> results = (List<QuestionGroup>) query.execute(code,
surveyId);
if (results != null && results.size() > 0) {
return results.get(0);
} else {
return null;
}
}
/**
* finds a group by code and path. Path is "surveyGroupName/surveyName"
*
* @param code
* @param path
* @return
*/
@SuppressWarnings("unchecked")
public QuestionGroup getByPath(String code, String path) {
PersistenceManager pm = PersistenceFilter.getManager();
javax.jdo.Query query = pm.newQuery(QuestionGroup.class);
query.setFilter(" path == pathParam && code == codeParam");
query.declareParameters("String pathParam, String codeParam");
List<QuestionGroup> results = (List<QuestionGroup>) query.execute(path,
code);
if (results != null && results.size() > 0) {
return results.get(0);
} else {
return null;
}
}
/**
* Deletes a questionGroup
*
* @param group
* @throws <API key>
*/
public void delete(QuestionGroup group) throws <API key> {
QuestionDao qDao = new QuestionDao();
qDao.<API key>(group.getKey().getId());
super.delete(group);
}
} |
<?php
class Pages extends CI_Controller {
private $data = array (
'stylesheet' => 'cover',
'additional_css_el' => '',
'additional_js_el' => '',
'title' => 'Home',
'description' => 'Welcome to SimpleWorkOrder',
'author' => 'SimpleWorkOrder'
);
public function __construct() {
parent::__construct();
}
public function view($pages = 'home') {
$this->data['title'] = ucfirst($pages) . ' | SimpleWorkOrder';
$this->data['slug'] = $pages;
$this->load->view('templates/header', $this->data);
$this->load->view('pages/templates/home_header', $this->data);
if ($pages == 'signup') {
$this->signup();
}
else {
$this->load->view('pages/' . $pages, $this->data);
}
$this->load->view('pages/templates/home_footer');
$this->load->view('templates/footer', $this->data);
}
private function signup() {
$this->load->model('users_model');
$this->load->helper('form');
$this->load->library('form_validation');
$this->form_validation->set_rules('first_name', 'First Name', 'trim|required|xss_clean');
$this->form_validation->set_rules('last_name', 'Last Name', 'trim|required|xss_clean');
$this->form_validation->set_rules('user_name', 'Username',
'trim|required|min_length[5]|max_length[20]|is_unique[users.user_name]|xss_clean');
$this->form_validation->set_rules('email', 'Email',
'trim|required|xss_clean|is_unique[users.email]|valid_email');
$this->form_validation->set_rules('primary_phone', 'Primary Phone', 'trim|required|xss_clean');
$this->form_validation->set_rules('specialty', 'Specialty', 'trim|xss_clean');
$this->form_validation->set_rules('h-o-ney-pot', 'h-o-ney-pot', 'max_length[0]|xss_clean');
if ($this->form_validation->run() == FALSE)
{
$this->data['success'] = FALSE;
$this->load->view('pages/signup', $this->data);
}
else
{
$this->users_model->set_user_signup();
$this->email_welcome($this->input->post('email'));
redirect('page/signup/?success=True');
}
}
private function email_welcome($email) {
$this->config->load('email');
$this->load->library('email');
$this->email->from($this->config->item('smtp_email_address'), 'Admin');
$this->email->to($email);
$this->email->subject('Thank you for signing up!');
$message = $this->load->view('email/signup', '',TRUE);
$this->email->message($message);
$this->email->send();
}
} |
describe Universign::API do
describe '.request_timestamp', vcr: { cassette_name: 'universign' } do
subject { described_class.timestamp(digest) }
let(:digest) { Digest::SHA256.hexdigest("CECI EST UN HASH") }
it { is_expected.not_to be_nil }
end
end |
package tools_test
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
gc "launchpad.net/gocheck"
"github.com/wallyworld/core/environs/tools"
"github.com/wallyworld/core/testing/testbase"
)
type buildSuite struct {
testbase.LoggingSuite
restore func()
cwd string
filePath string
}
var _ = gc.Suite(&buildSuite{})
func (b *buildSuite) SetUpTest(c *gc.C) {
b.LoggingSuite.SetUpTest(c)
dir1 := c.MkDir()
dir2 := c.MkDir()
c.Log(dir1)
c.Log(dir2)
path := os.Getenv("PATH")
os.Setenv("PATH", fmt.Sprintf("%s:%s:%s", dir1, dir2, path))
// Make an executable file called "juju-test" in dir2.
b.filePath = filepath.Join(dir2, "juju-test")
err := ioutil.WriteFile(
b.filePath,
[]byte("doesn't matter, we don't execute it"),
0755)
c.Assert(err, gc.IsNil)
cwd, err := os.Getwd()
c.Assert(err, gc.IsNil)
b.cwd = c.MkDir()
err = os.Chdir(b.cwd)
c.Assert(err, gc.IsNil)
b.restore = func() {
os.Setenv("PATH", path)
os.Chdir(cwd)
}
}
func (b *buildSuite) TearDownTest(c *gc.C) {
b.restore()
b.LoggingSuite.TearDownTest(c)
}
func (b *buildSuite) TestFindExecutable(c *gc.C) {
for _, test := range []struct {
execFile string
expected string
errorMatch string
}{{
execFile: "/some/absolute/path",
expected: "/some/absolute/path",
}, {
execFile: "./foo",
expected: filepath.Join(b.cwd, "foo"),
}, {
execFile: "juju-test",
expected: b.filePath,
}, {
execFile: "<API key>",
errorMatch: `could not find "<API key>" in the path`,
}} {
result, err := tools.FindExecutable(test.execFile)
if test.errorMatch == "" {
c.Assert(err, gc.IsNil)
c.Assert(result, gc.Equals, test.expected)
} else {
c.Assert(err, gc.ErrorMatches, test.errorMatch)
c.Assert(result, gc.Equals, "")
}
}
} |
<?php
namespace rhosocial\user\rbac\permissions;
use rhosocial\user\rbac\Permission;
/**
* @version 1.0
* @author vistart <i@vistart.me>
*/
class DeleteAdminUser extends Permission
{
/**
* @inheritdoc
*/
public $name = 'deleteAdminUser';
/**
* @inheritdoc
*/
public $description = 'Delete an administrator user.';
} |
# <API key>: true
# This is a temporary fix to ignore some HTML/CSS validation issues with the
# Decidim HTML validation process.
module W3CValidators
class NuValidator
protected
alias validate_nu validate unless method_defined?(:validate_nu)
def validate(options) # :nodoc:
filter_results(validate_nu(options))
end
def ignore_errors
@ignore_errors ||= [
"CSS: “--content-height”: One operand must be a number."
]
end
def filter_results(results)
messages = results.<API key>(:@messages)
messages.delete_if do |msg|
msg.is_error? && ignore_errors.include?(msg.message)
end
results.<API key>(:@validity, messages.none?(&:is_error?))
results
end
end
end
# This allows us to dynamically load the validator URL from the ENV.
module W3cRspecValidators
class Config
# rubocop:disable Naming/<API key>
def self.get
@config ||= {
w3c_service_uri: ENV.fetch("VALIDATOR_HTML_URI", "https://validator.w3.org/nu/")
}.stringify_keys
end
# rubocop:enable Naming/<API key>
end
end |
package org.geomajas.gwt2.plugin.corewidget.example.client.sample.dialog;
import com.google.gwt.core.client.Callback;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.Widget;
import org.geomajas.gwt2.example.base.client.sample.SamplePanel;
import org.geomajas.gwt2.plugin.corewidget.example.client.i18n.SampleMessages;
import org.geomajas.gwt2.plugin.corewidget.example.client.sample.message.MessageBox;
/**
* Sample showing off MessageBox capabilities.
*
* @author Kristof Heirwegh
*/
public class MessageBoxExample implements SamplePanel, Callback<Boolean, Void> {
private DockLayoutPanel rootElement;
private static final <API key> UIBINDER = GWT.create(<API key>.class);
private static final SampleMessages MSG = GWT.create(SampleMessages.class);
/**
* UI binder interface.
*/
interface <API key> extends UiBinder<DockLayoutPanel, MessageBoxExample> {
}
public MessageBoxExample() {
rootElement = UIBINDER.createAndBindUi(this);
}
@Override
public Widget asWidget() {
return rootElement;
}
@UiHandler("infoMessageBtn")
protected void <API key>(ClickEvent event) {
MessageBox.showMessageBox(MSG.<API key>(), MSG.messageBoxMessage());
}
@UiHandler("warnMessageBtn")
protected void <API key>(ClickEvent event) {
MessageBox.showMessageBox(MSG.<API key>(), MSG.messageBoxMessage(),
MessageBox.MessageStyleType.WARN);
}
@UiHandler("errorMessageBtn")
protected void <API key>(ClickEvent event) {
MessageBox.showMessageBox(MSG.<API key>(), MSG.messageBoxMessage(),
MessageBox.MessageStyleType.ERROR);
}
@UiHandler("helpMessageBtn")
protected void <API key>(ClickEvent event) {
MessageBox.showMessageBox(MSG.<API key>(), MSG.<API key>(),
MessageBox.MessageStyleType.HELP);
}
@UiHandler("yesNoBtn")
protected void onYesNoBtnClicked(ClickEvent event) {
MessageBox.showYesNoMessageBox(MSG.messageBoxYesNoBtn(), MSG.messageBoxMessage(), this);
}
@UiHandler("yesNoCancelBtn")
protected void <API key>(ClickEvent event) {
MessageBox.<API key>(MSG.<API key>(), MSG.messageBoxMessage(), this);
}
// -- Callback --
@Override
public void onFailure(Void reason) {
MessageBox.showMessageBox("", MSG.<API key>());
}
@Override
public void onSuccess(Boolean result) {
MessageBox.showMessageBox("", result ? MSG.<API key>() : MSG.<API key>());
}
} |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='clustercheck',
use_scm_version=True,
setup_requires=['setuptools_scm'],
install_requires=[
'Twisted>=12.2',
'PyMySQL'
],
description='Standalone service for reporting of Percona XtraDB/Galera cluster nodes',
license='AGPL-3.0-only',
keywords='galera,mariadb,percona,database,cluster',
author='David Busby',
author_email='oneiroi@fedoraproject.org',
url='https://github.com/Oneiroi/clustercheck/',
packages=find_packages(),
entry_points={
'console_scripts': [
'clustercheck = clustercheck:main',
],
}
) |
import React, {useMemo} from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as EqualizerActions from '../../actions/equalizer';
import Equalizer from '../../components/Equalizer';
import EqualizerPresetList from '../../components/EqualizerPresetList';
import { useTranslation } from 'react-i18next';
import styles from './styles.scss';
const usePresets = () => {
const map = useSelector(state => state.equalizer.presets);
const ids = useSelector(state => state.equalizer.presetIDs);
return useMemo(() => denormalize({ids, map}), [ids, map]);
};
const denormalize = ({map, ids}) => ids.map(id => map[id]);
const <API key> = () => {
const equalizer = useSelector(state => state.equalizer);
const preset = equalizer.presets[equalizer.selected];
const dispatch = useDispatch();
const actions = useMemo(() => bindActionCreators(EqualizerActions, dispatch), [dispatch]);
const presets = usePresets();
const { t } = useTranslation('app');
return (
<div className={styles.equalizer_view}>
<h1>{t('equalizer')}</h1>
<div className={styles.<API key>}>
<Equalizer
values={preset.values}
preAmp={preset.preAmp}
onEqualizerChange={actions.changeValue}
onPreampChange={actions.setPreAmp}
onToggleSpectrum={actions.toggleSpectrum}
enableSpectrum={equalizer.enableSpectrum}
spectrum={equalizer.spectrum}
/>
<EqualizerPresetList
onClickItem={actions.selectPreset}
presets={presets}
selected={preset.id}
/>
</div>
</div>
);
};
export default <API key>; |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import struct
import time
import hashlib
import sys
import os
import random
import traceback
# CONFIG
server = "192.168.100.150"
username = ""
password = ""
host_name = "LIYUANYUAN"
host_os = "8089D"
host_ip = "10.30.22.17"
PRIMARY_DNS = "114.114.114.114"
dhcp_server = "0.0.0.0"
mac = 0xb888e3051680
CONTROLCHECKSTATUS = '\x20'
ADAPTERNUM = '\x01'
KEEP_ALIVE_VERSION = '\xdc\x02'
AUTH_VERSION = '\x0a\x00'
IPDOG = '\x01'
ror_version = False
# CONFIG_END
keep_alive1_mod = False #If you have trouble at KEEPALIVE1, turn this value to True
nic_name = '' #Indicate your nic, e.g. 'eth0.2'.nic_name
bind_ip = '0.0.0.0'
class ChallengeException (Exception):
def __init__(self):
pass
class LoginException (Exception):
def __init__(self):
pass
def bind_nic():
try:
import fcntl
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
0x8915, # SIOCGIFADDR
struct.pack('256s', ifname[:15])
)[20:24])
return get_ip_address(nic_name)
except ImportError as e:
print('Indicate nic feature need to be run under Unix based system.')
return '0.0.0.0'
except IOError as e:
print(nic_name + 'is unacceptable !')
return '0.0.0.0'
finally:
return '0.0.0.0'
if nic_name != '':
bind_ip = bind_nic()
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((bind_ip, 61440))
s.settimeout(3)
SALT = ''
IS_TEST = True
# specified fields based on version
CONF = "/etc/drcom.conf"
UNLIMITED_RETRY = True
EXCEPTION = False
DEBUG = False #log saves to file
LOG_PATH = '/var/log/drcom_client.log'
if IS_TEST:
DEBUG = True
LOG_PATH = 'drcom_client.log'
def log(*args, **kwargs):
s = ' '.join(args)
print s
if DEBUG:
with open(LOG_PATH,'a') as f:
f.write(s + '\n')
def challenge(svr,ran):
while True:
t = struct.pack("<H", int(ran)%(0xFFFF))
s.sendto("\x01\x02"+t+"\x09"+"\x00"*15, (svr, 61440))
try:
data, address = s.recvfrom(1024)
log('[challenge] recv',data.encode('hex'))
except:
log('[challenge] timeout, retrying...')
continue
if address == (svr, 61440):
break
else:
continue
log('[DEBUG] challenge:\n' + data.encode('hex'))
if data[0] != '\x02':
raise ChallengeException
log('[challenge] challenge packet sent.')
return data[4:8]
def md5sum(s):
m = hashlib.md5()
m.update(s)
return m.digest()
def dump(n):
s = '%x' % n
if len(s) & 1:
s = '0' + s
return s.decode('hex')
def ror(md5, pwd):
ret = ''
for i in range(len(pwd)):
x = ord(md5[i]) ^ ord(pwd[i])
ret += chr(((x<<3)&0xFF) + (x>>5))
return ret
def gen_crc(data, encrypt_type):
<API key> = 20000711
ret = ''
if encrypt_type == 0:
return struct.pack('<I',<API key>) + struct.pack('<I',126)
elif encrypt_type == 1:
# md5
foo = hashlib.md5(data).digest()
ret += foo[2]
ret += foo[3]
ret += foo[8]
ret += foo[9]
ret += foo[5]
ret += foo[6]
ret += foo[13]
ret += foo[14]
return ret
elif encrypt_type == 2:
# md4
foo = hashlib.new('md4', data).digest()
ret += foo[1]
ret += foo[2]
ret += foo[8]
ret += foo[9]
ret += foo[4]
ret += foo[5]
ret += foo[11]
ret += foo[12]
return ret
elif encrypt_type == 3:
# sha1
foo = hashlib.sha1(data).digest()
ret += foo[2]
ret += foo[3]
ret += foo[9]
ret += foo[10]
ret += foo[5]
ret += foo[6]
ret += foo[15]
ret += foo[16]
return ret
def <API key>(number,random,tail,type=1,first=False):
data = '\x07'+ chr(number) + '\x28\x00\x0b' + chr(type)
if first :
data += '\x0f\x27'
else:
data += KEEP_ALIVE_VERSION
data += '\x2f\x12' + '\x00' * 6
data += tail
data += '\x00' * 4
#data += struct.pack("!H",0xdc02)
if type == 3:
foo = ''.join([chr(int(i)) for i in host_ip.split('.')]) # host_ip
#CRC
# edited on 2014/5/12, filled zeros to checksum
# crc = packet_CRC(data+foo)
crc = '\x00' * 4
#data += struct.pack("!I",crc) + foo + '\x00' * 8
data += crc + foo + '\x00' * 8
else: #packet type = 1
data += '\x00' * 16
return data
# def packet_CRC(s):
# ret = 0
# for i in re.findall('..', s):
# ret ^= struct.unpack('>h', i)[0]
# ret &= 0xFFFF
# ret = ret * 0x2c7
# return ret
def keep_alive2(*args):
#first keep_alive:
#number = number (mod 7)
#status = 1: first packet user sended
# 2: first packet user recieved
# 3: 2nd packet user sended
# 4: 2nd packet user recieved
# Codes for test
tail = ''
packet = ''
svr = server
ran = random.randint(0,0xFFFF)
ran += random.randint(1,10)
# 2014/10/15 add by latyas, maybe svr sends back a file packet
svr_num = 0
packet = <API key>(svr_num,dump(ran),'\x00'*4,1,True)
while True:
log('[keep-alive2] send1',packet.encode('hex'))
s.sendto(packet, (svr, 61440))
data, address = s.recvfrom(1024)
log('[keep-alive2] recv1',data.encode('hex'))
if data.startswith('\x07\x00\x28\x00') or data.startswith('\x07' + chr(svr_num) + '\x28\x00'):
break
elif data[0] == '\x07' and data[2] == '\x10':
log('[keep-alive2] recv file, resending..')
svr_num = svr_num + 1
# packet = <API key>(svr_num,dump(ran),'\x00'*4,1, False)
break
else:
log('[keep-alive2] recv1/unexpected',data.encode('hex'))
#log('[keep-alive2] recv1',data.encode('hex'))
ran += random.randint(1,10)
packet = <API key>(svr_num, dump(ran),'\x00'*4,1,False)
log('[keep-alive2] send2',packet.encode('hex'))
s.sendto(packet, (svr, 61440))
while True:
data, address = s.recvfrom(1024)
if data[0] == '\x07':
svr_num = svr_num + 1
break
else:
log('[keep-alive2] recv2/unexpected',data.encode('hex'))
log('[keep-alive2] recv2',data.encode('hex'))
tail = data[16:20]
ran += random.randint(1,10)
packet = <API key>(svr_num,dump(ran),tail,3,False)
log('[keep-alive2] send3',packet.encode('hex'))
s.sendto(packet, (svr, 61440))
while True:
data, address = s.recvfrom(1024)
if data[0] == '\x07':
svr_num = svr_num + 1
break
else:
log('[keep-alive2] recv3/unexpected',data.encode('hex'))
log('[keep-alive2] recv3',data.encode('hex'))
tail = data[16:20]
log("[keep-alive2] keep-alive2 loop was in daemon.")
i = svr_num
while True:
try:
time.sleep(20)
keep_alive1(*args)
ran += random.randint(1,10)
packet = <API key>(i,dump(ran),tail,1,False)
#log('DEBUG: keep_alive2,packet 4\n',packet.encode('hex'))
log('[keep_alive2] send',str(i),packet.encode('hex'))
s.sendto(packet, (svr, 61440))
data, address = s.recvfrom(1024)
log('[keep_alive2] recv',data.encode('hex'))
tail = data[16:20]
#log('DEBUG: keep_alive2,packet 4 return\n',data.encode('hex'))
ran += random.randint(1,10)
packet = <API key>(i+1,dump(ran),tail,3,False)
#log('DEBUG: keep_alive2,packet 5\n',packet.encode('hex'))
s.sendto(packet, (svr, 61440))
log('[keep_alive2] send',str(i+1),packet.encode('hex'))
data, address = s.recvfrom(1024)
log('[keep_alive2] recv',data.encode('hex'))
tail = data[16:20]
#log('DEBUG: keep_alive2,packet 5 return\n',data.encode('hex'))
i = (i+2) % 0xFF
except:
break
def checksum(s):
ret = 1234
x = 0
for i in [x*4 for x in range(0, -(-len(s)
ret ^= int(s[i:i+4].ljust(4, '\x00')[::-1].encode('hex'), 16)
ret = (1968 * ret) & 0xffffffff
return struct.pack('<I', ret)
def mkpkt(salt, usr, pwd, mac):
'''
struct _tagLoginPacket
{
struct _tagDrCOMHeader Header;
unsigned char PasswordMd5[MD5_LEN];
char Account[ACCOUNT_MAX_LEN];
unsigned char ControlCheckStatus;
unsigned char AdapterNum;
unsigned char <API key>[MAC_LEN];
unsigned char PasswordMd5_2[MD5_LEN];
unsigned char HostIpNum;
unsigned int HostIPList[HOST_MAX_IP_NUM];
unsigned char HalfMD5[8];
unsigned char DogFlag;
unsigned int unkown2;
struct _tagHostInfo HostInfo;
unsigned char <API key>;
unsigned char DogVersion;
};
'''
data = '\x03\x01\x00' + chr(len(usr) + 20)
data += md5sum('\x03\x01' + salt + pwd)
data += usr.ljust(36, '\x00')
data += CONTROLCHECKSTATUS
data += ADAPTERNUM
data += dump(int(data[4:10].encode('hex'),16)^mac).rjust(6, '\x00') #mac xor md51
data += md5sum("\x01" + pwd + salt + '\x00' * 4) #md52
data += '\x01' # number of ip
data += ''.join([chr(int(i)) for i in host_ip.split('.')]) #x.x.x.x ->
data += '\00' * 4 #your ipaddress 2
data += '\00' * 4 #your ipaddress 3
data += '\00' * 4 #your ipaddress 4
data += md5sum(data + '\x14\x00\x07\x0B')[:8] #md53
data += IPDOG
data += '\x00'*4 # unknown2
'''
struct _tagOSVERSIONINFO
{
unsigned int OSVersionInfoSize;
unsigned int MajorVersion;
unsigned int MinorVersion;
unsigned int BuildNumber;
unsigned int PlatformID;
char ServicePack[128];
};
struct _tagHostInfo
{
char HostName[HOST_NAME_MAX_LEN];
unsigned int DNSIP1;
unsigned int DHCPServerIP;
unsigned int DNSIP2;
unsigned int WINSIP1;
unsigned int WINSIP2;
struct <API key> OSVersion;
};
'''
data += host_name.ljust(32, '\x00') # _tagHostInfo.HostName
data += ''.join([chr(int(i)) for i in PRIMARY_DNS.split('.')]) # _tagHostInfo.DNSIP1
data += ''.join([chr(int(i)) for i in dhcp_server.split('.')]) # _tagHostInfo.DHCPServerIP
data += '\x00\x00\x00\x00' # _tagHostInfo.DNSIP2
data += '\x00' * 4 # _tagHostInfo.WINSIP1
data += '\x00' * 4 # _tagHostInfo.WINSIP2
data += '\x94\x00\x00\x00' # _tagHostInfo.OSVersion.OSVersionInfoSize
data += '\x05\x00\x00\x00' # _tagHostInfo.OSVersion.MajorVersion
data += '\x01\x00\x00\x00' # _tagHostInfo.OSVersion.MinorVersion
data += '\x28\x0A\x00\x00' # _tagHostInfo.OSVersion.BuildNumber
data += '\x02\x00\x00\x00' # _tagHostInfo.OSVersion.PlatformID
# _tagHostInfo.OSVersion.ServicePack
data += host_os.ljust(32, '\x00')
data += '\x00' * 96
# END OF _tagHostInfo
data += AUTH_VERSION
if ror_version:
'''
struct _tagLDAPAuth
{
unsigned char Code;
unsigned char PasswordLen;
unsigned char Password[MD5_LEN];
};
'''
data += '\x00' # _tagLDAPAuth.Code
data += chr(len(pwd)) # _tagLDAPAuth.PasswordLen
data += ror(md5sum('\x03\x01' + salt + pwd), pwd) # _tagLDAPAuth.Password
'''
struct <API key>
{
unsigned char Code;
unsigned char Len;
unsigned long CRC;
unsigned short Option;
unsigned char AdapterAddress[MAC_LEN];
};
'''
data += '\x02' # <API key>.Code
data += '\x0C' # <API key>.Len
data += checksum(data + '\x01\x26\x07\x11\x00\x00' + dump(mac)) # <API key>.CRC
data += '\x00\x00' # <API key>.Option
data += dump(mac) # <API key>.AdapterAddress
# END OF <API key>
if ror_version:
data += '\x00' * (8 - len(pwd))
if len(pwd)%2:
data += '\x00'
else:
data += '\x00' # auto logout / default: False
data += '\x00' # broadcast mode / default : False
data += '\xE9\x13' #unknown, filled numbers randomly =w=
log('[mkpkt]',data.encode('hex'))
return data
def login(usr, pwd, svr):
global SALT
global AUTH_INFO
i = 0
timeoutcount = 0
while True:
salt = challenge(svr,time.time()+random.randint(0xF,0xFF))
SALT = salt
packet = mkpkt(salt, usr, pwd, mac)
log('[login] send',packet.encode('hex'))
s.sendto(packet, (svr, 61440))
log('[login] packet sent.')
try:
data, address = s.recvfrom(1024)
log('[login] recv',data.encode('hex'))
if address == (svr, 61440) :
if data[0] == '\x04':
log('[login] loged in')
AUTH_INFO = data[23:39]
break
else:
log('[login] login failed.')
if IS_TEST:
time.sleep(3)
else:
time.sleep(30)
continue
else:
if i >= 5 and UNLIMITED_RETRY == False :
log('[login] exception occured.')
sys.exit(1)
else:
i += 1
continue
except socket.timeout as e:
print(e)
log('[login] recv timeout.')
timeoutcount += 1
if timeoutcount >= 5:
log('[login] recv timeout exception occured 5 times.')
sys.exit(1)
else:
continue
log('[login] login sent')
#0.8 changed:
return data[23:39]
#return data[-22:-6]
def logout(usr, pwd, svr, mac, auth_info):
salt = challenge(svr, time.time()+random.randint(0xF, 0xFF))
if salt:
data = '\x06\x01\x00' + chr(len(usr) + 20)
data += md5sum('\x03\x01' + salt + pwd)
data += usr.ljust(36, '\x00')
data += CONTROLCHECKSTATUS
data += ADAPTERNUM
data += dump(int(data[4:10].encode('hex'),16)^mac).rjust(6, '\x00')
# data += '\x44\x72\x63\x6F' # Drco
data += auth_info
s.send(data)
data, address = s.recvfrom(1024)
if data[:1] == '\x04':
log('[logout_auth] logouted.')
def keep_alive1(salt,tail,pwd,svr):
if keep_alive1_mod:
res=''
while True:
s.sendto('\x07' + struct.pack('!B',int(time.time())%0xFF) + '\x08\x00\x01\x00\x00\x00', (svr, 61440))
log('[<API key>] <API key> packet sent.')
try:
res, address = s.recvfrom(1024)
log('[<API key>] recv', res.encode('hex'))
except:
log('[<API key>] timeout, retrying...')
continue
if address == (svr, 61440):
if res[0] == '\x07':
break
else:
raise ChallengeException
else:
continue
seed = res[8:12]
# encrypt_type = int(res[5].encode('hex'))
encrypt_type = struct.unpack('<I', seed)[0] & 3
crc = gen_crc(seed, encrypt_type)
data = '\xFF' + '\x00'*7 + seed + crc + tail + struct.pack('!H', int(time.time())%0xFFFF)
log('[keep_alive1] send', data.encode('hex'))
s.sendto(data, (svr, 61440))
while True:
res, address = s.recvfrom(1024)
if res[0] == '\x07':
break
else:
log('[keep-alive1]recv/not expected', res.encode('hex'))
log('[keep-alive1]recv', res.encode('hex'))
else:
foo = struct.pack('!H',int(time.time())%0xFFFF)
data = '\xff' + md5sum('\x03\x01'+salt+pwd) + '\x00\x00\x00'
data += tail
data += foo + '\x00\x00\x00\x00'
log('[keep_alive1] send',data.encode('hex'))
s.sendto(data, (svr, 61440))
while True:
data, address = s.recvfrom(1024)
if data[0] == '\x07':
break
else:
log('[keep-alive1]recv/not expected',data.encode('hex'))
log('[keep-alive1] recv', data.encode('hex'))
def empty_socket_buffer():
#empty buffer for some fucking schools
log('starting to empty socket buffer')
try:
while True:
data, address = s.recvfrom(1024)
log('recived sth unexpected',data.encode('hex'))
if s == '':
break
except:
# get exception means it has done.
log('exception in empty_socket_buffer')
pass
log('emptyed')
def daemon():
with open('/var/run/jludrcom.pid','w') as f:
f.write(str(os.getpid()))
def main():
if not IS_TEST:
daemon()
execfile(CONF, globals())
log("auth svr: " + server + "\nusername: " + username + "\npassword: " + password + "\nmac: " + str(hex(mac))[:-1])
log("bind ip: " + bind_ip)
while True:
try:
package_tail = login(username, password, server)
except LoginException:
continue
log('package_tail',package_tail.encode('hex'))
#keep_alive1 is fucking bullshit!
empty_socket_buffer()
keep_alive1(SALT,package_tail,password,server)
keep_alive2(SALT,package_tail,password,server)
if __name__ == "__main__":
main() |
<?php
class Cookie {
public static function exists($name) {
return (isset($_COOKIE[$name])) ? true : false;
}
public static function get($name) {
return $_COOKIE[$name];
}
public static function put($name, $value, $expiry) {
if (setcookie($name, $value, time() + $expiry, "/")) {
return true;
}
else {
return false;
}
}
public static function delete($name) {
self::put($name, "", time() -1);
}
} |
package com.foundationdb.server.types.texpressions;
import com.foundationdb.qp.operator.QueryContext;
import com.foundationdb.qp.row.Row;
import com.foundationdb.server.explain.*;
import com.foundationdb.server.explain.std.<API key>;
import com.foundationdb.server.types.TInstance;
import com.foundationdb.server.types.TPreptimeValue;
import com.foundationdb.server.types.value.ValueSource;
import com.foundationdb.server.types.value.ValueTarget;
import com.foundationdb.server.types.value.ValueTargets;
public final class TPreparedField implements TPreparedExpression {
@Override
public TPreptimeValue evaluateConstant(QueryContext queryContext) {
return null;
}
@Override
public TInstance resultType() {
return typeInstance;
}
@Override
public <API key> build() {
return new Evaluation(typeInstance, fieldIndex);
}
@Override
public CompoundExplainer getExplainer(ExplainContext context)
{
CompoundExplainer ex = new <API key>(Type.FIELD, "Field", context);
ex.addAttribute(Label.POSITION, PrimitiveExplainer.getInstance(fieldIndex));
if (context.hasExtraInfo(this))
ex.get().putAll(context.getExtraInfo(this).get());
return ex;
}
@Override
public String toString() {
return "Field(" + fieldIndex + ')';
}
public TPreparedField(TInstance typeInstance, int fieldIndex) {
this.typeInstance = typeInstance;
this.fieldIndex = fieldIndex;
}
private final TInstance typeInstance;
private final int fieldIndex;
private static class Evaluation extends <API key><Row> {
@Override
protected void evaluate(Row context, ValueTarget target) {
ValueSource rowSource = context.value(fieldIndex);
ValueTargets.copyFrom(rowSource, target);
}
@Override
public void with(Row row) {
setContext(row);
}
private Evaluation(TInstance underlyingType, int fieldIndex) {
super(underlyingType);
this.fieldIndex = fieldIndex;
}
private int fieldIndex;
}
} |
<?php
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access directly to this file");
}
/**
* Manage the hours in the timeslot.
*/
class <API key> extends CommonDBTM {
/**
* We activate the history.
*
* @var boolean
*/
public $dohistory = true;
/**
* The right name for this class
*
* @var string
*/
static $rightname = '<API key>';
/**
* Get name of this type by language of the user connected
*
* @param integer $nb number of elements
* @return string name of this type
*/
static function getTypeName($nb = 0) {
return __('Time slot entry', 'fusioninventory');
}
/**
* Get search function for the class
*
* @return array
*/
function rawSearchOptions() {
$tab = [];
$tab[] = [
'id' => 'common',
'name' => __('Time slot', 'fusioninventory')
];
$tab[] = [
'id' => '1',
'table' => $this->getTable(),
'field' => 'name',
'name' => __('Name'),
'datatype' => 'itemlink',
];
$tab[] = [
'id' => '2',
'table' => 'glpi_entities',
'field' => 'completename',
'name' => __('Entity'),
'datatype' => 'dropdown',
];
$tab[] = [
'id' => '3',
'table' => $this->getTable(),
'field' => 'is_recursive',
'name' => __('Child entities'),
'datatype' => 'bool',
];
$tab[] = [
'id' => '4',
'table' => $this->getTable(),
'field' => 'name',
'name' => __('Name'),
'datatype' => 'string',
];
return $tab;
}
/**
* Display form to add a new time entry in timeslot
*
* @param integer $timeslots_id
*/
function formEntry($timeslots_id) {
$ID = 0;
$options = [];
$this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>";
echo __('Start time', 'fusioninventory');
echo "</td>";
echo "<td>";
$days = [
'1' => __('Monday'),
'2' => __('Tuesday'),
'3' => __('Wednesday'),
'4' => __('Thursday'),
'5' => __('Friday'),
'6' => __('Saturday'),
'7' => __('Sunday')
];
echo '<div id="beginday">';
Dropdown::showFromArray('beginday', $days);
echo '</div>';
$hours = [];
$dec = 15 * 60;
for ($timestamp = 0; $timestamp < (24 * 3600); $timestamp += $dec) {
$hours[$timestamp] = date('H:i', $timestamp);
}
<API key>::showHours('beginhours', ['step' => 15]);
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>";
echo __('End time', 'fusioninventory');
echo "</td>";
echo "<td>";
echo '<div id="beginday">';
Dropdown::showFromArray('lastday', $days);
echo '</div>';
<API key>::showHours('lasthours', ['step' => 15]);
echo Html::hidden('timeslots_id', ['value' => $timeslots_id]);
echo "</td>";
echo "</tr>";
$this->showFormButtons($options);
$this->formDeleteEntry($timeslots_id);
$this->showTimeSlot($timeslots_id);
}
/**
* Display delete form
*
* @todo rename this method in showTimeslots() since it's not only used to delete but also to
* show the list of Timeslot Entries. -- Kevin 'kiniou' Roy
*
* @param integer $timeslots_id
*/
function formDeleteEntry($timeslots_id) {
$dbentries = <API key>(
'<API key>',
['<API key>' => $timeslots_id],
'',
['day', 'begin ASC']);
$options = [];
$ID = key($dbentries);
$canedit = $this->getFromDB($ID)
&& $this->can($ID, READ);
$this->showFormHeader($options);
foreach ($dbentries as $dbentry) {
echo "<tr class='tab_bg_3'>";
echo "<td>";
$daysofweek = Toolbox::getDaysOfWeekArray();
$daysofweek[7] = $daysofweek[0];
unset($daysofweek[0]);
echo $daysofweek[$dbentry['day']];
echo "</td>";
echo "<td>";
echo <API key>::getHourMinute($dbentry['begin']);
echo " - ";
echo <API key>::getHourMinute($dbentry['end']);
echo "</td>";
echo "<td colspan='2'>";
if ($canedit) {
echo "<input type='submit' class='submit' name='purge-".$dbentry['id']."' value='delete' />";
}
echo "</td>";
echo "</tr>";
}
$this->showFormButtons(['canedit' => false]);
}
/**
* Display timeslot graph
*
* @todo This must be moved in Timeslot class since a Task class is linked to a Timeslot and not
* directly to a TimeslotEntry. The Timeslot class must be the entry point of any other class.
* -- Kevin 'kiniou' Roy
*
* @param integer $timeslots_id
*/
function showTimeSlot($timeslots_id) {
echo "<div id='chart'></div>";
echo "<div id='startperiod'></div>";
echo "<div id='stopperiod'></div>";
$daysofweek = Toolbox::getDaysOfWeekArray();
$daysofweek[7] = $daysofweek[0];
unset($daysofweek[0]);
$dates = [
$daysofweek[1] => [],
$daysofweek[2] => [],
$daysofweek[3] => [],
$daysofweek[4] => [],
$daysofweek[5] => [],
$daysofweek[6] => [],
$daysofweek[7] => [],
];
for ($day=1; $day <= 7; $day++) {
$dbentries = <API key>(
'<API key>',
[
'<API key>' => $timeslots_id,
'day' => $day,
],
'',
'`begin` ASC');
foreach ($dbentries as $entries) {
$dates[$daysofweek[$day]][] = [
'start' => $entries['begin'],
'end' => $entries['end']
];
}
}
echo '<script>timeslot(\''.json_encode($dates).'\')</script>';
}
/**
* Add a new entry
*
* @param array $data
*/
function addEntry($data) {
if ($data['lastday'] < $data['beginday']) {
return;
} else if ($data['lastday'] == $data['beginday']
&& $data['lasthours'] <= $data['beginhours']) {
return;
}
// else ok, we can update DB
for ($day=$data['beginday']; $day <= $data['lastday']; $day++) {
$range = [];
$range['beginhours'] = $data['beginhours'];
$range['lasthours'] = $data['lasthours'];
if ($data['beginday'] < $day) {
$range['beginhours'] = 0;
}
if ($data['lastday'] > $day) {
$range['lasthours'] = (24 * 3600);
}
// now get from DB
$dbentries = <API key>(
'<API key>',
[
'<API key>' => $data['timeslots_id'],
'day' => $day,
],
'',
'`begin` ASC');
$rangeToUpdate = $dbentries;
$rangeToAdd = [];
foreach ($dbentries as $entries) {
// the entry if before this db entry
if ($range['lasthours'] < $entries['begin']) {
break;
}
//the entry is more after end of this db entry
if ($range['beginhours'] > $entries['end']) {
continue;
}
// The entry is in this db entry
if ($range['beginhours'] >= $entries['begin']
&& $range['lasthours'] <= $entries['end']) {
unset($range['beginhours']);
break;
}
if ($range['beginhours'] < $entries['begin']) {
$rangeToUpdate[$entries['id']]['begin'] = $range['beginhours'];
if ($range['lasthours'] < $entries['end']) {
unset($range['beginhours']);
break;
} else {
$range['beginhours'] = $entries['end'];
}
} else if ($range['beginhours'] > $entries['begin']) {
if ($range['lasthours'] > $entries['end']) {
$range['beginhours'] = $entries['end'];
}
}
}
if (isset($range['beginhours'])
&& $range['beginhours'] != $range['lasthours']) {
$rangeToAdd = [[
'<API key>' => $data['timeslots_id'],
'day' => $day,
'begin' => $range['beginhours'],
'end' => $range['lasthours']
]];
}
$periods = [];
foreach ($rangeToUpdate as $dbToUpdate) {
$periods[$dbToUpdate['begin']] = $dbToUpdate;
}
foreach ($rangeToAdd as $dbToAdd) {
$periods[$dbToAdd['begin']] = $dbToAdd;
}
ksort($periods);
$periods = $this->mergePeriods($periods);
foreach ($dbentries as $dbentry) {
if (count($periods) > 0) {
$input = array_pop($periods);
$input['id'] = $dbentry['id'];
$input['day'] = $day;
$this->update($input);
} else {
$this->delete($dbentry);
}
}
if (count($periods) > 0) {
foreach ($periods as $period) {
$input = $period;
if (isset($input['id'])) {
unset($input['id']);
}
$this->add($input);
}
}
}
}
/**
* Merge 2 periods when 2 entries have a same time part
*
* @param array $periods
* @return array
*/
function mergePeriods($periods) {
$update = false;
$previouskey = 0;
$first = true;
foreach ($periods as $key=>$period) {
if ($first) {
$first = false;
$previouskey = $key;
} else {
if ($period['begin'] <= $periods[$previouskey]['end']
|| $period['begin'] == ($periods[$previouskey]['end'] + 15)) {
if ($period['end'] > $periods[$previouskey]['end']) {
$periods[$previouskey]['end'] = $period['end'];
}
unset($periods[$key]);
$update = true;
} else {
$previouskey = $key;
}
}
}
if ($update) {
$periods = $this->mergePeriods($periods);
}
return $periods;
}
} |
package com.puresoltechnologies.purifinity.server.passwordstore.rest.api;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.puresoltechnologies.commons.types.EmailAddress;
import com.puresoltechnologies.commons.types.Password;
import com.puresoltechnologies.purifinity.server.passwordstore.domain.<API key>;
import com.puresoltechnologies.purifinity.server.passwordstore.domain.<API key>;
import com.puresoltechnologies.purifinity.server.passwordstore.domain.<API key>;
import com.puresoltechnologies.purifinity.server.passwordstore.domain.<API key>;
/**
* This is the central REST interface for PasswordStore.
*
* @author Rick-Rainer Ludwig
*/
@Path("rest")
public interface <API key> {
@PUT
@Path("createAccount")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public String createPassword(<API key> entity) throws <API key>;
@PUT
@Path("activateAcount")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public EmailAddress activatePassword(<API key> entity) throws <API key>;
@POST
@Path("authenticate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public boolean authenticate(<API key> entity);
@POST
@Path("changePassword")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public boolean changePassword(<API key> entity) throws <API key>;
@POST
@Path("resetPassword")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Password resetPassword(String emailAddress) throws <API key>;
@DELETE
@Path("{email}")
public void deletePassword(@PathParam("email") String emailAddress);
} |
<div class="panel panel-info" ng-if="success">
<div class="panel-heading">
<a target="_blank" href="http://circl.lu/services/passive-dns/">CIRCL.lu</a> Passive DNS Report
</div>
<div class="panel-body">
<!-- Domain details -->
<p ng-if="content.results.length == 0">
No result found.
</p>
<table class="table" ng-if="content.results">
<thead>
<th>Count</th>
<th>rrtype</th>
<th>rdata</th>
<th>First time</th>
<th>Last time</th>
</thead>
<tbody ng-repeat="r in content.results | orderBy:'-time_last'">
<tr>
<td>{{r.count}}</td>
<td>{{r.rrtype}}</td>
<td>{{r.rdata}}</td>
<td>{{r.time_first}}</td>
<td>{{r.time_last}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- General error -->
<div class="panel panel-danger" ng-if="!success">
<div class="panel-heading">
<strong>{{(artifact.data || artifact.attachment.name) | fang}}</strong>
</div>
<div class="panel-body">
<dl class="dl-horizontal" ng-if="content.errorMessage">
<dt><i class="fa fa-warning"></i> PassiveDNS: </dt>
<dd class="wrap">{{content.errorMessage}}</dd>
</dl>
</div>
</div> |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Cp1252">
<title>com.kraqqen.util.sern</title>
</head>
<body>
<dl><dt>Author:</dt><dd>E</dd></dl>
</body>
</html> |
// This program is free software: you can redistribute it and/or modify
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
using System.IO;
using YamlDotNet.RepresentationModel;
namespace LoLAutoLogin.Utility
{
public class ClientSettings
{
internal string Locale { get; }
internal string Region { get; }
internal bool RemembersUsername { get; }
private ClientSettings(string locale, string region, bool remembersUsername)
{
Locale = locale;
Region = region;
RemembersUsername = remembersUsername;
}
internal static ClientSettings FromFile(string filePath)
{
Logger.Info($"Loading client info from \"{filePath}\"");
if (!File.Exists(filePath))
throw new <API key>();
YamlMappingNode root = Util.ReadYaml<YamlMappingNode>(filePath);
string locale = (root?["install"]?["globals"]?["locale"] as YamlScalarNode)?.Value;
string region = (root?["install"]?["globals"]?["region"] as YamlScalarNode)?.Value;
bool remembersUsername = bool.Parse((root?["install"]?["login-remember-me"]?["rememberMe"] as YamlScalarNode)?.Value);
return new ClientSettings(locale, region, remembersUsername);
}
}
} |
from .hooks import pre_init_hook
from . import models
from . import report |
package objenome.solution;
import objenome.goal.Between;
import objenome.goal.DecideNumericValue.DecideIntegerValue;
/**
*
* @author me
*/
public class SetIntegerValue extends SetConstantValue<Integer> implements SetNumericValue {
public SetIntegerValue(DecideIntegerValue d, @Between(min=0, max=1) double normalizedValue) {
super(d);
setNormalizedValue(normalizedValue);
}
@Override
public Integer getValue() {
return intValue();
}
@Override
public Integer getMin() {
return ((DecideIntegerValue)problem).min;
}
@Override
public Integer getMax() {
return ((DecideIntegerValue)problem).max;
}
public void setNormalizedValue(@Between(min=0, max=1) double v) {
setValue(v * (getMax() - getMin()) + getMin());
}
@Override
public void setValue(double d) {
this.set(d);
}
@Override
public Number getNumber() {
return getValue();
}
@Override
public void mutate() {
setValue( Math.random() * (getMax() - getMin()) + getMin() );
}
} |
import * as React from "react";
import { Pages_organization } from "./__generated__/Pages_organization.graphql";
import PageItem from "./PageItem";
type Props = {
memberGroupId: string;
pages: {
edges: Array<{
node: Pages_organization;
}>;
};
};
export default class PageList extends React.Component<Props> {
render() {
return (
<div>
{this.props.pages.edges.map((edge) => {
return (
<PageItem
key={edge.node.id}
memberGroupId={this.props.memberGroupId}
{...edge.node}
/>
);
})}
</div>
);
}
} |
package net.katk.model;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderColumn;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlIDREF;
/**
* A people group is an abstraction that aim at put together peoples.
*/
@Entity(name="party")
public class Party extends Common
{
@XmlIDREF
@ManyToOne(cascade=CascadeType.PERSIST,fetch=FetchType.LAZY)
@Column(name="boss")
private People _boss = null;
public People getBoss()
{
return _boss;
}
@XmlElement
@OneToMany @OrderColumn(name = "index_members")
private List<People> _members = new ArrayList<>(); // boss must also be a members.
public List<People> getMembers()
{
return _members;
}
@XmlIDREF
@ManyToOne(cascade=CascadeType.PERSIST,fetch=FetchType.LAZY)
@Column(name="admin")
private Party _admin = null;
public Party getAdmin()
{
return _admin;
}
@XmlElement
@OneToMany @OrderColumn(name = "index_children")
private List<Party> _children = new ArrayList<>();
public List<Party> getChidren()
{
return _children;
}
@XmlElement // StringVar[9]
@Column(name="rwxrwxrwx")
private String _rwxrwxrwx = "rwxrwxr_x";
public String getRwxrwxrwx()
{
return _rwxrwxrwx;
}
} |
DELETE FROM `weenie` WHERE `class_Id` = 30345;
INSERT INTO `weenie` (`class_Id`, `class_Name`, `type`, `last_Modified`)
VALUES (30345, '<API key>', 3, '2019-02-10 00:00:00') /* MissileLauncher */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (30345, 1, 256) /* ItemType - MissileWeapon */
, (30345, 5, 400) /* EncumbranceVal */
, (30345, 9, 4194304) /* ValidLocations - MissileWeapon */
, (30345, 16, 1) /* ItemUseable - No */
, (30345, 19, 50000) /* Value */
, (30345, 50, 4) /* AmmoType - Atlatl */
, (30345, 51, 2) /* CombatUse - Missile */
, (30345, 93, 1044) /* PhysicsState - Ethereal, IgnoreCollisions, Gravity */
, (30345, 151, 2) /* HookType - Wall */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (30345, 22, True ) /* Inscribable */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (30345, 1, 'Dart-Flicker') /* Name */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (30345, 1, 0x02001370) /* Setup */
, (30345, 3, 0x20000014) /* SoundTable */
, (30345, 8, 0x06005BD0) /* Icon */
, (30345, 22, 0x3400002B) /* PhysicsEffectTable */
, (30345, 52, 0x06005B0C) /* IconUnderlay */
, (30345, 8001, 270762776) /* <API key> - Value, Usable, AmmoType, CombatUse, Wielder, ValidLocations, <API key>, Burden, HookType */
, (30345, 8002, 1) /* <API key> - IconUnderlay */
, (30345, 8003, 67108882) /* <API key> - Inscribable, Attackable, <API key> */
, (30345, 8005, 38945) /* <API key> - CSetup, Parent, STable, PeTable, Position */
, (30345, 8009, 1) /* <API key> - RightHand */;
INSERT INTO `<API key>` (`object_Id`, `position_Type`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`)
VALUES (30345, 8040, 0x016002AC, 90.63963, -26.6261, -0.071, 0.707043, 0.707043, -0.009465, -0.009465) /* <API key> */
/* @teleloc 0x016002AC [90.639630 -26.626100 -0.071000] 0.707043 0.707043 -0.009465 -0.009465 */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (30345, 8000, 0x80039778) /* <API key> */
, (30345, 8008, 0x501002FA) /* <API key> */; |
#ifndef <API key>
#define <API key>
#include <pthread.h>
#include <map>
#include <string>
#include "arch/compiler.hpp"
#include "config/args.hpp"
#include "arch/runtime/event_queue.hpp"
#include "arch/runtime/system_event.hpp"
#include "arch/runtime/message_hub.hpp"
#include "arch/runtime/coroutines.hpp"
#include "arch/io/blocker_pool.hpp"
#include "arch/io/timer_provider.hpp"
#include "arch/timer.hpp"
class linux_thread_t;
class os_signal_cond_t;
/* coro_runtime_t is borrowed from coroutines.hpp. Please only
construct one coro_runtime_t per thread. Coroutines can only be used
when a coro_runtime_t exists. It exists to take advantage of RAII. */
struct coro_runtime_t {
coro_runtime_t();
~coro_runtime_t();
#ifndef NDEBUG
void <API key>(std::map<std::string, size_t> *dest);
#endif
};
/* A thread pool represents a group of threads, each of which is associated with an
event queue. There is one thread pool per server. It is responsible for starting up
and shutting down the threads and event queues. */
class linux_thread_pool_t {
public:
linux_thread_pool_t(int worker_threads, bool do_set_affinity);
// When the process receives a SIGINT or SIGTERM, interrupt_message will be delivered to the
// same thread that initial_message was delivered to, and interrupt_message will be set to
// NULL. If you want to receive notification of further SIGINTs or SIGTERMs, you must call
// <API key>() again. Returns the previous value of interrupt_message.
static MUST_USE os_signal_cond_t *<API key>(os_signal_cond_t *interrupt_message);
// Blocks while threads are working. Only returns after shutdown() is called. initial_message
// is a thread message that will be delivered to thread zero after all of the event queues
// have been started; it is used to start the server's activity.
void run_thread_pool(<API key> *initial_message);
#ifndef NDEBUG
void <API key>();
#endif
// Shut down all the threads. Can be called from any thread.
void <API key>();
~linux_thread_pool_t();
private:
#ifndef NDEBUG
bool coroutine_summary;
#endif
static void *start_thread(void*);
#ifndef _WIN32
static void interrupt_handler(int signo, siginfo_t *siginfo, void *);
// Currently handles SIGSEGV and SIGBUS signals.
static void <API key>(int, siginfo_t *, void *) NORETURN;
#endif
spinlock_t <API key>;
os_signal_cond_t *interrupt_message;
// Used to signal the main thread for shutdown
volatile bool do_shutdown;
pthread_cond_t shutdown_cond;
pthread_mutex_t shutdown_cond_mutex;
// The number of threads to allocate for handling blocking calls
static const int <API key> = 2;
blocker_pool_t* <API key>;
public:
pthread_t pthreads[MAX_THREADS];
linux_thread_t *threads[MAX_THREADS];
// Cooperatively run a blocking function call using the <API key>
template <class Callable>
static void run_in_blocker_pool(const Callable &);
int n_threads;
bool do_set_affinity;
// Non-inlinable getters and setters for the thread local variables.
// See thread_local.hpp for an explanation of why these must not be
// inlined.
static linux_thread_pool_t *get_thread_pool();
static void set_thread_pool(linux_thread_pool_t *val);
static int get_thread_id();
static void set_thread_id(int val);
static linux_thread_t *get_thread();
static void set_thread(linux_thread_t *val);
private:
// The thread_pool that started the thread we are currently in
static THREAD_LOCAL linux_thread_pool_t *thread_pool;
// The ID of the thread we are currently in
static THREAD_LOCAL int thread_id;
// The event queue for the thread we are currently in (same as &thread_pool->threads[thread_id])
static THREAD_LOCAL linux_thread_t *thread;
DISABLE_COPYING(linux_thread_pool_t);
};
template <class Callable>
struct generic_job_t :
public blocker_pool_t::job_t
{
void run() {
(*fn)();
}
void done() {
// Now that the function is done, resume execution of the suspended task
suspended->notify_sometime();
}
const Callable *fn;
coro_t* suspended;
};
// Function to handle blocking calls in a separate thread pool
// This should be used for any calls that cannot otherwise be made non-blocking
template <class Callable>
void linux_thread_pool_t::run_in_blocker_pool(const Callable &fn)
{
if (get_thread_pool() != NULL) {
generic_job_t<Callable> job;
job.fn = &fn;
job.suspended = coro_t::self();
rassert(get_thread_pool()-><API key> != NULL,
"thread_pool_t::run_in_blocker_pool called while generic_thread_pool uninitialized");
get_thread_pool()-><API key>->do_job(&job);
// Give up execution, to be resumed when the done callback is made
coro_t::wait();
} else {
// Thread pool has not been created, just block the current thread, since we won't be
// screwing up any coroutines
fn();
}
}
class linux_thread_t :
public <API key>,
public <API key> {
public:
linux_thread_t(linux_thread_pool_t *parent_pool, int thread_id);
~linux_thread_t();
linux_event_queue_t queue;
linux_message_hub_t message_hub;
timer_handler_t timer_handler;
/* Never accessed; its constructor and destructor set up and tear down thread-local variables
for coroutines. */
coro_runtime_t coro_runtime;
void pump(); // Called by the event queue
bool should_shut_down(); // Called by the event queue
#ifndef NDEBUG
void initiate_shut_down(std::map<std::string, size_t> *coroutine_counts); // Can be called from any thread
#else
void initiate_shut_down(); // Can be called from any thread
#endif
void on_event(int events);
private:
volatile bool do_shutdown;
pthread_mutex_t do_shutdown_mutex;
system_event_t <API key>;
#ifndef NDEBUG
std::map<std::string, size_t> *<API key>;
#endif
};
#endif /* <API key> */ |
GtkFrame.frame_default {
border: 0px;
padding: 0px;
border-radius: 16px;
background-color: #5c7dbe;
}
GtkFrame.frame_bet {
border: 6px solid;
border-color: #c1c0bf;
border-radius: 24px;
background-color: white;
box-shadow: 2px 2px 4px black inset;
padding: 25px;
}
.font_bet {
color: #47423f;
font-size: 44px;
font-weight: bold;
}
GtkFrame.frame_shadow {
border: 0px;
padding: 0px 4px 4px 0px;
border-radius: 16px;
background-color: #47423F;
}
.font_default {
color: white;
font-size: 42px;
text-shadow: 2px 2px 2px black;
}
GtkFrame.frame_grid {
border: 8px solid #c1c0bf;
border-radius: 32px;
background-image: -gtk-gradient (linear,
left top, right bottom,
from(#9d9a99), to(#d6d5d4));
box-shadow: 2px 2px 2px grey inset;
}
GtkGrid.frame_grid > GtkImage {
box-shadow: 2px 2px 2px grey inset;
}
GtkImage.grid_child_odd {
background-color: #ededeb;
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<style type="text/css" media="screen">
body, html, div {
padding: 0px;
margin: 0px;
border: 0px;
}
body, html {
height: 100%;
text-align: center;
}
html > body {
background: black;
}
</style>
<link rel="stylesheet" type="text/css" href="webodf.css"/>
<script src="lib/runtime.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
function init() {
runtime.loadClass("odf.OdfCanvas");
// if the url has a fragment (#...), try to load the file it represents
var location = String(document.location),
pos = location.indexOf('
odfelement = document.getElementById("odf");
document.odfcanvas = new odf.OdfCanvas(odfelement);
if (pos === -1 || !window) {
return;
}
location = location.substr(pos + 1);
document.odfcanvas.load(location);
}
window.setTimeout(init, 1);
</script>
<title></title>
</head>
<body>
<div id="odf"/>
</body>
</html> |
package ProjectTaskToDo::Schema::Result::TodolistUser;
# DO NOT MODIFY THE FIRST PART OF THIS FILE
use strict;
use warnings;
use Moose;
use MooseX::NonMoose;
use namespace::autoclean;
extends 'DBIx::Class::Core';
__PACKAGE__->load_components("InflateColumn::DateTime", "PK::Auto");
=head1 NAME
ProjectTaskToDo::Schema::Result::TodolistUser
=cut
__PACKAGE__->table("todolist_user");
=head1 ACCESSORS
=head2 id
data_type: 'bigint'
extra: {unsigned => 1}
is_auto_increment: 1
is_nullable: 0
=head2 todolist_id
data_type: 'mediumint'
is_nullable: 0
=head2 user_id
data_type: 'bigint'
extra: {unsigned => 1}
is_nullable: 0
=head2 role_id
data_type: 'mediumint'
is_nullable: 0
=head2 last_modified
data_type: 'timestamp'
default_value: current_timestamp
is_nullable: 0
=cut
__PACKAGE__->add_columns(
"id",
{
data_type => "bigint",
extra => { unsigned => 1 },
is_auto_increment => 1,
is_nullable => 0,
},
"todolist_id",
{ data_type => "mediumint", is_nullable => 0 },
"user_id",
{ data_type => "bigint", extra => { unsigned => 1 }, is_nullable => 0 },
"role_id",
{ data_type => "mediumint", is_nullable => 0 },
"last_modified",
{
data_type => "timestamp",
default_value => \"current_timestamp",
is_nullable => 0,
},
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__-><API key>("todolist_user_role", ["todolist_id", "user_id", "role_id"]);
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2dzl6/TdrgP0NAC+JN1Qcw
__PACKAGE__->meta->make_immutable;
1;
=head1 COPYRIGHT
Copyright (C) 2008 - 2015 William B. Hauck, http://wbhauck.com
=head1 LICENSE
This file is part of ProjectTaskToDo.
ProjectTaskToDo is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ProjectTaskToDo 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with ProjectTaskToDo. If not, see <http:
=cut |
package petascope.wcps2.translator;
/**
* Translator class for the extend operation in wcps
*
* @author <a href="mailto:alex@flanche.net">Alex Dumitru</a>
* @author <a href="mailto:vlad@flanche.net">Vlad Merticariu</a>
*/
public class ExtendExpression extends CoverageExpression {
/**
* Constructor for the class
*
* @param coverage the coverage to be extended
* @param <API key> a list of intervals to extend the coverage onto
*/
public ExtendExpression(CoverageExpression coverage, <API key> <API key>) {
this.coverage = coverage;
this.<API key> = <API key>;
setCoverage(coverage.getCoverage());
}
@Override
public String toRasql() {
return TEMPLATE.replace("$coverage", coverage.toRasql()).replace("$intervalList", <API key>.toRasql());
}
/**
* Getter for the coverage expression
*
* @return
*/
public CoverageExpression <API key>() {
return coverage;
}
/**
* Getter for the dimension interval list
*
* @return
*/
public <API key> <API key>() {
return <API key>;
}
private final CoverageExpression coverage;
private final <API key> <API key>;
private static String TEMPLATE = "extend($coverage, [$intervalList])";
} |
=begin
Camaleon CMS is a content management system
Copyright (C) 2015 by Owen Peredo Diaz
Email: owenperedo@gmail.com
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero 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 Affero General Public License (GPLv3) for more details.
=end
module CamaleonCms::Frontend::ApplicationHelper
include CamaleonCms::Frontend::SiteHelper
include CamaleonCms::Frontend::NavMenuHelper
include CamaleonCms::Frontend::SeoHelper
# add where conditionals to filter private/hidden/expired/drafts/unpublished
# note: only for post records
def <API key>(active_record)
active_record = active_record.visible_frontend
r = {active_record: active_record}
hooks_run("filter_post", r)
r[:active_record]
end
# fix for url_to or url_path or any other who need add automatically current locale in the url
# sample: cama_url_to_fixed("root_url", data: "asdasd", y: 12)
# note: if current locale is the default language, then locale is not added in the url
def cama_url_to_fixed(url_to, *args)
options = args.extract_options!
if request.present?
if options.include?(:locale) && options[:locale] == false
options.delete(:locale)
else
options[:locale] = I18n.locale if !options[:locale].present? && current_site.get_languages.size > 1
end
options[:locale] = nil if options[:locale].present? && current_site.get_languages.first.to_s == options[:locale].to_s
end
options.delete(:format) if PluginRoutes.system_info["skip_format_url"].present?
send(url_to.gsub('-', '_'), *(args << options))
end
end |
<?php
/**
* @see Zend_OpenId
*/
//$1 "Zend/OpenId.php";
/**
* @see <API key>
*/
//$1 "Zend/OpenId/Extension.php";
/**
* @see <API key>
*/
//$1 "Zend/OpenId/Consumer/Storage.php";
/**
* @see Zend_Http_Client
*/
//$1 'Zend/Http/Client.php';
class <API key>
{
/**
* Reference to an implementation of storage object
*
* @var <API key> $_storage
*/
protected $_storage = null;
/**
* Enables or disables consumer to use association with server based on
* Diffie-Hellman key agreement
*
* @var <API key> $_dumbMode
*/
protected $_dumbMode = false;
/**
* Internal cache to prevent unnecessary access to storage
*
* @var array $_cache
*/
protected $_cache = array();
/**
* HTTP client to make HTTP requests
*
* @var Zend_Http_Client $_httpClient
*/
private $_httpClient = null;
/**
* HTTP session to store climed_id between requests
*
* @var <API key> $_session
*/
private $_session = null;
/**
* Last error message for logi, check or verify failure
*
* @var string $_error
*/
private $_error = '';
/**
* Constructs a <API key> object with given $storage.
* Enables or disables future association with server based on
* Diffie-Hellman key agreement.
*
* @param <API key> $storage implementation of custom
* storage object
* @param bool $dumbMode Enables or disables consumer to use association
* with server based on Diffie-Hellman key agreement
*/
public function __construct(<API key> $storage = null,
$dumbMode = false)
{
if ($storage === null) {
//$1 "Zend/OpenId/Consumer/Storage/File.php";
$this->_storage = new <API key>();
} else {
$this->_storage = $storage;
}
$this->_dumbMode = $dumbMode;
}
/**
* Performs check (with possible user interaction) of OpenID identity.
*
* This is the first step of OpenID authentication process.
* On success the function does not return (it does HTTP redirection to
* server and exits). On failure it returns false.
*
* @param string $id OpenID identity
* @param string $returnTo URL to redirect response from server to
* @param string $root HTTP URL to identify consumer on server
* @param mixed $extensions extension object or array of extensions objects
* @param <API key> $response an optional response
* object to perform HTTP or HTML form redirection
* @return bool
*/
public function login($id, $returnTo = null, $root = null, $extensions = null,
<API key> $response = null)
{
return $this->_checkId(
false,
$id,
$returnTo,
$root,
$extensions,
$response);
}
/**
* Performs immediate check (without user interaction) of OpenID identity.
*
* This is the first step of OpenID authentication process.
* On success the function does not return (it does HTTP redirection to
* server and exits). On failure it returns false.
*
* @param string $id OpenID identity
* @param string $returnTo HTTP URL to redirect response from server to
* @param string $root HTTP URL to identify consumer on server
* @param mixed $extensions extension object or array of extensions objects
* @param <API key> $response an optional response
* object to perform HTTP or HTML form redirection
* @return bool
*/
public function check($id, $returnTo=null, $root=null, $extensions = null,
<API key> $response = null)
{
return $this->_checkId(
true,
$id,
$returnTo,
$root,
$extensions,
$response);
}
/**
* Verifies authentication response from OpenID server.
*
* This is the second step of OpenID authentication process.
* The function returns true on successful authentication and false on
* failure.
*
* @param array $params HTTP query data from OpenID server
* @param string &$identity this argument is set to end-user's claimed
* identifier or OpenID provider local identifier.
* @param mixed $extensions extension object or array of extensions objects
* @return bool
*/
public function verify($params, &$identity = "", $extensions = null)
{
$this->_setError('');
$version = 1.1;
if (isset($params['openid_ns']) &&
$params['openid_ns'] == Zend_OpenId::NS_2_0) {
$version = 2.0;
}
if (isset($params["openid_claimed_id"])) {
$identity = $params["openid_claimed_id"];
} else if (isset($params["openid_identity"])){
$identity = $params["openid_identity"];
} else {
$identity = "";
}
if ($version < 2.0 && !isset($params["openid_claimed_id"])) {
if ($this->_session !== null) {
if ($this->_session->identity === $identity) {
$identity = $this->_session->claimed_id;
}
} else if (defined('SID')) {
if (isset($_SESSION["zend_openid"]["identity"]) &&
isset($_SESSION["zend_openid"]["claimed_id"]) &&
$_SESSION["zend_openid"]["identity"] === $identity) {
$identity = $_SESSION["zend_openid"]["claimed_id"];
}
} else {
//$1 "Zend/Session/Namespace.php";
$this->_session = new <API key>("zend_openid");
if ($this->_session->identity === $identity) {
$identity = $this->_session->claimed_id;
}
}
}
if (empty($params['openid_mode'])) {
$this->_setError("Missing openid.mode");
return false;
}
if (empty($params['openid_return_to'])) {
$this->_setError("Missing openid.return_to");
return false;
}
if (empty($params['openid_signed'])) {
$this->_setError("Missing openid.signed");
return false;
}
if (empty($params['openid_sig'])) {
$this->_setError("Missing openid.sig");
return false;
}
if ($params['openid_mode'] != 'id_res') {
$this->_setError("Wrong openid.mode '".$params['openid_mode']."' != 'id_res'");
return false;
}
if (empty($params['openid_assoc_handle'])) {
$this->_setError("Missing openid.assoc_handle");
return false;
}
if ($params['openid_return_to'] != Zend_OpenId::selfUrl()) {
/* Ignore query part in openid.return_to */
$pos = strpos($params['openid_return_to'], '?');
if ($pos === false ||
SUBSTR($params['openid_return_to'], 0 , $pos) != Zend_OpenId::selfUrl()) {
$this->_setError("Wrong openid.return_to '".
$params['openid_return_to']."' != '" . Zend_OpenId::selfUrl() ."'");
return false;
}
}
if ($version >= 2.0) {
if (empty($params['<API key>'])) {
$this->_setError("Missing openid.response_nonce");
return false;
}
if (empty($params['openid_op_endpoint'])) {
$this->_setError("Missing openid.op_endpoint");
return false;
/* OpenID 2.0 (11.3) Checking the Nonce */
} else if (!$this->_storage->isUniqueNonce($params['openid_op_endpoint'], $params['<API key>'])) {
$this->_setError("Duplicate openid.response_nonce");
return false;
}
}
if (!empty($params['<API key>'])) {
if ($this->_storage-><API key>(
$params['<API key>'],
$url,
$macFunc,
$secret,
$expires)) {
$this->_storage->delAssociation($url);
}
}
if ($this->_storage-><API key>(
$params['openid_assoc_handle'],
$url,
$macFunc,
$secret,
$expires)) {
$signed = explode(',', $params['openid_signed']);
$data = '';
foreach ($signed as $key) {
$data .= $key . ':' . $params['openid_' . strtr($key,'.','_')] . "\n";
}
if (base64_decode($params['openid_sig']) ==
Zend_OpenId::hashHmac($macFunc, $data, $secret)) {
if (!<API key>::forAll($extensions, 'parseResponse', $params)) {
$this->_setError("Extension::parseResponse failure");
return false;
}
/* OpenID 2.0 (11.2) Verifying Discovered Information */
if (isset($params['openid_claimed_id'])) {
$id = $params['openid_claimed_id'];
if (!Zend_OpenId::normalize($id)) {
$this->_setError("Normalization failed");
return false;
} else if (!$this->_discovery($id, $discovered_server, $discovered_version)) {
$this->_setError("Discovery failed: " . $this->getError());
return false;
} else if ((!empty($params['openid_identity']) &&
$params["openid_identity"] != $id) ||
(!empty($params['openid_op_endpoint']) &&
$params['openid_op_endpoint'] != $discovered_server) ||
$discovered_version != $version) {
$this->_setError("Discovery information verification failed");
return false;
}
}
return true;
}
$this->_storage->delAssociation($url);
$this->_setError("Signature check failed");
return false;
}
else
{
/* Use dumb mode */
if (isset($params['openid_claimed_id'])) {
$id = $params['openid_claimed_id'];
} else if (isset($params['openid_identity'])) {
$id = $params['openid_identity'];
} else {
$this->_setError("Missing openid.claimed_id and openid.identity");
return false;
}
if (!Zend_OpenId::normalize($id)) {
$this->_setError("Normalization failed");
return false;
} else if (!$this->_discovery($id, $server, $discovered_version)) {
$this->_setError("Discovery failed: " . $this->getError());
return false;
}
/* OpenID 2.0 (11.2) Verifying Discovered Information */
if ((isset($params['openid_identity']) &&
$params["openid_identity"] != $id) ||
(isset($params['openid_op_endpoint']) &&
$params['openid_op_endpoint'] != $server) ||
$discovered_version != $version) {
$this->_setError("Discovery information verification failed");
return false;
}
$params2 = array();
foreach ($params as $key => $val) {
if (strpos($key, 'openid_ns_') === 0) {
$key = 'openid.ns.' . substr($key, strlen('openid_ns_'));
} else if (strpos($key, 'openid_sreg_') === 0) {
$key = 'openid.sreg.' . substr($key, strlen('openid_sreg_'));
} else if (strpos($key, 'openid_') === 0) {
$key = 'openid.' . substr($key, strlen('openid_'));
}
$params2[$key] = $val;
}
$params2['openid.mode'] = '<API key>';
$ret = $this->_httpRequest($server, 'POST', $params2, $status);
if ($status != 200) {
$this->_setError("'Dumb' signature verification HTTP request failed");
return false;
}
$r = array();
if (is_string($ret)) {
foreach(explode("\n", $ret) as $line) {
$line = trim($line);
if (!empty($line)) {
$x = explode(':', $line, 2);
if (is_array($x) && count($x) == 2) {
list($key, $value) = $x;
$r[trim($key)] = trim($value);
}
}
}
}
$ret = $r;
if (!empty($ret['invalidate_handle'])) {
if ($this->_storage-><API key>(
$ret['invalidate_handle'],
$url,
$macFunc,
$secret,
$expires)) {
$this->_storage->delAssociation($url);
}
}
if (isset($ret['is_valid']) && $ret['is_valid'] == 'true') {
if (!<API key>::forAll($extensions, 'parseResponse', $params)) {
$this->_setError("Extension::parseResponse failure");
return false;
}
return true;
}
$this->_setError("'Dumb' signature verification failed");
return false;
}
}
/**
* Store assiciation in internal chace and external storage
*
* @param string $url OpenID server url
* @param string $handle association handle
* @param string $macFunc HMAC function (sha1 or sha256)
* @param string $secret shared secret
* @param integer $expires expiration UNIX time
* @return void
*/
protected function _addAssociation($url, $handle, $macFunc, $secret, $expires)
{
$this->_cache[$url] = array($handle, $macFunc, $secret, $expires);
return $this->_storage->addAssociation(
$url,
$handle,
$macFunc,
$secret,
$expires);
}
/**
* Retrive assiciation information for given $url from internal cahce or
* external storage
*
* @param string $url OpenID server url
* @param string &$handle association handle
* @param string &$macFunc HMAC function (sha1 or sha256)
* @param string &$secret shared secret
* @param integer &$expires expiration UNIX time
* @return void
*/
protected function _getAssociation($url, &$handle, &$macFunc, &$secret, &$expires)
{
if (isset($this->_cache[$url])) {
$handle = $this->_cache[$url][0];
$macFunc = $this->_cache[$url][1];
$secret = $this->_cache[$url][2];
$expires = $this->_cache[$url][3];
return true;
}
if ($this->_storage->getAssociation(
$url,
$handle,
$macFunc,
$secret,
$expires)) {
$this->_cache[$url] = array($handle, $macFunc, $secret, $expires);
return true;
}
return false;
}
/**
* Performs HTTP request to given $url using given HTTP $method.
* Send additinal query specified by variable/value array,
* On success returns HTTP response without headers, false on failure.
*
* @param string $url OpenID server url
* @param string $method HTTP request method 'GET' or 'POST'
* @param array $params additional qwery parameters to be passed with
* @param int &$staus HTTP status code
* request
* @return mixed
*/
protected function _httpRequest($url, $method = 'GET', array $params = array(), &$status = null)
{
$client = $this->_httpClient;
if ($client === null) {
$client = new Zend_Http_Client(
$url,
array(
'maxredirects' => 4,
'timeout' => 15,
'useragent' => 'Zend_OpenId'
)
);
} else {
$client->setUri($url);
}
$client->resetParameters();
if ($method == 'POST') {
$client->setMethod(Zend_Http_Client::POST);
$client->setParameterPost($params);
} else {
$client->setMethod(Zend_Http_Client::GET);
$client->setParameterGet($params);
}
try {
$response = $client->request();
} catch (Exception $e) {
$this->_setError('HTTP Request failed: ' . $e->getMessage());
return false;
}
$status = $response->getStatus();
$body = $response->getBody();
if ($status == 200 || ($status == 400 && !empty($body))) {
return $body;
}else{
$this->_setError('Bad HTTP response');
return false;
}
}
/**
* Create (or reuse existing) association between OpenID consumer and
* OpenID server based on Diffie-Hellman key agreement. Returns true
* on success and false on failure.
*
* @param string $url OpenID server url
* @param float $version OpenID protocol version
* @param string $priv_key for testing only
* @return bool
*/
protected function _associate($url, $version, $priv_key=null)
{
/* Check if we already have association in chace or storage */
if ($this->_getAssociation(
$url,
$handle,
$macFunc,
$secret,
$expires)) {
return true;
}
if ($this->_dumbMode) {
/* Use dumb mode */
return true;
}
$params = array();
if ($version >= 2.0) {
$params = array(
'openid.ns' => Zend_OpenId::NS_2_0,
'openid.mode' => 'associate',
'openid.assoc_type' => 'HMAC-SHA256',
'openid.session_type' => 'DH-SHA256',
);
} else {
$params = array(
'openid.mode' => 'associate',
'openid.assoc_type' => 'HMAC-SHA1',
'openid.session_type' => 'DH-SHA1',
);
}
$dh = Zend_OpenId::createDhKey(pack('H*', Zend_OpenId::DH_P),
pack('H*', Zend_OpenId::DH_G),
$priv_key);
$dh_details = Zend_OpenId::getDhKeyDetails($dh);
$params['openid.dh_modulus'] = base64_encode(
Zend_OpenId::btwoc($dh_details['p']));
$params['openid.dh_gen'] = base64_encode(
Zend_OpenId::btwoc($dh_details['g']));
$params['openid.dh_consumer_public'] = base64_encode(
Zend_OpenId::btwoc($dh_details['pub_key']));
while(1) {
$ret = $this->_httpRequest($url, 'POST', $params, $status);
if ($ret === false) {
$this->_setError("HTTP request failed");
return false;
}
$r = array();
$bad_response = false;
foreach(explode("\n", $ret) as $line) {
$line = trim($line);
if (!empty($line)) {
$x = explode(':', $line, 2);
if (is_array($x) && count($x) == 2) {
list($key, $value) = $x;
$r[trim($key)] = trim($value);
} else {
$bad_response = true;
}
}
}
if ($bad_response && strpos($ret, 'Unknown session type') !== false) {
$r['error_code'] = 'unsupported-type';
}
$ret = $r;
if (isset($ret['error_code']) &&
$ret['error_code'] == 'unsupported-type') {
if ($params['openid.session_type'] == 'DH-SHA256') {
$params['openid.session_type'] = 'DH-SHA1';
$params['openid.assoc_type'] = 'HMAC-SHA1';
} else if ($params['openid.session_type'] == 'DH-SHA1') {
$params['openid.session_type'] = 'no-encryption';
} else {
$this->_setError("The OpenID service responded with: " . $ret['error_code']);
return false;
}
} else {
break;
}
}
if ($status != 200) {
$this->_setError("The server responded with status code: " . $status);
return false;
}
if ($version >= 2.0 &&
isset($ret['ns']) &&
$ret['ns'] != Zend_OpenId::NS_2_0) {
$this->_setError("Wrong namespace definition in the server response");
return false;
}
if (!isset($ret['assoc_handle']) ||
!isset($ret['expires_in']) ||
!isset($ret['assoc_type']) ||
$params['openid.assoc_type'] != $ret['assoc_type']) {
if ($params['openid.assoc_type'] != $ret['assoc_type']) {
$this->_setError("The returned assoc_type differed from the supplied openid.assoc_type");
} else {
$this->_setError("Missing required data from provider (assoc_handle, expires_in, assoc_type are required)");
}
return false;
}
$handle = $ret['assoc_handle'];
$expiresIn = $ret['expires_in'];
if ($ret['assoc_type'] == 'HMAC-SHA1') {
$macFunc = 'sha1';
} else if ($ret['assoc_type'] == 'HMAC-SHA256' &&
$version >= 2.0) {
$macFunc = 'sha256';
} else {
$this->_setError("Unsupported assoc_type");
return false;
}
if ((empty($ret['session_type']) ||
($version >= 2.0 && $ret['session_type'] == 'no-encryption')) &&
isset($ret['mac_key'])) {
$secret = base64_decode($ret['mac_key']);
} else if (isset($ret['session_type']) &&
$ret['session_type'] == 'DH-SHA1' &&
!empty($ret['dh_server_public']) &&
!empty($ret['enc_mac_key'])) {
$dhFunc = 'sha1';
} else if (isset($ret['session_type']) &&
$ret['session_type'] == 'DH-SHA256' &&
$version >= 2.0 &&
!empty($ret['dh_server_public']) &&
!empty($ret['enc_mac_key'])) {
$dhFunc = 'sha256';
} else {
$this->_setError("Unsupported session_type");
return false;
}
if (isset($dhFunc)) {
$serverPub = base64_decode($ret['dh_server_public']);
$dhSec = Zend_OpenId::computeDhSecret($serverPub, $dh);
if ($dhSec === false) {
$this->_setError("DH secret comutation failed");
return false;
}
$sec = Zend_OpenId::digest($dhFunc, $dhSec);
if ($sec === false) {
$this->_setError("Could not create digest");
return false;
}
$secret = $sec ^ base64_decode($ret['enc_mac_key']);
}
if ($macFunc == 'sha1') {
if (Zend_OpenId::strlen($secret) != 20) {
$this->_setError("The length of the sha1 secret must be 20");
return false;
}
} else if ($macFunc == 'sha256') {
if (Zend_OpenId::strlen($secret) != 32) {
$this->_setError("The length of the sha256 secret must be 32");
return false;
}
}
$this->_addAssociation(
$url,
$handle,
$macFunc,
$secret,
time() + $expiresIn);
return true;
}
/**
* Performs discovery of identity and finds OpenID URL, OpenID server URL
* and OpenID protocol version. Returns true on succees and false on
* failure.
*
* @param string &$id OpenID identity URL
* @param string &$server OpenID server URL
* @param float &$version OpenID protocol version
* @return bool
* @todo OpenID 2.0 (7.3) XRI and Yadis discovery
*/
protected function _discovery(&$id, &$server, &$version)
{
$realId = $id;
if ($this->_storage->getDiscoveryInfo(
$id,
$realId,
$server,
$version,
$expire)) {
$id = $realId;
return true;
}
/* TODO: OpenID 2.0 (7.3) XRI and Yadis discovery */
/* HTML-based discovery */
$response = $this->_httpRequest($id, 'GET', array(), $status);
if ($status != 200 || !is_string($response)) {
return false;
}
if (preg_match(
'/<link[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid2.provider[ \t]*[^"\']*\\1[^>]*href=(["\'])([^"\']+)\\2[^>]*\/?>/i',
$response,
$r)) {
$version = 2.0;
$server = $r[3];
} else if (preg_match(
'/<link[^>]*href=(["\'])([^"\']+)\\1[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid2.provider[ \t]*[^"\']*\\3[^>]*\/?>/i',
$response,
$r)) {
$version = 2.0;
$server = $r[2];
} else if (preg_match(
'/<link[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid.server[ \t]*[^"\']*\\1[^>]*href=(["\'])([^"\']+)\\2[^>]*\/?>/i',
$response,
$r)) {
$version = 1.1;
$server = $r[3];
} else if (preg_match(
'/<link[^>]*href=(["\'])([^"\']+)\\1[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid.server[ \t]*[^"\']*\\3[^>]*\/?>/i',
$response,
$r)) {
$version = 1.1;
$server = $r[2];
} else {
return false;
}
if ($version >= 2.0) {
if (preg_match(
'/<link[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid2.local_id[ \t]*[^"\']*\\1[^>]*href=(["\'])([^"\']+)\\2[^>]*\/?>/i',
$response,
$r)) {
$realId = $r[3];
} else if (preg_match(
'/<link[^>]*href=(["\'])([^"\']+)\\1[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid2.local_id[ \t]*[^"\']*\\3[^>]*\/?>/i',
$response,
$r)) {
$realId = $r[2];
}
} else {
if (preg_match(
'/<link[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid.delegate[ \t]*[^"\']*\\1[^>]*href=(["\'])([^"\']+)\\2[^>]*\/?>/i',
$response,
$r)) {
$realId = $r[3];
} else if (preg_match(
'/<link[^>]*href=(["\'])([^"\']+)\\1[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid.delegate[ \t]*[^"\']*\\3[^>]*\/?>/i',
$response,
$r)) {
$realId = $r[2];
}
}
$expire = time() + 60 * 60;
$this->_storage->addDiscoveryInfo($id, $realId, $server, $version, $expire);
$id = $realId;
return true;
}
/**
* Performs check of OpenID identity.
*
* This is the first step of OpenID authentication process.
* On success the function does not return (it does HTTP redirection to
* server and exits). On failure it returns false.
*
* @param bool $immediate enables or disables interaction with user
* @param string $id OpenID identity
* @param string $returnTo HTTP URL to redirect response from server to
* @param string $root HTTP URL to identify consumer on server
* @param mixed $extensions extension object or array of extensions objects
* @param <API key> $response an optional response
* object to perform HTTP or HTML form redirection
* @return bool
*/
protected function _checkId($immediate, $id, $returnTo=null, $root=null,
$extensions=null, <API key> $response = null)
{
$this->_setError('');
if (!Zend_OpenId::normalize($id)) {
$this->_setError("Normalisation failed");
return false;
}
$claimedId = $id;
if (!$this->_discovery($id, $server, $version)) {
$this->_setError("Discovery failed: " . $this->getError());
return false;
}
if (!$this->_associate($server, $version)) {
$this->_setError("Association failed: " . $this->getError());
return false;
}
if (!$this->_getAssociation(
$server,
$handle,
$macFunc,
$secret,
$expires)) {
/* Use dumb mode */
unset($handle);
unset($macFunc);
unset($secret);
unset($expires);
}
$params = array();
if ($version >= 2.0) {
$params['openid.ns'] = Zend_OpenId::NS_2_0;
}
$params['openid.mode'] = $immediate ?
'checkid_immediate' : 'checkid_setup';
$params['openid.identity'] = $id;
$params['openid.claimed_id'] = $claimedId;
if ($version <= 2.0) {
if ($this->_session !== null) {
$this->_session->identity = $id;
$this->_session->claimed_id = $claimedId;
} else if (defined('SID')) {
$_SESSION["zend_openid"] = array(
"identity" => $id,
"claimed_id" => $claimedId);
} else {
//$1 "Zend/Session/Namespace.php";
$this->_session = new <API key>("zend_openid");
$this->_session->identity = $id;
$this->_session->claimed_id = $claimedId;
}
}
if (isset($handle)) {
$params['openid.assoc_handle'] = $handle;
}
$params['openid.return_to'] = Zend_OpenId::absoluteUrl($returnTo);
if (empty($root)) {
$root = Zend_OpenId::selfUrl();
if ($root[strlen($root)-1] != '/') {
$root = dirname($root);
}
}
if ($version >= 2.0) {
$params['openid.realm'] = $root;
} else {
$params['openid.trust_root'] = $root;
}
if (!<API key>::forAll($extensions, 'prepareRequest', $params)) {
$this->_setError("Extension::prepareRequest failure");
return false;
}
Zend_OpenId::redirect($server, $params, $response);
return true;
}
/**
* Sets HTTP client object to make HTTP requests
*
* @param Zend_Http_Client $client HTTP client object to be used
*/
public function setHttpClient($client) {
$this->_httpClient = $client;
}
/**
* Returns HTTP client object that will be used to make HTTP requests
*
* @return Zend_Http_Client
*/
public function getHttpClient() {
return $this->_httpClient;
}
/**
* Sets session object to store climed_id
*
* @param <API key> $session HTTP client object to be used
*/
public function setSession(<API key> $session) {
$this->_session = $session;
}
/**
* Returns session object that is used to store climed_id
*
* @return <API key>
*/
public function getSession() {
return $this->_session;
}
/**
* Saves error message
*
* @param string $message error message
*/
protected function _setError($message)
{
$this->_error = $message;
}
/**
* Returns error message that explains failure of login, check or verify
*
* @return string
*/
public function getError()
{
return $this->_error;
}
} |
"""
Test for LMS instructor background task queue management
"""
from mock import patch, Mock
from bulk_email.models import CourseEmail, SEND_TO_ALL
from courseware.tests.factories import UserFactory
from xmodule.modulestore.exceptions import ItemNotFoundError
from instructor_task.api import (
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>
)
from instructor_task.api_helper import AlreadyRunningError
from instructor_task.models import InstructorTask, PROGRESS
from instructor_task.tests.test_base import (<API key>,
<API key>,
<API key>,
TestReportMixin,
TEST_COURSE_KEY)
from certificates.models import CertificateStatuses, <API key>
class <API key>(<API key>):
"""
Tests API methods that involve the reporting of status for background tasks.
"""
def <API key>(self):
# when fetching running tasks, we get all running tasks, and only running tasks
for _ in range(1, 5):
self.<API key>()
self.<API key>()
progress_task_ids = [self.<API key>().task_id for _ in range(1, 5)]
task_ids = [instructor_task.task_id for instructor_task in <API key>(TEST_COURSE_KEY)]
self.assertEquals(set(task_ids), set(progress_task_ids))
def <API key>(self):
# when fetching historical tasks, we get all tasks, including running tasks
expected_ids = []
for _ in range(1, 5):
expected_ids.append(self.<API key>().task_id)
expected_ids.append(self.<API key>().task_id)
expected_ids.append(self.<API key>().task_id)
task_ids = [instructor_task.task_id for instructor_task
in <API key>(TEST_COURSE_KEY, usage_key=self.problem_url)]
self.assertEquals(set(task_ids), set(expected_ids))
# make the same call using explicit task_type:
task_ids = [instructor_task.task_id for instructor_task
in <API key>(
TEST_COURSE_KEY,
usage_key=self.problem_url,
task_type='rescore_problem'
)]
self.assertEquals(set(task_ids), set(expected_ids))
# make the same call using a non-existent task_type:
task_ids = [instructor_task.task_id for instructor_task
in <API key>(
TEST_COURSE_KEY,
usage_key=self.problem_url,
task_type='dummy_type'
)]
self.assertEquals(set(task_ids), set())
class <API key>(<API key>):
"""Tests API methods that involve the submission of module-based background tasks."""
def setUp(self):
super(<API key>, self).setUp()
self.initialize_course()
self.student = UserFactory.create(username="student", email="student@edx.org")
self.instructor = UserFactory.create(username="instructor", email="instructor@edx.org")
def <API key>(self):
# confirm that a rescore of a non-existent module returns an exception
problem_url = <API key>.problem_location("NonexistentProblem")
request = None
with self.assertRaises(ItemNotFoundError):
<API key>(request, problem_url, self.student)
with self.assertRaises(ItemNotFoundError):
<API key>(request, problem_url)
with self.assertRaises(ItemNotFoundError):
<API key>(request, problem_url)
with self.assertRaises(ItemNotFoundError):
<API key>(request, problem_url)
def <API key>(self):
# confirm that a rescore of an existent but unscorable module returns an exception
# (Note that it is easier to test a scoreable but non-rescorable module in test_tasks,
# where we are creating real modules.)
problem_url = self.problem_section.location
request = None
with self.assertRaises(NotImplementedError):
<API key>(request, problem_url, self.student)
with self.assertRaises(NotImplementedError):
<API key>(request, problem_url)
def <API key>(self, task_function, student=None):
problem_url_name = 'x' * 255
self.<API key>(problem_url_name)
location = <API key>.problem_location(problem_url_name)
with self.assertRaises(ValueError):
if student is not None:
task_function(self.create_task_request(self.instructor), location, student)
else:
task_function(self.create_task_request(self.instructor), location)
def <API key>(self):
self.<API key>(<API key>)
def <API key>(self):
self.<API key>(<API key>, self.student)
def <API key>(self):
self.<API key>(<API key>)
def <API key>(self):
self.<API key>(<API key>)
def _test_submit_task(self, task_function, student=None):
# tests submit, and then tests a second identical submission.
problem_url_name = 'H1P1'
self.<API key>(problem_url_name)
location = <API key>.problem_location(problem_url_name)
if student is not None:
instructor_task = task_function(self.create_task_request(self.instructor), location, student)
else:
instructor_task = task_function(self.create_task_request(self.instructor), location)
# test resubmitting, by updating the existing record:
instructor_task = InstructorTask.objects.get(id=instructor_task.id)
instructor_task.task_state = PROGRESS
instructor_task.save()
with self.assertRaises(AlreadyRunningError):
if student is not None:
task_function(self.create_task_request(self.instructor), location, student)
else:
task_function(self.create_task_request(self.instructor), location)
def <API key>(self):
self._test_submit_task(<API key>)
def <API key>(self):
self._test_submit_task(<API key>, self.student)
def <API key>(self):
self._test_submit_task(<API key>)
def <API key>(self):
self._test_submit_task(<API key>)
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message'))
class <API key>(TestReportMixin, <API key>):
"""Tests API methods that involve the submission of course-based background tasks."""
def setUp(self):
super(<API key>, self).setUp()
self.initialize_course()
self.student = UserFactory.create(username="student", email="student@edx.org")
self.instructor = UserFactory.create(username="instructor", email="instructor@edx.org")
def <API key>(self):
"""Create CourseEmail object for testing."""
course_email = CourseEmail.create(self.course.id, self.instructor, SEND_TO_ALL, "Test Subject", "<p>This is a test message</p>")
return course_email.id
def _test_resubmission(self, api_call):
"""
Tests the resubmission of an instructor task through the API.
The call to the API is a lambda expression passed via
`api_call`. Expects that the API call returns the resulting
InstructorTask object, and that its resubmission raises
`AlreadyRunningError`.
"""
instructor_task = api_call()
instructor_task = InstructorTask.objects.get(id=instructor_task.id)
instructor_task.task_state = PROGRESS
instructor_task.save()
with self.assertRaises(AlreadyRunningError):
api_call()
def <API key>(self):
email_id = self.<API key>()
api_call = lambda: <API key>(
self.create_task_request(self.instructor),
self.course.id,
email_id
)
self._test_resubmission(api_call)
def <API key>(self):
api_call = lambda: <API key>(
self.create_task_request(self.instructor),
self.course.id,
problem_location=''
)
self._test_resubmission(api_call)
def <API key>(self):
api_call = lambda: <API key>(
self.create_task_request(self.instructor),
self.course.id,
features=[]
)
self._test_resubmission(api_call)
def <API key>(self):
api_call = lambda: <API key>(self.create_task_request(self.instructor),
self.course.id)
self._test_resubmission(api_call)
def <API key>(self):
api_call = lambda: <API key>(
self.create_task_request(self.instructor), self.course.id
)
self._test_resubmission(api_call)
def <API key>(self):
api_call = lambda: <API key>(
self.create_task_request(self.instructor), self.course.id
)
self._test_resubmission(api_call)
def <API key>(self):
api_call = lambda: <API key>(
self.create_task_request(self.instructor),
self.course.id,
features=[]
)
self._test_resubmission(api_call)
def <API key>(self):
api_call = lambda: <API key>(
self.create_task_request(self.instructor),
self.course.id,
file_name=u'filename.csv'
)
self._test_resubmission(api_call)
def <API key>(self):
"""
Tests certificates generation task submission api
"""
api_call = lambda: <API key>(
self.create_task_request(self.instructor),
self.course.id
)
self._test_resubmission(api_call)
def <API key>(self):
"""
Tests certificates regeneration task submission api
"""
def api_call():
"""
wrapper method for <API key>
"""
return <API key>(
self.create_task_request(self.instructor),
self.course.id,
[CertificateStatuses.downloadable, CertificateStatuses.generating]
)
self._test_resubmission(api_call)
def <API key>(self):
"""
Tests that a new record is added whenever certificate generation/regeneration task is submitted.
"""
instructor_task = <API key>(
self.create_task_request(self.instructor),
self.course.id
)
<API key> = <API key>.objects.filter(
course_id=self.course.id,
generated_by=self.instructor,
instructor_task=instructor_task,
is_regeneration=False
)
# Validate that record was added to <API key>
self.assertTrue(<API key>.exists())
instructor_task = <API key>(
self.create_task_request(self.instructor),
self.course.id,
[CertificateStatuses.downloadable, CertificateStatuses.generating]
)
<API key> = <API key>.objects.filter(
course_id=self.course.id,
generated_by=self.instructor,
instructor_task=instructor_task,
is_regeneration=True
)
# Validate that record was added to <API key>
self.assertTrue(<API key>.exists()) |
package cn.dlb.bim.models.ifc2x3tc1;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Ifc Feature Element Subtraction</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link cn.dlb.bim.models.ifc2x3tc1.<API key>#getVoidsElements <em>Voids Elements</em>}</li>
* </ul>
*
* @see cn.dlb.bim.models.ifc2x3tc1.Ifc2x3tc1Package#<API key>()
* @model
* @generated
*/
public interface <API key> extends IfcFeatureElement {
/**
* Returns the value of the '<em><b>Voids Elements</b></em>' reference.
* It is bidirectional and its opposite is '{@link cn.dlb.bim.models.ifc2x3tc1.IfcRelVoidsElement#<API key> <em>Related Opening Element</em>}'.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Voids Elements</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Voids Elements</em>' reference.
* @see #isSetVoidsElements()
* @see #unsetVoidsElements()
* @see #setVoidsElements(IfcRelVoidsElement)
* @see cn.dlb.bim.models.ifc2x3tc1.Ifc2x3tc1Package#<API key>()
* @see cn.dlb.bim.models.ifc2x3tc1.IfcRelVoidsElement#<API key>
* @model opposite="<API key>" unsettable="true"
* @generated
*/
IfcRelVoidsElement getVoidsElements();
/**
* Sets the value of the '{@link cn.dlb.bim.models.ifc2x3tc1.<API key>#getVoidsElements <em>Voids Elements</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Voids Elements</em>' reference.
* @see #isSetVoidsElements()
* @see #unsetVoidsElements()
* @see #getVoidsElements()
* @generated
*/
void setVoidsElements(IfcRelVoidsElement value);
/**
* Unsets the value of the '{@link cn.dlb.bim.models.ifc2x3tc1.<API key>#getVoidsElements <em>Voids Elements</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetVoidsElements()
* @see #getVoidsElements()
* @see #setVoidsElements(IfcRelVoidsElement)
* @generated
*/
void unsetVoidsElements();
/**
* Returns whether the value of the '{@link cn.dlb.bim.models.ifc2x3tc1.<API key>#getVoidsElements <em>Voids Elements</em>}' reference is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Voids Elements</em>' reference is set.
* @see #unsetVoidsElements()
* @see #getVoidsElements()
* @see #setVoidsElements(IfcRelVoidsElement)
* @generated
*/
boolean isSetVoidsElements();
} // <API key> |
package com.stratelia.webactiv.servlets;
import com.stratelia.silverpeas.peasCore.SessionManager;
import com.stratelia.silverpeas.silvertrace.SilverTrace;
import javax.servlet.ServletContextEvent;
import javax.servlet.<API key>;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
/**
* @author sv To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class SilverListener implements HttpSessionListener, <API key> {
// HttpSessionListener methods
@Override
public void sessionCreated(HttpSessionEvent event) {
}
@Override
public void sessionDestroyed(HttpSessionEvent event) {
remove(event);
}
// <API key> methods
@Override
public void contextDestroyed(ServletContextEvent event) {
SilverTrace.info("peasCore", "SilverListener.contextDestroyed",
"peasCore.<API key>");
SessionManager.getInstance().shutdown();
}
@Override
public void contextInitialized(ServletContextEvent event) {
}
// Clear session informations
private void remove(HttpSessionEvent event) {
SessionManager mgr = SessionManager.getInstance();
mgr.closeSession(event.getSession().getId());
SilverTrace.info("peasCore", "SilverListener.sessionDestroyed",
"peasCore.<API key>", "ID=" + event.getSession().getId());
}
} |
#!/usr/bin/env bash
cd /var/www
/home/vagrant/.rvm/wrappers/epiclogger/bundle install
/home/vagrant/.rvm/wrappers/epiclogger/rake db:migrate
/home/vagrant/.rvm/wrappers/epiclogger/bundler exec rails s -d -b 0.0.0.0
/home/vagrant/.rvm/wrappers/epiclogger/bundler exec sidekiq -d -L sidekiq.log -q mailer,5 -q default
exit 0 |
Factory.define :section do |f|
f.title "Articles"
end |
package org.yamcs.tctm;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.nio.ByteBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yamcs.<API key>;
import org.yamcs.YConfiguration;
import org.yamcs.archive.PacketWithTime;
import com.google.common.util.concurrent.<API key>;
import org.yamcs.utils.CcsdsPacket;
import org.yamcs.utils.TimeEncoding;
/**
* Receives telemetry packets via multicast from TMR. The nice thing about multicast is that there is no
* connection required so the code can be fairly simple.
* Keeps simple statistics about the number of datagram received and the number of too short datagrams
* @author nm
*
*/
public class MulticastTmDataLink extends <API key> implements TmPacketDataLink {
private volatile int validDatagramCount = 0;
private volatile int <API key> = 0;
private volatile boolean disabled=false;
private volatile boolean quitting=false;
private MulticastSocket tmSocket;
private String group="239.192.0.1";
private int port=31002;
private TmSink tmSink;
private Logger log=LoggerFactory.getLogger(this.getClass().getName());
final int maxLength=1500; //maximum length of tm packets in columbus is 1472
DatagramPacket datagram = new DatagramPacket(new byte[maxLength], maxLength);
/**
* Creates a
* @param spec
* @throws <API key> if tmGroup or tmPort are not defined in the configuration files
*/
public MulticastTmDataLink(String instance, String name, String spec) throws <API key> {
YConfiguration c=YConfiguration.getConfiguration("multicast");
group=c.getString(spec, "tmGroup");
port=c.getInt(spec, "tmPort");
try {
openSocket();
} catch (IOException e) {
throw new <API key>("IOException caught when opening the multicast socket: "+e);
}
}
/**
* Creates a simple multicast receiver listening to the given group and port
* @param group
* @param port
* @throws IOException if there was an exception opening the port (happends when there is alredy another process bound
* to that port and the option REUSE_ADDR is not set on its socket)
*/
public MulticastTmDataLink(String group, int port) throws IOException {
this.group=group;
this.port=port;
openSocket();
}
private void openSocket() throws IOException {
tmSocket=new MulticastSocket(port);
tmSocket.joinGroup(InetAddress.getByName(group));
}
@Override
public void setTmSink(TmSink tmSink) {
this.tmSink=tmSink;
}
@Override
public void run() {
while(!quitting) {
PacketWithTime pwrt=getNextPacket();
tmSink.processPacket(pwrt);
}
}
/**
*
* Called to retrieve the next packet.
* It blocks in readining on the multicast socket
* @return anything that looks as a valid packet, just the size is taken into account to decide if it's valid or not
*/
public PacketWithTime getNextPacket() {
ByteBuffer packet = null;
while(disabled) {
try {
Thread.sleep(1000);
} catch (<API key> e) {
return null;
}
}
long rectime=TimeEncoding.INVALID_INSTANT;
while (isRunning()) {
try {
tmSocket.receive(datagram);
/*the packet received from TMR has a 10 bytes header followed by the CCSDS packet:
* some kind of identification always 0x0B for TM and 06 for PP - 1 byte - the list with all the packet types can be found in the <API key>.java part of the DaSS API
* ccsds time - 5 bytes
* requestId (always set to 0 (I guess only for multicast) - 4 bytes
* ccsds packet
*
* The time in the "TMR header" is the reception time. It looks like the CCSDS GPS but is generated locally so it's UNIX time in fact
*/
if(datagram.getLength()<26) { //10 for the TMR header plus 6 for the primary CCSDS header plus 10 for secondary CCSDS header
log.warn("Incomplete packet received on the multicast, discarded: {}", datagram);
continue;
}
byte[] data = datagram.getData();
int offset = datagram.getOffset();
ByteBuffer bb = ByteBuffer.wrap(data);
//the time sent by TMR is not really GPS, it's the unix local computer time shifted to GPS epoch
long unixTimesec=(0xFFFFFFFFL & (long)bb.getInt(offset+1))+315964800L;
int unixTimeMicrosec=(0xFF&bb.get(offset+5))*(1000000/256);
rectime = TimeEncoding.fromUnixTime(unixTimesec, unixTimeMicrosec);
int pktLength = 7+((data[14+offset]&0xFF)<<8)+(data[15+offset]&0xFF);
if(pktLength<16) {
<API key>++;
log.warn("Invalid packet received on the multicast, pktLength: {}. Expecting minimum 16 bytes", pktLength);
continue;
}
if(datagram.getLength()<10+pktLength) {
<API key>++;
log.warn("Incomplete packet received on the multicast. expected {}, received: {}", pktLength, (datagram.getLength()-10));
continue;
}
validDatagramCount++;
packet = ByteBuffer.allocate(pktLength);
packet.put(data, offset+10, pktLength);
break;
} catch (IOException e) {
log.warn("exception {} thrown when reading from the multicast socket {}:{}", group, port, e);
}
}
if(packet!=null) {
return new PacketWithTime(rectime, CcsdsPacket.getInstant(packet), packet.array());
} else {
return null;
}
}
@Override
public String getLinkStatus() {
return disabled?"DISABLED":"OK";
}
/**
* returns statistics with the number of datagram received and the number of invalid datagrams
*/
@Override
public String getDetailedStatus() {
if(disabled) {
return "DISABLED";
} else {
return String.format("OK (%s:%d)%nValid datagrams received: %d%nInvalid datagrams received: %d",
group, port, validDatagramCount, <API key>);
}
}
/**
* Sets the disabled to true such that getNextPacket ignores the received datagrams
*/
@Override
public void disable() {
disabled=true;
}
/**
* Sets the disabled to false such that getNextPacket does not ignore the received datagrams
*/
@Override
public void enable() {
disabled=false;
}
@Override
public boolean isDisabled() {
return disabled;
}
@Override
public long getDataCount() {
return validDatagramCount;
}
} |
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class <API key> extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql("UPDATE phpbb_config SET config_value = '4' WHERE config_name = 'default_style'");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
}
} |
<?php
namespace Fusio\Impl\Table\Generated;
class RoutesResponseRow extends \PSX\Record\Record
{
public function setId(?int $id) : void
{
$this->setProperty('id', $id);
}
public function getId() : ?int
{
return $this->getProperty('id');
}
public function setMethodId(?int $methodId) : void
{
$this->setProperty('method_id', $methodId);
}
public function getMethodId() : ?int
{
return $this->getProperty('method_id');
}
public function setCode(?int $code) : void
{
$this->setProperty('code', $code);
}
public function getCode() : ?int
{
return $this->getProperty('code');
}
public function setResponse(?string $response) : void
{
$this->setProperty('response', $response);
}
public function getResponse() : ?string
{
return $this->getProperty('response');
}
} |
package org.kuali.kfs.module.cam.batch.dataaccess.impl;
import org.apache.ojb.broker.query.Criteria;
import org.apache.ojb.broker.query.QueryFactory;
import org.apache.ojb.broker.query.<API key>;
import org.kuali.kfs.module.cam.<API key>;
import org.kuali.kfs.module.cam.batch.dataaccess.<API key>;
import org.kuali.kfs.module.cam.businessobject.<API key>;
import org.kuali.kfs.sys.util.<API key>;
import org.kuali.rice.core.framework.persistence.ojb.dao.<API key>;
import java.math.BigDecimal;
import java.util.Iterator;
public class <API key> extends <API key> implements <API key> {
public Integer <API key>(String documentNumber, Integer <API key>) {
Criteria criteria = new Criteria();
criteria.addEqualTo(<API key>.<API key>.DOCUMENT_NUMBER, documentNumber);
criteria.addEqualTo(<API key>.<API key>.<API key>, <API key>);
<API key> query = QueryFactory.newReportQuery(<API key>.class, criteria);
query.setAttributes(new String[]{"max(" + <API key>.<API key>.<API key> + ")"});
Iterator<?> iterator = <API key>().<API key>(query);
Integer maxSequenceNumber = Integer.valueOf(0);
if (iterator.hasNext()) {
Object[] data = (Object[]) <API key>.<API key>(iterator);
if (data[0] != null) {
maxSequenceNumber = ((BigDecimal) data[0]).intValue();
}
}
return maxSequenceNumber;
}
} |
<?php
// created: 2017-10-10 15:19:35
$mod_strings = array (
'LBL_ASSIGNED_TO_ID' => 'Assigned User Id',
'<API key>' => 'Assigned to',
'LBL_SECURITYGROUPS' => 'Security Groups',
'<API key>' => 'Security Groups',
'LBL_ID' => 'ID',
'LBL_DATE_ENTERED' => 'Date Created',
'LBL_DATE_MODIFIED' => 'Date Modified',
'LBL_MODIFIED' => 'Modified By',
'LBL_MODIFIED_ID' => 'Modified By Id',
'LBL_MODIFIED_NAME' => 'Modified By Name',
'LBL_CREATED' => 'Created By',
'LBL_CREATED_ID' => 'Created By Id',
'LBL_DESCRIPTION' => 'Description',
'LBL_DELETED' => 'Deleted',
'LBL_NAME' => 'Name',
'LBL_CREATED_USER' => 'Created by User',
'LBL_MODIFIED_USER' => 'Modified by User',
'LBL_LIST_NAME' => 'Name',
'LBL_EDIT_BUTTON' => 'Edit',
'LBL_REMOVE' => 'Remove',
'LBL_LIST_FORM_TITLE' => ' List',
'LBL_MODULE_NAME' => NULL,
'LBL_MODULE_TITLE' => NULL,
'LBL_HOMEPAGE_TITLE' => 'My ',
'LNK_NEW_RECORD' => 'Create ',
'LNK_LIST' => 'View ',
'<API key>' => 'Импорт ',
'<API key>' => ' ',
'<API key>' => 'View History',
'<API key>' => 'Activities',
'<API key>' => NULL,
'LBL_NEW_FORM_TITLE' => 'New ',
'LBL_BH_MARKETING_COMPANY_BH_MARKETING_RESPONSE_1_FROM_BH_MARKETING_RESPONSE_TITLE' => 'Отклик на маркетинговую компанию',
'LBL_BH_MARKETING_COMPANY_BH_MARKETING_DIRECTORATE_1_FROM_BH_MARKETING_DIRECTORATE_TITLE' => 'Ректорат маркетингового воздействия',
'LBL_BH_MARKETING_COMPANY_BH_MARKETING_COMPANY_HISTORY_1_FROM_BH_MARKETING_COMPANY_HISTORY_TITLE' => 'История маркетинговой компании',
'<API key>' => 'Каналы воздействия компании',
'<API key>' => 'Продукты компании',
'<API key>' => 'Обращения',
'<API key>' => 'Скрипты',
); |
package org.asqatasun.rules.rgaa32016;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.asqatasun.entity.audit.TestSolution;
import org.asqatasun.entity.audit.ProcessResult;
import org.asqatasun.rules.keystore.AttributeStore;
import org.asqatasun.rules.keystore.HtmlElementStore;
import static org.asqatasun.rules.keystore.MarkerStore.<API key>;
import static org.asqatasun.rules.keystore.MarkerStore.<API key>;
import org.asqatasun.rules.keystore.RemarkMessageStore;
import org.asqatasun.rules.rgaa32016.test.<API key>;
/**
* Unit test class for the implementation of the rule 1.6.7 of the referential RGAA 3.2016
*
* @author
*/
public class <API key> extends <API key> {
/**
* Default constructor
* @param testName
*/
public <API key> (String testName){
super(testName);
}
@Override
protected void <API key>() {
<API key>(
"org.asqatasun.rules.rgaa32016.Rgaa32016Rule010607");
}
@Override
protected void setUpWebResourceMap() {
addWebResource("Rgaa32016.Test.1.6.7-3NMI-01",
createParameter("Rules", <API key>, "informative-image"));
addWebResource("Rgaa32016.Test.1.6.7-3NMI-02");
addWebResource("Rgaa32016.Test.1.6.7-3NMI-03",
createParameter("Rules", <API key>, "informative-image"));
addWebResource("Rgaa32016.Test.1.6.7-3NMI-04");
addWebResource("Rgaa32016.Test.1.6.7-3NMI-05",
createParameter("Rules", <API key>, "informative-image"));
addWebResource("Rgaa32016.Test.1.6.7-3NMI-06");
addWebResource("Rgaa32016.Test.1.6.7-4NA-01");
addWebResource("Rgaa32016.Test.1.6.7-4NA-02");
addWebResource("Rgaa32016.Test.1.6.7-4NA-03");
addWebResource("Rgaa32016.Test.1.6.7-4NA-04",
createParameter("Rules", <API key>, "decorative-image"));
addWebResource("Rgaa32016.Test.1.6.7-4NA-05");
addWebResource("Rgaa32016.Test.1.6.7-4NA-06");
}
@Override
protected void setProcess() {
ProcessResult processResult = processPageTest("Rgaa32016.Test.1.6.7-3NMI-01");
<API key>(processResult, 1, 1);
<API key>(
processResult,
TestSolution.NEED_MORE_INFO,
RemarkMessageStore.<API key>,
HtmlElementStore.SVG_ELEMENT,
1,
new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "mock svg"),
new ImmutablePair(AttributeStore.ARIA_LABEL_ATTR, AttributeStore.<API key>));
processResult = processPageTest("Rgaa32016.Test.1.6.7-3NMI-02");
<API key>(processResult, 1, 1);
<API key>(
processResult,
TestSolution.NEED_MORE_INFO,
RemarkMessageStore.<API key>,
HtmlElementStore.SVG_ELEMENT,
1,
new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "mock svg"),
new ImmutablePair(AttributeStore.ARIA_LABEL_ATTR, AttributeStore.<API key>));
processResult = processPageTest("Rgaa32016.Test.1.6.7-3NMI-03");
<API key>(processResult, 1, 1);
<API key>(
processResult,
TestSolution.NEED_MORE_INFO,
RemarkMessageStore.<API key>,
HtmlElementStore.SVG_ELEMENT,
1,
new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, ""),
new ImmutablePair(AttributeStore.ARIA_LABEL_ATTR, "mock svg"));
processResult = processPageTest("Rgaa32016.Test.1.6.7-3NMI-04");
<API key>(processResult, 1, 1);
<API key>(
processResult,
TestSolution.NEED_MORE_INFO,
RemarkMessageStore.<API key>,
HtmlElementStore.SVG_ELEMENT,
1,
new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, ""),
new ImmutablePair(AttributeStore.ARIA_LABEL_ATTR, "mock svg"));
processResult = processPageTest("Rgaa32016.Test.1.6.7-3NMI-05");
<API key>(processResult, 1, 1);
<API key>(
processResult,
TestSolution.NEED_MORE_INFO,
RemarkMessageStore.<API key>,
HtmlElementStore.SVG_ELEMENT,
1,
new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "mock svg"),
new ImmutablePair(AttributeStore.ARIA_LABEL_ATTR, "svg label"));
processResult = processPageTest("Rgaa32016.Test.1.6.7-3NMI-06");
<API key>(processResult, 1, 1);
<API key>(
processResult,
TestSolution.NEED_MORE_INFO,
RemarkMessageStore.<API key>,
HtmlElementStore.SVG_ELEMENT,
1,
new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "mock svg"),
new ImmutablePair(AttributeStore.ARIA_LABEL_ATTR, "svg label"));
<API key>(processPageTest("Rgaa32016.Test.1.6.7-4NA-01"));
<API key>(processPageTest("Rgaa32016.Test.1.6.7-4NA-02"));
<API key>(processPageTest("Rgaa32016.Test.1.6.7-4NA-03"));
<API key>(processPageTest("Rgaa32016.Test.1.6.7-4NA-04"));
<API key>(processPageTest("Rgaa32016.Test.1.6.7-4NA-05"));
<API key>(processPageTest("Rgaa32016.Test.1.6.7-4NA-06"));
}
} |
/* larger canvas, spectrum + EQ visualization and other items */
background-position:50% 50%; /* (~109px) initial play button position
}*/
.sm2-inline-list .ui360-vis {
cursor:pointer
}
.ui360-vis a {
font:14px "helvetica neue",helvetica,monaco,lucida,terminal,monospace;
white-space:nowrap;
text-indent:0px; /* undo inline style */
top:46%; /* ehh. */
}
.sm2-inline-list .ui360-vis a {
line-height:198px;
top:auto;
}
/*.ui360-vis .sm2-360ui {
margin-left:-256px;
}*/
.ui360-vis .sm2-timing {
line-height:198px;
}
.ui360-vis .sm2-timing {
font:bold 24px "helvetica neue",helvetica,monaco,lucida,terminal,monospace;
color:#333;
text-align:center;
line-height:198px;
text-indent:0px;
}
.sm2-inline-list .ui360-vis,
.sm2-inline-list .ui360-vis .sm2-360ui {
margin-left:0px;
}
.sm2-inline-list .ui360-vis {
margin:8px 13px 7px 0px;
padding-left:0px;
background-position:50% 50%; /* initial play button position */
}
.sm2-inline-list .ui360-vis a {
position:absolute;
display:inline;
left:0px;
bottom:0px;
top:1px;
width:100%; /* 2px padding in box */
height:99%; /* dumb vertical hack */
*height:198px; /* IE is dumb. */
overflow:hidden;
font-size:small;
font-weight:300;
color:#333;
margin:0px;
padding:0px;
line-height:488px; /* bottom vertical alignment for text */
*line-height:480px; /* IE again */
text-align:center;
-moz-border-radius:0px;
-khtml-border-radius:0px;
border-radius:0px;
}
.sm2-inline-list .ui360 a:hover {
background-color:transparent; /* reset */
}
.sm2-inline-list .ui360-vis:hover .sm2-360ui,
.sm2-inline-list .ui360-vis a.sm2_link:hover,
.sm2-inline-list .ui360-vis a.sm2_link:active,
.sm2-inline-list .ui360-vis a.sm2_link:focus {
background-color:transparent;
}
.sm2-inline-list .ui360-vis:hover a.sm2_link {
background-color:#fafafa;
*background-color:transparent; /* eh, screw IE. */
}
/* Use a bigger loading image for this layout */
.ui360-vis .sm2-360btn {
width:48px;
height:48px;
margin-left:-24px;
margin-top:-24px;
}
.ui360-vis:hover .sm2-360btn {
/* show "play" anywhere on UI when hovering */
background:transparent url(<API key>.png) no-repeat 50% 50%;
_background:transparent url(360-button-vis-play.gif) no-repeat 50% 50%;
cursor:pointer;
}
.ui360-vis .sm2-360ui.sm2_paused .sm2-360btn {
background:transparent url(360-button-vis-play.png) no-repeat 50% 50%;
_background:transparent url(360-button-vis-play.gif) no-repeat 50% 50%;
cursor:pointer;
}
.ui360-vis .sm2-360btn-default:hover,
.ui360-vis .sm2-360ui.sm2_paused .sm2-360btn:hover {
background:transparent url(<API key>.png) no-repeat 50% 50%;
_background:transparent url(360-button-vis-play.gif) no-repeat 50% 50%;
cursor:pointer;
}
.ui360-vis .sm2-360ui.sm2_playing .sm2-360btn:hover,
.ui360-vis .sm2-360btn-playing:hover {
background:transparent url(<API key>.png) no-repeat 50% 50%;
_background:transparent url(<API key>.gif) no-repeat 50% 50%;
cursor:pointer;
}
.ui360-vis {
/* non-JS / before-loaded state */
background:transparent url(360-button-vis-play.png) no-repeat 50% 50%;
_background:transparent url(360-button-vis-play.gif) no-repeat 50% 50%; /* IE 6-only: special crap GIF */
}
.ui360-vis .sm2-360btn-default {
/* real button, post-loaded state */
background:transparent url(360-button-vis-play.png) no-repeat 50% 50%;
_background:transparent url(360-button-vis-play.gif) no-repeat 50% 50%; /* IE 6-only: special crap GIF */
}
.ui360-vis .sm2-360ui.sm2_dragging .sm2-360btn {
visibility: hidden;
} |
from django.urls import path
from . import dashboard_views
app_name = 'exam'
urlpatterns = [
path('assignment/new/', dashboard_views.MakeAssignmentView.as_view(),
name='assignment_new'),
path('assignment/success/',
dashboard_views.<API key>.as_view(),
name='assignment_success'),
path('assignment/<int:assignment_id>/name_list/',
dashboard_views.<API key>.as_view(),
name='<API key>'),
] |
/*global OpManagerFactory, IWidget, updateLayout, Wirecloud */
(function () {
"use strict";
var Dragboard = function Dragboard(tab, workspace, dragboardElement) {
// PRIVATE VARIABLES
this.currentCode = 1;
// HTML Elements
this.dragboardElement = document.getElementById('dragboard');
this.barElement = document.getElementById('bar');
// Atributes
this.iWidgets = {};
this.tab = tab;
this.workspace = workspace;
this.parseTab(tab.tabInfo);
};
Dragboard.prototype.paint = function (iWidgetId) {
var opManager, iWidget;
opManager = OpManagerFactory.getInstance();
iWidget = this.getIWidget(iWidgetId);
opManager.alternatives.showAlternative(opManager.<API key>);
opManager.globalDragboard.show(iWidget.alternative);
opManager.visibleLayer = "dragboard";
updateLayout();
};
Dragboard.prototype.parseTab = function (tabInfo) {
var curIWidget, iwidget, widget, i,
container, opManager = OpManagerFactory.getInstance();
this.currentCode = 1;
this.iWidgets = {};
// For controlling when the iwidgets are totally loaded!
this.iwidgets = tabInfo.iwidgets;
for (i = 0; i < this.iwidgets.length; i += 1) {
curIWidget = this.iwidgets[i];
// Get widget model
widget = this.workspace.resources.getOrCreateMissing(curIWidget.widget, 'widget');
// Create instance model
container = opManager.globalDragboard.newIWidgetContainer();
iwidget = new IWidget(widget, curIWidget.id, curIWidget.code, curIWidget.title, this, container, curIWidget);
this.iWidgets[curIWidget.id] = iwidget;
if (curIWidget.code >= this.currentCode) {
this.currentCode = curIWidget.code + 1;
}
}
};
Dragboard.prototype.destroy = function () {
var key;
//disconect and delete the connectables and variables of all tab iWidgets
for (key in this.iWidgets) {
this.iWidgets[key].destroy();
}
this.iWidgets = null;
};
Dragboard.prototype.getIWidgets = function () {
return Wirecloud.Utils.values(this.iWidgets);
};
Dragboard.prototype.getIWidget = function (iWidgetId) {
return this.iWidgets[iWidgetId];
};
Dragboard.prototype._updateIWidgetInfo = function (iWidget) {
OpManagerFactory.getInstance().globalDragboard._updateIWidgetInfo(iWidget);
this.workspace.updateVisibleTab(this.tab.index);
};
window.Dragboard = Dragboard;
})(); |
#include "harness.h"
#include "catalog/catalog.h"
#include "catalog/cluster.h"
#include "catalog/constraint.h"
#include "catalog/database.h"
#include "catalog/table.h"
#include "common/tabletuple.h"
#include "common/valuevector.h"
#include "expressions/abstractexpression.h"
#include "indexes/tableindex.h"
#include "plannodes/abstractplannode.h"
#include "storage/persistenttable.h"
#include "storage/tablefactory.h"
#include "storage/tableiterator.h"
#include "storage/temptable.h"
#include "storage/tableutil.h"
#include "test_utils/LoadTableFrom.hpp"
#include "test_utils/<API key>.h"
#include <cstdlib>
#include <ctime>
#include <unistd.h>
#include <boost/shared_ptr.hpp>
#define NUM_OF_COLUMNS 4
#define NUM_OF_TUPLES 10 //must be multiples of 2 for Update test.
// Define the column information for the main test table
// This is useful because it will allow us to check different types and other
// configurations without having to dig down into the code
voltdb::ValueType COLUMN_TYPES[NUM_OF_COLUMNS] = { voltdb::VALUE_TYPE_INTEGER,
voltdb::VALUE_TYPE_VARCHAR,
voltdb::VALUE_TYPE_VARCHAR,
voltdb::VALUE_TYPE_INTEGER };
int COLUMN_SIZES[NUM_OF_COLUMNS] = { 4, 8, 8, 4};
bool COLUMN_ALLOW_NULLS[NUM_OF_COLUMNS] = { false, true, true, false };
/*
* The schema for this catalog can be found in the
* sql file voltdb/tests/frontend/org/voltdb/planner/testplans-eng10022.sql.
* To generate it, start voltdb and load that schema into the database.
* The file voltdbroot/config_log/catalog.jar will contain a file
* named catalog.txt, whose contents are this string. It will need some
* cleanup in emacs to make it suitable to be a C++ string.
* All that will be needed is to escape double quotes with a backslash,
* and surround each line with unescaped double quotes. But you
* knew that already.
*/
const char *catalog_string =
"add / clusters cluster\n"
"set /clusters#cluster localepoch 1199145600\n"
"set $PREV securityEnabled false\n"
"set $PREV httpdportno 0\n"
"set $PREV jsonapi false\n"
"set $PREV networkpartition false\n"
"set $PREV voltRoot \"\"\n"
"set $PREV exportOverflow \"\"\n"
"set $PREV drOverflow \"\"\n"
"set $PREV adminport 0\n"
"set $PREV adminstartup false\n"
"set $PREV heartbeatTimeout 0\n"
"set $PREV useddlschema false\n"
"set $PREV drConsumerEnabled false\n"
"set $PREV drProducerEnabled false\n"
"set $PREV drClusterId 0\n"
"set $PREV drProducerPort 0\n"
"set $PREV drMasterHost \"\"\n"
"set $PREV drFlushInterval 0\n"
"add /clusters#cluster databases database\n"
"set /clusters#cluster/databases#database schema \"eJylU1tuwzAM+99pbIn043N1nPsfabJRtGtXdYmLIFFgWSJFgVAKiEiAEuwbIWjj3w52KEm10x0bSJEgxd75vMqjAhJSTT0jMeXEbDXo2IkRSevdpD30SKiU2aUb+jawc0oxS9JURpSiokGhRepTbTPmS5X8NtQANeZz8ifOt7sMc6rNcITVai82Zx06uPOPbNXLFx6ktVQfUCxXAjep7xmNltvRffF90D+ApnW3GaPFo/CyDN/<API key>/JnPTB7LHpg1i55YFR+7gF3/<API key>\"\n"
"set $PREV isActiveActiveDRed false\n"
"add /clusters#cluster/databases#database groups administrator\n"
"set $PREV securityprovider \"\"\n"
"set /clusters#cluster/databases#database/groups#administrator admin true\n"
"set $PREV defaultproc true\n"
"set $PREV defaultprocread true\n"
"set $PREV sql true\n"
"set $PREV sqlread true\n"
"set $PREV allproc true\n"
"add /clusters#cluster/databases#database groups user\n"
"set /clusters#cluster/databases#database/groups#user admin false\n"
"set $PREV defaultproc true\n"
"set $PREV defaultprocread true\n"
"set $PREV sql true\n"
"set $PREV sqlread true\n"
"set $PREV allproc true\n"
"add /clusters#cluster/databases#database tables D_CUSTOMER\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER isreplicated false\n"
"set $PREV partitioncolumn /clusters#cluster/databases#database/tables#D_CUSTOMER/columns#D_CUSTOMERID\n"
"set $PREV estimatedtuplecount 0\n"
"set $PREV materializer null\n"
"set $PREV signature \"D_CUSTOMER|ivvi\"\n"
"set $PREV tuplelimit 2147483647\n"
"set $PREV isDRed false\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER columns D_CUSTOMERID\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/columns#D_CUSTOMERID index 0\n"
"set $PREV type 5\n"
"set $PREV size 4\n"
"set $PREV nullable false\n"
"set $PREV name \"D_CUSTOMERID\"\n"
"set $PREV defaultvalue null\n"
"set $PREV defaulttype 0\n"
"set $PREV matview null\n"
"set $PREV aggregatetype 0\n"
"set $PREV matviewsource null\n"
"set $PREV inbytes false\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER columns D_FIRSTNAME\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/columns#D_FIRSTNAME index 1\n"
"set $PREV type 9\n"
"set $PREV size 2048\n"
"set $PREV nullable true\n"
"set $PREV name \"D_FIRSTNAME\"\n"
"set $PREV defaultvalue null\n"
"set $PREV defaulttype 0\n"
"set $PREV matview null\n"
"set $PREV aggregatetype 0\n"
"set $PREV matviewsource null\n"
"set $PREV inbytes false\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER columns D_LASTNAME\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/columns#D_LASTNAME index 2\n"
"set $PREV type 9\n"
"set $PREV size 2048\n"
"set $PREV nullable true\n"
"set $PREV name \"D_LASTNAME\"\n"
"set $PREV defaultvalue null\n"
"set $PREV defaulttype 0\n"
"set $PREV matview null\n"
"set $PREV aggregatetype 0\n"
"set $PREV matviewsource null\n"
"set $PREV inbytes false\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER columns D_ZIPCODE\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/columns#D_ZIPCODE index 3\n"
"set $PREV type 5\n"
"set $PREV size 4\n"
"set $PREV nullable true\n"
"set $PREV name \"D_ZIPCODE\"\n"
"set $PREV defaultvalue null\n"
"set $PREV defaulttype 0\n"
"set $PREV matview null\n"
"set $PREV aggregatetype 0\n"
"set $PREV matviewsource null\n"
"set $PREV inbytes false\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER indexes D_TABLEINDEX1\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX1 unique false\n"
"set $PREV assumeUnique false\n"
"set $PREV countable true\n"
"set $PREV type 1\n"
"set $PREV expressionsjson \"\"\n"
"set $PREV predicatejson \"\"\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX1 columns D_CUSTOMERID\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX1/columns#D_CUSTOMERID index 0\n"
"set $PREV column /clusters#cluster/databases#database/tables#D_CUSTOMER/columns#D_CUSTOMERID\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER indexes D_TABLEINDEX2\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX2 unique true\n"
"set $PREV assumeUnique false\n"
"set $PREV countable true\n"
"set $PREV type 1\n"
"set $PREV expressionsjson \"\"\n"
"set $PREV predicatejson \"\"\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX2 columns D_CUSTOMERID\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX2/columns#D_CUSTOMERID index 0\n"
"set $PREV column /clusters#cluster/databases#database/tables#D_CUSTOMER/columns#D_CUSTOMERID\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX2 columns D_FIRSTNAME\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX2/columns#D_FIRSTNAME index 1\n"
"set $PREV column /clusters#cluster/databases#database/tables#D_CUSTOMER/columns#D_FIRSTNAME\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX2 columns D_LASTNAME\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX2/columns#D_LASTNAME index 2\n"
"set $PREV column /clusters#cluster/databases#database/tables#D_CUSTOMER/columns#D_LASTNAME\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER indexes D_TABLEINDEX3\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX3 unique false\n"
"set $PREV assumeUnique false\n"
"set $PREV countable true\n"
"set $PREV type 1\n"
"set $PREV expressionsjson \"\"\n"
"set $PREV predicatejson \"\"\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX3 columns D_FIRSTNAME\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX3/columns#D_FIRSTNAME index 0\n"
"set $PREV column /clusters#cluster/databases#database/tables#D_CUSTOMER/columns#D_FIRSTNAME\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX3 columns D_LASTNAME\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#D_TABLEINDEX3/columns#D_LASTNAME index 1\n"
"set $PREV column /clusters#cluster/databases#database/tables#D_CUSTOMER/columns#D_LASTNAME\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER indexes <API key>\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#<API key> unique true\n"
"set $PREV assumeUnique false\n"
"set $PREV countable true\n"
"set $PREV type 1\n"
"set $PREV expressionsjson \"\"\n"
"set $PREV predicatejson \"\"\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#<API key> columns D_CUSTOMERID\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#<API key>/columns#D_CUSTOMERID index 0\n"
"set $PREV column /clusters#cluster/databases#database/tables#D_CUSTOMER/columns#D_CUSTOMERID\n"
"add /clusters#cluster/databases#database/tables#D_CUSTOMER constraints <API key>\n"
"set /clusters#cluster/databases#database/tables#D_CUSTOMER/constraints#<API key> type 4\n"
"set $PREV oncommit \"\"\n"
"set $PREV index /clusters#cluster/databases#database/tables#D_CUSTOMER/indexes#<API key>\n"
"set $PREV foreignkeytable null\n"
"add /clusters#cluster/databases#database tables R_CUSTOMER\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER isreplicated true\n"
"set $PREV partitioncolumn null\n"
"set $PREV estimatedtuplecount 0\n"
"set $PREV materializer null\n"
"set $PREV signature \"R_CUSTOMER|ivvi\"\n"
"set $PREV tuplelimit 2147483647\n"
"set $PREV isDRed false\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER columns R_CUSTOMERID\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/columns#R_CUSTOMERID index 0\n"
"set $PREV type 5\n"
"set $PREV size 4\n"
"set $PREV nullable false\n"
"set $PREV name \"R_CUSTOMERID\"\n"
"set $PREV defaultvalue null\n"
"set $PREV defaulttype 0\n"
"set $PREV matview null\n"
"set $PREV aggregatetype 0\n"
"set $PREV matviewsource null\n"
"set $PREV inbytes false\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER columns R_FIRSTNAME\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/columns#R_FIRSTNAME index 1\n"
"set $PREV type 9\n"
"set $PREV size 2048\n"
"set $PREV nullable true\n"
"set $PREV name \"R_FIRSTNAME\"\n"
"set $PREV defaultvalue null\n"
"set $PREV defaulttype 0\n"
"set $PREV matview null\n"
"set $PREV aggregatetype 0\n"
"set $PREV matviewsource null\n"
"set $PREV inbytes false\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER columns R_LASTNAME\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/columns#R_LASTNAME index 2\n"
"set $PREV type 9\n"
"set $PREV size 2048\n"
"set $PREV nullable true\n"
"set $PREV name \"R_LASTNAME\"\n"
"set $PREV defaultvalue null\n"
"set $PREV defaulttype 0\n"
"set $PREV matview null\n"
"set $PREV aggregatetype 0\n"
"set $PREV matviewsource null\n"
"set $PREV inbytes false\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER columns R_ZIPCODE\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/columns#R_ZIPCODE index 3\n"
"set $PREV type 5\n"
"set $PREV size 4\n"
"set $PREV nullable true\n"
"set $PREV name \"R_ZIPCODE\"\n"
"set $PREV defaultvalue null\n"
"set $PREV defaulttype 0\n"
"set $PREV matview null\n"
"set $PREV aggregatetype 0\n"
"set $PREV matviewsource null\n"
"set $PREV inbytes false\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER indexes R_TABLEINDEX1\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX1 unique false\n"
"set $PREV assumeUnique false\n"
"set $PREV countable true\n"
"set $PREV type 1\n"
"set $PREV expressionsjson \"\"\n"
"set $PREV predicatejson \"\"\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX1 columns R_CUSTOMERID\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX1/columns#R_CUSTOMERID index 0\n"
"set $PREV column /clusters#cluster/databases#database/tables#R_CUSTOMER/columns#R_CUSTOMERID\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER indexes R_TABLEINDEX2\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX2 unique true\n"
"set $PREV assumeUnique false\n"
"set $PREV countable true\n"
"set $PREV type 1\n"
"set $PREV expressionsjson \"\"\n"
"set $PREV predicatejson \"\"\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX2 columns R_CUSTOMERID\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX2/columns#R_CUSTOMERID index 0\n"
"set $PREV column /clusters#cluster/databases#database/tables#R_CUSTOMER/columns#R_CUSTOMERID\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX2 columns R_FIRSTNAME\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX2/columns#R_FIRSTNAME index 1\n"
"set $PREV column /clusters#cluster/databases#database/tables#R_CUSTOMER/columns#R_FIRSTNAME\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX2 columns R_LASTNAME\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX2/columns#R_LASTNAME index 2\n"
"set $PREV column /clusters#cluster/databases#database/tables#R_CUSTOMER/columns#R_LASTNAME\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER indexes R_TABLEINDEX3\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX3 unique false\n"
"set $PREV assumeUnique false\n"
"set $PREV countable true\n"
"set $PREV type 1\n"
"set $PREV expressionsjson \"\"\n"
"set $PREV predicatejson \"\"\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX3 columns R_FIRSTNAME\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX3/columns#R_FIRSTNAME index 0\n"
"set $PREV column /clusters#cluster/databases#database/tables#R_CUSTOMER/columns#R_FIRSTNAME\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX3 columns R_LASTNAME\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#R_TABLEINDEX3/columns#R_LASTNAME index 1\n"
"set $PREV column /clusters#cluster/databases#database/tables#R_CUSTOMER/columns#R_LASTNAME\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER indexes <API key>\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#<API key> unique true\n"
"set $PREV assumeUnique false\n"
"set $PREV countable true\n"
"set $PREV type 1\n"
"set $PREV expressionsjson \"\"\n"
"set $PREV predicatejson \"\"\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#<API key> columns R_CUSTOMERID\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#<API key>/columns#R_CUSTOMERID index 0\n"
"set $PREV column /clusters#cluster/databases#database/tables#R_CUSTOMER/columns#R_CUSTOMERID\n"
"add /clusters#cluster/databases#database/tables#R_CUSTOMER constraints <API key>\n"
"set /clusters#cluster/databases#database/tables#R_CUSTOMER/constraints#<API key> type 4\n"
"set $PREV oncommit \"\"\n"
"set $PREV index /clusters#cluster/databases#database/tables#R_CUSTOMER/indexes#<API key>\n"
"set $PREV foreignkeytable null\n";
class ExecutionEngineTest : public <API key><EngineTestTopend> {
public:
ExecutionEngineTest() :
<API key><EngineTestTopend>(),
<API key>(NULL),
<API key>(-1),
<API key>(NULL),
<API key>(-1) {}
void initialize(const char *catalog_string,
uint32_t random_seed = (uint32_t)time(NULL)) {
<API key><EngineTestTopend>::initialize(catalog_string, random_seed);
<API key> = <API key>("D_CUSTOMER", &<API key>);
<API key> = <API key>("R_CUSTOMER", &<API key>);
// Fill in tuples. The IndexOrder test does not use
// the contents of the tables. The ExecutionEngineTest does
// use them, in a somewhat trivial way. It would be good if
// there was some way to fill these in deterministically.
// Random tuples make debugging unnecessarily difficult,
// especially if the random see is the time the test
// started.
ASSERT_TRUE(<API key>);
ASSERT_TRUE(voltdb::tableutil::addRandomTuples(<API key>, NUM_OF_TUPLES));
ASSERT_TRUE(<API key>);
ASSERT_TRUE(voltdb::tableutil::addRandomTuples(<API key>, NUM_OF_TUPLES));
}
protected:
voltdb::PersistentTable* <API key>;
int <API key>;
voltdb::Table* <API key>;
int <API key>;
};
// Create a random seed once and for all, and use it always.
uint32_t random_seed = 0;
/*
* Check the order of index vector.
*
* Index vector should follow the order of primary key first, all unique indices afterwards, and all the non-unique indices at the end.
*/
TEST_F(ExecutionEngineTest, IndexOrder) {
initialize(catalog_string, random_seed);
ASSERT_TRUE(<API key>->primaryKeyIndex() == <API key>->allIndexes()[0]);
ASSERT_TRUE(<API key>->allIndexes()[1]->isUniqueIndex());
ASSERT_FALSE(<API key>->allIndexes()[2]->isUniqueIndex());
ASSERT_FALSE(<API key>->allIndexes()[3]->isUniqueIndex());
}
// <API key>
// This plan is the plan generated from the query in the test
// org.voltdb.planner.TestPlansENG10022.testPlanENG10022. It
// can be generated with this onerously complicated procedure.
// 1. Run the test with the JVM command line parameter -Dmumble=compilerdebug.
// It doesn't matter what property name you use, mumble in this
// case. But the property value must be compilerdebug. An
// easy way to do this in Eclipse is to create a JRE configuration
// with -Dmumble=compilerdebug and run the testENG10022 test with
// this configuration. Perhaps setting VOLTDB_OPTS when running
// the ant target for the test works as well.
// 2. When the test runs there will be a folder called debugoutput
// wherever the test is run. In the Eclipse method above this will
// be the project folder, which is the root of the source folder.
// There you will find a file with name something like
// debugoutput/statement_plans/<API key>.txt.
// The contents of this file should be this string.
// 3. Some emacs cleanup will be required to paste this into
// the source code as a string. Escape double quotes and add
// initial double quotes, '\n' lines and terminal double quotes
// as usual.
namespace {
std::string plan =
"{\n"
" \"EXECUTE_LIST\": [\n"
" 2,\n"
" 1\n"
" ],\n"
" \"PLAN_NODES\": [\n"
" {\n"
" \"CHILDREN_IDS\": [2],\n"
" \"ID\": 1,\n"
" \"PLAN_NODE_TYPE\": \"SEND\"\n"
" },\n"
" {\n"
" \"ID\": 2,\n"
" \"INLINE_NODES\": [{\n"
" \"ID\": 3,\n"
" \"OUTPUT_SCHEMA\": [\n"
" {\n"
" \"COLUMN_NAME\": \"CID\",\n"
" \"EXPRESSION\": {\n"
" \"COLUMN_IDX\": 0,\n"
" \"TYPE\": 32,\n"
" \"VALUE_TYPE\": 5\n"
" }\n"
" },\n"
" {\n"
" \"COLUMN_NAME\": \"CID2\",\n"
" \"EXPRESSION\": {\n"
" \"LEFT\": {\n"
" \"ISNULL\": false,\n"
" \"TYPE\": 30,\n"
" \"VALUE\": 2,\n"
" \"VALUE_TYPE\": 5\n"
" },\n"
" \"RIGHT\": {\n"
" \"COLUMN_IDX\": 0,\n"
" \"TYPE\": 32,\n"
" \"VALUE_TYPE\": 5\n"
" },\n"
" \"TYPE\": 3,\n"
" \"VALUE_TYPE\": 6\n"
" }\n"
" }\n"
" ],\n"
" \"PLAN_NODE_TYPE\": \"PROJECTION\"\n"
" }],\n"
" \"LOOKUP_TYPE\": \"GTE\",\n"
" \"PLAN_NODE_TYPE\": \"INDEXSCAN\",\n"
" \"PURPOSE\": 3,\n"
" \"SORT_DIRECTION\": \"ASC\",\n"
" \"TARGET_INDEX_NAME\": \"<API key>\",\n"
" \"TARGET_TABLE_ALIAS\": \"R_CUSTOMER\",\n"
" \"TARGET_TABLE_NAME\": \"R_CUSTOMER\"\n"
" }\n"
" ]\n"
"}\n"
"\n";
}
namespace {
/*
* Set this to true to dump the result buffer as an
* array of bytes. This is very helpful to figure out
* problems with wire protocol understanding.
*/
bool debug_dump = false;
void dumpResultTable(const char *buffer, size_t size) {
const char *start = "";
const char *sep = "";
printf(" ");
for (int idx = 0; idx < 8; idx += 1) {
printf("%02d ", idx);
}
printf("\n");
for (int idx = 0; idx < 500 && idx < size; idx += 1) {
if (idx % 8 == 0) {
printf("%s%03d.) ", start, idx);
start = "\n";
sep = "";
}
printf("%s%02x", sep, 0xff & static_cast<unsigned int>(buffer[idx]));
sep = ", ";
}
printf("\n");
}
}
TEST_F(ExecutionEngineTest, <API key>) {
initialize(catalog_string, random_seed);
// Given a PlanFragmentInfo data object, make the m_engine execute it,
// and validate the results.
// Load the plan in the top end. We'll use fragmentId as
// a length one array below.
m_topend->addPlan(100, plan);
fragmentId_t fragmentId = 100;
// Make sure the parameter buffer is filled
// with healthful zeros, and then create an input
// deserializer.
memset(m_parameter_buffer.get(), 0, 4 * 1024);
voltdb::<API key> emptyParams(m_parameter_buffer.get(), 4 * 1024);
// Execute the plan. You'd think this would be more
// impressive.
m_engine-><API key>(1, &fragmentId, NULL, emptyParams, 1000, 1000, 1000, 1000, 1);
// Fetch the results. We have forced them to be written
// to our own buffer in the local engine. But we don't
// know how much of the buffer is actually used. So we
// need to query the engine.
size_t result_size = m_engine->getResultsSize();
if (debug_dump) {
dumpResultTable(m_result_buffer.get(), result_size);
}
boost::scoped_ptr<voltdb::TempTable> result(voltdb::loadTableFrom(m_result_buffer.get(), result_size));
assert(result.get() != NULL);
ASSERT_TRUE(result != NULL);
const voltdb::TupleSchema* res_schema = result->schema();
voltdb::TableTuple tuple(res_schema);
boost::scoped_ptr<voltdb::TableIterator> iter(result->makeIterator());
if (!iter->hasNext()) {
printf("No results!!\n");
}
int32_t count;
for (count = 0; iter->next(tuple); count += 1) {
/*
* This is true because of collusion between the query
* and the test. The query selects two values, both
* integral, and the second is twice the first.
*/
int64_t v0 = voltdb::ValuePeeker::peekAsBigInt(tuple.getNValue(0));
int64_t v1 = voltdb::ValuePeeker::peekAsBigInt(tuple.getNValue(1));
ASSERT_TRUE(2*v0 == v1);
}
if (debug_dump) {
printf("Success after inspecting %d rows\n", count);
}
}
int main() {
return TestSuite::globalInstance()->runAll();
} |
// How Level Up Tests Apollo Queries - Level Up Code Blog
// An example with 'apollo-link-state':
import { graphql } from 'graphql';
import { schema } from './FakeDataProvider';
// Takes a query and args and returns mocked data
const mockGraphql = async (query, args = {}) => {
try {
const res = await graphql(schema, query.loc.source.body, null, null, args);
return res.data;
} catch (e) {
console.log(e.message);
return { errors: e };
}
};
export default mockGraphql; |
<?php
umask(0117);
fopen('text.txt', 'a+');
?> |
// This program is free software: you can redistribute it and/or modify
// published by the Free Software Foundation, either version 3 of the
// This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// You should have received a copy of the GNU Affero General Public
#include "<API key>.h"
#include <QMimeData>
#include <QDebug>
#include "qutils.h"
#include <boost/foreach.hpp>
#include "options/optionboolean.h"
using namespace std;
<API key>::<API key>(QObject *parent)
: TableModel(parent)
{
_boundTo = NULL;
_terms.setSortParent(_variables);
}
QVariant <API key>::data(const QModelIndex &index, int role) const
{
if (_boundTo == NULL || index.isValid() == false)
return QVariant();
if (role == Qt::DisplayRole)
{
int colNo = index.column();
int rowNo = index.row();
Options *row = _rows.at(rowNo);
if (colNo == 0) {
OptionTerms *termOption = static_cast<OptionTerms *>(row->get(0));
Term t(termOption->value().front());
return t.asQString();
}
}
else if (role == Qt::CheckStateRole)
{
int colNo = index.column();
int rowNo = index.row();
Options *row = _rows.at(rowNo);
if (colNo == 1)
{
OptionBoolean *booleanOption = static_cast<OptionBoolean *>(row->get(1));
return booleanOption->value() ? Qt::Checked : Qt::Unchecked;
}
}
return QVariant();
}
int <API key>::rowCount(const QModelIndex &) const
{
if (_boundTo == NULL)
return 0;
return _rows.size();
}
int <API key>::columnCount(const QModelIndex &) const
{
if (_boundTo == NULL)
return 0;
return _boundTo->rowTemplate()->size();
}
bool <API key>::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (index.isValid() == false)
return false;
if (index.column() == 1 && role == Qt::CheckStateRole)
{
bool checked = value.toInt() == Qt::Checked;
Options *row = _rows.at(index.row());
OptionBoolean *booleanOption = static_cast<OptionBoolean *>(row->get(1));
booleanOption->setValue(checked);
updateNuisances(checked);
_boundTo->setValue(_rows);
return true;
}
return false;
}
QStringList <API key>::mimeTypes() const
{
QStringList types;
types << "application/vnd.list.term";
return types;
}
void <API key>::setVariables(const Terms &fixedFactors, const Terms &randomFactors, const Terms &covariates)
{
_fixedFactors = fixedFactors;
_randomFactors = randomFactors;
_covariates = covariates;
Terms all;
all.add(fixedFactors);
all.add(randomFactors);
all.add(covariates);
_variables.set(all);
emit <API key>();
}
const Terms &<API key>::variables() const
{
return _variables;
}
void <API key>::bindTo(Option *option)
{
_boundTo = dynamic_cast<OptionsTable *>(option);
beginResetModel();
_rows = _boundTo->value();
foreach (Options *row, _rows)
{
OptionTerm *nameOption = static_cast<OptionTerm*>(row->get(0));
vector<string> term = nameOption->term();
_terms.add(Term(term));
}
endResetModel();
}
void <API key>::unbind()
{
beginResetModel();
_boundTo = NULL;
_rows.clear();
endResetModel();
}
void <API key>::mimeDataMoved(const QModelIndexList &indexes)
{
// sort indices, and delete from end to beginning
QModelIndexList sorted = indexes;
qSort(sorted.begin(), sorted.end(), qGreater<QModelIndex>());
int lastRowDeleted = -1;
Terms terms = _terms;
Terms toRemove;
foreach (const QModelIndex &index, sorted)
{
int rowNo = index.row();
if (rowNo != lastRowDeleted)
{
toRemove.add(terms.at(index.row()));
terms.remove(index.row());
}
lastRowDeleted = rowNo;
}
foreach (const Term &rem, toRemove)
{
int i = 0;
while (i < terms.size())
{
const Term &term = terms.at(i);
if (term.containsAll(rem))
terms.remove(i);
else
i++;
}
}
setTerms(terms);
}
const Terms &<API key>::terms() const
{
return _terms;
}
void <API key>::addFixedFactors(const Terms &terms)
{
_fixedFactors.add(terms);
_variables.add(terms);
Terms existingTerms = _terms;
Terms newTerms = _terms;
newTerms.<API key>(_randomFactors);
newTerms.<API key>(_covariates);
existingTerms.add(newTerms.ffCombinations(terms));
setTerms(existingTerms);
emit <API key>();
}
void <API key>::addRandomFactors(const Terms &terms)
{
_randomFactors.add(terms);
_variables.add(terms);
Terms newTerms = _terms;
newTerms.add(terms);
setTerms(newTerms, true);
emit <API key>();
}
void <API key>::addCovariates(const Terms &terms)
{
_covariates.add(terms);
_variables.add(terms);
Terms newTerms = _terms;
newTerms.add(terms);
setTerms(newTerms);
emit <API key>();
}
void <API key>::removeVariables(const Terms &terms)
{
_variables.remove(terms);
_fixedFactors.remove(terms);
_randomFactors.remove(terms);
_covariates.remove(terms);
Terms newTerms = _terms;
newTerms.<API key>(terms);
setTerms(newTerms);
emit <API key>();
}
bool <API key>::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const
{
Q_UNUSED(action);
Q_UNUSED(row);
Q_UNUSED(column);
Q_UNUSED(parent);
if (mimeTypes().contains("application/vnd.list.term"))
{
QByteArray encodedData = data->data("application/vnd.list.term");
QDataStream stream(&encodedData, QIODevice::ReadOnly);
if (stream.atEnd())
return false;
return true;
}
return false;
}
bool <API key>::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent, int assignType)
{
if (action == Qt::IgnoreAction)
return true;
if ( ! canDropMimeData(data, action, row, column, parent))
return false;
if ( ! data->hasFormat("application/vnd.list.term"))
return false;
QByteArray encodedData = data->data("application/vnd.list.term");
Terms dropped;
dropped.setSortParent(_variables);
dropped.set(encodedData);
Terms newTerms;
switch (assignType)
{
case Cross:
newTerms = dropped.crossCombinations();
break;
case Interaction:
newTerms = dropped.wayCombinations(dropped.size());
break;
case MainEffects:
newTerms = dropped.wayCombinations(1);
break;
case All2Way:
newTerms = dropped.wayCombinations(2);
break;
case All3Way:
newTerms = dropped.wayCombinations(3);
break;
case All4Way:
newTerms = dropped.wayCombinations(4);
break;
case All5Way:
newTerms = dropped.wayCombinations(5);
break;
default:
(void)newTerms;
}
assign(newTerms);
return true;
}
bool <API key>::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
return dropMimeData(data, action, row, column, parent, Cross);
}
QMimeData *<API key>::mimeData(const QModelIndexList &indexes) const
{
/* returns dummy data. when the user drags entries away from this listbox
* it means that they're deleting entries, so there's no point populating
* this data object properly
*/
Q_UNUSED(indexes);
QMimeData *mimeData = new QMimeData();
QByteArray encodedData;
QDataStream dataStream(&encodedData, QIODevice::WriteOnly);
dataStream << 0;
mimeData->setData("application/vnd.list.term", encodedData);
return mimeData;
}
Qt::ItemFlags <API key>::flags(const QModelIndex &index) const
{
if (index.isValid())
{
if (index.column() == 0)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
else
return Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;
}
else
{
return Qt::ItemIsEnabled | Qt::ItemIsDropEnabled;
}
}
QVariant <API key>::headerData(int section, Qt::Orientation orientation, int role) const
{
if (orientation == Qt::Horizontal)
{
if (role == Qt::DisplayRole)
{
if (section == 0)
return "Model Terms";
else if (section == 1)
return "Is Nuisance";
}
else
{
if (section == 1 && role == Qt::SizeHintRole)
return QSize(50, -1);
}
}
return QVariant();
}
Qt::DropActions <API key>::<API key>() const
{
return Qt::CopyAction;
}
Qt::DropActions <API key>::<API key>() const
{
return Qt::MoveAction;
}
OptionTerm *<API key>::termOptionFromRow(Options *row)
{
return static_cast<OptionTerm *>(row->get(0));
}
void <API key>::setTerms(const Terms &terms, bool newTermsAreNuisance)
{
_terms.set(terms);
if (_boundTo == NULL)
return;
beginResetModel();
Terms::const_iterator itr;
vector<Options *>::iterator otr;
otr = _rows.begin();
while (otr != _rows.end())
{
Options *row = *otr;
OptionTerm *termCell = termOptionFromRow(row);
Term existingTerm = Term(termCell->term());
bool shouldRemove = true;
itr = terms.begin();
while (itr != terms.end())
{
const Term &term = *itr;
if (term == existingTerm)
{
shouldRemove = false;
break;
}
itr++;
}
if (shouldRemove)
{
_rows.erase(otr);
delete row;
}
else
{
otr++;
}
}
itr = terms.begin();
for (int i = 0; i < terms.size(); i++)
{
const Term &term = *itr;
if (i < _rows.size())
{
otr = _rows.begin();
otr += i;
Options *row = *otr;
OptionTerm *termCell = termOptionFromRow(row);
Term existingTerm = Term(termCell->term());
if (existingTerm != term)
{
Options *row = static_cast<Options *>(_boundTo->rowTemplate()->clone());
OptionTerms *termCell = static_cast<OptionTerms *>(row->get(0));
termCell->setValue(term.scomponents());
if (row->size() > 1 && newTermsAreNuisance)
{
OptionBoolean *nuisance = static_cast<OptionBoolean *>(row->get(1));
nuisance->setValue(true);
}
_rows.insert(otr, row);
}
}
else
{
Options *row = static_cast<Options *>(_boundTo->rowTemplate()->clone());
OptionTerms *termCell = static_cast<OptionTerms *>(row->get(0));
termCell->setValue(term.scomponents());
if (row->size() > 1 && newTermsAreNuisance)
{
OptionBoolean *nuisance = static_cast<OptionBoolean *>(row->get(1));
nuisance->setValue(true);
}
_rows.push_back(row);
}
itr++;
}
updateNuisances();
_boundTo->setValue(_rows);
endResetModel();
emit termsChanged();
}
void <API key>::clear()
{
setTerms(Terms());
}
void <API key>::assign(const Terms &terms)
{
Terms t = _terms;
t.add(terms);
setTerms(t);
}
void <API key>::updateNuisances(bool checked)
{
if (_rows.size() > 0)
{
Options *row = _rows.front();
if (row->size() < 2)
return; // no nuisance terms
}
// if a higher order interaction is specified as nuisance, then all lower order terms should be changed to nuisance as well
for (int i = 0; i < _rows.size(); i++)
{
Options *row = _rows.at(i);
OptionTerm *termOption = static_cast<OptionTerm*>(row->get(0));
OptionBoolean *nuisanceOption = static_cast<OptionBoolean*>(row->get(1));
Term term = Term(termOption->term());
if (nuisanceOption->value() == checked)
{
for (int j = 0; j < _rows.size(); j++)
{
if (i == j)
continue;
Options *r = _rows.at(j);
OptionTerm *tOption = static_cast<OptionTerm*>(r->get(0));
OptionBoolean *nOption = static_cast<OptionBoolean*>(r->get(1));
Term t = Term(tOption->term());
if (checked)
{
if (term.containsAll(t))
nOption->setValue(true);
}
else
{
if (t.containsAll(term))
nOption->setValue(false);
}
}
}
}
emit dataChanged(this->index(0,1), this->index(_rows.size() - 1, 1));
}
bool <API key>::piecesCanBeAssigned() const
{
return <API key>;
}
void <API key>::<API key>(bool piecesCanBeAssigned)
{
<API key> = piecesCanBeAssigned;
} |
package es.igosoftware.euclid.experimental.vectorial.rendering.symbolizer;
import es.igosoftware.euclid.IBoundedGeometry2D;
import es.igosoftware.euclid.ICurve2D;
import es.igosoftware.euclid.ISurface2D;
import es.igosoftware.euclid.bounding.<API key>;
import es.igosoftware.euclid.bounding.IFinite2DBounds;
import es.igosoftware.euclid.experimental.vectorial.rendering.context.IProjectionTool;
import es.igosoftware.euclid.experimental.vectorial.rendering.context.IVectorial2DDrawer;
import es.igosoftware.euclid.experimental.vectorial.rendering.context.<API key>;
import es.igosoftware.euclid.experimental.vectorial.rendering.symbols.GSymbol2DList;
import es.igosoftware.euclid.features.IGlobeFeature;
import es.igosoftware.euclid.features.<API key>;
import es.igosoftware.euclid.ntree.GGTNode;
import es.igosoftware.euclid.vector.IVector2;
import es.igosoftware.euclid.vector.IVectorI2;
public interface ISymbolizer2D {
/* general */
public boolean isDebugRendering();
public double getLODMinSize();
public boolean isRenderLODIgnores();
public void preprocessFeatures(final <API key><IVector2, ? extends IBoundedGeometry2D<? extends IFinite2DBounds<?>>> features);
public void preRender(final IVectorI2 renderExtent,
final IProjectionTool projectionTool,
final <API key> viewport,
final ISymbolizer2D symbolizer,
final IVectorial2DDrawer drawer);
public void postRender(final IVectorI2 renderExtent,
final IProjectionTool projectionTool,
final <API key> viewport,
final ISymbolizer2D symbolizer,
final IVectorial2DDrawer drawer);
public double <API key>(final <API key> scaler);
public boolean isClusterSymbols();
/* nodes */
public GSymbol2DList getNodeSymbols(final GGTNode<IVector2, IGlobeFeature<IVector2, ? extends IBoundedGeometry2D<? extends IFinite2DBounds<?>>>, IBoundedGeometry2D<? extends IFinite2DBounds<?>>> node,
final <API key> scaler);
/* point style */
public GSymbol2DList getPointSymbols(final IVector2 point,
final IGlobeFeature<IVector2, ? extends IBoundedGeometry2D<? extends IFinite2DBounds<?>>> feature,
final <API key> scaler);
/* curves */
public GSymbol2DList getCurveSymbols(final ICurve2D<? extends IFinite2DBounds<?>> curve,
final IGlobeFeature<IVector2, ? extends IBoundedGeometry2D<? extends IFinite2DBounds<?>>> feature,
final <API key> scaler);
/* surfaces */
public GSymbol2DList getSurfaceSymbols(final ISurface2D<? extends IFinite2DBounds<?>> surface,
final IGlobeFeature<IVector2, ? extends IBoundedGeometry2D<? extends IFinite2DBounds<?>>> feature,
final <API key> scaler);
} |
# = Informations
# Ekylibre - Simple agricultural ERP
# This program is free software: you can redistribute it and/or modify
# any later version.
# This program is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# == Table: listing_nodes
# attribute_name :string
# condition_operator :string
# condition_value :string
# created_at :datetime not null
# creator_id :integer
# depth :integer default(0), not null
# exportable :boolean default(TRUE), not null
# id :integer not null, primary key
# item_listing_id :integer
# <API key> :integer
# item_nature :string
# item_value :text
# key :string
# label :string not null
# lft :integer
# listing_id :integer not null
# lock_version :integer default(0), not null
# name :string not null
# nature :string not null
# parent_id :integer
# position :integer
# rgt :integer
# sql_type :string
# updated_at :datetime not null
# updater_id :integer
require 'test_helper'
class ListingNodeTest < ActiveSupport::TestCase
test_fixtures
end |
class <API key> < ActiveRecord::Migration[4.2]
def change
add_column :spending_proposals, :hidden_at, :datetime
end
end |
package com.cgi.eoss.fstep.orchestrator.service;
import static java.nio.file.StandardOpenOption.CREATE;
import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
import static java.nio.file.StandardOpenOption.WRITE;
import java.io.<API key>;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.OffsetDateTime;
import java.util.Optional;
import com.cgi.eoss.fstep.catalogue.CatalogueService;
import com.cgi.eoss.fstep.model.FstepService;
import com.cgi.eoss.fstep.model.<API key>.Parameter;
import com.cgi.eoss.fstep.model.Job;
import com.cgi.eoss.fstep.model.internal.OutputFileMetadata;
import com.cgi.eoss.fstep.model.internal.OutputFileMetadata.<API key>;
import com.cgi.eoss.fstep.model.internal.<API key>;
import com.cgi.eoss.fstep.model.internal.RetrievedOutputFile;
import com.cgi.eoss.fstep.rpc.FileStream;
import com.cgi.eoss.fstep.rpc.FileStreamClient;
import com.google.protobuf.Message;
import com.mysema.commons.lang.Pair;
import lombok.Getter;
import lombok.extern.log4j.Log4j2;
@Log4j2
public class <API key><T extends Message> extends FileStreamClient<T> {
private <API key> <API key>;
private Job job;
private CatalogueService catalogueService;
private Path filePath;
private OutputFileMetadata outputFileMetadata;
@Getter
private RetrievedOutputFile retrievedOutputFile;
public <API key>(CatalogueService catalogueService, <API key> <API key>, Job job, Path filePath) {
this.catalogueService = catalogueService;
this.<API key> = <API key>;
this.job=job;
this.filePath = filePath;
}
@Override
public OutputStream buildOutputStream(FileStream.FileMeta fileMeta) throws IOException {
LOG.info("Collecting output '{}' with filename {} ({} bytes)", <API key>.getOutputId(), fileMeta.getFilename(),
fileMeta.getSize());
<API key> <API key> = OutputFileMetadata.builder();
outputFileMetadata = <API key>.<API key>(<API key>).build();
setOutputPath(catalogueService.<API key>(<API key>, filePath.toString(), fileMeta.getSize()));
LOG.info("Writing output file for job {}: {}", job.getExtId(), getOutputPath());
return new <API key>(Files.newOutputStream(getOutputPath(), CREATE, TRUNCATE_EXISTING, WRITE));
}
@Override
public void onCompleted() {
super.onCompleted();
Pair<OffsetDateTime, OffsetDateTime> startEndDateTimes = <API key>(job.getConfig().getService(),
<API key>.getOutputId()).map(p-> <API key>.<API key>(p, getOutputPath().getFileName().toString())).orElseGet(() -> new Pair<>(null, null));
outputFileMetadata.setStartDateTime(startEndDateTimes.getFirst());
outputFileMetadata.setEndDateTime(startEndDateTimes.getSecond());
retrievedOutputFile = new RetrievedOutputFile(outputFileMetadata, getOutputPath());
}
private Optional<Parameter> <API key>(FstepService service, String outputId) {
return service.<API key>().getDataOutputs().stream().filter(p -> p.getId().equals(outputId))
.findFirst();
}
} |
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import DeviceUtil, { DeviceKind } from "../../Base/Util/DeviceUtil";
import DeviceComponent from "./DeviceComponent";
export interface OnChangeDevice { (deviceId: string, deviceName: string): void };
export class DeviceView {
private _textElement: HTMLInputElement;
private _listElement: HTMLElement;
private _devices: Array<MediaDeviceInfo>;
private _onChangeDevice: OnChangeDevice;
private _selectDeviceId: string;
private _deviceKind: DeviceKind;
/**
*
* @param deviceKind
* @param textElement
* @param listElement
* @param devices
* @param deviceSelector
*/
public constructor(deviceKind: DeviceKind, textElement: HTMLInputElement, listElement: HTMLElement, devices: Array<MediaDeviceInfo>, deviceSelector: OnChangeDevice) {
this._deviceKind = deviceKind;
this._textElement = textElement;
this._textElement.style.cursor = "pointer";
this._listElement = listElement;
this._devices = devices;
this._onChangeDevice = deviceSelector;
this.Create();
}
public Create() {
ReactDOM.render(<DeviceComponent owner={this} deviceList={this._devices} />, this._listElement, () => { });
}
/**
*
* @param deviceId
* @param deviceName
*/
public ChangeDevice(deviceId: string, deviceName: string) {
this._textElement.click();
this._selectDeviceId = deviceId;
this._textElement.value = deviceName;
if (this._onChangeDevice) {
this._onChangeDevice(deviceId, deviceName);
}
}
public SelectClear() {
this._selectDeviceId = "";
this._textElement.value = "";
if (this._onChangeDevice) {
this._onChangeDevice("", "");
}
}
public SelectFirstDevice() {
if (this._devices && this._devices.length > 0) {
this.SelectDeivce(this._devices[0].deviceId);
}
}
/**
*
* @param id
*/
public SelectDeivce(id: string) {
let name = DeviceUtil.GetDeviceName(this._deviceKind, id);
this._textElement.value = name;
if (this._onChangeDevice) {
this._onChangeDevice(id, name);
}
}
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link type="image/x-icon" href="../favicon.ico" rel="icon" />
<link href="../src/tamination.css" type="text/css" rel="stylesheet" />
<link href="../src/jquery-ui.css" rel="stylesheet" />
<script src="../ext/require.js" data-main="../src/config"></script>
<title>Put Taminations on Your Web Site</title>
</head>
<body><div class="definition">
<table><tr valign="top"><td width="40%">
<h2>How to Put Taminations on Your Web Site</h2>
<p>
Now you can put any Tamination on your web site.
To the right here is an example. The animation is contained inside an iframe on your web page.
The HTML code for this example is<br/>
<code><iframe src="http:
width="300" height="400"></iframe></code></p>
<p>
The components of the iframe are:</p>
<ol><li><code>src="http:
This loads all the Tamination code including the Java applet.</li>
<li><code>?b1</code><br/>The call level - b1, b2, ms, plus, a1, a2, c1, c2, or c3a.</li>
<li><code>/circulate</code><br/>The page with the animation,
<span style="text-decoration:underline">without</span> the trailing .html.</li>
<li><code>.<API key></code><br/>
The specific animation to show. This follows the same rules as <a href="howtolink.html">linking</a>.</li>
<li>Options <code>&play</code> and <code>&loop</code><br/>
which tell the code to start the animation and replay
it indefinitely. Other options are <ul style="list-style-type:none">
<li><code>&grid</code> to show the grid</li>
<li><code>&numbers</code> to number the dancers or <code>&couples</code> to number couples</li>
<li><code>&paths</code> to show the dancer paths</li>
<li><code>&speed=slow</code> or <code>fast</code> to set the animation rate</li>
<li><code>&phantoms</code> to show phantom dancers for the
challenge level calls that use them</li>
<li><code>&hexagon</code> to show the hexagon version.</li></ul>
Options can be in any order.</li>
<li><code>width="300"</code> and <code>height="400"</code><br/>
Size of the iframe. The animation will be fitted to these dimensions.
For a square dance floor, use height = width + 100. </li>
</ol>
</td><td>
<iframe src="../embed.html?ms/circulate.<API key>&play&loop" width="300" height="400"></iframe>
</td></tr></table>
</div></body>
</html> |
class Drink < ApplicationRecord
include <API key>
validates :drink_name, presence: true
def display
drink_name
end
def self.params
[
:id,
:drink_name,
:notes,
:calories,
:price
]
end
end |
# licence: AGPL
from pyramid.view import view_config
from dace.processinstance.core import <API key>
from pontus.default_behavior import Cancel
from pontus.form import FormView
from pontus.view import BasicView
from pontus.view_operation import MultipleView
from lac.content.processes.<API key>.behaviors import (
RemoveReview)
from lac.core import BaseReview
from lac import _
class <API key>(BasicView):
title = 'Alert for remove'
name = 'alertforremove'
template = 'lac:views/<API key>/templates/alert_remove.pt'
def update(self):
result = {}
values = {'context': self.context}
body = self.content(args=values, template=self.template)['body']
item = self.adapt_item(body, self.viewid)
result['coordinates'] = {self.coordinates: [item]}
return result
class RemoveReviewView(FormView):
title = _('Remove')
name = 'removereviewform'
formid = 'formremovereview'
behaviors = [RemoveReview, Cancel]
validate_behaviors = False
@view_config(
name='removereview',
context=BaseReview,
renderer='pontus:templates/views_templates/grid.pt',
)
class <API key>(MultipleView):
title = _('Remove')
name = 'removereview'
viewid = 'removereview'
template = 'daceui:templates/<API key>.pt'
views = (<API key>, RemoveReviewView)
validators = [RemoveReview.get_validator()]
<API key>.update(
{RemoveReview: <API key>}) |
#include "stdafx.h"
#include "signerCapi.h"
#include <stdio.h>
#include <string.h>
#include <vcclr.h >
#include <stdlib.h >
#include <fcntl.h>
#include <iostream>
#include <io.h>
#include <map>
#using <System.dll>
#using <System.Security.dll>
#include <msclr\marshal_cppstd.h>
using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Security::Cryptography::X509Certificates;
using namespace System::Security::Cryptography::Pkcs;
using namespace System::IO;
using namespace System::Text::RegularExpressions;
using namespace std;
using namespace ittru;
gcroot <X509Certificate2 ^> certificate;
gcroot <signAx ^> signer;
signerCapi::signerCapi(void)
{
signer = gcnew signAx();
}
signerCapi::~signerCapi(void)
{
}
void signerCapi::printMessageStdOut(const char * content){
String^ contentStr = gcnew String(content);
String^ jsonOut = "{"
+ "\"status\":\"0\","
+ "\"message\":\"" + contentStr + "\""
+ "}";
printToStdOut(convert (jsonOut));
}
void signerCapi::printToStdOut(char * content){
_setmode(_fileno(stdout), _O_BINARY);
std::string strOut(content);
int uiSize = strOut.length();
std::cout << char(((uiSize >> 0) & 0xFF));
std::cout << char(((uiSize >> 8) & 0xFF));
std::cout << char(((uiSize >> 16) & 0xFF));
std::cout << char(((uiSize >> 24) & 0xFF));
std::cout << strOut.c_str();
}
std::map<int, char*> signerCapi::parseJson(char* original){
std::map<int, char*> ret;
String^ originalStr = gcnew String(original);
String^ delimStr = ",";
array<Char>^ delimiter = delimStr->ToCharArray();
array<String^>^ strArr = originalStr->Split(delimiter);
delimStr = ":";
delimiter = delimStr->ToCharArray();
for (int word = 0; word < strArr->Length; word++){
array<String^>^ strArr2 = strArr[word]->Split(delimiter);
char * key = convert(clean(strArr2[0]));
ret[ keyToInt(key) ] = convert(clean(strArr2[1]));
}
return ret;
}
int signerCapi::keyToInt(char* key){
if (strcmp(key, "operation") == 0){
return OPERATION;
}
else if (strcmp(key, "thumbprint") == 0){
return THUMBPRINT;
}
else if (strcmp(key, "sign_type") == 0){
return SIGN_TYPE;
}
else if (strcmp(key, "sa_b64") == 0){
return SA_B64;
}
else {
return -1;
}
}
char * signerCapi::ReadFromStdIn(void){
_setmode(_fileno(stdin), _O_BINARY);
char cBuffer[65536] = { 0 };
unsigned int uiSize = 0;
std::cin.read((char*)&uiSize, sizeof(unsigned int));
memset(cBuffer, 0, 65536);
std::cin.read(cBuffer, uiSize);
std::string strIn(cBuffer);
return cBuffer;
}
String^ signerCapi::clean(String^ src){
String ^delim = gcnew String(" {}\"\\");
src = src->TrimStart(delim->ToCharArray());
src = src->TrimEnd(delim->ToCharArray());
return src;
}
char* signerCapi::convert(String^ src){
pin_ptr<const wchar_t> wch = PtrToStringChars(src);
size_t convertedChars = 0;
size_t sizeInBytes = ((src->Length + 1) * 2);
errno_t err = 0;
char* ret = (char *)malloc(sizeInBytes);
err = wcstombs_s(&convertedChars,
ret, sizeInBytes,
wch, sizeInBytes);
return ret;
}
void signerCapi::<API key>(char * certb64, char* thumbprint,
char*subject, int keySize){
String^ certb64Str = gcnew String(certb64);
String^ thumbprintStr = gcnew String(thumbprint);
String^ subjectStr = gcnew String(subject);
String^ jsonOut = "{"
+ "\"status\":\"0\","
+ "\"message\":\"OK\","
+ "\"thumbprint\":\"" + thumbprintStr + "\","
+ "\"certb64\":\"" + certb64Str + "\","
+ "\"subject\":\"" + subjectStr + "\","
+ "\"keySize\":\"" + keySize + "\""
+ "}";
printToStdOut(convert(jsonOut));
}
void signerCapi::getSubjectStdOut(char * subject){
String^ subjectStr = gcnew String(subject);
String^ jsonOut = "{"
+ "\"status\":\"0\","
+ "\"message\":\"OK\","
+ "\"subject\":\"" + subjectStr + "\""
+ "}";
printToStdOut(convert(jsonOut));
}
void signerCapi::signStdOut(char * sign){
String^ signStr = gcnew String(sign);
String^ jsonOut = "{"
+ "\"status\":\"0\","
+ "\"message\":\"OK\","
+ "\"sign\":\"" + signStr + "\""
+ "}";
printToStdOut(convert(jsonOut));
}
void signerCapi::isActiveStdOut(){
String^ jsonOut = "{"
+ "\"status\":\"0\","
+ "\"message\":\"OK\""
+ "}";
printToStdOut(convert(jsonOut));
}
void signerCapi::getKeySizeStdOut(int keySize){
String^ ksSize = Convert::ToString(keySize);
String^ jsonOut = "{"
+ "\"status\":\"0\","
+ "\"message\":\"OK\","
+ "\"keySize\":\"" + ksSize + "\""
+ "}";
printToStdOut(convert(jsonOut));
}
void signerCapi::getCertificate(const char* thumnprint){
signer-><API key>(gcnew String(thumnprint));
}
char* signerCapi::getCertificate(char* title,
char* msg, char* subjectRegex, char* issuerRegex){
return convert(signer->getCertificate(gcnew String(title), gcnew String(msg),
gcnew String(subjectRegex), gcnew String(issuerRegex)));
}
char* signerCapi::sign(int hashAlg, char* saValue, char* thumbprint){
String^ thumbprintStr = gcnew String(thumbprint);
signer-><API key>(thumbprintStr);
return convert( signer->sign(hashAlg, gcnew String(saValue)) );
}
int signerCapi::getKeySize(){
return ( signer->getKeySize() );
}
char* signerCapi::getThumbprint(){
return convert ( signer->getThumbprint() );
}
char* signerCapi::getSubject(void){
return convert( signer->getSubject() );
}
/*
void signerCapi::<API key>(char * certb64, char* thumbprint){
_setmode(_fileno(stdout), _O_BINARY);
String^ certb64Str = gcnew String(certb64);
String^ thumbprintStr = gcnew String(thumbprint);
String^ jsonOut = "{"
+ "\"status\":\"0\","
+ "\"message\":\"OK\","
+ "\"thumbprint\":\"" + thumbprintStr + "\","
+ "\"certb64\":\"" + certb64Str + "\""
+ "}";
msclr::interop::marshal_context context;
std::string strOut = context.marshal_as<std::string>(jsonOut);
int uiSize = strOut.length();
std::cout << char(((uiSize >> 0) & 0xFF));
std::cout << char(((uiSize >> 8) & 0xFF));
std::cout << char(((uiSize >> 16) & 0xFF));
std::cout << char(((uiSize >> 24) & 0xFF));
std::cout << strOut.c_str();
}
*/ |
<?php namespace Controller;
class PostController extends \Controller\BaseController {
static $layout = "admin";
public function index(){
$entries = \Model\Post::paginate([
'updated' => "DESC"
],null,10);
return \Bootie\App::view('admin.posts.index',[
'entries' => $entries
]);
}
public function create(){
$p = new \Model\Post();
$p->title = 'New Post';
$p->user_id = session('user_id');
$p->created = TIME;
$p->updated = TIME;
$p->save();
$id = $p->id;
$entry = \Model\Post::row([
'id' => $id
]);
return \Bootie\App::view('admin.posts.edit',[
'entry' => $entry
]);
}
public function edit($id){
if(is_numeric($id))
{
$entry = \Model\Post::row([
'id' => $id
]);
return \Bootie\App::view('admin.posts.edit',[
'entry' => $entry
]);
}
return \Exception('Post ID was not provided');
}
public function update($id){
if(is_numeric($id))
{
extract($_POST);
$entry = new \Model\Post();
$entry->id = $id;
$entry->title = $title;
$entry->slug = ! empty($slug) ? $slug : sanitize($title,false);
$entry->caption = $caption;
$entry->content = $content;
$entry->updated = TIME;
$result = $entry->save();
return redirect('/admin/posts',[
'success' => "Entry <strong>{$entry->title}</strong> has been updated"
]);
}
return redirect('/admin/posts',[
'danger' => "Entry ID was not provided"
]);
}
public function delete($id){
if(is_numeric($id))
{
$entry = \Model\Post::row([
'id' => $id
]);
if( $entry )
{
$tags = \Model\PostTag::row([
'post_id' => $id
]);
if($tags)
{
$tags->delete();
}
foreach($entry->files() as $file)
{
\Bootie\Image::destroy_group($file->name,'posts');
\Model\File::row([
'id' => $file->id
])->delete();
}
$title = $entry->title;
$entry->delete();
return redirect('/admin/posts',[
'success' => "Entry <strong>{$title}</strong> has been deleted"
]);
}
}
return redirect('/admin/posts',[
'danger' => "Entry was not found"
]);
}
} |
define(function(require, exports, module) {
'use strict';
console.log('Loading search.js ...');
var TSCORE = require('tscore');
var currentQuery = '';
var nextQuery = '';
var recursiveSymbol = '~';
// TODO implement case sensitive search
var caseSensitiveSearch = false;
function prepareQuery(queryText) {
// cleaning up the query, reducing the spaces
var queryText = queryText.toLowerCase().replace(/^\s+|\s+$/g, '');
var recursive = queryText.indexOf(recursiveSymbol) !== 0;
if (!recursive) {
queryText = queryText.substring(1, queryText.length);
}
var queryTerms = queryText.split(' ');
var queryObj = {
includedTerms: [],
excludedTerms: [],
includedTags: [],
excludedTags: [],
recursive: recursive,
fileTypeFilter: function() {
return true;
},
};
// parsing the query terms
queryTerms.forEach(function(value) {
if (value.length <= 1) {
return;
}
if (TSCORE.PRO && value.indexOf('t:picture') === 0) {
queryObj.fileTypeFilter = TSCORE.PRO.Search.filterPictures;
} else if (TSCORE.PRO && value.indexOf('t:note') === 0) {
queryObj.fileTypeFilter = TSCORE.PRO.Search.filterNotes;
} else if (TSCORE.PRO && value.indexOf('t:doc') === 0) {
queryObj.fileTypeFilter = TSCORE.PRO.Search.filterDocuments;
} else if (TSCORE.PRO && value.indexOf('t:audio') === 0) {
queryObj.fileTypeFilter = TSCORE.PRO.Search.filterAudioFiles;
} else if (TSCORE.PRO && value.indexOf('t:video') === 0) {
queryObj.fileTypeFilter = TSCORE.PRO.Search.filterVideoFiles;
} else if (TSCORE.PRO && value.indexOf('t:archive') === 0) {
queryObj.fileTypeFilter = TSCORE.PRO.Search.filterArchives;
} else if (value.indexOf('!') === 0) {
queryObj.excludedTerms.push([value.substring(1, value.length), false]);
} else if (value.indexOf('+') === 0) {
queryObj.includedTags.push([value.substring(1, value.length), true]);
} else if (value.indexOf('-') === 0) {
queryObj.excludedTags.push([value.substring(1, value.length), true]);
} else {
queryObj.includedTerms.push([value, false]);
}
});
return queryObj;
}
function <API key>(filePath) {
// Returning only text based files
return /\.(html|htm|txt|xml|md|mdown|json)$/i.test(filePath);
}
function filterFileObject(fileEntry, queryObj) {
var parentDir = TSCORE.TagUtils.<API key>(fileEntry.path).toLowerCase();
var searchIn = fileEntry.name.toLowerCase();
var fileNameTags;
//if(!queryObj.fileTypeFilter(searchIn)) {
// return false;
if (fileEntry.tags) {
fileNameTags = fileEntry.tags;
} else {
fileNameTags = TSCORE.TagUtils.extractTags(fileEntry.path);
}
var result = true;
if (fileNameTags.length < 1 && queryObj.includedTags.length > 0) {
return false;
}
for (var i = 0; i < queryObj.includedTerms.length; i++) {
// Considers the parent directory name in the search results
if ((parentDir + searchIn).indexOf(queryObj.includedTerms[i][0]) >= 0) {
queryObj.includedTerms[i][1] = true;
} else {
return false;
}
}
for (var i = 0; i < queryObj.excludedTerms.length; i++) {
if (searchIn.indexOf(excludedTerms[i][0]) < 0) {
queryObj.excludedTerms[i][1] = true;
} else {
return false;
}
}
for (var i = 0; i < queryObj.includedTags.length; i++) {
queryObj.includedTags[i][1] = false;
for (var j = 0; j < fileNameTags.length; j++) {
if (fileNameTags[j].toLowerCase() == queryObj.includedTags[i][0]) {
queryObj.includedTags[i][1] = true;
}
}
}
for (var i = 0; i < queryObj.includedTags.length; i++) {
result = result & queryObj.includedTags[i][1];
}
for (var i = 0; i < queryObj.excludedTags.length; i++) {
queryObj.excludedTags[i][1] = true;
for (var j = 0; j < fileNameTags.length; j++) {
if (fileNameTags[j].toLowerCase() == queryObj.excludedTags[i][0]) {
queryObj.excludedTags[i][1] = false;
}
}
}
for (var i = 0; i < queryObj.excludedTags.length; i++) {
result = result & queryObj.excludedTags[i][1];
}
return result;
}
function searchData(data, query) {
// TODO make a switch in gui for content search
var <API key> = (isChrome || isFirefox) ? false : true;
var queryObj = prepareQuery(query);
var searchResults = [];
var metaDirPattern = TSCORE.dirSeparator + TSCORE.metaFolder + TSCORE.dirSeparator;
if (query.length > 0) {
TSCORE.showWaitingDialog($.i18n.t("ns.common:<API key>"));
console.time("walkDirectorySearch");
TSCORE.IOUtils.walkDirectory(TSCORE.currentPath, {recursive: queryObj.recursive},
function(fileEntry) {
return new Promise(function(resolve, reject) {
var <API key> = fileEntry.path.indexOf(metaDirPattern);
// Searching in file names while skipping paths containing '/.ts/'
if (<API key> < 1 && filterFileObject(fileEntry, queryObj) && queryObj.fileTypeFilter(fileEntry.name.toLowerCase())) {
searchResults.push(fileEntry);
resolve();
return;
}
// Searching in content
if (<API key> && <API key>(fileEntry.name)) { // Search in content
TSCORE.IO.<API key>(fileEntry.path, "text").then(function(content) {
var found;
var metaExtLocation = fileEntry.path.lastIndexOf(TSCORE.metaFileExt); // .json
// Checking for matching tags, parsing meta JSONs located in ../.ts/ folders
if (<API key> > 0 && metaExtLocation > <API key>) {
try {
var metaData = JSON.parse(content);
if (metaData.tags && metaData.tags.length > 0 && queryObj.includedTags.length > 0) {
// Checking if both tag arrays have same members
for (var i = 0; i < metaData.tags.length; i++) {
for (var j = 0; j < queryObj.includedTags.length; j++) {
if (queryObj.includedTags[j][0] === (metaData.tags[i].title.toLowerCase())) {
queryObj.includedTags[j][1] = true;
found = true;
}
}
}
// Logicaling AND-ing the result
for (var j = 0; j < queryObj.includedTags.length; j++) {
found = found & queryObj.includedTags[j][1];
queryObj.includedTags[j][1] = false;
}
}
} catch (err) {
console.log("Error " + err + " parsing JSON from: " + fileEntry.path);
}
}
if (!found) {
// Searching in the content
queryObj.includedTerms.forEach(function(term) {
if (content.indexOf(term[0]) >= 0) {
console.log("Term " + term[0] + " found in " + fileEntry.path);
found = true;
}
});
}
if (found) {
if (<API key> > 0) { // file is in the meta folder
var contentExtLocation = fileEntry.path.lastIndexOf(TSCORE.contentFileExt); // .txt
var metaFolderLocation = fileEntry.path.lastIndexOf(TSCORE.metaFolderFile);
// file is meta file (json) and not tsm.json
if (metaExtLocation > <API key> && metaFolderLocation < 0) {
fileEntry.name = fileEntry.name.substring(0, fileEntry.name.indexOf(TSCORE.metaFileExt));
fileEntry.path = fileEntry.path.substring(0, <API key> + 1) + fileEntry.name;
}
// file is text file containing extracted contentent (txt)
if (contentExtLocation > <API key>) {
fileEntry.name = fileEntry.name.substring(0, fileEntry.name.indexOf(TSCORE.contentFileExt));
fileEntry.path = fileEntry.path.substring(0, <API key> + 1) + fileEntry.name;
}
// file is meta directory file (tsm.json)
if (metaFolderLocation > <API key>) {
fileEntry.path = fileEntry.path.substring(0, <API key> + 1);
fileEntry.name = TSCORE.TagUtils.<API key>(fileEntry.path) + "." + TSCORE.directoryExt;
fileEntry.isDirectory = true;
}
if (!fileEntry.isDirectory) { // TODO check if the main file exists
// TSCORE.IO.<API key>(fileEntry.path).then(function(mainFileEntry) {
// searchResults.push(mainFileEntry);
searchResults.push(fileEntry);
resolve();
return;
// }, function() {
// console.log("main file does not exist anymore " + fileEntry.path);
// resolve();
} else { // by tsm.json files
fileEntry.size = 0;
fileEntry.lmdt = 0;
searchResults.push(fileEntry);
resolve();
return;
}
} else { // file is regular text, md, json file
searchResults.push(fileEntry);
resolve();
return;
}
} else { // file does not match
resolve();
return;
}
}, function(err) {
console.log("Failed loading content for: " + fileEntry.path);
resolve();
return;
});
} else {
resolve();
return;
}
});
}
//, function(dirEntry) {}
).then(
function(entries) {
console.timeEnd("walkDirectorySearch");
console.log("Found " + searchResults.length + " out of " + entries.length + " entries.");
TSCORE.Search.nextQuery = "";
TSCORE.PerspectiveManager.<API key>(searchResults, true);
TSCORE.hideWaitingDialog();
},
function(err) {
console.warn("Error creating index: " + err);
}
).catch(function() {
TSCORE.hideWaitingDialog();
});
return false;
} else {
if (TSCORE.Config.getCalculateTags()) {
// Find all tags in the current search results
calculateTags(data);
}
return data;
}
}
function calculateTags(data) {
console.log('Calculating tags from search results');
// TODO consider tags in sidecar files
var allTags = [];
data.forEach(function(fileEntry) {
fileEntry.tags.forEach(function(tag) {
allTags.push(("" + tag).toLowerCase());
});
});
var countData = _.countBy(allTags, function(obj) {
return obj;
});
TSCORE.calculatedTags.length = 0;
_.each(countData, function(count, tag) {
TSCORE.calculatedTags.push({
'title': tag,
'type': 'plain',
'count': count
});
});
TSCORE.generateTagGroups();
}
// Public variables definition
exports.currentQuery = currentQuery;
exports.nextQuery = nextQuery;
exports.recursiveSymbol = recursiveSymbol;
// Public API definition
exports.searchData = searchData;
exports.calculateTags = calculateTags;
}); |
<?php
use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Message\ResponseInterface;
require __DIR__ . '/../../vendor/autoload.php';
trait BasicStructure {
use Auth;
use Trashbin;
/** @var string */
private $currentUser = '';
/** @var string */
private $currentServer = '';
/** @var string */
private $baseUrl = '';
/** @var int */
private $apiVersion = 1;
/** @var ResponseInterface */
private $response = null;
/** @var CookieJar */
private $cookieJar;
/** @var string */
private $requestToken;
protected $adminUser;
protected $regularUser;
protected $localBaseUrl;
protected $remoteBaseUrl;
public function __construct($baseUrl, $admin, $<API key>) {
// Initialize your context here
$this->baseUrl = $baseUrl;
$this->adminUser = $admin;
$this->regularUser = $<API key>;
$this->localBaseUrl = $this->baseUrl;
$this->remoteBaseUrl = $this->baseUrl;
$this->currentServer = 'LOCAL';
$this->cookieJar = new CookieJar();
// in case of ci deployment we take the server url from the environment
$testServerUrl = getenv('TEST_SERVER_URL');
if ($testServerUrl !== false) {
$this->baseUrl = $testServerUrl;
$this->localBaseUrl = $testServerUrl;
}
// federated server url from the environment
$testRemoteServerUrl = getenv('TEST_SERVER_FED_URL');
if ($testRemoteServerUrl !== false) {
$this->remoteBaseUrl = $testRemoteServerUrl;
}
}
/**
* @Given /^using api version "(\d+)"$/
* @param string $version
*/
public function usingApiVersion($version) {
$this->apiVersion = (int) $version;
}
/**
* @Given /^As an "([^"]*)"$/
* @param string $user
*/
public function asAn($user) {
$this->currentUser = $user;
}
/**
* @Given /^Using server "(LOCAL|REMOTE)"$/
* @param string $server
* @return string Previous used server
*/
public function usingServer($server) {
$previousServer = $this->currentServer;
if ($server === 'LOCAL'){
$this->baseUrl = $this->localBaseUrl;
$this->currentServer = 'LOCAL';
return $previousServer;
} else {
$this->baseUrl = $this->remoteBaseUrl;
$this->currentServer = 'REMOTE';
return $previousServer;
}
}
/**
* @When /^sending "([^"]*)" to "([^"]*)"$/
* @param string $verb
* @param string $url
*/
public function sendingTo($verb, $url) {
$this->sendingToWith($verb, $url, null);
}
/**
* Parses the xml answer to get ocs response which doesn't match with
* http one in v1 of the api.
* @param ResponseInterface $response
* @return string
*/
public function getOCSResponse($response) {
return $response->xml()->meta[0]->statuscode;
}
/**
* This function is needed to use a vertical fashion in the gherkin tables.
* @param array $arrayOfArrays
* @return array
*/
public function simplifyArray($arrayOfArrays){
$a = array_map(function($subArray) { return $subArray[0]; }, $arrayOfArrays);
return $a;
}
/**
* @When /^sending "([^"]*)" to "([^"]*)" with$/
* @param string $verb
* @param string $url
* @param \Behat\Gherkin\Node\TableNode $body
*/
public function sendingToWith($verb, $url, $body) {
$fullUrl = $this->baseUrl . "v{$this->apiVersion}.php" . $url;
$client = new Client();
$options = [];
if ($this->currentUser === 'admin') {
$options['auth'] = $this->adminUser;
} else {
$options['auth'] = [$this->currentUser, $this->regularUser];
}
$options['headers'] = [
'OCS_APIREQUEST' => 'true'
];
if ($body instanceof \Behat\Gherkin\Node\TableNode) {
$fd = $body->getRowsHash();
$options['body'] = $fd;
}
// TODO: Fix this hack!
if ($verb === 'PUT' && $body === null) {
$options['body'] = [
'foo' => 'bar',
];
}
try {
$this->response = $client->send($client->createRequest($verb, $fullUrl, $options));
} catch (ClientException $ex) {
$this->response = $ex->getResponse();
}
}
/**
* @When /^sending "([^"]*)" with exact url to "([^"]*)"$/
* @param string $verb
* @param string $url
*/
public function sendingToDirectUrl($verb, $url) {
$this-><API key>($verb, $url, null);
}
public function <API key>($verb, $url, $body) {
$fullUrl = substr($this->baseUrl, 0, -5) . $url;
$client = new Client();
$options = [];
if ($this->currentUser === 'admin') {
$options['auth'] = $this->adminUser;
} else {
$options['auth'] = [$this->currentUser, $this->regularUser];
}
if ($body instanceof \Behat\Gherkin\Node\TableNode) {
$fd = $body->getRowsHash();
$options['body'] = $fd;
}
try {
$this->response = $client->send($client->createRequest($verb, $fullUrl, $options));
} catch (ClientException $ex) {
$this->response = $ex->getResponse();
}
}
public function isExpectedUrl($possibleUrl, $finalPart){
$baseUrlChopped = substr($this->baseUrl, 0, -4);
$endCharacter = strlen($baseUrlChopped) + strlen($finalPart);
return (substr($possibleUrl,0,$endCharacter) == "$baseUrlChopped" . "$finalPart");
}
/**
* @Then /^the OCS status code should be "([^"]*)"$/
* @param int $statusCode
*/
public function <API key>($statusCode) {
<API key>::assertEquals($statusCode, $this->getOCSResponse($this->response));
}
/**
* @Then /^the HTTP status code should be "([^"]*)"$/
* @param int $statusCode
*/
public function <API key>($statusCode) {
<API key>::assertEquals($statusCode, $this->response->getStatusCode());
}
/**
* @Then /^the Content-Type should be "([^"]*)"$/
* @param string $contentType
*/
public function <API key>($contentType) {
<API key>::assertEquals($contentType, $this->response->getHeader('Content-Type'));
}
/**
* @param ResponseInterface $response
*/
private function <API key>(ResponseInterface $response) {
$this->requestToken = substr(preg_replace('/(.*)data-requesttoken="(.*)">(.*)/sm', '\2', $response->getBody()->getContents()), 0, 89);
}
/**
* @Given Logging in using web as :user
* @param string $user
*/
public function loggingInUsingWebAs($user) {
$loginUrl = substr($this->baseUrl, 0, -5) . '/login';
// Request a new session and extract CSRF token
$client = new Client();
$response = $client->get(
$loginUrl,
[
'cookies' => $this->cookieJar,
]
);
$this-><API key>($response);
// Login and extract new token
$password = ($user === 'admin') ? 'admin' : '123456';
$client = new Client();
$response = $client->post(
$loginUrl,
[
'body' => [
'user' => $user,
'password' => $password,
'requesttoken' => $this->requestToken,
],
'cookies' => $this->cookieJar,
]
);
$this-><API key>($response);
}
/**
* @When Sending a :method to :url with requesttoken
* @param string $method
* @param string $url
*/
public function <API key>($method, $url) {
$baseUrl = substr($this->baseUrl, 0, -5);
$client = new Client();
$request = $client->createRequest(
$method,
$baseUrl . $url,
[
'cookies' => $this->cookieJar,
]
);
$request->addHeader('requesttoken', $this->requestToken);
try {
$this->response = $client->send($request);
} catch (ClientException $e) {
$this->response = $e->getResponse();
}
}
/**
* @When Sending a :method to :url without requesttoken
* @param string $method
* @param string $url
*/
public function <API key>($method, $url) {
$baseUrl = substr($this->baseUrl, 0, -5);
$client = new Client();
$request = $client->createRequest(
$method,
$baseUrl . $url,
[
'cookies' => $this->cookieJar,
]
);
try {
$this->response = $client->send($request);
} catch (ClientException $e) {
$this->response = $e->getResponse();
}
}
public static function removeFile($path, $filename){
if (file_exists("$path" . "$filename")) {
unlink("$path" . "$filename");
}
}
/**
* @Given User :user modifies text of :filename with text :text
* @param string $user
* @param string $filename
* @param string $text
*/
public function modifyTextOfFile($user, $filename, $text) {
self::removeFile("../../data/$user/files", "$filename");
file_put_contents("../../data/$user/files" . "$filename", "$text");
}
public function <API key>($name, $size) {
$file = fopen("work/" . "$name", 'w');
fseek($file, $size - 1 ,SEEK_CUR);
fwrite($file,'a'); // write a dummy char at SIZE position
fclose($file);
}
public function createFileWithText($name, $text){
$file = fopen("work/" . "$name", 'w');
fwrite($file, $text);
fclose($file);
}
/**
* @Given file :filename of size :size is created in local storage
* @param string $filename
* @param string $size
*/
public function <API key>($filename, $size) {
$this-><API key>("local_storage/$filename", $size);
}
/**
* @Given file :filename with text :text is created in local storage
* @param string $filename
* @param string $text
*/
public function <API key>($filename, $text) {
$this->createFileWithText("local_storage/$filename", $text);
}
/**
* @When Sleep for :seconds seconds
* @param int $seconds
*/
public function sleepForSeconds($seconds) {
sleep((int)$seconds);
}
/**
* @BeforeSuite
*/
public static function addFilesToSkeleton(){
for ($i=0; $i<5; $i++){
file_put_contents("../../core/skeleton/" . "textfile" . "$i" . ".txt", "Nextcloud test text file\n");
}
if (!file_exists("../../core/skeleton/FOLDER")) {
mkdir("../../core/skeleton/FOLDER", 0777, true);
}
if (!file_exists("../../core/skeleton/PARENT")) {
mkdir("../../core/skeleton/PARENT", 0777, true);
}
file_put_contents("../../core/skeleton/PARENT/" . "parent.txt", "Nextcloud test text file\n");
if (!file_exists("../../core/skeleton/PARENT/CHILD")) {
mkdir("../../core/skeleton/PARENT/CHILD", 0777, true);
}
file_put_contents("../../core/skeleton/PARENT/CHILD/" . "child.txt", "Nextcloud test text file\n");
}
/**
* @AfterSuite
*/
public static function <API key>(){
for ($i=0; $i<5; $i++){
self::removeFile("../../core/skeleton/", "textfile" . "$i" . ".txt");
}
if (is_dir("../../core/skeleton/FOLDER")) {
rmdir("../../core/skeleton/FOLDER");
}
self::removeFile("../../core/skeleton/PARENT/CHILD/", "child.txt");
if (is_dir("../../core/skeleton/PARENT/CHILD")) {
rmdir("../../core/skeleton/PARENT/CHILD");
}
self::removeFile("../../core/skeleton/PARENT/", "parent.txt");
if (is_dir("../../core/skeleton/PARENT")) {
rmdir("../../core/skeleton/PARENT");
}
}
/**
* @BeforeScenario @local_storage
*/
public static function <API key>(){
$dir = "./work/local_storage/";
$di = new <API key>($dir, FilesystemIterator::SKIP_DOTS);
$ri = new <API key>($di, <API key>::CHILD_FIRST);
foreach ( $ri as $file ) {
$file->isDir() ? rmdir($file) : unlink($file);
}
}
/**
* @AfterScenario @local_storage
*/
public static function <API key>(){
$dir = "./work/local_storage/";
$di = new <API key>($dir, FilesystemIterator::SKIP_DOTS);
$ri = new <API key>($di, <API key>::CHILD_FIRST);
foreach ( $ri as $file ) {
$file->isDir() ? rmdir($file) : unlink($file);
}
}
} |
from base64 import urlsafe_b64decode
from io import StringIO
from django.http.response import HttpResponse
from django.shortcuts import render
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_exempt
import openid2rp
from Care4Care.settings import STATICFILES_DIRS
@never_cache
def oidtest(request):
ax = (("http://axschema.org/eid/card-validity/end",
"http://axschema.org/person/gender",
"http://axschema.org/contact/postalAddress/home",
"http://axschema.org/namePerson/first",
"http://axschema.org/eid/photo",
"http://axschema.org/eid/card-validity/begin",
"http://axschema.org/contact/city/home",
"http://axschema.org/contact/postalCode/home",
"http://axschema.org/birthDate",
"http://openid.net/schema/birthDate/birthYear",
"http://openid.net/schema/birthDate/birthMonth",
"http://openid.net/schema/birthDate/birthday",
"http://axschema.org/eid/pob",
"http://axschema.org/eid/card-number",
"http://axschema.org/eid/nationality",
"http://axschema.org/namePerson/last",
"http://axschema.org/namePerson",
"http://axschema.org/eid/rrn",
"http://axschema.org/eid/age"), ())
uri = "https:
kind, claimedId = openid2rp.normalize_uri(uri)
res = openid2rp.discover(claimedId)
if res is not None:
services, op_endpoint, op_local = res
session = openid2rp.associate(services, op_endpoint)
redirect_url = openid2rp.<API key>(
services,
op_endpoint,
session['assoc_handle'],
"http://127.0.0.1:8000/tests/openid2",
claimedId, op_local,
sreg=((), ()),
ax=ax
)
response = HttpResponse()
response['Location'] = redirect_url
response.status_code=303
return response
# return render_to_response('OIDTest.html',
# 'services' : services,
# 'op_endpoint' : op_endpoint,
# 'op_local' : op_local,
# 'kind' : kind,
# 'claimedID' : claimedId,
# 'redirect_url' : redirect_url
@csrf_exempt
@never_cache
def oidtest2(request):
# signed, claimedID = openid2rp.verify(request.POST, None, None, True)
# printy(get_ax(request.POST))
ax = get_ax(request.POST)
args = ax.copy()
args.update({'ax' : ax})
strIO = StringIO()
print(ax, file=strIO)
args.update({'printy' : strIO.getvalue()})
return render(request, "OIDTest.html", args)
def get_ax(response):
ax = 'ax' + "."
oax = 'openid.' + ax
res = {}
for k, v in response.items():
if k.startswith(oax+"type."):
k = k.rsplit('.',1)[1]
value_name = oax+"value."+k
if ax+"value."+k not in response['openid.signed']:
continue
res[v] = response[value_name]
return _get_readable_ax(res)
def _get_readable_ax(ax):
res = {}
AX = {"http://axschema.org/eid/card-validity/end" : 'card_validity_end',
"http://axschema.org/person/gender" : 'gender',
"http://axschema.org/contact/postalAddress/home" : 'address',
"http://axschema.org/namePerson/first" : 'firstname',
"http://axschema.org/eid/photo" : 'photo',
"http://axschema.org/eid/card-validity/begin" : 'card_validity_start',
"http://axschema.org/contact/city/home" : 'city',
"http://axschema.org/contact/postalCode/home" : 'postal_code',
"http://axschema.org/birthDate" : 'birth_date',
"http://openid.net/schema/birthDate/birthYear" : 'birth_year',
"http://openid.net/schema/birthDate/birthMonth" : 'birth_month',
"http://openid.net/schema/birthDate/birthday" : 'birth_day',
"http://axschema.org/eid/pob" : 'birth_place',
"http://axschema.org/eid/card-number" : 'card_number',
"http://axschema.org/eid/nationality" : 'nationality',
"http://axschema.org/namePerson/last" : 'lastname',
"http://axschema.org/namePerson" : 'fullname',
"http://axschema.org/eid/rrn" : 'register_number',
"http://axschema.org/eid/age" : 'age'
}
for key, value in ax.items():
if key.endswith('photo'):
filename = STATICFILES_DIRS[0] + '/images/photo.jpg'
#value = value.replace('-', '+').replace('_', '/')
if len(value) % 3 != 0: value += '=';
if len(value) % 3 != 0: value += '=';
with open(filename, 'wb') as fd:
fd.write(urlsafe_b64decode(value))
fd.close()
value = filename
res[AX[key]] = value
return res |
<?php
class <API key> extends <API key>
{
protected $prefix = 'OPERAMINIONANDROID';
public static $constantIDs = array(
'<API key>',
'<API key>',
'<API key>',
);
public function canHandle($userAgent)
{
if (<API key>::isDesktopBrowser($userAgent)) {
return false;
}
return <API key>::checkIfContainsAll($userAgent, array('Android', 'Opera Mini'));
}
public function <API key>($userAgent)
{
if (<API key>::checkIfContains($userAgent, ' Build/')) {
return $this->getDeviceIDFromRIS($userAgent, <API key>::indexOfOrLength($userAgent, ' Build/'));
}
$prefixes = array(
'Opera/9.80 (J2ME/MIDP; Opera Mini/5' => '<API key>',
'Opera/9.80 (Android; Opera Mini/5.0' => '<API key>',
'Opera/9.80 (Android; Opera Mini/5.1' => '<API key>',
);
foreach ($prefixes as $prefix => $defaultID) {
if (<API key>::checkIfStartsWith($userAgent, $prefix)) {
// If RIS returns a non-generic match, return it, else, return the default
$tolerance = strlen($prefix);
$deviceID = $this->getDeviceIDFromRIS($userAgent, $tolerance);
if ($deviceID === WURFL_Constants::NO_MATCH) {
return $defaultID;
}
return $deviceID;
}
}
return WURFL_Constants::NO_MATCH;
}
public function applyRecoveryMatch($userAgent)
{
return '<API key>';
}
} |
use crate::domain::model::error::Error as ModelError;
use crate::domain::ports::secondary::list::{List, Parameters};
use async_trait::async_trait;
use common::document::ContainerDocument;
use futures::stream::{Stream, StreamExt};
use std::pin::Pin;
use tracing::info_span;
use tracing_futures::Instrument;
type PinnedStream<T> = Pin<Box<dyn Stream<Item = T> + Send + 'static>>;
#[async_trait]
pub trait ListDocuments<D> {
async fn list_documents(&self) -> Result<PinnedStream<Result<D, ModelError>>, ModelError>;
}
#[async_trait]
impl<D, T> ListDocuments<D> for T
where
D: ContainerDocument + Send + Sync + 'static,
T: List<D> + Send + Sync,
{
async fn list_documents(&self) -> Result<PinnedStream<Result<D, ModelError>>, ModelError> {
let doc_type = D::static_doc_type().to_string();
let documents = self
.list_documents(Parameters { doc_type })
.await?
.map(|raw| raw.map_err(|err| ModelError::<API key> { source: err.into() }))
.instrument(info_span!(
"List documents",
doc_type = D::static_doc_type(),
));
Ok(documents.boxed())
}
} |
<?php
namespace SPHERE\Application\Corporation\Company\Service;
use SPHERE\Application\Corporation\Company\Service\Entity\TblCompany;
use SPHERE\Application\Corporation\Company\Service\Entity\ViewCompany;
use SPHERE\Application\Platform\System\Protocol\Protocol;
use SPHERE\System\Database\Binding\AbstractData;
/**
* Class Data
*
* @package SPHERE\Application\Corporation\Company\Service
*/
class Data extends AbstractData
{
/**
* @return false|ViewCompany[]
*/
public function viewCompany()
{
return $this->getCachedEntityList(
__METHOD__, $this->getConnection()->getEntityManager(), 'ViewCompany'
);
}
public function <API key>()
{
}
/**
* @param string $Name
* @param string $ExtendedName
* @param string $Description
*
* @return null|object|TblCompany
*/
public function createCompany($Name, $ExtendedName = '', $Description = '')
{
$Manager = $this->getConnection()->getEntityManager();
$Entity = $Manager->getEntity('TblCompany')->findOneBy(array(
TblCompany::ATTR_NAME => $Name,
TblCompany::ATTR_EXTENDED_NAME => $ExtendedName,
'EntityRemove' => null
));
if (null === $Entity) {
$Entity = new TblCompany();
$Entity->setName($Name);
$Entity->setExtendedName($ExtendedName);
$Entity->setDescription($Description);
$Manager->saveEntity($Entity);
Protocol::useService()->createInsertEntry($this->getConnection()->getDatabase(), $Entity);
}
return $Entity;
}
/**
* @param TblCompany $tblCompany
* @param string $Name
* @param string $ExtendedName
* @param string $Description
*
* @return bool
*/
public function updateCompany(
TblCompany $tblCompany,
$Name,
$ExtendedName = '',
$Description = ''
) {
$Manager = $this->getConnection()->getEntityManager();
/** @var TblCompany $Entity */
$Entity = $Manager->getEntityById('TblCompany', $tblCompany->getId());
$Protocol = clone $Entity;
if (null !== $Entity) {
$Entity->setName($Name);
$Entity->setExtendedName($ExtendedName);
$Entity->setDescription($Description);
$Manager->saveEntity($Entity);
Protocol::useService()->createUpdateEntry($this->getConnection()->getDatabase(), $Protocol, $Entity);
return true;
}
return false;
}
/**
* @return bool|TblCompany[]
*/
public function getCompanyAll()
{
return $this->getCachedEntityList(__METHOD__, $this->getConnection()->getEntityManager(), 'TblCompany');
}
/**
* @return int
*/
public function countCompanyAll()
{
return $this->getConnection()->getEntityManager()->getEntity('TblCompany')->count();
}
/**
* @param integer $Id
*
* @return bool|TblCompany
*/
public function getCompanyById($Id)
{
return $this->getCachedEntityById(__METHOD__, $this->getConnection()->getEntityManager(), 'TblCompany', $Id);
}
/**
* @param string $Description
*
* @return bool|TblCompany
*/
public function <API key>($Description)
{
$list = $this-><API key>(__METHOD__, $this->getConnection()->getEntityManager(), 'TblCompany',
array(TblCompany::ATTR_DESCRIPTION => $Description));
if ($list) {
if (count($list) === 1) {
return $list[0];
}
}
return false;
}
/**
* @param $Name
* @param $ExtendedName
*
* @return false|TblCompany
*/
public function getCompanyByName($Name, $ExtendedName)
{
return $this->getCachedEntityBy(__METHOD__, $this->getConnection()->getEntityManager(), 'TblCompany',
array(
TblCompany::ATTR_NAME => $Name,
TblCompany::ATTR_EXTENDED_NAME => $ExtendedName
));
}
/**
* @param TblCompany $tblCompany
*
* @return bool
*/
public function destroyCompany(TblCompany $tblCompany)
{
$Manager = $this->getConnection()->getEntityManager();
/** @var TblCompany $Entity */
$Entity = $Manager->getEntityById('TblCompany', $tblCompany->getId());
if (null !== $Entity) {
Protocol::useService()->createDeleteEntry($this->getConnection()->getDatabase(), $Entity);
$Manager->removeEntity($Entity);
return true;
}
return false;
}
} |
"use strict";
describe("Zotero.Tags", function () {
describe("#getID()", function () {
it("should return tag id", function* () {
var tagName = Zotero.Utilities.randomString();
var item = <API key>('item');
item.addTag(tagName);
yield item.saveTx();
assert.typeOf((yield Zotero.Tags.getID(tagName)), "number");
})
})
describe("#getName()", function () {
it("should return tag id", function* () {
var tagName = Zotero.Utilities.randomString();
var item = <API key>('item');
item.addTag(tagName);
yield item.saveTx();
var libraryID = Zotero.Libraries.userLibraryID;
var tagID = yield Zotero.Tags.getID(tagName);
assert.equal((yield Zotero.Tags.getName(tagID)), tagName);
})
})
describe("#removeFromLibrary()", function () {
it("should reload tags of associated items", function* () {
var libraryID = Zotero.Libraries.userLibraryID;
var tagName = Zotero.Utilities.randomString();
var item = <API key>('item');
item.addTag(tagName);
yield item.saveTx();
assert.lengthOf(item.getTags(), 1);
var tagID = yield Zotero.Tags.getID(tagName);
yield Zotero.Tags.removeFromLibrary(libraryID, tagID);
assert.lengthOf(item.getTags(), 0);
})
})
describe("#purge()", function () {
it("should remove orphaned tags", function* () {
var libraryID = Zotero.Libraries.userLibraryID;
var tagName = Zotero.Utilities.randomString();
var item = <API key>('item');
item.addTag(tagName);
yield item.saveTx();
var tagID = yield Zotero.Tags.getID(tagName);
assert.typeOf(tagID, "number");
yield item.eraseTx();
assert.equal((yield Zotero.Tags.getName(tagID)), tagName);
yield Zotero.DB.executeTransaction(function* () {
yield Zotero.Tags.purge();
});
assert.isFalse(yield Zotero.Tags.getName(tagID));
})
})
}) |
from . import controllers |
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<title>COBRA::Export::Midos - Export collection as Midos2000 database</title>
<link rev="made" href="mailto:feedback@suse.de" />
</head>
<body style="background-color: white">
<table border="0" width="100%" cellspacing="0" cellpadding="3">
<tr><td class="block" style="background-color: #cccccc" valign="middle">
<big><strong><span class="block"> COBRA::Export::Midos - Export collection as Midos2000 database</span></strong></big>
</td></tr>
</table>
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#version">VERSION</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#methods">METHODS</a></li>
<ul>
<li><a href="#constructor">Constructor</a></li>
<li><a href="#<API key>">Public interface methods</a></li>
</ul>
<li><a href="#examples">EXAMPLES</a></li>
<li><a href="#diagnostics">DIAGNOSTICS</a></li>
<li><a href="#<API key>">CONFIGURATION AND ENVIRONMENT</a></li>
<li><a href="#dependencies">DEPENDENCIES</a></li>
<li><a href="#<API key>">BUGS AND LIMITATIONS</a></li>
<li><a href="#author">AUTHOR</a></li>
<li><a href="
<li><a href="#see_also_references">SEE ALSO/REFERENCES</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>COBRA::Export::Midos - Export collection as Midos2000 database</p>
<p>
<a href="#__index__"><small>Back to Top</small></a>
</p>
<hr />
<h1><a name="version">VERSION</a></h1>
<p>This documentation refers to COBRA::Export::Midos version 0.0.1</p>
<p>
<a href="#__index__"><small>Back to Top</small></a>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
NOT IMPLEMENTED YET!</pre>
<p>
<a href="#__index__"><small>Back to Top</small></a>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>A full description of the module and its features.
May include numerous subsections (i.e., =head2, =head3, etc.)</p>
<p>
<a href="#__index__"><small>Back to Top</small></a>
</p>
<hr />
<h1><a name="methods">METHODS</a></h1>
<p>A separate section listing the public components of the module's interface.
These normally consist of methods that may be called on objects belonging to
the classes that the module provides.</p>
<p>In an object-oriented module, this section should begin with a sentence of the
form ``An object of this class represents...'', to give the reader a high-level
context to help them understand the methods that are subsequently described.</p>
<p>
</p>
<h2><a name="constructor">Constructor</a></h2>
<dl>
<dt><strong><a name="item_new">new</a></strong><br />
</dt>
<dd>
TO-BE-DOCUMENTED
</dd>
<p></p></dl>
<p>
</p>
<h2><a name="<API key>">Public interface methods</a></h2>
<p>
<a href="#__index__"><small>Back to Top</small></a>
</p>
<hr />
<h1><a name="examples">EXAMPLES</a></h1>
<p>Many people learn better by example than by explanation, and most learn better
by a combination of the two. Providing a <em>/demo</em> directory stocked with well-
commented examples is an excellent idea, but users might not have access to the
original distribution, and demos are unlikely to have been installed for them.
Adding a few illustrative examples in the documentation itself can greatly
increase the ``learnability'' of your code.</p>
<p>
<a href="#__index__"><small>Back to Top</small></a>
</p>
<hr />
<h1><a name="diagnostics">DIAGNOSTICS</a></h1>
<p>A list of every error and warning message that the module can generate
(even the ones that will ``never happen''), with a full explanation of each
problem, one or more likely causes, and any suggested remedies.</p>
<p>
<a href="#__index__"><small>Back to Top</small></a>
</p>
<hr />
<h1><a name="<API key>">CONFIGURATION AND ENVIRONMENT</a></h1>
<p>A full explanation of any configuration <code>system(s)</code> used by the module,
including the names and locations of any configuration files, and the
meaning of any environment variables and properties that can be set. These
descriptions must also include details of any configuration language used.</p>
<p>
<a href="#__index__"><small>Back to Top</small></a>
</p>
<hr />
<h1><a name="dependencies">DEPENDENCIES</a></h1>
<p>A list of all the other modules that this module relies upon, including any
restrictions on versions, and an indication of whether these required modules
are part of the standard Perl distribution, part of the module's distribution,
or must be installed separately.</p>
<p>
<a href="#__index__"><small>Back to Top</small></a>
</p>
<hr />
<h1><a name="<API key>">BUGS AND LIMITATIONS</a></h1>
<p>A list of known problems with the module, together with some indications of
whether they are likely to be fixed in an upcoming release.</p>
<p>Also a list of restrictions on the features the module does provide:
data types that cannot be handled, performance issues and the circumstances
in which they may arise, practical limitations on the size of data sets,
special cases that are not (yet) handled, etc.</p>
<p>There are no known bugs in this module. Please report problems to Jens Wille
<code><jens.wille@gmail.com></code>. Patches are welcome.</p>
<p>
<a href="#__index__"><small>Back to Top</small></a>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Jens Wille <code><jens.wille@gmail.com></code></p>
<p>
<a href="#__index__"><small>Back to Top</small></a>
</p>
<hr />
<h1><a name="<API key>">LICENSE AND COPYRIGHT</a></h1>
<p>Copyright (C) 2006 Jens Wille <code><jens.wille@gmail.com></code></p>
<p>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.</p>
<p>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.</p>
<p>You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</p>
<p>
<a href="#__index__"><small>Back to Top</small></a>
</p>
<hr />
<h1><a name="see_also_references">SEE ALSO/REFERENCES</a></h1>
<p>Often there will be other modules and applications that are possible
alternatives to using your software. Or other documentation that would be of
use to the users of your software. Or a journal article or book that explains
the ideas on which the software is based. Listing those in a ``See Also'' section
allows people to understand your software better and to find the best solution
for their problems themselves, without asking you directly.</p>
<p><a href="../../../../site/lib/COBRA.html">COBRA</a>, <a href="../../../../site/lib/COBRA/Export.html">COBRA::Export</a></p>
<p><a href="#__index__"><small>Back to Top</small></a></p>
<table border="0" width="100%" cellspacing="0" cellpadding="3">
<tr><td class="block" style="background-color: #cccccc" valign="middle">
<big><strong><span class="block"> COBRA::Export::Midos - Export collection as Midos2000 database</span></strong></big>
</td></tr>
</table>
</body>
</html> |
og.selectingCells = false;
og.actualSelCell = '';
og.selectedCells = [];
og.paintingDay = 0;
og.old_style = {'background-color':'transparent', 'opacity':'1', 'filter':'alpha(opacity = 100)'};
var scroll_to = -1;
var cant_tips = 0;
var tips_array = [];
og.currentHourLineTOut = null;
og.drawCurrentHourLine = function(d, pre) {
if (cal_actual_view == 'viewweek' && pre == 'w_' || cal_actual_view == 'viewweek5days' && pre == 'w5_' || cal_actual_view == 'viewdate' && pre == 'd_') {
if (!og.startLineTime) og.startLineTime = new Date();
var now = new Date();
var diff = now.getTime() - og.startLineTime.getTime();
var date = new Date();
date.setTime(og.startLocaleTime.getTime() + diff);
var h = date.format('H');
var m = date.format('i');
var cell = h*2 + (m > 30 ? 1 : 0);
cell_id = 'h' + d + '_' + cell;
cell = Ext.get(cell_id);
if(m > 30) m -= 30;
var top = m * 100 / 30;
old_line = Ext.get(pre+"currentHourLine");
if (old_line) old_line.remove();
var title = date.format(og.config['time_format_use_24'] ? 'G:i' : 'g:i A');
var new_top = cell.getTop(true) + cell.getHeight() * top / 100;
var cant_d = pre == 'w_' ? 7 : (pre == 'w5_' ? 5 : 1);
var html = '<div id="'+pre+'currentHourLine" title="'+title+'" style="height:2px; z-index:200; position:absolute; top:'+ new_top +'px; left:'+ (d*100/cant_d) +'%; border-top:2px solid #B95000; width:'+(100/cant_d)+'%; opacity:0.7; filter:alpha(opacity=70);"></div>';
Ext.get("eventowner").insertHtml('afterBegin', html);
var tout = 60*1000;
if (og.currentHourLineTOut) clearTimeout(og.currentHourLineTOut);
og.currentHourLineTOut = setTimeout('og.drawCurrentHourLine('+d+', "'+pre+'")', tout);
} else {
og.currentHourLineTOut = null;
}
}
og.eventSelected = function(checked) {
if (checked) og.events_selected += 1;
else if (og.events_selected > 0) og.events_selected -= 1;
var topToolbar = Ext.getCmp('<API key>');
if (topToolbar) topToolbar.updateCheckedStatus(og.events_selected);
}
// month view
og.monthViewEventDD = Ext.extend(Ext.dd.DDProxy, {
startDrag: function(x, y) {
var dragEl = Ext.get(this.getDragEl());
var el = Ext.get(this.getEl());
dragEl.applyStyles({border:'','z-index':2000});
dragEl.update(el.dom.innerHTML);
if (el.getStyle('background-color') == 'transparent') {
dragEl.setStyle('background-color', '#99CC66');
}
dragEl.applyStyles('opacity: 0.5; filter: alpha(opacity = 50);');
},
onDragOver: function(e, targetId) {
var target = Ext.get(targetId);
if (target) this.lastTarget = target;
},
onDragOut: function(e, targetId) {
var target = Ext.get(targetId);
if (target) this.lastTarget = target;
},
endDrag: function() {
var ok = true;
if (this.config.dragData.is_repe) {
ok = confirm(lang('confirm repeating event edition'));
}
if (!ok) return;
date = null;
for (i=0; i<og.ev_cell_dates.length; i++) {
if (og.ev_cell_dates[i].key == this.lastTarget.id) {
date = og.ev_cell_dates[i];
break;
}
}
if (date != null) {
var el = Ext.get(this.getEl());
var parent = Ext.get(date.key);
parent.appendChild(el);
this.config.dragData.day = date.day;
this.config.dragData.month = date.month;
this.config.dragData.year = date.year;
this.config.fn.apply(this.config.scope || window, [this, this.config.dragData]);
} else {
og.err('Invalid grid cell');
}
}
});
// week and day views
og.eventDD = Ext.extend(Ext.dd.DDProxy, {
startDrag: function(x, y) {
var dragEl = Ext.get(this.getDragEl());
var el = Ext.get(this.getEl());
dragEl.applyStyles({border:'','z-index':2000});
dragEl.update(el.dom.innerHTML);
dragEl.applyStyles('opacity: 0.5; filter: alpha(opacity = 50);');
},
onDragOver: function(e, targetId) {
var target = Ext.get(targetId);
if (target) {
this.lastTarget = target;
}
},
onDragOut: function(e, targetId) {
var target = Ext.get(targetId);
if (target) {
this.lastTarget = target;
}
},
endDrag: function() {
var el = Ext.get(this.getEl());
if(this.lastTarget) {
var str_temp = this.lastTarget.id.split ('_');
isAllDay = (this.lastTarget.id.indexOf('alldayeventowner_') >= 0) || (this.lastTarget.id.indexOf('alldaycelltitle_') >= 0);
var ok = true;
if (this.config.dragData.is_repe) {
ok = confirm(lang('confirm repeating event edition'));
}
if (!ok) return;
if (isAllDay) {
var parent = Ext.get('alldayeventowner_'+str_temp[1]);
parent.appendChild(el);
og.<API key>();
} else {
var grid = Ext.get('grid');
var parent = Ext.get('eventowner');
var lt = Ext.get(this.lastTarget);
var top = lt.getTop() - parent.getTop();
var left = 100 * (lt.getLeft() - parent.getLeft() + 3) / grid.getWidth();
el.applyStyles('top:'+top+'px;left:'+left+'%;');
parent.appendChild(el);
/*var cont = Ext.get('gridcontainer');
if (cont.getTop() + cont.getHeight() < el.getTop() + el.getHeight()) {
style = 'height:'+ (cont.getTop() + cont.getHeight() - el.getTop() - 1) +'px';
el.applyStyles(style);
Ext.get(this.getDragEl()).update(el.dom.innerHTML);
}*/
}
if(this.config.fn && 'function' === typeof this.config.fn) {
if (isAllDay) {
date = og.ev_cell_dates[str_temp[1]];
} else {
date = og.ev_cell_dates[str_temp[0].substr(1)];
}
if (date) {
this.config.dragData.day = date.day;
this.config.dragData.month = date.month;
this.config.dragData.year = date.year;
if (!isAllDay) {
this.config.dragData.hour = Math.floor(str_temp[1] / 2);
this.config.dragData.min = (str_temp[1] % 2 == 0 ? 0 : 30);
}
this.config.fn.apply(this.config.scope || window, [this, this.config.dragData]);
} else {
og.err('Invalid grid cell');
}
}
}
}
});
og.createEventDrag = function(div_id, obj_id, is_repetitive, origdate, type, isAllday, dropzone) {
var obj_div = Ext.get(div_id);
obj_div.dd = new og.eventDD(div_id, dropzone, {
dragData: {id: obj_id, is_repe: is_repetitive, orig_date: origdate},
scope: this,
isTarget:false,
fn: function(dd, ddata) {
switch (type) {
case 'event':
if (isAllday) {
ddata.hour = -1;
ddata.min = -1;
}
og.openLink(og.getUrl('event', 'move_event', {id:ddata.id, year:ddata.year, month:ddata.month, day:ddata.day, hour:ddata.hour, min:ddata.min, orig_date:ddata.orig_date}), {
callback: function(success, data) {
if (!isAllday) {
updateTip(div_id, data.ev_data.subject, data.ev_data.start + " - " + data.ev_data.end);
var els = [];
if (Ext.isIE) {
var spans = document.<API key>('span');
for(var i=0; i<spans.length; i++){
if(spans.item(i).getAttribute('name') == div_id+'_info'){
els.push(spans.item(i));
}
}
} else els = document.getElementsByName(div_id+'_info');
if (els.length > 0) {
for (i=0; i<els.length; i++) {
els[i].innerHTML = data.ev_data.start + (cal_actual_view == 'viewweek' || cal_actual_view == 'viewweek5days' ? "" : " - " + data.ev_data.end);
}
}
}
}
});
break;
case 'milestone':
og.openLink(og.getUrl('milestone', 'change_due_date', {id:ddata.id, year:ddata.year, month:ddata.month, day:ddata.day}), {});
break;
case 'task':
var d_to_change = (div_id.indexOf('_end_') != -1 ? 'due' : (div_id.indexOf('_st_') != -1 ? 'start' : 'both'));
og.openLink(og.getUrl('task', '<API key>', {id:ddata.id, year:ddata.year, month:ddata.month, day:ddata.day, tochange:d_to_change}), {});
break;
default: break;
}
}
});
}
og.<API key> = function(div_id, obj_id, is_repetitive, type, origdate) {
var obj_div = Ext.get(div_id);
obj_div.dd = new og.monthViewEventDD(div_id, 'ev_dropzone', {
dragData: {id: obj_id, is_repe: is_repetitive, orig_date: origdate},
scope: this,
isTarget:false,
fn: function(dd, ddata) {
switch (type) {
case 'event':
og.openLink(og.getUrl('event', 'move_event', {id:ddata.id, year:ddata.year, month:ddata.month, day:ddata.day, hour:-1, min:-1, orig_date:ddata.orig_date}), {});
break;
case 'milestone':
og.openLink(og.getUrl('milestone', 'change_due_date', {id:ddata.id, year:ddata.year, month:ddata.month, day:ddata.day, hour:-1, min:-1}), {});
break;
case 'task':
var d_to_change = (div_id.indexOf('_end_') != -1 ? 'due' : (div_id.indexOf('_st_') != -1 ? 'start' : 'both'));
og.openLink(og.getUrl('task', '<API key>', {id:ddata.id, year:ddata.year, month:ddata.month, day:ddata.day, hour:-1, min:-1, tochange:d_to_change}), {});
break;
default: break;
}
}
});
}
og.setResizableEvent = function(div_id, ev_id, w_day) {
var resizer = new Ext.Resizable(div_id, {
adjustments: [0,-4],
handles: 's',
heightIncrement: 21,
resizeChild: 'inner_' + div_id,
pinned: true
});
var prev_height = 0;
resizer.on('beforeResize', function() {
el = resizer.getEl();
if (el) prev_height = el.getHeight();
});
resizer.on('resize', function() {
el = resizer.getEl();
var grid = Ext.get('grid');
width = 100 * el.getWidth() / grid.getWidth();
el.applyStyles('width:'+width+'%;');
rows = (el.getHeight() - prev_height) / 21;
dur_h = Math.floor(rows / 2);
dur_m = rows % 2 == 0 ? 0 : 30;
og.openLink(og.getUrl('event', 'change_duration', {id:ev_id, hours:dur_h, mins:dur_m}), {
callback: function(success, data) {
ev_data = data.ev_data;
updateTip(div_id, ev_data.subject, ev_data.start + " - " + ev_data.end);
}
});
});
}
og.<API key> = function() {
var container = Ext.get('allDayGrid');
var max_height = 0;
for (i=0; i<6; i++) {
var parent = Ext.get('alldayeventowner_' + i);
if (parent != null) {
var obj = parent.first();
var top = 5;
while (obj) {
obj.applyStyles('top:'+top+'px;');
top += 21;
obj = obj.next();
}
if (top > max_height) max_height = top;
}
}
if (max_height > 0) {
max_height += 16;
container.applyStyles('height:'+max_height+'px;');
for (i=0; i<6; i++) {
var parent = Ext.get('alldayeventowner_' + i);
if (parent != null)
parent.applyStyles('height:'+max_height+'px;');
}
}
}
addTipToArray = function(pos, div_id, title, bdy) {
tips_array[pos] = new Ext.ToolTip({
target: div_id,
html: bdy,
title: title,
hideDelay: 1500,
closable: true
});
}
addTip = function(div_id, title, bdy) {
addTipToArray(cant_tips++, div_id, title, bdy);
}
updateTip = function(div_id, title, body) {
for (i=0; i<cant_tips; i++) {
tip = tips_array[i];
if (tip && tip.target.id == div_id) {
tip.disable();
addTipToArray(i, div_id, title, body);
break;
}
}
}
og.change_link_incws = function(hrefid, checkid) {
var link = document.getElementById(hrefid).href
if (document.getElementById(checkid).checked) {
document.getElementById(hrefid).href = link.replace('isw=0', 'isw=1');
} else {
document.getElementById(hrefid).href = link.replace('isw=1', 'isw=0');
}
}
og.overCell = function(cell_id) {
var ele = Ext.get(cell_id);
if (!og.selectingCells) og.old_style = ele.getStyles('background-color', 'opacity', 'filter');
ele.applyStyles({'background-color':'#D3E9FF', 'opacity':'1', 'filter':'alpha(opacity = 100)'});
}
og.resetCell = function(cell_id) {
var ele = Ext.get(cell_id);
ele.applyStyles(og.old_style);
}
og.minSelectedCell = function() {
min_val = 99;
for (i=0; i<og.selectedCells.length; i++) {
if (og.selectedCells[i] != '') {
str_temp = og.selectedCells[i].split('_');
min_val = parseInt(str_temp[1]) < min_val ? parseInt(str_temp[1]) : min_val;
}
}
return min_val;
}
og.paintSelectedCells = function(cell_id) {
str_temp = cell_id.split('_');
cell_id = 'h' + og.paintingDay + '_' + str_temp[1];
if (og.selectingCells && og.actualSelCell != cell_id) {
for (i=0; i<og.selectedCells.length; i++) {
curr_split = og.selectedCells[i].split('_');
if (parseInt(curr_split[1]) > parseInt(str_temp[1])/*cell_id*/) {
og.resetCell(og.selectedCells[i]);
og.selectedCells[i] = '';
}
}
i = og.minSelectedCell();
if (i == 99) i = str_temp[1];
do {
temp_cell = 'h' + og.paintingDay + '_' + i;
og.overCell(temp_cell);
og.selectedCells[og.selectedCells.length] = temp_cell;
i++;
} while (temp_cell != cell_id && i < 48);
og.actualSelCell = cell_id;
}
}
og.clearPaintedCells = function() {
for (i=0; i<og.selectedCells.length; i++) {
if (og.selectedCells[i] != '') og.resetCell(og.selectedCells[i]);
}
og.selectedCells = [];
og.selectingCells = false;
og.actualSelCell = '';
}
// hour range selection
var ev_start_day, ev_start_month, ev_start_year, ev_start_hour, ev_start_minute;
var ev_end_day, ev_end_month, ev_end_year, ev_end_hour, ev_end_minute;
og.selectStartDateTime = function(day, month, year, hour, minute) {
og.selectingCells = true;
og.selectDateTime(true, day, month, year, hour, minute);
}
og.selectEndDateTime = function(day, month, year, hour, minute) {
og.selectDateTime(false, day, month, year, hour, minute);
}
og.selectDateTime = function(start, day, month, year, hour, minute) {
if (start == true) {
ev_start_day = day;
ev_start_month = month;
ev_start_year = year;
ev_start_hour= hour;
ev_start_minute = minute;
} else {
ev_end_day = day;
ev_end_month = month;
ev_end_year = year;
ev_end_hour = hour;
ev_end_minute = minute;
}
}
og.<API key> = function() {
min_val = og.minSelectedCell();
ev_start_hour = Math.floor(min_val / 2);
ev_start_minute = (min_val % 2 == 0) ? 0 : 30;
}
og.getDurationMinutes = function() {
og.<API key>();
var s_val = new Date();
s_val.setFullYear(ev_start_year);
s_val.setMonth(ev_start_month);
s_val.setDate(ev_start_day);
s_val.setHours(ev_start_hour);
s_val.setMinutes(ev_start_minute);
s_val.setSeconds(0);
s_val.setMilliseconds(0);
var e_val = new Date();
e_val.setFullYear(ev_start_year);
e_val.setMonth(ev_start_month);
e_val.setDate(ev_start_day);
e_val.setHours(ev_end_hour);
e_val.setMinutes(ev_end_minute);
e_val.setSeconds(0);
e_val.setMilliseconds(0);
if (ev_end_hour == 0) e_val.setDate(e_val.getDate() + 1);
var millis = e_val.getTime() - s_val.getTime();
return ((millis / 1000) / 60);
}
og.showEventPopup = function(day, month, year, hour, minute, use_24hr, st_val) {
var typeid = 1, hrs = 1, mins = 0;
if (hour == -1 || minute == -1) {
hour = 0;
minute = 0;
typeid = 2;
ev_start_hour = ev_start_minute = durationhour = durationmin = 0;
ev_start_day = day;
ev_start_month = month;
ev_start_year = year;
} else {
og.selectEndDateTime(day, month, year, hour, minute);
hrs = 0;
mins = og.getDurationMinutes();
while (mins >= 60) {
mins -= 60;
hrs +=1;
}
if (hrs == 0) {
hrs = 1;
mins = 0;
}
}
if (use_24hr) {
st_hour = ev_start_hour;
ampm = '';
} else {
if (ev_start_hour >= 12) {
st_hour = ev_start_hour - (ev_start_hour > 12 ? 12 : 0);
ampm = ' PM';
} else {
if (ev_start_hour == 0) st_hour = 12;
else st_hour = ev_start_hour;
ampm = ' AM';
}
}
st_time = st_hour + ':' + ev_start_minute + (ev_start_minute < 10 ? '0' : '') + ampm;
og.EventPopUp.show(null, {day: ev_start_day,
month: ev_start_month,
year: ev_start_year,
hour: ev_start_hour,
minute: ev_start_minute,
durationhour: hrs,
durationmin: mins,
start_value: st_val,
start_time: st_time,
type_id: typeid,
view:'week',
title: lang('add event'),
time_format: use_24hr ? 'G:i' : 'g:i A',
<API key>: 1
}, '');
og.clearPaintedCells();
} |
package com.stratelia.silverpeas.containerManager;
/**
* This is the data structure that represents a link links between icone and action (use in JSP
* ActionBar)
*/
public class URLIcone {
private String sIconePath = ""; // path on the icone to show in the JSP
private String sAlternateText = ""; // Alternate text on the icone
private String sActionURL = ""; // URLs on the action to link with the icones
private boolean bPopUp = true; // Tells the JSP to open the sActionURL in a
// new PopUp window or not
public URLIcone() {
}
public void setIconePath(String sGivenIconePath) {
sIconePath = sGivenIconePath;
}
public String getIconePath() {
return sIconePath;
}
public void setAlternateText(String sGivenAlternateText) {
sAlternateText = sGivenAlternateText;
}
public String getAlternateText() {
return sAlternateText;
}
public void setActionURL(String sGivenActionURL) {
sActionURL = sGivenActionURL;
}
public String getActionURL() {
return sActionURL;
}
public void setPopUp(boolean bGivenPopUp) {
bPopUp = bGivenPopUp;
}
public boolean getPopUp() {
return bPopUp;
}
} |
"""Tests for the source package recipe view classes and templates."""
__metaclass__ = type
from mechanize import LinkNotFoundError
from storm.locals import Store
from testtools.matchers import StartsWith
import transaction
from zope.component import getUtility
from zope.security.interfaces import Unauthorized
from zope.security.proxy import removeSecurityProxy
from lp.buildmaster.enums import BuildStatus
from lp.registry.interfaces.person import IPersonSet
from lp.services.webapp import canonical_url
from lp.soyuz.interfaces.processor import IProcessorSet
from lp.testing import (
admin_logged_in,
ANONYMOUS,
BrowserTestCase,
login,
logout,
person_logged_in,
TestCaseWithFactory,
)
from lp.testing.layers import <API key>
from lp.testing.pages import (
extract_text,
find_main_content,
find_tags_by_class,
setupBrowser,
setupBrowserForUser,
)
from lp.testing.sampledata import ADMIN_EMAIL
class <API key>(TestCaseWithFactory):
layer = <API key>
def test_canonical_url(self):
owner = self.factory.makePerson(name='ppa-owner')
ppa = self.factory.makeArchive(owner=owner, name='ppa')
build = self.factory.<API key>(archive=ppa)
self.assertThat(
canonical_url(build),
StartsWith(
'http://launchpad.dev/~ppa-owner/+archive/ppa/+recipebuild/'))
class <API key>(BrowserTestCase):
"""Create some sample data for recipe tests."""
layer = <API key>
def setUp(self):
"""Provide useful defaults."""
super(<API key>, self).setUp()
self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
self.chef = self.factory.makePerson(
displayname='Master Chef', name='chef')
self.user = self.chef
self.ppa = self.factory.makeArchive(
displayname='Secret PPA', owner=self.chef, name='ppa')
self.squirrel = self.factory.makeDistroSeries(
displayname='Secret Squirrel', name='secret', version='100.04',
distribution=self.ppa.distribution)
naked_squirrel = removeSecurityProxy(self.squirrel)
naked_squirrel.nominatedarchindep = self.squirrel.newArch(
'i386', getUtility(IProcessorSet).getByName('386'), False,
self.chef, <API key>=True)
def makeRecipeBuild(self):
"""Create and return a specific recipe."""
chocolate = self.factory.makeProduct(name='chocolate')
cake_branch = self.factory.makeProductBranch(
owner=self.chef, name='cake', product=chocolate)
recipe = self.factory.<API key>(
owner=self.chef, distroseries=self.squirrel, name=u'cake_recipe',
description=u'This recipe builds a foo for disto bar, with my'
' Secret Squirrel changes.', branches=[cake_branch],
daily_build_archive=self.ppa)
build = self.factory.<API key>(
recipe=recipe)
return build
def test_cancel_build(self):
"""An admin can cancel a build."""
queue = self.factory.<API key>()
build = queue.specific_job.build
transaction.commit()
build_url = canonical_url(build)
logout()
browser = self.getUserBrowser(build_url, user=self.admin)
browser.getLink('Cancel build').click()
self.assertEqual(
browser.getLink('Cancel').url,
build_url)
browser.getControl('Cancel build').click()
self.assertEqual(
browser.url,
build_url)
login(ANONYMOUS)
self.assertEqual(
BuildStatus.SUPERSEDED,
build.status)
def <API key>(self):
"""No one but an admin can cancel a build."""
queue = self.factory.<API key>()
build = queue.specific_job.build
transaction.commit()
build_url = canonical_url(build)
logout()
browser = self.getUserBrowser(build_url, user=self.chef)
self.assertRaises(
LinkNotFoundError,
browser.getLink, 'Cancel build')
self.assertRaises(
Unauthorized,
self.getUserBrowser, build_url + '/+cancel', user=self.chef)
def <API key>(self):
"""If the build isn't queued, you can't cancel it."""
build = self.makeRecipeBuild()
build.cancelBuild()
transaction.commit()
build_url = canonical_url(build)
logout()
browser = self.getUserBrowser(build_url, user=self.admin)
self.assertRaises(
LinkNotFoundError,
browser.getLink, 'Cancel build')
def test_rescore_build(self):
"""An admin can rescore a build."""
queue = self.factory.<API key>()
build = queue.specific_job.build
transaction.commit()
build_url = canonical_url(build)
logout()
browser = self.getUserBrowser(build_url, user=self.admin)
browser.getLink('Rescore build').click()
self.assertEqual(
browser.getLink('Cancel').url,
build_url)
browser.getControl('Score').value = '1024'
browser.getControl('Rescore build').click()
self.assertEqual(
browser.url,
build_url)
login(ANONYMOUS)
self.assertEqual(
build.buildqueue_record.lastscore,
1024)
def <API key>(self):
"""Build scores can only take numbers."""
queue = self.factory.<API key>()
build = queue.specific_job.build
transaction.commit()
build_url = canonical_url(build)
logout()
browser = self.getUserBrowser(build_url, user=self.admin)
browser.getLink('Rescore build').click()
self.assertEqual(
browser.getLink('Cancel').url,
build_url)
browser.getControl('Score').value = 'tentwentyfour'
browser.getControl('Rescore build').click()
self.assertEqual(
extract_text(find_tags_by_class(browser.contents, 'message')[1]),
'Invalid integer data')
def <API key>(self):
"""No one but admin can rescore a build."""
queue = self.factory.<API key>()
build = queue.specific_job.build
transaction.commit()
build_url = canonical_url(build)
logout()
browser = self.getUserBrowser(build_url, user=self.chef)
self.assertRaises(
LinkNotFoundError,
browser.getLink, 'Rescore build')
self.assertRaises(
Unauthorized,
self.getUserBrowser, build_url + '/+rescore', user=self.chef)
def <API key>(self):
"""If the build isn't queued, you can't rescore it."""
build = self.makeRecipeBuild()
build.cancelBuild()
transaction.commit()
build_url = canonical_url(build)
logout()
browser = self.getUserBrowser(build_url, user=self.admin)
self.assertRaises(
LinkNotFoundError,
browser.getLink, 'Rescore build')
def <API key>(self):
"""Show sane error if you attempt to rescore a non-queued build.
This is the case where the user has a stale link that they click on.
"""
build = self.factory.<API key>()
build.cancelBuild()
index_url = canonical_url(build)
browser = self.getViewBrowser(build, '+rescore', user=self.admin)
self.assertEqual(index_url, browser.url)
self.assertIn(
'Cannot rescore this build because it is not queued.',
browser.contents)
def <API key>(self):
"""Show sane error if you attempt to rescore a non-queued build.
This is the case where the user is on the rescore page and submits.
"""
build = self.factory.<API key>()
index_url = canonical_url(build)
browser = self.getViewBrowser(build, '+rescore', user=self.admin)
with person_logged_in(self.admin):
build.cancelBuild()
browser.getLink('Rescore build').click()
self.assertEqual(index_url, browser.url)
self.assertIn(
'Cannot rescore this build because it is not queued.',
browser.contents)
def <API key>(self):
build = self.makeRecipeBuild()
Store.of(build).flush()
build_url = canonical_url(build)
build.updateStatus(
BuildStatus.FULLYBUILT, builder=self.factory.makeBuilder())
browser = self.getViewBrowser(build.builder, '+history')
self.<API key>(
'Build history.*~chef/chocolate/cake recipe build',
extract_text(find_main_content(browser.contents)))
self.assertEqual(build_url,
browser.getLink('~chef/chocolate/cake recipe build').url)
def makeBuildingRecipe(self, archive=None):
builder = self.factory.makeBuilder()
build = self.factory.<API key>(archive=archive)
build.updateStatus(BuildStatus.BUILDING, builder=builder)
build.queueBuild()
build.buildqueue_record.builder = builder
build.buildqueue_record.logtail = 'i am failing'
return build
def <API key>(self, url, user=None):
browser = setupBrowserForUser(user) if user else setupBrowser()
browser.mech_browser.set_handle_equiv(False)
browser.open(url)
return browser
def <API key>(self):
build = self.makeBuildingRecipe()
url = canonical_url(build.builder)
logout()
browser = self.<API key>(url)
self.assertIn('i am failing', browser.contents)
def <API key>(self):
archive = self.factory.makeArchive(private=True)
with admin_logged_in():
build = self.makeBuildingRecipe(archive=archive)
url = canonical_url(removeSecurityProxy(build).builder)
random_person = self.factory.makePerson()
logout()
# An unrelated user can't see the logtail of a private build.
browser = self.<API key>(url, random_person)
self.assertNotIn('i am failing', browser.contents)
# But someone who can see the archive can.
browser = self.<API key>(url, archive.owner)
self.assertIn('i am failing', browser.contents) |
package io.github.pablomusumeci.find.domain.services.api;
import java.util.Map;
public class LearningResponse {
private boolean success;
private String message;
public Map<String, Float> getBayes() {
return bayes;
}
private Map<String, Float> bayes;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
} |
/** @file
* Implementation of performance tests for Connections
*/
#include <fstream>
#include <iostream>
#include <time.h>
#include <stdlib.h>
#include <nupic/algorithms/TemporalMemory.hpp>
#include <nupic/algorithms/Connections.hpp>
#include "<API key>.hpp"
using namespace std;
using namespace nupic;
using namespace nupic::algorithms::temporal_memory;
using namespace nupic::algorithms::connections;
#define SEED 42
namespace nupic
{
void <API key>::RunTests()
{
srand(SEED);
<API key>();
<API key>();
<API key>();
<API key>();
}
/**
* Tests typical usage of Connections with Temporal Memory.
*/
void <API key>::<API key>()
{
<API key>(2048, 40, 5, 100, "temporal memory");
}
/**
* Tests typical usage of Connections with a large Temporal Memory.
*/
void <API key>::<API key>()
{
<API key>(16384, 328, 3, 40, "temporal memory (large)");
}
/**
* Tests typical usage of Connections with Spatial Pooler.
*/
void <API key>::<API key>()
{
<API key>(2048, 2048, 40, 40, "spatial pooler");
}
/**
* Tests typical usage of Connections with Temporal Pooler.
*/
void <API key>::<API key>()
{
<API key>(2048, 16384, 40, 400, "temporal pooler");
}
void <API key>::<API key>(UInt numColumns,
UInt w,
int numSequences,
int numElements,
string label)
{
clock_t timer = clock();
// Initialize
TemporalMemory tm;
vector<UInt> columnDim;
columnDim.push_back(numColumns);
tm.initialize(columnDim);
checkpoint(timer, label + ": initialize");
// Learn
vector< vector< vector<CellIdx> > >sequences;
vector< vector<CellIdx> >sequence;
vector<CellIdx> sdr;
for (int i = 0; i < numSequences; i++)
{
for (int j = 0; j < numElements; j++)
{
sdr = randomSDR(numColumns, w);
sequence.push_back(sdr);
}
sequences.push_back(sequence);
}
for (int i = 0; i < 5; i++)
{
for (auto sequence : sequences)
{
for (auto sdr : sequence)
{
feedTM(tm, sdr);
tm.reset();
}
}
}
checkpoint(timer, label + ": initialize + learn");
// Test
for (auto sequence : sequences)
{
for (auto sdr : sequence)
{
feedTM(tm, sdr, false);
tm.reset();
}
}
checkpoint(timer, label + ": initialize + learn + test");
}
void <API key>::<API key>(UInt numCells,
UInt numInputs,
UInt w,
UInt numWinners,
string label)
{
clock_t timer = clock();
Connections connections(numCells, 1, numInputs);
Segment segment;
vector<CellIdx> sdr;
// Initialize
for (UInt c = 0; c < numCells; c++)
{
segment = connections.createSegment(c);
for (UInt i = 0; i < numInputs; i++)
{
const Permanence permanence = max((Permanence)0.000001,
(Permanence)rand()/RAND_MAX);
connections.createSynapse(segment, i, permanence);
}
}
checkpoint(timer, label + ": initialize");
// Learn
vector<CellIdx> winnerCells;
SynapseData synapseData;
Permanence permanence;
for (int i = 0; i < 500; i++)
{
sdr = randomSDR(numInputs, w);
vector<SegmentOverlap> activeSegments;
vector<SegmentOverlap> matchingSegments;
connections.computeActivity(sdr, 0.5, 0, 0.25, 0,
activeSegments, matchingSegments);
winnerCells = <API key>(connections, numWinners, activeSegments);
for (CellIdx winnerCell : winnerCells)
{
segment = Segment(0, winnerCell);
for (Synapse synapse : connections.synapsesForSegment(segment))
{
synapseData = connections.dataForSynapse(synapse);
permanence = synapseData.permanence;
if (find(sdr.begin(), sdr.end(), synapseData.presynapticCell) !=
sdr.end())
{
permanence += 0.2;
}
else
{
permanence -= 0.1;
}
permanence = max(permanence, (Permanence)0);
permanence = min(permanence, (Permanence)1);
if (permanence == 0)
{
connections.destroySynapse(synapse);
}
else
{
connections.<API key>(synapse, permanence);
}
}
}
}
checkpoint(timer, label + ": initialize + learn");
// Test
for (int i = 0; i < 500; i++)
{
sdr = randomSDR(numInputs, w);
vector<SegmentOverlap> activeSegments;
vector<SegmentOverlap> matchingSegments;
connections.computeActivity(sdr, 0.5, 0, 0.25, 0,
activeSegments, matchingSegments);
winnerCells = <API key>(connections, numWinners, activeSegments);
}
checkpoint(timer, label + ": initialize + learn + test");
}
void <API key>::checkpoint(clock_t timer, string text)
{
float duration = (float)(clock() - timer) / CLOCKS_PER_SEC;
cout << duration << " in " << text << endl;
}
vector<CellIdx> <API key>::randomSDR(UInt n, UInt w)
{
set<UInt> sdrSet = set<UInt>();
vector<CellIdx> sdr;
for (UInt i = 0; i < w; i++)
{
sdrSet.insert(rand() % (UInt)n);
}
for (UInt c : sdrSet)
{
sdr.push_back(c);
}
return sdr;
}
void <API key>::feedTM(TemporalMemory &tm,
vector<CellIdx> sdr,
bool learn)
{
vector<UInt> activeColumns;
for (auto c : sdr)
{
activeColumns.push_back(c);
}
tm.compute(activeColumns.size(), activeColumns.data(), learn);
}
vector<CellIdx> <API key>::<API key>(
Connections& connections, UInt numCells,
vector<SegmentOverlap> activeSegments)
{
set<CellIdx> winnerCells;
std::sort(activeSegments.begin(), activeSegments.end(),
[](const SegmentOverlap& a, const SegmentOverlap&b)
{
return a.overlap > b.overlap;
});
for (const SegmentOverlap& segOverlap : activeSegments)
{
winnerCells.insert(segOverlap.segment.cell);
if (winnerCells.size() >= numCells)
{
break;
}
}
return vector<CellIdx>(winnerCells.begin(), winnerCells.end());
}
} // end namespace nupic
int main(int argc, char *argv[])
{
<API key> test = <API key>();
test.RunTests();
} |
"""
Tests for the dump_to_neo4j management command.
"""
from datetime import datetime
from unittest import mock
import ddt
from django.core.management import call_command
from edx_toggles.toggles.testutils import <API key>
from xmodule.modulestore.tests.django_utils import <API key>
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
import openedx.core.djangoapps.content.block_structure.config as <API key>
from openedx.core.djangoapps.content.block_structure.signals import <API key>
from openedx.core.djangoapps.coursegraph.management.commands.dump_to_neo4j import <API key>
from openedx.core.djangoapps.coursegraph.management.commands.tests.utils import MockGraph, MockNodeMatcher
from openedx.core.djangoapps.coursegraph.tasks import (
coerce_types,
serialize_course,
serialize_item,
should_dump_course,
<API key>
)
from openedx.core.djangolib.testing.utils import skip_unless_lms
class <API key>(<API key>):
"""
Base class for the test suites in this file. Sets up a couple courses.
"""
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.course = CourseFactory.create()
cls.chapter = ItemFactory.create(parent=cls.course, category='chapter')
cls.sequential = ItemFactory.create(parent=cls.chapter, category='sequential')
cls.vertical = ItemFactory.create(parent=cls.sequential, category='vertical', display_name='subject')
cls.html = ItemFactory.create(parent=cls.vertical, category='html')
cls.problem = ItemFactory.create(parent=cls.vertical, category='problem')
cls.video = ItemFactory.create(parent=cls.vertical, category='video', display_name='subject')
cls.video2 = ItemFactory.create(parent=cls.vertical, category='video')
cls.course2 = CourseFactory.create()
cls.course_strings = [str(cls.course.id), str(cls.course2.id)]
@staticmethod
def setup_mock_graph(mock_matcher_class, mock_graph_class, transaction_errors=False):
"""
Replaces the py2neo Graph object with a MockGraph; similarly replaces
NodeMatcher with MockNodeMatcher.
Arguments:
mock_matcher_class: a mocked NodeMatcher class
mock_graph_class: a mocked Graph class
transaction_errors: a bool for whether we should get errors
when transactions try to commit
Returns: an instance of MockGraph
"""
mock_graph = MockGraph(transaction_errors=transaction_errors)
mock_graph_class.return_value = mock_graph
mock_node_matcher = MockNodeMatcher(mock_graph)
mock_matcher_class.return_value = mock_node_matcher
return mock_graph
def assertCourseDump(self, mock_graph, number_of_courses, number_commits, number_rollbacks):
"""
Asserts that we have the expected number of courses, commits, and
rollbacks after we dump the modulestore to neo4j
Arguments:
mock_graph: a MockGraph backend
number_of_courses: number of courses we expect to find
number_commits: number of commits we expect against the graph
number_rollbacks: number of commit rollbacks we expect
"""
courses = {node['course_key'] for node in mock_graph.nodes}
assert len(courses) == number_of_courses
assert mock_graph.number_commits == number_commits
assert mock_graph.number_rollbacks == number_rollbacks
@ddt.ddt
class <API key>(<API key>):
"""
Tests for the dump to neo4j management command
"""
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.NodeMatcher')
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.Graph')
@ddt.data(1, 2)
def <API key>(self, number_of_courses, mock_graph_class, mock_matcher_class):
"""
Test that you can specify which courses you want to dump.
"""
mock_graph = self.setup_mock_graph(mock_matcher_class, mock_graph_class)
call_command(
'dump_to_neo4j',
courses=self.course_strings[:number_of_courses],
host='mock_host',
port=7687,
user='mock_user',
password='mock_password',
)
self.assertCourseDump(
mock_graph,
number_of_courses=number_of_courses,
number_commits=number_of_courses,
number_rollbacks=0
)
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.NodeMatcher')
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.Graph')
def <API key>(self, mock_graph_class, mock_matcher_class):
"""
Test that you can skip courses.
"""
mock_graph = self.setup_mock_graph(
mock_matcher_class, mock_graph_class
)
call_command(
'dump_to_neo4j',
skip=self.course_strings[:1],
host='mock_host',
port=7687,
user='mock_user',
password='mock_password',
)
self.assertCourseDump(
mock_graph,
number_of_courses=1,
number_commits=1,
number_rollbacks=0,
)
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.NodeMatcher')
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.Graph')
def <API key>(self, mock_graph_class, mock_matcher_class):
"""
Test that if you skip and specify the same course, you'll skip it.
"""
mock_graph = self.setup_mock_graph(
mock_matcher_class, mock_graph_class
)
call_command(
'dump_to_neo4j',
skip=self.course_strings[:1],
courses=self.course_strings[:1],
host='mock_host',
port=7687,
user='mock_user',
password='mock_password',
)
self.assertCourseDump(
mock_graph,
number_of_courses=0,
number_commits=0,
number_rollbacks=0,
)
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.NodeMatcher')
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.Graph')
def <API key>(self, mock_graph_class, mock_matcher_class):
"""
Test if you don't specify which courses to dump, then you'll dump
all of them.
"""
mock_graph = self.setup_mock_graph(
mock_matcher_class, mock_graph_class
)
call_command(
'dump_to_neo4j',
host='mock_host',
port=7687,
user='mock_user',
password='mock_password'
)
self.assertCourseDump(
mock_graph,
number_of_courses=2,
number_commits=2,
number_rollbacks=0,
)
class SomeThing:
"""Just to test the stringification of an object."""
def __str__(self):
return "<SomeThing>"
@skip_unless_lms
@ddt.ddt
class <API key>(<API key>):
"""
Tests for the <API key>
"""
@classmethod
def setUpClass(cls):
"""Any ModuleStore course/content operations can go here."""
super().setUpClass()
cls.mss = <API key>.create()
def test_serialize_item(self):
"""
Tests the serialize_item method.
"""
fields, label = serialize_item(self.course)
assert label == 'course'
assert 'edited_on' in list(fields.keys())
assert 'display_name' in list(fields.keys())
assert 'org' in list(fields.keys())
assert 'course' in list(fields.keys())
assert 'run' in list(fields.keys())
assert 'course_key' in list(fields.keys())
assert 'location' in list(fields.keys())
assert 'block_type' in list(fields.keys())
assert 'detached' in list(fields.keys())
assert 'checklist' not in list(fields.keys())
def <API key>(self):
"""
Tests the serialize_course method.
"""
nodes, relationships = serialize_course(self.course.id)
assert len(nodes) == 9
# the course has 7 "PARENT_OF" relationships and 3 "PRECEDES"
assert len(relationships) == 10
def <API key>(self):
"""
Tests that the <API key> function strips the version
and branch from a location
"""
location = self.course.id.make_usage_key(
'test_block_type', 'test_block_id'
).for_branch(
'test_branch'
).for_version(b'test_version')
assert location.branch is not None
assert location.version_guid is not None
stripped_location = <API key>(location)
assert stripped_location.branch is None
assert stripped_location.version_guid is None
@staticmethod
def <API key>(relationships, relationship_type):
"""
Extracts a list of XBlock location tuples from a list of Relationships.
Arguments:
relationships: list of py2neo `Relationship` objects
relationship_type: the type of relationship to filter `relationships`
by.
Returns:
List of tuples of the locations of of the relationships'
constituent nodes.
"""
relationship_pairs = [
(rel.start_node["location"], rel.end_node["location"])
for rel in relationships if type(rel).__name__ == relationship_type
]
return relationship_pairs
@staticmethod
def <API key>(xblock1, xblock2):
"""
Returns a tuple of locations from two XBlocks.
Arguments:
xblock1: an xblock
xblock2: also an xblock
Returns:
A tuple of the string representations of those XBlocks' locations.
"""
return (str(xblock1.location), str(xblock2.location))
def <API key>(self, xblock1, xblock2, relationships, relationship_type):
"""
Helper assertion that a pair of xblocks have a certain kind of
relationship with one another.
"""
relationship_pairs = self.<API key>(relationships, relationship_type)
location_pair = self.<API key>(xblock1, xblock2)
assert location_pair in relationship_pairs
def <API key>(self, xblock1, xblock2, relationships, relationship_type):
"""
The opposite of `<API key>`: asserts that a pair
of xblocks do NOT have a certain kind of relationship.
"""
relationship_pairs = self.<API key>(relationships, relationship_type)
location_pair = self.<API key>(xblock1, xblock2)
assert location_pair not in relationship_pairs
def <API key>(self):
"""
Tests that two nodes that should have a precedes relationship have it.
"""
__, relationships = serialize_course(self.course.id)
self.<API key>(self.video, self.video2, relationships, "PRECEDES")
self.<API key>(self.video2, self.video, relationships, "PRECEDES")
self.<API key>(self.vertical, self.video, relationships, "PRECEDES")
self.<API key>(self.html, self.video, relationships, "PRECEDES")
def <API key>(self):
"""
Test that two nodes that should have a parent_of relationship have it.
"""
__, relationships = serialize_course(self.course.id)
self.<API key>(self.vertical, self.video, relationships, "PARENT_OF")
self.<API key>(self.vertical, self.html, relationships, "PARENT_OF")
self.<API key>(self.course, self.chapter, relationships, "PARENT_OF")
self.<API key>(self.course, self.video, relationships, "PARENT_OF")
self.<API key>(self.video, self.vertical, relationships, "PARENT_OF")
self.<API key>(self.video, self.html, relationships, "PARENT_OF")
def <API key>(self):
"""
Test that we add index values on nodes
"""
nodes, relationships = serialize_course(self.course.id) # lint-amnesty, pylint: disable=unused-variable
# the html node should have 0 index, and the problem should have 1
html_nodes = [node for node in nodes if node['block_type'] == 'html']
assert len(html_nodes) == 1
problem_nodes = [node for node in nodes if node['block_type'] == 'problem']
assert len(problem_nodes) == 1
html_node = html_nodes[0]
problem_node = problem_nodes[0]
assert html_node['index'] == 0
assert problem_node['index'] == 1
@ddt.data(
(1, 1),
(SomeThing(), "<SomeThing>"),
(1.5, 1.5),
("úñîçø∂é", "úñîçø∂é"),
(b"plain string", b"plain string"),
(True, True),
(None, "None"),
((1,), "(1,)"),
# list of elements should be coerced into a list of the
# string representations of those elements
([SomeThing(), SomeThing()], ["<SomeThing>", "<SomeThing>"]),
([1, 2], ["1", "2"]),
)
@ddt.unpack
def test_coerce_types(self, original_value, coerced_expected):
"""
Tests the coerce_types helper
"""
coerced_value = coerce_types(original_value)
assert coerced_value == coerced_expected
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.NodeMatcher')
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.<API key>)
def test_dump_to_neo4j(self, <API key>, mock_matcher_class):
"""
Tests the dump_to_neo4j method works against a mock
py2neo Graph
"""
mock_graph = MockGraph()
<API key>.return_value = mock_graph
mock_matcher_class.return_value = MockNodeMatcher(mock_graph)
# mocking is thorwing error in kombu serialzier and its not require here any more.
credentials = {}
submitted, skipped = self.mss.<API key>(credentials) # lint-amnesty, pylint: disable=unused-variable
self.assertCourseDump(
mock_graph,
number_of_courses=2,
number_commits=2,
number_rollbacks=0,
)
# 9 nodes + 7 relationships from the first course
# 2 nodes and no relationships from the second
assert len(mock_graph.nodes) == 11
self.assertCountEqual(submitted, self.course_strings)
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.NodeMatcher')
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.<API key>)
def <API key>(self, <API key>, mock_matcher_class):
"""
Tests that the the dump_to_neo4j method handles the case where there's
an exception trying to write to the neo4j database.
"""
mock_graph = MockGraph(transaction_errors=True)
<API key>.return_value = mock_graph
mock_matcher_class.return_value = MockNodeMatcher(mock_graph)
# mocking is thorwing error in kombu serialzier and its not require here any more.
credentials = {}
submitted, skipped = self.mss.<API key>(credentials) # lint-amnesty, pylint: disable=unused-variable
self.assertCourseDump(
mock_graph,
number_of_courses=0,
number_commits=0,
number_rollbacks=2,
)
self.assertCountEqual(submitted, self.course_strings)
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.NodeMatcher')
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.<API key>)
@ddt.data((True, 2), (False, 0))
@ddt.unpack
def <API key>(
self,
override_cache,
<API key>,
<API key>,
mock_matcher_class,
):
"""
Tests the caching mechanism and override to make sure we only publish
recently updated courses.
"""
mock_graph = MockGraph()
<API key>.return_value = mock_graph
mock_matcher_class.return_value = MockNodeMatcher(mock_graph)
# mocking is thorwing error in kombu serialzier and its not require here any more.
credentials = {}
# run once to warm the cache
self.mss.<API key>(
credentials, override_cache=override_cache
)
# when run the second time, only dump courses if the cache override
# is enabled
submitted, __ = self.mss.<API key>(
credentials, override_cache=override_cache
)
assert len(submitted) == <API key>
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.NodeMatcher')
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.<API key>)
def <API key>(self, <API key>, mock_matcher_class):
"""
Tests that we only dump those courses that have been published after
the last time the command was been run.
"""
mock_graph = MockGraph()
<API key>.return_value = mock_graph
mock_matcher_class.return_value = MockNodeMatcher(mock_graph)
# mocking is thorwing error in kombu serialzier and its not require here any more.
credentials = {}
# run once to warm the cache
submitted, skipped = self.mss.<API key>(credentials) # lint-amnesty, pylint: disable=unused-variable
assert len(submitted) == len(self.course_strings)
# simulate one of the courses being published
with <API key>(<API key>.<API key>, True):
<API key>(None, self.course.id)
# make sure only the published course was dumped
submitted, __ = self.mss.<API key>(credentials)
assert len(submitted) == 1
assert submitted[0] == str(self.course.id)
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.<API key>')
@mock.patch('openedx.core.djangoapps.coursegraph.tasks.<API key>')
@ddt.data(
(str(datetime(2016, 3, 30)), str(datetime(2016, 3, 31)), True),
(str(datetime(2016, 3, 31)), str(datetime(2016, 3, 30)), False),
(str(datetime(2016, 3, 31)), None, False),
(None, str(datetime(2016, 3, 30)), True),
(None, None, True),
)
@ddt.unpack
def <API key>(
self,
last_command_run,
<API key>,
should_dump,
<API key>,
<API key>,
):
"""
Tests whether a course should be dumped given the last time it was
dumped and the last time it was published.
"""
<API key>.return_value = last_command_run
<API key>.return_value = <API key>
mock_course_key = mock.Mock()
mock_graph = mock.Mock()
assert should_dump_course(mock_course_key, mock_graph) == should_dump |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Chrome page top margin bug</title>
<style>
@page {
size: 400px 200px;
margin: 0;
}
body {
margin: 0;
}
section {
margin-top: 20px;
page-break-after: always;
}
</style>
</head>
<body>
<section>
(1st page) Print this on Chrome and check layout
</section>
<section>
(2nd page) There should be 20px top margin above this text
</section>
</body>
</html> |
import fs from 'fs';
import path from 'path';
import { assert } from 'chai';
import <API key> from '../src/<API key>';
describe('<API key>', () => {
it('separates code based on GENERATED_CODE token', () => {
const fixture = fs.readFileSync(
path.join(__dirname, './fixtures/impl-legacy-basic.cpp'),
'utf-8'
);
const expected = {
globals: '',
<API key>: '// stuff before generated code statement\n',
<API key>: '\n// stuff after generated code statement\n',
};
assert.deepEqual(<API key>(fixture), expected);
});
it('extracts code from global blocks', () => {
const fixture = fs.readFileSync(
path.join(__dirname, './fixtures/<API key>.cpp'),
'utf-8'
);
const expected = {
globals: '#include <Something.h>\n',
<API key>:
'// some stuff before global block\n\n// some more stuff\n',
<API key>:
'\nvoid evaluate(Context ctx) {\n // blah blah\n}\n',
};
assert.deepEqual(<API key>(fixture), expected);
});
it('handles multiple and empty global blocks', () => {
const fixture = fs.readFileSync(
path.join(__dirname, './fixtures/<API key>.cpp'),
'utf-8'
);
const expected = {
globals: '#include <Something.h>\n\n\n#include <AnotherThing.h>\n',
<API key>:
'// some stuff before global block\n\n\n\n// some more stuff\n\nstruct State {};\n',
<API key>:
'\nvoid evaluate(Context ctx) {\n // blah blah\n}\n',
};
assert.deepEqual(<API key>(fixture), expected);
});
}); |
.Scale {
transform: scale(0.8);
opacity: 0;
transition: transform 0.1s linear, opacity 0.1s linear;
}
.Scale.visible {
opacity: 1;
transform: scale(1);
} |
# Numenta Platform for Intelligent Computing (NuPIC)
# following terms and conditions apply:
# This program is free software: you can redistribute it and/or modify
# published by the Free Software Foundation.
# This program is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
"""
Template file used by the OPF Experiment Generator to generate the actual
description.py file by replacing $XXXXXXXX tokens with desired values.
This description.py file was generated by:
'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py'
"""
from nupic.frameworks.opf.expdescriptionapi import <API key>
from nupic.frameworks.opf.<API key> import (
<API key>,
<API key>,
DeferredDictLookup)
from nupic.frameworks.opf.clamodelcallbacks import *
from nupic.frameworks.opf.metrics import MetricSpec
from nupic.frameworks.opf.opfutils import (InferenceType,
InferenceElement)
from nupic.support import aggregationDivide
from nupic.frameworks.opf.opftaskdriver import (
<API key>,
<API key>,
<API key>)
# Model Configuration Dictionary:
# Define the model parameters and adjust for any modifications if imported
# from a sub-experiment.
# between the sub-experiment and base experiment
# NOTE: Use of DEFERRED VALUE-GETTERs: dictionary fields and list elements
# within the config dictionary may be assigned futures derived from the
# ValueGetterBase class, such as DeferredDictLookup.
# This facility is particularly handy for enabling substitution of values in
# the config dictionary from other values in the config dictionary, which is
# needed by permutation.py-based experiments. These values will be resolved
# during the call to <API key>(),
# which we call after the base experiment's config dictionary is updated from
# the sub-experiment. See ValueGetterBase and
# DeferredDictLookup for more details about value-getters.
# For each custom encoder parameter to be exposed to the sub-experiment/
# permutation overrides, define a variable in this section, using key names
# beginning with a single underscore character to avoid collisions with
# pre-defined keys (e.g., <API key>).
# Example:
# config = dict(
# <API key> = 70,
# <API key> = 5,
# dsEncoderSchema = [
# base=dict(
# fieldname='Name2', type='ScalarEncoder',
# name='Name2', minval=0, maxval=270, clipInput=True,
# n=DeferredDictLookup('<API key>'),
# w=DeferredDictLookup('<API key>')),
# <API key>(config)
# <API key>(config)
config = {
# Type of model that the rest of these parameters apply to.
'model': "CLA",
# Version that specifies the format of the config.
'version': 1,
# Intermediate variables used to compute fields in modelParams and also
# referenced from the control section.
'aggregationInfo': { 'fields': [ ('numericFieldNameA', 'mean'),
('numericFieldNameB', 'sum'),
('categoryFieldNameC', 'first')],
'hours': 0},
'predictAheadTime': None,
# Model parameter dictionary.
'modelParams': {
# The type of inference that this model will perform
'inferenceType': 'TemporalNextStep',
'sensorParams': {
# Sensor diagnostic output verbosity control;
# if > 0: sensor region will print out on screen what it's sensing
# at each step 0: silent; >=1: some info; >=2: more info;
# >=3: even more info (see compute() in py/regions/RecordSensor.py)
'verbosity' : 0,
# Example:
# dsEncoderSchema = [
# DeferredDictLookup('<API key>'),
# (value generated from DS_ENCODER_SCHEMA)
'encoders': {
'timestamp_timeOfDay': dict(fieldname='timestamp', type='DateEncoder',timeOfDay=(21,8)),
'timestamp_dayOfWeek': dict(fieldname='timestamp', type='DateEncoder',dayOfWeek=(21,3)),
'consumption': dict(fieldname='consumption',type='ScalarEncoder',
name='consumption', minval=0,maxval=200,
clipInput=True, n=153, w=21, ) #resolution=5),
},
# A dictionary specifying the period for <API key>
# resets from a RecordSensor;
# None = disable <API key> resets (also disabled if
# all of the specified values evaluate to 0).
# Valid keys is the desired combination of the following:
# days, hours, minutes, seconds, milliseconds, microseconds, weeks
# Example for 1.5 days: sensorAutoReset = dict(days=1,hours=12),
# (value generated from SENSOR_AUTO_RESET)
'sensorAutoReset' : None,
},
'spEnable': True,
'spParams': {
# SP diagnostic output verbosity control;
# 0: silent; >=1: some info; >=2: more info;
'spVerbosity' : 0,
'globalInhibition': 1,
# Number of cell columns in the cortical region (same number for
# SP and TP)
# (see also tpNCellsPerCol)
'columnCount': 2048,
'inputWidth': 0,
# SP inhibition control (absolute value);
# Maximum number of active columns in the SP region's output (when
# there are more, the weaker ones are suppressed)
'<API key>': 40,
'seed': 1956,
# potentialPct
# What percent of the columns's receptive field is available
# for potential synapses. At initialization time, we will
# choose potentialPct * (2*potentialRadius+1)^2
'potentialPct': 0.5,
# The default connected threshold. Any synapse whose
# permanence value is above the connected threshold is
# a "connected synapse", meaning it can contribute to the
# cell's firing. Typical value is 0.10. Cells whose activity
# level before inhibition falls below <API key>
# will have their own internal <API key>
# threshold set below this default value.
# (This concept applies to both SP and TP and so 'cells'
# is correct here as opposed to 'columns')
'synPermConnected': 0.1,
'synPermActiveInc': 0.1,
'synPermInactiveDec': 0.01,
},
# Controls whether TP is enabled or disabled;
# TP is necessary for making temporal predictions, such as predicting
# the next inputs. Without TP, the model is only capable of
# reconstructing missing sensor inputs (via SP).
'tmEnable' : True,
'tmParams': {
# TP diagnostic output verbosity control;
# 0: silent; [1..6]: increasing levels of verbosity
# (see verbosity in nupic/trunk/py/nupic/research/TP.py and TP10X*.py)
'verbosity': 0,
# Number of cell columns in the cortical region (same number for
# SP and TP)
# (see also tpNCellsPerCol)
'columnCount': 2048,
# The number of cells (i.e., states), allocated per column.
'cellsPerColumn': 32,
'inputWidth': 2048,
'seed': 1960,
# Temporal Pooler implementation selector (see _getTPClass in
# CLARegion.py).
'temporalImp': 'cpp',
# New Synapse formation count
# NOTE: If None, use <API key>
# TODO: need better explanation
'newSynapseCount': 20,
# Maximum number of synapses per segment
# > 0 for fixed-size CLA
# -1 for non-fixed-size CLA
# TODO: for Ron: once the appropriate value is placed in TP
# constructor, see if we should eliminate this parameter from
# description.py.
'<API key>': 32,
# Maximum number of segments per cell
# > 0 for fixed-size CLA
# -1 for non-fixed-size CLA
# TODO: for Ron: once the appropriate value is placed in TP
# constructor, see if we should eliminate this parameter from
# description.py.
'maxSegmentsPerCell': 128,
# Initial Permanence
# TODO: need better explanation
'initialPerm': 0.21,
# Permanence Increment
'permanenceInc': 0.1,
# Permanence Decrement
# If set to None, will automatically default to tpPermanenceInc
# value.
'permanenceDec' : 0.1,
'globalDecay': 0.0,
'maxAge': 0,
# Minimum number of active synapses for a segment to be considered
# during search for the best-matching segments.
# None=use default
# Replaces: tpMinThreshold
'minThreshold': 12,
# Segment activation threshold.
# A segment is active if it has >= <API key>
# connected synapses that are active due to infActiveState
# None=use default
# Replaces: <API key>
'activationThreshold': 16,
'outputType': 'normal',
# "Pay Attention Mode" length. This tells the TP how many new
# elements to append to the end of a learned sequence at a time.
# Smaller values are better for datasets with short sequences,
# higher values are better for datasets with long sequences.
'pamLength': 1,
},
'clParams': {
# Classifier implementation selection.
'implementation': 'py',
'regionName' : 'SDRClassifierRegion',
# Classifier diagnostic output verbosity control;
# 0: silent; [1..6]: increasing levels of verbosity
'verbosity' : 0,
# This controls how fast the classifier learns/forgets. Higher values
# make it adapt faster and forget older patterns faster.
'alpha': 0.001,
# This is set after the call to <API key> and is
# computed from the aggregationInfo and predictAheadTime.
'steps': '1',
},
'<API key>': False,
},
}
# end of config dictionary
# Adjust base config dictionary for any modifications if imported from a
# sub-experiment
<API key>(config)
# Compute predictionSteps based on the predictAheadTime and the aggregation
# period, which may be permuted over.
if config['predictAheadTime'] is not None:
predictionSteps = int(round(aggregationDivide(
config['predictAheadTime'], config['aggregationInfo'])))
assert (predictionSteps >= 1)
config['modelParams']['clParams']['steps'] = str(predictionSteps)
# Adjust config by applying <API key>
# futures. NOTE: this MUST be called after <API key>() in order
# to support value-getter-based substitutions from the sub-experiment (if any)
<API key>(config)
# [optional] A sequence of one or more tasks that describe what to do with the
# model. Each task consists of a task label, an input spec., iteration count,
# and a task-control spec per opfTaskSchema.json
# NOTE: The tasks are intended for OPF clients that make use of OPFTaskDriver.
# Clients that interact with OPFExperiment directly do not make use of
# the tasks specification.
control = dict(
environment='opfExperiment',
tasks = [
{
# Task label; this label string may be used for diagnostic logging and for
# constructing filenames or directory pathnames for task-specific files, etc.
'taskLabel' : "OnlineLearning",
# Input stream specification per py/nupic/cluster/database/StreamDef.json.
'dataset' : {
'info': 'test_NoProviders',
'version': 1,
'streams': [
{
'columns': ['*'],
'info': 'my gym.csv dataset',
'source': 'file://extra/gym/gym_melbourne.csv',
'first_record': 0,
'last_record': 4000
}
],
# TODO: Aggregation is not supported yet by run_opf_experiment.py
#'aggregation' : config['aggregationInfo']
},
# Iteration count: maximum number of iterations. Each iteration corresponds
# to one record from the (possibly aggregated) dataset. The task is
# terminated when either number of iterations reaches iterationCount or
# all records in the (possibly aggregated) database have been processed,
# whichever occurs first.
# iterationCount of -1 = iterate over the entire dataset
'iterationCount' : -1,
# Task Control parameters for OPFTaskDriver (per <API key>.json)
'taskControl' : {
# Iteration cycle list consisting of opftaskdriver.<API key>
# instances.
'iterationCycle' : [
#<API key>(1000),
<API key>(1000, inferenceArgs=None),
#<API key>(10, inferenceArgs=None),
],
'metrics' : [
MetricSpec(field=u'consumption',
inferenceElement='prediction',
metric='aae',
params={'window': 200}),
],
# Logged Metrics: A sequence of regular expressions that specify which of
# the metrics from the Inference Specifications section MUST be logged for
# every prediction. The regex's correspond to the automatically generated
# metric labels. This is similar to the way the optimization metric is
# specified in permutations.py.
'loggedMetrics': ['.*nupicScore.*', ".*aae.*"],
# Callbacks for experimentation/research (optional)
'callbacks' : {
# Callbacks to be called at the beginning of a task, before model iterations.
# Signature: callback(<reference to OPFExperiment>); returns nothing
# 'setup' : [<API key>, <API key>],
# 'setup' : [<API key>],
'setup' : [],
# Callbacks to be called after every learning/inference iteration
# Signature: callback(<reference to OPFExperiment>); returns nothing
'postIter' : [],
# Callbacks to be called when the experiment task is finished
# Signature: callback(<reference to OPFExperiment>); returns nothing
'finish' : []
}
} # End of taskControl
}, # End of task
]
)
<API key> = <API key>(modelConfig=config,
control=control) |
package com.torodb.torod.db.backends;
import com.google.common.base.Preconditions;
import com.torodb.torod.core.backend.DbBackend;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import javax.annotation.Nonnull;
import javax.inject.Singleton;
import javax.sql.DataSource;
@Singleton
public abstract class AbstractDbBackend implements DbBackend {
public static final int <API key> = 1;
public static final int <API key> = 1;
public static final int <API key> = 2;
public static final int <API key> = <API key> + <API key>
+ <API key>;
private static final int <API key> = 16;
private static final int <API key> = 64;
private static final long <API key> = 10 * 60 * 1000;
private static final long <API key> = 10L * 1000;
private final <API key> configuration;
private HikariDataSource commonDataSource;
private HikariDataSource systemDataSource;
private HikariDataSource <API key>;
private volatile boolean <API key> = false;
/**
* Configure the backend. The contract specifies that any subclass must call initialize() method after
* properly constructing the object.
*
* @param configuration
*/
public AbstractDbBackend(<API key> configuration) {
this.configuration = configuration;
int connectionPoolSize = configuration.<API key>();
int <API key> = configuration.<API key>();
Preconditions.checkState(
connectionPoolSize >= <API key>,
"At least " + <API key> + " total connections with the backend SQL database are required"
);
Preconditions.checkState(
<API key> >= <API key>,
"At least " + <API key> + " read connection(s) is(are) required"
);
Preconditions.checkState(
connectionPoolSize - <API key> >= <API key>,
"Reserved read connections must be lower than total connections minus "
+ <API key>
);
}
protected abstract void <API key>(@Nonnull HikariDataSource dataSource);
protected synchronized void initialize() {
if(<API key>) {
return;
}
int <API key> = configuration.<API key>();
commonDataSource = <API key>(
configuration, "session",
configuration.<API key>() - <API key> - <API key>
);
systemDataSource = <API key>(configuration, "system", <API key>);
<API key> = <API key>(configuration, "cursors", <API key>);
<API key>(<API key>);
<API key>.setReadOnly(true);
<API key> = true;
}
private HikariDataSource <API key>(
<API key> configuration, String poolName, int poolSize
) {
HikariConfig hikariConfig = new HikariConfig();
// Delegate database-specific setting of connection parameters and any specific configuration
hikariConfig.setDataSource(<API key>(configuration, poolName));
// Apply ToroDB-specific datasource configuration
hikariConfig.<API key>(<API key>);
hikariConfig.setPoolName(poolName);
hikariConfig.setMaximumPoolSize(poolSize);
return new HikariDataSource(hikariConfig);
}
protected abstract DataSource <API key>(<API key> configuration, String poolName);
private void <API key>() {
if(! <API key>) {
initialize();
}
}
@Override
public DataSource <API key>() {
<API key>();
return commonDataSource;
}
@Override
public DataSource getSystemDataSource() {
<API key>();
return systemDataSource;
}
@Override
public DataSource <API key>() {
<API key>();
return <API key>;
}
@Override
public int <API key>() {
return <API key>;
}
@Override
public int <API key>() {
return <API key>;
}
@Override
public long <API key>() {
return <API key>;
}
@Override
public void shutdown() {
commonDataSource.shutdown();
systemDataSource.shutdown();
<API key>.shutdown();
}
} |
DELETE FROM `weenie` WHERE `class_Id` = 38320;
INSERT INTO `weenie` (`class_Id`, `class_Name`, `type`, `last_Modified`)
VALUES (38320, '<API key>', 10, '2019-02-10 00:00:00') /* Creature */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (38320, 1, 16) /* ItemType - Creature */
, (38320, 2, 31) /* CreatureType - Human */
, (38320, 6, -1) /* ItemsCapacity */
, (38320, 7, -1) /* ContainersCapacity */
, (38320, 16, 32) /* ItemUseable - Remote */
, (38320, 25, 200) /* Level */
, (38320, 93, 6292504) /* PhysicsState - ReportCollisions, IgnoreCollisions, Gravity, <API key>, EdgeSlide */
, (38320, 95, 8) /* RadarBlipColor - Yellow */
, (38320, 113, 1) /* Gender - Male */
, (38320, 133, 4) /* ShowableOnRadar - ShowAlways */
, (38320, 134, 16) /* PlayerKillerStatus - RubberGlue */
, (38320, 188, 1) /* HeritageGroup - Aluvian */
, (38320, 281, 2) /* Faction1Bits - EldrytchWeb */
, (38320, 288, 1001) /* SocietyRankEldweb */
, (38320, 8007, 0) /* <API key> */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (38320, 1, True ) /* Stuck */
, (38320, 19, False) /* Attackable */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (38320, 54, 3) /* UseRadius */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (38320, 1, 'Promotions Officer') /* Name */
, (38320, 5, 'Society Officer') /* Template */
, (38320, 8006, 'AAA9AAAAAAA=') /* <API key> */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (38320, 1, 0x02000001) /* Setup */
, (38320, 2, 0x09000001) /* MotionTable */
, (38320, 3, 0x20000001) /* SoundTable */
, (38320, 6, 0x0400007E) /* PaletteBase */
, (38320, 8, 0x06000FF1) /* Icon */
, (38320, 9, 0x05001151) /* EyesTexture */
, (38320, 10, 0x0500117D) /* NoseTexture */
, (38320, 11, 0x05001192) /* MouthTexture */
, (38320, 15, 0x04001FC4) /* HairPalette */
, (38320, 16, 0x040002BE) /* EyesPalette */
, (38320, 17, 0x040002B8) /* SkinPalette */
, (38320, 8001, 9437238) /* <API key> - ItemsCapacity, ContainersCapacity, Usable, UseRadius, RadarBlipColor, RadarBehavior */
, (38320, 8003, 4) /* <API key> - Stuck */
, (38320, 8005, 100355) /* <API key> - CSetup, MTable, STable, Position, Movement */;
INSERT INTO `<API key>` (`object_Id`, `position_Type`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`)
VALUES (38320, 8040, 0x00B8011D, 109.883, -133.677, -23.995, 1, 0, 0, 0) /* <API key> */
/* @teleloc 0x00B8011D [109.883000 -133.677000 -23.995000] 1.000000 0.000000 0.000000 0.000000 */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (38320, 8000, 0xAE25315E) /* <API key> */;
INSERT INTO `<API key>` (`object_Id`, `type`, `init_Level`, `level_From_C_P`, `c_P_Spent`)
VALUES (38320, 1, 240, 0, 0) /* Strength */
, (38320, 2, 200, 0, 0) /* Endurance */
, (38320, 3, 250, 0, 0) /* Quickness */
, (38320, 4, 200, 0, 0) /* Coordination */
, (38320, 5, 290, 0, 0) /* Focus */
, (38320, 6, 290, 0, 0) /* Self */;
INSERT INTO `<API key>` (`object_Id`, `type`, `init_Level`, `level_From_C_P`, `c_P_Spent`, `current_Level`)
VALUES (38320, 1, 196, 0, 0, 296) /* MaxHealth */
, (38320, 3, 196, 0, 0, 396) /* MaxStamina */
, (38320, 5, 196, 0, 0, 486) /* MaxMana */;
INSERT INTO `<API key>` (`object_Id`, `sub_Palette_Id`, `offset`, `length`)
VALUES (38320, 67109560, 0, 24)
, (38320, 67109566, 32, 8)
, (38320, 67116996, 24, 8);
INSERT INTO `<API key>` (`object_Id`, `index`, `old_Id`, `new_Id`)
VALUES (38320, 16, 83886232, 83890685)
, (38320, 16, 83886668, 83890513)
, (38320, 16, 83886837, 83890557)
, (38320, 16, 83886684, 83890578);
INSERT INTO `<API key>` (`object_Id`, `index`, `animation_Id`)
VALUES (38320, 0, 16794164)
, (38320, 1, 16794177)
, (38320, 2, 16794167)
, (38320, 3, 16794172)
, (38320, 4, 16794174)
, (38320, 5, 16794176)
, (38320, 6, 16794166)
, (38320, 7, 16794173)
, (38320, 8, 16794175)
, (38320, 9, 16794160)
, (38320, 10, 16794170)
, (38320, 11, 16794158)
, (38320, 12, 16794163)
, (38320, 13, 16794171)
, (38320, 14, 16794159)
, (38320, 15, 16794162)
, (38320, 16, 16794169)
, (38320, 21, 16777708)
, (38320, 22, 16777708); |
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
$module_name = 'abc_affiliate';
$listViewDefs[$module_name] = array(
'NAME' => array(
'width' => '32',
'label' => 'LBL_NAME',
'default' => true,
'link' => true),
'ASSIGNED_USER_NAME' => array(
'type'=>'relate',
'width' => '9',
'label' => '<API key>',
'module' => 'Users',
'id' => 'ASSIGNED_USER_ID',
'default' => true,
'link' => true,
'related_fields' => array('ASSIGNED_USER_ID')),
);
?> |
'use strict';
angular.module( 'portailApp' )
.component( 'news',
{
bindings: { edition: '<' },
controller: [ '$sce', 'Popups', '$http', '$q', 'URL_ENT', 'RANDOM_IMAGES', 'currentUser',
function( $sce, Popups, $http, $q, URL_ENT, RANDOM_IMAGES, currentUser ) {
var ctrl = this;
ctrl.newsfeed = [];
ctrl.retrieve_news = function( force_reload ) {
var one_month_ago = moment().subtract( 1, 'months' ).toDate().toISOString();
$http.get( URL_ENT + '/api/news', {
params: {
user_id: ctrl.user.id,
'pubDate>': one_month_ago
}
} )
.then( function( response ) {
ctrl.newsfeed = _( response.data ).map( function( item, index ) {
item.trusted_content = $sce.trustAsHtml( item.description );
item.no_image = _( item.image ).isNull();
item.pubDate = moment( new Date( item.pubDate ) ).toDate();
item.image = 'app/node_modules/<API key>/images/11_publipostage.svg';
return item;
} );
ctrl.carouselIndex = 0;
if ( _( ctrl.user.profiles ).isEmpty() ) {
return $q.resolve( { data: [] } );
} else {
return $http.get( URL_ENT + '/api/structures/' + ctrl.user.active_profile().structure_id + '/rss', { params: { 'pubDate>': one_month_ago } } );
}
} )
.then( function( response ) {
ctrl.newsfeed = ctrl.newsfeed.concat( _( response.data ).map( function( item, index ) {
item.trusted_content = $sce.trustAsHtml( item.content );
item.no_image = _( item.image ).isNull();
item.pubDate = moment( new Date( item.pubDate ) ).toDate();
if ( _( item.image ).isNull() ) {
item.image = _( RANDOM_IMAGES ).sample();
}
return item;
} ) );
} );
};
ctrl.config_news_fluxes = function() {
Popups.manage_fluxes( function() {
ctrl.retrieve_news( true );
}, function error() { } );
};
ctrl.$onInit = function() {
currentUser.get( false ).then( function( user ) {
ctrl.user = user;
ctrl.retrieve_news( false );
} );
};
}],
template: `
<ul class="noir" rn-carousel <API key> <API key>="6" rn-carousel-index="$ctrl.carouselIndex">
<li ng:repeat="slide in $ctrl.newsfeed | orderBy:'pubDate':true" active="slide.active"
ng:class="{'publipostage': slide.title == 'Publipostage', 'no-image': slide.no_image}">
<div class="carousel-image"
ng:style="{'background-image': 'url(' + slide.image + ')'}"></div>
<div class="carousel-caption">
<span class="pub-date" ng:cloak>{{ slide.pubDate | date:'medium' }}</span>
<a href="{{ slide.link }}" target="_blank" ng:if="slide.link != 'notYetImplemented'">
<h6 ng:cloak>{{ slide.title }}</h6>
</a>
<h6 ng:if="slide.link == 'notYetImplemented'">{{ slide.title }}</h6>
<p ng:bind-html="slide.trusted_content"></p>
</div>
</li>
<div class="hidden-xs hidden-sm <API key>"
<API key>
slides="$ctrl.newsfeed"
rn-carousel-index="$ctrl.carouselIndex">
</div>
<span class="hidden-xs hidden-sm floating-button big toggle bouton-config-news blanc"
ng:if="$ctrl.user.is_admin() && $ctrl.edition"
ng:click="$ctrl.config_news_fluxes()"></span>
</ul>
`
} ); |
<?php
require 'configure.php';
require 'errorcodes.php';
require 'establish_link.php';
require 'utilfuncs.php';
/**
* Function that loads a map from the database.
* Might be worth refactoring this somewhat.
*/
function get_map( $userID, $pass_hash, $mapID, $timestamp ) {
global $version;
//Set up the basics of the XML.
header( "Content-type: text/xml" );
$outputstr = "<?xml version='1.0' encoding='UTF-8'?>\n<map version='$version'></map>";
$output = new SimpleXMLElement( $outputstr );
//Standard SQL connection stuff
$linkID = establishLink();
if ( ! $linkID ) {
badDBLink( $output );
return $output;
}
if ( ! $userID ) {
//Don't have to check login info here
} else if ( ! checkLogin( $userID, $pass_hash, $linkID ) ) {
incorrectLogin( $output );
return $output;
}
$mapID = <API key>( $linkID, $mapID );
$timestamp = <API key>( $linkID, $timestamp );
$query = "SELECT maps.map_id,maps.proj_id, maps.title,maps.map_type,maps.created_date, category_map.category_id,projects.is_hostile,users.username,users.url FROM maps INNER JOIN users ON users.user_id = maps.user_id inner JOIN category_map on maps.map_id=category_map.map_id left join projects on projects.proj_id=category_map.category_id WHERE maps.is_deleted = 0 and maps.map_id=$mapID";
$resultID = mysqli_query( $linkID, $query );
if ( ! $resultID ) {
dataNotFound( $output, $query );
return $output;
}
if ( mysqli_num_rows( $resultID ) == 0 ) {
nonexistent( $output, $query );
return $output;
}
$row = mysqli_fetch_assoc( $resultID );
if ( $row['proj_id'] ) {
//Map is in a project.
//Confirm that the project allows the user to open a map
if ( isUserInMapProject( $userID, $mapID, $linkID ) ) {
//Nothing needs to be done, the logic will continue as normal
} else {
//Bail!
notInProject( $output, "User ID: $userID and Map ID: $mapID" );
return $output;
}
}
//If map isn't in a project, continue as normal.
$output->addAttribute( "ID", $row['map_id'] );
$output->addAttribute( "title", $row['title'] );
$output->addAttribute( "username", $row['username'] );
$output->addAttribute( "url", $row['url'] );
$output->addAttribute( "project", $row['category_id'] );
$output->addAttribute( "map_type", $row['map_type'] );
$output->addAttribute( "is_hostile", $row['is_hostile'] );
$output->addAttribute( "created_date", $row['created_date'] );
if ( $timestamp == 0 ) {
$output->addAttribute( "reloadRPANEL", "1" );
} else {
$output->addAttribute( "reloadRPANEL", "0" );
}
$mapHistory = false;
// check for the history of the map and get the same ..
$query = "SELECT * FROM maps inner join SavedComponents on map_id=CompId inner join users on OrgUserId=users.user_id where type=1 and map_id = $mapID";
$resultID = mysqli_query( $linkID, $query );
if ( $resultID && mysqli_num_rows( $resultID ) > 0 ) {
$detailTree = $output->addChild( "mapHistory" );
<API key>( $mapID, 0, $detailTree, $linkID );
$mapHistory = true;
}
$timeID = mysqli_query( $linkID, "SELECT NOW()" );
if ( ! $timeID ) {
noTime( $output );
return $output;
}
$timerow = mysqli_fetch_assoc( $timeID );
$now = $timerow['NOW()'];
$output->addAttribute( "timestamp", $now );
// Textboxes are easy!
$query = "SELECT * FROM textboxes WHERE map_id = $mapID AND modified_date>'$timestamp' ORDER BY textbox_id";
$resultID = mysqli_query( $linkID, $query );
if ( $resultID ) {
for ( $x = 0; $x < mysqli_num_rows( $resultID ); $x++ ) {
$row = mysqli_fetch_assoc( $resultID );
$textbox = $output->addChild( "textbox" );
$textbox->addAttribute( "ID", $row['textbox_id'] );
$textbox->addAttribute( "text", to_utf8( $row['text'] ) );
$textbox->addAttribute( "deleted", $row['is_deleted'] );
}
}
// Nodes take a bit more work.
/*$query = "SELECT * FROM nodes INNER JOIN users ON nodes.user_id=users.user_id NATURAL JOIN node_types
WHERE map_id = $mapID AND modified_date>\"$timestamp\" ORDER BY node_id";
*/
$query = "SELECT nodes.node_id, nodes.nodetype_id,users.firstname,users.lastname,users.url, users.username, nodes.x_coord, nodes.y_coord, nodes.typed, nodes.is_positive, nodes.connected_by, nodes.is_deleted, node_types.type
FROM nodes INNER JOIN users ON nodes.user_id=users.user_id NATURAL JOIN node_types
WHERE map_id = $mapID AND modified_date>\"$timestamp\" ORDER BY node_id";
if ( $mapHistory ) {
$query = "SELECT nodes.node_id,nodes.nodetype_id, users.firstname,users.lastname,users.url, users.username, nodes.x_coord, nodes.y_coord, nodes.typed, nodes.is_positive, nodes.connected_by, nodes.is_deleted, node_types.type,usersparent.user_id AS prevauthoruid,usersparent.username AS prevauthor,usersparent.url AS prevauthorurl FROM nodes INNER JOIN users ON nodes.user_id=users.user_id left join SavedComponents ON nodes.node_id = CompId left join nodes as nodesparent on OrgCompId = nodesparent.node_id left join users as usersparent on nodesparent.user_id = usersparent.user_id left JOIN node_types on nodes.nodetype_id = node_types.nodetype_id
WHERE nodes.map_id = $mapID AND nodes.modified_date>\"$timestamp\" ORDER BY nodes.node_id";
}
$resultID = mysqli_query( $linkID, $query );
if ( $resultID ) {
for ( $x = 0; $x < mysqli_num_rows( $resultID ); $x++ ) {
$row = mysqli_fetch_assoc( $resultID );
error_log( $query, 0 );
$node_id = $row['node_id'];
$node = $output->addChild( "node" );
$node->addAttribute( "ID", $node_id );
$node->addAttribute( "Type", $row['type'] );
$node->addAttribute( "Author", $row['username'] );
$node->addAttribute( "FirstName", $row['firstname'] );
$node->addAttribute( "LastName", $row['lastname'] );
$node->addAttribute( "URL", $row['url'] );
$node->addAttribute( "x", $row['x_coord'] );
$node->addAttribute( "y", $row['y_coord'] );
$node->addAttribute( "typed", $row['typed'] );
$node->addAttribute( "positive", $row['is_positive'] );
$node->addAttribute( "connected_by", $row['connected_by'] );
$node->addAttribute( "deleted", $row['is_deleted'] );
if ( $mapHistory ) {
$node->addAttribute( "PA", $row['prevauthor'] );
$node->addAttribute( "PAUrl", $row['prevauthorurl'] );
}
//Have to do this instead of a proper join for the simple reason that we don't want to have multiple instances of the same <node>
$innerQuery = "SELECT * FROM nodetext WHERE node_id=$node_id ORDER BY position ASC";
$resultID2 = mysqli_query( $linkID, $innerQuery );
if ( ! $resultID2 ) {
dataNotFound( $output, $innerQuery );
return $output;
}
for ( $y = 0; $y < mysqli_num_rows( $resultID2 ); $y++ ) {
$nodetext = $node->addChild( "nodetext" );
$innerRow = mysqli_fetch_assoc( $resultID2 );
$nodetext->addAttribute( "ID", $innerRow['nodetext_id'] );
$nodetext->addAttribute( "textboxID", $innerRow['textbox_id'] );
$nodetext->addAttribute( "targetNodeID", $innerRow['target_node_id'] );
$nodetext->addAttribute( "deleted", $innerRow['is_deleted'] );
}
}
}
// sourcenodes will take a lot more work.
$query = "SELECT * FROM connections NATURAL JOIN connection_types WHERE map_id = $mapID AND modified_date>\"$timestamp\"";
$resultID = mysqli_query( $linkID, $query );
if ( $resultID ) {
for ( $x = 0; $x < mysqli_num_rows( $resultID ); $x++ ) {
$row = mysqli_fetch_assoc( $resultID );
$conn_id = $row['connection_id'];
$connection = $output->addChild( "connection" );
$connection->addAttribute( "connID", $conn_id );
$connection->addAttribute( "type", $row['conn_name'] );
$connection->addAttribute( "targetnode", $row['node_id'] );
$connection->addAttribute( "x", $row['x_coord'] );
$connection->addAttribute( "y", $row['y_coord'] );
$connection->addAttribute( "deleted", $row['is_deleted'] );
//Set up the inner query to find the source nodes
$innerQuery = "SELECT * FROM sourcenodes WHERE connection_id=$conn_id";
$resultID2 = mysqli_query( $linkID, $innerQuery );
if ( ! $resultID2 ) {
dataNotFound( $output, $innerQuery );
return $output;
}
for ( $y = 0; $y < mysqli_num_rows( $resultID2 ); $y++ ) {
$sourcenode = $connection->addChild( "sourcenode" );
$innerRow = mysqli_fetch_assoc( $resultID2 );
$sourcenode->addAttribute( "ID", $innerRow['sn_id'] );
$sourcenode->addAttribute( "nodeID", $innerRow['node_id'] );
$sourcenode->addAttribute( "deleted", $innerRow['is_deleted'] );
}
}
}
return $output;
}
$userID = $_REQUEST['uid'];
$pass_hash = $_REQUEST['pass_hash'];
$mapID = $_REQUEST['map_id'];
$timestamp = $_REQUEST['timestamp'];
$output = get_map( $userID, $pass_hash, $mapID, $timestamp );
print $output->asXML(); |
#include <string>
#include <cstdio>
#include <cstdlib>
#include <time.h>
int main(int argc, char** argv){
char buffer1[2048] = {0};
char buffer2[2048] = {0};
int bytesTotal = 0;
int bytesMoved = 0;
int bytes = 0;
int change = 0;
int iterations = 0;
std::string oper1 = "Test String to be sent over the network.";
std::string oper2 = "";
printf("Oper1 = %s\n", oper1.c_str());
bytesTotal = oper1.size()+2;
buffer1[0] = (char)bytesTotal;
bytesMoved = 1;
srand(time(NULL));
while(bytesMoved < bytesTotal){
iterations++;
change = (bytesTotal - bytesMoved) * (rand() % 4 + 1) / 4;
memmove(&buffer1[bytesMoved], &oper1.c_str()[bytesMoved],change);
bytesMoved += change;
}
printf("%u\n",(unsigned char) buffer1[0]);
bytesTotal = (int)buffer1[0];
bytesMoved = 1;
while(bytesMoved < bytesTotal){
iterations++;
change = (bytesTotal - bytesMoved) * (rand() % 4 + 1) / 4;
memmove(&buffer2[bytesMoved-1], &buffer1[bytesMoved-1], change);
bytesMoved += change;
}
oper2 = buffer2;
printf("Oper2 = %s\n", oper2.c_str());
printf("Iterations = %d\n", iterations);
return 0;
} |
<?php
namespace Core;
/**
* Session class
*
* @package core
* @author Frederic Guillot
*/
class Session
{
const SESSION_LIFETIME = 0; // Until the browser is closed
/**
* Return true if the session is open
*
* @static
* @access public
* @return boolean
*/
public static function isOpen()
{
return session_id() !== '';
}
/**
* Open a session
*
* @access public
* @param string $base_path Cookie path
* @param string $save_path Custom session save path
*/
public function open($base_path = '/', $save_path = '')
{
if ($save_path !== '') {
session_save_path($save_path);
}
// HttpOnly and secure flags for session cookie
<API key>(
self::SESSION_LIFETIME,
$base_path ?: '/',
null,
Tool::isHTTPS(),
true
);
// Avoid session id in the URL
ini_set('session.use_only_cookies', '1');
// Ensure session ID integrity
ini_set('session.entropy_file', '/dev/urandom');
ini_set('session.entropy_length', '32');
ini_set('session.<API key>', 6);
// If session was autostarted with session.auto_start = 1 in php.ini destroy it, otherwise we cannot login
if (isset($_SESSION)) {
session_destroy();
}
// Custom session name
session_name('__S');
// Start the session
session_start();
// Regenerate the session id to avoid session fixation issue
if (empty($_SESSION['__validated'])) {
<API key>(true);
$_SESSION['__validated'] = 1;
}
}
/**
* Destroy the session
*
* @access public
*/
public function close()
{
// Flush all sessions variables
$_SESSION = array();
// Destroy the session cookie
if (ini_get('session.use_cookies')) {
$params = <API key>();
setcookie(
session_name(),
'',
time() - 42000,
$params['path'],
$params['domain'],
$params['secure'],
$params['httponly']
);
}
// Destroy session data
session_destroy();
}
/**
* Register a flash message (success notification)
*
* @access public
* @param string $message Message
*/
public function flash($message)
{
$_SESSION['flash_message'] = $message;
}
/**
* Register a flash error message (error notification)
*
* @access public
* @param string $message Message
*/
public function flashError($message)
{
$_SESSION['flash_error_message'] = $message;
}
} |
package com.nokia.mole.common;
import java.io.Serializable;
import java.util.Random;
import org.apache.log4j.Logger;
public class ID implements Comparable<ID>, Serializable {
private static final long serialVersionUID = 1L;
static Logger log = Logger.getLogger(ID.class);
public static final Random random = new Random ();
public final long id;
public ID (long _id) {
id = _id;
}
public ID (ID _id) {
id = _id.id;
}
public ID () {
// TODO think about nextLong 48 bit limitation
// see code in Posti
id = random.nextLong();
}
public int compareTo(ID _id) {
if (_id.id == id) return 0;
if (_id.id < id) return 1;
return -1;
}
} |
# AirCasting - Share your Air!
# This program is free software: you can redistribute it and/or modify
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# You can contact the authors by email at <info@habitatmap.org>
class CreateSessions < ActiveRecord::Migration
def change
create_table :sessions do |t|
t.timestamps
end
end
end |
/*
LudiPQ - 1 - 2 Portal
@author Jvlaple
*/
function enter(pi) {
var nextMap = 922010400;
var eim = pi.getPlayer().getEventInstance();
var target = eim.getMapInstance(nextMap);
var targetPortal = target.getPortal("st00");
// only let people through if the eim is ready
var avail = eim.getProperty("3stageclear");
if (avail == null) {
// can't go thru eh?
pi.getPlayer().dropMessage(5, "Some seal is blocking this door.");
return false;
}
else {
pi.playPortalSound();
pi.getPlayer().changeMap(target, targetPortal);
return true;
}
} |
\hypertarget{<API key>}{}\section{Riferimenti per il file Elaborato7/\+Driver\+\_\+\+G\+P\+I\+O\+\_\+\+Custom/\+Terza\+\_\+\+Tipologia/main.c}
\label{<API key>}\index{Elaborato7/\+Driver\+\_\+\+G\+P\+I\+O\+\_\+\+Custom/\+Terza\+\_\+\+Tipologia/main.\+c@{Elaborato7/\+Driver\+\_\+\+G\+P\+I\+O\+\_\+\+Custom/\+Terza\+\_\+\+Tipologia/main.\+c}}
driver \char`\"{}mygpio\+\_\+uiointdriver\char`\"{} to control gpio
{\ttfamily \#include \char`\"{}mygpio\+\_\+uiointdriver.\+h\char`\"{}}\newline
Grafo delle dipendenze di inclusione per main.\+c\+:
% FIG 0
\subsection*{Funzioni}
\begin{DoxyCompactItemize}
\item
int \hyperlink{_elaborato7_2_driver___g_p_i_o___custom_2_terza___tipologia_2main_8c_a0ddf1224851353fc92bfbff6f499fa97}{main} (int argc, char $\ast$argv\mbox{[}$\,$\mbox{]})
\end{DoxyCompactItemize}
\subsection{Descrizione dettagliata}
driver \char`\"{}mygpio\+\_\+uiointdriver\char`\"{} to control gpio
\begin{DoxyAuthor}{Autori}
Colella Gianni -\/ Guida Ciro -\/ Lombardi Daniele / Group IV -\/ Sistemi Embedded 2016-\/2017
\end{DoxyAuthor}
\begin{DoxyVersion}{Versione}
V1.\+0
\end{DoxyVersion}
\begin{DoxyDate}{Data}
5-\/\+July-\/2017
\end{DoxyDate}
\subsection{Documentazione delle funzioni}
\mbox{\Hypertarget{_elaborato7_2_driver___g_p_i_o___custom_2_terza___tipologia_2main_8c_a0ddf1224851353fc92bfbff6f499fa97}\label{_elaborato7_2_driver___g_p_i_o___custom_2_terza___tipologia_2main_8c_a0ddf1224851353fc92bfbff6f499fa97}}
\index{Elaborato7/\+Driver\+\_\+\+G\+P\+I\+O\+\_\+\+Custom/\+Terza\+\_\+\+Tipologia/main.\+c@{Elaborato7/\+Driver\+\_\+\+G\+P\+I\+O\+\_\+\+Custom/\+Terza\+\_\+\+Tipologia/main.\+c}!main@{main}}
\index{main@{main}!Elaborato7/\+Driver\+\_\+\+G\+P\+I\+O\+\_\+\+Custom/\+Terza\+\_\+\+Tipologia/main.\+c@{Elaborato7/\+Driver\+\_\+\+G\+P\+I\+O\+\_\+\+Custom/\+Terza\+\_\+\+Tipologia/main.\+c}}
\subsubsection{\texorpdfstring{main()}{main()}}
{\footnotesize\ttfamily int main (\begin{DoxyParamCaption}\item[{int}]{argc, }\item[{char $\ast$}]{argv\mbox{[}$\,$\mbox{]} }\end{DoxyParamCaption})}
$<$ First step
Structure and variable declaration
$<$ Second step
mygpio\+\_\+parse\+\_\+command function is called to parse all argument passed to driver mygpio\+\_\+nodriver
$<$ Third step
mygpio\+\_\+open\+\_\+memory function is called to achieve gpio virtual address
$<$ Fourth step
mygpio\+\_\+read\+\_\+gpio is called if r\+\_\+w variable is R\+E\+AD, otherwise is called write\+\_\+gpio function
$<$ First step
mygpio\+\_\+close\+\_\+memory function is called to close memory file and delete file descriptor
Definizione alla linea 14 del file main.\+c.
Referenzia mygpio\+\_\+close\+\_\+memory(), mygpio\+\_\+open\+\_\+memory(), mygpio\+\_\+parse\+\_\+command(), mygpio\+\_\+read\+\_\+gpio(), mygpio\+\_\+write\+\_\+gpio(), mygpio\+\_\+\+Type\+Def\+::r\+\_\+w, e R\+E\+AD.
\begin{DoxyCode}
14 \{
17 \hyperlink{<API key>}{mygpio\_TypeDef} mygpio; \textcolor{comment}{/* Structure associated to GPIO custom peripheral */}
18 \textcolor{keywordtype}{int} ret\_parse; \textcolor{comment}{/* Returned value from mygpio\_parse\_command function */}
21 \textcolor{comment}{/* Check if parse\_command function returns error */}
22 \textcolor{keywordflow}{if}((ret\_parse=\hyperlink{<API key>}{mygpio\_parse\_command}(argc,argv,&mygpio))==1)
23 \textcolor{keywordflow}{return} 0;
24 \textcolor{keywordflow}{else}
25 \textcolor{keywordflow}{if}(ret\_parse==-1)
26 \textcolor{keywordflow}{return} -1;
27
30 \textcolor{comment}{/* Check if mygpio\_open\_memory function returns error */}
31 \textcolor{keywordflow}{if}(\hyperlink{<API key>}{mygpio\_open\_memory}(&mygpio)==-1)\{
32 printf(\textcolor{stringliteral}{"mygpio\_uiointdriver aborted!\(\backslash\)n"});
33 \textcolor{keywordflow}{return} -1;
34 \}
35 \textcolor{comment}{
38 \textcolor{comment}{} \textcolor{keywordflow}{if} ((mygpio.\hyperlink{<API key>}{r\_w}) == \hyperlink{<API key>}{READ}) \{
39 \textcolor{keywordflow}{if}(\hyperlink{<API key>}{mygpio\_read\_gpio}(&mygpio)==-1)
40 \textcolor{keywordflow}{return} -1;
41 \}
42 \textcolor{keywordflow}{else} \hyperlink{<API key>}{mygpio\_write\_gpio}(&mygpio);
45 \hyperlink{<API key>}{mygpio\_close\_memory}(&mygpio);
46
47 \textcolor{keywordflow}{return} 0;
48 \}
\end{DoxyCode} |
<!DOCTYPE html>
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="SHORTCUT ICON" href="../../../../img/clover.ico" />
<link rel="stylesheet" href="../../../../aui/css/aui.min.css" media="all"/>
<link rel="stylesheet" href="../../../../aui/css/aui-experimental.min.css" media="all"/>
<!--[if IE 9]><link rel="stylesheet" href="../../../../aui/css/aui-ie9.min.css" media="all"/><![endif]-->
<style type="text/css" media="all">
@import url('../../../../style.css');
@import url('../../../../tree.css');
</style>
<script src="../../../../jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="../../../../aui/js/aui.min.js" type="text/javascript"></script>
<script src="../../../../aui/js/aui-experimental.min.js" type="text/javascript"></script>
<script src="../../../../aui/js/aui-soy.min.js" type="text/javascript"></script>
<script src="../../../../package-nodes-tree.js" type="text/javascript"></script>
<script src="../../../../clover-tree.js" type="text/javascript"></script>
<script src="../../../../clover.js" type="text/javascript"></script>
<script src="../../../../clover-descriptions.js" type="text/javascript"></script>
<script src="../../../../cloud.js" type="text/javascript"></script>
<title><API key> </title>
</head>
<body onload="onLoad('<API key> : com.rapidminer.operator.meta.FileIterator.java')">
<div id="page">
<header id="header" role="banner">
<nav class="aui-header <API key>" role="navigation">
<div class="aui-header-inner">
<div class="aui-header-primary">
<h1 id="logo" class="aui-header-logo <API key>">
<a href="http:
</h1>
</div>
<div class="<API key>">
<ul class="aui-nav">
<li id="system-help-menu">
<a class="aui-nav-link" title="Open online Clover documentation" target="_blank"
href="https://confluence.atlassian.com/display/CLOVER/Clover+Documentation+Home">
<span class="aui-icon aui-icon-small aui-iconfont-help"> Help</span>
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="aui-page-panel">
<div class="<API key>">
<div class="aui-page-panel-nav <API key>">
<div class="<API key>" style="margin-bottom: 20px;">
<div class="<API key>">
<div class="aui-avatar aui-avatar-large aui-avatar-project">
<div class="aui-avatar-inner">
<img src="../../../../img/clover_logo_large.png" alt="Clover icon"/>
</div>
</div>
</div>
<div class="<API key>" >
<h1>
<API key>
</h1>
</div>
</div>
<nav class="aui-navgroup <API key>">
<div class="aui-navgroup-inner">
<ul class="aui-nav">
<li class="">
<a href="../../../../dashboard.html">Project overview</a>
</li>
</ul>
<div class="aui-nav-heading <API key>">
<strong>Packages</strong>
</div>
<div class="aui-nav project-packages">
<form method="get" action="#" class="aui <API key>">
<input type="text" autocomplete="off" class="package-filter text"
placeholder="Type to filter packages..." name="package-filter" id="package-filter"
title="Start typing package name (or part of the name) to search through the tree. Use arrow keys and the Enter key to navigate."/>
</form>
<p class="<API key> hidden">
<small>No results found.</small>
</p>
<div class="<API key>" data-root-relative="../../../../" data-package-name="com.rapidminer.operator.meta">
<div class="<API key>"></div>
<div class="<API key>"></div>
</div>
</div>
</div>
</nav> </div>
<section class="<API key>">
<div class="<API key>">
<ol class="aui-nav aui-nav-breadcrumbs">
<li><a href="../../../../dashboard.html">Project Clover database 5 2017 16:40:29 CST</a></li>
<li><a href="pkg-summary.html"> Package com.rapidminer.operator.meta</a></li>
</ol>
<h1 class="aui-h2-clover">
File FileIterator.java
</h1>
<div class="aui-message aui-message-warning">
<p class="title">
<strong>Evaluation License</strong>
</p>
<p>
This report was generated with an evaluation server license. <a href="http:
</p>
</div>
<div class="aui-tabs horizontal-tabs" id="tabs-file">
<div class="tabs-pane <API key> active-pane" id="tabs-file-source">
<div> </div>
<div style="display: table; width: 100%">
<div style="display: table-cell; ">
<div class="dashboard-widget">
<header class="<API key>">
<h3>Code metrics</h3>
</header>
<div class="<API key>">
<div id="td-header-stats" class="aui-item" style="display: ">
<div style="display: table">
<div class="stats-box">
<div class="stats-box-label"><label title="Total number of branches in this file">Branches:</label></div>
<div class="stats-box-value">0</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Total number of statements in this file">Statements:</label></div>
<div class="stats-box-value">0</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Total number of methods in this file">Methods:</label></div>
<div class="stats-box-value">0</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Total number of classes in this file">Classes:</label></div>
<div class="stats-box-value">1</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Total number of lines of code in this file">LOC:</label></div>
<div class="stats-box-value">131</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Total number of non-comment lines of code in this file">NCLOC:</label></div>
<div class="stats-box-value">83</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Cyclomatic complexity is the number of paths in this file">Total complexity:</label></div>
<div class="stats-box-value">0</div>
</div>
<div class="stats-box">
<div class="stats-box-label">
<label title="Complexity density is the complexity divided by the number of statements in this file">Complexity density:</label>
</div>
<div class="stats-box-value">-</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Number of statements per method.">Statements/Method:</label></div>
<div class="stats-box-value">-</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Number of methods per class.">Methods/Class:</label></div>
<div class="stats-box-value">0</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Complexity divided by the number of methods in this file">Average method complexity:</label></div>
<div class="stats-box-value">-</div>
</div>
</div>
<div class="subtle">
<small><strong>100%</strong> of code in this file is excluded from these metrics.</small>
<label class="aui-button aui-button-subtle" onclick="toggleStats('td-header-stats', '<API key>');"
title="Include or exclude filtered elements from these statistics.">Remove Filter</label>
</div>
</div>
<div id="<API key>" class="aui-item" style="display: none">
<div style="display: table">
<div class="stats-box">
<div class="stats-box-label"><label title="Total number of branches in this file">Branches:</label></div>
<div class="stats-box-value">12</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Total number of statements in this file">Statements:</label></div>
<div class="stats-box-value">35</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Total number of methods in this file">Methods:</label></div>
<div class="stats-box-value">6</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Total number of classes in this file">Classes:</label></div>
<div class="stats-box-value">1</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Total number of lines of code in this file">LOC:</label></div>
<div class="stats-box-value">131</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Total number of non-comment lines of code in this file">NCLOC:</label></div>
<div class="stats-box-value">83</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Cyclomatic complexity is the number of paths in this file">Total complexity:</label></div>
<div class="stats-box-value">19</div>
</div>
<div class="stats-box">
<div class="stats-box-label">
<label title="Complexity density is the complexity divided by the number of statements in this file">Complexity density:</label>
</div>
<div class="stats-box-value">0.54</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Number of statements per method.">Statements/Method:</label></div>
<div class="stats-box-value">5.83</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Number of methods per class.">Methods/Class:</label></div>
<div class="stats-box-value">6</div>
</div>
<div class="stats-box">
<div class="stats-box-label"><label title="Complexity divided by the number of methods in this file">Average method complexity:</label></div>
<div class="stats-box-value">3.17</div>
</div>
</div>
<div class="subtle">
<small>These metrics include <strong class='bold'>100%</strong> of code marked as filtered.</small>
<label class="aui-button aui-button-subtle" onclick="toggleStats('<API key>', 'td-header-stats');"
title="Include or exclude filtered elements from these statistics.">Apply Filter</label>
</div>
</div> </div>
</div>
</div>
</div>
<h2>Classes</h2>
<table class="aui aui-table-sortable">
<thead>
<tr> <th>Class</th>
<th>Line
<th class="">
<label title="The total number of statements.">Total Statements</label>
</th>
<th class="">
<label title="Cyclomatic complexity is a measure of the number of paths in your code.">Complexity</label>
</th>
<th class="">
<label title="The amount of code that was hit at least once during testing.">TOTAL Coverage</label>
</th>
<th>Actions</th>
</tr> </thead>
<tbody>
<tr> <td id="FileIterator">
<span><a href="#44" title="FileIterator" onclick="<API key>('dialog-FileIterator', '44');">FileIterator</a></span>
</td>
<td>44<a name="sl-44"></a></td>
<td class="">0</td>
<td class="">0</td>
<td class=""><div style="display: table; width: 100%">
<div class="barGraphValue"><span class="sortValue">-1.0</span> - </div><div style="display: table-cell">
<div title="Empty" class="barEmpty" style="min-width:200px;"></div></div></div></td>
<td><button data-dialog-id="dialog-FileIterator" class="aui-button aui-button-link dialog-show-button">Show methods</button></td>
</tr> </tbody>
</table>
<section role="dialog" id="dialog-FileIterator" class="aui-layer aui-dialog2 aui-dialog2-xlarge" aria-hidden="true">
<header class="aui-dialog2-header">
<h1 class="<API key>">Class FileIterator</h1>
<div class="<API key>">
<input id="<API key>" class="test-filter text" type="text" name="method-filter"
placeholder="Type to filter methods..." autocomplete="off"
onkeyup="filterMethods('<API key>', '<API key>');"/>
</div>
</header>
<div class="aui-dialog2-content">
<table class="aui aui-table-sortable">
<thead>
<tr> <th id="FileIterator">
Class<br/> <span><a href="#44" title="FileIterator" onclick="<API key>('dialog-FileIterator', '44');">FileIterator</a></span>
</th>
<th>Line #<br/>44<a name="sl-44"></a></th>
<th class=""><label title="The total number of statements.">Total Statements</label><br/>0</th>
<th class=""><label title="Cyclomatic complexity is a measure of the number of paths in your code.">Complexity</label><br/>0</th>
<th class=""><label title="The amount of code that was hit at least once during testing.">TOTAL Coverage</label><br/><div style="display: table; width: 100%">
<div class="barGraphValue"><span class="sortValue">-1.0</span> - </div><div style="display: table-cell">
<div title="Empty" class="barEmpty" style="min-width:200px;"></div></div></div></th>
</tr> </thead>
<tbody id="<API key>">
<tr id="FileIterator-1">
<td id="summary-52-2">
<span class="sortValue">FileIterator(OperatorDescription)</span>
  <a href="?line=29#52" title="FileIterator(OperatorDescription)" name="sl-52" onclick="<API key>('dialog-FileIterator', '52');">FileIterator(OperatorDescription)</a>
</td>
<td align="right"><span class="sortValue">52</span>52</td>
<td class="" align="right"><span class="sortValue">0.0</span>0</td>
<td class="" align="right"><span class="sortValue">1.0</span>1</td>
<td class="" align="right"><span class="sortValue">-1.0</span><div style="display: table; width: 100%">
<div class="barGraphValue"><span class="sortValue">-1.0</span> - </div><div style="display: table-cell">
<div title="Empty" class="barEmpty" style="min-width:200px;"></div></div></div></td>
</tr> <tr id="FileIterator-2">
<td id="summary-56-2">
<span class="sortValue">doWork() : void</span>
  <a href="?line=29#56" title="doWork() : void" name="sl-56" onclick="<API key>('dialog-FileIterator', '56');">doWork() : void</a>
</td>
<td align="right"><span class="sortValue">56</span>56</td>
<td class="" align="right"><span class="sortValue">0.0</span>0</td>
<td class="" align="right"><span class="sortValue">1.0</span>1</td>
<td class="" align="right"><span class="sortValue">-1.0</span><div style="display: table; width: 100%">
<div class="barGraphValue"><span class="sortValue">-1.0</span> - </div><div style="display: table-cell">
<div title="Empty" class="barEmpty" style="min-width:200px;"></div></div></div></td>
</tr> <tr id="FileIterator-3">
<td id="summary-63-2">
<span class="sortValue"><API key>(File,Pattern,boolean,boolean,boolean,List<EntryContainer>) : List<EntryContainer></span>
  <a href="?line=29#63" title="<API key>(File,Pattern,boolean,boolean,boolean,List<EntryContainer>) : List<EntryContainer>" name="sl-63" onclick="<API key>('dialog-FileIterator', '63');"><API key>(File,Pattern,boolean,boolean,boolean,List<EntryContainer>) : List<EntryContainer></a>
</td>
<td align="right"><span class="sortValue">63</span>63</td>
<td class="" align="right"><span class="sortValue">0.0</span>0</td>
<td class="" align="right"><span class="sortValue">1.0</span>1</td>
<td class="" align="right"><span class="sortValue">-1.0</span><div style="display: table; width: 100%">
<div class="barGraphValue"><span class="sortValue">-1.0</span> - </div><div style="display: table-cell">
<div title="Empty" class="barEmpty" style="min-width:200px;"></div></div></div></td>
</tr> <tr id="FileIterator-4">
<td id="summary-90-2">
<span class="sortValue">iterate(Object,Pattern,boolean,boolean,boolean) : void</span>
  <a href="?line=29#90" title="iterate(Object,Pattern,boolean,boolean,boolean) : void" name="sl-90" onclick="<API key>('dialog-FileIterator', '90');">iterate(Object,Pattern,boolean,boolean,boolean) : void</a>
</td>
<td align="right"><span class="sortValue">90</span>90</td>
<td class="" align="right"><span class="sortValue">0.0</span>0</td>
<td class="" align="right"><span class="sortValue">1.0</span>1</td>
<td class="" align="right"><span class="sortValue">-1.0</span><div style="display: table; width: 100%">
<div class="barGraphValue"><span class="sortValue">-1.0</span> - </div><div style="display: table-cell">
<div title="Empty" class="barEmpty" style="min-width:200px;"></div></div></div></td>
</tr> <tr id="FileIterator-5">
<td id="summary-110-2">
<span class="sortValue">getParameterTypes() : List<ParameterType></span>
  <a href="?line=29#110" title="getParameterTypes() : List<ParameterType>" name="sl-110" onclick="<API key>('dialog-FileIterator', '110');">getParameterTypes() : List<ParameterType></a>
</td>
<td align="right"><span class="sortValue">110</span>110</td>
<td class="" align="right"><span class="sortValue">0.0</span>0</td>
<td class="" align="right"><span class="sortValue">1.0</span>1</td>
<td class="" align="right"><span class="sortValue">-1.0</span><div style="display: table; width: 100%">
<div class="barGraphValue"><span class="sortValue">-1.0</span> - </div><div style="display: table-cell">
<div title="Empty" class="barEmpty" style="min-width:200px;"></div></div></div></td>
</tr> <tr id="FileIterator-6">
<td id="summary-124-2">
<span class="sortValue"><API key>() : OperatorVersion[]</span>
  <a href="?line=29#124" title="<API key>() : OperatorVersion[]" name="sl-124" onclick="<API key>('dialog-FileIterator', '124');"><API key>() : OperatorVersion[]</a>
</td>
<td align="right"><span class="sortValue">124</span>124</td>
<td class="" align="right"><span class="sortValue">0.0</span>0</td>
<td class="" align="right"><span class="sortValue">1.0</span>1</td>
<td class="" align="right"><span class="sortValue">-1.0</span><div style="display: table; width: 100%">
<div class="barGraphValue"><span class="sortValue">-1.0</span> - </div><div style="display: table-cell">
<div title="Empty" class="barEmpty" style="min-width:200px;"></div></div></div></td>
</tr> </tbody>
</table>
<div> </div>
</div>
<footer class="aui-dialog2-footer">
<div class="<API key>">
<button class="aui-button aui-button-primary dialog-close-button"
data-dialog-id="dialog-FileIterator">Close</button>
</div>
<div class="<API key>">Click on a class or a method name to jump to source.</div>
</footer>
</section>
<div> </div>
<h2>Contributing tests</h2>
<div class="aui-message">
<p>No tests hitting this source file were found.</p>
</div>
<h2>Source view</h2>
<div style="display: table; width: 100%;">
<div style="display: table-cell">
<button class="aui-button aui-button-link"
title="Toggles all methods in the source to be either expanded or collapsed."
onclick="<API key>(this); return false;" id="method-expander">
Collapse all methods
</button>
</div>
<div style="display: table-cell">
<div style="text-align: right; margin-bottom: 10px">
<button class="aui-button aui-button-subtle" id="popupHelp">
<span class="aui-icon aui-icon-small aui-iconfont-help"></span> Show legend
</button>
<script>
AJS.InlineDialog(AJS.$("#popupHelp"), "helpDialog",
function(content, trigger, showPopup) {
content.css({"padding":"20px"}).html(<API key>);
showPopup();
return false;
},
{
width: 700, hideDelay: 60000
}
);
</script> </div>
</div>
</div>
<table cellspacing="0" cellpadding="0" class="srcView" width="100%">
<tbody> <tr id="l1">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=1#src-1">1</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
</tr>
<tr id="l19">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=19#src-19">19</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-19" class="srcLine"><span class="keyword">package</span> com.<a href="../../../rapidminer/pkg-summary.html">rapidminer</a>.<a href="../../operator/pkg-summary.html">operator</a>.<a href="../meta/pkg-summary.html">meta</a>;</span></td>
</tr>
<tr id="l20">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=20#src-20">20</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-20" class="srcLine"></span></td>
</tr>
<tr id="l21">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=21#src-21">21</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-21" class="srcLine"><span class="keyword">import</span> java.io.File;</span></td>
</tr>
<tr id="l22">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=22#src-22">22</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-22" class="srcLine"><span class="keyword">import</span> java.util.Arrays;</span></td>
</tr>
<tr id="l23">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=23#src-23">23</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-23" class="srcLine"><span class="keyword">import</span> java.util.LinkedList;</span></td>
</tr>
<tr id="l24">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=24#src-24">24</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-24" class="srcLine"><span class="keyword">import</span> java.util.List;</span></td>
</tr>
<tr id="l25">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=25#src-25">25</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-25" class="srcLine"><span class="keyword">import</span> java.util.regex.Pattern;</span></td>
</tr>
<tr id="l26">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=26#src-26">26</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-26" class="srcLine"></span></td>
</tr>
<tr id="l27">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=27#src-27">27</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-27" class="srcLine"><span class="keyword">import</span> com.<a href="../../../rapidminer/pkg-summary.html">rapidminer</a>.<a href="../../operator/pkg-summary.html">operator</a>.<a href="../../../../com/rapidminer/operator/OperatorDescription.html#OperatorDescription">OperatorDescription</a>;</span></td>
</tr>
<tr id="l28">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=28#src-28">28</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-28" class="srcLine"><span class="keyword">import</span> com.<a href="../../../rapidminer/pkg-summary.html">rapidminer</a>.<a href="../../operator/pkg-summary.html">operator</a>.<a href="../../../../com/rapidminer/operator/OperatorException.html#OperatorException">OperatorException</a>;</span></td>
</tr>
<tr id="l29">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=29#src-29">29</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-29" class="srcLine"><span class="keyword">import</span> com.<a href="../../../rapidminer/pkg-summary.html">rapidminer</a>.<a href="../../operator/pkg-summary.html">operator</a>.<a href="../../../../com/rapidminer/operator/OperatorVersion.html#OperatorVersion">OperatorVersion</a>;</span></td>
</tr>
<tr id="l30">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=30#src-30">30</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-30" class="srcLine"><span class="keyword">import</span> com.<a href="../../../rapidminer/pkg-summary.html">rapidminer</a>.<a href="../../operator/pkg-summary.html">operator</a>.<a href="../../../../com/rapidminer/operator/UserError.html#UserError">UserError</a>;</span></td>
</tr>
<tr id="l31">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=31#src-31">31</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-31" class="srcLine"><span class="keyword">import</span> com.<a href="../../../rapidminer/pkg-summary.html">rapidminer</a>.<a href="../../operator/pkg-summary.html">operator</a>.<a href="../nio/pkg-summary.html">nio</a>.<a href="../nio/file/pkg-summary.html">file</a>.<a href="../../../../com/rapidminer/operator/nio/file/FileObject.html#FileObject">FileObject</a>;</span></td>
</tr>
<tr id="l32">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=32#src-32">32</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-32" class="srcLine"><span class="keyword">import</span> com.<a href="../../../rapidminer/pkg-summary.html">rapidminer</a>.<a href="../../operator/pkg-summary.html">operator</a>.<a href="../nio/pkg-summary.html">nio</a>.<a href="../nio/file/pkg-summary.html">file</a>.<a href="../../../../com/rapidminer/operator/nio/file/SimpleFileObject.html#SimpleFileObject">SimpleFileObject</a>;</span></td>
</tr>
<tr id="l33">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=33#src-33">33</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-33" class="srcLine"><span class="keyword">import</span> com.<a href="../../../rapidminer/pkg-summary.html">rapidminer</a>.<a href="../../parameter/pkg-summary.html">parameter</a>.<a href="../../../../com/rapidminer/parameter/ParameterType.html#ParameterType">ParameterType</a>;</span></td>
</tr>
<tr id="l34">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=34#src-34">34</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-34" class="srcLine"><span class="keyword">import</span> com.<a href="../../../rapidminer/pkg-summary.html">rapidminer</a>.<a href="../../parameter/pkg-summary.html">parameter</a>.<a href="../../../../com/rapidminer/parameter/<API key>.html#<API key>"><API key></a>;</span></td>
</tr>
<tr id="l35">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=35#src-35">35</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-35" class="srcLine"></span></td>
</tr>
<tr id="l36">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=36#src-36">36</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-36" class="srcLine"></span></td>
</tr>
<tr id="l37">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=37#src-37">37</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-37" class="srcLine"><span class="comment">/**</span></span></td>
</tr>
<tr id="l38">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=38#src-38">38</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-38" class="srcLine"><span class="comment"> * This operator iterates over the files in the specified directory (and subdirectories if the</span></span></td>
</tr>
<tr id="l39">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=39#src-39">39</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-39" class="srcLine"><span class="comment"> * corresponding parameter is set to true).</span></span></td>
</tr>
<tr id="l40">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=40#src-40">40</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-40" class="srcLine"><span class="comment"> *</span></span></td>
</tr>
<tr id="l41">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=41#src-41">41</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-41" class="srcLine"><span class="comment"> * </span><span class="javadoc">@author</span><span class="comment"> Sebastian Land, Ingo Mierswa, Marius Helf</span></span></td>
</tr>
<tr id="l42">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=42#src-42">42</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-42" class="srcLine"><span class="comment"> */</span></span></td>
</tr>
<tr id="l43">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=43#src-43">43</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-43" class="srcLine">@Deprecated</span></td>
</tr>
<tr class="inlineStatsRow" align="right" valign="middle">
<td class="coverageCount"><a name="44" class="nolink"> </a></td>
<td class="coverageCount aui-icon aui-icon-small <API key>" id='<API key>' onclick="toggleInlineStats(this, 'inlinestats-44');"/>
<td align="center" valign="middle">
<table id="inlinestats-44" style="display:none;" class="inlineStats" width="100%" cellspacing="1px" cellpadding="1px">
<tr onclick="toggleInlineStats(document.getElementById('<API key>'), 'inlinestats-44');return true;">
<td><div>
<div title="Empty" class="barEmpty" style="min-width:40px;"></div>
</div></td><td> - </td>
<td class="inlineStat">Uncovered Elements: 0 (0)</td>
<td class="inlineStat">Complexity: 0</td>
<td class="inlineStat">Complexity Density: -</td>
</tr>
</table>
</td>
</tr>
<tr id="l44">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=44#src-44">44</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" id="id-44"><span class="spacer"></span><span id="src-44" class="srcLine"><span class="keyword">public</span> <span class="keyword">class</span> <a href="../../../../com/rapidminer/operator/meta/FileIterator.html#FileIterator">FileIterator</a> <span class="keyword">extends</span> <a href="../../../../com/rapidminer/operator/meta/<API key>.html#<API key>"><API key></a> {</span></td>
</tr>
<tr id="l45">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=45#src-45">45</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-45" class="srcLine"></span></td>
</tr>
<tr id="l46">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=46#src-46">46</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-46" class="srcLine"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> String PARAMETER_DIRECTORY = <span class="string">"directory"</span>;</span></td>
</tr>
<tr id="l47">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=47#src-47">47</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-47" class="srcLine"></span></td>
</tr>
<tr id="l48">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=48#src-48">48</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-48" class="srcLine"> <span class="keyword">private</span> File directory;</span></td>
</tr>
<tr id="l49">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=49#src-49">49</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-49" class="srcLine"></span></td>
</tr>
<tr id="l50">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=50#src-50">50</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-50" class="srcLine"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> <a href="../../../../com/rapidminer/operator/OperatorVersion.html#OperatorVersion">OperatorVersion</a> <API key> = <span class="keyword">new</span> <a href="../../../../com/rapidminer/operator/OperatorVersion.html#OperatorVersion">OperatorVersion</a>(6, 4, 0);</span></td>
</tr>
<tr id="l51">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=51#src-51">51</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-51" class="srcLine"></span></td>
</tr>
<tr class="inlineStatsRow" align="right" valign="middle">
<td class="coverageCount"><a name="52" class="nolink"> </a></td>
<td class="coverageCount aui-icon aui-icon-small <API key>" id='<API key>' onclick="toggleInlineStats(this, 'inlinestats-52');"/>
<td align="center" valign="middle">
<table id="inlinestats-52" style="display:none;" class="inlineStats" width="100%" cellspacing="1px" cellpadding="1px">
<tr onclick="toggleInlineStats(document.getElementById('<API key>'), 'inlinestats-52');return true;">
<td><div>
<div title="Empty" class="barEmpty" style="min-width:40px;"></div>
</div></td><td> - </td>
<td class="inlineStat">Uncovered Elements: 0 (0)</td>
<td class="inlineStat">Complexity: 1</td>
<td class="inlineStat">Complexity Density: -</td>
</tr>
</table>
</td>
</tr>
<tr id="l52">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=52#src-52">52</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" methodStart srcCell" id="id-52"><img title="Method Statistics" onclick="toggleSrcRowVis(this, 52,54);" id="img-52" src="../../../../img/collapse.gif" alt="toggle" class="icon"/><span id="src-52" class="srcLineFiltered"><span class="nolink" title="Filtered by: constructor"> <span class="keyword">public</span> <a href="../../../../com/rapidminer/operator/meta/FileIterator.html#FileIterator">FileIterator</a>(<a href="../../../../com/rapidminer/operator/OperatorDescription.html#OperatorDescription">OperatorDescription</a> description) {</span><span class="foldControl" onclick="toggleSrcRowVis(document.getElementById('img-52'), 52,54);" id="e52" style="display:none;border:none;">...</span></span></td>
</tr>
<tr id="l53">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=53#src-53">53</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-53" class="srcLineFiltered"><span class="nolink" title="Filtered by: constructor"> <span class="keyword">super</span>(description);</span></span></td>
</tr>
<tr id="l54">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=54#src-54">54</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-54" class="srcLine"> }</span></td>
</tr>
<tr id="l55">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=55#src-55">55</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-55" class="srcLine"></span></td>
</tr>
<tr class="inlineStatsRow" align="right" valign="middle">
<td class="coverageCount"><a name="56" class="nolink"> </a></td>
<td class="coverageCount aui-icon aui-icon-small <API key>" id='<API key>' onclick="toggleInlineStats(this, 'inlinestats-56');"/>
<td align="center" valign="middle">
<table id="inlinestats-56" style="display:none;" class="inlineStats" width="100%" cellspacing="1px" cellpadding="1px">
<tr onclick="toggleInlineStats(document.getElementById('<API key>'), 'inlinestats-56');return true;">
<td><div>
<div title="Empty" class="barEmpty" style="min-width:40px;"></div>
</div></td><td> - </td>
<td class="inlineStat">Uncovered Elements: 0 (0)</td>
<td class="inlineStat">Complexity: 1</td>
<td class="inlineStat">Complexity Density: -</td>
</tr>
</table>
</td>
</tr>
<tr id="l56">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=56#src-56">56</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" methodStart srcCell" id="id-56"><img title="Method Statistics" onclick="toggleSrcRowVis(this, 56,61);" id="img-56" src="../../../../img/collapse.gif" alt="toggle" class="icon"/><span id="src-56" class="srcLineFiltered"><span class="nolink" title="Filtered by: method"> @Override</span><span class="foldControl" onclick="toggleSrcRowVis(document.getElementById('img-56'), 56,61);" id="e56" style="display:none;border:none;">...</span></span></td>
</tr>
<tr id="l57">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=57#src-57">57</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-57" class="srcLine"> <span class="keyword">public</span> <span class="keyword">void</span> doWork() <span class="keyword">throws</span> <a href="../../../../com/rapidminer/operator/OperatorException.html#OperatorException">OperatorException</a> {</span></td>
</tr>
<tr id="l58">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=58#src-58">58</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-58" class="srcLineFiltered"><span class="nolink" title="Filtered by: method"> directory = getParameterAsFile(PARAMETER_DIRECTORY);</span></span></td>
</tr>
<tr id="l59">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=59#src-59">59</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-59" class="srcLine"></span></td>
</tr>
<tr id="l60">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=60#src-60">60</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-60" class="srcLineFiltered"><span class="nolink" title="Filtered by: method"> <span class="keyword">super</span>.doWork();</span></span></td>
</tr>
<tr id="l61">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=61#src-61">61</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-61" class="srcLine"> }</span></td>
</tr>
<tr id="l62">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=62#src-62">62</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-62" class="srcLine"></span></td>
</tr>
<tr class="inlineStatsRow" align="right" valign="middle">
<td class="coverageCount"><a name="63" class="nolink"> </a></td>
<td class="coverageCount aui-icon aui-icon-small <API key>" id='<API key>' onclick="toggleInlineStats(this, 'inlinestats-63');"/>
<td align="center" valign="middle">
<table id="inlinestats-63" style="display:none;" class="inlineStats" width="100%" cellspacing="1px" cellpadding="1px">
<tr onclick="toggleInlineStats(document.getElementById('<API key>'), 'inlinestats-63');return true;">
<td><div>
<div title="Empty" class="barEmpty" style="min-width:40px;"></div>
</div></td><td> - </td>
<td class="inlineStat">Uncovered Elements: 0 (0)</td>
<td class="inlineStat">Complexity: 1</td>
<td class="inlineStat">Complexity Density: -</td>
</tr>
</table>
</td>
</tr>
<tr id="l63">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=63#src-63">63</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" methodStart srcCell" id="id-63"><img title="Method Statistics" onclick="toggleSrcRowVis(this, 63,88);" id="img-63" src="../../../../img/collapse.gif" alt="toggle" class="icon"/><span id="src-63" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, private"> <span class="keyword">private</span> List<EntryContainer> <API key>(File dir, Pattern filter, <span class="keyword">boolean</span> iterateSubDirs, <span class="keyword">boolean</span> iterateFiles,</span><span class="foldControl" onclick="toggleSrcRowVis(document.getElementById('img-63'), 63,88);" id="e63" style="display:none;border:none;">...</span></span></td>
</tr>
<tr id="l64">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=64#src-64">64</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-64" class="srcLine"> <span class="keyword">boolean</span> recursive, List<EntryContainer> toFill) <span class="keyword">throws</span> <a href="../../../../com/rapidminer/operator/OperatorException.html#OperatorException">OperatorException</a> {</span></td>
</tr>
<tr id="l65">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=65#src-65">65</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-65" class="srcLine"></span></td>
</tr>
<tr id="l66">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=66#src-66">66</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-66" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, private"> File[] directoryListFiles = dir.listFiles();</span></span></td>
</tr>
<tr id="l67">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=67#src-67">67</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-67" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, else, private"> <span class="keyword">if</span> (dir.isDirectory() && directoryListFiles != <span class="keyword">null</span>) {</span></span></td>
</tr>
<tr id="l68">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=68#src-68">68</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-68" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, for, if, private"> <span class="keyword">for</span> (File child : dir.listFiles()) {</span></span></td>
</tr>
<tr id="l69">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=69#src-69">69</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-69" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, for, if, private"> String fileName = child.getName();</span></span></td>
</tr>
<tr id="l70">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=70#src-70">70</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-70" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, for, if, private"> String fullPath = child.getAbsolutePath();</span></span></td>
</tr>
<tr id="l71">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=71#src-71">71</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-71" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, for, if, private"> String parentPath = child.getParent();</span></span></td>
</tr>
<tr id="l72">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=72#src-72">72</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-72" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, for, if, private"> <span class="keyword">if</span> (iterateSubDirs && child.isDirectory() || iterateFiles && child.isFile()) {</span></span></td>
</tr>
<tr id="l73">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=73#src-73">73</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-73" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, for, if, private"> <span class="keyword">if</span> (matchesFilter(filter, fileName, fullPath, parentPath)) {</span></span></td>
</tr>
<tr id="l74">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=74#src-74">74</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-74" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, for, if, private"> <a href="../../../../com/rapidminer/operator/nio/file/FileObject.html#FileObject">FileObject</a> fileObject = <span class="keyword">new</span> <a href="../../../../com/rapidminer/operator/nio/file/SimpleFileObject.html#SimpleFileObject">SimpleFileObject</a>(child);</span></span></td>
</tr>
<tr id="l75">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=75#src-75">75</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-75" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, for, if, private"> toFill.add(<span class="keyword">new</span> EntryContainer(fileName, fullPath, parentPath, fileObject));</span></span></td>
</tr>
<tr id="l76">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=76#src-76">76</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-76" class="srcLine"> }</span></td>
</tr>
<tr id="l77">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=77#src-77">77</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-77" class="srcLine"> }</span></td>
</tr>
<tr id="l78">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=78#src-78">78</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-78" class="srcLine"></span></td>
</tr>
<tr id="l79">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=79#src-79">79</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-79" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, for, if, private"> <span class="keyword">if</span> (recursive && child.isDirectory()) {</span></span></td>
</tr>
<tr id="l80">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=80#src-80">80</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-80" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, for, if, private"> <API key>(child, filter, iterateSubDirs, iterateFiles, recursive, toFill);</span></span></td>
</tr>
<tr id="l81">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=81#src-81">81</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-81" class="srcLine"> }</span></td>
</tr>
<tr id="l82">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=82#src-82">82</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-82" class="srcLine"> }</span></td>
</tr>
<tr id="l83">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=83#src-83">83</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-83" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, if, else, private"> } <span class="keyword">else</span> <span class="keyword">if</span> (<API key>().isAbove(<API key>)</span></span></td>
</tr>
<tr id="l84">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=84#src-84">84</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-84" class="srcLine"> || dir.isDirectory() && directoryListFiles == <span class="keyword">null</span>) {</span></td>
</tr>
<tr id="l85">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=85#src-85">85</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-85" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, if, else, private"> <span class="keyword">throw</span> <span class="keyword">new</span> <a href="../../../../com/rapidminer/operator/UserError.html#UserError">UserError</a>(<span class="keyword">this</span>, 324, <API key>(PARAMETER_DIRECTORY));</span></span></td>
</tr>
<tr id="l86">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=86#src-86">86</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-86" class="srcLine"> }</span></td>
</tr>
<tr id="l87">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=87#src-87">87</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-87" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, private"> <span class="keyword">return</span> toFill;</span></span></td>
</tr>
<tr id="l88">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=88#src-88">88</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-88" class="srcLine"> }</span></td>
</tr>
<tr id="l89">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=89#src-89">89</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-89" class="srcLine"></span></td>
</tr>
<tr class="inlineStatsRow" align="right" valign="middle">
<td class="coverageCount"><a name="90" class="nolink"> </a></td>
<td class="coverageCount aui-icon aui-icon-small <API key>" id='<API key>' onclick="toggleInlineStats(this, 'inlinestats-90');"/>
<td align="center" valign="middle">
<table id="inlinestats-90" style="display:none;" class="inlineStats" width="100%" cellspacing="1px" cellpadding="1px">
<tr onclick="toggleInlineStats(document.getElementById('<API key>'), 'inlinestats-90');return true;">
<td><div>
<div title="Empty" class="barEmpty" style="min-width:40px;"></div>
</div></td><td> - </td>
<td class="inlineStat">Uncovered Elements: 0 (0)</td>
<td class="inlineStat">Complexity: 1</td>
<td class="inlineStat">Complexity Density: -</td>
</tr>
</table>
</td>
</tr>
<tr id="l90">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=90#src-90">90</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" methodStart srcCell" id="id-90"><img title="Method Statistics" onclick="toggleSrcRowVis(this, 90,108);" id="img-90" src="../../../../img/collapse.gif" alt="toggle" class="icon"/><span id="src-90" class="srcLineFiltered"><span class="nolink" title="Filtered by: method"> @Override</span><span class="foldControl" onclick="toggleSrcRowVis(document.getElementById('img-90'), 90,108);" id="e90" style="display:none;border:none;">...</span></span></td>
</tr>
<tr id="l91">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=91#src-91">91</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-91" class="srcLine"> <span class="keyword">protected</span> <span class="keyword">void</span> iterate(Object currentParent, Pattern filter, <span class="keyword">boolean</span> iterateSubDirs, <span class="keyword">boolean</span> iterateFiles,</span></td>
</tr>
<tr id="l92">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=92#src-92">92</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-92" class="srcLine"> <span class="keyword">boolean</span> recursive) <span class="keyword">throws</span> <a href="../../../../com/rapidminer/operator/OperatorException.html#OperatorException">OperatorException</a> {</span></td>
</tr>
<tr id="l93">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=93#src-93">93</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-93" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, if"> <span class="keyword">if</span> (currentParent == <span class="keyword">null</span>) {</span></span></td>
</tr>
<tr id="l94">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=94#src-94">94</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-94" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, if"> currentParent = directory;</span></span></td>
</tr>
<tr id="l95">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=95#src-95">95</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-95" class="srcLine"></span></td>
</tr>
<tr id="l96">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=96#src-96">96</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-96" class="srcLine"> }</span></td>
</tr>
<tr id="l97">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=97#src-97">97</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-97" class="srcLine"> <span class="comment">// init Operator progress and compute objects which meet all criteria</span></span></td>
</tr>
<tr id="l98">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=98#src-98">98</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-98" class="srcLineFiltered"><span class="nolink" title="Filtered by: method"> List<EntryContainer> objectsOfIntrest = <span class="keyword">this</span>.<API key>((File) currentParent, filter, iterateSubDirs,</span></span></td>
</tr>
<tr id="l99">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=99#src-99">99</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-99" class="srcLine"> iterateFiles, recursive, <span class="keyword">new</span> LinkedList<EntryContainer>());</span></td>
</tr>
<tr id="l100">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=100#src-100">100</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-100" class="srcLineFiltered"><span class="nolink" title="Filtered by: method"> getProgress().setTotal(objectsOfIntrest.size());</span></span></td>
</tr>
<tr id="l101">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=101#src-101">101</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-101" class="srcLine"></span></td>
</tr>
<tr id="l102">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=102#src-102">102</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-102" class="srcLine"> <span class="comment">// do the actual work</span></span></td>
</tr>
<tr id="l103">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=103#src-103">103</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-103" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, for"> <span class="keyword">for</span> (EntryContainer entry : objectsOfIntrest) {</span></span></td>
</tr>
<tr id="l104">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=104#src-104">104</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-104" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, for"> <API key>(entry.fileName, entry.fullPath, entry.parentPath, entry.fileObject);</span></span></td>
</tr>
<tr id="l105">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=105#src-105">105</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-105" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, for"> getProgress().step();</span></span></td>
</tr>
<tr id="l106">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=106#src-106">106</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-106" class="srcLine"> }</span></td>
</tr>
<tr id="l107">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=107#src-107">107</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-107" class="srcLine"></span></td>
</tr>
<tr id="l108">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=108#src-108">108</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-108" class="srcLine"> }</span></td>
</tr>
<tr id="l109">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=109#src-109">109</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-109" class="srcLine"></span></td>
</tr>
<tr class="inlineStatsRow" align="right" valign="middle">
<td class="coverageCount"><a name="110" class="nolink"> </a></td>
<td class="coverageCount aui-icon aui-icon-small <API key>" id='<API key>' onclick="toggleInlineStats(this, 'inlinestats-110');"/>
<td align="center" valign="middle">
<table id="inlinestats-110" style="display:none;" class="inlineStats" width="100%" cellspacing="1px" cellpadding="1px">
<tr onclick="toggleInlineStats(document.getElementById('<API key>'), 'inlinestats-110');return true;">
<td><div>
<div title="Empty" class="barEmpty" style="min-width:40px;"></div>
</div></td><td> - </td>
<td class="inlineStat">Uncovered Elements: 0 (0)</td>
<td class="inlineStat">Complexity: 1</td>
<td class="inlineStat">Complexity Density: -</td>
</tr>
</table>
</td>
</tr>
<tr id="l110">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=110#src-110">110</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" methodStart srcCell" id="id-110"><img title="Method Statistics" onclick="toggleSrcRowVis(this, 110,122);" id="img-110" src="../../../../img/collapse.gif" alt="toggle" class="icon"/><span id="src-110" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, property"> @Override</span><span class="foldControl" onclick="toggleSrcRowVis(document.getElementById('img-110'), 110,122);" id="e110" style="display:none;border:none;">...</span></span></td>
</tr>
<tr id="l111">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=111#src-111">111</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-111" class="srcLine"> <span class="keyword">public</span> List<<a href="../../../../com/rapidminer/parameter/ParameterType.html#ParameterType">ParameterType</a>> getParameterTypes() {</span></td>
</tr>
<tr id="l112">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=112#src-112">112</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-112" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, property"> List<<a href="../../../../com/rapidminer/parameter/ParameterType.html#ParameterType">ParameterType</a>> types = <span class="keyword">new</span> LinkedList<<a href="../../../../com/rapidminer/parameter/ParameterType.html#ParameterType">ParameterType</a>>();</span></span></td>
</tr>
<tr id="l113">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=113#src-113">113</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-113" class="srcLine"></span></td>
</tr>
<tr id="l114">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=114#src-114">114</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-114" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, property"> <a href="../../../../com/rapidminer/parameter/ParameterType.html#ParameterType">ParameterType</a> type = <span class="keyword">new</span> <a href="../../../../com/rapidminer/parameter/<API key>.html#<API key>"><API key></a>(PARAMETER_DIRECTORY, <span class="string">"Specifies the directory to iterate over."</span>,</span></span></td>
</tr>
<tr id="l115">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=115#src-115">115</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-115" class="srcLine"> <span class="keyword">false</span>);</span></td>
</tr>
<tr id="l116">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=116#src-116">116</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-116" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, property"> type.setExpert(<span class="keyword">false</span>);</span></span></td>
</tr>
<tr id="l117">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=117#src-117">117</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-117" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, property"> types.add(type);</span></span></td>
</tr>
<tr id="l118">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=118#src-118">118</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-118" class="srcLine"></span></td>
</tr>
<tr id="l119">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=119#src-119">119</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-119" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, property"> types.addAll(<span class="keyword">super</span>.getParameterTypes());</span></span></td>
</tr>
<tr id="l120">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=120#src-120">120</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-120" class="srcLine"></span></td>
</tr>
<tr id="l121">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=121#src-121">121</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-121" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, property"> <span class="keyword">return</span> types;</span></span></td>
</tr>
<tr id="l122">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=122#src-122">122</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-122" class="srcLine"> }</span></td>
</tr>
<tr id="l123">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=123#src-123">123</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-123" class="srcLine"></span></td>
</tr>
<tr class="inlineStatsRow" align="right" valign="middle">
<td class="coverageCount"><a name="124" class="nolink"> </a></td>
<td class="coverageCount aui-icon aui-icon-small <API key>" id='<API key>' onclick="toggleInlineStats(this, 'inlinestats-124');"/>
<td align="center" valign="middle">
<table id="inlinestats-124" style="display:none;" class="inlineStats" width="100%" cellspacing="1px" cellpadding="1px">
<tr onclick="toggleInlineStats(document.getElementById('<API key>'), 'inlinestats-124');return true;">
<td><div>
<div title="Empty" class="barEmpty" style="min-width:40px;"></div>
</div></td><td> - </td>
<td class="inlineStat">Uncovered Elements: 0 (0)</td>
<td class="inlineStat">Complexity: 1</td>
<td class="inlineStat">Complexity Density: -</td>
</tr>
</table>
</td>
</tr>
<tr id="l124">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=124#src-124">124</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" methodStart srcCell" id="id-124"><img title="Method Statistics" onclick="toggleSrcRowVis(this, 124,130);" id="img-124" src="../../../../img/collapse.gif" alt="toggle" class="icon"/><span id="src-124" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, property"> @Override</span><span class="foldControl" onclick="toggleSrcRowVis(document.getElementById('img-124'), 124,130);" id="e124" style="display:none;border:none;">...</span></span></td>
</tr>
<tr id="l125">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=125#src-125">125</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-125" class="srcLine"> <span class="keyword">public</span> <a href="../../../../com/rapidminer/operator/OperatorVersion.html#OperatorVersion">OperatorVersion</a>[] <API key>() {</span></td>
</tr>
<tr id="l126">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=126#src-126">126</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-126" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, property"> <a href="../../../../com/rapidminer/operator/OperatorVersion.html#OperatorVersion">OperatorVersion</a>[] changes = <span class="keyword">super</span>.<API key>();</span></span></td>
</tr>
<tr id="l127">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=127#src-127">127</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-127" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, property"> changes = Arrays.copyOf(changes, changes.length + 1);</span></span></td>
</tr>
<tr id="l128">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=128#src-128">128</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-128" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, property"> changes[changes.length - 1] = <API key>;</span></span></td>
</tr>
<tr id="l129">
<td align="right" class="lineCount Filtered"><a class="lineNumHref" href="?line=129#src-129">129</a></td>
<td align="right" class="coverageCount Filtered missedByTest" >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-129" class="srcLineFiltered"><span class="nolink" title="Filtered by: method, property"> <span class="keyword">return</span> changes;</span></span></td>
</tr>
<tr id="l130">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=130#src-130">130</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-130" class="srcLine"> }</span></td>
</tr>
<tr id="l131">
<td align="right" class="lineCount NoHilight"><a class="lineNumHref" href="?line=131#src-131">131</a></td>
<td align="right" class="coverageCount NoHilight " >  </td>
<td class=" srcCell" ><span class="spacer"></span><span id="src-131" class="srcLine">}</span></td>
</tr>
</tbody></table> </div>
</div><!-- .aui-tabs -->
<script type="text/javascript">
var ol_bgclass = "overBG";
var ol_fgclass = "overFG";
var ol_cgclass = "overCaption";
var ol_captionfontclass= "overCaption";
var ol_closefontclass = "closeFont";
var ol_closeclick = 1;
var ol_close = 'X';
var ol_wrap = 1;
var rootRelPath = '../../../../';
var testsPerFile = -1;
</script>
<script src="FileIterator.js" type="text/javascript"></script>
</div> <!-- class="<API key>" -->
<footer id="footer" role="contentinfo">
<section class="footer-body">
<ul>
<li>
Report generated by <a target="_new" href="http:
on 5 2017 17:24:16 CST using coverage data from 1 1970 08:00:00 CST.
</li>
</ul>
<ul>
<li>Clover Evaluation License registered to Clover Plugin. You have 29 day(s) before your license expires.</li>
</ul>
<div id="footer-logo">
<a target="_blank" href="http:
Atlassian
</a>
</div>
</section>
</footer> </section> <!-- class="<API key>" -->
</div> <!-- class="<API key>" -->
</div> <!-- class="aui-page-panel" -->
</div> <!-- id="page" -->
</body>
</html> |
<!DOCTYPE html>
<html lang="{{ DEFAULT_LANG }}">
<head>
{% block head %}
<title>{% block title %}{{ SITENAME }}{% endblock title %}</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/2015/css/main.css" />
{% if FEED_ALL_ATOM %}
<link href="{{ FEED_DOMAIN }}/{{ FEED_ALL_ATOM }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Full Atom Feed" />
{% endif %}
{% if FEED_ALL_RSS %}
<link href="{{ FEED_DOMAIN }}/{{ FEED_ALL_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Full RSS Feed" />
{% endif %}
{% endblock head %}
</head>
<body id="index" class="home">
<header class="main-header">
<nav class="top-bar">
<div class="wrapper">
{% for item in articles %}
{%- if article and item.url == article.url %}<a href="{{ SITEURL }}/{{ item.url }}" class="active">
{{ item.slug }}
</a>{%- else %}<a href="{{ SITEURL }}/{{ item.url }}">
{{ item.slug }}
</a>{% endif %}
{% endfor %}
</div>
</nav>
{% block header %}
{% endblock %}
</header>
{% block body %}
<div class="wrapper">
{% block content %}
{% endblock %}
</div>
{% endblock %}
<footer id="contentinfo" class="body">
<div class="wrapper">
<p class="center">
Šios svetainės išeities kodas:
<a href="https://bitbucket.org/sirex/pyconlt">
bitbucket.org/sirex/pyconlt
</a>
</p>
<address id="about" class="vcard body">
Proudly powered by <a href="http://getpelican.com/">Pelican</a>,
which takes great advantage of <a href="http://python.org">Python</a>.
</address>
</div>
</footer>
</body>
</html> |
define(["i18nObj","jquery"],function(a,b){b.extend(!0,a,{translations:{ar:{quick_start_bar:{event:{save:"حفظ",saving:"جارٍ الحفظ..."}}},es:{quick_start_bar:{event:{save:"Guardar",saving:"Guardando..."}}},fr:{quick_start_bar:{event:{save:"Enregistrer",saving:"Enregistrement..."}}},ja:{quick_start_bar:{event:{save:"",saving:"..."}}},ko:{quick_start_bar:{event:{save:"",saving:" ..."}}},nl:{quick_start_bar:{event:{save:"Opslaan",saving:"Bezig met opslaan..."}}},pt:{quick_start_bar:{event:{save:"Guardar",saving:"A guardar..."}}},ru:{quick_start_bar:{event:{save:"Сохранить",saving:"Сохранение..."}}},zh:{quick_start_bar:{event:{save:"",saving:"..."}}}}})}) |
package org.cojen.tupl.core;
import java.io.IOException;
import java.util.Comparator;
/**
* Overrides inherited methods to scan in reverse order.
*
* @author Brian S O'Neill
*/
class SortReverseScanner extends SortScanner {
SortReverseScanner(LocalDatabase db) {
super(db);
}
@Override
public Comparator<byte[]> comparator() {
return super.comparator().reversed();
}
@Override
protected void doStep(BTreeCursor c) throws IOException {
c.deletePrevious();
}
@Override
protected void initPosition(BTreeCursor c) throws IOException {
c.last();
}
} |
import React from 'react';
import { Abelito75 } from 'CONTRIBUTORS';
import SpellLink from 'common/SpellLink';
import SPELLS from 'common/SPELLS';
import SPECS from 'game/SPECS';
import { TooltipElement } from 'common/Tooltip';
import Warning from 'interface/Alert/Warning';
import CHANGELOG from './CHANGELOG';
export default {
// The people that have contributed to this spec recently. People don't have to sign up to be long-time maintainers to be included in this list. If someone built a large part of the spec or contributed something recently to that spec, they can be added to the contributors list. If someone goes MIA, they may be removed after major changes or during a new expansion.
contributors: [Abelito75],
// The WoW client patch this spec was last updated to be fully compatible with.
patchCompatibility: '8.3',
// If set to false`, the spec will show up as unsupported.
isSupported: true,
// Explain the status of this spec's analysis here. Try to mention how complete it is, and perhaps show links to places users can learn more.
// If this spec's analysis does not show a complete picture please mention this in the `<Warning>` component.
description: (
<>
Hello all! Thanks so much for taking the time use this tool as a way to improve your play. The goal is to provide targeted suggestions to improve your overall Protection Warrior play. The suggestions are based on the current theorycrafting and practical knowledge from some of the best Protection Warrior playing this game. (And even some former Protection Warrior who still like to help us dreamers out.) <br /> <br />
The tool is not perfect so I am always looking to improve it. If you have any suggestions or comments, don't hesitated to swing by the GitHub Issue linked below, or the <a href="https://discord.gg/0pYY7932lTH4FHW6" target="_blank" rel="noopener noreferrer">Skyhold</a> discord server. You can also contact me directly on Discord (Abelito75#0001). Thanks and I hope you continue to enjoy the tool!
<Warning>
Because resets of <SpellLink id={SPELLS.SHIELD_SLAM.id} /> <TooltipElement content="The combatlog does not contain any events for random cooldown resets.">can't be tracked</TooltipElement> properly, any cooldown information of <SpellLink id={SPELLS.SHIELD_SLAM.id} /> should be treated as <TooltipElement content="Whenever Shield Slams would be cast before its cooldown would have expired normally, the cooldown expiry will be set back to the last possible trigger of Revenge, Devastate, Devastator or Thunder Clap. This may lead to higher times on cooldown than you actually experienced in-game.">educated guesses</TooltipElement>.
</Warning>
</>
),
// A recent example report to see interesting parts of the spec. Will be shown on the homepage.
exampleReport: '/report/wDCktr26Z81NJGdp/13-Mythic+Lady+Ashvane+-+Kill+(4:47)/Admisw',
// Don't change anything below this line;
// The current spec identifier. This is the only place (in code) that specifies which spec this parser is about.
spec: SPECS.PROTECTION_WARRIOR,
// The contents of your changelog.
changelog: CHANGELOG,
// The CombatLogParser class for your spec.
parser: () => import('./CombatLogParser' /* webpackChunkName: "ProtectionWarrior" */).then(exports => exports.default),
// The path to the current directory (relative form project root). This is used for generating a GitHub link directly to your spec's code.
path: __dirname,
}; |
import download from "downloadjs"
import {<API key>} from "./templates"
import {ImportFidusFile} from "../../importer/file"
import {deactivateWait, addAlert, get, post, cancelPromise, findTarget, Dialog, escapeText, shortFileTitle, longFilePath} from "../../common"
/**
* Functions for the recovering previously created document revisions.
*/
export class <API key> {
constructor(documentId, documentList, user) {
this.documentId = documentId // documentId The id in documentList.
this.documentList = documentList
this.user = user
this.dialog = false
}
/**
* Create a dialog showing the existing revisions for a certain document.
* @function createDialog
* @param {number}
*/
init() {
const doc = this.documentList.find(doc => doc.id === this.documentId)
this.dialog = new Dialog({
title: `${gettext('Saved revisions of')} ${escapeText(shortFileTitle(doc.title, doc.path))}`,
id: 'revisions-dialog',
width: 620,
height: 480,
buttons: [{type: 'close'}],
body: <API key>({doc})
})
this.dialog.open()
return this.bind()
}
bind() {
const dialogEl = this.dialog.dialogEl
return new Promise(resolve => {
dialogEl.addEventListener('click', event => {
const el = {}
let revisionId, revisionFilename
switch (true) {
case findTarget(event, '.download-revision', el):
revisionId = parseInt(el.target.dataset.id)
revisionFilename = el.target.dataset.filename
this.download(revisionId, revisionFilename)
break
case findTarget(event, '.recreate-revision', el):
revisionId = parseInt(el.target.dataset.id)
resolve(this.recreate(revisionId, this.user))
break
case findTarget(event, '.delete-revision', el):
revisionId = parseInt(el.target.dataset.id)
resolve(this.delete(revisionId))
break
default:
break
}
})
})
}
/**
* Recreate a revision.
* @function recreate
* @param {number} id The pk value of the document revision.
*/
recreate(id, user) {
const doc = this.documentList.find(doc => doc.id === this.documentId)
return get(`/api/document/get_revision/${id}/`).then(
response => response.blob()
).then(
blob => {
const importer = new ImportFidusFile(
blob,
user,
longFilePath(doc.title, doc.path, `${gettext('Revision of')} `)
)
return importer.init()
}
).then(
({ok, statusText, doc}) => {
deactivateWait()
if (ok) {
addAlert('info', statusText)
return {
action: 'added-document',
doc
}
} else {
addAlert('error', statusText)
return Promise.reject(new Error(statusText))
}
}
)
}
/**
* Download a revision.
* @param {number} id The pk value of the document revision.
*/
download(id, filename) {
get(`/api/document/get_revision/${id}/`).then(
response => response.blob()
).then(
blob => download(blob, filename, 'application/fidus+zip')
)
}
/**
* Delete a revision.
* @param {number} id The pk value of the document revision.
*/
delete(id) {
const buttons = []
const returnPromise = new Promise(resolve => {
buttons.push({
text: gettext('Delete'),
classes: "fw-dark",
click: () => {
<API key>.close()
resolve(this.deleteRevision(id))
}
})
buttons.push({
type: 'cancel',
click: () => {
<API key>.close()
resolve(cancelPromise())
}
})
})
const <API key> = new Dialog({
id: 'confirmdeletion',
title: gettext('Confirm deletion'),
icon: '<API key>',
body: `${gettext('Do you really want to delete the revision?')}`,
height: 80,
buttons
})
<API key>.open()
return returnPromise
}
deleteRevision(id) {
return post(
'/api/document/delete_revision/',
{id}
).then(
() => {
const thisTr = document.querySelector(`tr.revision-${id}`),
documentId = thisTr.dataset.document,
doc = this.documentList.find(doc => doc.id === parseInt(documentId))
thisTr.parentElement.removeChild(thisTr)
addAlert('success', gettext('Revision deleted'))
return Promise.resolve({
action: 'deleted-revision',
id,
doc
})
// TODO: Remove from overview menu as well
}
).catch(
() => {
addAlert('error', gettext('Could not delete revision.'))
return Promise.reject(new Error('Could not delete revision.'))
}
)
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.