text:
/*
 * render_views_tesselated_sphere.h
 *
 *  Created on: Dec 23, 2011
 *      Author: aitor
 */

#ifndef RENDER_VIEWS_TESSELATED_SPHERE_H_
#define RENDER_VIEWS_TESSELATED_SPHERE_H_

#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
#include <pcl/common/common.h>

namespace pcl
{
  namespace apps
  {
    /** \brief @b Class to render synthetic views of a 3D mesh using a tesselated sphere
     * NOTE: This class should replace renderViewTesselatedSphere from pcl::visualization.
     * Some extensions are planned in the near future to this class like removal of duplicated views for
     * symmetrical objects, generation of RGB synthetic clouds when RGB available on mesh, etc.
     * \author Aitor Aldoma
     * \ingroup apps
     */
    class PCL_EXPORTS RenderViewsTesselatedSphere
    {
    private:
      std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > poses_;
      std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> generated_views_;
      std::vector<float> entropies_;
      int resolution_;
      int tesselation_level_;
      bool use_vertices_;
      float view_angle_;
      float radius_sphere_;
      bool compute_entropy_;
      vtkSmartPointer<vtkPolyData> polydata_;

    public:
      RenderViewsTesselatedSphere ()
      {
        resolution_ = 150;
        tesselation_level_ = 1;
        use_vertices_ = false;
        view_angle_ = 57;
        radius_sphere_ = 1.f;
        compute_entropy_ = false;
      }

      /* \brief Sets the size of the render window
       * \param res resolution size
       */
      void
      setResolution (int res)
      {
        resolution_ = res;
      }

      /* \brief Wether to use the vertices or triangle centers of the tesselated sphere
       * \param use true indicates to use vertices, false triangle centers
       */

      void
      setUseVertices (bool use)
      {
        use_vertices_ = use;
      }

      /* \brief Radius of the sphere where the virtual camera will be placed
       * \param use true indicates to use vertices, false triangle centers
       */
      void
      setRadiusSphere (float radius)
      {
        radius_sphere_ = radius;
      }

      /* \brief Wether to compute the entropies (level of occlusions for each view)
       * \param compute true to compute entropies, false otherwise
       */
      void
      setComputeEntropies (bool compute)
      {
        compute_entropy_ = compute;
      }

      /* \brief How many times the icosahedron should be tesselated. Results in more or less camera positions and generated views.
       * \param level amount of tesselation
       */
      void
      setTesselationLevel (int level)
      {
        tesselation_level_ = level;
      }

      /* \brief Sets the view angle of the virtual camera
       * \param angle view angle in degrees
       */
      void
      setViewAngle (float angle)
      {
        view_angle_ = angle;
      }

      /* \brief adds the mesh to be used as a vtkPolyData
       * \param polydata vtkPolyData object
       */
      void
      addModelFromPolyData (vtkSmartPointer<vtkPolyData> polydata)
      {
        polydata_ = polydata;
      }

      /* \brief performs the rendering and stores the generated information
       */
      void
      generateViews ();

      /* \brief Get the generated poses for the generated views
       * \param poses 4x4 matrices representing the pose of the cloud relative to the model coordinate system
       */
      void
      getPoses (std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > & poses)
      {
        poses = poses_;
      }

      /* \brief Get the generated views
       * \param views generated pointclouds in camera coordinates
       */
      void
      getViews (std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> & views)
      {
        views = generated_views_;
      }

      /* \brief Get the entropies (level of occlusions) for the views
       * \param entropies level of occlusions
       */
      void
      getEntropies (std::vector<float> & entropies)
      {
        entropies = entropies_;
      }
    };

  }
}

#endif /* RENDER_VIEWS_TESSELATED_SPHERE_H_ */


text:
class SemanticalError < StandardError
end

redpajama_set_name: RedPajamaGithub


text:
package org.apache.stratos.cli.commands;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.stratos.cli.RestCommandLineService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.stratos.cli.Command;
import org.apache.stratos.cli.StratosCommandContext;
import org.apache.stratos.cli.exception.CommandException;
import org.apache.stratos.cli.utils.CliConstants;

public class UnsubscribeCommand implements Command<StratosCommandContext> {

	private static final Logger logger = LoggerFactory.getLogger(UnsubscribeCommand.class);

	private final Options options;;

	public UnsubscribeCommand() {
		options = constructOptions();
	}

	/**
	 * Construct Options.
	 *
	 * @return Options expected from command-line.
	 */
	private Options constructOptions() {
		final Options options = new Options();
		Option forceOption = new Option(CliConstants.FORCE_OPTION, CliConstants.FORCE_LONG_OPTION, false,
				"Never prompt for confirmation");
		options.addOption(forceOption);
		return options;
	}

	@Override
	public String getName() {
		return CliConstants.UNSUBSCRIBE_ACTION;
	}

	@Override
	public String getDescription() {
		return "Unsubscribe from a subscribed cartridge";
	}

	@Override
	public String getArgumentSyntax() {
		return "[Cartridge alias]";
	}

	@Override
	public int execute(StratosCommandContext context, String[] args) throws CommandException {
		if (logger.isDebugEnabled()) {
			logger.debug("Executing {} command...", getName());
		}
		if (args != null && args.length > 0) {
			String[] remainingArgs = null;
			String alias = null;
			boolean force = false;
			final CommandLineParser parser = new GnuParser();
			CommandLine commandLine;
			try {
				commandLine = parser.parse(options, args);
				remainingArgs = commandLine.getArgs();
				if (remainingArgs != null && remainingArgs.length == 1) {
					// Get alias
					alias = remainingArgs[0];
				} else {
					if (logger.isDebugEnabled()) {
						logger.debug("Unsubscribe: not enough arguments");
					}
					context.getStratosApplication().printUsage(getName());
					return CliConstants.BAD_ARGS_CODE;
				}

				if (commandLine.hasOption(CliConstants.FORCE_OPTION)) {
					if (logger.isTraceEnabled()) {
						logger.trace("Force option is passed");
					}
					force = true;
				}
				if (logger.isDebugEnabled()) {
					logger.debug("Unsubscribing {}, Force Option: {}", alias, force);
				}
				if (force || context.getApplication().getConfirmation("Are you sure you want to unsubscribe?")) {
					System.out.format("Unsubscribing the cartridge %s%n", alias);
					//CommandLineService.getInstance().unsubscribe(alias);
                    RestCommandLineService.getInstance().unsubscribe(alias);
				}
				return CliConstants.SUCCESSFUL_CODE;
			} catch (ParseException e) {
				if (logger.isErrorEnabled()) {
					logger.error("Error parsing arguments", e);
				}
				System.out.println(e.getMessage());
				return CliConstants.BAD_ARGS_CODE;
			}
		} else {
			context.getStratosApplication().printUsage(getName());
			return CliConstants.BAD_ARGS_CODE;
		}
	}

	@Override
	public Options getOptions() {
		return options;
	}

}


text:
<?php

namespace Libreame\BackendBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * LbActsesion
 *
 * @ORM\Table(name="lb_actsesion", indexes={@ORM\Index(name="fk_lb_ActSesion_lb_sesiones1_idx", columns={"inActSesionDisUs"})})
 * @ORM\Entity
 */
class LbActsesion
{
    /**
     * @var integer
     *
     * @ORM\Column(name="inActSesion", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $inactsesion;

    /**
     * @var integer
     *
     * @ORM\Column(name="inActAccion", type="integer", nullable=false)
     */
    private $inactaccion;

    /**
     * @var string
     *
     * @ORM\Column(name="txActMensaje", type="string", length=500, nullable=false)
     */
    private $txactmensaje;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="feActFecha", type="datetime", nullable=false)
     */
    private $feactfecha;

    /**
     * @var integer
     *
     * @ORM\Column(name="inActFinalizada", type="integer", nullable=false)
     */
    private $inactfinalizada;

    /**
     * @var \Libreame\BackendBundle\Entity\LbSesiones
     *
     * @ORM\ManyToOne(targetEntity="Libreame\BackendBundle\Entity\LbSesiones")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="inActSesionDisUs", referencedColumnName="inSesion")
     * })
     */
    private $inactsesiondisus;

    /**
     * Get inactsesion
     *
     * @return integer
     */
    public function getInactsesion()
    {
        return $this->inactsesion;
    }

    /**
     * Set inactaccion
     *
     * @param integer $inactaccion
     * @return LbActsesion
     */
    public function setInactaccion($inactaccion)
    {
        $this->inactaccion = $inactaccion;

        return $this;
    }

    /**
     * Get inactaccion
     *
     * @return integer
     */
    public function getInactaccion()
    {
        return $this->inactaccion;
    }

    /**
     * Set txactmensaje
     *
     * @param string $txactmensaje
     * @return LbActsesion
     */
    public function setTxactmensaje($txactmensaje)
    {
        $this->txactmensaje = $txactmensaje;

        return $this;
    }

    /**
     * Get txactmensaje
     *
     * @return string
     */
    public function getTxactmensaje()
    {
        return $this->txactmensaje;
    }

    /**
     * Set feactfecha
     *
     * @param \DateTime $feactfecha
     * @return LbActsesion
     */
    public function setFeactfecha($feactfecha)
    {
        $this->feactfecha = $feactfecha;

        return $this;
    }

    /**
     * Get feactfecha
     *
     * @return \DateTime
     */
    public function getFeactfecha()
    {
        return $this->feactfecha;
    }

    /**
     * Set inactfinalizada
     *
     * @param integer $inactfinalizada
     * @return LbActsesion
     */
    public function setInactfinalizada($inactfinalizada)
    {
        $this->inactfinalizada = $inactfinalizada;

        return $this;
    }

    /**
     * Get inactfinalizada
     *
     * @return integer
     */
    public function getInactfinalizada()
    {
        return $this->inactfinalizada;
    }

    /**
     * Set inactsesiondisus
     *
     * @param \Libreame\BackendBundle\Entity\LbSesiones $inactsesiondisus
     * @return LbActsesion
     */
    public function setInactsesiondisus(\Libreame\BackendBundle\Entity\LbSesiones $inactsesiondisus = null)
    {
        $this->inactsesiondisus = $inactsesiondisus;

        return $this;
    }

    /**
     * Get inactsesiondisus
     *
     * @return \Libreame\BackendBundle\Entity\LbSesiones
     */
    public function getInactsesiondisus()
    {
        return $this->inactsesiondisus;
    }
}


