text:
require('../../support/spec_helper');

describe("Cucumber.Listener.JsonFormatterWrapper", function () {
  var Cucumber = requireLib('cucumber');
  var listener, failedStepResults;

  beforeEach(function () {
    spyOn(process.stdout, 'write');
    listener  = Cucumber.Listener.JsonFormatter(process.stdout);
    formatter = listener.getGherkinFormatter();
    spyOn(formatter, 'uri');
    spyOn(formatter, 'feature');
    spyOn(formatter, 'step');
    spyOn(formatter, 'background');
    spyOn(formatter, 'scenario');
    spyOn(formatter, 'result');
    spyOn(formatter, 'match');
    spyOn(formatter, 'eof');
    spyOn(formatter, 'done');
  });

  describe("handleBeforeFeatureEvent()", function () {
    var event, feature, callback;

    beforeEach(function () {
      feature = createSpyWithStubs("feature", {
        getKeyword: 'Feature',
        getName: 'A Name',
        getDescription: 'A Description',
        getLine: 3,
        getUri: undefined,
        getTags: false
      });
      event    = createSpyWithStubs("event", {getPayloadItem: feature});
      callback = createSpy("callback");
    });

    it("adds the feature attributes to the output", function () {
      listener.handleBeforeFeatureEvent(event, callback);
      expect(formatter.uri).toHaveBeenCalledWith(undefined);
      expect(formatter.feature).toHaveBeenCalledWith({
        id: 'A-Name',
        name: 'A Name',
        description: 'A Description',
        line: 3,
        keyword: 'Feature'
      });
    });
  });

  // Handle Background

  describe("handleBackgroundEvent()", function () {

    var parentFeatureEvent, background, step, steps, event, callback;

    beforeEach(function () {
      feature = createSpyWithStubs("feature", {
        getKeyword: 'Feature',
        getName: 'A Name',
        getDescription: 'A Description',
        getLine: 3,
        getUri: 'feature-uri',
        getTags: false
      });
      parentFeatureEvent = createSpyWithStubs("event", {getPayloadItem: feature});
      step = createSpyWithStubs("step", {
        getName: 'Step',
        getLine: 3,
        getKeyword: 'Step',
        hasDocString: false,
        hasDataTable: false
      });
      steps = [step];
      background = createSpyWithStubs("background", {
        getKeyword: 'Background',
        getName: 'A Name',
        getDescription: 'A Description',
        getLine: 3,
        getSteps: steps
      });
      event    = createSpyWithStubs("event", {getPayloadItem: background});
      callback = createSpy("callback");
    });

    it("adds the background attributes to the output", function () {
      listener.handleBackgroundEvent(event, callback);
      expect(formatter.background).toHaveBeenCalledWith({
        name: 'A Name',
        keyword: 'Background',
        description: 'A Description',
        type: 'background',
        line: 3
      });
    });
  });

  // Handle Scenario

  describe("handleBeforeScenarioEvent()", function () {
    var parentFeatureEvent, scenario, callback;

    beforeEach(function () {
      feature = createSpyWithStubs("feature", {
        getKeyword: 'Feature',
        getName: 'A Name',
        getDescription: 'A Description',
        getLine: 3,
        getUri: 'feature-uri',
        getTags: false
      });
      parentFeatureEvent = createSpyWithStubs("event", {getPayloadItem: feature});
      scenario = createSpyWithStubs("scenario", {
        getKeyword: 'Scenario',
        getName: 'A Name',
        getDescription: 'A Description',
        getLine: 3,
        getTags: false
      });
      event    = createSpyWithStubs("event", {getPayloadItem: scenario});
      callback = createSpy("callback");
    });

    it("adds the scenario attributes to the output", function () {
      listener.handleBeforeScenarioEvent(event, callback);
      expect(formatter.scenario).toHaveBeenCalledWith({
        name: 'A Name',
        id: 'undefined;a-name',
        line: 3,
        keyword: 'Scenario',
        description: 'A Description',
        type: 'scenario'
      });
    });
  });

  describe("formatStep()", function () {
    it("adds name, line and keyword to the step properties", function (){
      var step = createSpyWithStubs("step", {
        getName: 'Step',
        getLine: 3,
        getKeyword: 'Step',
        hasDocString: false,
        hasDataTable: false
      });

      listener.formatStep(step);
      expect(formatter.step).toHaveBeenCalledWith({ name : 'Step', line : 3, keyword : 'Step'});

    });

    it("if the step has one, adds a DocString to the step properties", function (){
      var fakeDocString = createSpyWithStubs("docString", {
        getContents: "This is a DocString",
        getLine: 3,
        getContentType: null
      });

      var step = createSpyWithStubs("step", {
        getName: 'Step',
        getLine: 3,
        getKeyword: 'Step',
        hasDocString: true,
        hasDataTable: false,
        getDocString: fakeDocString
      });

      listener.formatStep(step);
      expect(formatter.step).toHaveBeenCalledWith({
        name: 'Step',
        line: 3,
        keyword: 'Step',
        doc_string: {
          value: 'This is a DocString',
          line: 3,
          content_type: null
        }
      });
    });

    it("if the step has one, adds a DataTable to the step properties", function (){
      var fakeContents = createSpyWithStubs("row", {
        raw: [
          ['a:1', 'a:2', 'a:3'],
          ['b:1', 'b:2', 'b:3'],
          ['c:1', 'c:2', 'c:3']
        ]
      })
      var fakeDataTable = createSpyWithStubs("dataTable", { getContents: fakeContents });
      var step = createSpyWithStubs("step", {
        getName: 'Step',
        getLine: 3,
        getKeyword: 'Step',
        hasDocString: false,
        hasDataTable: true,
        getDataTable: fakeDataTable
      });
      listener.formatStep(step);
      expect(formatter.step).toHaveBeenCalledWith({
        name: 'Step',
        line: 3,
        keyword: 'Step',
        rows: [
          {line : undefined, cells: ['a:1', 'a:2', 'a:3'] },
          {line : undefined, cells: ['b:1', 'b:2', 'b:3'] },
          {line : undefined, cells: ['c:1', 'c:2', 'c:3'] }
        ]
      });
    });
  });

  describe("formatTags()", function () {
    it("returns the given tags in the format expected by the JSON formatter", function () {
      var tags = [
        createSpyWithStubs("tag", {getName: "tag_one", getLine:1}),
        createSpyWithStubs("tag", {getName: "tag_two", getLine:2}),
        createSpyWithStubs("tag", {getName: "tag_three", getLine:3})
      ];
      expect(listener.formatTags(tags, null)).toEqual([
        {name: 'tag_one', line :1},
        {name: 'tag_two', line :2},
        {name: 'tag_three', line :3}
      ]);
    });

    it("filters out any tags it is told to ignore - e.g. those of the parent feature", function (){
      var tags = [
        createSpyWithStubs("tag", {getName: "tag_one", getLine:1}),
        createSpyWithStubs("tag", {getName: "tag_two", getLine:2}),
        createSpyWithStubs("tag", {getName: "parent_one", getLine:3}),
        createSpyWithStubs("tag", {getName: "parent_two", getLine:3})
      ];

      var parent_tags = [
        createSpyWithStubs("tag", {getName: "parent_one", getLine:3}),
        createSpyWithStubs("tag", {getName: "parent_two", getLine:3})
      ];
      expect(listener.formatTags(tags, parent_tags)).toEqual([
        {name: 'tag_one', line :1},
        {name: 'tag_two', line :2}
      ]);
    });
  });

  describe("handleStepResultEvent()", function () {
    var parentFeatureEvent, feature, parent_scenario_event, scenario, event, callback, stepResult;

    beforeEach(function () {
      callback = createSpy("Callback");
    });

    it("outputs a step with failed status where no result has been defined", function (){
      step = createSpyWithStubs("step", {
        getName: 'Step',
        getLine: 3,
        getKeyword: 'Step',
        hasDocString: false,
        hasDataTable: false
      });
      stepResult = createSpyWithStubs("stepResult", {
        isSuccessful: undefined,
        isPending:    undefined,
        isFailed:     undefined,
        isSkipped:    undefined,
        isUndefined:  undefined,
        getFailureException: false,
        getDuration:  undefined,
        getStep:      step
      });
      fakeEvent = createSpyWithStubs("event", {getPayloadItem: stepResult});

      listener.handleStepResultEvent(fakeEvent, callback);

      expect(formatter.step).toHaveBeenCalledWith({name: 'Step', line: 3, keyword: 'Step'});
      expect(formatter.result).toHaveBeenCalledWith({status: 'failed'});
      expect(formatter.match).toHaveBeenCalledWith({location: undefined});

    });

    it("outputs a step with passed status for a successful step", function (){
      step = createSpyWithStubs("step", {
        getName: 'Step',
        getLine: 3,
        getKeyword: 'Step',
        hasDocString: false,
        hasDataTable: false
      });
      stepResult = createSpyWithStubs("stepResult", {
        isSuccessful: undefined,
        isPending:    undefined,
        isFailed:     undefined,
        isSkipped:    undefined,
        isUndefined:  undefined,
        getFailureException: false,
        getDuration:  undefined,
        getStep:      step
      });
      stepResult.isSuccessful.andReturn(true);
      stepResult.getDuration.andReturn(1);
      fakeEvent = createSpyWithStubs("event", {getPayloadItem: stepResult});

      listener.handleStepResultEvent(fakeEvent, callback);

      expect(formatter.step).toHaveBeenCalledWith({name: 'Step', line: 3, keyword: 'Step'});
      expect(formatter.result).toHaveBeenCalledWith({status: 'passed', duration: 1});
      expect(formatter.match).toHaveBeenCalledWith({location: undefined});
    });

    it("outputs a step with pending status where step is pending", function (){
      step = createSpyWithStubs("step", {
        getName: 'Step',
        getLine: 3,
        getKeyword: 'Step',
        hasDocString: false,
        hasDataTable: false
      });

      stepResult = createSpyWithStubs("stepResult", {
        isSuccessful: undefined,
        isPending:    undefined,
        isFailed:     undefined,
        isSkipped:    undefined,
        isUndefined:  undefined,
        getFailureException: false,
        getDuration:  undefined,
        getStep:      step
      });

      stepResult.isPending.andReturn(true);
      fakeEvent = createSpyWithStubs("event", {getPayloadItem: stepResult});

      listener.handleStepResultEvent(fakeEvent, callback);

      expect(formatter.step).toHaveBeenCalledWith({name: 'Step', line: 3, keyword: 'Step'});
      expect(formatter.result).toHaveBeenCalledWith({status: 'pending', error_message: undefined});
      expect(formatter.match).toHaveBeenCalledWith({location: undefined});
    });

    it("outputs a step with failed status where step fails", function (){
      step = createSpyWithStubs("step", {
        getName: 'Step',
        getLine: 3,
        getKeyword: 'Step',
        hasDocString: false,
        hasDataTable: false
      });

      stepResult = createSpyWithStubs("stepResult", {
        isSuccessful: undefined,
        isPending:    undefined,
        isFailed:     undefined,
        isSkipped:    undefined,
        isUndefined:  undefined,
        getFailureException: false,
        getDuration:  undefined,
        getStep:      step
      });

      stepResult.isFailed.andReturn(true);
      stepResult.getDuration.andReturn(1);
      fakeEvent = createSpyWithStubs("event", {getPayloadItem: stepResult});

      listener.handleStepResultEvent(fakeEvent, callback);

      expect(formatter.step).toHaveBeenCalledWith({name: 'Step', line: 3, keyword: 'Step'});
      expect(formatter.result).toHaveBeenCalledWith({status: 'failed', duration: 1});
      expect(formatter.match).toHaveBeenCalledWith({location: undefined});
    });

    it("outputs a step with skipped status where step should be skipped", function (){
      step = createSpyWithStubs("step", {
        getName: 'Step',
        getLine: 3,
        getKeyword: 'Step',
        hasDocString: false,
        hasDataTable: false
      });

      stepResult = createSpyWithStubs("stepResult", {
        isSuccessful: undefined,
        isPending:    undefined,
        isFailed:     undefined,
        isSkipped:    undefined,
        isUndefined:  undefined,
        getFailureException: false,
        getDuration:  undefined,
        getStep:      step
      });

      stepResult.isSkipped.andReturn(true);
      fakeEvent      = createSpyWithStubs("event", {getPayloadItem: stepResult});

      listener.handleStepResultEvent(fakeEvent, callback);

      expect(formatter.step).toHaveBeenCalledWith({name: 'Step', line: 3, keyword: 'Step'});
      expect(formatter.result).toHaveBeenCalledWith({status: 'skipped'});
      expect(formatter.match).toHaveBeenCalledWith({location: undefined});
    });

    it("outputs a step with undefined status where step is undefined", function (){
      step = createSpyWithStubs("step", {
        getName: 'Step',
        getLine: 3,
        getKeyword: 'Step',
        hasDocString: false,
        hasDataTable: false
      });

      stepResult = createSpyWithStubs("stepResult", {
        isSuccessful: undefined,
        isPending:    undefined,
        isFailed:     undefined,
        isSkipped:    undefined,
        isUndefined:  undefined,
        getFailureException: false,
        getDuration:  undefined,
        getStep:      step
      });

      stepResult.isUndefined.andReturn(true);
      fakeEvent      = createSpyWithStubs("event", {getPayloadItem: stepResult});

      listener.handleStepResultEvent(fakeEvent, callback);

      expect(formatter.step).toHaveBeenCalledWith({name: 'Step', line: 3, keyword: 'Step'});
      expect(formatter.result).toHaveBeenCalledWith({status: 'undefined'});
      expect(formatter.match).toHaveBeenCalledWith({location: undefined});
    });
  });

  describe("handleAfterFeaturesEvent()", function () {
    var features, callback;

    beforeEach(function () {
      event    = createSpy("Event");
      callback = createSpy("Callback");
    });

    it("finalises output", function () {
      listener.handleAfterFeaturesEvent(event, callback);
      expect(formatter.eof).toHaveBeenCalled();
      expect(formatter.done).toHaveBeenCalled();
    });

    it("calls back", function () {
      listener.handleAfterFeaturesEvent(event, callback);
      expect(callback).toHaveBeenCalled();
    });
  });
});


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FlatRedBall.Glue.CreatedClass;
using FlatRedBall.Glue.MVVM;
using FlatRedBall.Glue.SaveClasses;

