text:
(function () {
    'use strict';

    /**
    * @ngdoc service
    * @name umbraco.services.umbDataFormatter
    * @description A helper object used to format/transform JSON Umbraco data, mostly used for persisting data to the server
    **/
    function umbDataFormatter() {

        /**
         * maps the display properties to a property collection for persisting/POSTing
         * @param {any} tabs
         */
        function getContentProperties(tabs) {

            var properties = [];

            _.each(tabs, function (tab) {

                _.each(tab.properties, function (prop) {

                    //don't include the custom generic tab properties
                    //don't include a property that is marked readonly
                    if (!prop.alias.startsWith("_umb_") && !prop.readonly) {
                        properties.push({
                            id: prop.id,
                            alias: prop.alias,
                            value: prop.value
                        });
                    }
                });
            });

            return properties;
        }

        return {

            formatChangePasswordModel: function(model) {
                if (!model) {
                    return null;
                }
                var trimmed = _.omit(model, ["confirm", "generatedPassword"]);

                //ensure that the pass value is null if all child properties are null
                var allNull = true;
                var vals = _.values(trimmed);
                for (var k = 0; k < vals.length; k++) {
                    if (vals[k] !== null && vals[k] !== undefined) {
                        allNull = false;
                    }
                }
                if (allNull) {
                    return null;
                }

                return trimmed;
            },

            formatContentTypePostData: function (displayModel, action) {

                //create the save model from the display model
                var saveModel = _.pick(displayModel,
                    'compositeContentTypes', 'isContainer', 'allowAsRoot', 'allowedTemplates', 'allowedContentTypes',
                    'alias', 'description', 'thumbnail', 'name', 'id', 'icon', 'trashed',
                    'key', 'parentId', 'alias', 'path', 'allowCultureVariant', 'allowSegmentVariant', 'isElement');

                // TODO: Map these
                saveModel.allowedTemplates = _.map(displayModel.allowedTemplates, function (t) { return t.alias; });
                saveModel.defaultTemplate = displayModel.defaultTemplate ? displayModel.defaultTemplate.alias : null;
                var realGroups = _.reject(displayModel.groups, function (g) {
                    //do not include these tabs
                    return g.tabState === "init";
                });
                saveModel.groups = _.map(realGroups, function (g) {

                    var saveGroup = _.pick(g, 'inherited', 'id', 'sortOrder', 'name');

                    var realProperties = _.reject(g.properties, function (p) {
                        //do not include these properties
                        return p.propertyState === "init" || p.inherited === true;
                    });

                    var saveProperties = _.map(realProperties, function (p) {
                        var saveProperty = _.pick(p, 'id', 'alias', 'description', 'validation', 'label', 'sortOrder', 'dataTypeId', 'groupId', 'memberCanEdit', 'showOnMemberProfile', 'isSensitiveData', 'allowCultureVariant', 'allowSegmentVariant');
                        return saveProperty;
                    });

                    saveGroup.properties = saveProperties;

                    //if this is an inherited group and there are not non-inherited properties on it, then don't send up the data
                    if (saveGroup.inherited === true && saveProperties.length === 0) {
                        return null;
                    }

                    return saveGroup;
                });

                //we don't want any null groups
                saveModel.groups = _.reject(saveModel.groups, function (g) {
                    return !g;
                });

                return saveModel;
            },

            /** formats the display model used to display the data type to the model used to save the data type */
            formatDataTypePostData: function (displayModel, preValues, action) {
                var saveModel = {
                    parentId: displayModel.parentId,
                    id: displayModel.id,
                    name: displayModel.name,
                    selectedEditor: displayModel.selectedEditor,
                    //set the action on the save model
                    action: action,
                    preValues: []
                };
                for (var i = 0; i < preValues.length; i++) {

                    saveModel.preValues.push({
                        key: preValues[i].alias,
                        value: preValues[i].value
                    });
                }
                return saveModel;
            },

            /** formats the display model used to display the dictionary to the model used to save the dictionary */
            formatDictionaryPostData : function(dictionary, nameIsDirty) {
                var saveModel = {
                    parentId: dictionary.parentId,
                    id: dictionary.id,
                    name: dictionary.name,
                    nameIsDirty: nameIsDirty,
                    translations: [],
                    key : dictionary.key
                };

                for(var i = 0; i < dictionary.translations.length; i++) {
                    saveModel.translations.push({
                        isoCode: dictionary.translations[i].isoCode,
                        languageId: dictionary.translations[i].languageId,
                        translation: dictionary.translations[i].translation
                    });
                }

                return saveModel;
            },

            /** formats the display model used to display the user to the model used to save the user */
            formatUserPostData: function (displayModel) {

                //create the save model from the display model
                var saveModel = _.pick(displayModel, 'id', 'parentId', 'name', 'username', 'culture', 'email', 'startContentIds', 'startMediaIds', 'userGroups', 'message');

                //make sure the userGroups are just a string array
                var currGroups = saveModel.userGroups;
                var formattedGroups = [];
                for (var i = 0; i < currGroups.length; i++) {
                    if (!Utilities.isString(currGroups[i])) {
                        formattedGroups.push(currGroups[i].alias);
                    }
                    else {
                        formattedGroups.push(currGroups[i]);
                    }
                }
                saveModel.userGroups = formattedGroups;

                //make sure the startnodes are just a string array
                var props = ["startContentIds", "startMediaIds"];
                for (var m = 0; m < props.length; m++) {
                    var startIds = saveModel[props[m]];
                    if (!startIds) {
                        continue;
                    }
                    var formattedIds = [];
                    for (var j = 0; j < startIds.length; j++) {
                        formattedIds.push(Number(startIds[j].id));
                    }
                    saveModel[props[m]] = formattedIds;
                }

                return saveModel;
            },

            /** formats the display model used to display the user group to the model used to save the user group*/
            formatUserGroupPostData: function (displayModel, action) {
                //create the save model from the display model
                var saveModel = _.pick(displayModel, 'id', 'alias', 'name', 'icon', 'sections', 'users', 'defaultPermissions', 'assignedPermissions');

                // the start nodes cannot be picked as the property name needs to change - assign manually
                saveModel.startContentId = displayModel['contentStartNode'];
                saveModel.startMediaId = displayModel['mediaStartNode'];

                //set the action on the save model
                saveModel.action = action;
                if (!saveModel.id) {
                    saveModel.id = 0;
                }

                //the permissions need to just be the array of permission letters, currently it will be a dictionary of an array
                var currDefaultPermissions = saveModel.defaultPermissions;
                var saveDefaultPermissions = [];
                _.each(currDefaultPermissions, function (value, key, list) {
                    _.each(value, function (element, index, list) {
                        if (element.checked) {
                            saveDefaultPermissions.push(element.permissionCode);
                        }
                    });
                });
                saveModel.defaultPermissions = saveDefaultPermissions;

                //now format that assigned/content permissions
                var currAssignedPermissions = saveModel.assignedPermissions;
                var saveAssignedPermissions = {};
                _.each(currAssignedPermissions, function (nodePermissions, index) {
                    saveAssignedPermissions[nodePermissions.id] = [];
                    _.each(nodePermissions.allowedPermissions, function (permission, index) {
                        if (permission.checked) {
                            saveAssignedPermissions[nodePermissions.id].push(permission.permissionCode);
                        }
                    });
                });
                saveModel.assignedPermissions = saveAssignedPermissions;

                //make sure the sections are just a string array
                var currSections = saveModel.sections;
                var formattedSections = [];
                for (var i = 0; i < currSections.length; i++) {
                    if (!Utilities.isString(currSections[i])) {
                        formattedSections.push(currSections[i].alias);
                    }
                    else {
                        formattedSections.push(currSections[i]);
                    }
                }
                saveModel.sections = formattedSections;

                //make sure the user are just an int array
                var currUsers = saveModel.users;
                var formattedUsers = [];
                for (var j = 0; j < currUsers.length; j++) {
                    if (!Utilities.isNumber(currUsers[j])) {
                        formattedUsers.push(currUsers[j].id);
                    }
                    else {
                        formattedUsers.push(currUsers[j]);
                    }
                }
                saveModel.users = formattedUsers;

                //make sure the startnodes are just an int if one is set
                var props = ["startContentId", "startMediaId"];
                for (var m = 0; m < props.length; m++) {
                    var startId = saveModel[props[m]];
                    if (!startId) {
                        continue;
                    }
                    saveModel[props[m]] = startId.id;
                }

                saveModel.parentId = -1;
                return saveModel;
            },

            /** formats the display model used to display the member to the model used to save the member */
            formatMemberPostData: function (displayModel, action) {
                //this is basically the same as for media but we need to explicitly add the username,email, password to the save model

                var saveModel = this.formatMediaPostData(displayModel, action);

                saveModel.key = displayModel.key;

                var genericTab = _.find(displayModel.tabs, function (item) {
                    return item.id === 0;
                });

                //map the member login, email, password and groups
                var propLogin = _.find(genericTab.properties, function (item) {
                    return item.alias === "_umb_login";
                });
                var propEmail = _.find(genericTab.properties, function (item) {
                    return item.alias === "_umb_email";
                });
                var propPass = _.find(genericTab.properties, function (item) {
                    return item.alias === "_umb_password";
                });
                var propGroups = _.find(genericTab.properties, function (item) {
                    return item.alias === "_umb_membergroup";
                });
                saveModel.email = propEmail.value.trim();
                saveModel.username = propLogin.value.trim();

                saveModel.password = this.formatChangePasswordModel(propPass.value);

                var selectedGroups = [];
                for (var n in propGroups.value) {
                    if (propGroups.value[n] === true) {
                        selectedGroups.push(n);
                    }
                }
                saveModel.memberGroups = selectedGroups;

                //turn the dictionary into an array of pairs
                var memberProviderPropAliases = _.pairs(displayModel.fieldConfig);
                _.each(displayModel.tabs, function (tab) {
                    _.each(tab.properties, function (prop) {
                        var foundAlias = _.find(memberProviderPropAliases, function (item) {
                            return prop.alias === item[1];
                        });
                        if (foundAlias) {
                            //we know the current property matches an alias, now we need to determine which membership provider property it was for
                            // by looking at the key
                            switch (foundAlias[0]) {
                                case "umbracoMemberLockedOut":
                                    saveModel.isLockedOut = Object.toBoolean(prop.value);
                                    break;
                                case "umbracoMemberApproved":
                                    saveModel.isApproved = Object.toBoolean(prop.value);
                                    break;
                                case "umbracoMemberComments":
                                    saveModel.comments = prop.value;
                                    break;
                            }
                        }
                    });
                });

                return saveModel;
            },

            /** formats the display model used to display the media to the model used to save the media */
            formatMediaPostData: function (displayModel, action) {
                //NOTE: the display model inherits from the save model so we can in theory just post up the display model but
                // we don't want to post all of the data as it is unecessary.
                var saveModel = {
                    id: displayModel.id,
                    properties: getContentProperties(displayModel.tabs),
                    name: displayModel.name,
                    contentTypeAlias: displayModel.contentTypeAlias,
                    parentId: displayModel.parentId,
                    //set the action on the save model
                    action: action
                };

                return saveModel;
            },

            /** formats the display model used to display the content to the model used to save the content  */
            formatContentPostData: function (displayModel, action) {

                //NOTE: the display model inherits from the save model so we can in theory just post up the display model but
                // we don't want to post all of the data as it is unecessary.
                var saveModel = {
                    id: displayModel.id,
                    name: displayModel.name,
                    contentTypeAlias: displayModel.contentTypeAlias,
                    parentId: displayModel.parentId,
                    //set the action on the save model
                    action: action,
                    variants: _.map(displayModel.variants, function(v) {
                        return {
                            name: v.name || "", //if its null/empty,we must pass up an empty string else we get json converter errors
                            properties: getContentProperties(v.tabs),
                            culture: v.language ? v.language.culture : null,
                            segment: v.segment,
                            publish: v.publish,
                            save: v.save,
                            releaseDate: v.releaseDate,
                            expireDate: v.expireDate
                        };
                    })
                };

                var propExpireDate = displayModel.removeDate;
                var propReleaseDate = displayModel.releaseDate;
                var propTemplate = displayModel.template;

                saveModel.expireDate = propExpireDate ? propExpireDate : null;
                saveModel.releaseDate = propReleaseDate ? propReleaseDate : null;
                saveModel.templateAlias = propTemplate ? propTemplate : null;

                return saveModel;
            },

            /**
             * This formats the server GET response for a content display item
             * @param {} displayModel
             * @returns {}
             */
            formatContentGetData: function(displayModel) {

                // We need to check for invariant properties among the variant variants,
                // as the value of an invariant property is shared between different variants.
                // A property can be culture invariant, segment invariant, or both.
                // When we detect this, we want to make sure that the property object instance is the
                // same reference object between all variants instead of a copy (which it will be when
                // return from the JSON structure).

                if (displayModel.variants && displayModel.variants.length > 1) {
                    // Collect all invariant properties from the variants that are either the
                    // default language variant or the default segment variant.
                    var defaultVariants = _.filter(displayModel.variants, function (variant) {
                        var isDefaultLanguage = variant.language && variant.language.isDefault;
                        var isDefaultSegment = variant.segment == null;

                        return isDefaultLanguage || isDefaultSegment;
                    });

                    if (defaultVariants.length > 0) {
                        _.each(defaultVariants, function (defaultVariant) {
                            var invariantProps = [];

                            _.each(defaultVariant.tabs, function (tab, tabIndex) {
                                _.each(tab.properties, function (property, propIndex) {
                                    // culture == null -> property is culture invariant
                                    // segment == null -> property is *possibly* segment invariant
                                    if (!property.culture || !property.segment) {
                                        invariantProps.push({
                                            tabIndex: tabIndex,
                                            propIndex: propIndex,
                                            property: property
                                        });
                                    }
                                });
                            });

                            var otherVariants = _.filter(displayModel.variants, function (variant) {
                                return variant !== defaultVariant;
                            });

                            // now assign this same invariant property instance to the same index of the other variants property array
                            _.each(otherVariants, function (variant) {
                                _.each(invariantProps, function (invProp) {
                                    var tab = variant.tabs[invProp.tabIndex];
                                    var prop = tab.properties[invProp.propIndex];

                                    var inheritsCulture = prop.culture === invProp.property.culture && prop.segment == null && invProp.property.segment == null;
                                    var inheritsSegment = prop.segment === invProp.property.segment && !prop.culture;

                                    if (inheritsCulture || inheritsSegment) {
                                        tab.properties[invProp.propIndex] = invProp.property;
                                    }
                                });
                            });
                        });
                    }
                }

                return displayModel;
            },

            /**
             * Formats the display model used to display the relation type to a model used to save the relation type.
             * @param {Object} relationType
             */
            formatRelationTypePostData : function(relationType) {
                var saveModel = {
                    id: relationType.id,
                    name: relationType.name,
                    alias: relationType.alias,
                    key : relationType.key,
                    isBidirectional: relationType.isBidirectional,
                    parentObjectType: relationType.parentObjectType,
                    childObjectType: relationType.childObjectType
                };

                return saveModel;
            }
        };
    }
    angular.module('umbraco.services').factory('umbDataFormatter', umbDataFormatter);

})();