text:
Tinkering with lit-html and polymer-3

## Setup

```
npm i
npm start
```


text:
package com.ksoichiro.task.web;

import com.ksoichiro.task.annotation.*;
import com.ksoichiro.task.domain.Account;
import com.ksoichiro.task.exception.DuplicateTagNameException;
import com.ksoichiro.task.form.TagCreateForm;
import com.ksoichiro.task.form.TagUpdateForm;
import com.ksoichiro.task.service.TagService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@StandardController("/tag")
@RequiredArgsConstructor(onConstructor = @__({@Autowired}))
@Slf4j
public class TagController {
    private final TagService tagService;

    @RequestMapping
    public String index(@LoginAccount Account account, Model model, @PageableDefault Pageable pageable) {
        model.addAttribute("tags", tagService.findByAccount(account, pageable));
        return "tag/index";
    }

    @Create
    public String create(TagCreateForm tagCreateForm, BindingResult bindingResult, Model model) {
        return "tag/create";
    }

    @CreateSave
    public String createSave(@LoginAccount Account account, @Validated TagCreateForm tagCreateForm, BindingResult bindingResult, Model model) {
        if (bindingResult.hasErrors()) {
            return create(tagCreateForm, bindingResult, model);
        }
        try {
            tagService.create(tagCreateForm.toDTO(account));
        } catch (DuplicateTagNameException e) {
            log.warn("Failed to create tag for account {}", account.getId(), e);
            bindingResult.reject("error.tag.name.duplicate");
            return create(tagCreateForm, bindingResult, model);
        } catch (Exception e) {
            log.warn("Failed to create tag for account {}", account.getId(), e);
            bindingResult.reject("error.tag.create");
            return create(tagCreateForm, bindingResult, model);
        }
        return "redirect:/tag";
    }

    @Update
    public String update(@PathVariable Integer id,
                         @LoginAccount Account account,
                         TagUpdateForm tagUpdateForm, BindingResult bindingResult, Model model) {
        tagUpdateForm.copyFrom(tagService.findByIdAndAccount(id, account));
        return "tag/update";
    }

    @UpdateSave
    public String updateSave(@LoginAccount Account account,
                             @Validated TagUpdateForm tagUpdateForm, BindingResult bindingResult, Model model) {
        if (bindingResult.hasErrors()) {
            if (tagUpdateForm.cannotDecideWhatToUpdate()) {
                return "redirect:/tag";
            }
            return update(tagUpdateForm.getId(), account, tagUpdateForm, bindingResult, model);
        }
        try {
            tagService.update(tagUpdateForm.toDTO(account));
        } catch (DuplicateTagNameException e) {
            log.warn("Failed to update tag for account {}", account.getId(), e);
            bindingResult.reject("error.tag.name.duplicate");
            return update(tagUpdateForm.getId(), account, tagUpdateForm, bindingResult, model);
        } catch (Exception e) {
            log.warn("Failed to update tag for account {}", account.getId(), e);
            bindingResult.reject("error.tag.update");
            return update(tagUpdateForm.getId(), account, tagUpdateForm, bindingResult, model);
        }
        return "redirect:/tag";
    }
}


text:
module Codebreaker
  VERSION = "0.8.0"
end


text:
import { RawDraftContentState } from "draft-js";
import * as React from "react";

import AppHeader from "../../../components/AppHeader";
import { CardSpacer } from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
import SaveButtonBar from "../../../components/SaveButtonBar/SaveButtonBar";
import SeoForm from "../../../components/SeoForm";
import i18n from "../../../i18n";
import { UserError } from "../../../types";
import CategoryDetailsForm from "../../components/CategoryDetailsForm";

interface FormData {
  description: RawDraftContentState;
  name: string;
  seoTitle: string;
  seoDescription: string;
}

const initialData: FormData = {
  description: null,
  name: "",
  seoDescription: "",
  seoTitle: ""
};

export interface CategoryCreatePageProps {
  errors: UserError[];
  disabled: boolean;
  saveButtonBarState: ConfirmButtonTransitionState;
  onSubmit(data: FormData);
  onBack();
}

export const CategoryCreatePage: React.StatelessComponent<
  CategoryCreatePageProps
> = ({
  disabled,
  onSubmit,
  onBack,
  errors: userErrors,
  saveButtonBarState
}) => (
  <Form
    onSubmit={onSubmit}
    initial={initialData}
    errors={userErrors}
    confirmLeave
  >
    {({ data, change, errors, submit, hasChanged }) => (
      <Container>
        <AppHeader onBack={onBack}>{i18n.t("Categories")}</AppHeader>
        <PageHeader title={i18n.t("Add Category")} />
        <div>
          <CategoryDetailsForm
            disabled={disabled}
            data={data}
            onChange={change}
            errors={errors}
          />
          <CardSpacer />
          <SeoForm
            helperText={i18n.t(
              "Add search engine title and description to make this product easier to find"
            )}
            title={data.seoTitle}
            titlePlaceholder={data.name}
            description={data.seoDescription}
            descriptionPlaceholder={data.name}
            loading={disabled}
            onChange={change}
            disabled={disabled}
          />
          <SaveButtonBar
            onCancel={onBack}
            onSave={submit}
            labels={{
              save: i18n.t("Save category")
            }}
            state={saveButtonBarState}
            disabled={disabled || !hasChanged}
          />
        </div>
      </Container>
    )}
  </Form>
);
CategoryCreatePage.displayName = "CategoryCreatePage";
export default CategoryCreatePage;


text:
<!DOCTYPE html>

    <meta content="text/html; charset=UTF-8" http-equiv="content-type">
    <title>HTML5 Image Description Extension (longdesc)</title>

    <link href="prism.css" rel="stylesheet" type="text/css">
    <link href="https://www.w3.org/StyleSheets/TR/W3C-CR" rel="stylesheet">

HTML5 Image Description Extension (longdesc)

W3C
        Candidate Recommendation 12 August 2014

This version:

http://www.w3.org/TR/2014/CR-html-longdesc-20140812/

Latest published version:

http://www.w3.org/TR/html-longdesc/

Latest editor's draft:

 https://dvcs.w3.org/hg/html-proposals/raw-file/default/longdesc1/longdesc.html

Previous version:

http://www.w3.org/TR/2013/WD-html-longdesc-20130716/

Editors:

Charles (McCathie) Nevile,
          Яндекс—Yandex

Mark Sadecki, W3C through July 2014

Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.

Abstract

This specification defines a longdesc attribute (based on
        the longdesc attribute of HTML 4) to link descriptions to
        images in HTML5 content.

By allowing a hyperlink inside another one, this document
        explicitly redefines the HTML concept of hyperlink in a limited set of
        circumstances.

Status of This Document

 This section describes the status of this document at the time of
          its publication. Other documents may supersede this document. A list
          of current W3C
          publications and the latest revision of this technical report can be
          found in the W3C
            technical reports index at http://www.w3.org/TR/.

 This document was developed through the HTML
      Accessibility Task Force, and is published by the HTML
      Working Group with approval by the
      Protocols and Formats Working Group as a W3C Candidate Recommendation.
        If you wish to make comments regarding this document, please send
        them to public-html-a11y@w3.org
        (subscribe,
        archives).
        All
        feedback is welcome. Bugs can also be filed directly into the W3C
          Bug tracker for this specification. This Candidate Recommendation is expected to end no sooner than 26 August 2014.

The disposition of comments from the Last Call Working Draft is available.

Significant changes between successive public drafts are tracked in the
        Change History section.

This document is intended to become a W3C
        Recommendation.

Publication as a Candidate Recommendation does not imply endorsement by the W3C
        Membership. This is a draft document and may be updated, replaced or
        obsoleted by other documents at any time. It is inappropriate to cite
        this document as other than work in progress.

This document was produced by a group operating under the 5
          February 2004 W3C
          Patent Policy. W3C
        maintains a public
          list of any patent disclosures made in connection with the
        deliverables of the group; that page also includes instructions for
        disclosing a patent. An individual who has actual knowledge of a patent
        which the individual believes contains Essential
          Claim(s) must disclose the information in accordance with section
          6 of the W3C
        Patent Policy.

Table of Contents

            Introduction

1.
              Conformance

1.1
                  Dependencies

2.
              Use Cases and Requirements

3.
              The longdesc Attribute

3.1
                  Extensions to the HTMLImageElement
                Interface

3.1.1
                      Attribute

A.
              Acknowledgements

B.
              References

B.1
                  Normative References

B.2
                  Informative References

C.
              Change History

Introduction

Text alternatives are used to make visual information accessible by describing
        the information or function represented in an image.  The alt
        attribute is designed to provide a concise description or functional equivalent
        for an image.  For some images and contexts, more detail is required to convey
        all the information contained in the image. The longdesc attribute
        is designed as a means to provide this level of detail.

HTML 4 provided a longdesc attribute for the img
        element that enabled a machine-discoverable description of an image to
        be linked to the image. This extension specification defines a longdesc
        attribute to provide that functionality for HTML5.

Example: (Informative)

<!-- The description is somewhere on the same page as the image -->
<img src="http://example.com/graph1" alt="Drinks are getting sweeter"
    longdesc="#graph1Explained">

<!-- The description is a page on its own -->
<img src="figure1" alt="figure 1" longdesc="http://example.com/desc1">

<!-- The description is one of several within an external page -->
<img src="ExampleImage" alt="example" longdesc="http://example.com/descs#item3">

<!-- The description is included in a data: URI -->
<img src="logo" alt="W3C" longdesc="data:text/html;charset=utf-8;,%3C!DOCTYPE%20html%3E
%3Chtml%3E%3Chead%3E%3Ctitle%3EDescription%20of%20the%20W3C%20Logo%3C/title%3E%3C/head%3E
%3Cbody%3E%3Cp%3EA%20blue%20capital%20letter%20%22W%22%20with%20kerning%20so%20it%20
touches%20a%20blue%203%2C%20followed%20by%20a%20black%20shadow%20of%20a%20white%20
capital%20letter%20C%20all%20on%20a%20white%20background%3C/body%3E%3C/html%3E">

1. Conformance

All authoring guidelines, diagrams, examples, notes, and sections marked
        "informative"
        in this specification are informational. Everything else in this specification is
        "normative" as described in
        [QAFRAME].

The key words "must", "should", "should not" and
        "may" in this specification are to be interpreted as
        described in [RFC2119].

