text:
module AwsCli
  module CLI
    module AS
      require 'awscli/cli/as'
      class Groups < Thor

        desc "list [OPTIONS]", "list auto scaling groups"
        method_option :table, :aliases => "-t", :type => :boolean, :desc => "simple format listing in a table"
        def list
          create_as_object
          @as.list options
        end

        desc "create", "create a new auto scaling group"
        method_option :id, :aliases => "-n", :banner => "NAME", :required => true, :desc => "name of the auto scaling group to create"
        method_option :availability_zones, :aliases => "-z", :type => :array, :required => true, :desc => "A list of availability zones for the Auto Scaling group"
        method_option :launch_configuration_name, :aliases => "-c", :required => true, :banner => "CFG_NAME", :desc => "The name of the launch configuration to use with the Auto Scaling group"
        method_option :min_size, :aliases => "-l", :type => :numeric, :required => :true, :desc => "The minimum size of the Auto Scaling group"
        method_option :max_size, :aliases => "-h", :type => :numeric, :required => :true, :desc => "The maximum size of the Auto Scaling group"
        method_option :desired_capacity, :aliases => "-r", :type => :numeric, :desc => "The number of Amazon EC2 instances that should be running in the group"
        method_option :default_cooldown, :aliases => "-t", :type => :numeric, :desc => "The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start"
        method_option :health_check_grace_period, :type => :numeric, :desc => "Length of time in seconds after a new Amazon EC2 instance comes into service that Auto Scaling starts checking its health"
        method_option :health_check_type, :desc => "The service you want the health status from, Amazon EC2 or Elastic Load Balancer. Valid values are 'EC2' or 'ELB'"
        method_option :load_balancer_names, :type => :array, :desc => "A list of LoadBalancers to use"
        method_option :placement_group, :desc => "Physical location of your cluster placement group created in Amazon EC2"
        method_option :tags, :type => :array, :desc => "list of key=value pairs used for tags"
        method_option :termination_policies, :type => :array, :desc => "A standalone termination policy or a list of termination policies used to select the instance to terminate. The policies are executed in the order that they are listed"
        method_option :vpc_zone_identifiers, :type => :array, :desc => "A list of subnet identifiers of Amazon Virtual Private Clouds (Amazon VPCs)"
        def create
          create_as_object
          @as.create options
        end

        desc "delete", "delete an existing auto scaling group"
        method_option :id, :aliases => "-n", :banner => "NAME", :required => true, :desc => "name of the auto sacling group to delete"
        method_option :force, :aliases => "-f", :type => :boolean, :desc => "force deletes instances of the specified auto scaling group"
        def delete
          create_as_object
          @as.delete options
        end

        desc "scale", "change the desired capacity of a auto sacling group"
        method_option :id, :aliases => "-n", :banner => "NAME", :required => true, :desc => "name of the auto sacling group to scale"
        method_option :desired_capacity, :aliases => "-c", :type => :numeric, :banner => "SIZE", :required => true, :desc => "Desired capacity of a auto scaling group"
        def scale
          create_as_object
          @as.set_desired_capacity options
        end

        # desc "update", "update auto scaling group attributes"
        # method_option :id, :aliases => "-n", :banner => "NAME", :required => true, :desc => "name of the auto sacling group to scale"
        # method_option :availability_zones, :aliases => "-z", :type => :array, :desc => "A list of availability zones for the Auto Scaling group"
        # method_option :desired_capacity, :aliases => "-r", :type => :numeric, :desc => "The number of Amazon EC2 instances that should be running in the group"
        # method_option :default_cooldown, :aliases => "-t", :type => :numeric, :desc => "The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start"
        # method_option :health_check_grace_period, :type => :numeric, :desc => "Length of time in seconds after a new Amazon EC2 instance comes into service that Auto Scaling starts checking its health"
        # method_option :health_check_type, :desc => "The service you want the health status from, Amazon EC2 or Elastic Load Balancer. Valid values are 'EC2' or 'ELB'"
        # method_option :launch_configuration_name, :aliases => "-c", :banner => "CFG_NAME", :desc => "The name of the launch configuration to use with the Auto Scaling group"
        # method_option :min_size, :aliases => "-l", :type => :numeric, :desc => "The minimum size of the Auto Scaling group"
        # method_option :max_size, :aliases => "-h", :type => :numeric, :desc => "The maximum size of the Auto Scaling group"
        # method_option :termination_policies, :type => :array, :desc => "A standalone termination policy or a list of termination policies used to select the instance to terminate. The policies are executed in the order that they are listed"
        # method_option :vpc_zone_identifiers, :type => :array, :desc => "A list of subnet identifiers of Amazon Virtual Private Clouds (Amazon VPCs)"
        # def update
        #   create_as_object
        #   @as.update options
        # end

        desc "suspend", "Suspends Auto Scaling processes for an Auto Scaling group. To suspend specific process types, specify them by name with the ScalingProcesses parameter. To suspend all process types, omit the ScalingProcesses"
        method_option :id, :aliases => "-n", :banner => "NAME", :required => true, :desc => "name of the auto sacling group to suspend processes"
        method_option :scaling_processes, :aliases => "-p", :type => :array, :desc => "The processes that you want to suspend. To suspend all process types, omit this parameter"
        def suspend
          create_as_object
          @as.suspend_processes options
        end

        desc "resume", "Resumes Auto Scaling processes for an Auto Scaling group"
        method_option :id, :aliases => "-n", :banner => "NAME", :required => true, :desc => "name of the auto sacling group to resume processes"
        method_option :scaling_processes, :aliases => "-p", :type => :array, :desc => "The processes that you want to resume. To resume all process types, omit this parameter"
        def resume
          create_as_object
          @as.resume_processes options
        end

        private
        def create_as_object
          puts "AS Establishing Connetion..."
          $as_conn =  Awscli::Connection.new.request_as
          puts "AS Establishing Connetion... OK"
          @as = Awscli::As::Groups.new($as_conn)
        end

        AwsCli::CLI::As.register AwsCli::CLI::AS::Groups, :groups, 'groups [COMMAND]', 'Auto Scaling Groups Management'

      end
    end
  end
end


text:
require 'test_helper'
require 'tset'

class TsetTest < ActiveSupport::TestCase

  setup do
    @match = Match.find(1)
  end

  test 'should get current set' do
    assert_equal 2, Tset.find_current_set(@match).id
  end

  test 'should add set' do
    assert Tset.add(@match)
  end

  test 'should update winner' do
    tset = Tset.find(1)
    tset.update_winner(1)
    assert_equal 1, tset.user_id
  end

  test 'should be end of set' do
    tset = tsets(:set_has_ended)
    assert tset.end?(1)
  end

  test 'should not be end of set' do
    tset = tsets(:one)
    assert_not tset.end?(1)
  end

end

redpajama_set_name: RedPajamaGithub


text:
var global = require('../internals/global');

var globalIsFinite = global.isFinite;

// `Number.isFinite` method
// https://tc39.es/ecma262/#sec-number.isfinite
// eslint-disable-next-line es-x/no-number-isfinite -- safe
module.exports = Number.isFinite || function isFinite(it) {
  return typeof it == 'number' && globalIsFinite(it);
};


text:
<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "componente".
 *
 * @property integer $id
 * @property integer $etapaid
 * @property string $componente
 * @property integer $usuariocrea
 * @property string $fechacrea
 * @property integer $usuariomodifica
 * @property string $fechamodifica
 *
 * @property Etapa $etapa
 * @property Documentopre[] $documentopres
 * @property Estadocomponente[] $estadocomponentes
 * @property Nota[] $notas
 */