text:
define([
    'underscore',
    'backbone-events',
    'calculations',
    'scene',
    'geometrygraphsingleton',
    'scenevieweventgenerator',
    'modelviews/vertexMV',
    'settings',
    'modelviews/currentworkplane'
  ], function(_,
    Events,
    calc,
    sceneModel,
    geometryGraph,
    sceneViewEventGenerator,
    VertexMV,
    userSettings,
    currentWorkplane) {

    var camera = sceneModel.view.camera;
    var snapSettingsOverride;

    var getPositionForEvent = function(event, facePosition, edgePosition) {

      var settings = snapSettingsOverride || userSettings;

      var workplanePosition = getPositionOnWorkplane(event);
      if (settings.get('snapedges') && edgePosition) {
        return edgePosition;
      } else if (settings.get('snapfaces') && facePosition) {
        return facePosition;
      } else if (settings.get('snapgrid')) {
        return round(workplanePosition, currentWorkplane.getGridSize());
      } else {
        return round(workplanePosition, 0.001);
      }
    };

    var getPositionOnWorkplane = function(event) {
      var workplaneModel = currentWorkplane.get();
      return calc.positionOnWorkplane(
        $('#scene'), event, workplaneModel.vertex, geometryGraph, camera);
    };

    var round = function(position, grid) {
      return new THREE.Vector3(
        Math.round(position.x/grid) * grid,
        Math.round(position.y/grid) * grid,
        Math.round(position.z/grid) * grid);
    };

    // ---------- Observer ----------

    function Observer() {

      _.extend(this, Events);

      this.workplaneOrFacePositionChanged = function(event, facePosition, edgePosition) {
        var newPosition = getPositionForEvent(event, facePosition, edgePosition);
        if (newPosition) {
          if (!this.lastPosition || !this.lastPosition.equals(newPosition)) {
            this.trigger('positionChanged', newPosition, event);
          }
          this.lastPosition = newPosition;
        }
      };

      this.workplaneClick = function() {
        if (this.lastPosition) {
          this.trigger('click', this.lastPosition);
        }
      };

      this.workplaneDblClick = function() {
        if (this.lastPosition) {
          this.trigger('dblclick', this.lastPosition);
        }
      };

      this.sceneViewDragStarted = function(intersection, event, facePosition, edgePosition) {
        var newPosition = getPositionForEvent(event, facePosition, edgePosition);
        if (newPosition) {
          intersection.view.trigger('dragStarted', newPosition, intersection, event);
        }
      };

      this.sceneViewDrag = function(intersection, event, facePosition, edgePosition) {
        var newPosition = getPositionForEvent(event, facePosition, edgePosition);
        if (newPosition) {
          if (!this.lastDragPosition || !this.lastDragPosition.equals(newPosition)) {
            intersection.view.trigger('drag', newPosition, intersection, event);
          }
          this.lastDragPosition = newPosition;
        }
      };

      this.overrideSnapping = function(settings) {
        if (settings) {
          // Mimic the model
          snapSettingsOverride = {
            get: function(key) {
              return settings[key];
            }
          };
        } else {
          snapSettingsOverride = undefined;
        }
      };

      // Register for events after the document is loaded and the workplane exists
      this.registerEvents = function() {
        VertexMV.eventProxy.on('workplanePositionChanged', this.workplaneOrFacePositionChanged, this);
        VertexMV.eventProxy.on('workplaneClick', this.workplaneClick, this);
        VertexMV.eventProxy.on('workplaneDblClick', this.workplaneDblClick, this);
        VertexMV.eventProxy.on('overrideSnapping', this.overrideSnapping, this);

        sceneViewEventGenerator.on('positionChanged', this.workplaneOrFacePositionChanged, this);
        sceneViewEventGenerator.on('dragStarted', this.sceneViewDragStarted, this);
        sceneViewEventGenerator.on('drag', this.sceneViewDrag, this);
      };

    }
    return new Observer();

  });