1.1 Dependencies and Definitions

The Interface Definition Language (IDL) fragments in this specification must
          be interpreted as required for conforming IDL fragments, as described
          in the Web IDL specification. [WEBIDL]

The terms "valid
            non-empty URL potentially surrounded by spaces", "hyperlink",
          and "reflect",
          used in this specification are defined in [HTML5],
          although this specification modifies the semantics of the term
          "hyperlink" in allowing hyperlinks to be nested in certain specific
          circumstances.

This document uses the terms <dfn>accessible</dfn> and <dfn>accessibility</dfn> in the sense
        of ensuring people with disabilities can use the Web. Further information is available, e.g. Introduction to Web Accessibility.

2. Use Cases and Requirements

The longdesc attribute gives authors a mechanism for referencing a long text
        description for images which cannot be adequately described using shorter description
        mechanisms, such as in the following use cases.

Use Cases

Identifying a well-known image

Identifying an image is often important context for a discussion.
          There are many well-known images which are widely reproduced and well
          known. In some cases, such as "Mona Lisa", "Guernica", "A Starry Night",
          or "The Scream", the most effective way to identify an
          image is to use its title, creator, and similar information that would
          be found in a catalog. But different people know images by different
          titles, and some titles are not well known. When the image itself
          cannot be seen, a description can often be used to offer easier
          recognition than the cataloging information, for example "Washington
          crossing a river, standing heroically in a boat, while soldiers
          do all the paddling", or "the Da Vinci picture of the man in a square and
          a circle".

Requires: Discoverability

Helped by: Inline,
          Optional Consumption,
          Reuse,
          Simple Return

Describing a complex diagram

In many environments diagrams are used to explain a concept or
          transmit information efficiently. For a user with a reduced ability to
          see the image (poor contrast vision and other conditions are as
          relevant here as a complete lack of vision), a description can enable
          that user to understand the information being presented.

Requires:
          Structured Markup

Helped by: Inline,
          Reuse,
          Simple Return

Teaching accessible development

In many environments producing content that is accessible to users
          regardless of disability is a legal and/or market requirement.

Requires: Backwards Compatibility,
          Maintenance

A self-describing artistic work

The visual design of many pages is an important part of the message
          the author intends to convey to a fully-sighted user. Many authors
          would like to convey as much of that design as possible to a user with
          low or no vision.

Requires: Discoverability,
          No Visual Encumbrance,
          Structured Markup

Helped by: Reuse,
          Simple Return

Referring to an existing description

Many well-known images are already described by other sources. The
          copyright on those sources may not be compatible with re-publishing
          the description, but there is little value in making a new one.

Requires: Discoverability,
          Optional Consumption,
          Reuse,
          Simple Return

Helped by: No Visual Encumbrance

Linking to a description included within a page

If an image already has a description included within a page, making
          the linkage explicit can provide further clarity for a user who is not
          able to interpret the default layout. For example this happens when
          users force a re-layout of the page elements because they have
          magnified the content, or because they do not see the default visual
          relationship between the element and its description.

This practice also enables description to be provided for all users.

By keeping the association clear the content maintainer can more
          easily check that the description and link are actually correct.

Requires: Discoverability,
          Inline,
          Optional Consumption,
          Simple Return,
          Structured Markup

Localizing descriptions

When content is translated to multiple languages, it is important
          that metadata intended for humans, such as image
          descriptions, can be readily localized.

Helped by: Structured Markup,
          Reuse, Maintenance.

Image search

Many search engines provide an option to search for images and present
          the results out of context. The ability to discover and process identified
          descriptions allows search engines to improve the source material they use
          to support text-based queries for images.

Requires: Discoverability

Helped by: Structured Markup

Describing images

Image search tools identify multiple copies of the same image. Where a
          search tool can identify a description of an image, this can be provided
          to the user as a description for any copies of that image.

Requires: Discoverability

Helped by: Reuse

Requirements for an Image Description Functionality

Backwards Compatibility

It should be possible to use existing
          tools and techniques to associate an image with its description.

Discoverability

It must be simple for a
          user agent to automatically discover a description provided for a
          given image.

A user should be able to determine that
            there is a description available for a given image.

Inline

It must be possible to associate a
          description in the body of a page with an image in that page.

Maintenance

It must be simple to maintain a library of
          images and descriptions for dynamic assembly, or dis-assembly and
          re-assembly, of content.

No Visual Encumbrance

It must be possible to provide a
          description for an image without forcing the description to be
          rendered on the page.

Optional Consumption

A user must be able to choose not to read
          the long description of a given image.

Reuse

It must be possible to re-use a single
          description for multiple occurrences of an image.

Simple Return

A user must be able to return from the
          description to the image.

Structured Markup

It must be possible to include rich markup
          (e.g. HTML5) in the description of the image.

3. The longdesc Attribute

This extension changes the definition of a hyperlink in HTML,
        by allowing a longdesc attribute to occur inside a
        hyperlink.

3.0 Implementation

3.0.1 Authors and Conformance
        Checkers

Zero or one longdesc attributes may
          be added to any img element.

The longdesc attribute must
          contain a valid
            non-empty URL potentially surrounded by spaces. The URL is a hyperlink
          to a description of the image that the parent img
          element represents.

The linked description should be in a
          broadly accessible format.

This section is informative

Best practices for checking descriptions of images are beyond the
            scope of this document, but there are many resources available.
            For further guidance authoring tool developers can consult e.g.
            Appendix A-3: Long text descriptions
            of [ATAG].

High quality implementation in authoring and content management
            tools is likely to include checking for common errors, such as
            including a description instead of a URL in the attribute, or
            pointing to a resource that is an image or plain text, which are
            often poor choices for a high-quality description.  Additional
            examples of error checking and repair options can be found in
            Appendix B: Levels of Checking Automation
            and Appendix C: Levels of Repair Automation
            of [ATAG]

3.0.2 Authors

When a description is only part of the target document, authors
          should link to a container element in the target
          document that contains the entire description.

Example: (Informative)

<!-- Image with description that is only part of target document -->
<img src="foo.png" alt="Example image" longdesc="example.html#desc2">

<!-- Target document -->
<section id="desc2">
  <h2>Image foo.png</h2>
  <p>Description of the image...</p>
</section>

This section is informative

Best practices for full descriptions of images are beyond the scope
            of this document, but there are many resources available.

Authors should not rely solely on longdesc where standards
          exist to provide direct, structured access.

This section is informative

For example a MathML version of mathematical content, or an SVG image that
            uses the accessibility features of SVG, can provide direct accessibility to
            users with appropriate technology. In such cases, it is appropriate to use
            those techniques in combination with longdesc.

3.0.3 User Agents

If the longdesc value is valid, User agents must
          make the link available to all users through the regular user
          interface(s).

If the longdesc value is valid, User agents must
          expose the link to relevant APIs, especially accessibility-oriented
          APIs.

User agents should enable users to discover
          when images in a page contain a long description.

This section is informative

longdesc can be present on an image within a
            hyperlink. This does not change the requirements on user agents,
            which must still enable the hyperlink to be followed.

Complete documentation of best practices for implementation is
            beyond the scope of this document. These notes are offered to help
            minimize the impact of common mistakes.

A common mistake in the past has been to use a description, instead
            of a URL that links to a description. Converting such values to
            data: URLs is a repair strategy for user agents that can help users
            to recover in cases where authors have made this mistake.

It is usually helpful when the behavior for finding, reading, and
            returning from a long description to the image described is a
            consistent experience.

Further information on making user agents accessible can be found
            in [UAAG].

3.1 Extension to the HTMLImageElement
          Interface

partial interface HTMLImageElement {
             attribute DOMString longdesc;
};

3.1.1 Attribute

longdesc of type DOMString

The <dfn id="dfn-dom-element-longdesc">longdesc</dfn>
                IDL attribute must be a valid
                non-empty URL potentially surrounded by spaces. It defines a
                hyperlink to a detailed description of the image its parent HTMLImageElement
                represents.

The longdesc IDL attribute must
                reflect
                the HTML content attribute longdesc.

This section is informative

<var>image</var>.longdesc
                    [ = <var>value</var> ]

Returns a DOMString that represents the attribute's
                    contents.

Can be set, to replace the contents of the attribute with
                    the given string.

Example: (Informative)

/*Make the first internal longdesc reference absolute*/

var baseURL = document.location.origin + document.location.pathname
var someImage = document.querySelector('img[longdesc^=#]');

someImage.longdesc = baseURL + someImage.longdesc;

Example: (Informative)

/*Open new windows for each longdesc found*/

var describedImages = document.querySelectorAll('img[longdesc]');

for (i in describedImages) {
  if (i.longdesc)
    window.open(i.longdesc);
}

Example: (Informative)

/*Tries to repair errors where the longdesc isn't a URI*/

var describedImages = document.querySelectorAll('img[longdesc]');

