text:
!
! m_vstringformat --
!
!   The module m_vstringformat provides services to format one string, that is to
!   say to convert a basic fortran data type into a dynamic vstring.
!   The current version of m_vstringformat can handle logical variables
!   and integers of all kinds. The format can be given by the client code,
!   or computed automatically. The format can be given as a basic character
!   string, or as a vstring.
!
!   Overview
!   The only method provided here is vstring_format, which takes one basic
!   basic fortran data type as the first argument (and, optionnaly, a format),
!   and returns a dynamic string which represents that value.
!
!   Formatting logical values
!   One can format a logical into a vstring with automatic or explicit format.
!   In the following sample, one format the ".false." logical into a vstring.
!   After formatting, the string "mystring" has a length of 1 and its content
!   is "F".
!
!      logical :: mybool
!      type ( t_vstring ) :: mystring
!      mybool = .false.
!      mystring = vstring_format ( mybool )
!
!   In the following sample, one format the ".false." logical into a vstring
!   with an explicit format given as a character string :
!
!      logical :: mybool
!      type ( t_vstring ) :: mystring
!      mybool = .false.
!      mystring = vstring_format ( mybool , "(L3)" )
!
!   After formatting, the string "mystring" has a length of 3 and its content
!   is "  F".
!
!   In the following sample, one format the ".false." logical into a vstring
!   with an explicit format given as a vstring :
!
!      logical :: mybool
!      type ( t_vstring ) :: mystring
!      type ( t_vstring ) :: myformat
!      mybool = .false.
!      call vstring_new ( myformat , "(L3)" )
!      mystring = vstring_format ( mybool , myformat )
!      call vstring_free ( myformat )
!
!   Formatting integer values
!   One can format an integer into a vstring, with automatic or explict format.
!   The string formatting system can handle all fortran kinds of integers.
!   The automatic format makes so that the resulting string has the
!   length which exactly matches the number of digits necessary to represent
!   the integer :
!   - if the integer is negative, the "-" sign is at the begining of the string,
!   - if the integer is positive, the "+" sign is not in the string.
!   In the following example, one formats the integer 2008 into a vstring.
!   After formatting, the string has a length of 4 and its content is the
!   string "2008".
!
!      type ( t_vstring ) :: mystring
!      mystring = vstring_format ( 2008 )
!
!   To acheive the same effect, one can use the "I0" format of the fortran 90
!   standard :
!
!      type ( t_vstring ) :: mystring
!      mystring = vstring_format ( 2008 , "(I0)" )
!
!   The component can handle long integers with specified kinds 1, 2, 4 or 8.
!   In the following example, one automatically format a 32-bits integer
!   (1073741824 = 2**31) into a dynamic string.
!
!      integer (kind=4) :: integerkind4 = 1073741824
!      mystring = vstring_format ( integerkind4 )
!
!   After formatting, the string has a length of 4 and its content is the
!   string "1073741824".
!
!   Limitations
!   The current implementation of the string formatting is based
!   on the standard "write" fortran statement, which takes
!   a basic character string as argument.
!   Moreover the format given to the string formatting command
!   is not analysed at all, so that the length of the resulting
!   string is not computed.
!   The current component use therefore a character string of
!   fixed length VSTRING_FORMAT_MAXIMUM_FORMAT_LENGTH.
!   This leads to at least two limitations :
!   - if the client code has to manage formated strings which length is over
!     VSTRING_FORMAT_MAXIMUM_FORMAT_LENGTH characters, the
!     current algorithm will generate an error at execution time.
!   - the "write" statement has to manage a long string, even
!     if the result is short, which raise performances issues.
!
!   The current string formatting takes only one value.
!   An effective implementation would in fact take a list of
!   one or more arguments, which may be of different types.
!
!   The current implementation does not manage real values.
!
!   The limitations of the current component are so strong that the
!   component should not be released... but is useful to format
!   integers and that is why it has been finally released.
!
!   Planned features
!   It is expected that future releases of this component can manage
!   more basic data types, including real types of all kinds.
!   Future releases may also extend the formats by taking into account
!   string formatting coming from other languages than fortran (for example C),
!   including:
!   - the "-" specification which specifies that the converted argument
!     should be left-justified in its field
!   - the "+" specification which specifies that a number should always
!     be printed with a sign, even if positive.
!   - etc...
!
! Copyright (c) 2008 Michael Baudin michael.baudin@gmail.com
!
! $Id: m_vstringformat.f90,v 1.2 2008/06/12 16:23:47 relaxmike Exp $
!
!
module m_vstringformat
  use m_vstring, only : &
       t_vstring, &
       vstring_new, &
       vstring_free , &
       vstring_exists , &
       vstring_length , &
       vstring_range , &
       vstring_cast , &
       vstring_append
  implicit none
  private
  !
  ! Public methods
  !
  public :: vstring_format
  !
  ! vstring_format --
  !   Generic converter from a basic fortran data type into a vstring.
  !   Returns a new dynamic string with type t_vstring by formating the
  !   given value against the optional format fmt.
  ! Arguments :
  !   value : logical to format
  !     or integer of kind 1, 2, 4 or 8 to format
  !   fmt, optional : if provided, then this format is used to compute the
  !     new string. If format is provided, it may be either with a character(len=*) type
  !     or with a t_vstring type.
  !     If format is not provided, an automatic format is computed and applied
  !     to compute the new string. With automatic format, the computed
  !     string has a minimum length, that is, does not contain any blank and
  !     begins with "-" only if the value is a strictly negative integer.
  !
  interface vstring_format
     !
     ! Logical
     !
     module procedure vstring_format_auto_logical
     module procedure vstring_format_char_logical
     module procedure vstring_format_vstring_logical
     !
     ! Integer
     !
     module procedure vstring_format_auto_integer_kind1
     module procedure vstring_format_auto_integer_kind2
     module procedure vstring_format_auto_integer_kind4
     module procedure vstring_format_auto_integer_kind8
     module procedure vstring_format_char_integer_kind1
     module procedure vstring_format_char_integer_kind2
     module procedure vstring_format_char_integer_kind4
     module procedure vstring_format_char_integer_kind8
     module procedure vstring_format_vstring_integer_kind1
     module procedure vstring_format_vstring_integer_kind2
     module procedure vstring_format_vstring_integer_kind4
     module procedure vstring_format_vstring_integer_kind8
  end interface vstring_format
  !
  ! Set to true to stop whenever an error comes in the vstring component.
  logical, save :: vstringformat_stoponerror = .true.
  !
  ! Constants
  !
  integer, parameter :: VSTRING_FORMAT_MAXIMUM_FORMAT_LENGTH = 1000