redpajama_set_name: RedPajamaGithub


text:
class RolyPolyCreate<%= role_permission_class_name.pluralize %> < ActiveRecord::Migration

  def change

    create_table(:<%= role_permissions_table_name %>) do |t|
      t.references :<%= roles_table_name.singularize %>, null: false
      t.references :<%= permissions_table_name.singularize %>, null: false
    end

    add_index :<%= role_permissions_table_name %>, :<%= "#{roles_table_name.singularize}_id" %>
    add_index :<%= role_permissions_table_name %>, :<%= "#{permissions_table_name.singularize}_id" %>
    add_index :<%= role_permissions_table_name %>, [:<%= "#{roles_table_name.singularize}_id" %>, :<%= "#{permissions_table_name.singularize}_id" %>], unique: true

  end

end


text:
sap.ui.define([
	"../util/FileUtils",
	"sap/base/util/extend",
	"sap/m/IconTabHeader",
	"sap/m/IconTabFilter",
	"sap/m/Image",
	"sap/m/MessageStrip",
	"sap/ui/codeeditor/CodeEditor",
	"sap/ui/core/Control"
], function (
	FileUtils,
	extend,
	IconTabHeader,
	IconTabFilter,
	Image,
	MessageStrip,
	CodeEditor,
	Control
) {
	"use strict";
	var FileEditor = Control.extend("sap.ui.demo.accessibilityGuide.controls.FileEditor", {
		metadata: {
			properties: {
				/**
				 * Array containing list of objects which have property name and link
				 */
				files: {
					type: "object[]",
					defaultValue: []
				},
				editable: {
					type: "boolean",
					defaultValue: true
				}
			},
			aggregations: {
				_header: {
					type: "sap.ui.core.Control",
					multiple: false,
					visibility: "hidden"
				},
				_editor: {
					type: "sap.ui.core.Control",
					multiple: false,
					visibility: "hidden"
				},
				_readOnlyWarningStrip: {
					type: "sap.ui.core.Control",
					multiple: false,
					visibility: "hidden"
				},
				_errorsStrip: {
					type: "sap.ui.core.Control",
					multiple: false,
					visibility: "hidden"
				},
				_schemaErrorsStrip: {
					type: "sap.ui.core.Control",
					multiple: false,
					visibility: "hidden"
				},
				_image: {
					type: "sap.ui.core.Control",
					multiple: false,
					visibility: "hidden"
				}
			}
		},
		renderer: {
			apiVersion: 2,
			render: function (oRm, oFileEditor) {

				oRm.openStart("div", oFileEditor)
					.class("sapUiCardExplorerFileEditor")
					.style("height", "100%")
					.openEnd();

				oRm.openStart("div")
					.class("sapUiCardExplorerFileEditorHeader")
					.openEnd();
				oRm.renderControl(oFileEditor._getErrorsStrip());

				if (oFileEditor.getFiles().length > 1) {
					oRm.renderControl(oFileEditor._getHeader());
				}

				oRm.close("div");

				oRm.openStart("div")
					.class("sapUiCardExplorerFileEditorContent")
					.openEnd();
				oRm.renderControl(oFileEditor._getImage());
				oRm.renderControl(oFileEditor._getEditor());
				oRm.close("div");

				oRm.close("div");
			}
		}
	});

	FileEditor.prototype.init = function () {
		this._bFetch = false;
		this._aFiles = [];
	};

	FileEditor.prototype.onBeforeRendering = function () {
		if (!this._bFetch) {
			return;
		}

		this._bFetch = false;
		this._fetchContents();
	};

	FileEditor.prototype.setFiles = function (aFiles) {
		this._getHeader().destroyItems();
		this._bFetch = true;
		this._createInternalFiles(aFiles);

		return this.setProperty("files", aFiles);
	};

	FileEditor.prototype._getHeader = function () {
		var oHeader = this.getAggregation("_header");

		if (!oHeader) {
			oHeader = new IconTabHeader(this.getId() + "-header", {
                select: this._onFileSwitch.bind(this)
            });
			this.setAggregation("_header", oHeader);
		}

		return oHeader;
	};

    FileEditor.prototype._onFileSwitch = function (oEvent) {
        this._update();
    };

	FileEditor.prototype._getEditor = function () {
		var oEditor = this.getAggregation("_editor");

		if (!oEditor) {
			oEditor = new CodeEditor(this.getId() + "-editor", {
				syntaxHints: false
			});

			oEditor._oEditor.session.on("changeAnnotation", this._onSyntaxError.bind(this));
			oEditor._oEditor.completers = []; // This will prevent all auto complete and suggestions of the editor
			this.setAggregation("_editor", oEditor);
		}

		return oEditor;
	};

	FileEditor.prototype._getReadOnlyWarningStrip = function () {
		var oStrip = this.getAggregation("_readOnlyWarningStrip");

		if (!oStrip) {
			oStrip = new MessageStrip({
				showIcon: true,
				type: "Warning",
				text: "This file is read-only.",
				visible: false
			});
			this.setAggregation("_readOnlyWarningStrip", oStrip);
		}

		return oStrip;
	};

	FileEditor.prototype._getErrorsStrip = function () {
		var oStrip = this.getAggregation("_errorsStrip");

		if (!oStrip) {
			oStrip = new MessageStrip({
				showIcon: true,
				type: "Error",
				visible: false
			});
			this.setAggregation("_errorsStrip", oStrip);
		}

		return oStrip;
	};

	FileEditor.prototype._getSchemaErrorsStrip = function () {
		var oStrip = this.getAggregation("_schemaErrorsStrip");

		if (!oStrip) {
			oStrip = new MessageStrip({
				showIcon: true,
				type: "Error",
				visible: false
			});
			this.setAggregation("_schemaErrorsStrip", oStrip);
		}

		return oStrip;
	};

	FileEditor.prototype._getImage = function () {
		var oImage = this.getAggregation("_image");

		if (!oImage) {
			oImage = new Image(this.getId() + "-image", {
				width: "100%"
			});
			this.setAggregation("_image", oImage);
		}

		return oImage;
	};

	FileEditor.prototype._update = function () {
		var sSelectedFileKey = this._getHeader().getSelectedKey(),
			sFileExtension = sSelectedFileKey.split('.').pop(),
			iSelectedFileIndex = this._aFiles.findIndex(function (oEl) { return oEl.key === sSelectedFileKey; }),
			oSelectedFile = this._aFiles[iSelectedFileIndex],
			bEditable = this._isFileEditable(oSelectedFile);

		sFileExtension = sFileExtension === 'js' ? 'javascript' : sFileExtension;

		this._getReadOnlyWarningStrip().setVisible(!bEditable);

		this._getErrorsStrip().setVisible(false);
		this._getSchemaErrorsStrip().setVisible(false);

		if (FileUtils.isBlob(sSelectedFileKey)) {
			this._getImage()
				.setSrc(oSelectedFile.content)
				.setVisible(true);

			this._getEditor().setVisible(false);
		} else {
			this._bPreventLiveChange = true;
			this._getEditor()
				.setEditable(bEditable)
				.setType(sFileExtension)
				.setValue(oSelectedFile.content)
				.setVisible(true);
			this._bPreventLiveChange = false;

			this._getImage().setVisible(false);
		}
	};

	FileEditor.prototype._createIconTabFilters = function () {
		this._aFiles.forEach(function (oFile) {
			this._getHeader().addItem(new IconTabFilter({
				key: oFile.key,
				text: oFile.name
			}));
		}.bind(this));
	};
	FileEditor.mimetypes = {
		"js": "text/javascript",
		"json": "application/json",
		"html": "text/html",
		"properties": "text/plain"
	};

	FileEditor.prototype._fetchContents = function () {
		var aFetchPromises = this._aFiles.map(function (oFile) {
			var sType = oFile.url.substring(oFile.url.lastIndexOf(".") + 1);
			oFile._type = FileEditor.mimetypes[sType] || "text/plain";
			oFile.promise = FileUtils.fetch(sap.ui.require.toUrl("sap/ui/demo/accessibilityGuide" + oFile.url));
			return oFile.promise;
		});

		Promise.all(aFetchPromises)
			.then(function (aData) {
				aData.map(function (sData, i) {
					this._aFiles[i]._url = URL.createObjectURL(new Blob([sData], { type: this._aFiles[i]._type }));
					this._aFiles[i].content = sData;
				}.bind(this));

				this._getHeader().setSelectedKey(this._aFiles[0].key);
				this._createIconTabFilters();
				this._update();
			}.bind(this))
			.catch(function (sErr) {
				this._getErrorsStrip()
					.setVisible(true)
					.setText(sErr);
			}.bind(this));
	};

	/**
	 * There should be only 1 card manifest in sample, with name "manifest.json" or "cardManifest.json"
	 *
	 * @param {object} oFile The file with all properties.
	 * @returns {boolean} Whether the file is editable.
	 */
	FileEditor.prototype._isFileEditable = function (oFile) {
		return !oFile.isApplicationManifest
			&& (oFile.name.endsWith("manifest.json"));
	};

	FileEditor.prototype._findIndex = function (sName) {
		return this._aFiles.findIndex(function (oFile) { return oFile.key === sName; });
	};

	FileEditor.prototype._onSyntaxError = function () {
		var aErrorAnnotations = this._getEditor()._oEditor.session.$annotations,
			sMessage = "";

		if (aErrorAnnotations && aErrorAnnotations.length) {
			aErrorAnnotations.forEach(function (oError) {
				sMessage += "Line " + String(oError.row) + ": " + oError.text + '\n';
			});
			this._getErrorsStrip()
				.setVisible(true)
				.setText(sMessage);
		} else {
			this._getErrorsStrip().setVisible(false);
		}
	};

	FileEditor.prototype._createInternalFiles = function (aFiles) {
		this._aFiles = aFiles.map(function (oFile) {
			return extend({}, oFile, {
				content: "",
				promise: null
			});
		});
	};

	/**
	 * @returns {Promise} Promise resolved with the manifest as string.
	 */
	FileEditor.prototype.getManifestContent = function () {
		var oManifestFile = this.getManifestFile();

		// always try to return the content first, in case it is already loaded and edited
		if (oManifestFile.content) {
			return Promise.resolve(oManifestFile.content);
		} else {
			return oManifestFile.promise;
		}
	};

	FileEditor.prototype.getManifestFile = function () {
		return this._aFiles.find(function (oFile) {
			if (this._isFileEditable(oFile)) {
				return oFile;
			}
		}.bind(this));
	};

	FileEditor.prototype.setManifestContent = function (sValue) {
		this.getManifestFile().content = sValue;
		this._update();
	};

	FileEditor.prototype.getFilesWithContent = function () {
		var aFetchPromises = this._aFiles.map(function (oFile) { return oFile.promise; });

		return Promise.all(aFetchPromises)
			.then(function () {
				return this._aFiles;
			}.bind(this));
	};

	FileEditor.prototype.showError = function (sError) {
		this._getErrorsStrip()
			.setVisible(true)
			.setText(sError);
	};

	return FileEditor;
});