for (i in describedImages) {
  if (i.longdesc && !(validURL(i.longdesc)) { //assumes some URL validating function
    var theData = encodeURIComponent(i.longdesc);
    i.longdesc = "data:text/plain;charset=";
    i.longdesc += document.charset;
    i.longdesc += theData;
  }
}

A. Acknowledgements

This section is informative

Thanks to the HTML Working Group of the late 1990s for the original
          specification of longdesc, to those who have implemented it in various
          kinds of software, and to many many people involved with the
          development of HTML5 (including but not limited to those who discussed
          "ISSUE-30" in the HTML Working Group, the Protocols and Formats
          Working Group, the W3C Advisory Board, and around countless dinner
          tables, coffee breaks, and elsewhere) for the ideas, discussions and
          contributions that led to the initial draft of this specification.
          With the exception of Laura Carlson, who did far more very valuable
          work than it took me to produce this specification, I haven't named
          them: the list might be larger than the content of the specification.

For specific comments and suggestions that led to improvements over
          successive drafts of this specification, thanks to the W3C's HTML
          Accessibility Task Force, the W3C Internationalization Working Group,
          and to Jonathan Avila, Robin Berjon, James Craig, Paul Cotton, Steve
          Faulkner, John Foliot, Geoff Freed, Peter Gruzca, Richard Ishida, Anne
          van Kesteren, David MacDonald, Michelle McManus, Chris Mills, Jay
          Munro, Devarshi Pant, Marta Pawlowska, Silvia Pfeiffer, Wendy Seltzer,
          Leif Halvard Silli, Mathew Turvey, Klaas 'Z4us' V, and Boris Zbarsky.
          The code examples are rendered with Lea Verou's prism tools. Any
          errors are despite, not as a result of, their efforts.

B. References

B.1 Normative References

[HTML5]

Robin Berjon et. al., eds. HTML5.
              W3C Working Draft. (Work in progress.) URL: http://www.w3.org/TR/html5/

[RFC2119]

S. Bradner. Key
                  words for use in RFCs to Indicate Requirement Levels.
              March 1997. Internet RFC 2119. URL: http://www.ietf.org/rfc/rfc2119.txt

[WEBIDL]

Cameron McCormack. Web
                  IDL. 27 September 2011. W3C Working Draft. (Work in
              progress.) URL: http://www.w3.org/TR/2011/WD-WebIDL-20110927/

B.2 Informative References

[QAFRAME]

Karl Dubost et. al., eds.
              QA Framework: Specification Guidelines., August 2005. W3C Recommendation.
              URL: http://www.w3.org/TR/2005/REC-qaframe-spec-20050817/

[ATAG]

Jutta Treviranus et. al., eds. Implementing ATAG 2.0,
              October 2011. W3C Working Draft.
              URL: http://www.w3.org/TR/2013/WD-IMPLEMENTING-ATAG20-20131107/

[UAAG]

Ian Jacobs et. al., eds. User
                  Agent Accessibility Guidelines 1.0, December 2002.
              W3C Recommendation. URL: http://www.w3.org/TR/2002/REC-UAAG10-20021217/.
              A draft for a version 2.0 is available at http://www.w3.org/TR/UAAG20/

C. Change History

This section is informative

Between the current draft and the Last Call Working Draft

Editorial changes include:

Improved markup used for informative sections for better screen
              reader support

Moved introductory text from "Use Cases" to "Introduction" and modified
            it to more clearly define the longdesc attribute.

Added more precise references to relevant sections of ATAG in
              the "Implementation" section.

Added text to clarify the use of longdesc in conjunction with
              other techniques.

Added the "Image Search" and "Describing images" use case.

Improved examples in the "Identifying a well known image" use
              case

Clarified the scope of normative text in the "Conformance"
              section.

Hyperlinked "Use Case" references to their definitions and
              rearranged definitions in alphabetical order.

Removed "title" attribute from example.

Added Mark Sadecki as an editor.

Various changes to improve readability and consistency.

Between the Last Call Working Draft and the Second
              Public Working Draft

Editorial changes include:

Explicitly stating that longdesc makes a limited
              change to the semantics of the term "hyperlink" in HTML

Editing of the informative guidance in various places.

Explicitly adding a reference to the software license to allow
              people to re-use the code samples and IDL more easily with fewer
              restrictions.

Between the Second
              Public Working Draft and the First
              Public Working Draft

Substantive changes include:

Added a requirement that the destination of a longdesc
              should be "accessible".

The requirement to present content through the standard User
              Interface was changed from should to must.

The requirement to present content through the standard User
              Interface was narrowed to apply only to valid values of longdesc.

The requirement to present content through the Accessibility
              APIs was changed from should to must.

The requirement to present content through the Accessibility
              APIs was narrowed to apply only to valid values of longdesc.

The IDL attribute longdesc was changed to reflect
              the HTML content attribute longdesc.

Editorial changes include:

Clarifying that the document does not define "accessible",
              except that it is used in the sense that it is used in [WCAG].

Sectioning requirements according to whom they apply.

Removed the statement that User Agents may
              present descriptions which are erroneously included in the content
              instead of a link.

Added more examples


text:
<?php
namespace accounting\clients\cli\commands;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

use accounting\aplication\CreateAccount;

class CreateAccountCommand extends Command
{
	private $repo;
	private $idsGenerator;

	public function __construct($repo, $idsGenerator)
	{
		parent::__construct();
		$this->repo = $repo;
		$this->idsGenerator = $idsGenerator;
	}

	protected function configure()
	{
		$this->setName('account:create')
			->setDescription('Create an account')
			->addArgument(
				'name',
				InputArgument::REQUIRED,
				'Name the new account'
			)
			->addArgument(
				'total',
				InputArgument::REQUIRED,
				'Total amount of the new account'
			);
	}

	protected function execute(InputInterface $input, OutputInterface $output)
	{
		$name = $input->getArgument('name');
		$total = $input->getArgument('total');
		$usecase = new CreateAccount($this->repo, $this->idsGenerator);
		$result = $usecase->execute($name, $total);

		$output->writeln("Account created with uuid ".(string)$result);
	}
}


text:
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { Notifications } from '/logic/accounts/schema';
import News from '/logic/news/schema';
import lastLogin from './user';

import './notifications.html';

// Subscribe to notifications
Meteor.subscribe('notifications');

// Number of notifications
const count = new ReactiveVar(0);

// Update page title with notifications count
const updateTitle = () => {
  const title = 'WCASA | Wisconsin Coalition Against Sexual Assault';

  if (count.get() > 0) {
    document.title = `(${count.get()}) - ${title}`;
  } else document.title = title;
};

// Notification helpers
Template.notifications.helpers({
  // Whether to show the notifications section
  show: () => !!Meteor.user(),

  // Return all notifications
  notifications: () => {
    // Notifications from db (manually issued)
    const notifs = Notifications.collection.find({}).fetch();

    // Action alerts since last login
    const alerts = News.collection
      .find({ timestamp: { $gte: lastLogin.get() } }, { sort: { date: -1 } })
      .fetch();

    // Combination
    const all = notifs.concat(alerts);

    // Update total count
    count.set(all.length);

    // Update title
    updateTitle();

    return all;
  },
});

export default count;


text:
require "formula"

class Hatari < Formula
  homepage "http://hatari.tuxfamily.org"
  head "http://hg.tuxfamily.org/mercurialroot/hatari/hatari", :using => :hg, :branch => "default"
  url "http://download.tuxfamily.org/hatari/1.8.0/hatari-1.8.0.tar.bz2"
  sha1 "08d950c3156c764b87ac0ae03c4f350febff9567"

  depends_on :x11
  depends_on "cmake" => :build
  depends_on "libpng"
  depends_on "sdl"

  def install
    sdl = Formula["sdl"].opt_prefix
    system "cmake", "-DENABLE_OSX_BUNDLE:BOOL=0",
                    "-DSDLMAIN_LIBRARY:FILEPATH=#{sdl}/lib/libSDLmain.a",
                    "-DSDL_INCLUDE_DIR:PATH=#{sdl}/include/SDL",
                    "-DSDL_LIBRARY:STRING=#{sdl}/lib/libSDLmain.a;#{sdl}/lib/libSDL.dylib;-framework Cocoa",
                    *std_cmake_args

    system "make", "install"
  end
end


text:
using Xunit;

namespace System.Tests
{
    public class ConvertToDoubleTests : ConvertTestBase<Double>
    {
        [Fact]
        public void FromBoolean()
        {
            Boolean[] testValues = { true, false };
            Double[] expectedValues = { 1.0, 0.0 };
            Verify(Convert.ToDouble, testValues, expectedValues);
        }

        [Fact]
        public void FromByte()
        {
            Byte[] testValues = { Byte.MaxValue, Byte.MinValue };
            Double[] expectedValues = { Byte.MaxValue, Byte.MinValue };
            Verify(Convert.ToDouble, testValues, expectedValues);
        }

        [Fact]
        public void FromDecimal()
        {
            Decimal[] testValues = { Decimal.MaxValue, Decimal.MinValue, 0.0m };
            Double[] expectedValues = { (Double)Decimal.MaxValue, (Double)Decimal.MinValue, 0.0 };
            Verify(Convert.ToDouble, testValues, expectedValues);
        }

        [Fact]
        public void FromDouble()
        {
            Double[] testValues = { Double.MaxValue, Double.MinValue, Double.NegativeInfinity, Double.PositiveInfinity, Double.Epsilon };
            Double[] expectedValues = { Double.MaxValue, Double.MinValue, Double.NegativeInfinity, Double.PositiveInfinity, Double.Epsilon };
            Verify(Convert.ToDouble, testValues, expectedValues);
        }

        [Fact]
        public void FromInt16()
        {
            Int16[] testValues = { Int16.MaxValue, Int16.MinValue, 0 };
            Double[] expectedValues = { Int16.MaxValue, Int16.MinValue, 0 };
            Verify(Convert.ToDouble, testValues, expectedValues);
        }

        [Fact]
        public void FromInt32()
        {
            Int32[] testValues = { Int32.MaxValue, Int32.MinValue, 0 };
            Double[] expectedValues = { Int32.MaxValue, Int32.MinValue, 0 };
            Verify(Convert.ToDouble, testValues, expectedValues);
        }

        [Fact]
        public void FromInt64()
        {
            Int64[] testValues = { Int64.MaxValue, Int64.MinValue, 0 };
            Double[] expectedValues = { (Double)Int64.MaxValue, (Double)Int64.MinValue, 0 };
            Verify(Convert.ToDouble, testValues, expectedValues);
        }

        [Fact]
        public void FromObject()
        {
            Object[] testValues = { null };
            Double[] expectedValues = { 0.0 };
            VerifyFromObject(Convert.ToDouble, Convert.ToDouble, testValues, expectedValues);

            Object[] invalidValues = { new Object(), DateTime.Now };
            VerifyFromObjectThrows<InvalidCastException>(Convert.ToDouble, Convert.ToDouble, invalidValues);
        }

        [Fact]
        public void FromSByte()
        {
            SByte[] testValues = { SByte.MaxValue, SByte.MinValue };
            Double[] expectedValues = { SByte.MaxValue, SByte.MinValue };
            Verify(Convert.ToDouble, testValues, expectedValues);
        }

        [Fact]
        public void FromSingle()
        {
            Single[] testValues = { Single.MaxValue, Single.MinValue, 0.0f };
            Double[] expectedValues = { Single.MaxValue, Single.MinValue, 0.0 };
            Verify(Convert.ToDouble, testValues, expectedValues);
        }

        [Fact]
        public void FromString()
        {
            String[] testValues = { Double.MinValue.ToString("R"), Double.MaxValue.ToString("R"), (0.0).ToString(), (10.0).ToString(), (-10.0).ToString(), null };
            Double[] expectedValues = { Double.MinValue, Double.MaxValue, 0.0, 10.0, -10.0, 0.0 };
            VerifyFromString(Convert.ToDouble, Convert.ToDouble, testValues, expectedValues);

            String[] overflowValues = { Double.MaxValue.ToString(), Double.MinValue.ToString() };
            VerifyFromStringThrows<OverflowException>(Convert.ToDouble, Convert.ToDouble, overflowValues);

            String[] formatExceptionValues = { "123xyz" };
            VerifyFromStringThrows<FormatException>(Convert.ToDouble, Convert.ToDouble, formatExceptionValues);
        }

        [Fact]
        public void FromUInt16()
        {
            UInt16[] testValues = { UInt16.MaxValue, UInt16.MinValue };
            Double[] expectedValues = { UInt16.MaxValue, UInt16.MinValue };
            Verify(Convert.ToDouble, testValues, expectedValues);
        }

        [Fact]
        public void FromUInt32()
        {
            UInt32[] testValues = { UInt32.MaxValue, UInt32.MinValue };
            Double[] expectedValues = { UInt32.MaxValue, UInt32.MinValue };
            Verify(Convert.ToDouble, testValues, expectedValues);
        }

        [Fact]
        public void FromUInt64()
        {
            UInt64[] testValues = { UInt64.MaxValue, UInt64.MinValue };
            Double[] expectedValues = { (Double)UInt64.MaxValue, (Double)UInt64.MinValue };
            Verify(Convert.ToDouble, testValues, expectedValues);
        }
    }
}


text:
import {
  ComponentFixture,
  ComponentFixtureAutoDetect, fakeAsync,
  TestBed, tick,
} from '@angular/core/testing';
import { of } from 'rxjs';
import { GcHistoryComponent } from './gc-history.component';
import { SharedTestingModule } from "../../../../../shared/shared.module";
import { GCHistory } from "../../../../../../../ng-swagger-gen/models/gchistory";
import { HttpHeaders, HttpResponse } from "@angular/common/http";
import { Registry } from "../../../../../../../ng-swagger-gen/models/registry";
import { GcService } from "../../../../../../../ng-swagger-gen/services/gc.service";
import { CURRENT_BASE_HREF } from "../../../../../shared/units/utils";
import { delay } from "rxjs/operators";

describe('GcHistoryComponent', () => {
  let component: GcHistoryComponent;
  let fixture: ComponentFixture<GcHistoryComponent>;
  const mockJobs: GCHistory[] = [
    {
      id: 1,
      job_name: 'test',
      job_kind: 'manual',
      schedule: null,
      job_status: 'pending',
      job_parameters: '{"dry_run":true}',
      creation_time: null,
      update_time: null,
    },
    {
      id: 2,
      job_name: 'test',
      job_kind: 'manual',
      schedule: null,
      job_status: 'finished',
      job_parameters: '{"dry_run":true}',
      creation_time: null,
      update_time: null,
    }
  ];
  const fakedGcService = {
    count: 0,
    getGCHistoryResponse() {
      if (this.count === 0) {
        this.count += 1;
        const response: HttpResponse<Array<Registry>> = new HttpResponse<Array<Registry>>({
          headers: new HttpHeaders({'x-total-count': [mockJobs[0]].length.toString()}),
          body: [mockJobs[0]]
        });
        return of(response).pipe(delay(0));
      } else {
        this.count += 1;
        const response: HttpResponse<Array<Registry>> = new HttpResponse<Array<Registry>>({
          headers: new HttpHeaders({'x-total-count': [mockJobs[1]].length.toString()}),
          body: [mockJobs[1]]
        });
        return of(response).pipe(delay(0));
      }
    }
  };
  beforeEach(() => {
    TestBed.configureTestingModule({
      declarations: [GcHistoryComponent],
      imports: [
        SharedTestingModule,
      ],
      providers: [
        {provide: GcService, useValue: fakedGcService},
        // open auto detect
        {provide: ComponentFixtureAutoDetect, useValue: true}
      ]
    });
  });

  beforeEach(() => {
    fixture = TestBed.createComponent(GcHistoryComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });
  afterEach(() => {
    if (component && component.timerDelay) {
      component.timerDelay.unsubscribe();
      component.timerDelay = null;
    }
  });
  it('should create', () => {
    expect(component).toBeTruthy();
  });
  it('should retry getting jobs', fakeAsync(() => {
    tick(10000);
    fixture.detectChanges();
    fixture.whenStable().then(() => {
      expect(component.jobs[0].job_status).toEqual('finished');
    });
  }));
  it('should return right log link', () => {
    expect(component.getLogLink('1')).toEqual(`${CURRENT_BASE_HREF}/system/gc/1/log`);
  });
});


text:
set -ex

# reload package sources
apt-get update
apt-get upgrade -y

# Install Python 3 for Home Assistant
apt-get install -y \
  python3 \
  python3-venv \
  python3-pip

# Create home assistant user
groupadd -f -r -g 1001 homeassistant
useradd -u 1001 -g 1001 -rm homeassistant

# Install Home Assistant
python3 -m venv /srv/homeassistant
chown -R homeassistant:homeassistant /srv/homeassistant
su homeassistant -s /bin/bash -c "source /srv/homeassistant/bin/activate && pip3 -V && pip install --upgrade pip"
su homeassistant -s /bin/bash -c "source /srv/homeassistant/bin/activate && pip3 install --no-cache-dir homeassistant==${HOME_ASSISTANT_VERSION}"
systemctl enable home-assistant@homeassistant.service

# TODO: Install all of Home Assistant dependencies

# Clean up Python caches
find /srv/homeassistant/lib/ | \
  grep -E "(__pycache__|\.pyc$)" | \
  xargs rm -rf

# Install mosquitto
apt-get install -y \
  mosquitto

# Install influxdb
wget -q "https://dl.influxdata.com/influxdb/releases/influxdb_${INFLUXDB_VERSION}_armhf.deb"
sudo dpkg -i "influxdb_${INFLUXDB_VERSION}_armhf.deb"

# TODO: Rename host name?
# TODO: Rename user and password?

# Cleanup APT cache and lists
apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


text:
FILE *inputSidFile = NULL;

void printWelcome() {
	printf("SID Companiet - 6510 Emulator\n");
	printf("\tDummy version\n");
    c64_printOpcodeStats();
}

int main(int argc, char **argv) {
	printWelcome();

	if (argv[1]) {
		inputSidFile = fopen(argv[1], "rb");
		if (inputSidFile == 0) {
			printf("ERROR: File %s not found\n", argv[1]);
			exit(1);
		}

		parseHeader();
		printf("Loaded %s, %d subsongs\n", argv[1], sh.songs);
	}

	console_interface();
	return 0;
}


text:
<?php

#echo("check_permissions.php
");
$sql = "
select
	sa.account_id,
	a.user_name,
	ap.application_id,
	ap.application_name,
	r.role_id,
	r.role_name,
	p.full_name,
	p.birth_date
from
	system_administrator sa
join
	applications ap on ap.application_name = ?
join
	role r on r.role_id = 1
join
	account a on sa.account_id = a.account_id
join
	people p on a.person_id = p.people_id
where
	a.user_name = ?
";
$params = array();
$params[] = $security["application"];
$params[] = $security["username"];
$res = sql_shell($sql, $params, $path, "esa_credentials");
if($res["rowcount"] != 0)
	{
	$results["account_id"] = $res["recordset"][0]["account_id"];
	$results["user_name"] = $res["recordset"][0]["user_name"];
	$results["application_id"] = $res["recordset"][0]["application_id"];
	$results["application_name"] = $res["recordset"][0]["application_name"];
	$results["role_id"] = $res["recordset"][0]["role_id"];
	$results["role_name"] = $res["recordset"][0]["role_name"];
	$results["security_token"] = $results["user_name"]."|".$res["recordset"][0]["full_name"]." ".$res["recordset"][0]["birth_date"]." ".$results["user_name"];
	$results["permission"] = "Identified in the system_administrator table.";
	}
else
	{
	$sql = "
select
	aar.account_id,
	a.user_name,
	ap.application_id,
	ap.application_name,
	r.role_id,
	r.role_name,
	p.full_name,
	p.birth_date
from
	acct_app_roles aar
join
	application_roles ar on aar.arid = ar.arid
join
	role r on ar.role_id = r.role_id
join
	account a on aar.account_id = a.account_id
join
	applications ap on ar.application_id = ap.application_id
join
	people p on a.person_id = p.people_id
where
	a.user_name = ? and
	ap.application_name = ?
";
	$params = array();
	$params[] = $security["username"];
	$params[] = $security["application"];
	$res = sql_shell($sql, $params, $path, "esa_credentials");
	if($res["rowcount"] > 0)
		{
		$results["account_id"] = $res["recordset"][0]["account_id"];
		$results["user_name"] = $res["recordset"][0]["user_name"];
		$results["application_id"] = $res["recordset"][0]["application_id"];
		$results["application_name"] = $res["recordset"][0]["application_name"];
		$results["role_id"] = $res["recordset"][0]["role_id"];
		$results["role_name"] = $res["recordset"][0]["role_name"];
		$results["security_token"] = $results["user_name"]."|".$res["recordset"][0]["full_name"]." ".$res["recordset"][0]["birth_date"]." ".$results["user_name"];
		$results["permission"] = "Identified in the acct_app_roles table.";
		#echo("<textarea style='width: 100%; height: 300px;'>");
		#print_r($results);
		#echo("</textarea>");
		}
	else
		{
		$results["ws_status"] = "failed";
		$results["ws_msg"] = "User [".$security["username"]."] has not been authorized to access [".$security["application"]."].";
		$security["request_status"] = $results["ws_status"];
		$security["status_msg"] = $results["ws_msg"];
		$security["description"] .= "Insuficient permissions and authority.
";
		}
	}
?>


text:
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * VideoMetadata.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
 */

package com.google.api.ads.admanager.axis.v202205;

/**
 * Metadata for a video asset.
 */
public class VideoMetadata  implements java.io.Serializable {
    /* The scalable type of the asset. This attribute is required. */
    private com.google.api.ads.admanager.axis.v202205.ScalableType scalableType;

    /* The duration of the asset in milliseconds. This attribute is
     * required. */
    private java.lang.Integer duration;

    /* The bit rate of the asset in kbps. If the asset can play at
     * a range of bit rates (such
     *                 as an Http Live Streaming video), then set the bit
     * rate to zero and populate the minimum
     *                 and maximum bit rate instead. */
    private java.lang.Integer bitRate;

    /* The minimum bitrate of the video in kbps.  Only set this if
     * the asset can play at a
     *                 range of bit rates. */
    private java.lang.Integer minimumBitRate;

    /* The maximum bitrate of the video in kbps.  Only set this if
     * the asset can play at a
     *                 range of bit rates. */
    private java.lang.Integer maximumBitRate;

    /* The size (width and height) of the asset. This attribute is
     * required. */
    private com.google.api.ads.admanager.axis.v202205.Size size;

    /* The mime type of the asset. This attribute is required. */
    private com.google.api.ads.admanager.axis.v202205.MimeType mimeType;

    /* The delivery type of the asset. This attribute is required. */
    private com.google.api.ads.admanager.axis.v202205.VideoDeliveryType deliveryType;

    /* The codecs of the asset. This attribute is optional and defaults
     * to an empty list. */
    private java.lang.String[] codecs;

    public VideoMetadata() {
    }

    public VideoMetadata(
           com.google.api.ads.admanager.axis.v202205.ScalableType scalableType,
           java.lang.Integer duration,
           java.lang.Integer bitRate,
           java.lang.Integer minimumBitRate,
           java.lang.Integer maximumBitRate,
           com.google.api.ads.admanager.axis.v202205.Size size,
           com.google.api.ads.admanager.axis.v202205.MimeType mimeType,
           com.google.api.ads.admanager.axis.v202205.VideoDeliveryType deliveryType,
           java.lang.String[] codecs) {
           this.scalableType = scalableType;
           this.duration = duration;
           this.bitRate = bitRate;
           this.minimumBitRate = minimumBitRate;
           this.maximumBitRate = maximumBitRate;
           this.size = size;
           this.mimeType = mimeType;
           this.deliveryType = deliveryType;
           this.codecs = codecs;
    }

    @Override
    public String toString() {
        return com.google.common.base.MoreObjects.toStringHelper(this.getClass())
            .omitNullValues()
            .add("bitRate", getBitRate())
            .add("codecs", getCodecs())
            .add("deliveryType", getDeliveryType())
            .add("duration", getDuration())
            .add("maximumBitRate", getMaximumBitRate())
            .add("mimeType", getMimeType())
            .add("minimumBitRate", getMinimumBitRate())
            .add("scalableType", getScalableType())
            .add("size", getSize())
            .toString();
    }

    /**
     * Gets the scalableType value for this VideoMetadata.
     *
     * @return scalableType   * The scalable type of the asset. This attribute is required.
     */
    public com.google.api.ads.admanager.axis.v202205.ScalableType getScalableType() {
        return scalableType;
    }

    /**
     * Sets the scalableType value for this VideoMetadata.
     *
     * @param scalableType   * The scalable type of the asset. This attribute is required.
     */
    public void setScalableType(com.google.api.ads.admanager.axis.v202205.ScalableType scalableType) {
        this.scalableType = scalableType;
    }

    /**
     * Gets the duration value for this VideoMetadata.
     *
     * @return duration   * The duration of the asset in milliseconds. This attribute is
     * required.
     */
    public java.lang.Integer getDuration() {
        return duration;
    }

    /**
     * Sets the duration value for this VideoMetadata.
     *
     * @param duration   * The duration of the asset in milliseconds. This attribute is
     * required.
     */
    public void setDuration(java.lang.Integer duration) {
        this.duration = duration;
    }

    /**
     * Gets the bitRate value for this VideoMetadata.
     *
     * @return bitRate   * The bit rate of the asset in kbps. If the asset can play at
     * a range of bit rates (such
     *                 as an Http Live Streaming video), then set the bit
     * rate to zero and populate the minimum
     *                 and maximum bit rate instead.
     */
    public java.lang.Integer getBitRate() {
        return bitRate;
    }

    /**
     * Sets the bitRate value for this VideoMetadata.
     *
     * @param bitRate   * The bit rate of the asset in kbps. If the asset can play at
     * a range of bit rates (such
     *                 as an Http Live Streaming video), then set the bit
     * rate to zero and populate the minimum
     *                 and maximum bit rate instead.
     */
    public void setBitRate(java.lang.Integer bitRate) {
        this.bitRate = bitRate;
    }

    /**
     * Gets the minimumBitRate value for this VideoMetadata.
     *
     * @return minimumBitRate   * The minimum bitrate of the video in kbps.  Only set this if
     * the asset can play at a
     *                 range of bit rates.
     */
    public java.lang.Integer getMinimumBitRate() {
        return minimumBitRate;
    }

    /**
     * Sets the minimumBitRate value for this VideoMetadata.
     *
     * @param minimumBitRate   * The minimum bitrate of the video in kbps.  Only set this if
     * the asset can play at a
     *                 range of bit rates.
     */
    public void setMinimumBitRate(java.lang.Integer minimumBitRate) {
        this.minimumBitRate = minimumBitRate;
    }

    /**
     * Gets the maximumBitRate value for this VideoMetadata.
     *
     * @return maximumBitRate   * The maximum bitrate of the video in kbps.  Only set this if
     * the asset can play at a
     *                 range of bit rates.
     */
    public java.lang.Integer getMaximumBitRate() {
        return maximumBitRate;
    }

    /**
     * Sets the maximumBitRate value for this VideoMetadata.
     *
     * @param maximumBitRate   * The maximum bitrate of the video in kbps.  Only set this if
     * the asset can play at a
     *                 range of bit rates.
     */
    public void setMaximumBitRate(java.lang.Integer maximumBitRate) {
        this.maximumBitRate = maximumBitRate;
    }

    /**
     * Gets the size value for this VideoMetadata.
     *
     * @return size   * The size (width and height) of the asset. This attribute is
     * required.
     */
    public com.google.api.ads.admanager.axis.v202205.Size getSize() {
        return size;
    }

    /**
     * Sets the size value for this VideoMetadata.
     *
     * @param size   * The size (width and height) of the asset. This attribute is
     * required.
     */
    public void setSize(com.google.api.ads.admanager.axis.v202205.Size size) {
        this.size = size;
    }

    /**
     * Gets the mimeType value for this VideoMetadata.
     *
     * @return mimeType   * The mime type of the asset. This attribute is required.
     */
    public com.google.api.ads.admanager.axis.v202205.MimeType getMimeType() {
        return mimeType;
    }

    /**
     * Sets the mimeType value for this VideoMetadata.
     *
     * @param mimeType   * The mime type of the asset. This attribute is required.
     */
    public void setMimeType(com.google.api.ads.admanager.axis.v202205.MimeType mimeType) {
        this.mimeType = mimeType;
    }

    /**
     * Gets the deliveryType value for this VideoMetadata.
     *
     * @return deliveryType   * The delivery type of the asset. This attribute is required.
     */
    public com.google.api.ads.admanager.axis.v202205.VideoDeliveryType getDeliveryType() {
        return deliveryType;
    }

    /**
     * Sets the deliveryType value for this VideoMetadata.
     *
     * @param deliveryType   * The delivery type of the asset. This attribute is required.
     */
    public void setDeliveryType(com.google.api.ads.admanager.axis.v202205.VideoDeliveryType deliveryType) {
        this.deliveryType = deliveryType;
    }

    /**
     * Gets the codecs value for this VideoMetadata.
     *
     * @return codecs   * The codecs of the asset. This attribute is optional and defaults
     * to an empty list.
     */
    public java.lang.String[] getCodecs() {
        return codecs;
    }

    /**
     * Sets the codecs value for this VideoMetadata.
     *
     * @param codecs   * The codecs of the asset. This attribute is optional and defaults
     * to an empty list.
     */
    public void setCodecs(java.lang.String[] codecs) {
        this.codecs = codecs;
    }

    public java.lang.String getCodecs(int i) {
        return this.codecs[i];
    }

    public void setCodecs(int i, java.lang.String _value) {
        this.codecs[i] = _value;
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof VideoMetadata)) return false;
        VideoMetadata other = (VideoMetadata) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = true &&
            ((this.scalableType==null && other.getScalableType()==null) ||
             (this.scalableType!=null &&
              this.scalableType.equals(other.getScalableType()))) &&
            ((this.duration==null && other.getDuration()==null) ||
             (this.duration!=null &&
              this.duration.equals(other.getDuration()))) &&
            ((this.bitRate==null && other.getBitRate()==null) ||
             (this.bitRate!=null &&
              this.bitRate.equals(other.getBitRate()))) &&
            ((this.minimumBitRate==null && other.getMinimumBitRate()==null) ||
             (this.minimumBitRate!=null &&
              this.minimumBitRate.equals(other.getMinimumBitRate()))) &&
            ((this.maximumBitRate==null && other.getMaximumBitRate()==null) ||
             (this.maximumBitRate!=null &&
              this.maximumBitRate.equals(other.getMaximumBitRate()))) &&
            ((this.size==null && other.getSize()==null) ||
             (this.size!=null &&
              this.size.equals(other.getSize()))) &&
            ((this.mimeType==null && other.getMimeType()==null) ||
             (this.mimeType!=null &&
              this.mimeType.equals(other.getMimeType()))) &&
            ((this.deliveryType==null && other.getDeliveryType()==null) ||
             (this.deliveryType!=null &&
              this.deliveryType.equals(other.getDeliveryType()))) &&
            ((this.codecs==null && other.getCodecs()==null) ||
             (this.codecs!=null &&
              java.util.Arrays.equals(this.codecs, other.getCodecs())));
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = 1;
        if (getScalableType() != null) {
            _hashCode += getScalableType().hashCode();
        }
        if (getDuration() != null) {
            _hashCode += getDuration().hashCode();
        }
        if (getBitRate() != null) {
            _hashCode += getBitRate().hashCode();
        }
        if (getMinimumBitRate() != null) {
            _hashCode += getMinimumBitRate().hashCode();
        }
        if (getMaximumBitRate() != null) {
            _hashCode += getMaximumBitRate().hashCode();
        }
        if (getSize() != null) {
            _hashCode += getSize().hashCode();
        }
        if (getMimeType() != null) {
            _hashCode += getMimeType().hashCode();
        }
        if (getDeliveryType() != null) {
            _hashCode += getDeliveryType().hashCode();
        }
        if (getCodecs() != null) {
            for (int i=0;
                 i<java.lang.reflect.Array.getLength(getCodecs());
                 i++) {
                java.lang.Object obj = java.lang.reflect.Array.get(getCodecs(), i);
                if (obj != null &&
                    !obj.getClass().isArray()) {
                    _hashCode += obj.hashCode();
                }
            }
        }
        __hashCodeCalc = false;
        return _hashCode;
    }

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(VideoMetadata.class, true);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "VideoMetadata"));
        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("scalableType");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "scalableType"));
        elemField.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "ScalableType"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("duration");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "duration"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("bitRate");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "bitRate"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("minimumBitRate");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "minimumBitRate"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("maximumBitRate");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "maximumBitRate"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("size");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "size"));
        elemField.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "Size"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("mimeType");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "mimeType"));
        elemField.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "MimeType"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("deliveryType");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "deliveryType"));
        elemField.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "VideoDeliveryType"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("codecs");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202205", "codecs"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        elemField.setMaxOccursUnbounded(true);
        typeDesc.addFieldDesc(elemField);
    }

    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanSerializer(
            _javaType, _xmlType, typeDesc);
    }

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }

}