namespace FlatRedBall.Glue.ViewModels
{
    public class CustomClassViewModel : ViewModel
    {
        public void HandleUseThisClassClick(CustomClassSave classToUse)
        {
            ReferencedFileSave currentReferencedFile = EditorLogic.CurrentReferencedFile;

            if (EditorLogic.CurrentReferencedFile != null)
            {
                if (classToUse != null)
                {
                    CustomClassController.Self.SetCsvRfsToUseCustomClass(currentReferencedFile, classToUse, force:false);
                }

            }
        }

    }
}

redpajama_set_name: RedPajamaGithub


text:
module GeoWorks
  module Processors
    module Gdal
      extend ActiveSupport::Concern

      included do
        # Executes a gdal_translate command. Used to translate a raster
        # format into a different format. Also used in generating thumbnails
        # from vector data.
        # @param in_path [String] file input path
        # @param out_path [String] processor output file path
        # @param options [Hash] creation options
        def self.translate(in_path, out_path, _options)
          execute "gdal_translate -q -ot Byte -of GTiff \"#{in_path}\" #{out_path}"
        end

        # Executes a gdalwarp command. Used to transform a raster
        # from one projection into another.
        # @param in_path [String] file input path
        # @param out_path [String] processor output file path
        # @param options [Hash] creation options
        def self.warp(in_path, out_path, options)
          execute "gdalwarp -q -r bilinear -t_srs #{options[:output_srid]} "\
                  "#{in_path} #{out_path} -co 'COMPRESS=NONE'"
        end

        # Executes a gdal_translate command. Used to compress
        # a previously uncompressed raster.
        # @param in_path [String] file input path
        # @param out_path [String] processor output file path
        # @param options [Hash] creation options
        def self.compress(in_path, out_path, options)
          execute "gdal_translate -q -ot Byte -a_srs #{options[:output_srid]} "\
                    "#{in_path} #{out_path} -co 'COMPRESS=LZW'"
        end

        # Executes a gdal_rasterize command. Used to rasterize vector
        # format into raster format.
        # @param in_path [String] file input path
        # #param options [Hash] creation options
        # @param out_path [String] processor output file path
        def self.rasterize(in_path, out_path, options)
          execute "gdal_rasterize -q -burn 0 -init 255 -ot Byte -ts "\
                    "#{options[:output_size]} -of GTiff #{in_path} #{out_path}"
        end
      end
    end
  end
end


text:
set -o posix

function attention_echo {
	echo -e "\n******************************************"
	echo -e "*\t$1 *"
	echo -e "******************************************\n"
}

# Default project name (no spaces)
NAME_PROJECT="Default_Project_Name"
# If there is a T_NAME_PROJECT, assign it to NAME_PROJECT
if [ ! -z $T_NAME_PROJECT ]
then
	NAME_PROJECT=${T_NAME_PROJECT}
else
	attention_echo "No T_NAME_PROJECT set"
fi

# Target names
TARGET_PROJECT=${NAME_PROJECT}_exec
TARGET_GTEST=${NAME_PROJECT}_GTest

# Doxygen files directory name
DIRNAME_DOXYGEN=html

# Some directories
DIR_PROJECT_ROOT=$(dirname "$(readlink -f $0)")
DIR_PROJECT_ROOT=$(echo "$DIR_PROJECT_ROOT" | sed 's/\/utils\/travis//g')
DIR_BUILD=${DIR_PROJECT_ROOT}/build
DIR_SRC=${DIR_PROJECT_ROOT}/src
DIR_BUILD_SRC=${DIR_BUILD}/src
DIR_BUILD_TEST=${DIR_BUILD}/test
DIR_REPORTS=${DIR_BUILD}/reports
DIR_REPORTS_CPPLINT=${DIR_REPORTS}/cpplint-reports
DIR_REPORTS_CPPCHECK=${DIR_REPORTS}/cppcheck-reports
DIR_REPORTS_GCOVR=${DIR_REPORTS}/gcovr-reports
DIR_GCOVR_FILES=${DIR_BUILD_SRC}/CMakeFiles
DIR_UTILS=${DIR_PROJECT_ROOT}/utils
DIR_DOXYGEN=${DIR_BUILD}/${DIRNAME_DOXYGEN}
DIR_TMP_GHPAGES=${DIR_PROJECT_ROOT}/push_to_ghpages

# CPack packaged project
FILES_CPACK=${DIR_BUILD}/${NAME_PROJECT}*.zip

function success_exit {
	attention_echo "Finished build script"
	exit 0
}

function publish_to_gh_pages {
	attention_echo "Publish function start"

	pushd ${DIR_PROJECT_ROOT}

	mkdir -p ${DIR_TMP_GHPAGES}
	cp -Rf ${DIR_DOXYGEN} ${DIR_TMP_GHPAGES} || exit $?
	cp -Rf ${DIR_REPORTS} ${DIR_TMP_GHPAGES} || exit $?
	cp -f  ${FILES_CPACK} ${DIR_TMP_GHPAGES} || exit $?

	pushd ${DIR_TMP_GHPAGES}

	mv ${DIRNAME_DOXYGEN}/ doxygen/

	git config --global user.email "travis@travis-ci.org"
	git config --global user.name "Travis-CI"

	git clone --quiet --branch=gh-pages https://${GH_TOKEN}@${GH_REF} gh-pages > /dev/null 2>&1 # Muted for security (personal access token)

	cd gh-pages/
	git rm -rf ./doxygen/
	git rm -rf ./reports/
	git rm -rf ./cpack/
	mkdir cpack || exit $?
	cd ..
	mv doxygen/ gh-pages/
	mv reports/ gh-pages/
	mv ${FILES_CPACK} gh-pages/cpack/
	cd gh-pages/

	git add --all
	git commit -m "Latest documentation and reports. Auto-pushed from travis. Build $TRAVIS_BUILD_NUMBER"

	git remote rm origin
	git remote add origin https://${GH_USR}:${GH_TOKEN}@${GH_REF} > /dev/null 2>&1 # Muted for security (personal access token)

	git push -fq origin gh-pages > /dev/null 2>&1 # Muted for security (personal access token)
	popd
}

function do_cppcheck {
	attention_echo "cppcheck"

	mkdir -p ${DIR_REPORTS_CPPCHECK} || exit $?

	# Generate cppcheck xml
	cppcheck -v --enable=all ${DIR_SRC} -I${DIR_SRC} --xml-version=2 2> cppcheck-only-result.xml

	# Generate html from it
	${DIR_UTILS}/cppcheck-htmlreport.py\
		--file=cppcheck-only-result.xml\
		--report-dir=${DIR_REPORTS_CPPCHECK}\
		--source-dir=${DIR_PROJECT_ROOT}\
		--title=${NAME_PROJECT}
}