text:
var expect = require("chai").expect;
var assert = require("chai").assert;

var Promise = require("bluebird");

var _ = require("underscore");

var $config = require("../config/app.js");

var log4js = require("log4js");
log4js.configure($config.log);
var $logger = log4js.getLogger("app");

var userService = new (require("../service/sample-user-service"))();

var authenticationService = new (require("../lib/service/authentication-service.js"))(function () {
    return userService;
}, $config, $logger);

var serverUrl = ($config.https.enable ? "https" : "http") + "://localhost:5102";
var opts = {
    forceNew: true
};

describe("test db connection factory", function () {
    var cloudpifyHandler = null;
    var connection = null;

    beforeEach(function (done) {

        cloudpifyHandler = new (require("../cloudpify.js"))();

        cloudpifyHandler.start("full")
                .then(function () {
                    return authenticationService.generateToken(1);
                })
                .then(function (token) {
                    opts.query = "userId=1&token=" + token;
                    var io = require("socket.io-client");
                    connection = io.connect(serverUrl, opts);
                    connection.on("connect", function () {
                        console.log("Open SocketIO connection to server successfully");
                        done();
                    });
                })
                .catch(done);
    });

    afterEach(function (done) {
        cloudpifyHandler.stop()
                .then(function () {
                    connection.destroy();
                    done();
                })
                .catch(done);
    });

    it("should return correct stanza information", function (done) {
        connection.on("cloudpify", function (stanza) {
            console.log("Receive message from server: " + JSON.stringify(stanza));
            expect(stanza.id).to.equal(10);
            expect(stanza.body).to.be.a("number");
            done();
        });

        connection.emit("cloudpify", {
            id: 10,
            action: "cloudchat:sample-controller2:test-db-connection-factory",
            type: "iq"
        });
    });
});


text:
#pragma once
#include <sml.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @file
 * @defgroup Ann_Engine Neural network engine
 * @brief The SML neural network engine.
 *
 * \anchor Neural_Network_Engine_Introduction
 *
 * A neural network consists in a set of neurons that are inter-connected
 * and distributed in layers, usually three (Input, hidden and output layers).
 * For every connection between neurons there is a weight associated to it,
 * these weights are initialized randomly with values beetween -0.2 and 0.2 and
 * adjusted during the traning phase, so the neural networkt
 * output predict the right value.
 *
 * The neuron is the basic unit of the neural network and it's responsible for
 * producing an output value based on its inputs, the output is calculated
 * using the following formula:
 *
  \f$ f(\sum_{i=1}^{n} W_i * I_i) = Out (1)\f$
 * Where:
 *

 *
\f$i\f$ is the index of the input.
 *
\f$n\f$ is the number of inputs.
 *
\f$I_i\f$ is the input value for input i.
 *
\f$W_i\f$ is the weight value for the input i.
 *
\f$Out\f$ is the output value.
 *
\f$f(x)\f$ is the activation function.
 *

 *
 * The activation function is chosen by the user and it can be any differentiable function,
 * however most problems can be solved using the Sigmoid function.
 *
 * As an example, imagine that one wants to predict if a light should be on/off if Bob and Alice
 * is present in the room using the following trained neural network.
 * @image html ann.png
 *
 * Consider that Bob is present (input is 1) and Alice (input is 0) is not.
 *
 * The first step is to provide the Bob's and Alice's presence to the input nerons,
 * In a neuron network the input neurons are special, because they do not apply the formula (1) to produce an output.
 * The output value from a input neuron is the input value itself, so in this case the
 * N1 and N2 neurons will output 1 and 0 respectively.
 *
 * Consider that all neurons are using the sigmoid function defined as:
 *