text:
<?php

namespace App\Repositories;

use Core\Database\Repository;

/**
 * Class UserSettingsRepository
 * @package App\Repositories
 * @author Martin Brom
 */
class UserSettingsRepository
{
    /** @var Repository */
    private $baseRepository;

    /**
     * UserSettingsRepository constructor.
     * @param Repository $baseRepository
     */
    function __construct(Repository $baseRepository) {
        $this->baseRepository = $baseRepository;
    }

    /**
     * @param $user_id
     * @param $display_name
     * @return bool
     */
    public function changeDisplayName($user_id, $display_name) {
        $query = "UPDATE users
                SET display_name = :display_name
                WHERE id = :id";
        $data = ['id' => $user_id, 'display_name' => $display_name];
        return $this->baseRepository->run($query, $data);
    }

    /**
     * @param $user_id
     * @param $password
     * @return bool
     */
    public function changePassword($user_id, $password) {
        $query = "UPDATE users
                SET `password` = :password
                WHERE `id` = :id";
        $data = ['id' => $user_id, 'password' => $password];
        return $this->baseRepository->run($query, $data);
    }

    /**
     * @param $email
     * @param $token
     * @return bool
     */
    public function setPasswordResetToken($email, $token) {
        $query = "UPDATE users
                SET password_reset_token = :token
                WHERE email = :email";
        $data = ['email' => $email, 'token' => $token];
        return $this->baseRepository->run($query, $data);
    }