contains
  !
  ! vstring_format_auto_logical --
  !   Returns a new vstring by formatting a logical with automatic format.
  !
  function vstring_format_auto_logical ( value ) result ( newstring )
    logical , intent(in) :: value
    type ( t_vstring ) :: newstring
    character(len=1) :: charlength1
    write ( charlength1 , "(l1)" ) value
    call vstring_new ( newstring , charlength1 )
  end function vstring_format_auto_logical
  !
  ! vstring_format_char_logical --
  !   Returns a new vstring by formatting a logical with the given format.
  !
  function vstring_format_char_logical ( value , fmt ) result ( newstring )
    logical , intent(in) :: value
    character(len=*) , intent(in) :: fmt
    type ( t_vstring ) :: newstring
    ! TODO : what if the logical is expected to be formatted with more than the maximum possible number of characters ?
    character(len=VSTRING_FORMAT_MAXIMUM_FORMAT_LENGTH) :: charstring
    write ( charstring , fmt ) value
    !
    ! Note:
    !   The "trim" removes all trailing blanks and, since fortran add
    !   blanks only at the left, the string result of trim(charstring) is
    !   the expected one.
    !
    call vstring_new ( newstring , trim(charstring) )
  end function vstring_format_char_logical
  !
  ! vstring_format_vstring_logical --
  !   Returns a new vstring by formatting a logical with the given vstring format.
  !
  function vstring_format_vstring_logical ( value , fmt ) result ( newstring )
    logical , intent(in) :: value
    type ( t_vstring ) , intent(in) :: fmt
    type ( t_vstring ) :: newstring
    character(len=vstring_length(fmt)) :: fmt_charstring
    ! Downgrade the format to a character string
    call vstring_cast ( fmt , fmt_charstring )
    newstring = vstring_format_char_logical ( value , fmt_charstring )
  end function vstring_format_vstring_logical
  !
  ! vstring_format_auto_integer_kind1 --
  !   Format an integer(kind=1) into a vstring.
  ! Arguments :
  !   value : integer of kind 1 to format
  !   fmt, optional : if provided, then this format is used to compute the
  !     new string.
  !     If not provided, an automatic format is computed and applied
  !     to compute the new string. With automatic format, the computed
  !     string has a minimum length, that is, does not contain any blank and
  !     begins with "-" only if the value is a strictly negative integer.
  !     The format may be provided either with a character(len=*) type
  !     or with a t_vstring type.
  !
#define _INTEGER_FORMAT_VSTRING_ROUTINE vstring_format_vstring_integer_kind1
#define _INTEGER_FORMAT_CHAR_ROUTINE vstring_format_char_integer_kind1
#define _INTEGER_FORMAT_AUTO_ROUTINE vstring_format_auto_integer_kind1
#define _INTEGER_COMPUTE_AUTOFORMAT_ROUTINE vstring_compute_autoformat_integer_kind1
#define _INTEGER_COMPUTE_CHARNB vstring_format_intcharnb_kind1
#define _INTEGER_KIND 1
#include "m_vstringformat_integerkind_template.f90"
#undef _INTEGER_FORMAT_AUTO_ROUTINE
#undef _INTEGER_KIND
#undef _INTEGER_COMPUTE_AUTOFORMAT_ROUTINE
#undef _INTEGER_COMPUTE_CHARNB
#undef _INTEGER_FORMAT_CHAR_ROUTINE
#undef _INTEGER_FORMAT_VSTRING_ROUTINE
  !
  ! vstring_format_auto_integer_kind2 --
  !   Format an integer(kind=2) into a vstring.
  ! Arguments :
  !   value : integer of kind 2 to format
  !   fmt, optional : if provided, then this format is used to compute the
  !     new string.
  !     If not provided, an automatic format is computed and applied
  !     to compute the new string. With automatic format, the computed
  !     string has a minimum length, that is, does not contain any blank and
  !     begins with "-" only if the value is a strictly negative integer.
  !     The format may be provided either with a character(len=*) type
  !     or with a t_vstring type.
  !
#define _INTEGER_FORMAT_VSTRING_ROUTINE vstring_format_vstring_integer_kind2
#define _INTEGER_FORMAT_CHAR_ROUTINE vstring_format_char_integer_kind2
#define _INTEGER_FORMAT_AUTO_ROUTINE vstring_format_auto_integer_kind2
#define _INTEGER_COMPUTE_AUTOFORMAT_ROUTINE vstring_compute_autoformat_integer_kind2
#define _INTEGER_COMPUTE_CHARNB vstring_format_intcharnb_kind2
#define _INTEGER_KIND 2
#include "m_vstringformat_integerkind_template.f90"
#undef _INTEGER_FORMAT_AUTO_ROUTINE
#undef _INTEGER_KIND
#undef _INTEGER_COMPUTE_AUTOFORMAT_ROUTINE
#undef _INTEGER_COMPUTE_CHARNB
#undef _INTEGER_FORMAT_CHAR_ROUTINE
#undef _INTEGER_FORMAT_VSTRING_ROUTINE
  !
  ! vstring_format_auto_integer_kind4 --
  !   Format an integer(kind=4) into a vstring with automatic format.
  ! Arguments :
  !   value : integer of kind 8 to format
  !   fmt, optional : if provided, then this format is used to compute the
  !     new string.
  !     If not provided, an automatic format is computed and applied
  !     to compute the new string. With automatic format, the computed
  !     string has a minimum length, that is, does not contain any blank and
  !     begins with "-" only if the value is a strictly negative integer.
  !     The format may be provided either with a character(len=*) type
  !     or with a t_vstring type.
  !
#define _INTEGER_FORMAT_VSTRING_ROUTINE vstring_format_vstring_integer_kind4
#define _INTEGER_FORMAT_CHAR_ROUTINE vstring_format_char_integer_kind4
#define _INTEGER_FORMAT_AUTO_ROUTINE vstring_format_auto_integer_kind4
#define _INTEGER_COMPUTE_AUTOFORMAT_ROUTINE vstring_compute_autoformat_integer_kind4
#define _INTEGER_COMPUTE_CHARNB vstring_format_intcharnb_kind4
#define _INTEGER_KIND 4
#include "m_vstringformat_integerkind_template.f90"
#undef _INTEGER_FORMAT_AUTO_ROUTINE
#undef _INTEGER_KIND
#undef _INTEGER_COMPUTE_AUTOFORMAT_ROUTINE
#undef _INTEGER_COMPUTE_CHARNB
#undef _INTEGER_FORMAT_CHAR_ROUTINE
#undef _INTEGER_FORMAT_VSTRING_ROUTINE
  !
  ! vstring_format_auto_integer_kind8 --
  !   Format an integer(kind=8) into a vstring with automatic format.
  ! Arguments :
  !   value : integer of kind 8 to format
  !   fmt, optional : if provided, then this format is used to compute the
  !     new string.
  !     If not provided, an automatic format is computed and applied
  !     to compute the new string. With automatic format, the computed
  !     string has a minimum length, that is, does not contain any blank and
  !     begins with "-" only if the value is a strictly negative integer.
  !     The format may be provided either with a character(len=*) type
  !     or with a t_vstring type.
  !