\f$\frac{1}{1 + e^{-x}}\f$
 *
 * Using the formula (1) the N3's output will be:
 * \f{eqnarray*}{
 *     OutputN3 &=& \frac{1}{1 + e^{-x}}\\
 *              &=& \frac{1}{1 + e^{-((1 * 3) + (0 * 1.2))}}\\
 *              &=& 0.95
 * \f}
 *
 * The same thing for N4:
 * \f{eqnarray*}{
 *     OutputN4 &=& \frac{1}{1 + e^{-x}}\\
 *              &=& \frac{1}{1 + e^{-((1 * 3.4) + (0 * 2.5))}}\\
 *              &=& 0.96
 * \f}
 *
 * Finally the Light state (N5):
 * \f{eqnarray*}{
 *     Light state  &=& \frac{1}{1 + e^{-x}}\\
 *              &=& \frac{1}{1 + e^{-((0.95 * 4) + (0.96 * 5))}}\\
 *              &=& 0.99
 * \f}
 *
 * The neural network predict that the light state is 0.99, as it's very close to 1 we can consider
 * that the light should be On.
 *
 * @remark The values used in the neural network above
 * (inputs, outputs, neuron weights) were chosen randomly.
 *
 * The example above uses two neurons in the hidden layer, however for some problem, two nerons is not good enough.
 * There is no silver bullet about how many neurons one should use in the hidden layer, this number is obtained by trial and error.
 * SML can handle this automatically, during the traning phase SML will automatically choose the neural network topology
 * (how many neurons the hidden layer must have), it will also decide which is the best activation function.
 *
 * The SML neural network engine has two methods of operation, these methods try
 * to reduce or eliminate a problem called catastrophic forgetting that affects neural
 * networks.
 *
 * Basically catastrophic forgetting is a problem that the neural network may forget everything
 * that has learnt in the past and only accumulate recent memory. This happens due the nature
 * of their training. In order to reduce this problem the following methods were implemented.
 *
 * The first method is called pseudohearsal (the default one), in this method only one neural network is created
 * and everytime it needs be retrained, random inputs are genereted and
 * feed to the network. The corresponding outputs are stored and used to train the neural network
 * with the new collected data.
 *
 * The second method of operation consists in creating N neural networks,
 * that are very specific for each pattern that SML encounters and everytime the SML wants to make a prediction,
 * it will choose which is the best neural network for the current situation.
 * It is possible to set a limit of how many neural networks SML will have in memory, this limit
 * can be set with ::sml_ann_set_cache_max_size. This cache implements the LRU algorithm so,
 * neural networks that were not recent used will be deleted.
 *
 *
 * To know more about catastrophic forgetting: https://en.wikipedia.org/wiki/Catastrophic_interference
 *  @{
 */

/**
 * @enum sml_ann_training_algorithm
 * @brief Algorithm types used to train a neural network.
 * @see ::sml_ann_set_training_algorithm
 */
enum sml_ann_training_algorithm {
    SML_ANN_TRAINING_ALGORITHM_QUICKPROP,     /**< Faster than the standard backpropagation.
                                                 Uses the gradient information to update the weights;
                                                 It's based on the Newton's method.
                                               */
    SML_ANN_TRAINING_ALGORITHM_RPROP     /**< Uses the sign of the gradient to update the weights.*/
};     /**< The neural networks training type. */

/**
 * @enum sml_ann_activation_function
 * @brief The functions that are used by the neurons to produce an output.
 * @see ::sml_ann_set_activation_function_candidates
 */
enum sml_ann_activation_function {
    SML_ANN_ACTIVATION_FUNCTION_SIGMOID,     /**< Sigmoid function. Defined for 0 < y < 1*/
    SML_ANN_ACTIVATION_FUNCTION_SIGMOID_SYMMETRIC,     /**< Sigmoid function. Defined for -1 < y < 1*/
    SML_ANN_ACTIVATION_FUNCTION_GAUSSIAN,     /**< Gaussian function. Defined for  0 < y < 1*/
    SML_ANN_ACTIVATION_FUNCTION_GAUSSIAN_SYMMETRIC,     /**< Gaussian function. Defined for -1 < y < 1*/
    SML_ANN_ACTIVATION_FUNCTION_ELLIOT,     /**< Elliot function. Defined for 0 < y < 1*/
    SML_ANN_ACTIVATION_FUNCTION_ELLIOT_SYMMETRIC,     /**< Elliot function. Defined for -1 < y < 1*/
    SML_ANN_ACTIVATION_FUNCTION_COS,      /**< Cosinus function. Defined for 0 <= y <= 1 */
    SML_ANN_ACTIVATION_FUNCTION_COS_SYMMETRIC,     /**< Cosinus function. Defined for -1 <= y <= 1 */
    SML_ANN_ACTIVATION_FUNCTION_SIN,     /**< Sinus function. Defined for 0 <= y <= 1 */
    SML_ANN_ACTIVATION_FUNCTION_SIN_SYMMETRIC     /**< Sinus function. Defined for -1 <= y <= 1 */
};     /**< The neuron activation functions */

/**
 * @brief Creates a SML neural networks engine.
 *
 * @remark It must be freed with ::sml_free after usage is done.
 *
 * @return A ::sml_object object on success.
 * @return @c NULL on failure.
 *
 * @see ::sml_free
 * @see ::sml_object
 */
struct sml_object *sml_ann_new(void);

/**
 * @brief Check if the SML object is a neural network engine.
 *
 * @param sml The ::sml_object object.
 * @return @c true If it is fuzzy.
 * @return @c false If it is not fuzzy.
 */
bool sml_is_ann(struct sml_object *sml);

/**
 * @brief Check if SML was built with neural networks support.
 *
 * @return @c true If it has neural network support.
 * @return @c false If it is has not neural network support.
 */
bool sml_ann_supported(void);

/**
 * @brief Set the neural network trainning algorithm.
 *
 * The training algorithm is responsible for adjusting the neural network weights.
 *
 * @remark The default training algorithm is ::SML_ANN_TRAINING_ALGORITHM_QUICKPROP
 *
 * @param sml The ::sml_object object.
 * @param algorithm The ::sml_ann_training_algorithm algorithm.
 * @return @c true on success.
 * @return @c false on failure.
 */
bool sml_ann_set_training_algorithm(struct sml_object *sml, enum sml_ann_training_algorithm algorithm);

/**
 * @brief Set the neural networks activation function candidates.
 *
 * Activation functions resides inside the neurons and they are responsible for producing the
 * neuron output value. As choosing the correct activation functions may required a
 * lot of trial and error tests, the SML uses an algorithm that tries to suit the best
 * activiation functions for a given problem.
 *
 * @remark By default all ::sml_ann_activation_function are used as candidates.
 *
 * @param sml The ::sml_object object.
 * @param functions The ::sml_ann_activation_function functions vector.
 * @param size The size of the vector functions.
 * @return @c true on success.
 * @return @c false on failure.
 */
bool sml_ann_set_activation_function_candidates(struct sml_object *sml, enum sml_ann_activation_function *functions, unsigned int size);

/**
 * @brief Set the maximum number of neurons in the network
 *
 * SML automatically add neurons to the hidden layers when training the neural network,
 * you can prevent the neural network to grow too big by setting the max neurons.
 * Larger networks are more difficult to train, thus required more time. However,
 * smaller networks will have poor predictions.
 *
 * @remark The default max_neurons is 5
 *
 * @param sml The ::sml_object object.
 * @param max_neurons The maximum number of neurons in the neural network.
 * @return @c true on success.
 * @return @c false on failure.
 */
bool sml_ann_set_max_neurons(struct sml_object *sml, unsigned int max_neurons);

/**
 * @brief Set the number of neural network candidates
 *
 * During the training phase the SML will choose the network topology by itself.
 * To do so, it will create (M * 4) neuron candidates (where M is
 * the number of activation function candidates) and then N (where N is the number of candidate groups)
 * candidate groups will be created, ending up with M*4*N candidate neurons.
 * The only different beetwen these candidate groups is the initial weight values.
 *
 * @remark The default number of candidates is 6
 *
 * @param sml The ::sml_object object.
 * @param candidate_groups The number of candidate groups.
 * @return @c true on success.
 * @return @c false on failure.
 *
 * @see ::sml_ann_set_max_neurons
 * @see ::sml_ann_set_activation_function_candidates
 */
bool sml_ann_set_candidate_groups(struct sml_object *sml, unsigned int candidate_groups);

/**
 * @brief Set the neral network train epochs
 *
 * The training epochs is used to know when to stop the training.
 * If the desired error is never reached, the training phase will stop
 * when it reaches the training_epochs value.
 *
 * @remark The default training epochs is 300
 *
 * @param sml The ::sml_object object.
 * @param training_epochs The number of training_epochs
 * @return @c true on success.
 * @return @c false on failure.
 *
 * @see ::sml_ann_set_desired_error
 */
bool sml_ann_set_training_epochs(struct sml_object *sml, unsigned int training_epochs);

/**
 * @brief Set the neural network desired error
 *
 * This is used as a shortcut to stop the training phase. If
 * the neural network error is equals or below desired_error the train will be stopped.
 *
 * @remark The default desired error is 0.001
 *
 * @param sml The ::sml_object object.
 * @param desired_error The desired error
 * @return @c true on success.
 * @return @c false on failure.
 */
bool sml_ann_set_desired_error(struct sml_object *sml, float desired_error);

/**
 * @brief Set the maximum number of neural networks in the cache.
 *
 * This cache is used to store the neural networks that will be used to predict
 * output values. Setting this limit is only necessary if one sets pseudorehearsal
 * strategy to @c false, otherwise it's ignored.
 *
 * @remark The default cache size is 30.
 * @remark 0 means "infinite" cache size.
 *
 * @param sml The ::sml_object object.
 * @param max_size The max cache size
 * @return @c true on success.
 * @return @c false on failure.
 *
 * @see ::sml_ann_use_pseudorehearsal_strategy
 */
bool sml_ann_set_cache_max_size(struct sml_object *sml, unsigned int max_size);

/**
 * @brief Set the required number of observations to train the neural network.
 *
 * The SML will only train the neural network when the observation count reaches
 * required_observation. However this number is only a hint to SML, because if SML detects
 * that the provided number is not enough, the required_observations will grow.
 * There is a way to control how much memory the SML will use to store observations,
 * this memory cap can be set with ::sml_set_max_memory_for_observations
 *
 * @remark The default required observations is 2500
 *
 * @param sml The ::sml_object object.
 * @param required_observations The number of required observations
 * @return @c true on success.
 * @return @c false on failure.
 */
bool sml_ann_set_initial_required_observations(struct sml_object *sml, unsigned int required_observations);

/**
 * @brief Set the pseudoreharsal strategy
 *
 * For more information about the pseudorehearsal strategy look at the
 * \ref Neural_Network_Engine_Introduction
 * @remark The default value for pseudorehearsal is @c true.
 *
 * @param sml The ::sml_object object.
 * @param use_pseudorehearsal @c true to enable, @c false to disable
 * @return @c true on success.
 * @return @c false on failure.
 */
bool sml_ann_use_pseudorehearsal_strategy(struct sml_object *sml, bool use_pseudorehearsal);
/**
 * @}
 */
#ifdef __cplusplus
}
#endif


text:
class Structura; module Containable
  # @group HashLike

  # @return [Hash]
  def to_h(reject_no_assign=false)
    return @db.dup if reject_no_assign

    {}.tap {|h|
      each_pair do |k, v|
        h[k] = v
      end
    }
  end

  # @yield [name]
  # @yieldparam [Symbol] name - sequential under defined
  # @yieldreturn [self]
  # @return [Enumerator]
  def each_name(&block)
    return to_enum(__method__) unless block_given?
    self.class.each_name(&block)
    self
  end

  alias_method :each_member, :each_name
  alias_method :each_key, :each_name

  def has_value?(value)
    @db.has_value? value
  end

  alias_method :value?, :has_value?

  # @yield [name, value]
  # keep truthy only (unassign falsy member)
  # @see #each_pair
  # @return [Enumerator]
  # @yieldreturn [self]
  # @yieldreturn [nil]
  def select!
    raise "can't modify frozen #{self.class}" if frozen?
    return to_enum(__method__) unless block_given?

    modified = false
    each_pair do |name, value|
      unless yield name, value
        unassign name
        modified = true
      end
    end

    modified ? self : nil
  end

  # @see #select!
  # @yield [name, value]
  # @return [Enumerator]
  def keep_if(&block)
    raise "can't modify frozen #{self.class}" if frozen?
    return to_enum(__method__) unless block_given?
    select!(&block)
    self
  end

  # @see #select!
  # keep falsy only (unassign truthy member)
  # @yield [name, value]
  # @return [Enumerator]
  def reject!
    raise "can't modify frozen #{self.class}" if frozen?
    return to_enum(__method__) unless block_given?

    modified = false
    each_pair do |name, value|
      if yield name, value
        unassign name
        modified = true
      end
    end

    modified ? self : nil
  end

  # @see #reject!
  # @yield [name, value]
  # @return [Enumerator]
  def delete_if(&block)
    raise "can't modify frozen #{self.class}" if frozen?
    return to_enum(__method__) unless block_given?

    reject!(&block)
    self
  end

  # @param [Symbol, String] name
  # @return [Array] [name, value]
  def assoc(name)
    name = originalkey_for(keyable_for name)

    [name, self[name]]
  end

  # @return [Array] [name, value]
  def rassoc(value)
    each_pair.find{|pair|pair[1] == value}
  end

  # @see Hash#flatten
  # @return [Array]
  def flatten(level=1)
    each_pair.to_a.flatten level
  end

  # @see #select!
  # @yield [name, value]
  # @return [Subclass]
  def select(&block)
    return to_enum(__method__) unless block_given?

    dup.tap {|r|r.select!(&block)}
  end

  # @see #reject!
  # @yield [name, value]
  # @return [Subclass]
  def reject(&block)
    return to_enum(__method__) unless block_given?

    dup.tap {|r|r.reject!(&block)}
  end

  # @endgroup