    /**
     * @param $email
     * @param $token
     * @return bool
     */
    public function passwordResetExists($email, $token) {
        $query = "SELECT count(ID) as count
                FROM users
                WHERE email = :email
                AND password_reset_token = :token";
        $data = ['email' => $email, 'token' => $token];
        return $this->baseRepository->fetch($query, $data)['count'] > 0;
    }

    /**
     * @param $email
     * @param $hash
     * @return bool
     */
    public function resetPassword($email, $hash) {
        $query = "UPDATE users
                SET password = :hash, password_reset_token = NULL
                WHERE email = :email";
        $data = ['email' => $email, 'hash' => $hash];
        return $this->baseRepository->run($query, $data);
    }
}


text:
'use strict';

/**
 * Module dependencies.
 */
var should = require('should'),
	db = require('../../config/sequelize'),
	User = db.user;

/**
 * Globals
 */
var user, user2;

/**
 * Unit tests
 */
describe('User Model Unit Tests:', function() {
	before(function(done) {
		user = User.build({
			email: 'test@test.com',
			username: 'username',
			password: 'passwordhastobelong',
			provider: 'local'
		});
		user2 = User.build({
			email: 'test@test.com',
			username: 'username',
			password: 'passwordhastobelong',
			provider: 'local'
		});

		done();
	});

	describe('Method Save', function() {
		it('should begin with no users', function(done) {
			User.findAll().then(function(users) {
				users.should.have.length(0);
				done();
			});
		});

		it('should be able to save without problems', function(done) {
			user.save().then(function(u) {
                should.exist(u);
                done();
            });
		});

		it('should fail to save an existing user again', function(done) {
			user.save();

			user2.save().then(function() {
				winston.info('This message should never display!');
			}).catch(function(err) {
                done();
            });
		});

		it('should be able to show an error when try to save without username', function(done) {
			user.username = '';

			user.save().then(function() {
                winston.info('This message should never display!');
			}).catch(function(err) {
                done();
            });
		});
	});

	after(function(done) {
        User.destroy({ where: {}});
		done();
	});
});


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package openEHR_DAO;