#define _INTEGER_FORMAT_VSTRING_ROUTINE vstring_format_vstring_integer_kind8
#define _INTEGER_FORMAT_CHAR_ROUTINE vstring_format_char_integer_kind8
#define _INTEGER_FORMAT_AUTO_ROUTINE vstring_format_auto_integer_kind8
#define _INTEGER_COMPUTE_AUTOFORMAT_ROUTINE vstring_compute_autoformat_integer_kind8
#define _INTEGER_COMPUTE_CHARNB vstring_format_intcharnb_kind8
#define _INTEGER_KIND 8
#include "m_vstringformat_integerkind_template.f90"
#undef _INTEGER_FORMAT_AUTO_ROUTINE
#undef _INTEGER_KIND
#undef _INTEGER_COMPUTE_AUTOFORMAT_ROUTINE
#undef _INTEGER_COMPUTE_CHARNB
#undef _INTEGER_FORMAT_CHAR_ROUTINE
#undef _INTEGER_FORMAT_VSTRING_ROUTINE
  !
  ! vstringformat_error --
  !   Generates an error with the given error message
  !
  subroutine vstringformat_error ( this , message )
    implicit none
    type ( t_vstring ) , intent(in), optional :: this
    type ( t_vstring ) , intent (in) :: message
    character ( len = 40 ) :: this_chars
    type ( t_vstring ) :: this_subpart
    integer :: length
    integer, parameter :: length_max = 40
    logical :: isallocated
    character(len=1000) :: message_char
    write ( * , * ) "Internal error in m_vstring"
    if ( present ( this ) ) then
       length =  vstring_length ( this )
       isallocated = vstring_exists ( this )
       if ( isallocated ) then
          write ( * , * ) "Length:" , length
          if ( length < length_max ) then
             call vstring_cast ( this , this_chars )
             write ( * , * ) "Content:", trim(this_chars)
          else
             this_subpart = vstring_range ( this , 1 , 40 )
             call vstring_cast ( this_subpart , this_chars )
             write ( * , * ) "Content:", this_chars, "..."
             call vstring_free ( this_subpart )
          endif
       endif
    endif
    call vstring_cast ( message , message_char )
    write ( * , * ) "Message :", trim( message_char )
    if ( vstringformat_stoponerror ) then
       STOP
    endif
  end subroutine vstringformat_error
  !
  ! vstringformat_set_stoponerror --
  !   Configure the behaviour of the component whenever an
  !   error is met.
  !   If stoponerror is true, then the execution stops if an error is encountered.
  !   If stoponerror is false, then the execution continues if an error is encountered.
  !   In both cases, a message is displayed on standard output.
  !
  subroutine vstringformat_set_stoponerror ( stoponerror )
    logical , intent(in) :: stoponerror
    vstringformat_stoponerror = stoponerror
  end subroutine vstringformat_set_stoponerror
end module m_vstringformat


text:
**Ejercicio 1 Instalar los paquetes necesarios para usar KVM. Se pueden seguir estas instrucciones. Ya lo hicimos en el primer tema, pero volver a comprobar si nuestro sistema está preparado para ejecutarlo o hay que conformarse con la paravirtualización.**