end; end


text:
/* jshint node: true */
'use strict';

var expect = require('chai').expect;
var resolvePackageDependencies = require('../lib/resolvePackageDependencies');

var glob = require('glob');

var options = {};

var neuronJsons = [{
  name: 'mod_a',
  main: '',
  entries: ['./b.js', './index.js'],
  'packageRoot': __dirname + '/fixtures/mod_a/'
}];

describe("resolve dependencies", function() {
  it("returns an object of dependencyTree as expectResult", function(done){
    var expectResult = {
      'mod_a': {
        '*': {
          'dependencies': {
            'e@*': '*',
            'm@*': '*',
            'z@*': '*'
          },
          'asyncDependencies': {
            'f@*': '*'
          }
        }
      }
    };

    function test(err, result) {
      expect(result).to.deep.equals(expectResult);
      done();
    }
    resolvePackageDependencies(neuronJsons, options, test);
  });
});


text:
/*******************************************************************************
 *
 * Module Name: nsobject - Utilities for objects attached to namespace
 *                         table entries
 *
 ******************************************************************************/

/*
 * Copyright (C) 2000 - 2013, Intel Corp.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    substantially similar to the "NO WARRANTY" disclaimer below
 *    ("Disclaimer") and any redistribution must be conditioned upon
 *    including a substantially similar Disclaimer requirement for further
 *    binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * Alternatively, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 * NO WARRANTY
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES.
 */

#define __NSOBJECT_C__

#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>

#define _COMPONENT          ACPI_NAMESPACE
        ACPI_MODULE_NAME    ("nsobject")

/*******************************************************************************
 *
 * FUNCTION:    AcpiNsAttachObject
 *
 * PARAMETERS:  Node                - Parent Node
 *              Object              - Object to be attached
 *              Type                - Type of object, or ACPI_TYPE_ANY if not
 *                                    known
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Record the given object as the value associated with the
 *              name whose ACPI_HANDLE is passed. If Object is NULL
 *              and Type is ACPI_TYPE_ANY, set the name as having no value.
 *              Note: Future may require that the Node->Flags field be passed
 *              as a parameter.
 *
 * MUTEX:       Assumes namespace is locked
 *
 ******************************************************************************/

ACPI_STATUS
AcpiNsAttachObject (
    ACPI_NAMESPACE_NODE     *Node,
    ACPI_OPERAND_OBJECT     *Object,
    ACPI_OBJECT_TYPE        Type)
{
    ACPI_OPERAND_OBJECT     *ObjDesc;
    ACPI_OPERAND_OBJECT     *LastObjDesc;
    ACPI_OBJECT_TYPE        ObjectType = ACPI_TYPE_ANY;

    ACPI_FUNCTION_TRACE (NsAttachObject);

    /*
     * Parameter validation
     */
    if (!Node)
    {
        /* Invalid handle */

        ACPI_ERROR ((AE_INFO, "Null NamedObj handle"));
        return_ACPI_STATUS (AE_BAD_PARAMETER);
    }

    if (!Object && (ACPI_TYPE_ANY != Type))
    {
        /* Null object */

        ACPI_ERROR ((AE_INFO,
            "Null object, but type not ACPI_TYPE_ANY"));
        return_ACPI_STATUS (AE_BAD_PARAMETER);
    }

    if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
    {
        /* Not a name handle */

        ACPI_ERROR ((AE_INFO, "Invalid handle %p [%s]",
            Node, AcpiUtGetDescriptorName (Node)));
        return_ACPI_STATUS (AE_BAD_PARAMETER);
    }

    /* Check if this object is already attached */

    if (Node->Object == Object)
    {
        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
            "Obj %p already installed in NameObj %p\n",
            Object, Node));

        return_ACPI_STATUS (AE_OK);
    }

    /* If null object, we will just install it */

    if (!Object)
    {
        ObjDesc    = NULL;
        ObjectType = ACPI_TYPE_ANY;
    }

    /*
     * If the source object is a namespace Node with an attached object,
     * we will use that (attached) object
     */
    else if ((ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED) &&
            ((ACPI_NAMESPACE_NODE *) Object)->Object)
    {
        /*
         * Value passed is a name handle and that name has a
         * non-null value. Use that name's value and type.
         */
        ObjDesc    = ((ACPI_NAMESPACE_NODE *) Object)->Object;
        ObjectType = ((ACPI_NAMESPACE_NODE *) Object)->Type;
    }

    /*
     * Otherwise, we will use the parameter object, but we must type
     * it first
     */
    else
    {
        ObjDesc = (ACPI_OPERAND_OBJECT  *) Object;

        /* Use the given type */

        ObjectType = Type;
    }

    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
        ObjDesc, Node, AcpiUtGetNodeName (Node)));

    /* Detach an existing attached object if present */

    if (Node->Object)
    {
        AcpiNsDetachObject (Node);
    }

    if (ObjDesc)
    {
        /*
         * Must increment the new value's reference count
         * (if it is an internal object)
         */
        AcpiUtAddReference (ObjDesc);

        /*
         * Handle objects with multiple descriptors - walk
         * to the end of the descriptor list
         */
        LastObjDesc = ObjDesc;
        while (LastObjDesc->Common.NextObject)
        {
            LastObjDesc = LastObjDesc->Common.NextObject;
        }

        /* Install the object at the front of the object list */

        LastObjDesc->Common.NextObject = Node->Object;
    }

    Node->Type     = (UINT8) ObjectType;
    Node->Object   = ObjDesc;

    return_ACPI_STATUS (AE_OK);
}

/*******************************************************************************
 *
 * FUNCTION:    AcpiNsDetachObject
 *
 * PARAMETERS:  Node           - A Namespace node whose object will be detached
 *
 * RETURN:      None.
 *
 * DESCRIPTION: Detach/delete an object associated with a namespace node.
 *              if the object is an allocated object, it is freed.
 *              Otherwise, the field is simply cleared.
 *
 ******************************************************************************/

void
AcpiNsDetachObject (
    ACPI_NAMESPACE_NODE     *Node)
{
    ACPI_OPERAND_OBJECT     *ObjDesc;

    ACPI_FUNCTION_TRACE (NsDetachObject);

    ObjDesc = Node->Object;

    if (!ObjDesc ||
        (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA))
    {
        return_VOID;
    }

    if (Node->Flags & ANOBJ_ALLOCATED_BUFFER)
    {
        /* Free the dynamic aml buffer */

        if (ObjDesc->Common.Type == ACPI_TYPE_METHOD)
        {
            ACPI_FREE (ObjDesc->Method.AmlStart);
        }
    }

    /* Clear the entry in all cases */

    Node->Object = NULL;
    if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)
    {
        Node->Object = ObjDesc->Common.NextObject;
        if (Node->Object &&
           ((Node->Object)->Common.Type != ACPI_TYPE_LOCAL_DATA))
        {
            Node->Object = Node->Object->Common.NextObject;
        }
    }

    /* Reset the node type to untyped */

    Node->Type = ACPI_TYPE_ANY;

    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
        Node, AcpiUtGetNodeName (Node), ObjDesc));

    /* Remove one reference on the object (and all subobjects) */

    AcpiUtRemoveReference (ObjDesc);
    return_VOID;
}

/*******************************************************************************
 *
 * FUNCTION:    AcpiNsGetAttachedObject
 *
 * PARAMETERS:  Node             - Namespace node
 *
 * RETURN:      Current value of the object field from the Node whose
 *              handle is passed
 *
 * DESCRIPTION: Obtain the object attached to a namespace node.
 *
 ******************************************************************************/

ACPI_OPERAND_OBJECT *
AcpiNsGetAttachedObject (
    ACPI_NAMESPACE_NODE     *Node)
{
    ACPI_FUNCTION_TRACE_PTR (NsGetAttachedObject, Node);

    if (!Node)
    {
        ACPI_WARNING ((AE_INFO, "Null Node ptr"));
        return_PTR (NULL);
    }

    if (!Node->Object ||
            ((ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_OPERAND) &&
             (ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_NAMED))  ||
        ((Node->Object)->Common.Type == ACPI_TYPE_LOCAL_DATA))
    {
        return_PTR (NULL);
    }

    return_PTR (Node->Object);
}

/*******************************************************************************
 *
 * FUNCTION:    AcpiNsGetSecondaryObject
 *
 * PARAMETERS:  Node             - Namespace node
 *
 * RETURN:      Current value of the object field from the Node whose
 *              handle is passed.
 *
 * DESCRIPTION: Obtain a secondary object associated with a namespace node.
 *
 ******************************************************************************/