function do_cpplint {
	attention_echo "cpplint.py"

	mkdir -p ${DIR_REPORTS_CPPLINT} || exit $?

	# Generate cppcheck-style xml from cpplint output
	${DIR_UTILS}/cpplint.py --linelength=95 --extensions=h,cpp --verbose=0\
		--filter=-whitespace/blank_line,-whitespace/tab,-whitespace/comments,-whitespace/newline,-whitespace/braces,-legal,-readability/braces,-readability/multiline_comment,-build/header_guard\
		${DIR_SRC}/*.* 2>&1|\
		sed 's/"/\"/g' >&1| sed 's/</\</g' >&1| sed 's/>/\>/g' >&1|\
		sed "s/'/\'/g" >&1| sed 's/\&/\&/g' >&1|\
		${DIR_UTILS}/cpplint_to_cppcheckxml.py &> cpplint-cppcheck-result.xml

	# Generate html from it
	${DIR_UTILS}/cppcheck-htmlreport.py\
		--file=cpplint-cppcheck-result.xml\
		--report-dir=${DIR_REPORTS_CPPLINT}\
		--source-dir=${DIR_PROJECT_ROOT}\
		--title=${NAME_PROJECT}

	# Change Cppcheck things to cpplint
	sed -i 's/Cppcheck/cpplint/g' ${DIR_REPORTS_CPPLINT}/index.html
	sed -i 's/a\ tool\ for\ static\ C\/C++\ code\ analysis/an\ open\ source\ lint\-like\ tool\ from\ Google/g' ${DIR_REPORTS_CPPLINT}/index.html
	sed -i 's/http:\/\/cppcheck.sourceforge.net/http:\/\/google\-styleguide.googlecode.com\/svn\/trunk\/cpplint\/cpplint.py/g' ${DIR_REPORTS_CPPLINT}/index.html
	sed -i 's/IRC: <a href=\"irc:\/\/irc.freenode.net\/cppcheck\">irc:\/\/irc.freenode.net\/cppcheck<\/a>/\ /g' ${DIR_REPORTS_CPPLINT}/index.html
}

function do_valgrind {
	attention_echo "Valgrind"

	# Valgrind report
	SDL_AUDIODRIVER=dummy SDL_VIDEODRIVER=dummy valgrind\
		--xml=yes --xml-file=${DIR_REPORTS}/valgrind-exec-report.xml\
		--leak-check=full\
		--track-origins=yes\
		${DIR_PROJECT_ROOT}/${TARGET_PROJECT}

	# Test report
	${DIR_BUILD_TEST}/${TARGET_GTEST} --gtest_output=xml:${DIR_REPORTS}/gtest-report.xml
}

function do_gcovr {
	attention_echo "gcovr"

	mkdir -p ${DIR_REPORTS_GCOVR} || exit $?

	gcovr --verbose\
		--root=${DIR_GCOVR_FILES}\
		--filter=${DIR_SRC}/\
		--html --html-details --output=${DIR_REPORTS_GCOVR}/index.html
}

function code_analysis {
	do_cppcheck
	do_cpplint
	do_valgrind
	do_gcovr
}

#########################################
################ "Main" #################
#########################################

attention_echo "after_success : ${NAME_PROJECT}"

# If there is no build directory, exit
if [ ! -d "$DIR_BUILD" ]
then
	attention_echo "No build directory! Exiting..."
	exit 3
fi

pushd ${DIR_BUILD}

code_analysis

attention_echo "Packing with CPack"

cpack
popd

# If the first argument is what we want
if [ ! -z $T_DO_PUBLISH_GH_COV ] && [ "$T_DO_PUBLISH_GH_COV" == "Yes" ]
then
	attention_echo "cpp-coveralls"

	# Publish to Coveralls
	coveralls --verbose\
		--root ${DIR_PROJECT_ROOT} -E ".*externals*" -E ".*CMakeFiles.*" -E ".*test/.*.cpp.*"

	# Publish Doxygen to gh-pages
	publish_to_gh_pages

# If no argument specified to publish
else
	attention_echo "Not publishing Doxygen/Coveralls"
fi


text:
{-# language CPP #-}
-- | = Name
--
-- XR_OCULUS_android_session_state_enable - instance extension
--
-- = Specification
--
-- See
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_OCULUS_android_session_state_enable  XR_OCULUS_android_session_state_enable>
-- in the main specification for complete information.
--
-- = Registered Extension Number
--
-- 45
--
-- = Revision
--
-- 1
--
-- = Extension and Version Dependencies
--
-- -   Requires OpenXR 1.0
--
-- = See Also
--
-- No cross-references are available
--
-- = Document Notes
--
-- For more information, see the
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_OCULUS_android_session_state_enable OpenXR Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module OpenXR.Extensions.XR_OCULUS_android_session_state_enable  ( OCULUS_android_session_state_enable_SPEC_VERSION
                                                                 , pattern OCULUS_android_session_state_enable_SPEC_VERSION
                                                                 , OCULUS_ANDROID_SESSION_STATE_ENABLE_EXTENSION_NAME
                                                                 , pattern OCULUS_ANDROID_SESSION_STATE_ENABLE_EXTENSION_NAME
                                                                 ) where

import Data.String (IsString)

type OCULUS_android_session_state_enable_SPEC_VERSION = 1

-- No documentation found for TopLevel "XR_OCULUS_android_session_state_enable_SPEC_VERSION"
pattern OCULUS_android_session_state_enable_SPEC_VERSION :: forall a . Integral a => a
pattern OCULUS_android_session_state_enable_SPEC_VERSION = 1

type OCULUS_ANDROID_SESSION_STATE_ENABLE_EXTENSION_NAME = "XR_OCULUS_android_session_state_enable"

-- No documentation found for TopLevel "XR_OCULUS_ANDROID_SESSION_STATE_ENABLE_EXTENSION_NAME"
pattern OCULUS_ANDROID_SESSION_STATE_ENABLE_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern OCULUS_ANDROID_SESSION_STATE_ENABLE_EXTENSION_NAME = "XR_OCULUS_android_session_state_enable"


text:
CREATE TABLE IF NOT EXISTS `ci_sessions` (
        `id` varchar(128) NOT NULL,
        `ip_address` varchar(45) NOT NULL,
        `timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
        `data` blob NOT NULL,
        KEY `ci_sessions_timestamp` (`timestamp`)
);

CREATE TABLE IF NOT EXISTS `user_login` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_name` varchar(255) NOT NULL,
  `user_email` varchar(255) NOT NULL,
  `user_password` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `statistical` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `begin` datetime DEFAULT NOW(),
  `end` datetime NULL,
  `user_agent` varchar(255) NOT NULL,
  `user_ip` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `category` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `date` datetime DEFAULT NOW(),
  PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `opportunities` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category_id` int(11) NOT NULL,
  `company` varchar(255) NOT NULL,
  `adress` varchar(255) NOT NULL,
  `city` varchar(255) NOT NULL,
  `postal_code` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `contact` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `opportunitie_id` int(11) NOT NULL,
  `type_contact_id` int(11) NOT NULL,
  `date` datetime NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `type_contact` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
);

TRUNCATE TABLE `type_contact`;

INSERT INTO `type_contact` (`id`, `name`) VALUES (1, 'post');
INSERT INTO `type_contact` (`id`, `name`) VALUES (2, 'email');
INSERT INTO `type_contact` (`id`, `name`) VALUES (3, 'phone');
INSERT INTO `type_contact` (`id`, `name`) VALUES (4, 'phone_relaunch');
INSERT INTO `type_contact` (`id`, `name`) VALUES (5, 'interview');


text: wegen Performance und hohem Aufwand, sämtliche Operatoren zu überladen


text:
class ListStyleAdminMixin(object):
    def get_row_css(self, obj, index):
        return ''


text:
<?php
namespace Fluent;

class Api
{
    protected $_curl;

    protected $_key;

    protected $_secret;

    protected $_endpoint;

    protected $_debug = false;

    const ENDPOINT = 'https://fluent.5sq.io/service/v3';

    public function __construct($key, $secret, $endpoint = null, $debug = false)
    {
        $this->_curl = curl_init();
        $this->_key = $key;
        $this->_secret = $secret;
        $this->_endpoint = $endpoint;
        $this->_debug = $debug;
    }

    public function getEndpoint()
    {
        if ($this->_endpoint !== null) {
            return $this->_endpoint;
        }

        return self::ENDPOINT;
    }

    public function isDebugOn()
    {
        return ($this->_debug === true);
    }

    public function call($resource, $method, $params)
    {
        $payload = http_build_query($params);

        $url = $this->getEndpoint() . '/' . $resource;

        curl_setopt($this->_curl, CURLOPT_VERBOSE, $this->isDebugOn());
        curl_setopt($this->_curl, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($this->_curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($this->_curl, CURLOPT_USERPWD, $this->_key . ':' . $this->_secret);
        curl_setopt($this->_curl, CURLOPT_USERAGENT, 'Fluent-Library-PHP-v3.3');

        switch ($method) {
            case 'create':
                curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $payload);
                curl_setopt($this->_curl, CURLOPT_POST, true);
                break;
            case 'get':
                $url .= '/' . $params['id'];
                break;
            case 'index':
                $url .= ($payload) ? '?' . $payload : null;
                break;
            default:
                if (!array_key_exists('id', $params)) {
                    throw new Exception('id missing from REST RPC call');
                }
                $url .= '/' . $params['id'] . '/' . $method;
                break;
        }

        curl_setopt($this->_curl, CURLOPT_URL, $url);

        $start = microtime(true);
        $this->_log('Call to ' . $url . ': ' . $payload);
        if ($this->isDebugOn()) {
            $curl_buffer = fopen('php://memory', 'w+');
            curl_setopt($this->_curl, CURLOPT_STDERR, $curl_buffer);
        }

        $response_body = curl_exec($this->_curl);
        $info = curl_getinfo($this->_curl);
        $time = microtime(true) - $start;
        if ($this->isDebugOn()) {
            rewind($curl_buffer);
            $this->_log(stream_get_contents($curl_buffer));
            fclose($curl_buffer);
        }

        $this->_log('Completed in ' . number_format($time * 1000, 2) . 'ms');
        $this->_log('Got response: ' . $response_body);

        if(curl_error($this->_curl)) {
            throw new \Fluent\Exception("API call to " . $url . " failed: " . curl_error($this->_curl));
        }

        $result = json_decode($response_body);

        if ($result === null) {
            throw new \Fluent\Exception('We were unable to decode the JSON response from the Fluent API: ' . $response_body);
        }

        if (floor($info['http_code'] / 100) >= 4) {
            throw new \Fluent\Exception("{$info['http_code']}, " . $result->message);
        }

        return $result;
    }

    protected function _log($msg) {
        if ($this->isDebugOn()) {
            error_log($msg);
        }
    }
}


text:
export default {
	state: {
		temperature: 0,
		humidity: 0,

		lastUpdated: ''
	},
	mutations: {
		setWeather: (state, payload) => {
			state.temperature = payload.temperature;
			state.humidity = payload.humidity;
			state.lastUpdated = payload.lastUpdated;
		}
	},
	getters: {
		getWeather: (state) => {
			return {
				temperature: state.temperature,
				humidity: state.humidity,

				lastUpdated: state.lastUpdated
			};
		}
	}
};


text:
<?php
	Assets::add_css( array(
		css_path() . 'bootstrap.min.css',
		css_path() . 'bootstrap-responsive.min.css',
		Template::theme_url('css/jquery/ui-lightness/jquery-ui.css'),
	));

	Assets::add_js( array(
		js_path() . 'bootstrap.min.js',
		Template::theme_url('js/jquery/jquery.plugin.livequery.js'),
		Template::theme_url('js/jquery-ui-1.8.13.min.js'),
	));

?><!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!-- Always force latest IE rendering engine & Chrome Frame -->
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

	<title><?php echo isset($toolbar_title) ? $toolbar_title : ''; ?></title>

	<script type="text/javascript">
		var BASE_URL							= '<?php echo base_url(); ?>';
		var SITE_URL							= '<?php echo site_url(); ?>';
		var SITE_AREA							= '<?php echo SITE_AREA; ?>';
	</script>

	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
	<script>window.jQuery || document.write('<script src="<?php echo js_path(); ?>jquery-1.7.1.min.js"><\/script>')</script>

	<?php echo Assets::js(); ?>
	<?php // echo $template['metadata']; ?>

	<script type="text/javascript">

		//var CKEDITOR = window.parent.CKEDITOR;

		function windowClose()
		{
			//CKEDITOR.dialog.getCurrent().hide();
		}

		function insertHTML(html)
		{

			//window.parent.admin.insertHtml(html);
		}

		(function($)
		{

		 //

		})(jQuery);
	</script>
	<?php echo Assets::css(null, true); ?>
	<style type="text/css">
		body{padding:0px}
	</style>
</head>
<body>
	<?php
		echo Template::message();
		echo Template::yield();
	?>
</body>
</html>


text:
package net.sf.gaboto.node;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

import net.sf.gaboto.Gaboto;
import net.sf.gaboto.GabotoRuntimeException;
import net.sf.gaboto.GabotoSnapshot;
import net.sf.gaboto.node.annotation.SimpleLiteralProperty;
import net.sf.gaboto.node.annotation.SimpleURIProperty;
import net.sf.gaboto.node.pool.EntityExistsCallback;
import net.sf.gaboto.node.pool.EntityPool;
import net.sf.gaboto.node.pool.PassiveEntitiesRequest;
import net.sf.gaboto.time.TimeSpan;
import net.sf.gaboto.vocabulary.OxPointsVocab;

import org.apache.log4j.Logger;

import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.graph.Triple;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;

/**
 * Every defined class in the Gaboto ontology needs a representation in java (a subclass of GabotoEntity).
 *
 *
About GabotoEntities

 *
 *

 * OxPointEntities represent a defined class from the Gaboto ontology at a given point in time. That is, it
 * contains all the attribute values that this object had at a specified time. A representation of a Gaboto
 * object throughout its lifespan can be generated using the {@link GabotoTimeBasedEntity} class.
 *

 *
 *

 * Adding new classes to the Gaboto ontology might happen frequently so a GabotoEntity is
 * a JavaBean (see Wikipedia entry).
 * The generation of an entity object from
 * RDF or the creation of RDF from an entity object is  handled by the Gaboto system
 * using Java's reflection API.
 * In order to be able to achieve this a set of annotations has been defined that have to be used
 * to mark up the various get and set methods.
 *

 *
 *

 * For implementation details on how this dynamic loading of entities and their serialization to RDF
 * is done have a look at the methods {@link #loadFromSnapshot(Resource, GabotoSnapshot, EntityPool)},
 * {@link #getTriplesFor()}.
 *

 *
 *
Creating new GabotoEntities

 *
 *

 * The first step when adding a new entity to the system is to adjust Gaboto' ontology and
 * add the corresponding owl:class. For example add the following:
 *
 *  <owl:Class rdf:ID="ComputerMonitor"/>
 *
 * Next we regenerate the {@link OxPointsVocab} helper class by running the ant script (build.xml target: schemas).
 *

 *
 *

 * Now we can start writing the new {@link GabotoEntity}. We create a new class with
 * the same name as our ontology class and make it a subclass of {@link GabotoEntity}. We have
 * to override the getType method to return the correct ontology class. The basic skeleton would
 * look like this:
 *

 * public class ComputerMonitor extends GabotoEntity {
 *	   @Override
 *     public String getType(){
 *		   return OxPointsVocab.ComputerMonitor_URI;
 *	   }
 * }
 *

 *

 *
 *

 * Next we have to create a field for each bit of information that we want to store. Let's say we
 * want to store a name, the size and the monitors place. We simply add these to our class and create
 * a get and set method for each of them:
 *
 *

 * public class ComputerMonitor extends GabotoEntity {
 *
 *     private String name;
 *     private int size;
 *     private Place place;
 *
 *     @Override
 *     public String getType(){
 *		   return OxPointsVocab.ComputerMonitor_URI;
 *	   }
 *
 *     public void setName(String name){
 *         this.name = name;
 *     }
 *     public String getName(){
 *         return this.name;
 *     }
 *
 *     public void setSize(int size){
 *         this.size = size;
 *     }
 *     public int getSize(){
 *         return this.size;
 *     }
 *
 *     public void setPlace(Place place){
 *         this.place = place;
 *     }
 *     public Place getPlace(){
 *         return this.place;
 *     }
 * }
 *

 *
 *

 *
 *

 * As a last step we have to give Gaboto some clues as to what the methods should be used
 * for. This is done using predefined Annotations.
 *

 *
 *
Adding annotations to guide dynamic generation and serialisation

 *
 *

 * In order to automatically create RDF from entities or load entities from RDF Gaboto relies
 * upon clues in form of predefined annotations (we call them PropertyAnnotation). All PropertyAnnotations
 * are defined in the package org.oucs.gaboto.entities.utils. For our ComputerMonitor
 * example we need the two annotations {@link SimpleLiteralProperty} and {@link SimpleURIProperty}.
 * These tell Gaboto that the marked up method returns or stores either a literal ({@link SimpleLiteralProperty})
 * or an GabotoEntity ({@link SimpleURIProperty}).
 *

 *
 *

 * Additionally all PropertyAnnotations get the RDF Property the information corresponds to
 * as a parameter.
 *
 *
 *

 * public class ComputerMonitor extends GabotoEntity {
 *
 *     private String name;
 *     private int size;
 *     private Place place;
 *
 *     @Override
 *     public String getType(){
 *		   return OxPointsVocab.ComputerMonitor_URI;
 *	   }
 *
 *     @SimpleLiteralProperty(DC.title)
 *     public void setName(String name){
 *         this.name = name;
 *     }
 *     @SimpleLiteralProperty(DC.title)
 *     public String getName(){
 *         return this.name;
 *     }
 *
 *     @SimpleLiteralProperty(SomeVocab.hasSize)
 *     public void setSize(int size){
 *         this.size = size;
 *     }
 *     @SimpleLiteralProperty(SomeVocab.hasSize)
 *     public int getSize(){
 *         return this.size;
 *     }
 *
 *     @SimpleURIProperty(OxPointsVocab.hasParent)
 *     public void setPlace(Place place){
 *         this.place = place;
 *     }
 *     @SimpleURIProperty(OxPointsVocab.hasParent)
 *     public Place getPlace(){
 *         return this.place;
 *     }
 * }
 *

 *
 *

 *
 *
Adding annotations to guide the transformation to various output formats

 *
 *

 * The transformation of {@link GabotoEntity}s is also guided through annotations (TransformationAnnotation).
 * There are two TransformationAnnotaions: {@link TransformationProperty} and {@link TransformationIndirectProperty}.
 * The {@link TransformationProperty} annotation tells the transformer that the annotated method returns the object
 * it is looking for for the supplied RDF Property. The {@link TransformationIndirectProperty} annotation on the other
 * hand tells the transformer that the method's return value is an GabotoEntity and that it should look for the
 * object it is looking for (defined by the RDF property) there.
 *

 *
 *

 * In this case we want to mark up the getName method with {@link TransformationProperty} and for the monitor's location
 * we tell the transformer to look at the Place object using the {@link TransformationIndirectProperty} annotation.
 *
 *
 *

 * public class ComputerMonitor extends GabotoEntity {
 *
 *     private String name;
 *     private int size;
 *     private Place place;
 *
 *     @Override
 *     public String getType(){
 *		   return OxPointsVocab.ComputerMonitor_URI;
 *	   }
 *
 *
 *     @SimpleLiteralProperty(DC.title)
 *     public void setName(String name){
 *         this.name = name;
 *     }
 *     @TransformationProperty(DC.title)
 *     @SimpleLiteralProperty(DC.title)
 *     public String getName(){
 *         return this.name;
 *     }
 *
 *     @SimpleLiteralProperty(SomeVocab.hasSize)
 *     public void setSize(int size){
 *         this.size = size;
 *     }
 *     @SimpleLiteralProperty(SomeVocab.hasSize)
 *     public int getSize(){
 *         return this.size;
 *     }
 *
 *     @SimpleURIProperty(OxPointsVocab.hasParent)
 *     public void setPlace(Place place){
 *         this.place = place;
 *     }
 *     @TransformationIndirectProperty(OxPointsVocab.hasLocation)
 *     @SimpleURIProperty(OxPointsVocab.hasParent)
 *     public Place getPlace(){
 *         return this.place;
 *     }
 * }
 *

 *
 *

 *
 *
 * @author Arno Mittelbach
 * @version 0.1
 *
 * @see GabotoTimeBasedEntity
 * @see EntityPool
 */
abstract public class GabotoEntity implements RDFTyped {

	private static Logger logger = Logger.getLogger(GabotoEntity.class.getName());

	/**
	 * Stores the timespan in which this entity is valid. If it is null, then the entity is valid indefinitely.
	 */
	private TimeSpan timespan = TimeSpan.EXISTENCE;

	/**
	 * stores the entity's URI.
	 */
	private String uri;

	/**
	 * Stores the pool, this entity was created from
	 */
	private EntityPool createFromPool = null;

	/**
	 * Tells whether or not passive entities were loaded
	 */
	private boolean passiveEntitiesLoaded = false;

	/**
	 *
	 */
	protected Map<String, Resource> missingEntityReferences = new HashMap<String, Resource>();
	protected Map<String, Collection<EntityExistsCallback>> missingEntityReferenceCallbacks = new HashMap<String, Collection<EntityExistsCallback>>();

	/**
	 * Instantiate the GabotoEntity.
	 *
	 *

	 * OxPointsEntities should always use the default constructor and provide
	 * methods for all their fields in order for Gaboto to be able to automatically
	 * load and serialize them.
	 *

	 */
	public GabotoEntity(){

	}

	final static public <T extends GabotoEntity> T createNew(Gaboto gaboto, T newEntity){
		newEntity.setUri(gaboto.generateIdUri());
		return newEntity;
	}

	final public void setCreatedFromPool(EntityPool pool){
		this.createFromPool = pool;
	}

	final protected void addMissingReference(Resource res, EntityExistsCallback callback){
		missingEntityReferences.put(res.getURI(), res);
		if(! missingEntityReferenceCallbacks.containsKey(res.getURI())){
			missingEntityReferenceCallbacks.put(res.getURI(), new HashSet<EntityExistsCallback>());
		}
		missingEntityReferenceCallbacks.get(res.getURI()).add(callback);
	}

	final protected void removeMissingReference(String uriToRemove){
		missingEntityReferences.remove(uriToRemove);
	}

	/**
	 * Returns the entity's URI.
	 *
	 * @see #setUri(String)
	 * @return the entity's URI.
	 */
	final public String getUri() {
		return uri;
	}

	/**
	 * Sets the entity's URI.
	 *
	 * @see #getUri()
	 * @param uri this entity's new URI.
	 */
	final public void setUri(String uri) {
		this.uri = uri;
	}

	/**
	 * Stores the lifespan of this GabotoEntity.
	 *
	 *

	 * The lifespan does not necessary correspond to when the entity came into
	 * being and was destroyed. It is the span in which the entity is valid in the
	 * form at it is represented by this object.
	 *

	 *
	 * @see #getTimeSpan()
	 *
	 * @param ts The lifespan
	 */
	final public void setTimeSpan(TimeSpan ts){
		if(ts == null)
			this.timespan = TimeSpan.EXISTENCE;
		else
			this.timespan = ts.canonicalize();
	}

	/**
	 * Returns the entity's lifespan.
	 *
	 * @see #setTimeSpan(TimeSpan)
	 * @return Returns the entity's lifespan.
	 */
	final public TimeSpan getTimeSpan(){
		return this.timespan;
	}

	/**
	 * Every entity has a defined type.
	 *
	 * @see OxPointsVocab
	 *
	 * @return The entity's type (ontology class).
	 */
	abstract public String getType();

	/**
   * @param propertyURI unused, overridden
   */
	protected List<Method> getIndirectMethodsForProperty(String propertyURI){
		return null;
	}

	/**
	 * Tells whether direct references have been resolved for this entity.
	 *
	 * @return true if direct references have been resolved.
	 */
	public boolean isDirectReferencesResolved() {
		return missingEntityReferences.isEmpty();
	}

	/**
	 * Tries to resolve the direct references from the entity's pool (the pool it was last added to).
	 */
	public void resolveDirectReferences() {
		resolveDirectReferences(createFromPool);
	}

	/**
	 * Tries to resolve the entity's direct references from the passed pool.
	 * @param pool The pool to load the direct references from.
	 */
	public void resolveDirectReferences(EntityPool pool)  {
		if(isDirectReferencesResolved())
			return;

		if(pool == null)
			throw new IllegalStateException("The GabotoEntity was not provided with a pool object to resolve its references from.");

		// add missing references
		pool.addMissingReferencesForEntity(missingEntityReferences.values(), missingEntityReferenceCallbacks);
	}

	/**
	 * Tells the entity that all passive properties were loaded.
	 */
	public void setPassiveEntitiesLoaded(){
		this.passiveEntitiesLoaded = true;
	}

	/**
	 *
	 * @return true if passive entities were loaded.
	 */
	public boolean isPassiveEntitiesLoaded(){
		return passiveEntitiesLoaded;
	}

	/**
	 * Tries to load passive entities from the entity's pool.
	 */
	public void loadPassiveEntities() {
		loadPassiveEntities(createFromPool);
	}

	/**
	 * Tries to load passive entities from the passed pool.
	 * @param pool The pool to load the passive entities from.
	 */
	public void loadPassiveEntities(EntityPool pool) {
		if(passiveEntitiesLoaded)
			return;

		if(pool == null)
			throw new IllegalStateException("The GabotoEntity was not provided with a pool object to load the passive properties from.");

		pool.addPassiveEntitiesFor(this);
	}

	/**
	 * Is called by subclasses to ask for passive entities that they claim belong to them.
	 *
	 * @return null
	 */
	public Collection<PassiveEntitiesRequest> getPassiveEntitiesRequest(){
		return null;
	}

	/**
	 * The entity adds itself to the supplied Jena Model.
	 *
	 * @param model the JenaModel
	 */
	public void addToModel(Model model) {
		Graph g = model.getGraph();
		List<Triple> triples = getTriplesFor();
		for(Triple t : triples)
			g.add(t);
	}

	/**
	 * Returns the value of a property via reflection (searching in direct and indirect properties, but not in passive properties)
	 *
	 * @param prop The property
	 * @return The property's value (or null).
	 */
	public Object getPropertyValue(Property prop){
		return getPropertyValue(prop.getURI(), false, true);
	}

	/**
	 * Returns the value of a property via reflection
	 *
	 * @param prop The property
	 * @param searchInPassiveProperties Search in passive properties
	 * @param searchInIndirectProperties Search in indirect properties
	 */
	public Object getPropertyValue(Property prop, boolean searchInPassiveProperties, boolean searchInIndirectProperties){
		return getPropertyValue(prop.getURI(), searchInPassiveProperties, searchInIndirectProperties);
	}

	/**
	 * Returns the value of a property via reflection (searching in direct and indirect properties, but not in passive properties)
	 *
	 * @param propURI The property's URI
	 */
	public Object getPropertyValue(String propURI){
		return getPropertyValue(propURI, false, true);
	}

	/**
	 * Returns the value of a property.
	 *
	 * @param propURI The property's URI.
	 * @param searchInPassiveProperties True to search in passive properties.
	 * @param searchInIndirectProperties True to search in indirect properties.
	 */
	@SuppressWarnings("unchecked")
  public Object getPropertyValue(String propURI, boolean searchInPassiveProperties, boolean searchInIndirectProperties){
		Method directMethod = GabotoEntityUtils.getGetMethodFor(this, propURI);

		if(directMethod != null){
			try {
				Object value = directMethod.invoke(this, (Object[])null);
				if(value != null)
					return value;
			} catch (Exception e) {
				throw new GabotoRuntimeException(e);
			}
		}

		// search in passive
		if(searchInPassiveProperties){
			Object value = getPassivePropertyValue(propURI);
			if(value != null)
				return value;
		}

		// search in indirect properties?
		if(! searchInIndirectProperties)
			return null;

		// look for indirect Method
		List<Method> indirectMethods = getIndirectMethodsForProperty(propURI);
		if(indirectMethods == null)
			return null;

		for(Method indirectMethod : indirectMethods){
			try {
				Object obj = indirectMethod.invoke(this, (Object[])null);
				if(obj != null){
					if(! (obj instanceof GabotoEntity) && !(obj instanceof Collection))
						throw new IllegalAnnotationException(getClass());

					if(obj instanceof GabotoEntity){
						// cast
						GabotoEntity entity = (GabotoEntity) obj;

						// try to find answer at entity
						Object value = entity.getPropertyValue(propURI, searchInPassiveProperties, searchInIndirectProperties);
						if(value != null)
							return value;
					} else if(obj instanceof Collection){
						// try to cast
						try{
							Collection<GabotoEntity> entityCollection = (Collection<GabotoEntity>) obj;
							for(GabotoEntity entityInCollection : entityCollection){
								// try to find answer at entity
								Object value = entityInCollection.getPropertyValue(propURI, searchInPassiveProperties, searchInIndirectProperties);
								if(null != value)
									return value;
							}
						} catch(ClassCastException e){
							IllegalAnnotationException iae = new IllegalAnnotationException(getClass());
							iae.initCause(e);
							throw iae;
						}
					}

				}
      } catch (Exception e) {
        throw new GabotoRuntimeException(e);
      }
		}

		return null;
	}

	/**
	 * Returns the value of a passive property.
	 * @param prop The passive property.
	 * @return The property's value
	 */
	public Object getPassivePropertyValue(Property prop){
		return getPassivePropertyValue(prop.getURI());
	}

	/**
	 * Returns the value of a passive property.
	 * @param propURI The URI of the passive property.
	 * @return The property's value
	 */
	public Object getPassivePropertyValue(String propURI){
		Method m = GabotoEntityUtils.getPassiveGetMethodFor(this.getClass(), propURI);
		if(m != null){
			try {
				//System.err.println("For class " + this.getClass() +
				//        " found passive method " + m.getName() + ":" + m.invoke(this, (Object[])null));
				return m.invoke(this, (Object[])null);
			} catch (InvocationTargetException e) {
				throw new GabotoRuntimeException(e.getCause());
			} catch (Exception e) {
				throw new GabotoRuntimeException(e);
			}
		}

		return null;
	}

	/**
	 * Creates a map with all properties: direct (including static and unstored), indirect and passive
	 */
	public Map<String, Object> getAllProperties(){
		Map<String, Object> properties = getAllDirectProperties();
		properties.putAll(getAllPassiveProperties());
		properties.putAll(getAllIndirectProperties());

		return properties;
	}

	/**
	 * Creates a map with property value pairs for all direct properties (including static and unstored).
	 * @return a map with property value pairs
	 */
	public Map<String, Object> getAllDirectProperties(){
		Map<String, Object> properties = new HashMap<String, Object>();

		for(String prop : GabotoEntityUtils.getAllDirectProperties(this.getClass())){
			properties.put(prop, getPropertyValue(prop));
		}

		return properties;
	}

	/**
	 * Creates a map with property value pairs for all passive properties.
	 * @return a map with property value pairs.
	 */
	public Map<String, Object> getAllPassiveProperties(){
		Map<String, Object> properties = new HashMap<String, Object>();

		for(String prop : GabotoEntityUtils.getAllPassiveProperties(this.getClass())){
		  Object value = getPassivePropertyValue(prop);
			properties.put(prop, value);
			//System.err.println("Adding " + prop + " : (" + value.getClass() + ") " + value);
		}

		return properties;
	}

	/**
	 * Creates a map with property value pairs for all indirect properties.
	 * @return a map with property value pairs.
	 */
	public Map<String, Object> getAllIndirectProperties(){
		Map<String, Object> properties = new HashMap<String, Object>();

		for(String prop : GabotoEntityUtils.getAllIndirectProperties(this.getClass())){
			properties.put(prop, getPropertyValue(prop, false, true));
		}

		return properties;
	}

	/**
	 * Creates the java representation from an GabotoSnapshot and a resource object..
	 *
	 *

	 * The method uses reflection mechanisms to find appropriate setter methods.
	 *

	 *
	 * @param res An RDF Resource.
	 * @param snapshot The GabotoSnapshot containing all the data.
	 * @param pool The entity pool that is currently created (used for references to other entities).
	 *
	 */
	public void loadFromSnapshot(Resource res, GabotoSnapshot snapshot, EntityPool pool) {
		// set uri
		this.setUri(res.getURI());

		// log
		logger.debug("Load entity " + this.getUri() + " from Snapshot.");

		// try to set time span
		this.setTimeSpan(snapshot.getTimeSpanForEntity(res));

		// load entity
		//RDFContainerLoaderImpl.getInstance().loadFromSnapshot(this, res, snapshot, pool);
	}

	/**
	 * Creates a list of RDF triples that represent this {@link GabotoEntity}.
	 *
	 *

	 * Same as: entity.getTriplesFor(true);
	 *

	 *
	 * @see #getTriplesFor(boolean)
	 * @return a list of triples that represent this entity.
	 */
	public List<Triple> getTriplesFor() {
		return getTriplesFor(true);
	}

	/**
	 * Creates a list of RDF triples that represent this {@link GabotoEntity}.
	 *
	 * @param includeType Whether or not a triple denoting the entities type should be added to the list of triples.
	 *
	 * @return a list of triples that represent this entity.
	 *
	 */
	public List<Triple> getTriplesFor(boolean includeType) {
		// if no uri
		if(this.getUri() == null)
			throw new IllegalArgumentException("Entities need to have a defined uri");

		return RDFTypedTriplesListFactoryImpl.getInstance().getTriplesFor(this, Node.createURI(getUri()), includeType);
	}

	@Override
	public String toString(){
		TimeSpan ts = getTimeSpan();
		if(ts == null)
			ts = TimeSpan.EXISTENCE;

		return getUri() + " " + this.getClass().getSimpleName() + " : " + ts + "";
	}

	@Override
	public boolean equals(Object obj) {
		if(! (obj instanceof GabotoEntity))
			return false;

		GabotoEntity entity = (GabotoEntity) obj;

		if(getTimeSpan() != null && getUri() != null && entity.getTimeSpan() != null && entity.getUri() != null)
			return getTimeSpan().equals(entity.getTimeSpan()) && getUri().equals(entity.getUri()) && getClass().equals(entity.getClass());

		if(getUri() != null && entity.getUri() != null)
			return getUri().equals(entity.getUri()) && getClass().equals(entity.getClass());

		return super.equals(obj);
	}

	@Override
	public int hashCode(){
		return toString().hashCode();
	}
}


text:
package org.deuce.transaction.tl2cm.field;

import org.deuce.reflection.UnsafeHolder;
import org.deuce.transform.Exclude;

@Exclude
public class LongWriteFieldAccess extends WriteFieldAccess {

	private long value;

	public void set(long value, Object reference, long field) {
		super.init(reference, field);
		this.value = value;
	}

	@Override
	public void put() {
		UnsafeHolder.getUnsafe().putLong(reference, field, value);
		clear();
	}

	public long getValue() {
		return value;
	}

}


text:
  <link rel="stylesheet" href="assets/flowerpot.css">

Loading…

      Content note:

        Loading…

      <button class="button button-decode button-primary">Display Content</button>

Loading…


text:
package org.apache.flink.contrib.streaming.state;

import org.rocksdb.ColumnFamilyOptions;
import org.rocksdb.DBOptions;

/**
 * A factory for {@link DBOptions} to be passed to the {@link RocksDBStateBackend}.
 * Options have to be created lazily by this factory, because the {@code Options}
 * class is not serializable and holds pointers to native code.
 *
 *
A typical pattern to use this OptionsFactory is as follows:
 *
 *
Java 8:

 *
{@code
 * rocksDbBackend.setOptions( (currentOptions) -> currentOptions.setMaxOpenFiles(1024) );
 * }

 *
 *
Java 7:

 *
{@code
 * rocksDbBackend.setOptions(new OptionsFactory() {
 *
 *     public Options setOptions(Options currentOptions) {
 *         return currentOptions.setMaxOpenFiles(1024);
 *     }
 * })
 * }

 */
public interface OptionsFactory extends java.io.Serializable {

	/**
	 * This method should set the additional options on top of the current options object.
	 * The current options object may contain pre-defined options based on flags that have
	 * been configured on the state backend.
	 *
	 *
It is important to set the options on the current object and return the result from
	 * the setter methods, otherwise the pre-defined options may get lost.
	 *
	 * @param currentOptions The options object with the pre-defined options.
	 * @return The options object on which the additional options are set.
	 */
	DBOptions createDBOptions(DBOptions currentOptions);

	/**
	 * This method should set the additional options on top of the current options object.
	 * The current options object may contain pre-defined options based on flags that have
	 * been configured on the state backend.
	 *
	 *
It is important to set the options on the current object and return the result from
	 * the setter methods, otherwise the pre-defined options may get lost.
	 *
	 * @param currentOptions The options object with the pre-defined options.
	 * @return The options object on which the additional options are set.
	 */
	ColumnFamilyOptions createColumnOptions(ColumnFamilyOptions currentOptions);

}


text: from .b import v


text:
Thank you for considering contributing to Remote Retro. We're happy to have you!

### Types of contributions we're looking for

The best way to contribute is to take a look at our current backlog and work on a story that you're most excited about. Please take a look at the [Project Management](https://github.com/stride-nyc/remote_retro#project-management) section of our Readme for viewing the backlog. Bug fixes and documentation improvements are also welcome.

# Code of Conduct
Please read our [Code of Conduct](https://github.com/stride-nyc/remote_retro/blob/master/CODE_OF_CONDUCT.md) before contributing.

# First time contributing?
Unsure where to begin contributing to Remote Retro? You can start by looking through [issues](https://github.com/stride-nyc/remote_retro/issues) that have the "beginner-friendly" or "help wanted" label.

# Getting started
* Before you start coding, please see the [Dev Environment Setup](https://github.com/stride-nyc/remote_retro#dev-environment-setup) and [Tests](https://github.com/stride-nyc/remote_retro#tests) sections of the Readme for information about getting set up and running the tests.
* We require all contributors to sign a Contributor License Agreement before contributing. You will be prompted to electronically sign the individual CLA when you make a pull request.
  - The individual CLA can be viewed [here](https://gist.github.com/qlaire/cfcc3a2b9ab28f3c97716e4040afe578)
  - The corporate CLA can be viewed [here](https://gist.github.com/qlaire/c6b31ad2ba9489e75f6c810be466e7c6)
* Please see the [Project Management](https://github.com/stride-nyc/remote_retro#project-management) section to see how to view Remote Retro's current feature pipeline.

Once you're ready to start coding:

1. Create your own fork of the code
2. Make the necessary changes in your fork
3. If you like the change and think the project could use it:
    * Be sure you have followed the code style for the project.
    * Make a pull request, and be sure to fill out the information in the template.

# How to report a bug
### Security issues
If you find a security vulnerability, do NOT open an issue. Email cdranginis@stridenyc.com instead.

In order to determine whether you are dealing with a security issue, ask yourself these two questions:
* Can I access something that's not mine, or something I shouldn't have access to?
* Can I disable something for other people?

### For non-security issues
Please open an issue and use the template provided. Please add the "Bug" label.

# How to suggest a feature or enhancement
Before suggesting a feature, please read through the [Roadmap to MVP](https://github.com/stride-nyc/remote_retro#roadmap-to-mvp) and check the backlog to make sure that the story doesn't exist already. Once you're ready to suggest the feature or enhancement, open an issue and use the provided template. Please also add the "feature request" label.

# Code review process
After you submit your pull request, it will be reviewed within 10 business days and we will give you feedback on any needed changes. After feedback has been given we expect responses within two weeks. After two weeks we may close the pull request if it isn't showing any activity.

# Code Style
ESLint is used for checking JavaScript code style. It is also useful for avoiding some errors. Please use indentation of 2 spaces, and no semicolons. Please use ES2015 (ES6).


text:
PYTHON_INCLUDE=/usr/include/python3.4m
export PYTHON_INCLUDE

# the python version only 2 or 3 for now
PYTHON_VERSION=3
export PYTHON_VERSION

# we set the platform too
# this is the platform for buildenvironment,: linux, cygwin, mingw, ...
PYTHON_PLATFORM=linux
export PYTHON_PLATFORM

# we set the path to find the module for tests
PYTHONPATH=.:$(pwd)
export PYTHONPATH

# end of file


text:
SROOK_NESTED_NAMESPACE(srook, tuple, utility) {
SROOK_INLINE_NAMESPACE(v1)

namespace detail {

template <bool, class T>
struct wrap_tuple {
    SROOK_STATIC_ASSERT((type_traits::detail::Lnot<is_same<T, T>>::value), "never unreached here");
};

template <class T>
struct wrap_tuple<true, T>
    : srook::tmpl::vt::transfer<std::tuple, T> {};

template <class F>
struct argument_type
    : arguments_specialized<SROOK_DEDUCED_TYPENAME decay<F>::type, wrap_tuple> {};

template <class F>
struct result_type
    : derivation_invoke_result<SROOK_DEDUCED_TYPENAME decay<F>::type> {};

template <class F>
struct is_noexcept_type
    : srook::tmpl::vt::transfer<
        is_nothrow_invocable,
        SROOK_DEDUCED_TYPENAME srook::tmpl::vt::concat<
            SROOK_DEDUCED_TYPENAME decay<F>::type,
            SROOK_DEDUCED_TYPENAME arguments<SROOK_DEDUCED_TYPENAME decay<F>::type>::type
        >::type
    >::type {};

} // namespace detail
SROOK_INLINE_NAMESPACE_END
} SROOK_NESTED_NAMESPACE_END(utility, tuple, srook)
#endif
#endif


text:
import BufferedProxy from 'ember-buffered-proxy/proxy';
import Component from '@ember/component';
import UrlMatch from 'api-umbrella-admin-ui/models/api/url-match';
import { computed } from '@ember/object';
import { getOwner } from '@ember/application';

export default Component.extend({
  openModal: false,
  exampleSuffix: 'example.json?param=value',

  modalTitle: computed('model', function() {
    if(this.get('model.isNew')) {
      return 'Add Matching URL Prefix';
    } else {
      return 'Edit Matching URL Prefix';
    }
  }),

  bufferedModel: computed('model', function() {
    let owner = getOwner(this).ownerInjection();
    return BufferedProxy.extend(UrlMatch.validationClass).create(owner, { content: this.get('model') });
  }),

  exampleIncomingUrl: computed('bufferedModel.frontendPrefix', function() {
    let root = this.get('apiExampleIncomingUrlRoot') || '';
    let prefix = this.get('bufferedModel.frontendPrefix') || '';
    return root + prefix + this.get('exampleSuffix');
  }),

  exampleOutgoingUrl: computed('bufferedModel.{frontendPrefix,backendPrefix}', function() {
    let root = this.get('apiExampleOutgoingUrlRoot') || '';
    let prefix = this.get('bufferedModel.backendPrefix') || this.get('bufferedModel.frontendPrefix') || '';
    return root + prefix + this.get('exampleSuffix');
  }),

  actions: {
    submit() {
      this.get('bufferedModel').applyChanges();
      if(this.get('model.isNew')) {
        this.get('collection').pushObject(this.get('model'));
      }

      this.set('openModal', false);
    },

    closed() {
      this.get('bufferedModel').discardChanges();
      this.set('openModal', false);
    },
  },
});


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('exchange_portal', '0006_remove_travel_story_tags'),
    ]

    operations = [
        migrations.AlterField(
            model_name='travel_story',
            name='body',
            field=models.TextField(verbose_name='brödtext', help_text='Brödtext syns när en reseberättelse visas enskilt.'),
        ),
        migrations.AlterField(
            model_name='travel_story',
            name='headline',
            field=models.CharField(verbose_name='rubrik', max_length=255, help_text='Rubriken till reseberättelsen'),
        ),
        migrations.AlterField(
            model_name='travel_story',
            name='lead',
            field=models.TextField(verbose_name='ingress', help_text='Ingressen är den text som syns i reseberättelse.'),
        ),
    ]


text:
"use strict";

var os = require('os');
var cluster = require('cluster');
var debug = require('debug')('phantom-manager:integration');
var PhantomManager = require('../../index');

// Master
if (cluster.isMaster) {
    for (var i = 0; i < os.cpus().length; i++) {
        cluster.fork();
    }
    return;
} else if (cluster.isWorker) {
    // Fork
    var manager = new PhantomManager(function (error) {
        if(error) {
            manager.shutdown(function(err) {
                debug('manager terminated with ' + (err || 'no error'));
            });
        }
    }, {amount: 4});
}

setTimeout(function () {
    process.exit();
}, 10000);


text:
require 'nn'
require 'image'
require 'InstanceNormalization'
require 'src/utils'
require 'riseml'

local cmd = torch.CmdLine()

cmd:option('-image_size', 0, 'Resize input image to. Do not resize if 0.')
cmd:option('-model', '', 'Path to trained model.')
cmd:option('-cpu', false, 'use this flag to run on CPU')

local params = cmd:parse(arg)

-- Load model and set type
local model = torch.load(params.model)

if params.cpu then
  tp = 'torch.FloatTensor'
else
  require 'cutorch'
  require 'cunn'
  require 'cudnn'

  tp = 'torch.CudaTensor'
  model = cudnn.convert(model, cudnn)
end

model:type(tp)
model:evaluate()

local function run_image(img_data)
  -- Load image and scale
  local byte_tensor = torch.ByteTensor(torch.ByteStorage():string(img_data))
  local img = image.decompressJPG(byte_tensor, 3):float()

  if params.image_size > 0 then
    img = image.scale(img, params.image_size, params.image_size)
  end

  -- Stylize
  local input = img:add_dummy()
  local stylized = model:forward(input:type(tp)):double()
  stylized = deprocess(stylized[1])

  -- Return
  return image.compressJPG(torch.clamp(stylized,0,1)):storage():string()
end

riseml.serve(run_image)


text:
using System.Text.Json;
using Azure.Core;

namespace Azure.ResourceManager.Network.Models
{
    public partial class ExpressRouteCircuitSku : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            if (Optional.IsDefined(Name))
            {
                writer.WritePropertyName("name");
                writer.WriteStringValue(Name);
            }
            if (Optional.IsDefined(Tier))
            {
                writer.WritePropertyName("tier");
                writer.WriteStringValue(Tier.Value.ToString());
            }
            if (Optional.IsDefined(Family))
            {
                writer.WritePropertyName("family");
                writer.WriteStringValue(Family.Value.ToString());
            }
            writer.WriteEndObject();
        }

        internal static ExpressRouteCircuitSku DeserializeExpressRouteCircuitSku(JsonElement element)
        {
            Optional<string> name = default;
            Optional<ExpressRouteCircuitSkuTier> tier = default;
            Optional<ExpressRouteCircuitSkuFamily> family = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tier"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    tier = new ExpressRouteCircuitSkuTier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("family"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    family = new ExpressRouteCircuitSkuFamily(property.Value.GetString());
                    continue;
                }
            }
            return new ExpressRouteCircuitSku(name.Value, Optional.ToNullable(tier), Optional.ToNullable(family));
        }
    }
}


text:
package gnu.javax.crypto.mode;

import gnu.java.security.Registry;
import gnu.javax.crypto.cipher.IBlockCipher;
import gnu.javax.crypto.mac.IMac;
import gnu.javax.crypto.mac.MacFactory;

import java.security.InvalidKeyException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * A conventional two-pass authenticated-encrypted mode, EAX. EAX is a
 * Authenticated Encryption with Additional Data (AEAD) scheme,
 * which provides protection and authentication for the message, and provides
 * authentication of an (optional) header. EAX is composed of the counter mode
 * (CTR) and the one-key CBC MAC (OMAC).
 *

 * This class makes full use of the {@link IAuthenticatedMode} interface, that
 * is, all methods of both {@link IMode} and {@link IMac} can be used as
 * specified in the {@link IAuthenticatedMode} interface.
 *

 * References:
 *

 *
M. Bellare, P. Rogaway, and D. Wagner; A
 * Conventional Authenticated-Encryption Mode.

 *

 */
public class EAX
    implements IAuthenticatedMode
{
  /** The tag size, in bytes. */
  private int tagSize;
  /** The nonce OMAC instance. */
  private IMac nonceOmac;
  /** The header OMAC instance. */
  private IMac headerOmac;
  /** The message OMAC instance. */
  private IMac msgOmac;
  /** The CTR instance. */
  private IMode ctr;
  /** The direction state (encrypting or decrypting). */
  private int state;
  /** Whether we're initialized or not. */
  private boolean init;
  /** The cipher block size. */
  private int cipherBlockSize;
  /** The cipher. */
  private IBlockCipher cipher;
  /** The [t]_n array. */
  private byte[] t_n;
  private static boolean valid = false;

  public EAX(IBlockCipher cipher, int cipherBlockSize)
  {
    this.cipher = cipher;
    this.cipherBlockSize = cipherBlockSize;
    String name = cipher.name();
    int i = name.indexOf('-');
    if (i >= 0)
      name = name.substring(0, i);
    String omacname = Registry.OMAC_PREFIX + name;
    nonceOmac = MacFactory.getInstance(omacname);
    headerOmac = MacFactory.getInstance(omacname);
    msgOmac = MacFactory.getInstance(omacname);
    ctr = ModeFactory.getInstance(Registry.CTR_MODE, cipher, cipherBlockSize);
    t_n = new byte[cipherBlockSize];
    init = false;
  }

  public Object clone()
  {
    return new EAX((IBlockCipher) cipher.clone(), cipherBlockSize);
  }

  public String name()
  {
    return Registry.EAX_MODE + "(" + cipher.name() + ")";
  }

  public int defaultBlockSize()
  {
    return ctr.defaultBlockSize();
  }

  public int defaultKeySize()
  {
    return ctr.defaultKeySize();
  }

  public Iterator blockSizes()
  {
    return ctr.blockSizes();
  }

  public Iterator keySizes()
  {
    return ctr.keySizes();
  }

  public void init(Map attrib) throws InvalidKeyException
  {
    byte[] nonce = (byte[]) attrib.get(IV);
    if (nonce == null)
      throw new IllegalArgumentException("no nonce provided");
    byte[] key = (byte[]) attrib.get(KEY_MATERIAL);
    if (key == null)
      throw new IllegalArgumentException("no key provided");

    Arrays.fill(t_n, (byte) 0);
    nonceOmac.reset();
    nonceOmac.init(Collections.singletonMap(MAC_KEY_MATERIAL, key));
    nonceOmac.update(t_n, 0, t_n.length);
    nonceOmac.update(nonce, 0, nonce.length);
    byte[] N = nonceOmac.digest();
    nonceOmac.reset();
    nonceOmac.update(t_n, 0, t_n.length);
    nonceOmac.update(nonce, 0, nonce.length);
    t_n[t_n.length - 1] = 1;
    headerOmac.reset();
    headerOmac.init(Collections.singletonMap(MAC_KEY_MATERIAL, key));
    headerOmac.update(t_n, 0, t_n.length);
    t_n[t_n.length - 1] = 2;
    msgOmac.reset();
    msgOmac.init(Collections.singletonMap(MAC_KEY_MATERIAL, key));
    msgOmac.update(t_n, 0, t_n.length);
    Integer modeSize = (Integer) attrib.get(MODE_BLOCK_SIZE);
    if (modeSize == null)
      modeSize = Integer.valueOf(cipherBlockSize);
    HashMap ctrAttr = new HashMap();
    ctrAttr.put(KEY_MATERIAL, key);
    ctrAttr.put(IV, N);
    ctrAttr.put(STATE, Integer.valueOf(ENCRYPTION));
    ctrAttr.put(MODE_BLOCK_SIZE, modeSize);
    ctr.reset();
    ctr.init(ctrAttr);
    Integer st = (Integer) attrib.get(STATE);
    if (st != null)
      {
        state = st.intValue();
        if (state != ENCRYPTION && state != DECRYPTION)
          throw new IllegalArgumentException("invalid state");
      }
    else
      state = ENCRYPTION;

    Integer ts = (Integer) attrib.get(TRUNCATED_SIZE);
    if (ts != null)
      tagSize = ts.intValue();
    else
      tagSize = cipherBlockSize;
    if (tagSize < 0 || tagSize > cipherBlockSize)
      throw new IllegalArgumentException("tag size out of range");
    init = true;
  }

  public int currentBlockSize()
  {
    return ctr.currentBlockSize();
  }

  public void encryptBlock(byte[] in, int inOff, byte[] out, int outOff)
  {
    if (! init)
      throw new IllegalStateException("not initialized");
    if (state != ENCRYPTION)
      throw new IllegalStateException("not encrypting");
    ctr.update(in, inOff, out, outOff);
    msgOmac.update(out, outOff, ctr.currentBlockSize());
  }

  public void decryptBlock(byte[] in, int inOff, byte[] out, int outOff)
  {
    if (! init)
      throw new IllegalStateException("not initialized");
    if (state != DECRYPTION)
      throw new IllegalStateException("not decrypting");
    msgOmac.update(in, inOff, ctr.currentBlockSize());
    ctr.update(in, inOff, out, outOff);
  }

  public void update(byte[] in, int inOff, byte[] out, int outOff)
  {
    switch (state)
      {
      case ENCRYPTION:
        encryptBlock(in, inOff, out, outOff);
        break;
      case DECRYPTION:
        decryptBlock(in, inOff, out, outOff);
        break;
      default:
        throw new IllegalStateException("impossible state " + state);
      }
  }

  public void reset()
  {
    nonceOmac.reset();
    headerOmac.reset();
    msgOmac.reset();
    ctr.reset();
  }

  public boolean selfTest()
  {
    return true; // XXX
  }

  public int macSize()
  {
    return tagSize;
  }

  public byte[] digest()
  {
    byte[] tag = new byte[tagSize];
    digest(tag, 0);
    return tag;
  }

  public void digest(byte[] out, int outOffset)
  {
    if (outOffset < 0 || outOffset + tagSize > out.length)
      throw new IndexOutOfBoundsException();
    byte[] N = nonceOmac.digest();
    byte[] H = headerOmac.digest();
    byte[] M = msgOmac.digest();
    for (int i = 0; i < tagSize; i++)
      out[outOffset + i] = (byte)(N[i] ^ H[i] ^ M[i]);
    reset();
  }

  public void update(byte b)
  {
    if (! init)
      throw new IllegalStateException("not initialized");
    headerOmac.update(b);
  }

  public void update(byte[] buf, int off, int len)
  {
    if (! init)
      throw new IllegalStateException("not initialized");
    headerOmac.update(buf, off, len);
  }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>mc.houston.subcommands.create_flow — MissionControl 0.0.1 documentation</title>

    <link rel="stylesheet" href="../../../../_static/css/theme.css" type="text/css" />

        <link rel="index" title="Index"
              href="../../../../genindex.html"/>
        <link rel="search" title="Search" href="../../../../search.html"/>
    <link rel="top" title="MissionControl 0.0.1 documentation" href="../../../../index.html"/>
        <link rel="up" title="Module code" href="../../../index.html"/>

             MissionControl

                0.0.1

  <form id="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>

User Guide

Examples

API Documentation

          MissionControl

Docs »

Module code »

mc.houston.subcommands.create_flow

Source code for mc.houston.subcommands.create_flow

import json

from mc.flows.flow import Flow
from ._base_subcommand import BaseSubcommand

[docs]class Subcommand(BaseSubcommand):
    help = "Create a flow"

[docs]    def add_arguments(self, parser):
        group = parser.add_mutually_exclusive_group(required=True)
        group.add_argument('--flow_spec', type=json.loads)
        group.add_argument('--flow_spec_file', type=self.json_path_arg)

    def _get_defaults(self):
        return {
            'flow_spec': {}
        }

    def _ensure_parsed_args(self, *args, **kwargs):
        super()._ensure_parsed_args(*args, **kwargs)
        flow_spec = self.parsed_args.get('flow_spec')
        if flow_spec is None:
            flow_spec = self.parsed_args.get('flow_spec_file')

    def _run(self):
        flow_spec = self.parsed_args['flow_spec']
        flow_dict = Flow.from_flow_spec(flow_spec=flow_spec).to_flow_dict()
        flow_record = self.utils.db.create_item(
            item_type='flow', item_kwargs=flow_dict)
        return flow_record

        © Copyright 2017, A. Dorsk.

  Built with Sphinx using a theme provided by Read the Docs.


text:
package derpibooru.derpy.server.providers;

import android.content.Context;

import derpibooru.derpy.data.server.DerpibooruUser;
import derpibooru.derpy.server.QueryHandler;
import derpibooru.derpy.server.parsers.UserDataParser;

public class UserDataProvider extends Provider<DerpibooruUser> {
    public UserDataProvider(Context context, QueryHandler<DerpibooruUser> handler) {
        super(context, handler);
    }

    public void refreshUserData() {
        fetch();
    }

    @Override
    protected String generateUrl() {
        /* TODO: there is probably a better url to find user data at */
        StringBuilder sb = new StringBuilder();
        sb.append(DERPIBOORU_DOMAIN);
        sb.append("about"); /* @/about@ is a static page — slightly better than querying an image list, but the point still stands */
        return sb.toString();
    }

    @Override
    public void fetch() {
        super.executeQuery(new UserDataParser());
    }
}


text:
#include <CPSViewI.h>
#include <CReadLine.h>

CPSView::
CPSView() :
 start_time_        (0),
 debug_             (false),
 exit_flag_         (false),
 memory_mgr_        (),
 name_mgr_          (),
 resource_mgr_      (),
 dictionary_mgr_    (),
 operator_mgr_      (),
 operand_stack_     (),
 execution_stack_   (),
 graphics_stack_    (),
 graphics_          (NULL),
 gstate_mgr_        (),
 gstate_token_mgr_  (),
 token_mgr_         (),
 error_mgr_         (),
 mark_token_        (),
 current_file_      (NULL),
 current_file_stack_()
{
  if (getenv("PSVIEW_DEBUG") != NULL)
    debug_ = true;

  memory_mgr_     = new PSViewMemoryMgr(this);
  name_mgr_       = new PSViewNameMgr  (this);
  resource_mgr_   = new PSViewResourceMgr(this);
  dictionary_mgr_ = new PSViewDictionaryMgr(this);
  operator_mgr_   = new PSViewOperatorMgr(this);

  operand_stack_   = new PSViewOperandStack  (this);
  execution_stack_ = new PSViewExecutionStack(this);
  graphics_stack_  = new PSViewGraphicsStack (this);

  gstate_mgr_       = new PSViewGStateMgr(this);
  gstate_token_mgr_ = new PSViewGStateTokenMgr(this);

  token_mgr_ = new PSViewTokenMgr(this);
  error_mgr_ = new PSViewErrorMgr(this);

  mark_token_ = new PSViewMarkToken(this);

  operator_mgr_  ->init();
  dictionary_mgr_->init();

  init();
}

CPSView::
~CPSView()
{
  term();
}

void
CPSView::
setDebug(bool flag)
{
  debug_ = flag;
}

void
CPSView::
setExitFlag(bool flag)
{
  exit_flag_ = flag;
}

void
CPSView::
init()
{
  start_time_ = time(NULL);

  getErrorMgr()->setError(false);

  exit_flag_ = false;

  getMemoryMgr     ()->init();
  getGStateMgr     ()->init();
  getGStateTokenMgr()->init();
  getResourceMgr   ()->init();
}

void
CPSView::
term()
{
}

void
CPSView::
setRenderer(CPSViewRenderer *renderer)
{
  graphics_ = renderer;
}

void
CPSView::
openCurrentFile(const std::string &filename)
{
  auto *token = new PSViewTextFileToken(this, filename, "r");

  if (token == NULL) {
    getErrorMgr()->raise(PSVIEW_ERROR_TYPE_UNDEFINED_FILENAME);
    return;
  }

  if (current_file_ != NULL)
    current_file_stack_.push_back(current_file_);

  current_file_ = token;
}

void
CPSView::
closeCurrentFile()
{
  if (current_file_ != NULL)
    current_file_->close();

  /* Print any remaining Stack Tokens */

  if (getDebug()) {
    CStrUtil::printf("Stack : ");
    operand_stack_->print();
    CStrUtil::printf("\n");
  }

  if (current_file_stack_.size() > 0) {
    current_file_ = current_file_stack_[current_file_stack_.size() - 1];

    current_file_stack_.pop_back();
  }
  else
    current_file_ = NULL;
}

void
CPSView::
setCurrentFile(PSViewFileToken *token)
{
  current_file_ = token;
}

PSViewFileToken *
CPSView::
getCurrentFile()
{
  return current_file_;
}

void
CPSView::
executeCurrentFile()
{
  if (current_file_ == NULL)
    return;

  /* Check First Line */

  if (! current_file_->initPostScript()) {
    CStrUtil::eprintf("PSView: Invalid PostScript File %s\n",
                      current_file_->getFileName().c_str());

    return;
  }

  /* Read and Execute each Token in the File */

  PSViewToken *token;

  while ((token = current_file_->readToken()) != NULL) {
    if (token->isProcedure())
      operand_stack_->push(token);
    else
      token->execute();

    if (current_file_ == NULL || getErrorMgr()->getError())
      break;
  }
}

void
CPSView::
executive()
{
  PSViewOperatorMgr::executiveOp(getOperatorMgr());
}

bool
CPSView::
getLine(std::string &line)
{
  CReadLine readline;

  line = readline.readLine();

  if (readline.eof())
    return false;

  return true;
}


text:
namespace blink {

namespace {

using LayoutTableSectionTest = RenderingTest;

TEST_F(LayoutTableSectionTest,
       BackgroundIsKnownToBeOpaqueWithLayerAndCollapsedBorder) {
  setBodyInnerHTML(
      "
"
      "
"
      "
Cell
"
      "
"
      "
");

  LayoutTableSection* section =
      toLayoutTableSection(getLayoutObjectByElementId("section"));
  EXPECT_TRUE(section);
  EXPECT_FALSE(
      section->backgroundIsKnownToBeOpaqueInRect(LayoutRect(0, 0, 1, 1)));
}

TEST_F(LayoutTableSectionTest, BackgroundIsKnownToBeOpaqueWithBorderSpacing) {
  setBodyInnerHTML(
      "
"
      "
"
      "
Cell
"
      "
"
      "
");

  LayoutTableSection* section =
      toLayoutTableSection(getLayoutObjectByElementId("section"));
  EXPECT_TRUE(section);
  EXPECT_FALSE(
      section->backgroundIsKnownToBeOpaqueInRect(LayoutRect(0, 0, 1, 1)));
}

TEST_F(LayoutTableSectionTest, BackgroundIsKnownToBeOpaqueWithEmptyCell) {
  setBodyInnerHTML(
      "
"
      "
"
      "
Cell
"
      "
Cell	Cell
"
      "
"
      "
");

  LayoutTableSection* section =
      toLayoutTableSection(getLayoutObjectByElementId("section"));
  EXPECT_TRUE(section);
  EXPECT_FALSE(
      section->backgroundIsKnownToBeOpaqueInRect(LayoutRect(0, 0, 1, 1)));
}

TEST_F(LayoutTableSectionTest, EmptySectionDirtiedRows) {
  setBodyInnerHTML(
      "
"
      "

"
      "
");

  LayoutTableSection* section =
      toLayoutTableSection(getLayoutObjectByElementId("section"));
  EXPECT_TRUE(section);
  CellSpan cellSpan = section->dirtiedRows(LayoutRect(50, 50, 100, 100));
  EXPECT_EQ(0u, cellSpan.start());
  EXPECT_EQ(0u, cellSpan.end());
}

TEST_F(LayoutTableSectionTest, EmptySectionDirtiedEffectiveColumns) {
  setBodyInnerHTML(
      "
"
      "

"
      "
");

  LayoutTableSection* section =
      toLayoutTableSection(getLayoutObjectByElementId("section"));
  EXPECT_TRUE(section);
  CellSpan cellSpan =
      section->dirtiedEffectiveColumns(LayoutRect(50, 50, 100, 100));
  // The table has at least 1 column even if there is no cell.
  EXPECT_EQ(1u, section->table()->numEffectiveColumns());
  EXPECT_EQ(1u, cellSpan.start());
  EXPECT_EQ(1u, cellSpan.end());
}

}  // anonymous namespace

}  // namespace blink


text:
PKG_NAME = util-linux-schedutils
PKG_VERS = 2.26
PKG_EXT = tar.xz
PKG_DIST_NAME = util-linux-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://www.kernel.org/pub/linux/utils/util-linux/v$(PKG_VERS)
PKG_DIR = util-linux-$(PKG_VERS)

DEPENDS =

HOMEPAGE = https://github.com/karelzak/util-linux
COMMENT  = Random collection of Linux utilities
LICENSE  = GPL

GNU_CONFIGURE = 1
CONFIGURE_ARGS  = --without-ncurses --without-python
CONFIGURE_ARGS += --disable-all-programs --enable-schedutils

include ../../mk/spksrc.cross-cc.mk