import Elements.ArchetypeFile;
import Utils.PropertiesAccess;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.filechooser.FileNameExtensionFilter;
import openEHR_CONTROL.Parser;
import org.apache.xmlbeans.XmlException;
import org.openehr.schemas.v1.ArchetypeDocument;

/**
 *
 * @author vinicius
 */
public class ArchetypeAccess {

    private List<ArchetypeFile> full_archetype_list = new ArrayList<>();
    private List<String> types = new ArrayList<>();

    public ArchetypeAccess() {
        fillArchetypesList(new File(PropertiesAccess.getProp().getProperty("repository.dir")));
    }
/**
 * Build the archetype document from the parameter
 * @param file
 * @return
 */
    public static ArchetypeFile getArchetypeFile(File file) {
        ArchetypeDocument ad1 = null;
        try {
            ad1 = ArchetypeDocument.Factory.parse(file);
        } catch (XmlException | IOException ex) {
            Logger.getLogger(Parser.class.getName()).log(Level.SEVERE, null, ex);
        }
        ArchetypeFile af = new ArchetypeFile();
        af.setId(ad1.getArchetype().getArchetypeId().getValue());
        af.setType(ad1.getArchetype().getDefinition().getRmTypeName());
        return af;
    }
/**
 * Fills an archetype list
 * @param dir
 */
    public final void fillArchetypesList(File dir) {
        FileNameExtensionFilter fnef = new FileNameExtensionFilter(null, "xml");
        ArchetypeFile afile;
        for (File f : dir.listFiles()) {
            if (f.isDirectory()) {
                fillArchetypesList(f);
            } else {
                if (fnef.accept(f)) {
                    afile = ArchetypeAccess.getArchetypeFile(f);
                    if (!types.contains(afile.getType())) {
                        types.add(afile.getType());
                    }
                    getFull_archetype_list().add(ArchetypeAccess.getArchetypeFile(f));
                }
            }
        }
    }

    public List<ArchetypeFile> getFull_archetype_list() {
        return full_archetype_list;
    }

    public void setFull_archetype_list(List<ArchetypeFile> full_archetype_list) {
        this.full_archetype_list = full_archetype_list;
    }
/**
 * Gets archetypes by type ( i.e Observation )
 * @param type
 * @return
 */
    public List<ArchetypeFile> getArchetypesByType(String type) {
        List<ArchetypeFile> listbytype = new ArrayList<>();
        for (ArchetypeFile afile : full_archetype_list) {
            if (afile.getType().equals(type)) {
                listbytype.add(afile);
            }
        }
        return listbytype;
    }

    public List<String> getTypes() {
        return types;
    }

    public void setTypes(List<String> types) {
        this.types = types;
    }
}


text:
Chipotle-Studios
================

A teamwork effort of Veer, Corbin, and Jeremy, to create awesome things for people who don't have them.


text:
module System.Taffybar.Hooks.PagerHints (
  -- * Usage
  -- $usage
  pagerHints
) where

import Codec.Binary.UTF8.String (encode)
import Control.Monad
import Data.Monoid
import Foreign.C.Types (CInt)
import XMonad
import qualified XMonad.StackSet as W

-- $usage
--
-- You can use this module with the following in your @xmonad.hs@ file:
--
-- > import System.Taffybar.Hooks.PagerHints (pagerHints)
-- >
-- > main = xmonad $ ewmh $ pagerHints $ defaultConfig
-- > ...

-- | The \"Current Layout\" custom hint.
xLayoutProp :: X Atom
xLayoutProp = return =<< getAtom "_XMONAD_CURRENT_LAYOUT"

-- | The \"Visible Workspaces\" custom hint.
xVisibleProp :: X Atom
xVisibleProp = return =<< getAtom "_XMONAD_VISIBLE_WORKSPACES"

-- | Add support for the \"Current Layout\" and \"Visible Workspaces\" custom
-- hints to the given config.
pagerHints :: XConfig a -> XConfig a
pagerHints c = c { handleEventHook = handleEventHook c +++ pagerHintsEventHook
           , logHook = logHook c +++ pagerHintsLogHook }
  where x +++ y = x `mappend` y

-- | Update the current values of both custom hints.
pagerHintsLogHook :: X ()
pagerHintsLogHook = do
  withWindowSet
    (setCurrentLayout . description . W.layout . W.workspace . W.current)
  withWindowSet
    (setVisibleWorkspaces . map (W.tag . W.workspace) . W.visible)

-- | Set the value of the \"Current Layout\" custom hint to the one given.
setCurrentLayout :: String -> X ()
setCurrentLayout l = withDisplay $ \dpy -> do
  r <- asks theRoot
  a <- xLayoutProp
  c <- getAtom "UTF8_STRING"
  let l' = map fromIntegral (encode l)
  io $ changeProperty8 dpy r a c propModeReplace l'

-- | Set the value of the \"Visible Workspaces\" hint to the one given.
setVisibleWorkspaces :: [String] -> X ()
setVisibleWorkspaces vis = withDisplay $ \dpy -> do
  r  <- asks theRoot
  a  <- xVisibleProp
  c  <- getAtom "UTF8_STRING"
  let vis' = map fromIntegral $ concatMap ((++[0]) . encode) vis
  io $ changeProperty8 dpy r a c propModeReplace vis'

-- | Handle all \"Current Layout\" events received from pager widgets, and
-- set the current layout accordingly.
pagerHintsEventHook :: Event -> X All
pagerHintsEventHook (ClientMessageEvent {
    ev_message_type = mt,
    ev_data = d
  }) = withWindowSet $ \_ -> do
  a <- xLayoutProp
  when (mt == a) $ sendLayoutMessage d
  return (All True)
pagerHintsEventHook _ = return (All True)

-- | Request a change in the current layout by sending an internal message
-- to XMonad.
sendLayoutMessage :: [CInt] -> X ()
sendLayoutMessage evData = case evData of
  []   -> return ()
  x:_  -> if x < 0
            then sendMessage FirstLayout
            else sendMessage NextLayout