ACPI_OPERAND_OBJECT *
AcpiNsGetSecondaryObject (
    ACPI_OPERAND_OBJECT     *ObjDesc)
{
    ACPI_FUNCTION_TRACE_PTR (NsGetSecondaryObject, ObjDesc);

    if ((!ObjDesc)                                     ||
        (ObjDesc->Common.Type== ACPI_TYPE_LOCAL_DATA)  ||
        (!ObjDesc->Common.NextObject)                  ||
        ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA))
    {
        return_PTR (NULL);
    }

    return_PTR (ObjDesc->Common.NextObject);
}

/*******************************************************************************
 *
 * FUNCTION:    AcpiNsAttachData
 *
 * PARAMETERS:  Node            - Namespace node
 *              Handler         - Handler to be associated with the data
 *              Data            - Data to be attached
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Low-level attach data. Create and attach a Data object.
 *
 ******************************************************************************/

ACPI_STATUS
AcpiNsAttachData (
    ACPI_NAMESPACE_NODE     *Node,
    ACPI_OBJECT_HANDLER     Handler,
    void                    *Data)
{
    ACPI_OPERAND_OBJECT     *PrevObjDesc;
    ACPI_OPERAND_OBJECT     *ObjDesc;
    ACPI_OPERAND_OBJECT     *DataDesc;

    /* We only allow one attachment per handler */

    PrevObjDesc = NULL;
    ObjDesc = Node->Object;
    while (ObjDesc)
    {
        if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
            (ObjDesc->Data.Handler == Handler))
        {
            return (AE_ALREADY_EXISTS);
        }

        PrevObjDesc = ObjDesc;
        ObjDesc = ObjDesc->Common.NextObject;
    }

    /* Create an internal object for the data */

    DataDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_DATA);
    if (!DataDesc)
    {
        return (AE_NO_MEMORY);
    }

    DataDesc->Data.Handler = Handler;
    DataDesc->Data.Pointer = Data;

    /* Install the data object */

    if (PrevObjDesc)
    {
        PrevObjDesc->Common.NextObject = DataDesc;
    }
    else
    {
        Node->Object = DataDesc;
    }

    return (AE_OK);
}

/*******************************************************************************
 *
 * FUNCTION:    AcpiNsDetachData
 *
 * PARAMETERS:  Node            - Namespace node
 *              Handler         - Handler associated with the data
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Low-level detach data. Delete the data node, but the caller
 *              is responsible for the actual data.
 *
 ******************************************************************************/

ACPI_STATUS
AcpiNsDetachData (
    ACPI_NAMESPACE_NODE     *Node,
    ACPI_OBJECT_HANDLER     Handler)
{
    ACPI_OPERAND_OBJECT     *ObjDesc;
    ACPI_OPERAND_OBJECT     *PrevObjDesc;

    PrevObjDesc = NULL;
    ObjDesc = Node->Object;
    while (ObjDesc)
    {
        if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
            (ObjDesc->Data.Handler == Handler))
        {
            if (PrevObjDesc)
            {
                PrevObjDesc->Common.NextObject = ObjDesc->Common.NextObject;
            }
            else
            {
                Node->Object = ObjDesc->Common.NextObject;
            }

            AcpiUtRemoveReference (ObjDesc);
            return (AE_OK);
        }

        PrevObjDesc = ObjDesc;
        ObjDesc = ObjDesc->Common.NextObject;
    }

    return (AE_NOT_FOUND);
}

/*******************************************************************************
 *
 * FUNCTION:    AcpiNsGetAttachedData
 *
 * PARAMETERS:  Node            - Namespace node
 *              Handler         - Handler associated with the data
 *              Data            - Where the data is returned
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Low level interface to obtain data previously associated with
 *              a namespace node.
 *
 ******************************************************************************/

ACPI_STATUS
AcpiNsGetAttachedData (
    ACPI_NAMESPACE_NODE     *Node,
    ACPI_OBJECT_HANDLER     Handler,
    void                    **Data)
{
    ACPI_OPERAND_OBJECT     *ObjDesc;

    ObjDesc = Node->Object;
    while (ObjDesc)
    {
        if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
            (ObjDesc->Data.Handler == Handler))
        {
            *Data = ObjDesc->Data.Pointer;
            return (AE_OK);
        }

        ObjDesc = ObjDesc->Common.NextObject;
    }

    return (AE_NOT_FOUND);
}


text:
'use strict';

var NativeMethodsMixin = require('NativeMethodsMixin');
var PropTypes = require('ReactPropTypes');
var React = require('React');
var StyleSheet = require('StyleSheet');
var View = require('View');

var requireNativeComponent = require('requireNativeComponent');
var verifyPropTypes = require('verifyPropTypes');

var GRAY = '#999999';

type DefaultProps = {
  animating: boolean;
  color: string;
  hidesWhenStopped: boolean;
  size: 'small' | 'large';
};

var ActivityIndicatorIOS = React.createClass({
  mixins: [NativeMethodsMixin],

  propTypes: {
    /**
     * Whether to show the indicator (true, the default) or hide it (false).
     */
    animating: PropTypes.bool,
    /**
     * The foreground color of the spinner (default is gray).
     */
    color: PropTypes.string,
    /**
     * Whether the indicator should hide when not animating (true by default).
     */
    hidesWhenStopped: PropTypes.bool,
    /**
     * Size of the indicator. Small has a height of 20, large has a height of 36.
     */
    size: PropTypes.oneOf([
      'small',
      'large',
    ]),
    /**
     * Invoked on mount and layout changes with
     *
     *   {nativeEvent: { layout: {x, y, width, height}}}.
     */
    onLayout: PropTypes.func,
  },

  getDefaultProps: function(): DefaultProps {
    return {
      animating: true,
      color: GRAY,
      hidesWhenStopped: true,
      size: 'small',
    };
  },

  render: function() {
    var {onLayout, style, ...props} = this.props;
    var sizeStyle = (this.props.size === 'large') ? styles.sizeLarge : styles.sizeSmall;
    return (
      <View
        onLayout={onLayout}
        style={[styles.container, sizeStyle, style]}>
        <RCTActivityIndicatorView {...props} />
      </View>
    );
  }
});

var styles = StyleSheet.create({
  container: {
    alignItems: 'center',
    justifyContent: 'center',
  },
  sizeSmall: {
    width: 20,
    height: 20,
  },
  sizeLarge: {
    width: 36,
    height: 36,
  }
});

var RCTActivityIndicatorView = requireNativeComponent(
  'RCTActivityIndicatorView',
  null
);
if (__DEV__) {
  var nativeOnlyProps = {activityIndicatorViewStyle: true};
  verifyPropTypes(
    ActivityIndicatorIOS,
    RCTActivityIndicatorView.viewConfig,
    nativeOnlyProps
  );
}

module.exports = ActivityIndicatorIOS;


text:
package com.sun.xml.internal.ws.server;

/**
 * @author Vivek Pandey
 *
 * Defines server side constants
 *
 */