[imagen](http://i.imgur.com/yw19Mfj.jpg)
Como se ve en esta imagen al usar un sistema ya virtualizado para realizar la asignatura, no me permite usar las extensiones de KVM y su aceleracion no esta soportada.

Para instalar los paquetes necesarios en el caso de que no nos diera este error seria:

sudo apt-get install qemu-kvm libvirt-bin bridge-utils

**Ejercicio 2.1 Crear varias máquinas virtuales con algún sistema operativo libre tal como Linux o BSD. Si se quieren distribuciones que ocupen poco espacio con el objetivo principalmente de hacer pruebas se puede usar CoreOS (que sirve como soporte para Docker) GALPon Minino, hecha en Galicia para el mundo, Damn Small Linux, SliTaz (que cabe en 35 megas) y ttylinux (basado en línea de órdenes solo).**

- Creamos el disco donde alojaremos los sistemas que instalaremos:

qemu-img create -f qcow2 fichero-cow.qcow2 500M

[imagen](http://i.imgur.com/EEfwzn4.jpg)
- Procedemos a instalar los sistemas con las ordenes:
	*Para slitaz:
	qemu-system-x86_64 -hda img.qcow2 -cdrom slitaz-4.0.iso -boot once=d

[imagen](http://i.imgur.com/2sDngDZ.jpg)
**Ejercicio 2.2 Hacer un ejercicio equivalente usando otro hipervisor como Xen, VirtualBox o Parallels.**

Para ello hemos usado virtualbox que tengo instalado en la máquina anfitriona y es bastante simple :

- Creamos un disco donde alojar el sistema (le hemos dado un 1GB de RAM y 8 GB de memoria). Una vez Hecho esto nos vamos a configuración -> almacenamiento y le pasamos la iso. Con esto, esta lista para lanzarse. Una vez instalada el resultado es :

[imagen](http://i.imgur.com/ddNQbBg.jpg)

**Ejercicio 3 Crear un benchmark de velocidad de entrada salida y comprobar la diferencia entre usar paravirtualización y arrancar la máquina virtual simplemente con qemu-system-x86_64 -hda /media/Backup/Isos/discovirtual.img**

**Ejercicio 4 Crear una máquina virtual Linux con 512 megas de RAM y entorno gráfico LXDE a la que se pueda acceder mediante VNC y ssh.**

**Ejercicio 5 Crear una máquina virtual ubuntu e instalar en ella un servidor nginx para poder acceder mediante web.**

Voy a montar un servidor nginx en una maquina virtual para acceder mediante web dentro de la red en la que está conectada la máquina virtual del server. Para ello :

- Instalamos una máquina virtual con ubuntu.La installación se hace de la misma forma que he descrito en el apartado 2 del ejercicio dos aunque deberemos configurar la red para poder comunicarnos con la máquina virtual desde el anfitrión, por ese motivo:
	*descargamos la iso.
	*Creamos un disco para alojar el sistema
	*En el apartado red, elejimos la opción "adaptador solo-anfitrión" para poder conectarnos a la máquina virtual.

[imagen](http://i.imgur.com/mkacyz6.jpg)

	*le pasamos la iso de la imagen y lo lanzamos.

- Una vez instalado el sistema operativo, instalamos nginx con el comando:

sudo apt-get instal nginx

- Cuando se complete la instalación, abrimos el fichero default de  /etc/nginx/sites-available para configurar el server, por ejemplo , con gedit:

sudo gedit /etc/nginx/sites-available/default

[imagen](http://i.imgur.com/dYAI7H3.jpg)

- Descomentamos esas dos lineas para que el servidor escuche en ese puerto y guardamos los cambios. Después de esto, lanzamos el servidor nginx con el comando:

service nginx start

- Ya podemos comprobar que el server escucha y sirve la página de nginx

[imagen](http://i.imgur.com/L0huy91.jpg)

**Ejercicio 6 Usar juju para hacer el ejercicio anterior.**

**Ejercicio 7 Instalar una máquina virtual con Linux Mint para el hipervisor que tengas instalado.**

Para este ejercicio utilizaremos virtualBox, como he explicado en el apartado 2 del ejercicio dos, es básicamente seguir los mismos pasos:

-Primero, creamos el disco donde alojaremos el sistema linux mint.

[imagen](http://i.imgur.com/d2sWbyu.jpg)

-Una vez creado, procedemos a pasarle la iso en configuración -> almacenamiento.

[imagen](http://i.imgur.com/WvghpXd.jpg)

Y ya esta listo para lanzarse e instalarse.

[imagen](http://i.imgur.com/kY3fRu4.jpg)

redpajama_set_name: RedPajamaGithub


text:
'use strict';var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
    switch (arguments.length) {
        case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
        case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
        case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
    }
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var dom_adapter_1 = require('angular2/src/core/dom/dom_adapter');
var angular2_1 = require('angular2/angular2');
var location_strategy_1 = require('./location_strategy');
/**
 * `HashLocationStrategy` is a {@link LocationStrategy} used to configure the
 * {@link Location} service to represent its state in the
 * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax)
 * of the browser's URL.
 *
 * For instance, if you call `location.go('/foo')`, the browser's URL will become
 * `example.com#/foo`.
 *
 * ### Example
 *
 * ```
 * import {Component, provide} from 'angular2/angular2';
 * import {
 *   ROUTER_DIRECTIVES,
 *   ROUTER_PROVIDERS,
 *   RouteConfig,
 *   Location,
 *   LocationStrategy,
 *   HashLocationStrategy
 * } from 'angular2/router';
 *
 * @Component({directives: [ROUTER_DIRECTIVES]})
 * @RouteConfig([
 *  {...},
 * ])
 * class AppCmp {
 *   constructor(location: Location) {
 *     location.go('/foo');
 *   }
 * }
 *
 * bootstrap(AppCmp, [
 *   ROUTER_PROVIDERS,
 *   provide(LocationStrategy, {useClass: HashLocationStrategy})
 * ]);
 * ```
 */
var HashLocationStrategy = (function (_super) {
    __extends(HashLocationStrategy, _super);
    function HashLocationStrategy() {
        _super.call(this);
        this._location = dom_adapter_1.DOM.getLocation();
        this._history = dom_adapter_1.DOM.getHistory();
    }
    HashLocationStrategy.prototype.onPopState = function (fn) {
        dom_adapter_1.DOM.getGlobalEventTarget('window').addEventListener('popstate', fn, false);
    };
    HashLocationStrategy.prototype.getBaseHref = function () { return ''; };
    HashLocationStrategy.prototype.path = function () {
        // the hash value is always prefixed with a `#`
        // and if it is empty then it will stay empty
        var path = this._location.hash;
        // Dart will complain if a call to substring is
        // executed with a position value that extends the
        // length of string.
        return (path.length > 0 ? path.substring(1) : path) +
            location_strategy_1.normalizeQueryParams(this._location.search);
    };
    HashLocationStrategy.prototype.prepareExternalUrl = function (internal) {
        return internal.length > 0 ? ('#' + internal) : internal;
    };
    HashLocationStrategy.prototype.pushState = function (state, title, path, queryParams) {
        var url = path + location_strategy_1.normalizeQueryParams(queryParams);
        if (url.length == 0) {
            url = this._location.pathname;
        }
        else {
            url = this.prepareExternalUrl(url);
        }
        this._history.pushState(state, title, url);
    };
    HashLocationStrategy.prototype.forward = function () { this._history.forward(); };
    HashLocationStrategy.prototype.back = function () { this._history.back(); };
    HashLocationStrategy = __decorate([
        angular2_1.Injectable(),
        __metadata('design:paramtypes', [])
    ], HashLocationStrategy);
    return HashLocationStrategy;
})(location_strategy_1.LocationStrategy);
exports.HashLocationStrategy = HashLocationStrategy;
//# sourceMappingURL=hash_location_strategy.js.map


text:
package util

import (
	"io"

	"github.com/golang/glog"

	"github.com/openshift/library-go/pkg/serviceability"
)

// NewGLogWriterV returns a new Writer that delegates to `glog.Info` at the
// desired level of verbosity
func NewGLogWriterV(level int) io.Writer {
	return &gLogWriter{
		level: glog.Level(level),
	}
}

// gLogWriter is a Writer that writes by delegating to `glog.Info`
type gLogWriter struct {
	// level is the default level to log at
	level glog.Level
}

func (w *gLogWriter) Write(p []byte) (n int, err error) {
	if glog.V(w.level) {
		glog.InfoDepth(2, string(p))
	}

	return len(p), nil
}

// InitLogrus sets the logrus trace level based on the glog trace level.
func InitLogrus() {
	switch {
	case bool(glog.V(4)):
		serviceability.InitLogrus("DEBUG")
	case bool(glog.V(2)):
		serviceability.InitLogrus("INFO")
	case bool(glog.V(0)):
		serviceability.InitLogrus("WARN")
	}
}


text:
require 'log4r'

require 'vagrant/util/platform'

require_relative 'base'

module VagrantPlugins
  module Parallels
    module Driver
      # Driver for Parallels Desktop 11.
      class PD_11 < Base
        def initialize(uuid)
          super(uuid)

          @logger = Log4r::Logger.new('vagrant_parallels::driver::pd_11')
        end

        def connect_network_interface(name)
          execute_prlsrvctl('net', 'set', name, '--connect-host-to-net', 'on')
        end
      end
    end
  end
end


text:
//
//  CHSquareCell.h
//  BSBDJ
//
//  Created by nick on 16/4/20.
//  Copyright © 2016年 nick. All rights reserved.
//

#import <UIKit/UIKit.h>
@class CHSquareItem;
@interface CHSquareCell : UICollectionViewCell
/** 模型*/
@property (nonatomic, strong) CHSquareItem *item;
@end


text:
"""  Excel PublicEnum表单解析器基类,
ExcelPublicEnumParser

Sheet struct: 枚举数据类型名称	数据类型描述	枚举项	值	值定义

"""
import excelsheetparser

class ExcelPublicEnumParser(excelsheetparser.ExcelSheetParser):
    def ParseExcelSheet(self, model, xl_name, sh_ctx, sh_idx, sh_name):

        xl_name, sh_name = self.strip(xl_name, sh_name)
        #get namespace
        self.GetNamespace(xl_name, sh_idx, sh_name)
        #print "Namespace",self.ns, sh_name, len(sh_ctx)
        #item_cnt = 0
        last_ed_type = ''
        last_ed_desc = ''
        last_ed_items = []
        for i in range(1, len(sh_ctx)):
            if len(sh_ctx[i])<5:
                continue
            ed_type, ed_desc, it_name, it_value, it_desc = self.strip(sh_ctx[i][:5])

            if ed_type != "":
                if last_ed_type != "" and len(last_ed_items) >0:
                    #item_cnt = item_cnt +1
                    model.AppendItem(xl_name, sh_idx, sh_name, self.ns, "EnumData", (last_ed_type, last_ed_desc, last_ed_items))
                #new enumdata
                last_ed_type = ed_type
                last_ed_desc = ed_desc
                last_ed_items = []
            #append item data
            it_name = it_name.replace(' ', '')
            last_ed_items.append((it_name, it_value, it_desc))
        #process the last one
        if last_ed_type != "" and len(last_ed_items) >0:
            model.AppendItem(xl_name, sh_idx, sh_name, self.ns, "EnumData", (last_ed_type, last_ed_desc, last_ed_items))
        #print "items:", item_cnt


text:
package org.apache.hc.client5.http.examples;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;

import javax.net.ssl.SSLContext;

import org.apache.hc.client5.http.DnsResolver;
import org.apache.hc.client5.http.HttpRoute;
import org.apache.hc.client5.http.SystemDefaultDnsResolver;
import org.apache.hc.client5.http.auth.CredentialsProvider;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.config.AuthSchemes;
import org.apache.hc.client5.http.config.CookieSpecs;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.cookie.BasicCookieStore;
import org.apache.hc.client5.http.cookie.CookieStore;
import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.client5.http.impl.io.ManagedHttpClientConnectionFactory;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
import org.apache.hc.client5.http.io.ManagedHttpClientConnection;
import org.apache.hc.client5.http.protocol.HttpClientContext;
import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
import org.apache.hc.client5.http.socket.PlainConnectionSocketFactory;
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.ParseException;
import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.config.Registry;
import org.apache.hc.core5.http.config.RegistryBuilder;
import org.apache.hc.core5.http.config.SocketConfig;
import org.apache.hc.core5.http.impl.io.DefaultClassicHttpResponseFactory;
import org.apache.hc.core5.http.impl.io.DefaultHttpRequestWriterFactory;
import org.apache.hc.core5.http.impl.io.DefaultHttpResponseParser;
import org.apache.hc.core5.http.impl.io.DefaultHttpResponseParserFactory;
import org.apache.hc.core5.http.io.HttpConnectionFactory;
import org.apache.hc.core5.http.io.HttpMessageParser;
import org.apache.hc.core5.http.io.HttpMessageParserFactory;
import org.apache.hc.core5.http.io.HttpMessageWriterFactory;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.message.BasicHeader;
import org.apache.hc.core5.http.message.BasicLineParser;
import org.apache.hc.core5.http.message.LineParser;
import org.apache.hc.core5.pool.PoolConcurrencyPolicy;
import org.apache.hc.core5.pool.PoolReusePolicy;
import org.apache.hc.core5.ssl.SSLContexts;
import org.apache.hc.core5.util.CharArrayBuffer;
import org.apache.hc.core5.util.TimeValue;
import org.apache.hc.core5.util.Timeout;

/**
 * This example demonstrates how to customize and configure the most common aspects
 * of HTTP request execution and connection management.
 */
public class ClientConfiguration {

    public final static void main(final String[] args) throws Exception {

        // Use custom message parser / writer to customize the way HTTP
        // messages are parsed from and written out to the data stream.
        final HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory = new DefaultHttpResponseParserFactory() {

            @Override
            public HttpMessageParser<ClassicHttpResponse> create(final H1Config h1Config) {
                final LineParser lineParser = new BasicLineParser() {

                    @Override
                    public Header parseHeader(final CharArrayBuffer buffer) {
                        try {
                            return super.parseHeader(buffer);
                        } catch (final ParseException ex) {
                            return new BasicHeader(buffer.toString(), null);
                        }
                    }

                };
                return new DefaultHttpResponseParser(lineParser, DefaultClassicHttpResponseFactory.INSTANCE, h1Config);
            }

        };
        final HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory = new DefaultHttpRequestWriterFactory();

        // Create HTTP/1.1 protocol configuration
        final H1Config h1Config = H1Config.custom()
                .setMaxHeaderCount(200)
                .setMaxLineLength(2000)
                .build();
        // Create connection configuration
        final CharCodingConfig connectionConfig = CharCodingConfig.custom()
                .setMalformedInputAction(CodingErrorAction.IGNORE)
                .setUnmappableInputAction(CodingErrorAction.IGNORE)
                .setCharset(StandardCharsets.UTF_8)
                .build();

        // Use a custom connection factory to customize the process of
        // initialization of outgoing HTTP connections. Beside standard connection
        // configuration parameters HTTP connection factory can define message
        // parser / writer routines to be employed by individual connections.
        final HttpConnectionFactory<ManagedHttpClientConnection> connFactory = new ManagedHttpClientConnectionFactory(
                h1Config, connectionConfig, requestWriterFactory, responseParserFactory);

        // Client HTTP connection objects when fully initialized can be bound to
        // an arbitrary network socket. The process of network socket initialization,
        // its connection to a remote address and binding to a local one is controlled
        // by a connection socket factory.

        // SSL context for secure connections can be created either based on
        // system or application specific properties.
        final SSLContext sslcontext = SSLContexts.createSystemDefault();

        // Create a registry of custom connection socket factories for supported
        // protocol schemes.
        final Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
            .register("http", PlainConnectionSocketFactory.INSTANCE)
            .register("https", new SSLConnectionSocketFactory(sslcontext))
            .build();

        // Use custom DNS resolver to override the system DNS resolution.
        final DnsResolver dnsResolver = new SystemDefaultDnsResolver() {

            @Override
            public InetAddress[] resolve(final String host) throws UnknownHostException {
                if (host.equalsIgnoreCase("myhost")) {
                    return new InetAddress[] { InetAddress.getByAddress(new byte[] {127, 0, 0, 1}) };
                } else {
                    return super.resolve(host);
                }
            }

        };

        // Create a connection manager with custom configuration.
        final PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(
                socketFactoryRegistry, PoolConcurrencyPolicy.STRICT, PoolReusePolicy.LIFO, TimeValue.ofMinutes(5),
                null, dnsResolver, null);

        // Create socket configuration
        final SocketConfig socketConfig = SocketConfig.custom()
            .setTcpNoDelay(true)
            .build();
        // Configure the connection manager to use socket configuration either
        // by default or for a specific host.
        connManager.setDefaultSocketConfig(socketConfig);
        // Validate connections after 1 sec of inactivity
        connManager.setValidateAfterInactivity(TimeValue.ofSeconds(10));

        // Configure total max or per route limits for persistent connections
        // that can be kept in the pool or leased by the connection manager.
        connManager.setMaxTotal(100);
        connManager.setDefaultMaxPerRoute(10);
        connManager.setMaxPerRoute(new HttpRoute(new HttpHost("somehost", 80)), 20);

        // Use custom cookie store if necessary.
        final CookieStore cookieStore = new BasicCookieStore();
        // Use custom credentials provider if necessary.
        final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
        // Create global request configuration
        final RequestConfig defaultRequestConfig = RequestConfig.custom()
            .setCookieSpec(CookieSpecs.DEFAULT)
            .setExpectContinueEnabled(true)
            .setTargetPreferredAuthSchemes(Arrays.asList(AuthSchemes.NTLM, AuthSchemes.DIGEST))
            .setProxyPreferredAuthSchemes(Arrays.asList(AuthSchemes.BASIC))
            .build();

        // Create an HttpClient with the given custom dependencies and configuration.

        try (CloseableHttpClient httpclient = HttpClients.custom()
                .setConnectionManager(connManager)
                .setDefaultCookieStore(cookieStore)
                .setDefaultCredentialsProvider(credentialsProvider)
                .setProxy(new HttpHost("myproxy", 8080))
                .setDefaultRequestConfig(defaultRequestConfig)
                .build()) {
            final HttpGet httpget = new HttpGet("http://httpbin.org/get");
            // Request configuration can be overridden at the request level.
            // They will take precedence over the one set at the client level.
            final RequestConfig requestConfig = RequestConfig.copy(defaultRequestConfig)
                    .setSocketTimeout(Timeout.ofSeconds(5))
                    .setConnectTimeout(Timeout.ofSeconds(5))
                    .setConnectionRequestTimeout(Timeout.ofSeconds(5))
                    .setProxy(new HttpHost("myotherproxy", 8080))
                    .build();
            httpget.setConfig(requestConfig);

            // Execution context can be customized locally.
            final HttpClientContext context = HttpClientContext.create();
            // Contextual attributes set the local context level will take
            // precedence over those set at the client level.
            context.setCookieStore(cookieStore);
            context.setCredentialsProvider(credentialsProvider);

            System.out.println("Executing request " + httpget.getMethod() + " " + httpget.getUri());
            try (CloseableHttpResponse response = httpclient.execute(httpget, context)) {
                System.out.println("----------------------------------------");
                System.out.println(response.getCode() + " " + response.getReasonPhrase());
                System.out.println(EntityUtils.toString(response.getEntity()));

                // Once the request has been executed the local context can
                // be used to examine updated state and various objects affected
                // by the request execution.

                // Last executed request
                context.getRequest();
                // Execution route
                context.getHttpRoute();
                // Auth exchanges
                context.getAuthExchanges();
                // Cookie origin
                context.getCookieOrigin();
                // Cookie spec used
                context.getCookieSpec();
                // User security token
                context.getUserToken();

            }
        }
    }

}


text:
FROM ubuntu:13.10

MAINTAINER koide

# ssh:root
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update && apt-get clean

RUN apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo "root:root" |chpasswd

# ssh:user
RUN apt-get install -y sudo
RUN useradd --create-home -s /bin/bash doragon
RUN adduser doragon sudo
RUN echo "doragon:pass" | chpasswd
RUN mkdir /home/doragon/.ssh/

RUN echo >> /etc/sudoers
RUN echo "doragon ALL=(ALL) ALL" >> /etc/sudoers

EXPOSE 22
CMD /usr/sbin/sshd -D


text:
package com.planet_ink.coffee_mud.core.collections;
import java.util.*;

public class ReadOnlyIterator<K> implements Iterator<K>
{
	private final Iterator<K> iter;
	public ReadOnlyIterator(final Iterator<K> i)
	{
		iter=i;
	}

	@Override
	public boolean hasNext()
	{
		return iter.hasNext();
	}

	@Override
	public K next()
	{
		return iter.next();
	}

	@Override
	public void remove()
	{
		throw new java.lang.IllegalArgumentException();
	}

}


text:
2016-03-03

I hereby agree to the terms of the Entity Contributors License
Agreement, with MD5 checksum 3230b63601162567219de517a1be22b4.

I furthermore declare that I am authorized and able to make this
agreement and sign this declaration.

Signed,

Jordi Llach Fernandez, Agile Content
https://github.com/yacota

---

2016-03-03

I hereby agree to the terms of the Individual Contributors License
Agreement, with MD5 checksum 3455f69ed223b9e5712f8bb3abf38190.

I furthermore declare that I am authorized and able to make this
agreement and sign this declaration.

Signed,

Jordi Llach Fernandez
https://github.com/yacota


text:
package org.apache.taverna.workbench.views.monitor.graph;

import static java.lang.Math.max;
import org.apache.taverna.workbench.models.graph.GraphController;
import org.apache.taverna.platform.report.ProcessorReport;

/**
 * A MonitorNode that updates a Graph when
 * ProcessorReport property changes.
 *
 * @author David Withers
 */
public class GraphMonitorNode {
	private ProcessorReport processorReport;
	private GraphController graphController;
	private String processorId;
	private int queueSize = 0;
	private int sentJobs = 0;
	private int completedJobs = 0;
	private int errors = 0;

	public GraphMonitorNode(String id, ProcessorReport processorReport,
			GraphController graphController) {
		this.processorReport = processorReport;
		this.graphController = graphController;
		processorId = id;
	}

	/**
	 * Updates the Graph when changes to properties are detected.
	 */
	public void update() {
		synchronized (graphController) {
			boolean queueSizeChanged = false;
			boolean sentJobsChanged = false;
			boolean completedJobsChanged = false;
			boolean errorsChanged = false;

			int newQueueSize = processorReport.getJobsQueued();
			newQueueSize = newQueueSize == -1 ? 0 : newQueueSize;
			if (queueSize != newQueueSize) {
				queueSize = newQueueSize;
				queueSizeChanged = true;
			}

			int newSentJobs = processorReport.getJobsStarted();
			if (sentJobs != newSentJobs) {
				sentJobs = newSentJobs;
				sentJobsChanged = true;
			}

			int newCompletedJobs = processorReport.getJobsCompleted();
			if (completedJobs != newCompletedJobs) {
				completedJobs = newCompletedJobs;
				completedJobsChanged = true;
			}

			int newErrors = processorReport.getJobsCompletedWithErrors();
			if (errors != newErrors) {
				errors = newErrors;
				errorsChanged = true;
			}

			if (queueSizeChanged || sentJobsChanged || completedJobsChanged
					|| errorsChanged) {
				if (completedJobsChanged)
					graphController.setIteration(processorId, completedJobs);
				if (completedJobs > 0)
					graphController.setNodeCompleted(processorId,
							(completedJobs / (float) (sentJobs + queueSize)));
				if (sentJobsChanged) {
					// graphController.setEdgeActive(processorId, true);
				}
				if (errorsChanged && errors > 0)
					graphController.setErrors(processorId, errors);
			}
		}
	}

	public void redraw() {
		synchronized (graphController) {
			queueSize = max(processorReport.getJobsQueued(), 0);
			sentJobs = processorReport.getJobsStarted();
			completedJobs = processorReport.getJobsCompleted();
			errors = processorReport.getJobsCompletedWithErrors();

			graphController.setIteration(processorId, completedJobs);
			if (completedJobs > 0)
				graphController.setNodeCompleted(processorId,
						(completedJobs / (float) (sentJobs + queueSize)));
			if (errors > 0)
				graphController.setErrors(processorId, errors);
		}
	}
}


text:
class SimCamera: public OIS::KeyListener, public OIS::MouseListener
{
  public:
	SimCamera( Ogre::SceneManager* );
	~SimCamera();

	Ogre::Camera *GetCamera();

	void Update( Ogre::Real );

	virtual bool keyPressed( const OIS::KeyEvent &arg );
	virtual bool keyReleased( const OIS::KeyEvent &arg );

	virtual bool mouseMoved( const OIS::MouseEvent &arg );
	virtual bool mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
	virtual bool mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id );

  protected:
	Ogre::Camera       *cam;
	Ogre::SceneNode    *camNode;
	Ogre::SceneManager *sceneMan;

	Ogre::Vector3 velocity;
	Ogre::Real turnVelocity;

	bool upKey,
	     downKey,
	     rightKey,
	     leftKey,
	     turnLeftKey,
	     turnRightKey,
		 turbo,
		 menuMode;
};

#endif


text:
package org.apache.pluto.tags;

import java.lang.reflect.Field;
import java.util.Hashtable;

import javax.portlet.BaseURL;
import javax.portlet.PortletMode;
import javax.portlet.PortletModeException;
import javax.portlet.PortletResponse;
import javax.portlet.PortletURL;
import javax.portlet.WindowState;
import javax.portlet.WindowStateException;
import javax.servlet.jsp.JspException;

/**
 * Abstract supporting class for the JSR168 actionURL and renderURL tag handlers.
 *
 * @version 2.0
 */

public abstract class PortletURLTag168 extends BaseURLTag {
   private static final long serialVersionUID = 4167483154265467568L;

   protected String          portletMode      = null;

   protected String          windowState      = null;

   protected PortletURL      portletURL       = null;

   /**
    * Sets the portlet mode and window state on the URL.
    *
    * @throws JspException
    */
   protected void handlePMandWS() throws JspException {
      if (portletMode != null) {// set portlet mode
         try {
            PortletMode mode = (PortletMode) TEI.portletModes.get(portletMode.toUpperCase());

            if (mode == null) {
               mode = new PortletMode(portletMode);// support for custom portlet modes PLUTO-258
            }

            portletURL.setPortletMode(mode);

         } catch (PortletModeException e) {
            throw new JspException(e);
         }
      }

      if (windowState != null) {// set window state
         try {
            WindowState state = (WindowState) TEI.definedWindowStates.get(windowState.toUpperCase());

            if (state == null) {
               state = new WindowState(windowState);// support for custom window states PLUTO-258
            }

            portletURL.setWindowState(state);

         } catch (WindowStateException e) {
            throw new JspException(e);
         }
      }

   }

   /*
    * (non-Javadoc)
    *
    * @see org.apache.pluto.tags.BaseURLTag#doStartTag()
    */
   @Override
   public int doStartTag() throws JspException {

      PortletResponse portletResponse = (PortletResponse) pageContext.getRequest().getAttribute(
            Constants.PORTLET_RESPONSE);

      if (portletResponse != null) {

         PortletURL portletURL = createPortletUrl(portletResponse);
         setUrl(portletURL);
         handlePMandWS();

      }

      return super.doStartTag();
   }

   /**
    * Returns the portletMode property.
    *
    * @return String
    */
   public String getPortletMode() {
      return portletMode;
   }

   /**
    * Returns the windowState property.
    *
    * @return String
    */
   public String getWindowState() {
      return windowState;
   }

   /**
    * Sets the portletMode property.
    *
    * @param portletMode
    *           - the portlet mode to set
    * @return void
    */
   public void setPortletMode(String portletMode) {
      this.portletMode = portletMode;
   }

   /**
    * Sets the windowState property.
    *
    * @param windowState
    *           - the portlet window state to set
    * @return void
    */
   public void setWindowState(String windowState) {
      this.windowState = windowState;
   }

   /*
    * (non-Javadoc)
    *
    * @see org.apache.pluto.tags.BaseURLTag#getUrl()
    */
   @Override
   protected BaseURL getUrl() {
      return portletURL;
   }

   /*
    * (non-Javadoc)
    *
    * @see org.apache.pluto.tags.BaseURLTag#setUrl(javax.portlet.BaseURL)
    */
   @Override
   protected void setUrl(BaseURL url) {
      this.portletURL = (PortletURL) url;
   }

   /**
    * Creates an actionURL or a renderURL
    *
    * @param portletResponse
    *           PortletResponse
    * @return PortletURL
    */
   protected abstract PortletURL createPortletUrl(PortletResponse portletResponse);

   /**
    * TagExtraInfo class for PortletURLTag.
    */
   public static class TEI extends BaseURLTag.TEI {
      public final static Hashtable<String, Object> definedWindowStates = getDefinedWindowStates();

      public final static Hashtable<String, Object> portletModes        = getDefinedPortletModes();

      /**
       * Provides a list of all static PortletMode available in the specifications by using introspection
       *
       * @return Hashtable
       */
      private static Hashtable<String, Object> getDefinedPortletModes() {
         Hashtable<String, Object> portletModes = new Hashtable<String, Object>();
         Field[] f = PortletMode.class.getDeclaredFields();

         for (int i = 0; i < f.length; i++) {
            if (f[i].getType().isAssignableFrom(javax.portlet.PortletMode.class)) {
               try {
                  portletModes.put(f[i].get(f[i]).toString().toUpperCase(), f[i].get(f[i]));
               } catch (IllegalAccessException e) {
               }
            }
         }

         return portletModes;
      }

      /**
       * Provides a list of all static WindowsStates available in the specifications by using introspection
       *
       * @return Hashtable
       */
      private static Hashtable<String, Object> getDefinedWindowStates() {
         Hashtable<String, Object> definedWindowStates = new Hashtable<String, Object>();
         Field[] f = WindowState.class.getDeclaredFields();

         for (int i = 0; i < f.length; i++) {
            if (f[i].getType().isAssignableFrom(javax.portlet.WindowState.class)) {
               try {
                  definedWindowStates.put(f[i].get(f[i]).toString().toUpperCase(), f[i].get(f[i]));
               } catch (IllegalAccessException e) {

               }
            }
         }
         return definedWindowStates;
      }
   }

}


text:
package br.com.ceducarneiro.autohome.preference;

import android.content.Context;
import android.content.SharedPreferences;

import br.com.ceducarneiro.autohome.AutoHomeApp;

public class AppPreferencesManager {

    public static final float INVALID_VALUE = -999;

    private final String PREFERENCES_NODE = "preferences_app";

    private final String PREFERENCE_TEMPERATURE = "preference_temp";
    private final String PREFERENCE_HUMIDITY = "preference_humi";
    private final String PREFERENCE_LAMP_STATUS = "preference_lamp";
    private final String PREFERENCE_LAST_LAMP_TIME = "preference_last_lamp";

    private static AppPreferencesManager instance;
    private SharedPreferences prefs;
    private SharedPreferences.Editor editor;

    private AppPreferencesManager() {
        prefs = AutoHomeApp.getInstance().getSharedPreferences(PREFERENCES_NODE, Context.MODE_PRIVATE);
        editor = prefs.edit();
    }

    public static synchronized AppPreferencesManager getInstance() {
        if (instance == null) {
            instance = new AppPreferencesManager();
        }
        return instance;
    }

    public float getLastTemperature() {
        return prefs.getFloat(PREFERENCE_TEMPERATURE, INVALID_VALUE);
    }

    public void setLastTemperature(float value) {
        editor.putFloat(PREFERENCE_TEMPERATURE, value);
        editor.commit();
    }

    public float getLastHumidity() {
        return prefs.getFloat(PREFERENCE_HUMIDITY, INVALID_VALUE);
    }

    public void setLastHumidity(float value) {
        editor.putFloat(PREFERENCE_HUMIDITY, value);
        editor.commit();
    }

    public boolean getLampStatus() {
        return prefs.getBoolean(PREFERENCE_LAMP_STATUS, false);
    }

    public void setLampStatus(boolean value) {
        editor.putBoolean(PREFERENCE_LAMP_STATUS, value);
        editor.commit();
    }

    public long getLastLampTime() {
        return prefs.getLong(PREFERENCE_LAST_LAMP_TIME, 0l);
    }

    public void setLastLampTime(long value) {
        editor.putLong(PREFERENCE_LAST_LAMP_TIME, value);
        editor.commit();
    }

    public void clear() {
        editor.remove(PREFERENCE_TEMPERATURE);
        editor.remove(PREFERENCE_HUMIDITY);
        editor.remove(PREFERENCE_LAMP_STATUS);
        editor.remove(PREFERENCE_LAST_LAMP_TIME);
        editor.commit();
    }
}


text:
/****************************************************************************
** Meta object code from reading C++ file 'qfontdialog.h'
**
** Created: Mon 26. Nov 09:24:41 2012
**      by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#include "../../../dialogs/qfontdialog.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'qfontdialog.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif

QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_QFontDialog[] = {

 // content:
       6,       // revision
       0,       // classname
       0,    0, // classinfo
       8,   14, // methods
       2,   54, // properties
       1,   62, // enums/sets
       0,    0, // constructors
       0,       // flags
       2,       // signalCount

 // signals: signature, parameters, type, tag, flags
      18,   13,   12,   12, 0x05,
      44,   13,   12,   12, 0x05,

 // slots: signature, parameters, type, tag, flags
      64,   12,   12,   12, 0x08,
      88,   12,   12,   12, 0x08,
     114,   12,   12,   12, 0x08,
     147,   12,   12,   12, 0x08,
     172,   12,   12,   12, 0x08,
     196,   12,   12,   12, 0x08,

 // properties: name, type, flags
     220,  214, 0x40495103,
     250,  232, 0x0009510b,

 // properties: notify_signal_id
       0,
       0,

 // enums: name, flags, count, data
     258, 0x0,    2,   66,

 // enum data: key, value
     275, uint(QFontDialog::NoButtons),
     285, uint(QFontDialog::DontUseNativeDialog),

       0        // eod
};

static const char qt_meta_stringdata_QFontDialog[] = {
    "QFontDialog\0\0font\0currentFontChanged(QFont)\0"
    "fontSelected(QFont)\0_q_sizeChanged(QString)\0"
    "_q_familyHighlighted(int)\0"
    "_q_writingSystemHighlighted(int)\0"
    "_q_styleHighlighted(int)\0"
    "_q_sizeHighlighted(int)\0_q_updateSample()\0"
    "QFont\0currentFont\0FontDialogOptions\0"
    "options\0FontDialogOption\0NoButtons\0"
    "DontUseNativeDialog\0"
};

void QFontDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
    if (_c == QMetaObject::InvokeMetaMethod) {
        Q_ASSERT(staticMetaObject.cast(_o));
        QFontDialog *_t = static_cast<QFontDialog *>(_o);
        switch (_id) {
        case 0: _t->currentFontChanged((*reinterpret_cast< const QFont(*)>(_a[1]))); break;
        case 1: _t->fontSelected((*reinterpret_cast< const QFont(*)>(_a[1]))); break;
        case 2: _t->d_func()->_q_sizeChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 3: _t->d_func()->_q_familyHighlighted((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 4: _t->d_func()->_q_writingSystemHighlighted((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 5: _t->d_func()->_q_styleHighlighted((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 6: _t->d_func()->_q_sizeHighlighted((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: _t->d_func()->_q_updateSample(); break;
        default: ;
        }
    }
}

const QMetaObjectExtraData QFontDialog::staticMetaObjectExtraData = {
    0,  qt_static_metacall
};

const QMetaObject QFontDialog::staticMetaObject = {
    { &QDialog::staticMetaObject, qt_meta_stringdata_QFontDialog,
      qt_meta_data_QFontDialog, &staticMetaObjectExtraData }
};

#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &QFontDialog::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION

const QMetaObject *QFontDialog::metaObject() const
{
    return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}

void *QFontDialog::qt_metacast(const char *_clname)
{
    if (!_clname) return 0;
    if (!strcmp(_clname, qt_meta_stringdata_QFontDialog))
        return static_cast<void*>(const_cast< QFontDialog*>(this));
    return QDialog::qt_metacast(_clname);
}

int QFontDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 8)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 8;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QFont*>(_v) = currentFont(); break;
        case 1: *reinterpret_cast< FontDialogOptions*>(_v) = options(); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setCurrentFont(*reinterpret_cast< QFont*>(_v)); break;
        case 1: setOptions(*reinterpret_cast< FontDialogOptions*>(_v)); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 2;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}

// SIGNAL 0
void QFontDialog::currentFontChanged(const QFont & _t1)
{
    void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
    QMetaObject::activate(this, &staticMetaObject, 0, _a);
}

// SIGNAL 1
void QFontDialog::fontSelected(const QFont & _t1)
{
    void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
    QMetaObject::activate(this, &staticMetaObject, 1, _a);
}
QT_END_MOC_NAMESPACE


text:
import { render, screen } from '@testing-library/react';
import React from 'react';

import { selectors } from '@grafana/e2e-selectors';

import { PanelModel } from '../../state';

import PanelHeaderCorner, { Props } from './PanelHeaderCorner';

const setup = () => {
  const testPanel = new PanelModel({ title: 'test', description: 'test panel' });
  const props: Props = {
    panel: testPanel,
  };
  return render(<PanelHeaderCorner {...props} />);
};

describe('Panel header corner test', () => {
  it('should render component', () => {
    setup();

    expect(
      screen.getByRole('region', { name: selectors.components.Panels.Panel.headerCornerInfo('info') })
    ).toBeInTheDocument();
  });
});


text:
var TreeListener;

(function(){

(TreeListener = function(conf) {
  this.conf = conf;
  this.registerListeners();
  arguments.callee._super.apply(this, arguments);
}).prototype = {
  getContainer: function(){
    return getDom(this.conf.container);
  },
  registerListeners: function(){
    var container = this.getContainer();
    listen(container, ["click", "touchstart"], function(e){
      var target = e.getTarget();
      var treeNode = TreeNode.lookup(target);
      if (!treeNode) {
        return;
      }

      if (hCls(target, "toggle")) {
        if (this.fireEvent("beforeToggleNode", treeNode) === false) {
          return;
        }
        treeNode.toggle();
        this.fireEvent("afterToggleNode", treeNode);
      }
      else {
        this.fireEvent("nodeClicked", {
          treeNode: treeNode,
          event: e
        });
      }
    }, this);
    listen(container, "dblclick", function(e){
      var target = e.getTarget();
      var treeNode = TreeNode.lookup(target);
      if (!treeNode) {
        return;
      }

      if (hCls(target, "toggle")) {
        //noop
      }
      else {
        this.fireEvent("nodeDoubleClicked", {
          treeNode: treeNode,
          event: e
        });
      }
    }, this);
  }
};

adopt(TreeListener, Observable);

})();


text:
<?php

	class Restaurant extends CI_Controller {

		public function getRestaurant($type, $slug=false) {
			$this->load->model('restaurants');

			$slug = $slug ? $slug : $this->getRandomRestaurantSlug($type);

			$restaurant = $this->restaurants->getRestaurantsBySlug($type, $slug);
			$id = $this->restaurants->getIdBySlug($slug, $type);
			$restaurant->opening_hours = $this->restaurants->getOpeningHours($id);

			$this->load->view('restaurant', [
				'restaurant' => $restaurant
			]);
		}

		protected function getRandomRestaurantSlug($type) {
			$restaurants = [];
			$restaurants = $this->restaurants->getRestaurantsByType($type);
			$random = array_rand($restaurants);
			$restaurant = $restaurants[$random];
			$random_slug = $restaurant->slug;
			return $random_slug;
		}

		public function getAJAXRestaurantSlug($type) {
			$this->load->model('restaurants');
			$restaurant_slug = $this->restaurants->getRandomSlugByType($type);
			echo json_encode($restaurant_slug);
		}

		public function getAJAXRestaurantById($type, $id) {
			$this->load->model('restaurants');
			$slug = $this->restaurants->getRandomSlugByTypeAndId($type, $id);
			echo json_encode($slug);
		}

	}
?>


text:
module WorkerAttributes
  extend ActiveSupport::Concern

  class_methods do
    def feature_category(value)
      raise "Invalid category. Use `feature_category_not_owned!` to mark a worker as not owned" if value == :not_owned

      worker_attributes[:feature_category] = value
    end

    # Special case: mark this work as not associated with a feature category
    # this should be used for cross-cutting concerns, such as mailer workers.
    def feature_category_not_owned!
      worker_attributes[:feature_category] = :not_owned
    end

    def get_feature_category
      get_worker_attribute(:feature_category)
    end

    def feature_category_not_owned?
      get_worker_attribute(:feature_category) == :not_owned
    end

    protected

    # Returns a worker attribute declared on this class or its parent class.
    # This approach allows declared attributes to be inherited by
    # child classes.
    def get_worker_attribute(name)
      worker_attributes[name] || superclass_worker_attributes(name)
    end

    private

    def worker_attributes
      @attributes ||= {}
    end

    def superclass_worker_attributes(name)
      return unless superclass.include? WorkerAttributes

      superclass.get_worker_attribute(name)
    end
  end
end


text:
package io.swagger.client.model;

import com.wordnik.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 *
 **/
@ApiModel(description = "")
public class GoogleMapsLocation  {

  private String formattedAddress = null;

  /**
   **/
  @ApiModelProperty(value = "")
  @JsonProperty("formatted_address")
  public String getFormattedAddress() {
    return formattedAddress;
  }
  public void setFormattedAddress(String formattedAddress) {
    this.formattedAddress = formattedAddress;
  }

  @Override
  public String toString()  {
    StringBuilder sb = new StringBuilder();
    sb.append("class GoogleMapsLocation {\n");

    sb.append("  formattedAddress: ").append(formattedAddress).append("\n");
    sb.append("}\n");
    return sb.toString();
  }
}