text:
@interface BBLibrarySelectDatasourceDelegate : NSObject <UITableViewDelegate, UITableViewDataSource>

// Contains an array of BBPlace objects
@property (nonatomic, strong) NSArray *data; // <BBPlace>

//@property (nonatomic, weak) id <BBLibrarySelectDelegate> delegate;
@property (nonatomic, weak) id <BBLibrarySelectDelegate> selectDelegate;

@end


text:
#ifndef TouchDisambiguation_h
#define TouchDisambiguation_h

#include <wtf/Vector.h>

namespace WebCore {

class Frame;
class IntRect;
class Node;

void findGoodTouchTargets(const IntRect& touchBox, Frame* mainFrame, Vector<IntRect>& goodTargets, Vector<Node*>& highlightNodes);

} // namespace WebCore

#endif


text:
---
title: ContextMenu
order: 1
---

Using contextMenu in G6.

## Usage

The demo below show how to use contextMenu on a graph. Menu's style can be defined by the CSS:

```
/* Define the CSS with the id of your menu */
  #contextMenu {
    position: absolute;
    /* ... Other styles */
  }
  #contextMenu li {
    cursor: pointer;
		/* ... Other styles */
  }
  #contextMenu li:hover {
    color: #aaa;
    /* ... Other styles */
  }
`);
```


text:
package com.gt.debugconsole;

import org.apache.wicket.protocol.http.IWebApplicationFactory;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.protocol.http.WicketFilter;

/**
 *
 * @author Gábor Horváth
 */
public class ConsoleApplicationFactory implements IWebApplicationFactory {

	@Override
	public WebApplication createApplication(final WicketFilter filter) {
		return new ConsoleApplicationImpl();
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void destroy(final WicketFilter filter) {
	}

}


text:
<?php

use yii\db\Migration;
use yii\db\Schema;

class m161201_144656_add_new_field_to_profile extends Migration
{
    public function up()
    {
        $this->addColumn('{{%profile}}', 'sex', Schema::TYPE_STRING . '(255)');
        $this->addColumn('{{%profile}}', 'date', Schema::TYPE_INTEGER);
        $this->addColumn('{{%profile}}', 'month', Schema::TYPE_INTEGER);
        $this->addColumn('{{%profile}}', 'year', Schema::TYPE_INTEGER);
        $this->addColumn('{{%profile}}', 'avatar', Schema::TYPE_STRING . '(255)');
        $this->addColumn('{{%profile}}', 'banner', Schema::TYPE_STRING . '(255)');
    }

    public function down()
    {
        $this->dropColumn('{{%profile}}', 'banner');
        $this->dropColumn('{{%profile}}', 'avatar');
        $this->dropColumn('{{%profile}}', 'year');
        $this->dropColumn('{{%profile}}', 'month');
        $this->dropColumn('{{%profile}}', 'date');
        $this->dropColumn('{{%profile}}', 'sex');
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}


text:
package middleware

import (
	"errors"

	tele "gopkg.in/telebot.v3"
)

// AutoRespond returns a middleware that automatically responds
// to every callback.
func AutoRespond() tele.MiddlewareFunc {
	return func(next tele.HandlerFunc) tele.HandlerFunc {
		return func(c tele.Context) error {
			if c.Callback() != nil {
				defer c.Respond()
			}
			return next(c)
		}
	}
}

// IgnoreVia returns a middleware that ignores all the
// "sent via" messages.
func IgnoreVia() tele.MiddlewareFunc {
	return func(next tele.HandlerFunc) tele.HandlerFunc {
		return func(c tele.Context) error {
			if msg := c.Message(); msg != nil && msg.Via != nil {
				return nil
			}
			return next(c)
		}
	}
}

// Recover returns a middleware that recovers a panic happened in
// the handler.
func Recover(onError ...func(error)) tele.MiddlewareFunc {
	return func(next tele.HandlerFunc) tele.HandlerFunc {
		return func(c tele.Context) error {
			var f func(error)
			if len(onError) > 0 {
				f = onError[0]
			} else {
				f = func(err error) {
					c.Bot().OnError(err, nil)
				}
			}

			defer func() {
				if r := recover(); r != nil {
					if err, ok := r.(error); ok {
						f(err)
					} else if s, ok := r.(string); ok {
						f(errors.New(s))
					}
				}
			}()

			return next(c)
		}
	}
}


text:
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.password_manager.settings;

import android.content.Context;

import androidx.annotation.Nullable;

import org.chromium.base.Callback;
import org.chromium.base.IntStringCallback;
import org.chromium.components.browser_ui.settings.SettingsLauncher;

import java.util.ArrayList;

/**
 * Fake implementation for the PasswordManagerHandler.
 */
final class FakePasswordManagerHandler implements PasswordManagerHandler {
    // This class has exactly one observer, set on construction and expected to last at least as
    // long as this object (a good candidate is the owner of this object).
    private final PasswordListObserver mObserver;

    // The faked contents of the password store to be displayed.
    private ArrayList<SavedPasswordEntry> mSavedPasswords = new ArrayList<SavedPasswordEntry>();

    // The faked contents of the saves password exceptions to be displayed.
    private ArrayList<String> mSavedPasswordExeptions = new ArrayList<>();

    // The following three data members are set once {@link #serializePasswords()} is called.
    @Nullable
    private IntStringCallback mExportSuccessCallback;

    @Nullable
    private Callback<String> mExportErrorCallback;

    @Nullable
    private String mExportTargetPath;

    void setSavedPasswords(ArrayList<SavedPasswordEntry> savedPasswords) {
        mSavedPasswords = savedPasswords;
    }

    void setSavedPasswordExceptions(ArrayList<String> savedPasswordExceptions) {
        mSavedPasswordExeptions = savedPasswordExceptions;
    }

    IntStringCallback getExportSuccessCallback() {
        return mExportSuccessCallback;
    }

    Callback<String> getExportErrorCallback() {
        return mExportErrorCallback;
    }

    String getExportTargetPath() {
        return mExportTargetPath;
    }

    /**
     * Constructor.
     * @param observer The only observer.
     */
    FakePasswordManagerHandler(PasswordListObserver observer) {
        mObserver = observer;
    }

    @Override
    public void insertPasswordEntryForTesting(String origin, String username, String password) {
        mSavedPasswords.add(new SavedPasswordEntry(origin, username, password));
    }

    // Pretends that the updated lists are |mSavedPasswords| for the saved passwords and an
    // empty list for exceptions and immediately calls the observer.
    @Override
    public void updatePasswordLists() {
        mObserver.passwordListAvailable(mSavedPasswords.size());
        mObserver.passwordExceptionListAvailable(mSavedPasswordExeptions.size());
    }

    @Override
    public SavedPasswordEntry getSavedPasswordEntry(int index) {
        return mSavedPasswords.get(index);
    }

    @Override
    public String getSavedPasswordException(int index) {
        return mSavedPasswordExeptions.get(index);
    }

    @Override
    public void removeSavedPasswordEntry(int index) {
        assert false : "Define this method before starting to use it in tests.";
    }

    @Override
    public void removeSavedPasswordException(int index) {
        assert false : "Define this method before starting to use it in tests.";
    }

    @Override
    public void serializePasswords(
            String targetPath, IntStringCallback successCallback, Callback<String> errorCallback) {
        mExportSuccessCallback = successCallback;
        mExportErrorCallback = errorCallback;
        mExportTargetPath = targetPath;
    }

    @Override
    public void showPasswordEntryEditingView(
            Context context, SettingsLauncher launcher, int index, boolean isBlockedCredential) {
        assert false : "Define this method before starting to use it in tests.";
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.compute.models;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/** Defines values for UpgradeOperationInvoker. */
public enum UpgradeOperationInvoker {
    /** Enum value Unknown. */
    UNKNOWN("Unknown"),

    /** Enum value User. */
    USER("User"),

    /** Enum value Platform. */
    PLATFORM("Platform");

    /** The actual serialized value for a UpgradeOperationInvoker instance. */
    private final String value;

    UpgradeOperationInvoker(String value) {
        this.value = value;
    }

    /**
     * Parses a serialized value to a UpgradeOperationInvoker instance.
     *
     * @param value the serialized value to parse.
     * @return the parsed UpgradeOperationInvoker object, or null if unable to parse.
     */
    @JsonCreator
    public static UpgradeOperationInvoker fromString(String value) {
        UpgradeOperationInvoker[] items = UpgradeOperationInvoker.values();
        for (UpgradeOperationInvoker item : items) {
            if (item.toString().equalsIgnoreCase(value)) {
                return item;
            }
        }
        return null;
    }

    @JsonValue
    @Override
    public String toString() {
        return this.value;
    }
}


text:
{% extends "base_pacc.html" %}
{% load i18n %}

{% block title %}Registro - {{ block.super }}{% endblock %}

{% block main_content %}

<form method="post" action=".">{% csrf_token %}
  {{ form.as_p }}

  <input type="submit" value="{% trans 'Submit' %}" />
</form>

{% endblock %}


text:
package org.infinispan.commands.write;

import org.infinispan.commands.FlagAffectedCommand;
import org.infinispan.commands.VisitableCommand;

import java.util.Set;

/**
 * A command that modifies the cache in some way
 *
 * @author Manik Surtani
 * @since 4.0
 */
public interface WriteCommand extends VisitableCommand, FlagAffectedCommand {
   /**
    * Some commands may want to provide information on whether the command was successful or not.  This is different
    * from a failure, which usually would result in an exception being thrown.  An example is a putIfAbsent() not doing
    * anything because the key in question was present.  This would result in a isSuccessful() call returning false.
    *
    * @return true if the command completed successfully, false otherwise.
    */
   boolean isSuccessful();

   /**
    * Certain commands only work based on a certain condition or state of the cache.  For example, {@link
    * org.infinispan.Cache#putIfAbsent(Object, Object)} only does anything if a condition is met, i.e., the entry in
    * question is not already present.  This method tests whether the command in question is conditional or not.
    *
    * @return true if the command is conditional, false otherwise
    */
   boolean isConditional();

   /**
    *
    * @return a collection of keys affected by this write command.  Some commands - such as ClearCommand - may return
    * an empty collection for this method.
    */
   Set<Object> getAffectedKeys();

   /**
    * @return  {@code true} if the key was previously read in the transaction during this command execution
    */
   boolean wasPreviousRead();
}