class Componente extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'componente';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['etapaid'], 'required'],
            [['etapaid', 'usuariocrea', 'usuariomodifica'], 'integer'],
            [['fechacrea', 'fechamodifica'], 'safe'],
            [['componente'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'etapaid' => 'Etapaid',
            'componente' => 'Componente',
            'usuariocrea' => 'Usuariocrea',
            'fechacrea' => 'Fechacrea',
            'usuariomodifica' => 'Usuariomodifica',
            'fechamodifica' => 'Fechamodifica',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getEtapa()
    {
        return $this->hasOne(Etapa::className(), ['id' => 'etapaid']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getDocumentopres()
    {
        return $this->hasMany(Documentopre::className(), ['componenteid' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getEstadocomponentes()
    {
        return $this->hasMany(Estadocomponente::className(), ['componenteid' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getNotas()
    {
        return $this->hasMany(Nota::className(), ['componenteid' => 'id']);
    }
}


text:
package com.elmakers.mine.bukkit.magic;

/**
 * Exception that is thrown when an operation did not succeed because the
 *  plugin was not loaded yet.
 */
class PluginNotLoadedException extends RuntimeException {
}


text:
package org.simpleframework.xml.core;

import java.lang.annotation.Annotation;
import java.util.Iterator;
import java.util.LinkedHashMap;

import org.simpleframework.xml.Text;
import org.simpleframework.xml.stream.Format;

/**
 * The GroupExtractor represents an extractor for labels
 * associated with a particular union annotation. This extractor
 * registers Label by name and by type. Acquiring
 * the label by type allows the serialization process to dynamically
 * select a label, and thus converter, based on the instance type.
 * On deserialization a label is dynamically selected based on name.
 *
 * @author Niall Gallagher
 *
 * @see org.simpleframework.xml.core.Group
 */
class GroupExtractor implements Group {

   /**
    * This represents a factory for creating union extractors.
    */
   private final ExtractorFactory factory;

   /**
    * This represents the union label to be used for this group.
    */
   private final Annotation label;

   /**
    * This contains each label registered by name and by type.
    */
   private final Registry registry;

   /**
    * This contains each label registered by label name.
    */
   private final LabelMap elements;

   /**
    * Constructor for the GroupExtractor object. This
    * will create an extractor for the provided union annotation.
    * Each individual declaration within the union is extracted
    * and made available within the group.
    *
    * @param contact this is the annotated field or method
    * @param label this is the label associated with the contact
    * @param format this is the format used by this extractor
    */
   public GroupExtractor(Contact contact, Annotation label, Format format) throws Exception{
      this.factory = new ExtractorFactory(contact, label, format);
      this.elements = new LabelMap();
      this.registry = new Registry(elements);
      this.label = label;
      this.extract();
   }

   /**
    * This is used to acquire the names for each label associated
    * with this Group instance. The names provided
    * here are not styled according to a serialization context.
    *
    * @return this returns the names of each union extracted
    */
   public String[] getNames() throws Exception {
      return elements.getKeys();
   }

   /**
    * This is used to acquire the paths for each label associated
    * with this Group instance. The paths provided
    * here are not styled according to a serialization context.
    *
    * @return this returns the paths of each union extracted
    */
   public String[] getPaths() throws Exception {
      return elements.getPaths();
   }

   /**
    * This is used to acquire a LabelMap containing the
    * labels available to the group. Providing a context object
    * ensures that each of the labels is mapped to a name that is
    * styled according to its internal style.
    *
    * @return this returns a label map containing the labels
    */
   public LabelMap getElements() throws Exception {
      return elements.getLabels();
   }

   /**
    * This is used to acquire a Label based on the type
    * of an object. Selecting a label based on the type ensures that
    * the serialization process can dynamically convert an object
    * to XML. If the type is not supported, this returns null.
    *
    * @param type this is the type to select the label from
    *
    * @return this returns the label based on the type
    */
   public Label getLabel(Class type) {
      return registry.resolve(type);
   }

   /**
    * This is used to get a Label that represents the
    * text between elements on an element union. Providing a label
    * here ensures that the free text found between elements can
    * be converted in to strings and added to the list.
    *
    * @return a label if a text annotation has been declared
    */
   public Label getText() {
      return registry.resolveText();
   }

   /**
    * This is used to determine if the associated type represents a
    * label defined within the union group. If the label exists
    * this returns true, if not then this returns false.
    *
    * @param type this is the type to check for
    *
    * @return this returns true if a label for the type exists
    */
   public boolean isValid(Class type) {
      return registry.resolve(type) != null;
   }

   /**
    * This is used to determine if a type has been declared by the
    * annotation associated with the group. Unlike determining if
    * the type is valid this will not consider super types.
    *
    * @param type this is the type to determine if it is declared
    *
    * @return this returns true if the type has been declared
    */
   public boolean isDeclared(Class type) {
      return registry.containsKey(type);
   }

   /**
    * This is used to determine if the group is inline. A group is
    * inline if all of the elements in the group is inline. If any of
    * the Label objects in the group is not inline then
    * the entire group is not inline, although this is unlikely.
    *
    * @return this returns true if each label in the group is inline
    */
   public boolean isInline() {
      for(Label label : registry) {
         if(!label.isInline()) {
            return false;
         }
      }
      return !registry.isEmpty();
   }

   /**
    * This is used to determine if an annotated list is a text
    * list. A text list is a list of elements that also accepts
    * free text. Typically this will be an element list union that
    * will allow unstructured XML such as XHTML to be parsed.
    *
    * @return returns true if the label represents a text list
    */
   public boolean isTextList() {
      return registry.isText();
   }

   /**
    * This is used to extract the labels associated with the group.
    * Extraction will instantiate a Label object for
    * an individual annotation declared within the union. Each of
    * the label instances is then registered by both name and type.
    */
   private void extract() throws Exception {
      Extractor extractor = factory.getInstance();

      if(extractor != null) {
         extract(extractor);
      }
   }

   /**
    * This is used to extract the labels associated with the group.
    * Extraction will instantiate a Label object for
    * an individual annotation declared within the union. Each of
    * the label instances is then registered by both name and type.
    *
    * @param extractor this is the extractor to get labels for
    */
   private void extract(Extractor extractor) throws Exception {
      Annotation[] list = extractor.getAnnotations();

      for(Annotation label : list) {
         extract(extractor, label);
      }
   }

   /**
    * This is used to extract the labels associated with the group.
    * Extraction will instantiate a Label object for
    * an individual annotation declared within the union. Each of
    * the label instances is then registered by both name and type.
    *
    * @param extractor this is the extractor to get labels for
    * @param value this is an individual annotation declared
    */
   private void extract(Extractor extractor, Annotation value) throws Exception {
      Label label = extractor.getLabel(value);
      Class type = extractor.getType(value);

      if(registry != null) {
         registry.register(type, label);
      }
   }

   /**
    * This returns a string representation of the union group.
    * Providing a string representation in this way ensures that the
    * group can be used in exception messages and for any debugging.
    *
    * @return this returns a string representation of the group
    */
   public String toString() {
      return label.toString();
   }

   /**
    * The Registry object is used to maintain mappings
    * from types to labels. Each of the mappings can be used to
    * dynamically select a label based on the instance type that is
    * to be serialized. This also registers based on the label name.
    */
   private static class Registry extends LinkedHashMap<Class, Label> implements Iterable {

      /**
       * This maintains a mapping between label names and labels.
       */
      private LabelMap elements;

      /**
       * This label represents the free text between elements.
       */
      private Label text;

      /**
       * Constructor for the Registry object. This is
       * used to register label instances using both the name and
       * type of the label. Registration in this way ensures that
       * each label can be dynamically selected.
       *
       * @param elements this contains name to label mappings
       */
      public Registry(LabelMap elements){
         this.elements = elements;
      }

      /**
       * This is used to determine if an annotated list is a text
       * list. A text list is a list of elements that also accepts
       * free text. Typically this will be an element list union that
       * will allow unstructured XML such as XHTML to be parsed.
       *
       * @return returns true if the label represents a text list
       */
      public boolean isText() {
         return text != null;
      }

      /**
       * This is used so that all the Label objects
       * that have been added to the registry can be iterated over.
       * Iteration over the labels allows for easy validation.
       *
       * @return this returns an iterator for all the labels
       */
      public Iterator iterator() {
         return values().iterator();
      }

      /**
       * This is used to resolve the text for this registry. If there
       * is a text annotation declared with the union then this will
       * return a Label that can be used to convert the
       * free text between elements in to strings.
       *
       * @return this returns the label representing free text
       */
      public Label resolveText() {
         return resolveText(String.class);
      }

      /**
       * Here we resolve the Label the type is matched
       * with by checking if the type is directly mapped or if any of
       * the super classes of the type are mapped. If there are no
       * classes in the hierarchy of the type that are mapped then
       * this will return null otherwise the label will be returned.
       *
       * @param type this is the type to resolve the label for
       *
       * @return this will return the label that is best matched
       */
      public Label resolve(Class type) {
         Label label = resolveText(type);

         if(label == null) {
            return resolveElement(type);
         }
         return label;
      }

      /**
       * This is used to resolve the text for this registry. If there
       * is a text annotation declared with the union then this will
       * return a Label that can be used to convert the
       * free text between elements in to strings.
       *
       * @param type this is the type to resolve the text as
       *
       * @return this returns the label representing free text
       */
      private Label resolveText(Class type) {
         if(text != null) {
            if(type == String.class) {
               return text;
            }
         }
         return null;
      }

      /**
       * Here we resolve the Label the type is matched
       * with by checking if the type is directly mapped or if any of
       * the super classes of the type are mapped. If there are no
       * classes in the hierarchy of the type that are mapped then
       * this will return null otherwise the label will be returned.
       *
       * @param type this is the type to resolve the label for
       *
       * @return this will return the label that is best matched
       */
      private Label resolveElement(Class type) {
         while(type != null) {
            Label label = get(type);

            if(label != null) {
               return label;
            }
            type = type.getSuperclass();
         }
         return null;
      }

      /**
       * This is used to register a label based on the name. This is
       * done to ensure the label instance can be dynamically found
       * during the deserialization process by providing the name.
       *
       * @param name this is the name of the label to be registered
       * @param label this is the label that is to be registered
       */
      public void register(Class type, Label label) throws Exception {
         Label cache = new CacheLabel(label);

         registerElement(type, cache);
         registerText(cache);
      }

      /**
       * This is used to register a label based on the name. This is
       * done to ensure the label instance can be dynamically found
       * during the deserialization process by providing the name.
       *
       * @param name this is the name of the label to be registered
       * @param label this is the label that is to be registered
       */
      private void registerElement(Class type, Label label) throws Exception {
         String name = label.getName();

         if(!elements.containsKey(name)) {
            elements.put(name, label);
         }
         if(!containsKey(type)) {
            put(type, label);
         }
      }

      /**
       * This is used to register the provided label is a text label.
       * Registration as a text label can only happen if the field or
       * method has a Text annotation declared on it.
       *
       * @param label this is the label to register as text
       */
      private void registerText(Label label) throws Exception {
         Contact contact = label.getContact();
         Text value = contact.getAnnotation(Text.class);

         if(value != null) {
            text = new TextListLabel(label, value);
         }
      }
   }
}


text:
module Azure::Compute::Mgmt::V2018_06_01
  module Models
    #
    # Model object.
    #
    #
    class SubResourceReadOnly

      include MsRestAzure

      # @return [String] Resource Id
      attr_accessor :id

      #
      # Mapper for SubResourceReadOnly class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'SubResourceReadOnly',
          type: {
            name: 'Composite',
            class_name: 'SubResourceReadOnly',
            model_properties: {
              id: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'id',
                type: {
                  name: 'String'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
This test checks that flags passed to the external linker with -extldflags
through gc_linkopts are correctly combined with other flags passed through
-extldflags.

`go tool link` only uses the last set of flags passed with -extldflags. If more
than one set of flags is passed, the last set is passed to the external linker,
and the rest are silently ignored.

`go_binary` and `go_test` should look for -extldflags in gc_linkopts and
combine the flags into a single list passed to `go tool link`. This includes
flags generated by the rules themselves.

This test checks this behavior by adding extra rpaths, which has an observable
effect on a `go_binary` linked with the external linker. The shell script checks
that these paths are present.


text:
package org.apache.camel.impl;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.builder.RouteBuilder;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

public class RouteNoOutputTest extends ContextTestSupport {

    @Override
    @BeforeEach
    public void setUp() throws Exception {
        try {
            super.setUp();
            fail("Should have thrown exception");
        } catch (Exception e) {
            FailedToCreateRouteException failed = assertIsInstanceOf(FailedToCreateRouteException.class, e);
            assertTrue(failed.getRouteId().matches("route[0-9]+"));
            assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
            assertTrue(e.getCause().getMessage().matches(
                    "Route route[0-9]+\\Q has no output processors. You need to add outputs to the route such as to(\"log:foo\").\\E"));
        }
    }

    @Test
    public void testDummy() {
        // noop
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start");
            }
        };
    }
}


text:
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Tampleworks.WindowsApplicationBlock.Demo.ApplicationLogic.ReportGeneration;
using Tampleworks.WindowsApplicationBlock.ApplicationLogicAbstractions;

namespace Tampleworks.WindowsApplicationBlock.Demo.ApplicationLogic.MainPage
{
    public sealed class OrganisationReportGenerationViewModel : ViewModelBase
    {
        private readonly Guid organisationId;
        private readonly IWindowFrameControllerAgent viewAgent;
        private readonly IReportGenerationAgent reportGenerationAgent;
        private bool isRunning;
        private bool executionErrorIsVisible;
        private string executionErrorText;
        private double progressValue;
        private bool progressIsIndeterminate;
        private readonly Func<bool> getRequireExtendedExecution;
        private bool runningInExtendedExecution;

        public OrganisationReportGenerationViewModel(
            Guid organisationId,
            IWindowFrameControllerAgent viewAgent,
            IReportGenerationAgent reportGenerationAgent,
            Func<bool> getRequireExtendedExecution
        )
        {
            this.organisationId = organisationId;
            this.viewAgent = viewAgent;
            this.reportGenerationAgent = reportGenerationAgent;
            isRunning = false;
            this.getRequireExtendedExecution = getRequireExtendedExecution;
        }

        public bool IsNotRunning => !IsRunning;
        public bool IsRunning
        {
            get { return isRunning; }
            private set
            {
                if (isRunning == value) return;
                isRunning = value;
                OnPropertyChanged(nameof(IsRunning));
                OnPropertyChanged(nameof(IsNotRunning));
            }
        }

        public double ProgressValue
        {
            get { return progressValue; }
            private set
            {
                if (progressValue == value) return;
                progressValue = value;
                OnCallerPropertyChanged();
            }
        }

        public bool ProgressIsIndeterminate
        {
            get { return progressIsIndeterminate; }
            private set
            {
                if (progressIsIndeterminate == value) return;
                progressIsIndeterminate = value;
                OnCallerPropertyChanged();
            }
        }

        public bool ExecutionErrorIsVisible
        {
            get { return executionErrorIsVisible; }
            private set
            {
                if (executionErrorIsVisible == value) return;
                executionErrorIsVisible = value;
                OnCallerPropertyChanged();
            }
        }
        public string ExecutionErrorText
        {
            get { return executionErrorText; }
            private set
            {
                if (executionErrorText == value) return;
                executionErrorText = value;
                OnCallerPropertyChanged();
            }
        }

        public bool RunningInExtendedExecution
        {
            get { return runningInExtendedExecution; }
            private set
            {
                if (runningInExtendedExecution == value) return;
                runningInExtendedExecution = value;
                OnCallerPropertyChanged();
            }
        }

        public async void Run()
        {
            try
            {
                ReportGenerationStartResult startResult;
                do
                {
                    startResult = await reportGenerationAgent.StartGenerationAsync(organisationId, getRequireExtendedExecution());
                    switch (startResult)
                    {
                        case ReportGenerationStartResult.Started: break;
                        case ReportGenerationStartResult.PreviousOperationCompleted:
                            if (await ApproveRunReportAgain())
                            {
                                reportGenerationAgent.ResetCompleted(organisationId);
                                startResult = await reportGenerationAgent.StartGenerationAsync(organisationId, getRequireExtendedExecution());
                                Debug.Assert(startResult == ReportGenerationStartResult.Started);
                                break;
                            }
                            else return;
                        default: throw new NotSupportedException();
                    }
                } while (startResult != ReportGenerationStartResult.Started);
            }
            catch (UserMessageException exc)
            {
                await viewAgent.ShowStringContentDialog(
                    new ContentDialogParameters
                    {
                        Title = "Report generation start failed.",
                        Content = exc.Message,
                        PrimaryButtonText = "OK",
                    }
                );
                return;
            }

            await ObserverReportGeneration();
        }

        private async Task<bool> ApproveRunReportAgain()
        {
            var result = await viewAgent.ShowStringContentDialog(
                new ContentDialogParameters
                {
                    Title = "Report Generation",
                    Content = "Organisation report generation was completed before. Do you want to start its generation again?",
                    PrimaryButtonText = "Ok",
                    SecondaryButtonText = "Cancel",
                }
            );
            switch (result)
            {
                case StringContentDialogResult.Primary: return true;
                case StringContentDialogResult.Secondary: return false;
                default: throw new NotSupportedException();
            }
        }

        public async Task ObserverReportGeneration()
        {
            while (true)
            {
                ReportGenerationStateInfo state = reportGenerationAgent.GetStateAsync(organisationId);
                await viewAgent.RunInViewDispatcherAsync(() => UpdateByState(state));

                if (state != null && state.State == ReportGenerationState.Running)
                {
                    await Task.Delay(1000);
                }
                else
                {
                    break;
                };
            }
        }

        private void UpdateByState(ReportGenerationStateInfo state)
        {
            if (state == null)
            {
                IsRunning = false;
                ProgressIsIndeterminate = true;
                ProgressValue = 0;
                ExecutionErrorText = string.Empty;
                executionErrorIsVisible = false;
            }
            else
            {
                switch (state.State)
                {
                    case ReportGenerationState.Running:
                        IsRunning = true;
                        ProgressIsIndeterminate = !state.Running.ProgressValue.HasValue;
                        ProgressValue = state.Running.ProgressValue ?? 0;
                        RunningInExtendedExecution = state.Running.RunningInExtendedExecution;
                        ExecutionErrorText = string.Empty;
                        ExecutionErrorIsVisible = false;
                        break;
                    case ReportGenerationState.Cancelled:
                        IsRunning = false;
                        ProgressIsIndeterminate = true;
                        ProgressValue = 0;
                        ExecutionErrorText = "Operation Cancelled";
                        executionErrorIsVisible = true;
                        break;
                    case ReportGenerationState.Failed:
                        IsRunning = false;
                        ProgressIsIndeterminate = true;
                        ProgressValue = 0;
                        ExecutionErrorText = state.Fault.FaultMessage;
                        executionErrorIsVisible = true;
                        break;
                    case ReportGenerationState.Completed:
                        IsRunning = false;
                        ProgressIsIndeterminate = true;
                        ProgressValue = 0;
                        ExecutionErrorText = string.Empty;
                        executionErrorIsVisible = false;
                        break;
                    default: throw new NotSupportedException();
                }
            }
        }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

      <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Apache Ant - Apache Ant™ Project News</title>
        <link type="text/css" href="./page.css" rel="stylesheet">
          <meta name="author" content="Conor MacNeill">
  <meta name="email" content="">
        <meta name="author" content="Stefan Bodewig">
  <meta name="email" content="">
        <meta name="author" content="Magesh Umasankar">
  <meta name="email" content="">
        <meta name="author" content="Antoine Levy-Lambert">
  <meta name="email" content="">

              <form target="_blank" onsubmit="q.value = query.value + ' site:ant.apache.org'" action="http://www.google.com/search" method="get">

                      <input name="q" type="hidden">
                      <input size="15" id="query" type="text">

                      <input name="Search" value="Search" type="submit">

                      the Apache Ant site

              </form>

                        	Home

                          	Projects

Apache Ant

                                    Welcome

                                    License

                                    News

Documentation

                                    Manual

                                    Related Projects

                                    External Tools and Tasks

                                    Resources

                                    Frequently Asked Questions

                                    Wiki

                                    Having Problems?

Download

                                    Binary Distributions

                                    Source Distributions

                                    Ant Manual

Contributing

                                    Mailing Lists

                                    Subversion Repositories

                                    Nightly+Continuous Builds

                                    Bug Database

                                    Security

Sponsorship

                                    Thanks

                                    Sponsorship

Project Management

                                    Contributors

                                    Apache Ant Mission

                                    Project Bylaws

                                    Legal

Apache Ant™ Project News

      Apache Ant 1.8.2

December 27th, 2010 - Apache Ant 1.8.2 Released

Apache Ant 1.8.2 is now available for download as source or binary (with and without
      dependencies) from
      http://ant.apache.org/bindownload.cgi.

Key features of the 1.8.2 release are

performance improvements in directory scanning

XSLT task honors classpath again (bugrep 49271)

distinction between core tasks and optional tasks is abolished

numerous bug fixes and improvements as documented in Bugzilla
        and in WHATSNEW

      Apache Ivy 2.2.0

September 30, 2010 - Apache Ivy 2.2.0 Released

Apache Ivy 2.2.0 is now available for download as source or binary (with and without
      dependencies) from
      http://ant.apache.org/ivy/download.cgi.

Key features of the 2.2.0 release are

enhanced Maven2 compatibility, with several bug fixes and
        more pom features covered

new parent mechanism for Ivy files

improved pom generation from an ivy.xml file

automated PGP signature generation when uploading artifacts

numerous bug fixes and improvements as documented in Jira
        and in the release notes

For more information see
      the Ivy home page.

      Apache Ant 1.8.1

May 7th, 2010 - Apache Ant 1.8.1 Released

Apache Ant 1.8.1 is now available for download as source or binary (with and without
      dependencies) from
      http://ant.apache.org/bindownload.cgi.

Key features of the 1.8.1 release are

new task augment allows to add attributes or nested elements to previously defined references

numerous bug fixes and improvements as documented in Bugzilla
        and in WHATSNEW

      Apache Ant 1.8.0

Februrary 8th, 2010 - Apache Ant 1.8.0 Released

Key features of the 1.8.0 release are

Lexically scoped local properties, i.e. properties that are only defined inside a target,
      sequential block or similar environment. This is very useful inside
      of <macrodef>s where a macro can now define a temporary property
      that will disappear once the task has finished.

<import> can now import from any file- or URL-providing resource -
      this includes <javaresource>.
      This means <import> can read build file snippets from JARs or fixed server URLs.
      There are several other improvements in the area of import.

Various improvements to the directory scanning code that help with symbolic link
      cycles (as can be found on MacOS X Java installations for example) and improve
      scanning performance. For big directory trees the improvement is
      dramatic.

The way developers can extend Ant's property expansion algorithm has been rewritten
      (breaking the older API) to be easier to use and be more powerful.
      The whole local properties mechanism is implemented using that API and could be
      implemented in a separate library without changes in Ant's core.
      Things like the yet-to-be-released props Antlib can now provide often required
      "scripty" fuctions without touching Ant itself.
      At the same time the if and unless attributes have been rewritten to do the expected
      thing if applied to a property expansion (i.e. if="${foo}" will mean "yes, do it"
      if ${foo} expands to true, in Ant 1.7.1 it would mean "no" unless a property named
      "true" existed). This adds "testing conditions" as a new use-case to property
      expansion.

A new top-level element <extension-point>  assists in writing re-usable
      build files that are meant to be imported. <extension-point> has a name
      and a dependency-list like <target> and can be used like a <target>
      from the command line or a dependency-list but the importing build file can add
      targets to the <extension-point>'s depends list.

Ant now requires Java 1.4 or later

new task include provides an alternative to <import> that
   should be preferred when you don't want to override any targets

numerous bug fixes and improvements as documented in Bugzilla
        and in WHATSNEW

      Apache Ivy 2.1.0

October 8, 2009 - Apache Ivy 2.1.0 Released

Key features of the 2.1.0 release are

enhanced Maven2 compatibility, with several bug fixes and
        more pom features covered

new options for the Ivy Ant tasks and commandline

configuration intersections and configuration groups

numerous bug fixes and improvements as documented in Jira
        and in the release notes

For more information see
      the Ivy home page.

      Apache IvyDE 2.0.0

July 13, 2009 - Apache IvyDE 2.0.0 Released

Apache IvyDE 2.0.0 is now available for download from
        http://ant.apache.org/ivy/ivyde/download.cgi
        or directly from the updatesite
        http://www.apache.org/dist/ant/ivyde/updatesite

This is the first release considered as stable since the project as been hosted
        by the Apache Software Foundation.

Major changes in this release:

the "resolve in workspace" feature (make IvyDE search for Ivy dependencies
directly into the Eclipse projects) has been introduced in the last release
but was quite experimental. It has been refactored to be more reliable and
have been reported to be working like a charm by some of the IvyDE early users.

the user documentation of IvyDE is now available directly into the Eclipse help center.

IvyDE can now load property files along with the Ivy settings.

For more information see
      the IvyDE home page.

      Apache Ivy 2.0.0

January 20, 2009 - Apache Ivy 2.0.0 Released

Apache Ivy 2.0.0 (final) is now available for download as source or binary (with and without
      dependencies) from
      http://ant.apache.org/ivy/download.cgi.

This is the first non-beta release of Ivy under Apache and includes some major new features
      like: enhanced Maven2 compatibility, improved cache management, improved concurrency support
      and numerous bug fixes and other improvements.

For more information see the Ivy home page.

      Apache AntUnit 1.1

September 26, 2008 - Apache AntUnit 1.1 Released

Apache AntUnit 1.1 is now available for download as binary
      or source
      release.

In addition to a few bugfixes and some new assertions AntUnit
      1.1 allows test listeners to receive the log output of the
      project under test.  Both plainlistener and xmllistener have
      an option that makes them echo the project's output into their
      respective logs.

For more information see the Antlib's
        home page

      Apache AntUnit 1.1 Beta 1

September 3, 2008 - Apache AntUnit 1.1 Beta 1 Available

      Apache Ant 1.7.1

June 27, 2008 - Apache Ant 1.7.1 Available

Apache Ant 1.7.1 is now available for download.

 Ant 1.7.1 is mainly a bugfix release.

Ant 1.7.1 has extended support for Java6 features.

 Ant 1.7.1 <script> now has support for JavaFX.

      Apache Ivy is an Ant Sub-Project Now!

October 11, 2007 - Apache Ivy is an Ant Sub-Project Now!

Apache Ivy, "A Java based tool for tracking, resolving and
    managing project dependencies.", just finished Incubation and has joined
    the Ant project.  More information will be available from the Ant
    site soon.

Until we've finished the migration, you can learn more about
    Ivy from its Incubator
    website.

      Apache AntUnit 1.0

January 8, 2007 - Apache AntUnit 1.0 Available

Apache AntUnit 1.0 is now available for download.

This Ant Library contains tasks to test Ant tasks using Ant
    instead of JUnit.  For more information see the AntUnit home page.

      Apache Ant 1.7.0

December 19, 2006 - Apache Ant 1.7.0 Available

Apache Ant 1.7.0 is now available for download.

 Ant 1.7 introduces a resource framework. Some of the core ant
    tasks such as <copy/> are now able to process not only file
    system resources but also zip entries, tar entries, paths, ...
    Resource collections group resources, and can be further
    combined with operators such as union and intersection. This
    can be extended by custom resources and custom tasks using resources.

    Ant 1.7 starts outsourcing of optional tasks to Antlibs.
    The .NET antlib in preparation will replace the .NET optional tasks which ship in Ant.
    Support for the version control system Subversion will be only provided as an antlib to
    be released shortly.

Ant 1.7 fixes also a large number of bugs.

Ant 1.7 has some initial support for Java6 features.

      Apache .NET Ant Library 1.0Beta1

November 6, 2006 - Apache .NET Ant Library 1.0 Available

Apache .NET Ant Library 1.0 is now available for download.

This Ant Library contains support for tools like NUnit as well
    as the "old" .NET tasks of Ant's core.  It has been tested
    Microsoft's frameworks as well as Mono.

For more information see the Antlib's
    home page

      Apache AntUnit 1.0Beta2

October 29, 2006 - Apache AntUnit 1.0Beta2 Available

Apache AntUnit 1.0Beta1 is now available for download.

This Ant Library contains tasks to test Ant tasks using Ant
    instead of JUnit.  For more information see the AntUnit home page.

      Apache AntUnit 1.0Beta1

September 22, 2006 - Apache AntUnit 1.0Beta1 Available

Apache AntUnit 1.0Beta1 is now available for download.

This Ant Library contains tasks to test Ant tasks using Ant
    instead of JUnit.  For more information see the AntUnit home page.

      Apache .NET Ant Library 1.0Beta1

September 13, 2006 - Apache .NET Ant Library 1.0Beta1 Available

Apache .NET Ant Library 1.0Beta1 is now available for download.

This Ant Library contains support for tools like NUnit as well
    as the "old" .NET tasks of Ant's core.  It has been tested
    Microsoft's frameworks as well as Mono.

For more information see the Antlib's
    home page

      Apache Ant 1.6.5

June 2, 2005 - Apache Ant 1.6.5 Available

Apache Ant 1.6.5 is now available for download.

This is a bug fix release.

      Apache Ant 1.6.4

May 19, 2005 - Apache Ant 1.6.4 Available

Apache Ant 1.6.4 is now available for download.

This is a bug fix release.

      Apache Ant 1.6.3

April 28, 2005 - Apache Ant 1.6.3 Available

Apache Ant 1.6.3 is now available for download.

There is a large list of fixed bugs and enhancements.

Some of the bugs affecting the embedded use of Ant are fixed.

      Apache Antidote Retired

April 4th, 2005 - The Apache Ant Project Retires Apache Antidote, the
    Ant GUI

The Antidote subproject was once started to provide a GUI for
    Ant at a time where IDE support for Ant was far from usable.
    Unfortunately it never attracted a developer community of its
    own.

At the same time IDE support for Ant has become ubiquitous by
    now and there is little reason to have a GUI just for Ant.  This
    makes it even less likely that volunteers will start to spend time
    working on it.

Antidote's development has been stalled for years now, despite
    some efforts to rejuvenate it by single developers.  Therefore the
    Ant developers have chosen to retire Antidote.

Antidote will no longer be developed by the Ant project; its
    CVS module will be shut down.

If you are interested in Antidote's sources to learn from or
    build on it, you can find snapshots at http://archive.apache.org/ant/antidote/.

      Apache Ant 1.6.2

July 16, 2004 - Apache Ant 1.6.2 Available

Apache Ant 1.6.2 available for download.

Nested elements for namespaced tasks and types may belong to the
Ant default namespace as well as the task's or type's namespace.

All exceptions thrown by tasks are now wrapped in a
buildexception giving the location in the buildfile of the task.

Ant 1.6.2 fixes a large number of bugs and adds a number of
features which were asked for by users on Bugzilla.

      Wiki Migration

February 29, 2004

The Apache Ant Wiki pages have been migrated to their
      new home on the Apache
      Wiki farm.

      Apache Ant 1.6.1

February 12, 2004 - Apache Ant 1.6.1 Available

Apache Ant 1.6.1 is still available for
      download.

The ASF Board has approved the new Apache License 2.0.
    For a copy of that license, please see

    http://www.apache.org/licenses/.

The Ant 1.6.1 release is delivered with the
    Apache License 2.0.

Ant 1.6.1 fixes several bugs, most notably the handling
    of the default namespace for nested elements.

Ant 1.6.1 also introduces initial support for compiling with
    Java 1.5.

      Apache Ant 1.6.0

December 18, 2003 - Apache Ant 1.6.0 Available

Apache Ant 1.6.0 is still available for
      download.

As
    we've already said in the announcements of Ant 1.5.4, this release
    requires JDK 1.2 or later to run.

Ant 1.6.0 adds a lot of new features, most prominently support
    for XML namespaces as well as a new concept of Ant libraries that
    makes use of namespaces to avoid name clashes of custom tasks.
    For a longer list of fixed bugs and new features see the release
    notes.

If you find anything that hasn't been covered in the manual (I bet you
did) or could be explained better, feel free to help us out in the
Wiki.

      Apache Ant 1.5.4

August 12, 2003 - Apache Ant 1.5.4 Available

Apache Ant 1.5.4 is still available for
     download.

This is a minor bugfix release that fixes a problem with the
    javah task on JDK 1.4.2 and a couple of bugs in the
    Visual Age for Java intergration tasks.  If you don't use javah or
    VAJ, there is no reason to upgrade.

Note

Ant 1.5.4 is the last release that supports
      JDK 1.1. Ant 1.6.0 requires JDK 1.2 or
      later.

      Java Pro 2003 Readers Choice Award

June 11th, 2003: Apache Ant wins a Java Pro readers' choice award

      Ant has won the Java Pro 2003 Readers' Choice Award for

      Most Valuable Java Deployment Technology.

      Thanks to Java Pro and all its readers. You can read about
      these
      awards
      at the Java Pro website.

      JDJ Editors Choice Award

June 2003: Apache Ant wins JDJ Editors' Choice Award

"Ant is the hammer of the Java world: without it, civilization might have progressed, but much more slowly than it has. Ant is one of the most useful build tools I have ever had the pleasure to use." - Joe Ottinger

      Apache Ant keeps on winning!

June 9th, 2003: Apache Ant wins the JavaWorld Editors' Choice Award

    Ant has won the JavaWorld Editors' Choice Award for

    Most Useful Java Community-Developed Technology

    for the second time in a row! Read the
     full article -- or jump directly to the bit about
     our award :)

      Apache Ant 1.5.3

April 9, 2003 - Apache Ant 1.5.3 Available

Apache Ant 1.5.3 is still available for
     download.

      Apache Ant 1.5.2

March 3, 2003 - Apache Ant 1.5.2 Available!

The final version of Ant 1.5.2 is available for
     download.
     If you have any feedback on this release, feel free to join the
     discussion on the dev and user mailing lists.

      Apache Ant Top Level Project

November 18, 2002

The Apache board created
       the Apache Ant top level project. Ant has now migrated from the Jakarta
       project into an Apache project of its own. This is primarily an
       organizational change and will not affect the technical aspects of
       the project. Ant retains a strong association with the Apache
       Jakarta project. One effect of this change is that the Ant webpage
       is now located at http://ant.apache.org/

      Apache Ant 1.5.1

October 3, 2002 - Apache Ant 1.5.1 Available !

The final version of Ant 1.5.1 is still available for

     download. If you have any feedback on this release, feel free to join the
     discussion on the ant-dev and ant-user mailing lists.

      Apache Ant 1.5

July 15, 2002 - Fix for Cygwin problem in wrapper script available

The wrapper script of Apache Ant 1.5 needs to be replaced with a new
      version for Cygwin users.  See the FAQ for details.

July 10, 2002 - Apache Ant 1.5 Released!

The final version of Ant 1.5 is now available for

     download. If you have any feedback on this release, feel free to join the
     discussion on the ant-dev and ant-user mailing lists.

      Apache Ant wins again!

Apr 29, 2002: Apache Ant wins Software Development magazine's
    2002 Productivity Award.

    Ant has been awarded a 2002 Productivity Award by
    Software Development
    magazine.  Read the

    press release for more information and the full list of winners.

      Apache Ant has won!

Mar 26, 2002: Apache Ant wins the JavaWorld Editors' Choice
    Award

    Ant has won the JavaWorld Editors' Choice Award for
    Most Useful Java Community-Developed Technology.
    Read the
     full article -- or jump directly to the bit about
     our award :)

      Java 1.4 Support

Feb 15, 2002: Java 1.4 Support

      Java 1.4 has now been released by Sun. The latest Apache Ant source supports
      the new <tt>assert</tt> statement in the compiler task via the <tt>source</tt>
      attribute. It also contains a compatibility fix needed for some ant tasks
      on Java 1.4 over Windows XP. If you have problems running Ant 1.4.1 on WinXP/Java 1.4,
      please use a recent build or compile your own version from the source tree.

      See our new logo!

Have a look at our new cool logo!

      Apache Ant 1.4.1

11 October 2001 Apache Ant 1.4.1 released !

Please visit the

     download area.

      Best-Practices Profile of Apache Ant at Sun's Dot-Com Builder

Sun has released an introductory article on Apache Ant on their
      Dot-Com Builder site on May 30 2001. See http://dcb.sun.com/practices/profiles/ant.jsp

      Apache Ant, Apache Ivy, Ant, Ivy, Apache, the Apache feather logo, and the Apache Ant project logos are trademarks of The Apache Software Foundation.


text:
<?php

define ( 'DS', DIRECTORY_SEPARATOR );
define ( 'CRLF', chr ( 13 ) . chr ( 10 ) );

setup_autoloader ();

// Load the base functions
require COREPATH . 'base.php';

/**
 * Do we have access to mbstring?
 * We need this in order to work with UTF-8 strings
 */
define ( 'MBSTRING', function_exists ( 'mb_get_info' ) );

/**
 * Load the Composer autoloader if present
 */
defined ( 'VENDORPATH' ) or define ( 'VENDORPATH', realpath ( COREPATH . '..' . DS . 'vendor' ) . DS );
if (! is_file ( VENDORPATH . 'autoload.php' )) {
	die ( 'Composer is not installed. Please run "php composer.phar update" in the root to install Composer' );
}
require VENDORPATH . 'autoload.php';

/**
 * Register all the error/shutdown handlers
 */
register_shutdown_function ( function () {
	// reset the autoloader
	\Autoloader::_reset ();

	// make sure we're having an output filter so we can display errors
	// occuring before the main config file is loaded
	\Config::get ( 'security.output_filter', null ) or \Config::set ( 'security.output_filter', 'Security::htmlentities' );

	try {
		// fire any app shutdown events
		\Event::instance ()->trigger ( 'shutdown', '', 'none', true );

		// fire any framework shutdown events
		\Event::instance ()->trigger ( 'fuel-shutdown', '', 'none', true );
	} catch ( \Exception $e ) {
		if (\Fuel::$is_cli) {
			\Cli::error ( "Error: " . $e->getMessage () . " in " . $e->getFile () . " on " . $e->getLine () );
			\Cli::beep ();
			exit ( 1 );
		}
	}
	return \Error::shutdown_handler ();
} );

set_exception_handler ( function (\Exception $e) {
	// reset the autoloader
	\Autoloader::_reset ();

	// deal with PHP bugs #42098/#54054
	if (! class_exists ( 'Error' )) {
		include COREPATH . 'classes/error.php';
		class_alias ( '\Fuel\Core\Error', 'Error' );
		class_alias ( '\Fuel\Core\PhpErrorException', 'PhpErrorException' );
	}

	return \Error::exception_handler ( $e );
} );

set_error_handler ( function ($severity, $message, $filepath, $line) {
	// reset the autoloader
	\Autoloader::_reset ();

	// deal with PHP bugs #42098/#54054
	if (! class_exists ( 'Error' )) {
		include COREPATH . 'classes/error.php';
		class_alias ( '\Fuel\Core\Error', 'Error' );
		class_alias ( '\Fuel\Core\PhpErrorException', 'PhpErrorException' );
	}

	return \Error::error_handler ( $severity, $message, $filepath, $line );
} );
function setup_autoloader() {
	Autoloader::add_namespace ( 'Fuel\\Core', COREPATH . 'classes/' );

	Autoloader::add_namespace ( 'PHPSecLib', COREPATH . 'vendor' . DS . 'phpseclib' . DS, true );

	Autoloader::add_classes ( array (
			'Fuel\\Core\\Agent' => COREPATH . 'classes/agent.php',

			'Fuel\\Core\\Arr' => COREPATH . 'classes/arr.php',

			'Fuel\\Core\\Asset' => COREPATH . 'classes/asset.php',
			'Fuel\\Core\\Asset_Instance' => COREPATH . 'classes/asset/instance.php',

			'Fuel\\Core\\Cache' => COREPATH . 'classes/cache.php',
			'Fuel\\Core\\CacheNotFoundException' => COREPATH . 'classes/cache/notfound.php',
			'Fuel\\Core\\CacheExpiredException' => COREPATH . 'classes/cache.php',
			'Fuel\\Core\\Cache_Handler_Driver' => COREPATH . 'classes/cache/handler/driver.php',
			'Fuel\\Core\\Cache_Handler_Json' => COREPATH . 'classes/cache/handler/json.php',
			'Fuel\\Core\\Cache_Handler_Serialized' => COREPATH . 'classes/cache/handler/serialized.php',
			'Fuel\\Core\\Cache_Handler_String' => COREPATH . 'classes/cache/handler/string.php',
			'Fuel\\Core\\Cache_Storage_Driver' => COREPATH . 'classes/cache/storage/driver.php',
			'Fuel\\Core\\Cache_Storage_Apc' => COREPATH . 'classes/cache/storage/apc.php',
			'Fuel\\Core\\Cache_Storage_File' => COREPATH . 'classes/cache/storage/file.php',
			'Fuel\\Core\\Cache_Storage_Memcached' => COREPATH . 'classes/cache/storage/memcached.php',
			'Fuel\\Core\\Cache_Storage_Redis' => COREPATH . 'classes/cache/storage/redis.php',

			'Fuel\\Core\\Config' => COREPATH . 'classes/config.php',
			'Fuel\\Core\\ConfigException' => COREPATH . 'classes/config.php',
			'Fuel\\Core\\Config_Db' => COREPATH . 'classes/config/db.php',
			'Fuel\\Core\\Config_File' => COREPATH . 'classes/config/file.php',
			'Fuel\\Core\\Config_Ini' => COREPATH . 'classes/config/ini.php',
			'Fuel\\Core\\Config_Json' => COREPATH . 'classes/config/json.php',
			'Fuel\\Core\\Config_Interface' => COREPATH . 'classes/config/interface.php',
			'Fuel\\Core\\Config_Php' => COREPATH . 'classes/config/php.php',
			'Fuel\\Core\\Config_Yml' => COREPATH . 'classes/config/yml.php',

			'Fuel\\Core\\Controller' => COREPATH . 'classes/controller.php',
			'Fuel\\Core\\Controller_Rest' => COREPATH . 'classes/controller/rest.php',
			'Fuel\\Core\\Controller_Template' => COREPATH . 'classes/controller/template.php',
			'Fuel\\Core\\Controller_Hybrid' => COREPATH . 'classes/controller/hybrid.php',

			'Fuel\\Core\\Cookie' => COREPATH . 'classes/cookie.php',

			'Fuel\\Core\\DB' => COREPATH . 'classes/db.php',
			'Fuel\\Core\\DBUtil' => COREPATH . 'classes/dbutil.php',

			'Fuel\\Core\\Database_Connection' => COREPATH . 'classes/database/connection.php',
			'Fuel\\Core\\Database_Exception' => COREPATH . 'classes/database/exception.php',
			'Fuel\\Core\\Database_Expression' => COREPATH . 'classes/database/expression.php',
			'Fuel\\Core\\Database_Pdo_Connection' => COREPATH . 'classes/database/pdo/connection.php',
			'Fuel\\Core\\Database_Query' => COREPATH . 'classes/database/query.php',
			'Fuel\\Core\\Database_Query_Builder' => COREPATH . 'classes/database/query/builder.php',
			'Fuel\\Core\\Database_Query_Builder_Insert' => COREPATH . 'classes/database/query/builder/insert.php',
			'Fuel\\Core\\Database_Query_Builder_Delete' => COREPATH . 'classes/database/query/builder/delete.php',
			'Fuel\\Core\\Database_Query_Builder_Update' => COREPATH . 'classes/database/query/builder/update.php',
			'Fuel\\Core\\Database_Query_Builder_Select' => COREPATH . 'classes/database/query/builder/select.php',
			'Fuel\\Core\\Database_Query_Builder_Where' => COREPATH . 'classes/database/query/builder/where.php',
			'Fuel\\Core\\Database_Query_Builder_Join' => COREPATH . 'classes/database/query/builder/join.php',
			'Fuel\\Core\\Database_Result' => COREPATH . 'classes/database/result.php',
			'Fuel\\Core\\Database_Result_Cached' => COREPATH . 'classes/database/result/cached.php',
			'Fuel\\Core\\Database_Mysql_Connection' => COREPATH . 'classes/database/mysql/connection.php',
			'Fuel\\Core\\Database_MySQL_Result' => COREPATH . 'classes/database/mysql/result.php',
			'Fuel\\Core\\Database_Mysqli_Connection' => COREPATH . 'classes/database/mysqli/connection.php',
			'Fuel\\Core\\Database_MySQLi_Result' => COREPATH . 'classes/database/mysqli/result.php',

			'Fuel\\Core\\Fuel' => COREPATH . 'classes/fuel.php',
			'Fuel\\Core\\FuelException' => COREPATH . 'classes/fuel.php',

			'Fuel\\Core\\Finder' => COREPATH . 'classes/finder.php',

			'Fuel\\Core\\Date' => COREPATH . 'classes/date.php',

			'Fuel\\Core\\Debug' => COREPATH . 'classes/debug.php',

			'Fuel\\Core\\Cli' => COREPATH . 'classes/cli.php',

			'Fuel\\Core\\Crypt' => COREPATH . 'classes/crypt.php',

			'Fuel\\Core\\Event' => COREPATH . 'classes/event.php',
			'Fuel\\Core\\Event_Instance' => COREPATH . 'classes/event/instance.php',

			'Fuel\\Core\\Error' => COREPATH . 'classes/error.php',
			'Fuel\\Core\\PhpErrorException' => COREPATH . 'classes/error.php',

			'Fuel\\Core\\Format' => COREPATH . 'classes/format.php',

			'Fuel\\Core\\Fieldset' => COREPATH . 'classes/fieldset.php',
			'Fuel\\Core\\Fieldset_Field' => COREPATH . 'classes/fieldset/field.php',

			'Fuel\\Core\\File' => COREPATH . 'classes/file.php',
			'Fuel\\Core\\FileAccessException' => COREPATH . 'classes/file.php',
			'Fuel\\Core\\OutsideAreaException' => COREPATH . 'classes/file.php',
			'Fuel\\Core\\InvalidPathException' => COREPATH . 'classes/file.php',
			'Fuel\\Core\\File_Area' => COREPATH . 'classes/file/area.php',
			'Fuel\\Core\\File_Handler_File' => COREPATH . 'classes/file/handler/file.php',
			'Fuel\\Core\\File_Handler_Directory' => COREPATH . 'classes/file/handler/directory.php',

			'Fuel\\Core\\Form' => COREPATH . 'classes/form.php',
			'Fuel\\Core\\Form_Instance' => COREPATH . 'classes/form/instance.php',

			'Fuel\\Core\\Ftp' => COREPATH . 'classes/ftp.php',
			'Fuel\\Core\\FtpConnectionException' => COREPATH . 'classes/ftp.php',
			'Fuel\\Core\\FtpFileAccessException' => COREPATH . 'classes/ftp.php',

			'Fuel\\Core\\HttpException' => COREPATH . 'classes/httpexception.php',
			'Fuel\\Core\\HttpNotFoundException' => COREPATH . 'classes/httpexceptions.php',
			'Fuel\\Core\\HttpServerErrorException' => COREPATH . 'classes/httpexceptions.php',

			'Fuel\\Core\\Html' => COREPATH . 'classes/html.php',

			'Fuel\\Core\\Image' => COREPATH . 'classes/image.php',
			'Fuel\\Core\\Image_Driver' => COREPATH . 'classes/image/driver.php',
			'Fuel\\Core\\Image_Gd' => COREPATH . 'classes/image/gd.php',
			'Fuel\\Core\\Image_Imagemagick' => COREPATH . 'classes/image/imagemagick.php',
			'Fuel\\Core\\Image_Imagick' => COREPATH . 'classes/image/imagick.php',

			'Fuel\\Core\\Inflector' => COREPATH . 'classes/inflector.php',

			'Fuel\\Core\\Input' => COREPATH . 'classes/input.php',

			'Fuel\\Core\\Lang' => COREPATH . 'classes/lang.php',
			'Fuel\\Core\\LangException' => COREPATH . 'classes/lang.php',
			'Fuel\\Core\\Lang_Db' => COREPATH . 'classes/lang/db.php',
			'Fuel\\Core\\Lang_File' => COREPATH . 'classes/lang/file.php',
			'Fuel\\Core\\Lang_Ini' => COREPATH . 'classes/lang/ini.php',
			'Fuel\\Core\\Lang_Json' => COREPATH . 'classes/lang/json.php',
			'Fuel\\Core\\Lang_Interface' => COREPATH . 'classes/lang/interface.php',
			'Fuel\\Core\\Lang_Php' => COREPATH . 'classes/lang/php.php',
			'Fuel\\Core\\Lang_Yml' => COREPATH . 'classes/lang/yml.php',

			'Fuel\\Core\\Log' => COREPATH . 'classes/log.php',

			'Fuel\\Core\\Markdown' => COREPATH . 'classes/markdown.php',

			'Fuel\\Core\\Migrate' => COREPATH . 'classes/migrate.php',

			'Fuel\\Core\\Model' => COREPATH . 'classes/model.php',
			'Fuel\\Core\\Model_Crud' => COREPATH . 'classes/model/crud.php',

			'Fuel\\Core\\Module' => COREPATH . 'classes/module.php',
			'Fuel\\Core\\ModuleNotFoundException' => COREPATH . 'classes/module.php',

			'Fuel\\Core\\Mongo_Db' => COREPATH . 'classes/mongo/db.php',
			'Fuel\\Core\\Mongo_DbException' => COREPATH . 'classes/mongo/db.php',

			'Fuel\\Core\\Output' => COREPATH . 'classes/output.php',

			'Fuel\\Core\\Package' => COREPATH . 'classes/package.php',
			'Fuel\\Core\\PackageNotFoundException' => COREPATH . 'classes/package.php',

			'Fuel\\Core\\Pagination' => COREPATH . 'classes/pagination.php',

			'Fuel\\Core\\Profiler' => COREPATH . 'classes/profiler.php',

			'Fuel\\Core\\Request' => COREPATH . 'classes/request.php',
			'Fuel\\Core\\Request_Driver' => COREPATH . 'classes/request/driver.php',
			'Fuel\\Core\\RequestException' => COREPATH . 'classes/request/driver.php',
			'Fuel\\Core\\RequestStatusException' => COREPATH . 'classes/request/driver.php',
			'Fuel\\Core\\Request_Curl' => COREPATH . 'classes/request/curl.php',
			'Fuel\\Core\\Request_Soap' => COREPATH . 'classes/request/soap.php',

			'Fuel\\Core\\Redis_Db' => COREPATH . 'classes/redis/db.php',
			'Fuel\\Core\\RedisException' => COREPATH . 'classes/redis/db.php',

			'Fuel\\Core\\Response' => COREPATH . 'classes/response.php',

			'Fuel\\Core\\Route' => COREPATH . 'classes/route.php',
			'Fuel\\Core\\Router' => COREPATH . 'classes/router.php',

			'Fuel\\Core\\Security' => COREPATH . 'classes/security.php',
			'Fuel\\Core\\SecurityException' => COREPATH . 'classes/security.php',

			'Fuel\\Core\\Session' => COREPATH . 'classes/session.php',
			'Fuel\\Core\\Session_Driver' => COREPATH . 'classes/session/driver.php',
			'Fuel\\Core\\Session_Db' => COREPATH . 'classes/session/db.php',
			'Fuel\\Core\\Session_Cookie' => COREPATH . 'classes/session/cookie.php',
			'Fuel\\Core\\Session_File' => COREPATH . 'classes/session/file.php',
			'Fuel\\Core\\Session_Memcached' => COREPATH . 'classes/session/memcached.php',
			'Fuel\\Core\\Session_Redis' => COREPATH . 'classes/session/redis.php',
			'Fuel\\Core\\Session_Exception' => COREPATH . 'classes/session/exception.php',

			'Fuel\\Core\\Num' => COREPATH . 'classes/num.php',

			'Fuel\\Core\\Str' => COREPATH . 'classes/str.php',

			'Fuel\\Core\\TestCase' => COREPATH . 'classes/testcase.php',

			'Fuel\\Core\\Theme' => COREPATH . 'classes/theme.php',
			'Fuel\\Core\\ThemeException' => COREPATH . 'classes/theme.php',

			'Fuel\\Core\\Uri' => COREPATH . 'classes/uri.php',

			'Fuel\\Core\\Unzip' => COREPATH . 'classes/unzip.php',

			'Fuel\\Core\\Upload' => COREPATH . 'classes/upload.php',

			'Fuel\\Core\\Validation' => COREPATH . 'classes/validation.php',
			'Fuel\\Core\\Validation_Error' => COREPATH . 'classes/validation/error.php',

			'Fuel\\Core\\View' => COREPATH . 'classes/view.php',
			'Fuel\\Core\\ViewModel' => COREPATH . 'classes/viewmodel.php'
	) );
}
;


text:
namespace Iris.DomainClasses
{
    public abstract class BaseEntity
    {
        public int Id { get; set; }
    }
}


text:
<?php namespace App\Action\Acp;

use App\Domain\Sort;
use App\Domain\SortDirection;
use App\Utilities\UrlHelper;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;

class ApplyIndexGoodsAction
{
    public function __construct(
        private GetSortDirAction $getSortDir,
        private GetSortKeyAction $getSortKey,
        private Request $request,
        private UrlHelper $urlHelper,
    ) {
    }

    public function execute(
        Model $model,
        Sort $defaultSort = new Sort('id', SortDirection::Desc),
    ): Sort {
        $modelTpl = str($model::class)
            ->replace('App\\', '')
            ->explode('\\')
            ->map(fn ($string) => \Str::snake($string, '-'))
            ->implode('.');

        $sortDir = $this->getSortDir->execute($defaultSort->toString());
        $sortKey = $this->getSortKey->execute($defaultSort->toString());

        $sort = new Sort($sortKey, SortDirection::from($sortDir));

        $this->urlHelper->setSort($sort);

        view()->share([
            'q' => $this->request->input('q'),
            'model' => $model,
            'sortDir' => $sort->direction->value,
            'sortKey' => $sort->key,
            'modelTpl' => $modelTpl,
        ]);

        return $sort;
    }
}


text:
(function($) {

  "use strict";

  $(window).on('load', function() {

  /*Page Loader active
    ========================================================*/
    $('#preloader').fadeOut();

  // Sticky Nav
    $(window).on('scroll', function() {
        if ($(window).scrollTop() > 200) {
            $('.scrolling-navbar').addClass('top-nav-collapse');
        } else {
            $('.scrolling-navbar').removeClass('top-nav-collapse');
        }
    });

    /* ==========================================================================
       countdown timer
       ========================================================================== */
     jQuery('#clock').countdown('2018/06/21',function(event){
      var $this=jQuery(this).html(event.strftime(''
      +'
%-D Days
 '
      +'
%H Hours
 '
      +'
%M Minutes
 '
      +'
%S Seconds
 '));
    });

    /* slicknav mobile menu active  */
    $('.mobile-menu').slicknav({
        prependTo: '.navbar-header',
        parentTag: 'liner',
        allowParentLinks: true,
        duplicate: true,
        label: '',
      });

      /* WOW Scroll Spy
    ========================================================*/
     var wow = new WOW({
      //disabled for mobile
        mobile: false
    });
    wow.init();

    /* Nivo Lightbox
    ========================================================*/
    $('.lightbox').nivoLightbox({
        effect: 'fadeScale',
        keyboardNav: true,
      });
      $(function () {
        $('[data-toggle="popover"]').popover()
      });

    // one page navigation
    $('.navbar-nav').onePageNav({
            currentClass: 'active'
    });

    /* Back Top Link active
    ========================================================*/
      var offset = 200;
      var duration = 500;
      $(window).scroll(function() {
        if ($(this).scrollTop() > offset) {
          $('.back-to-top').fadeIn(400);
        } else {
          $('.back-to-top').fadeOut(400);
        }
      });

      $('.back-to-top').on('click',function(event) {
        event.preventDefault();
        $('html, body').animate({
          scrollTop: 0
        }, 600);
        return false;
      });
      $(window).scroll(function(){
        var top_of_element = $("faq").offset().top;
        var bottom_of_element = $("faq").offset().top + $("faq").outerHeight();
        var bottom_of_screen = $(window).scrollTop() + $(window).innerHeight();
        var top_of_screen = $(window).scrollTop();

      if((bottom_of_screen > top_of_element) && (top_of_screen < bottom_of_element)){

        var x = document.getElementById("faq-header");
        x.style.display="none";
      }
    else{
      var x = document.getElementById("faq-header");
        x.style.display="block";
    }

  });

  });

}(jQuery));


text:
@class NSString, USActionMap;

@protocol USActionHandlerDelegate <NSObject>
- (_Bool)shouldExecuteActionOfType:(NSString *)arg1 fromMap:(USActionMap *)arg2;
@end


text:
Trying to create more or less realistic economics for Factorio

##Why do I need this?
I want to enrich gameplay in Factorio, especially midgame and lategame stages. Biter massacre and rocket building are good, but I want to add new goal - to create successful company and conquer the market. Even if you are not into this kind of stuff, market can be helpful. Don't want to spend your time messing around with blue science or have oil shortage, but have giant iron deposit inside your walls? Constant biter attacks depleted your ammo, walls and turret reserves, but you have ten steel chests of speed modules? Sell excess supply and eliminate shortage.
I know about GalacticTrade mod, but it seems abandoned. I also want to practice my Lua coding skills, so I decided to create this mod from scratch.

##Planned features:
- Advanced economic model (No more "buy from Elysium / sell to Oblivion", except if you want it). Prices will be affected by supply and demand. If you instantly fill market with tons of copper ore, its price will drop beyond production cost.
- Dynamic market. Supply and demand will change over time. Market with big copper surplus from example above will attract copper plate manufacturers. If you stop producing copper ore, they will have shortages and copper ore price will increase, resulting in creation of new copper ore providers.
- Reputation and interaction.

##TODO:
- **Items, entities and recipes**
  - [x] Basic buyer and seller chests (similar to vanilla smart chest)
  - [ ] Logistic buyer and seller chests (active and passive provider as buyer, requester and storage as seller)
  - [ ] Technology tree integration
  - [ ] Graphics and icons
- **Base game integration**
  - [ ] Basic market statistics, price and quantity tables
  - [ ] Prime cost calculation based on raw resources, electricity and technological complexity (will run once at the start of a new game)
  - [ ] Link between chests and market, basic chest content cost calculation
- **Dynamic market**
  - [ ] Basic market analysis tools
  - [ ] Agents and automatic creation and destruction of companies
  - [ ] Price, supply and demand connection
- **Bank and market policy**
  - [ ] Credits and deposits
  - [ ] Investments into new companies or another projects
  - [ ] Reputation
- **GUI**
  - [ ] Chests GUI
  - [ ] Market overview GUI


text:
APP = add-product

SRC = main.c
EXTERN_OBJ = "../common/eprintf.o"

include ../config.mk
include ../default.mk

LDFLAGS += -lsqlite3


text:
import {forceStartWith} from "./strings"
import messages from "../messages"
import {logout} from "../session/sessionActions"
import {sessionStore} from "../session/sessionStore"

type Method = "GET" | "POST" | "PUT" | "DELETE"

interface RequestParameters {
  method: Method
  url: string
  entity?: any,
  headers?: Array<[string, string]>
}

export function request<T>(parameters: RequestParameters): Promise<T> {
  const {method, url, entity} = parameters
  const session = sessionToken()
  return new Promise((resolve, reject) => {
    const xhr = new XMLHttpRequest()
    xhr.open(method, realUrl(url), true)
    xhr.setRequestHeader("Content-Type", "application/json")
    if (session) {
      xhr.setRequestHeader("Authorization", `Basic ${session}`)
    }
    if (parameters.headers) {
      parameters.headers.forEach(header => xhr.setRequestHeader(header[0], header[1]))
    }

    xhr.onreadystatechange = () => {
      if (xhr.readyState == 4) {
        if (xhr.status == 200) {
          try {
            resolve(JSON.parse(xhr.responseText))
          } catch (e) {
            resolve(xhr.response)
          }
        } else if (xhr.status == 0) {
          console.error("Server seems offline")
          reject([messages.http.serverError])
        } else {
          if (xhr.status == 401 || xhr.status == 403) {
            console.error(`Not enough rights to do the action ${JSON.stringify(parameters)} (status: ${xhr.status})`)
            logout()
            reject([messages.http.notAccess])
          }
          try {
            const jsonErrors = JSON.parse(xhr.responseText)
            if (jsonErrors.errors) {
              reject(jsonErrors.errors)
            } else {
              console.error("There is no error object in http response: ", jsonErrors)
              reject([messages.http.serverError])
            }
          } catch (e) {
            console.error("Not parsed http response: ", xhr.response)
            reject([messages.http.serverError])
          }
        }
      }
    }

    if (entity) {
      xhr.send(JSON.stringify(entity))
    } else {
      xhr.send()
    }
  })
}

function realUrl(url: string): string {
  if (location.host.includes("localhost")) {
    return `http://localhost:9000/api${forceStartWith(url, "/")}`
  } else {
    return `/api${forceStartWith(url, "/")}`
  }
}

function sessionToken(): string {
  const http = sessionStore.state.http
  if (http) {
    return btoa(`${http.email}:${http.token}`)
  } else {
    return null
  }
}


text:
package net.mgsx.examples.platformer;

import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

import net.mgsx.game.core.EditorApplication;
import net.mgsx.game.core.EditorConfiguration;
import net.mgsx.game.core.meta.ClassRegistry;
import net.mgsx.game.examples.platformer.PlatformerEditorPlugin;
import net.mgsx.kit.config.ReflectionClassRegistry;
import net.mgsx.kit.launcher.DesktopApplication;
import net.mgsx.pd.Pd;
import net.mgsx.pd.PdConfiguration;

/**
 * Desktop launcher for level editor
 * @author mgsx
 *
 */
public class PlatformerLevelEditorLauncher {

	public static void main (String[] args)
	{
		ClassRegistry.instance = new ReflectionClassRegistry(
				ReflectionClassRegistry.behaviorTree,
				"net.mgsx.game.examples.platformer"
				);

		PdConfiguration.remoteEnabled = true;

		LwjglApplicationConfiguration.disableAudio = true;

		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();

		EditorConfiguration editConfig = new EditorConfiguration();
		editConfig.plugins.add(new PlatformerEditorPlugin());
		editConfig.path = args.length > 0 ? args[0] : null;

		final EditorApplication editor = new EditorApplication(editConfig){
			@Override
			public void create() {
				Pd.audio.create(new PdConfiguration());
				super.create();
			}
		};

		new DesktopApplication(editor, config);
	}
}


text:
FactoryGirl.define do
  factory :stream_report, class: Report do
    last_name "Trout"
    first_name "Brook"
    body_id "S000-001" # stream_id
    contact_id 9999
    site_number "8888" # site_id
    phone_1 "651-555-1212" # phone
    email "brook.trout@stream.mn"
    previous_year true # did_you_monitor_this_site_last_year?
  end

  factory :lake_report, class: Report do
    last_name "Walleye"
    first_name "Wally"
    clmp_number 7777 # clmp_number
    body_name "Mille Lacs" # lake_name
    body_id "48-0002-00" # lake_number
    site_number "48-0002-00-209" # site_number
    county "Crow Wing"
    phone_1 "218.555.1212" # phone_summer
    phone_2 "850.555.1212" # phone_winter
    email "wally.walleye@lake.mn"
    previous_year false # did_you_monitor_this_site_last_year?
    lake_depth 1.5 # lake_depth_at_sampling_site
  end

end


text:
require File.dirname(__FILE__) + "/spec_helper"

describe PDF::Reader::Page, "raw_content()" do
  it "should return a string from raw_content() from cairo-basic.pdf page 1" do
    @browser = PDF::Reader.new(pdf_spec_file("cairo-basic"))
    @page    = @browser.page(1)

    @page.raw_content.should be_a_kind_of(String)
  end
end

describe PDF::Reader::Page, "text()" do
  # only do a very basc test here. Detailed testing of text extraction is
  # done by testing the PageTextReceiver class
  it "should return the text content from cairo-basic.pdf page 1" do
    @browser = PDF::Reader.new(pdf_spec_file("cairo-basic"))
    @page    = @browser.page(1)

    @page.text.should eql("Hello James")
  end

end

describe PDF::Reader::Page, "walk()" do

  context "with page 1 of cairo-basic.pdf" do
    let!(:browser) { PDF::Reader.new(pdf_spec_file("cairo-basic")) }
    let!(:page)    { browser.page(1) }

    it "should call the special page= callback while walking content stream" do
      receiver = PDF::Reader::RegisterReceiver.new
      page.walk(receiver)

      callbacks = receiver.callbacks.map { |cb| cb[:name] }

      callbacks.first.should eql(:page=)
    end

    it "should run callbacks while walking content stream" do
      receiver = PDF::Reader::RegisterReceiver.new
      page.walk(receiver)

      callbacks = receiver.callbacks.map { |cb| cb[:name] }

      callbacks.size.should eql(16)
      callbacks[0].should eql(:page=)
      callbacks[1].should eql(:save_graphics_state)
    end

    it "should run callbacks on multiple receivers while walking content stream" do
      receiver_one = PDF::Reader::RegisterReceiver.new
      receiver_two = PDF::Reader::RegisterReceiver.new
      page.walk(receiver_one, receiver_two)

      callbacks = receiver_one.callbacks.map { |cb| cb[:name] }

      callbacks.size.should eql(16)
      callbacks.first.should eql(:page=)

      callbacks = receiver_two.callbacks.map { |cb| cb[:name] }

      callbacks.size.should eql(16)
      callbacks.first.should eql(:page=)
    end
  end
end

describe PDF::Reader::Page, "number()" do

  it "should return the text content from cairo-basic.pdf page 1" do
    @browser = PDF::Reader.new(pdf_spec_file("cairo-basic"))
    @page    = @browser.page(1)

    @page.number.should eql(1)
  end

end

describe PDF::Reader::Page, "number()" do

  it "should return the text content from cairo-basic.pdf page 1" do
    @browser = PDF::Reader.new(pdf_spec_file("cairo-basic"))
    @page    = @browser.page(1)

    @page.number.should eql(1)
  end

end

describe PDF::Reader::Page, "attributes()" do

  it "should contain attributes from the Page object" do
    @browser = PDF::Reader.new(pdf_spec_file("inherited_page_attributes"))
    @page    = @browser.page(1)

    attribs = @page.attributes
    attribs[:Resources].should      be_a_kind_of(Hash)
    attribs[:Resources].size.should eql(2)
  end

  it "should contain inherited attributes" do
    @browser = PDF::Reader.new(pdf_spec_file("inherited_page_attributes"))
    @page    = @browser.page(1)

    attribs = @page.attributes
    attribs[:MediaBox].should eql([0.0, 0.0, 595.276, 841.89])
  end

  it "should allow Page to override inherited attributes" do
    @browser = PDF::Reader.new(pdf_spec_file("override_inherited_attributes"))
    @page    = @browser.page(1)

    attribs = @page.attributes
    attribs[:MediaBox].should eql([0, 0, 200, 200])
  end

  it "should not include attributes from the Pages object that don't belong on a Page" do
    @browser = PDF::Reader.new(pdf_spec_file("inherited_page_attributes"))
    @page    = @browser.page(1)

    attribs = @page.attributes
    attribs[:Kids].should be_nil
  end

  it "should not include attributes from the Pages object that don't belong on a Page" do
    @browser = PDF::Reader.new(pdf_spec_file("inherited_trimbox"))
    @page    = @browser.page(1)

    attribs = @page.attributes
    attribs[:TrimBox].should be_nil
  end

  it "should always include Type => Page" do
    @browser = PDF::Reader.new(pdf_spec_file("inherited_page_attributes"))
    @page    = @browser.page(1)

    attribs = @page.attributes
    attribs[:Type].should eql(:Page)
  end

  it 'should assume 8.5" x 11" if MediaBox is missing (matches Acrobat behaviour)' do
    @browser = PDF::Reader.new(pdf_spec_file("mediabox_missing"))
    @page    = @browser.page(1)

    attribs = @page.attributes
    attribs[:MediaBox].should eql([0,0,612,792])
  end
end

describe PDF::Reader::Page, "fonts()" do

  it "should return a hash with the correct size from cairo-basic.pdf page 1" do
    @browser = PDF::Reader.new(pdf_spec_file("cairo-basic"))
    @page    = @browser.page(1)

    @page.fonts.should      be_a_kind_of(Hash)
    @page.fonts.size.should eql(1)
    @page.fonts.keys.should eql([:"CairoFont-0-0"])
  end

  it "should contain inherited resources" do
    @browser = PDF::Reader.new(pdf_spec_file("cairo-basic"))
    @page    = @browser.page(1)

    @page.fonts.should      be_a_kind_of(Hash)
    @page.fonts.size.should eql(1)
    @page.fonts.keys.should eql([:"CairoFont-0-0"])
  end

end

describe PDF::Reader::Page, "color_spaces()" do

  it "should return an empty hash from cairo-basic.pdf page 1" do
    @browser = PDF::Reader.new(pdf_spec_file("cairo-basic"))
    @page    = @browser.page(1)

    @page.color_spaces.should      be_a_kind_of(Hash)
    @page.color_spaces.size.should eql(0)
  end
end

describe PDF::Reader::Page, "graphic_states()" do

  it "should return an hash with 1 entry from cairo-basic.pdf page 1" do
    @browser = PDF::Reader.new(pdf_spec_file("cairo-basic"))
    @page    = @browser.page(1)

    @page.graphic_states.should      be_a_kind_of(Hash)
    @page.graphic_states.size.should eql(1)
  end
end

describe PDF::Reader::Page, "patterns()" do

  it "should return an empty hash from cairo-basic.pdf page 1" do
    @browser = PDF::Reader.new(pdf_spec_file("cairo-basic"))
    @page    = @browser.page(1)

    @page.patterns.should      be_a_kind_of(Hash)
    @page.patterns.size.should eql(0)
  end
end

describe PDF::Reader::Page, "procedure_sets()" do

  it "should return an empty array from cairo-basic.pdf page 1" do
    @browser = PDF::Reader.new(pdf_spec_file("cairo-basic"))
    @page    = @browser.page(1)

    @page.procedure_sets.should      be_a_kind_of(Array)
    @page.procedure_sets.size.should eql(0)
  end
end

describe PDF::Reader::Page, "properties()" do

  it "should return an empty hash from cairo-basic.pdf page 1" do
    @browser = PDF::Reader.new(pdf_spec_file("cairo-basic"))
    @page    = @browser.page(1)

    @page.properties.should      be_a_kind_of(Hash)
    @page.properties.size.should eql(0)
  end
end

describe PDF::Reader::Page, "shadings()" do

  it "should return an empty hash from cairo-basic.pdf page 1" do
    @browser = PDF::Reader.new(pdf_spec_file("cairo-basic"))
    @page    = @browser.page(1)

    @page.shadings.should      be_a_kind_of(Hash)
    @page.shadings.size.should eql(0)
  end
end

describe PDF::Reader::Page, "xobjects()" do

  it "should return an empty hash from cairo-basic.pdf page 1" do
    @browser = PDF::Reader.new(pdf_spec_file("cairo-basic"))
    @page    = @browser.page(1)

    @page.xobjects.should      be_a_kind_of(Hash)
    @page.xobjects.size.should eql(0)
  end
end


text:
/*
 * Create a new receipt instance
 */
var Receipt = function(collections, reservations, total) {
  this.reservations = reservations;
  this.total = total
  this.receipts = collections['receipts'];
}

/*
 * Create a new receipt mongod document
 */
Receipt.prototype.create = function(options, callback) {
  if(typeof options == 'function') callback = options, options = {};
  var self = this;

  this.receipts.insertOne({
      createdOn: new Date()
    , reservations: this.reservations
  }, options, function(err, r) {
    if(err) return callback(err);
    if(r.result.writeConcernError) return callback(r.result.writeConcernError);
    callback(null, self);
  })
}

/*
 * Create the optimal indexes for the queries
 */
Receipt.createOptimalIndexes = function(collections, callback) {
  callback();
}

module.exports = Receipt;


text:
package me.welcomer.framework.pico.service

import scala.concurrent.ExecutionContext
import scala.concurrent.Future

import me.welcomer.framework.eci.service.EciServiceComponent
import me.welcomer.framework.models.ECI

trait PicoEciServiceComponentMockImpl extends PicoEciServiceComponent { self: EciServiceComponent =>
  override protected def _picoEciService(picoUUID: String): PicoEciService = new PicoEciServiceMockImpl()(picoUUID)

  private[this] class PicoEciServiceMockImpl(implicit val picoUUID: String) extends PicoEciService {
    override def generate(description: Option[String] = None)(implicit ec: ExecutionContext): Future[String] = {
      Future("the-generated-eci")
    }
  }
}


text:
docker kill ontop_mysql_running
docker rm ontop_mysql_running
docker rmi ontop/ontop-mysql


text:
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et tw=80 ft=c: */

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef PDNSParams_h
#define PDNSParams_h

#include "DNS.h"
#include "nsTArray.h"

namespace mozilla {
namespace net {

// Need to define typedef in .h file--can't seem to in ipdl.h file?
typedef nsTArray<NetAddr> NetAddrArray;

} // namespace net
} // namespace mozilla

#endif // PDNSParams_h


text:
import random

if __name__ == '__main__':
	filename = 'sample.txt'
	output = ''

	with open(filename) as f:
		for line in f:
			for word in line.split():
				if len(word) > 2:
					first, *middle, last = word
					random.shuffle(middle)
					word = first + ''.join(middle) + last
					output += word + ' '
				else:
					output += word + ' '
		f.seek(0) # Return to the beginning of the file.
		print(f.read())

	print(output)


text:
@extends('back.film.template')

@section('form')
	{!! Form::open(['url' => 'film', 'method' => 'post', 'class' => 'form-horizontal panel',  'files' => true]) !!}
@stop


text:
layout: post
title:      "Sinatra. The framework, not the singer."
date:       2019-08-17 21:39:56 +0000
permalink:  sinatra_the_framework_not_the_singer
---

This project's requirements were fairly straightforward; create a RESTful CMS, CRUD, MVC app, using Sinatra/ActiveRecord.

Sounds simple enough, right? But... when breaking down all the components necessary to building such an application, things get just a little bit more tangled. Just a little. (Hahaha)

For starters, let's get the alphabet soup sorted out, and maybe it all starts making more sense.

* **REST**: Representational State Transfer. Software architecture style/standard for web applications. Tl;dr: matching our URLs to HTTP verbs to CRUD actions to Controller Routes to rendered Views.

* **URL**: Uniform Resource Locator. (Web address pointing to the resource you want, ie the content, file, etc...)

* **HTTP**: Hyper Text Transfer Protocol. Basically a standardized way for your browser (client) to communicate with a server, and transfer data back and forth.

* **CMS**: Content Management System. Self-explanatory really.

* **CRUD**: Create, Read, Update, Delete. These actions are enacted upon resources (files) that are persisted to a database.

* **MVC**: Model View Controller. An architectural design pattern for developing applications, which is divided into three interconnected parts. It serves to separate the logic from the interface, and manages the behavior, data, and communication within the application stack.

* **Sinatra**: A lightweight Ruby framework and DSL, for developing web applications.

* **DSL**: Domain Specific Language.

* **ActiveRecord**: A Ruby library and DSL for working with Relational SQL Databases. It provides an ORM, in order to map Ruby objects to a database table, methods mapped to table columns and inferred from the database schema, as well as pre-defined CRUD methods.

* **SQL**: Structured Query Language. A standard language for talking to databases.

* **ORM**: Object Relational Mapping.

As an end user, I'm very familiar with using apps, and how generally consistent that experience is. I am presented with choices: items to click or tap, and fields to populate. Easy peasy. As a developer though, being behind the curtain means having to think about all the actions, connections, and interactions needed to make that happen. It's like being a wizard, only cooler.

What I like most about Sinatra, is that in some ways it's the best of both worlds, those worlds being a programming language like pure Ruby, and a larger framework like Rails. Making this kind of application without leveraging a framework would be more involved, having to declare methods manually and extracting them to a Module for ease of use and avoiding unnecessary repetition.

On the other hand, a larger framework does a lot for you automagically, which can make it hard to fully grasp what is happening under the hood. For this reason, Sinatra is a good intermediary for both learning purposes, and deploying lightweight applications.

Initially, I approached this project with the intent of making it much more complex, with several more models and types of relationships, but it occured to me that I could easily go down a rabbit hole, finding ever more difficult ways to associate and pivot data, something that would be better suited for a larger project leveraging more powerful tools. I opted for keeping this one on the simpler side, showcasing what Sinatra can do. So I went leaner this round.

I created two models, one for a user, and another for toys, to create simple CMS application to track collectibles and figurines. A user is able to create, retrieve, update, or delete their account (yay CRUD), and able to see the pages and forms that correspond to these actions, which persist to a database.

A user's input is also validated so that invalid data isn't persisted, and is authenticated to the user's unique login. Other users' collections are viewable to all users, but cannot be modified or deleted by anyone other than the user who created the toys in their collection.

The toy model includes a number of attributes that can be filled by the user, such as name, edition, color, designer, and brand.

While this application itself is quite simple, it was an excellent foray into MVC architecture, ActiveRecord, and frameworks, as  well as a useful exercise in managing and controlling data.


text:
"""Resources module."""

import abc
import sys
from typing import TypeVar, Generic

if sys.version_info < (3, 7):
    from typing import GenericMeta
else:
    class GenericMeta(type):
        ...

T = TypeVar('T')

class ResourceMeta(GenericMeta, abc.ABCMeta):
    def __getitem__(cls, item):
        # Spike for Python 3.6
        return cls(item)

class Resource(Generic[T], metaclass=ResourceMeta):

    @abc.abstractmethod
    def init(self, *args, **kwargs) -> T:
        ...

    @abc.abstractmethod
    def shutdown(self, resource: T) -> None:
        ...

class AsyncResource(Generic[T], metaclass=ResourceMeta):

    @abc.abstractmethod
    async def init(self, *args, **kwargs) -> T:
        ...

    @abc.abstractmethod
    async def shutdown(self, resource: T) -> None:
        ...


text:
@interface TextViewController : BaseViewController

@end


text:
package search

import "io"

type SynonymIterator struct {
	synonyms []Synonym
	pos      int
}

func newSynonymIterator(synonyms []Synonym) *SynonymIterator {
	return &SynonymIterator{synonyms: synonyms}
}

func (it *SynonymIterator) Next(opts ...interface{}) (Synonym, error) {
	if it.pos >= len(it.synonyms) {
		return nil, io.EOF
	}
	synonym := it.synonyms[it.pos]
	it.pos++
	return synonym, nil
}


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>

    Admin Management

 <?php
	if(isset($loginmsg)){
	echo '

		'.$loginmsg.'

';
	}
	?>

Enter your email to get password

	    <?php
					$attributes = array('method' => 'post', 'name' => 'forgetpassword', 'id' => 'forgetpassword');
					echo form_open('admin/forgetpassword', $attributes);
					?>

        <input type="text" placeholder="Email" name="email" id="email" class="form-control">
        <?php echo form_error('email'); ?>

          <button class="btn btn-primary btn-block btn-flat" type="submit">Send</button>

     <?php echo form_close();?>

    Back to login