public interface ServerPropertyConstants {
    /*public static final String ATTACHMENT_CONTEXT =
        "com.sun.xml.internal.ws.attachment.AttachmentContext";*/
    public static final String SET_ATTACHMENT_PROPERTY =
        "com.sun.xml.internal.ws.attachment.SetAttachmentContext";
    public static final String GET_ATTACHMENT_PROPERTY =
        "com.sun.xml.internal.ws.attachment.GetAttachmentContext";
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="string141.xsl"?>
<doc/>


text:
<?php

namespace Kunstmaan\NodeSearchBundle\Tests\DependencyInjection\Compiler;

use Kunstmaan\NodeSearchBundle\DependencyInjection\Compiler\NodeSearcherCompilerPass;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

class NodeSearcherCompilerPassTest extends TestCase
{
    public function testTaggerSearchers()
    {
        $container = new ContainerBuilder();

        $container->register('kunstmaan_node_search.search.service', 'Kunstmaan\NodeSearchBundle\Services\SearchService')
            ->setArguments([new Reference('service_container'), new Reference('request_stack'), 10, []])
        ;

        $container->register('custom_searcher_1', 'stdClass')->addTag('kunstmaan_node_search.node_searcher');
        $container->register('custom_searcher_2', 'stdClass');

        $pass = new NodeSearcherCompilerPass();
        $pass->process($container);
        $arguments = $container->getDefinition('kunstmaan_node_search.search.service')->getArguments();

        $expected = [
            'custom_searcher_1',
        ];

        $this->assertCount(4, $arguments);
        $this->assertEquals($expected, array_keys($arguments[3]));
    }
}


text:
Fabricator(:category) do
  name        { Faker::Commerce.department(2) }
  description { Faker::Lorem.paragraph(2) }
end


text:
var should = chai.should();

describe("DraggableNumber input attributes", function() {
  beforeEach(function() {
    this.input = document.createElement("input");
    document.body.appendChild(this.input);
  });

  afterEach(function() {
    document.body.removeChild(this.input);
    delete this.input;
  });

  it("It should be possible to set options with input attributes", function() {
    this.input.setAttribute('data-min', "-17");
    this.input.setAttribute('data-max', "2014");
    this.input.setAttribute('data-dragThreshold', "24");
    var el = new DraggableNumber(this.input);
    el._min.should.equal(-17);
    el._max.should.equal(2014);
    el._dragThreshold.should.equal(24);
    el.destroy();
  });

  it("Defining options should override data attributes", function() {
    this.input.setAttribute('data-min', "-17");
    this.input.setAttribute('data-max', "2014");
    this.input.setAttribute('data-dragThreshold', "24");
    var el = new DraggableNumber(this.input, {
      min: 72,
      max: 1234,
      dragThreshold: 7
    });
    el._min.should.equal(72);
    el._max.should.equal(1234);
    el._dragThreshold.should.equal(7);
    el.destroy();
  });
});


text:
package org.apache.camel.component.jms;

import javax.jms.ConnectionFactory;

import org.apache.camel.BindToRegistry;
import org.apache.camel.CamelContext;
import org.apache.camel.ExchangePattern;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.junit.jupiter.api.Test;

import static org.apache.camel.component.jms.JmsComponent.jmsComponentAutoAcknowledge;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class JmsRouteWithInOnlyAndMultipleAcksTest extends CamelTestSupport {

    protected String componentName = "amq";

    @BindToRegistry("orderService")
    private MyOrderServiceBean serviceBean = new MyOrderServiceBean();

    @BindToRegistry("orderServiceNotificationWithAck-1")
    private MyOrderServiceNotificationWithAckBean orderNotificationAckBean = new MyOrderServiceNotificationWithAckBean("1");

    @BindToRegistry("orderServiceNotificationWithAck-2")
    private MyOrderServiceNotificationWithAckBean orderNotificationAckBean2 = new MyOrderServiceNotificationWithAckBean("2");

    @Test
    public void testSendOrderWithMultipleAcks() throws Exception {
        MockEndpoint inbox = getMockEndpoint("mock:inbox");
        inbox.expectedBodiesReceived("Camel in Action");

        String orderId = "1";
        MockEndpoint notifCollector = getMockEndpoint("mock:orderNotificationAckCollector");
        notifCollector.expectedMessageCount(2);
        notifCollector.expectedHeaderReceived("JMSCorrelationID", orderId);
        notifCollector.setResultWaitTime(10000);

        Object out = template.requestBodyAndHeader("amq:queue:inbox", "Camel in Action", "JMSCorrelationID", orderId);
        assertEquals("OK: Camel in Action", out);

        assertMockEndpointsSatisfied();
    }

    @Override
    protected CamelContext createCamelContext() throws Exception {
        CamelContext camelContext = super.createCamelContext();

        ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
        camelContext.addComponent(componentName, jmsComponentAutoAcknowledge(connectionFactory));

        return camelContext;
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // this route picks up an order request
                // send out a one way notification to multiple
                // topic subscribers, lets a bean handle
                // the order and then delivers a reply back to
                // the original order request initiator
                from("amq:queue:inbox").to("mock:inbox").to(ExchangePattern.InOnly, "amq:topic:orderServiceNotification").bean(
                        "orderService",
                        "handleOrder");

                // this route collects an order request notification
                // and sends back an acknowledgment back to a queue
                from("amq:topic:orderServiceNotification")
                        .bean("orderServiceNotificationWithAck-1", "handleOrderNotificationWithAck")
                        .to("amq:queue:orderServiceNotificationAck");

                // this route collects an order request notification
                // and sends back an acknowledgment back to a queue
                from("amq:topic:orderServiceNotification")
                        .bean("orderServiceNotificationWithAck-2", "handleOrderNotificationWithAck")
                        .to("amq:queue:orderServiceNotificationAck");

                // this route collects all order notifications acknowledgments
                from("amq:queue:orderServiceNotificationAck").to("mock:orderNotificationAckCollector");
            }
        };
    }

    public static class MyOrderServiceBean {
        public String handleOrder(String body) {
            return "OK: " + body;
        }
    }

    public static class MyOrderServiceNotificationWithAckBean {
        private String id;

        public MyOrderServiceNotificationWithAckBean(String id) {
            this.id = id;
        }

        public String handleOrderNotificationWithAck(String body) {
            return "Ack-" + id + ":" + body;
        }
    }
}


text:
package org.knowm.xchange.clevercoin;

import org.knowm.xchange.BaseExchange;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeSpecification;
import org.knowm.xchange.clevercoin.service.polling.CleverCoinAccountService;
import org.knowm.xchange.clevercoin.service.polling.CleverCoinMarketDataService;
import org.knowm.xchange.clevercoin.service.polling.CleverCoinTradeService;
import org.knowm.xchange.utils.nonce.CurrentTimeNonceFactory;

import si.mazi.rescu.SynchronizedValueFactory;

/**
 * @author Karsten Nilsen
 */
public class CleverCoinExchange extends BaseExchange implements Exchange {

  private SynchronizedValueFactory<Long> nonceFactory = new CurrentTimeNonceFactory();

  @Override
  protected void initServices() {
    this.pollingMarketDataService = new CleverCoinMarketDataService(this);
    this.pollingTradeService = new CleverCoinTradeService(this);
    this.pollingAccountService = new CleverCoinAccountService(this);
  }

  @Override
  public ExchangeSpecification getDefaultExchangeSpecification() {

    ExchangeSpecification exchangeSpecification = new ExchangeSpecification(this.getClass().getCanonicalName());
    exchangeSpecification.setSslUri("https://api.clevercoin.com");
    exchangeSpecification.setHost("api.clevercoin.com");
    exchangeSpecification.setPort(80);
    exchangeSpecification.setExchangeName("CleverCoin");
    exchangeSpecification.setExchangeDescription("CleverCoin is a Bitcoin exchange registred in The Netherlands with banking partner in France.");
    return exchangeSpecification;
  }

  @Override
  public SynchronizedValueFactory<Long> getNonceFactory() {

    return nonceFactory;
  }
}


text:
package org.terasology.engine.entitySystem.event;

import org.terasology.engine.network.NoReplicate;

public abstract class AbstractConsumableEvent implements ConsumableEvent {
    @NoReplicate
    protected boolean consumed;

    @Override
    public void consume() {
        consumed = true;
    }

    @Override
    public boolean isConsumed() {
        return consumed;
    }
}


text:
require 'spec_helper'

describe Trait, :job do
  subject { create :space }
  before(:each) do
    [Theorem, Trait].map &:delete_all
    theorem.save! validate: false
  end

  atoms :a, :b, :c

  context 'simple implications' do
    let(:theorem) { a >> b }

    it 'checks directly' do
      assert! subject, a
      expect( subject ).to satisfy b
    end

    it 'checks the contrapositive' do
      assert! subject, ~b
      expect( subject ).to satisfy ~a
    end
  end

  context 'disjunctions' do
    let(:theorem) { a >> (b | c ) }

    it 'checks directly' do
      assert! subject, a
      assert! subject, ~c
      expect( subject ).to satisfy b
    end

    it 'checks the contrapositive' do
      assert! subject, ~b
      assert! subject, ~c
      expect( subject ).to satisfy ~a
    end

    it 'only forces disjunctions when known' do
      assert! subject, a
      expect( subject ).not_to satisfy b
    end
  end

  context 'conjunctions' do
    let(:theorem) { a >> (b + c) }

    it 'checks directly' do
      assert! subject, a
      expect( subject ).to satisfy (b + c)
    end

    it 'checks the contrapositive' do
      assert! subject, ~c
      expect( subject ).to satisfy ~a
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>de.gishmo.gwt.example</groupId>
  <artifactId>module0707</artifactId>
  <version>1.0.0</version>

  <packaging>gwt-lib</packaging>

  <properties>
    <!-- Convenience property to set the GWT version -->
    <gwtVersion>2.8.2</gwtVersion>

    <!-- GWT needs at least java 1.6 -->
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

    <junit.version>4.12</junit.version>
    <org.mockito.version>1.10.19</org.mockito.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.outputEncoding>UTF-8</project.build.outputEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt</artifactId>
        <version>${gwtVersion}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-dev</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-codeserver</artifactId>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>src/main/java</directory>
        <includes>
          <include>**/shared/**</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/shared/**</include>
          <include>**/*.gwt.xml</include>
        </includes>
      </resource>
    </resources>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <encoding>${project.build.sourceEncoding}</encoding>
          <source>${maven.compiler.source}</source>
          <target>${maven.compiler.target}</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>net.ltgt.gwt.maven</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>1.0-rc-7</version>
        <extensions>true</extensions>
        <configuration>
          <moduleName>de.gishmo.gwt.example.module0707.Module0707</moduleName>
          <logLevel>TRACE</logLevel>
        </configuration>
        <!--<executions>-->
        <!--<execution>-->
        <!--<goals>-->
        <!--<goal>compile</goal>-->
        <!--</goals>-->
        <!--</execution>-->
        <!--</executions>-->
      </plugin>
    </plugins>
  </build>
</project>


text:
#include <common.h>
#include <dm.h>
#include <errno.h>
#include <sysreset.h>
#include <wdt.h>
#include <asm/io.h>
#include <asm/arch/wdt.h>
#include <linux/err.h>

static int ast_sysreset_request(struct udevice *dev, enum sysreset_t type)
{
	struct udevice *wdt;
	u32 reset_mode;
	int ret = uclass_first_device(UCLASS_WDT, &wdt);

	if (ret)
		return ret;

	switch (type) {
	case SYSRESET_WARM:
		reset_mode = WDT_CTRL_RESET_CPU;
		break;
	case SYSRESET_COLD:
		reset_mode = WDT_CTRL_RESET_CHIP;
		break;
	default:
		return -EPROTONOSUPPORT;
	}

	ret = wdt_expire_now(wdt, reset_mode);
	if (ret) {
		debug("Sysreset failed: %d", ret);
		return ret;
	}

	return -EINPROGRESS;
}

static struct sysreset_ops ast_sysreset = {
	.request	= ast_sysreset_request,
};

U_BOOT_DRIVER(sysreset_ast) = {
	.name	= "ast_sysreset",
	.id	= UCLASS_SYSRESET,
	.ops	= &ast_sysreset,
};