text:
use warnings;
use strict;
use Carp;
use Getopt::Long;

#flush buffer
$| = 1;
#-------------------------------------------------------------------------------
#-------------------------------- DESCRIPTION ----------------------------------
#-------------------------------------------------------------------------------
my $VERSION = "1.10";
my $SCRITPNAME = "taxo_prep_classifier_db.pl";
my $CHANGELOG = "
# Change log for $SCRITPNAME
#	- v1.0 = 22 March 2016
#	- v1.1 = 07 April 2016
#            print sequences in uppercase if -u
#	- v1.2 = 12 April 2016
#            Fix bug to get the whole description
#	- v1.3 = 21 July 2016
#            Allow lineages to not have the same length in the input file
#            => they will be put at the same length when populated down
#            Be more flexible on the lineage formatting
#	- v1.4 = 22 July 2016
#            Bug fix in writing .fa and .sti (was expecting __ in lineages)
#	- v1.5 = 27 Oct 2016
#            new output = tgs file
#	- v1.6 = 31 Jan 2017
#            Option to get sti and tri with a tab instead
#            Bug fix in the tri map...!!
#	- v1.7 = 16 Mar 2017
#            Bug fix for lineages without 00__ etc
#	- v1.8 = 22 Mar 2017
#            Populating down lineages is now an option
#            Bug fix in the tri, again
#	- v1.9 = 21 Jun 2017
#            Bug fix in the tri, again; was adding a layer
#	- v1.10 = 3 Jan 2018
#            Add option -a to make each sequence its own node
#            RW with convention upercase, and make them global (no need to pass to sub)
#            bug fix uc, it was always doing it

# TO DO = detect if same seqIDs have different lineages, output warnings, and allow correction / chose 1 by deleting lines in a file, then rerun script with an option loading that file to correct lineages
\n";

my $usage = "\nUsage [v$VERSION]:
    perl $SCRITPNAME
         -f input.fasta [-o coredbname] [-n] [-m <X>] [-s ;]
         [-g map.tab] [-p] [-t] [-w] [-u] [-a] [-v] [-c] [-h]

    PURPOSE:
     From a fasta file with lineages in their headers,
     creates the files required to build a Taxonomer classification database
     (.tri, .sti, .tgs)

    INPUT FILE:
     A fasta file containing lineage information
     (one way to add these lineages is to use the script fasta_add_lineage_using_key.pl)
     The fasta file will be parsed to obtain the files required, so the formatting
     of the headers and descriptions is important and should be:
        >seqID    lineage    description if any
     Also, note that:
       - lineage is anything that is after the first space or tab,
         so no spaces are allowed in seqID or lineages
       - Lineage levels (or nodes) are identified by a separator (set with -s), for ex.:
           Prokaryotes;Bacteria;Proteobacteria;Ecoli [-s ;]
           T,HLA,A*01 [-s ,]
           gene01:transcript0001:exon1 [-s :]
       - sequences may have lineages of different length, use -p to populate them down.
         Note that one type of lineage format will be specifically recognized:
            00__rankValue0;01__rankValue1;02__rankValue2;03__rankValue3
            (the ranks will be incremented when populated down)

    OUTPUTS:
     The fasta file will be parsed and create files required to build a classification database:
      -> get the taxid map = .tri
           >1
           0
           >child_ID
           parent_ID
      -> get the seq_id map = .sti
           >seq_id
           tax_id
      -> if -g is set, get the flexible taxonomy map = .tgs
           taxID \\t geneID \\t seqID \\t info[string_no_spaces]
      -> a modified fasta file = _taxonomer.fa
         Will have a shifted header, to have a numerical ID matching the .sti
         Use grep \"^>\" <coredb>_taxonomer.fa to obtain the correspondance between ID / header

     Two files that can be useful to parse the outputs will be created:
      -> a key file _key.txt file, with 4 columns seperated by a tab:
         taxid \t parent_taxid \t rank \t lineage_string
      -> an index file _index.txt, with 3 columns seperated by a tab:
         taxid \t rank \t label=last_value_of_lineage
         (required for iobio visualization)

    MANDATORY ARGUMENTS:
     -f,--fasta   => (STRING) input fasta file with lineage information, see above for its formatting

    OPTIONAL ARGUMENTS:
     -o,--out     => (STRING) output core name of the db (corename.tri, corename.sti...)
                              default = input file without fasta extension
                              (should be the database name)
     -n,--new     => (BOOL)   Get tabulated tri and sti files
                              sti: <id> \\t <taxid>
                              tri: <child_id> \\t <parent_id>
                                   (with a mandatory line = 1 \\t 0)
     -a,--all     => (BOOL)   each sequence will also be a node (to call counts to the reference in the public version)
                              this only affects the tri file.
     -m,--mirr    => (INT)    To set the first seqID number
                              0 is reserved, so if 0 is set, it will be 1
                              Default: last taxID+1
                              Will be ignored if -a is set
     -s,--sep     => (STRING) to set the separator for the nodes in the lineage
                              (special characters will be annoying to use, better to avoid)
                              default = ;
     -g,--genes   => (STRING) to also get the .tgs file.
                              getting the geneID requires a file with the geneID for each seqID:
                                 seqID \\t geneID
                              The file may contain only some seqIDs;
                              the others will get a geneID = seqID
                              if no file at all, use -g na
     -p,--pop     => (BOOL)   To populate down the lineages, so that all sequences have a lineage of the same length
                              if there is a rank but not a rank value, the rank value will be populated down:
                                 00__rankValue0;01__rankValue1;02__;03__
                              will be:
                                 00__rankValue0;01__rankValue1;02__rankValue1;03__rankValue1
                              The lineage format is very flexible except for one thing:
                              if any node has a __ in it, the ones before need to as well
                              (because it expects that __ is the separator for rank and value)
     -t,--test    => (BOOL)   will exit if missing lineages or duplicated sequences
     -w,--warn    => (BOOL)   print warnings (details of missing lineages or duplicated sequences)
     -u,--uc      => (BOOL)   print sequences in uc for the file _taxonomer.fa
                              (kmers with bases in lower cases are ignored when the db is built)
     -v,--version => (BOOL)   print version
     -c,--chlog   => (BOOL)   print change log (updates)
     -h,--help    => (BOOL)   print this usage\n\n";

#-------------------------------------------------------------------------------
#------------------------------- LOAD AND CHECK --------------------------------
#-------------------------------------------------------------------------------
my ($FASTA,$OUT,$TAB,$GENES,$POP,$SETID,$TEST,$WARN,$UC,$ALL,$V,$CHLOG,$HELP);
my $SEP = ";";
my $opt_success = GetOptions(
			 	  'fasta=s'   => \$FASTA,
			 	  'out=s'     => \$OUT,
			 	  'new'       => \$TAB,
			 	  'mirr=s'    => \$SETID,
			 	  'genes=s'   => \$GENES,
			 	  'sep=s'     => \$SEP,
			 	  'pop'       => \$POP,
			 	  'test'      => \$TEST,
			 	  'warn'      => \$WARN,
			 	  'uc'        => \$UC,
			 	  'all'       => \$ALL,
			 	  'chlog'     => \$CHLOG,
			 	  'version'   => \$V,
			 	  'help'      => \$HELP,);

#Check options, if files exist, etc
die "\n --- $SCRITPNAME version $VERSION\n\n" if $V;
die $CHANGELOG if ($CHLOG);
die "\n SOME MANDATORY ARGUMENTS MISSING, CHECK USAGE:\n$usage" if ($HELP || ! $FASTA);
die "\n -f $FASTA is not a fasta file?\n\n" unless ($FASTA =~ /\.fa|faa|fasta|fas$/);
die "\n -f $FASTA does not exist?\n\n" if (! -e $FASTA);
die "\n -m $SETID is not an integer!\n\n" if ($SETID && $SETID =~ /\D/);
die "\n -g $GENES does not exist?\n\n" if ($GENES && $GENES ne "na" && ! -e $GENES);
undef($SETID) if ($ALL);
($TAB)?($TAB="\t"):($TAB="\n");

#-------------------------------------------------------------------------------
#------------------------------------ MAIN -------------------------------------
#-------------------------------------------------------------------------------
print STDERR "\n --- $SCRITPNAME (v$VERSION)\n";
print STDERR "     input = $FASTA\n";
if (! $OUT) {
	$OUT = $FASTA;
	$OUT =~ s/\.fa$|\.faa$|\.fasta$|\.fas$//;
}
print STDERR "     output core name = $OUT\n";

print STDERR " --- Getting fasta IDs\n"; #could be all done at the same time, but that way taxIDs will be smaller numbers than the seqIDs
my @HEADERS = `grep "^>" $FASTA`;
my $nb_seqs = scalar(@HEADERS);
print STDERR "     => total of $nb_seqs sequence headers to process\n";
my $MAXLVL = 1;
if ($POP) {
print STDERR " --- Checking lineages for each seqIDs to check their depth\n";
	$MAXLVL = get_maxlvl();
	print STDERR "     => largest number of nodes in any lineage = $MAXLVL\n";
	print STDERR "        (separator for nodes = $SEP)\n";
}
print STDERR " --- Parsing headers to load lineages for each seqIDs \n";
print STDERR "     (separator for nodes = $SEP)\n" if (! $POP);
print STDERR "     (with filled empty nodes up to $MAXLVL = populating down)\n" if ($POP);
my $TAXONOMY = ();
my $INDEXMAP = ();
my $NB_DUP_ID = 0;
my $NB_NO_LIN = 0;
load_headers();
if (($NB_DUP_ID > 0) || ($NB_NO_LIN > 0)) {
	print STDERR " --- Parsing done, but:\n";
	print STDERR "     there were $NB_DUP_ID duplicated sequences (same id)\n" if ($NB_DUP_ID > 0);
	print STDERR "     there were $NB_NO_LIN sequences without lineage information\n" if ($NB_NO_LIN > 0);
	die "     => EXITING (--test chosen)\n\n" if ($TEST);
}
print STDERR " --- Obtaining tax id map (tri map) + taxids of each sequence\n";
my $TAXIDMAP = ();
my $SEQIDMAP = ();
my $TAXID = 1; #0 is the root
get_tri_sti();
$TAXID = $SETID if ($SETID);
$TAXID++ if $TAXID == 0;

print STDERR " --- Print .tri, _key.txt and _index.txt files\n";
print STDERR "     (tri in tabulated format)\n" if ($TAB eq "\t");
print STDERR "     (-a set, so tri also has each sequence as its own node in the tri)\n" if ($ALL);
print STDERR "     (WARN: -m was set, with is incompatible with -a, so was ignored)\n" if ($ALL && $SETID);
print_tri_key_idx();

print STDERR " --- Obtaining the sti map and writing it + rewriting the fasta file with integer IDs\n";
print STDERR "     (with lineages populated down)\n" if ($POP);
print STDERR "     (sti in tabulated format)\n" if ($TAB eq "\t");
print_fasta_sti_tgs();
print STDERR " --- DONE\n\n";
exit;

#-------------------------------------------------------------------------------
#--------------------------------- SUBROUTINES ---------------------------------
#-------------------------------------------------------------------------------
sub get_maxlvl {
	HEADER: foreach my $header (@HEADERS) {
		chomp($header);
		$header =~ s/^>//;
		my ($id,$lin) = split(/\s+/,$header);
		next HEADER if ((! $lin) || ($lin eq "nd")); #missing ones will be counted later
		my @nodes;
		($lin =~ /$SEP/)?(@nodes = split($SEP,$lin)):($nodes[0]=$lin);
		$MAXLVL = $#nodes+1 unless ($#nodes+1 < $MAXLVL);
	}
	return 1;
}

#-------------------------------------------------------------------------------
sub load_headers{
	HEADER: foreach my $header (@HEADERS) {
		chomp($header);
		$header =~ s/^>//;
		my ($id,$lin) = split(/\s+/,$header); #description useless here, but could be shifted to be as the lineage, so check that as well:
		if ((! $lin) || ($lin eq "nd")) {
			$NB_NO_LIN++;
			print STDERR "        WARN: no lineage found for $id -> skipping sequence\n" if ($WARN);
			next HEADER;
		}
		my $poplin = ();
		$poplin = get_map($lin);
		if ($TAXONOMY->{$id}) {
			$NB_DUP_ID++;
			print STDERR "        WARN: duplicated entry for $id -> skipping sequence\n" if ($WARN);
			next HEADER;
		} else {
			$TAXONOMY->{$id}=$poplin; #$POPlin = array
		}
	}
	return 1;
}

#-------------------------------------------------------------------------------
sub get_map {
	my $lin = shift;
	my @nodes = ();
	($lin =~ /$SEP/)?(@nodes = split($SEP,$lin)):($nodes[0]=$lin);
	$MAXLVL = $#nodes +1 if (! $POP); #Won't populate down
	my $lineage_string = "";
	for (my $i = 0; $i < $MAXLVL; $i++){
		#account for empty nodes values but that have rank values => $nodes[$i] would be defined
		if (($nodes[$i]) && ($nodes[$i] =~ /__/)) {
			my ($rank,$label) = split("__",$nodes[$i]);
			my ($prevrank,$prevlabel) = split("__",$nodes[$i-1]) unless ($label);
			$nodes[$i]=$rank."__".$prevlabel unless ($label);
		} else {
			#need to check if the previous node has a rank value => increment that
			if ($nodes[$i-1] =~ /__/) {
				my ($prevrank,$prevlabel) = split("__",$nodes[$i-1]);
				my $newrank;
				(substr($prevrank,0,1) eq 0)?($newrank="0".$i):($newrank = $prevrank++);
				($nodes[$i])?($nodes[$i]=$newrank."__".$nodes[$i]):($nodes[$i]=$newrank."__".$prevlabel);
			} else {
				$nodes[$i]=$nodes[$i-1] unless ($nodes[$i]); #basically assign the parent one to that nodes, but only if empty
			}
		}
		#current lineage - may miss levels, but for the indexmap I need all of them
		($lineage_string)?($lineage_string = $lineage_string.$SEP.$nodes[$i]):($lineage_string = $nodes[$i]);
		$INDEXMAP->{$lineage_string}{'rank'} = $i;
		$INDEXMAP->{$lineage_string}{'label'} = $nodes[$i];
		$INDEXMAP->{$lineage_string}{'label'} = $1 if ($INDEXMAP->{$lineage_string}{'label'} =~ /^[0-9]+?__(.+?)$/);
	}
	return (\@nodes); #the @nodes array has the populated down lineages
}

#-------------------------------------------------------------------------------
sub get_tri_sti {
	my $prev_lineage = "";
	foreach my $seqid (keys %{$TAXONOMY}) {
		my $lineage = "";
		foreach my $rank (@{$TAXONOMY->{$seqid}}) { #loop through all nodes
			($lineage eq "")?($lineage = $rank):($lineage = $lineage.$SEP.$rank);
			if (! $TAXIDMAP->{$lineage}{'own'}) { #no taxid yet
				$TAXIDMAP->{$lineage}{'own'}=$TAXID; #set as the previously incremented taxid
				if ((! $TAXIDMAP->{$prev_lineage}{'own'}) || ($INDEXMAP->{$lineage}{'rank'} == 0)) {
					$TAXIDMAP->{$lineage}{'parent'}=0; #when under the root
				} else {
					$TAXIDMAP->{$lineage}{'parent'}=$TAXIDMAP->{$prev_lineage}{'own'};
				}
				$TAXID++;
			}
			$prev_lineage = $lineage;
			#each seqID, the last taxid (before the ++) is the one to remember; no possible duplicated seqid at this point
			$SEQIDMAP->{$seqid}=$TAXIDMAP->{$lineage}{'own'};
		}
	}
	return 1;
}

#-------------------------------------------------------------------------------
sub print_tri_key_idx {
	my $key = $OUT."_key.txt";
	my $idx = $OUT."_index.txt";
	my %trimap = ();
	$trimap{1}=0;
	open(my $keyfh, ">", $key) or confess "ERROR (sub print_tri_key_idx): could not open to write $key $!\n";
	print $keyfh "#taxID\tparent_taxID\trank\tlineage_string\n";
	open(my $idxfh, ">", $idx) or confess "ERROR (sub print_tri_key_idx): could not open to write $idx $!\n";
	LIN: foreach my $lineage (sort keys %{$TAXIDMAP}) {
		next LIN unless ($lineage);
		#NB: tri does not need to be sorted, but that's 'prettier'
		$trimap{$TAXIDMAP->{$lineage}{'own'}}=$TAXIDMAP->{$lineage}{'parent'};
		my ($rank,$label) = ($INDEXMAP->{$lineage}{'rank'},$INDEXMAP->{$lineage}{'label'});
		print $keyfh "$TAXIDMAP->{$lineage}{'own'}\t$TAXIDMAP->{$lineage}{'parent'}\t$rank\t$lineage\n"; #taxid \t parent_taxid \t lineage_string
		print $idxfh "$TAXIDMAP->{$lineage}{'own'}\t$rank\t$label\n"; #taxid \t rank \t label
	}
	close ($keyfh);
	close ($idxfh);

	#print a sorted tri
	my $tri = $OUT.".tri";
	open(my $trifh, ">", $tri) or confess "ERROR (sub print_tri_key_idx): could not open to write $tri $!\n";
	foreach my $child (sort {$a<=>$b} keys %trimap) {
		print $trifh ">".$child.$TAB.$trimap{$child}."\n";
	}
	close ($trifh);
	return 1;
}

#-------------------------------------------------------------------------------
sub print_fasta_sti_tgs {
	#Deal with the tgs
	print STDERR "     Getting seqID <-> geneID correspondance to get the tgs\n" if ($GENES && $GENES ne "na");
	my $gID = load_geneIDs() if ($GENES && $GENES ne "na");
	my $sti = $OUT.".sti";
	my $tri = $OUT.".tri";
	my $tgs = $OUT.".tgs";
	$OUT = $OUT."_taxonomer.fa";
	my $skip;
	my %check = ();
	open(my $fh, "<", $FASTA) or confess "ERROR (sub print_fasta_sti_tgs): could not open to read $FASTA $!\n";
	open(my $stifh, ">", $sti) or confess "ERROR (sub print_fasta_sti_tgs): could not open to write $sti $!\n";
	open(my $fafh, ">", $OUT) or confess "ERROR (sub print_fasta_sti_tgs): could not open to write $OUT $!\n";
	open(my $tgsfh, ">", $tgs) or confess "ERROR (sub print_fasta_sti_tgs): could not open to write $tgs $!\n" if ($GENES);
	open(my $trifh, ">>", $tri) or confess "ERROR (sub print_tri_key_idx): could not open to write $tri $!\n" if ($ALL);
	LINE: while(<$fh>) {
		chomp (my $line = $_);
		if (substr($line,0,1) eq ">") {
			$line =~ s/^>//;
			my @header = split(/\s+/,$line);
			my ($seqid,$lin) = ($header[0],$header[1]);
			my @desc = @header;
			splice(@desc,0,2); #remove the first 2 elements; id_name & lineage
			my $desc = ""; #just in case
			$desc = join(" ",@desc) if ($desc[0]); #re-build the description if any
			#checks
			if (! $lin || $lin eq "nd" || $check{$seqid}){
				$skip = 1;
			} else {
				my $lineage = join("$SEP",@{$TAXONOMY->{$seqid}});
				#fasta file
				print $fafh ">$TAXID\t$seqid\t$lineage\t$desc\n";
				#sti file
				if ($ALL) {
					#then the sti file will be in tri and sti just has seqs as children of themselves
					print $stifh ">".$TAXID.$TAB.$TAXID."\n";
				} else {
					print $stifh ">".$TAXID.$TAB.$SEQIDMAP->{$seqid}."\n";
				}
				#Deal with tgs file if relevant
				if ($GENES) {
					my $g;
					($gID->{$seqid})?($g = $gID->{$seqid}):($g = $TAXID);
					print $tgsfh "$SEQIDMAP->{$seqid}\t$g\t$TAXID\t$seqid\n";
				}
				#now if -a option; add the sti in the tri
				if ($ALL) {
					print $trifh ">".$TAXID.$TAB.$SEQIDMAP->{$seqid}."\n"; #what would be in sti otherwise
				}
				$check{$seqid}=1;
				$skip = 0;
				$TAXID++;
			}
		} else {
			if ($UC) {
				print $fafh uc($line)."\n" unless ($skip == 1);
			} else {
				print $fafh $line."\n" unless ($skip == 1);
			}
		}
	}
	close $fh;
	close $stifh;
	close $fafh;
	close $tgsfh if ($GENES);
	close ($trifh) if ($ALL);
	return 1;
}

#-------------------------------------------------------------------------------
sub load_geneIDs {
	my %ids = ();
	open(my $fh, "<", $GENES) or confess "ERROR (sub load_geneIDs): could not open to read $GENES $!\n";
	while (<$fh>) {
		chomp(my $l = $_);
		next LINE if ((substr($l,0,1) eq "#") || ($l =~ /\W/));
		my @l = split('\s+',$l);
		$ids{$l[0]}=$l[1];
	}
	close ($fh);
	return(\%ids);
}


text:
/**@file tz_arraytrans.h
 * @brief *routines for array transformation (Obsolete)
 * @author Ting Zhao
 */

/*
 * Things to do to add a new type Tarray
 *
 * .h
 * #include "tarray.h"
 * #define TARRAY_AT     number
 * Tarray* Get_Tarray_At(Array_Link *a);
 *
 * .c
 * get_array
 * set_array
 * DEFINE_GET_DATA_AT(Tarray, Tarray, TARRAY_AT)
 * new_data
 *
 */

#ifndef _TZ_ARRAYTRANS_H_
#define _TZ_ARRAYTRANS_H_

#include "tz_cdefs.h"
#include <image_lib.h>
#include "tz_dmatrix.h"
#include "tz_fmatrix.h"
#include "tz_imatrix.h"
#include "tz_u8matrix.h"
#include "tz_matlabio.h"
#include "tz_object_3d.h"
#ifdef HAVE_LIBGSL
#  if defined(HAVE_INLINE)
#    undef HAVE_INLINE
#    define INLINE_SUPPRESSED
#  endif
#  include <gsl/gsl_matrix.h>
#  if defined(INLINE_SUPPRESSED)
#    define HAVE_INLINE
#  endif
#endif

__BEGIN_DECLS

#define IMAGE_AT                   1
#define STACK_AT                   2
#define DMATRIX_AT                 4
#define FMATRIX_AT                 5
#define IMATRIX_AT                 6
#define U8MATRIX_AT                7
#define GSL_MATRIX_AT              10
#define GSL_FLOAT_MATRIX_AT        11
#define GSL_UCHAR_MATRIX_AT        12
#define GSL_USHORT_MATRIX_AT       13
#define GSL_DOUBLE_MATRIX_AT       14
#define GSL_VECTOR_AT              15
#define GSL_FLOAT_VECTOR_AT        16
#define GSL_UCHAR_VECTOR_AT        17
#define GSL_USHORT_VECTOR_AT       18
#define GSL_DOUBLE_VECTOR_AT       19
#define MX_ARRAY_AT                30
#define MATLAB_ARRAY_AT            40
#define OBJECT_3D_AT               50

/**@brief Array link.
 *
 * Note: This data structure is obsolete and tz_arrayview.h is preferred.
 *
 * This data structure is for transforming different array data structures,
 * which have a common architecture. They all have
 * one and only one field for storing a data array, such as matrix, vector, and
 * pixel array. Other fields of them are information of the array. So we would
 * like to transform one of the data structures to another without making a new
 * copy of the array field. In Array_Link, <data> is a field referring to a
 * certain array data structure and <type> indicates what kind of array it is.
 */
typedef struct tag_Array_Link {
  void *data;
  int type;
} Array_Link;

/**@brief Attach an array.
 *
 * Attach_Array() attaches a raw array to the structured array in an array link.
 * The old attached raw array will be returned. Detach_Array() detaches the raw
 * array and  returns it.
 */
void* Attach_Array(Array_Link *a, void *array);
void* Detach_Array(Array_Link *a);

/*
 * New_Array_Link() news an array link with a certain type. It does not new a
 * raw array. Delete_Array_Link() frees the space of an array link, but any raw
 * array attached will be kept intact and returned.
 */
Array_Link* New_Array_Link(int type);
void* Delete_Array_Link(Array_Link *a);

/*
 * Get_xxx_At() is a set of funtions of getting a structured array from an
 * array link.
 */
Stack* Get_Stack_At(Array_Link *a);
Image* Get_Image_At(Array_Link *a);

#ifdef HAVE_LIBGSL
gsl_matrix_uchar* Get_Gmuc_At(Array_Link *a);
gsl_matrix_ushort* Get_Gmus_At(Array_Link *a);
gsl_matrix_float* Get_Gmf_At(Array_Link *a);
gsl_matrix* Get_Gmd_At(Array_Link *a);
gsl_vector_uchar* Get_Gvuc_At(Array_Link *a);
gsl_vector_ushort* Get_Gvus_At(Array_Link *a);
gsl_vector_float* Get_Gvf_At(Array_Link *a);
gsl_vector* Get_Gvd_At(Array_Link *a);
#endif

DMatrix* Get_DMatrix_At(Array_Link *a);
FMatrix* Get_FMatrix_At(Array_Link *a);
IMatrix* Get_IMatrix_At(Array_Link *a);
U8Matrix* Get_U8Matrix_At(Array_Link *a);
Object_3d* Get_Object_3d_At(Array_Link *a);

/*
 * xxx1_To_xxx2() is a set of transforming functions. After transformation,
 * one can use Get_xxx2_At() to get the transformed array. Note that the
 * transformed array should not be freed directly, use Free_Array_Link() to
 * free the corresponding array link instead.
 */
Array_Link* Image_To_Stack(Image *x);
Array_Link* Image_To_Gm(Image *x);
Array_Link* Image_To_Gv(Image *x);
Array_Link* Image_To_Matrix(Image *x);

Array_Link* Stack_To_Image(Stack *x);
Array_Link* Stack_Slice_To_Image(Stack *x, int slice);
Array_Link* Stack_To_Gm(Stack *x);
Array_Link* Stack_To_Gv(Stack *x);

Array_Link* Mar_To_Image(Matlab_Array *x);
Array_Link* Mar_To_Stack(Matlab_Array *x);
Array_Link* Mar_To_DMatrix(Matlab_Array *x);
Array_Link* Mar_To_Object_3d(Matlab_Array *x);

Array_Link* DMatrix_To_Gm(DMatrix *x);
Array_Link* FMatrix_To_Gm(FMatrix *x);
Array_Link* FMatrix_To_Stack(FMatrix *x);

__END_DECLS

#endif

redpajama_set_name: RedPajamaGithub


text:
<?php

error_reporting(E_ALL | E_STRICT | @E_DEPRECATED);
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'PHPUnit/Util/Filter.php';

PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(dirname(__FILE__));
PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(dirname(__FILE__) . '/../lib/IDS/vendors');

if (!defined('PHPUnit_MAIN_METHOD')) {
	define('PHPUnit_MAIN_METHOD', 'allTests');
}

class allTests
{
	public static function main()
	{
		PHPUnit_TextUI_TestRunner::run(self::suite());
	}

	public static function suite()
	{
        $suite = new PHPUnit_Framework_TestSuite('PHPIDS');
        require_once 'IDS/MonitorTest.php';
        $suite->addTestSuite('IDS_MonitorTest');
        require_once 'IDS/ReportTest.php';
        $suite->addTestSuite('IDS_ReportTest');
        require_once 'IDS/InitTest.php';
        $suite->addTestSuite('IDS_InitTest');
        require_once 'IDS/ExceptionTest.php';
        $suite->addTestSuite('IDS_ExceptionTest');
        require_once 'IDS/FilterTest.php';
        $suite->addTestSuite('IDS_FilterTest');
        require_once 'IDS/CachingTest.php';
        $suite->addTestSuite('IDS_CachingTest');
        require_once 'IDS/EventTest.php';
        $suite->addTestSuite('IDS_EventTest');
        require_once 'IDS/VersionTest.php';
        $suite->addTestSuite('IDS_VersionTest');
        return $suite;
	}
}

if (PHPUnit_MAIN_METHOD == 'allTests') {
	allTests::main();
}

/**
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * End:
 * vim600: sw=4 ts=4 expandtab
 */


text:
Add yourself to the docker group (create if necessary)

https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user

Using a lot of space for the images ... may need to move the docker image location to a bigger disk

https://linuxconfig.org/how-to-move-docker-s-default-var-lib-docker-to-another-directory-on-ubuntu-debian-linux

### Instances / machines

### What to do ...

  3. Log into the container-optimised virtual machine on google
    - `docker pull` the required image
    - `mkdir vieps_data`
    - `mkdir vieps_users`
    - `chmod a+w` on these (maybe `chown chronos vieps_data` ?)

  4. Run the container with the following command:

     (Note the paths !)

```sh
nohup docker run --cpus=4 --name vieps-pye -p 8080:8080 -p 8081:8081 -p 8082:8082 -p 8083:8083 -p 8084:8084 -p 8085:8085 -p 8086:8086 -p 8087:8087 -p 8088:8088 -p 8089:8089 -p 8090:8090 -p 8091:8091 -p 8092:8092  -v /home/lmoresi/vieps_data:/home/jovyan/Data/Resources -v /home/lmoresi/vieps_users:/home/jovyan/build lmoresi/docker-vieps-pye-8user:2018.1 &
```
  5. exit the shell using `^D` to ensure that the process continues to run in the background

  6. Log into the root instance of the site (`http:?.?.?.?:8080`) and use the `jupyter` terminal to rebuild the site (the external directories will have been overlain by mounting the persistent volumes). Back up this data if the image has been in use before.

  7. Do any other site maintenance / preparation such as caching data via the root instance. This will change the master copies of notebooks and can be propagated out via the `scripts/run-sitebuilder8.py` command.

#### Notes on these instructions

Volumes exposed in the image are:

``` sh
  /home/jovyan/Data/Resources
  /home/jovyan/build
```
We need to use absolute paths in the `docker run` command
otherwise these things get created quietly somewhere in the `/var/docker` area.
That might be OK as it would be persistent, but not helpful for backup etc.

### Usage

The root instance is the user logging in via the 8080 port

#### Passwords

Pretty obvious, but can be changed in the run-jupyter scripts.


text:
"""
Entry point into the weather sensor
"""
import logging.config
import sys
import threading
import time

from data.SensorHandler import SensorHandler
import data.SingletonExecution
from data.wifiChecker.WifiMon import WifiMon as WifiMon
from data.Constants import Constant

# Define the Error Log Details
logging.config.fileConfig(Constant.LOGGER_FILE_NAME)
logger = logging.getLogger(Constant.LOGGER_NAME)

# Run a check and close any previously running instances of the same application
data.SingletonExecution.SingletonExecution.ensure_only_one_instance()

def update_sensor():
    """
    Initiates a thread which will validate ALL Sensors and then run them with the frequency defined
    inside the configuration.ini file.
    """
    sh = SensorHandler()
    t = threading.Thread(name='sensorReaderThread', target=sh.sensor_continuous_reader)
    t.setDaemon(True)
    t.start()

def monitor_wifi():
    """
    Initiates a thread which will own the execution of the wifi checking and keep alive
    """
    wifi_monitor = WifiMon()
    t = threading.Thread(name='wifiMonitorThread', target=wifi_monitor.keep_wifi_alive)
    t.setDaemon(True)
    t.start()

def main(argv):
    """
    Start of weatherSensor
    :param argv:
        any command line entries
    """
    print('CTRL+C to break and exit')
    logger.info('*************************************************')
    logger.info('***** MQTT SensorCLIENT APPLICATION STARTED *****')
    logger.info('*************************************************')
    logger.debug('Parameters included on start was [{0}]'.format(argv))
    try:
        monitor_wifi()  # Sets up the wifi monitor thread
        update_sensor()  # Sets up the monitor sensor & mqtt publishing thread

        while threading.active_count() > 0:
            time.sleep(1)
    except (KeyboardInterrupt, SystemExit):
        logger.info(" ***** RECEIVED TERMINATION AND TERMINATING ***** ")
        SensorHandler.threadExitFlag = 1
        sys.exit()

if __name__ == '__main__':
    main(sys.argv)


text:
const donateURL = Cypress.env('USE_NEW_CREATE_ORDER') ? 'donate/legacy' : 'donate';

describe('collective.createOrder page', () => {
  it('loads custom donate page', () => {
    cy.visit(`/apex/${donateURL}?amount=50&interval=month&description=custom%20description`);
    cy.get('.tier .description').contains('custom description');
    cy.get('.tier .amount').contains('$50');
    cy.get('.tier .amount').contains('per month');
  });

  it('makes an order logged out as a new user', () => {
    const email = `testuser+${Math.round(Math.random() * 1000000)}@gmail.com`;
    cy.visit(`/apex/${donateURL}?test=e2e`);
    cy.get(".inputField textarea[name='publicMessage']").type('public message');
    cy.fillInputField('email', email);
    cy.fillInputField('firstName', 'Xavier');
    cy.fillInputField('lastName', 'Damman');
    cy.fillInputField('website', 'http://xdamman.com');
    cy.fillInputField('twitterHandle', 'xdamman');
    cy.fillInputField('description', 'short description');
    cy.get('.submit button').click();
    cy.wait(6500);
    cy.location().should(location => {
      expect(location.search).to.match(
        /\?status=PAID&CollectiveId=[0-9]+&collectiveType=COLLECTIVE&OrderId=[0-9]+&totalAmount=5000&paymentMethodType=creditcard/,
      );
    });
    cy.get('p.thankyou');
    cy.get('.message').contains('apex');
  });

  it('makes an order logged out as a new user with a manual payment method', () => {
    const email = `testuser+${Math.round(Math.random() * 1000000)}@gmail.com`;
    cy.visit(`/veganizerbxl/${donateURL}?amount=100`);
    cy.get(".inputField textarea[name='publicMessage']").type('public message');
    cy.fillInputField('email', email);
    cy.fillInputField('firstName', 'Xavier');
    cy.fillInputField('lastName', 'Damman');
    cy.fillInputField('website', 'http://xdamman.com');
    cy.fillInputField('twitterHandle', 'xdamman');
    cy.fillInputField('description', 'short description');
    cy.get('select[name="paymentMethodTypeSelector"]').select('manual');
    cy.get('.manualPaymentMethod .instructions').contains(
      'Instructions to make the payment of €100.00 will be sent to your email address',
    );
    cy.get('.manualPaymentMethod .instructions').contains(
      'Your order will be pending until the funds have been received by the host (BrusselsTogether ASBL)',
    );
    cy.get('.submit button').click();
    cy.wait(1000);
    cy.location().should(location => {
      expect(location.search).to.match(
        /\?status=PENDING&CollectiveId=[0-9]+&collectiveType=COLLECTIVE&OrderId=[0-9]+&totalAmount=10000&paymentMethodType=manual/,
      );
    });
    cy.get('p.thankyou');
    cy.get('.message').contains(
      'Your donation is pending. Please follow the instructions in the confirmation email to manually pay the host of the collective.',
    );
  });

  it('makes an order logged out as a new user with a redirect url', () => {
    const email = `testuser+${Math.round(Math.random() * 1000000)}@gmail.com`;
    cy.visit(`/apex/${donateURL}?test=e2e&redirect=http://localhost:3000/callback`);
    cy.get(".inputField textarea[name='publicMessage']").type('public message');
    cy.fillInputField('email', email);
    cy.fillInputField('firstName', 'Xavier');
    cy.fillInputField('lastName', 'Damman');
    cy.fillInputField('website', 'http://xdamman.com');
    cy.fillInputField('twitterHandle', 'xdamman');
    cy.fillInputField('description', 'short description');
    cy.get('.submit button').click();
    cy.wait(2500);
    cy.get('.result .success').contains('Order processed successfully. Redirecting you to localhost...');
    cy.location().should(location => {
      expect(location.search).to.match(/\?transactionid=[0-9]+/);
    });
  });

  it('makes an order as a new organization', () => {
    const email = `testuser+${Math.round(Math.random() * 1000000)}@gmail.com`;
    cy.visit(`/apex/${donateURL}`);
    cy.get('.inputField.email input').type(email);
    cy.wait(400);
    cy.get('.actions .submit button').click();
    cy.get('.result .error').contains('Credit card missing');
    cy.get('.fromCollectiveSelector select')
      .select('organization')
      .blur();
    cy.wait(500);
    cy.get('.actions .submit button').click();
    cy.get('.result .error').contains('Please provide a name for the new organization');
    cy.get('.organizationDetailsForm .organization_name input')
      .type('new org')
      .blur();
    cy.wait(400);
    cy.get('.actions .submit button').click();
    cy.get('.result .error').contains('Please provide a website for the new organization');
    cy.get('.organizationDetailsForm .organization_website input').type('neworg.com');
    cy.wait(400);
    cy.get('.actions .submit button').click();
    cy.get('.result .error').contains('Credit card missing');
  });
});


text: Website for the Michigan Cubing Club


text:
package bpmn.conformer;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener;
import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin;
import org.camunda.bpm.engine.impl.cfg.BpmnConformParseFactory;
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;

import bpmn.conformer.xpath.XPathConditionBpmnParseListener;

public class BpmnConformerProcessEnginePlugin extends AbstractProcessEnginePlugin {

  @Override
  public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
    setBpmnConformParseFactory(processEngineConfiguration);

    List<BpmnParseListener> postParseListeners = processEngineConfiguration.getCustomPostBPMNParseListeners();
    if(postParseListeners == null) {
      postParseListeners = new ArrayList<BpmnParseListener>();
      processEngineConfiguration.setCustomPostBPMNParseListeners(postParseListeners);
    }
    postParseListeners.add(new XPathConditionBpmnParseListener());
  }

  private static void setBpmnConformParseFactory(ProcessEngineConfigurationImpl processEngineConfiguration) {
    Class<? extends ProcessEngineConfigurationImpl> clazz = processEngineConfiguration.getClass();
    Field field = getField(clazz, "bpmnParseFactory");
    field.setAccessible(true);
    try {
      field.set(processEngineConfiguration, new BpmnConformParseFactory());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }

  private static Field getField(Class<?> clazz, String fieldName) {
    try {
      return clazz.getDeclaredField(fieldName);
    } catch (NoSuchFieldException e) {
      Class<?> superClass = clazz.getSuperclass();
      if (superClass == null) {
        throw new RuntimeException(e);
      } else {
        return getField(superClass, fieldName);
      }
    }
  }
}


text:
=pod

=head1 NAME

DSA_get0_pqg, DSA_set0_pqg, DSA_get0_key, DSA_set0_key,
DSA_get0_p, DSA_get0_q, DSA_get0_g,
DSA_get0_pub_key, DSA_get0_priv_key,
DSA_clear_flags, DSA_test_flags, DSA_set_flags,
DSA_get0_engine - Routines for getting and
setting data in a DSA object

=head1 SYNOPSIS

 #include <openssl/dsa.h>

Deprecated since OpenSSL 3.0, can be hidden entirely by defining
B<OPENSSL_API_COMPAT> with a suitable version value, see
L<openssl_user_macros(7)>:

 void DSA_get0_pqg(const DSA *d,
                   const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
 int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
 void DSA_get0_key(const DSA *d,
                   const BIGNUM **pub_key, const BIGNUM **priv_key);
 int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
 const BIGNUM *DSA_get0_p(const DSA *d);
 const BIGNUM *DSA_get0_q(const DSA *d);
 const BIGNUM *DSA_get0_g(const DSA *d);
 const BIGNUM *DSA_get0_pub_key(const DSA *d);
 const BIGNUM *DSA_get0_priv_key(const DSA *d);
 void DSA_clear_flags(DSA *d, int flags);
 int DSA_test_flags(const DSA *d, int flags);
 void DSA_set_flags(DSA *d, int flags);
 ENGINE *DSA_get0_engine(DSA *d);

=head1 DESCRIPTION

All of the functions described on this page are deprecated.
Applications should instead use L<EVP_PKEY_get_bn_param(3)>.

A DSA object contains the parameters B<p>, B<q> and B<g>. It also contains a
public key (B<pub_key>) and (optionally) a private key (B<priv_key>).

The B<p>, B<q> and B<g> parameters can be obtained by calling DSA_get0_pqg().
If the parameters have not yet been set then B<*p>, B<*q> and B<*g> will be set
to NULL. Otherwise they are set to pointers to their respective values. These
point directly to the internal representations of the values and therefore
should not be freed directly.

The B<p>, B<q> and B<g> values can be set by calling DSA_set0_pqg() and passing
the new values for B<p>, B<q> and B<g> as parameters to the function. Calling
this function transfers the memory management of the values to the DSA object,
and therefore the values that have been passed in should not be freed directly
after this function has been called.

To get the public and private key values use the DSA_get0_key() function. A
pointer to the public key will be stored in B<*pub_key>, and a pointer to the
private key will be stored in B<*priv_key>. Either may be NULL if they have not
been set yet, although if the private key has been set then the public key must
be. The values point to the internal representation of the public key and
private key values. This memory should not be freed directly.

The public and private key values can be set using DSA_set0_key(). The public
key must be non-NULL the first time this function is called on a given DSA
object. The private key may be NULL.  On subsequent calls, either may be NULL,
which means the corresponding DSA field is left untouched. As for DSA_set0_pqg()
this function transfers the memory management of the key values to the DSA
object, and therefore they should not be freed directly after this function has
been called.

Any of the values B<p>, B<q>, B<g>, B<priv_key>, and B<pub_key> can also be
retrieved separately by the corresponding function DSA_get0_p(), DSA_get0_q(),
DSA_get0_g(), DSA_get0_priv_key(), and DSA_get0_pub_key(), respectively.

DSA_set_flags() sets the flags in the B<flags> parameter on the DSA object.
Multiple flags can be passed in one go (bitwise ORed together). Any flags that
are already set are left set. DSA_test_flags() tests to see whether the flags
passed in the B<flags> parameter are currently set in the DSA object. Multiple
flags can be tested in one go. All flags that are currently set are returned, or
zero if none of the flags are set. DSA_clear_flags() clears the specified flags
within the DSA object.

DSA_get0_engine() returns a handle to the ENGINE that has been set for this DSA
object, or NULL if no such ENGINE has been set.

=head1 NOTES

Values retrieved with DSA_get0_key() are owned by the DSA object used
in the call and may therefore I<not> be passed to DSA_set0_key().  If
needed, duplicate the received value using BN_dup() and pass the
duplicate.  The same applies to DSA_get0_pqg() and DSA_set0_pqg().

=head1 RETURN VALUES

DSA_set0_pqg() and DSA_set0_key() return 1 on success or 0 on failure.

DSA_test_flags() returns the current state of the flags in the DSA object.

DSA_get0_engine() returns the ENGINE set for the DSA object or NULL if no ENGINE
has been set.

=head1 SEE ALSO

L<EVP_PKEY_get_bn_param(3)>,
L<DSA_new(3)>, L<DSA_new(3)>, L<DSA_generate_parameters(3)>, L<DSA_generate_key(3)>,
L<DSA_dup_DH(3)>, L<DSA_do_sign(3)>, L<DSA_set_method(3)>, L<DSA_SIG_new(3)>,
L<DSA_sign(3)>, L<DSA_size(3)>, L<DSA_meth_new(3)>

=head1 HISTORY

The functions described here were added in OpenSSL 1.1.0 and deprecated in
OpenSSL 3.0.

=head1 COPYRIGHT

Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License").  You may not use
this file except in compliance with the License.  You can obtain a copy
in the file LICENSE in the source distribution or at
L<https://www.openssl.org/source/license.html>.

=cut


text:
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2020, OpenNebula Project, OpenNebula Systems                */
/*                                                                            */
/* 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.                                             */
/* -------------------------------------------------------------------------- */

define(function(require) {
  var Locale = require('utils/locale');
  var TemplateButtons = require('tabs/templates-tab/buttons');
  var Tips = require('utils/tips');

  var Buttons = {
    "VMGroup.refresh" : {
      type: "action",
      layout: "refresh",
      alwaysActive: true
    },
    "VMGroup.create_dialog" : {
      type: "create_dialog",
      layout: "create"
    },
    "VMGroup.update_dialog" : {
      type : "action",
      layout: "main",
      text : Locale.tr("Update")
    },
    "VMGroup.chown" : {
      type: "confirm_with_select",
      text: Locale.tr("Change owner"),
      layout: "user_select",
      select: "User",
      tip: Locale.tr("Select the new owner")
    },
    "VMGroup.chgrp" : {
      type: "confirm_with_select",
      text: Locale.tr("Change group"),
      layout: "user_select",
      select: "Group",
      tip: Locale.tr("Select the new group")
    },
    "VMGroup.delete" : {
      type: "confirm",
      text: Locale.tr("Delete"),
      layout: "del"
    },
    // "VMGroup.lockA" : {
    //   type: "action",
    //   text: Locale.tr("Admin"),
    //   layout: "lock_buttons",
    //   data: 3
    // },
    // "VMGroup.lockM" : {
    //   type: "action",
    //   text: Locale.tr("Manage"),
    //   layout: "lock_buttons",
    //   data: 2
    // },
    "VMGroup.lockU" : {
      type: "action",
      text: Locale.tr("Lock"),
      layout: "lock_buttons",
      data: 1
    },
    "VMGroup.unlock" : {
      type: "action",
      text: Locale.tr("Unlock"),
      layout: "lock_buttons"
    }/*,
    "VMGroup.edit_labels" : {
      layout: "labels",
    }*/
  };

  return Buttons;
});


text:
package CPANPLUS::Configure;
use strict;

use CPANPLUS::Internals::Constants;
use CPANPLUS::Error;
use CPANPLUS::Config;

use Log::Message;
use Module::Load                qw[load];
use Params::Check               qw[check];
use File::Basename              qw[dirname];
use Module::Loaded              ();
use Locale::Maketext::Simple    Class => 'CPANPLUS', Style => 'gettext';

use vars                        qw[$AUTOLOAD $VERSION $MIN_CONFIG_VERSION];
use base                        qw[CPANPLUS::Internals::Utils];

local $Params::Check::VERBOSE = 1;

### require, avoid circular use ###
require CPANPLUS::Internals;
$VERSION = "0.9134";

### can't use O::A as we're using our own AUTOLOAD to get to
### the config options.
for my $meth ( qw[conf _lib _perl5lib]) {
    no strict 'refs';

    *$meth = sub {
        my $self = shift;
        $self->{'_'.$meth} = $_[0] if @_;
        return $self->{'_'.$meth};
    }
}

=pod

=head1 NAME

CPANPLUS::Configure - configuration for CPANPLUS

=head1 SYNOPSIS

    $conf   = CPANPLUS::Configure->new( );

    $bool   = $conf->can_save;
    $bool   = $conf->save( $where );

    @opts   = $conf->options( $type );

    $make       = $conf->get_program('make');
    $verbose    = $conf->set_conf( verbose => 1 );

=head1 DESCRIPTION

This module deals with all the configuration issues for CPANPLUS.
Users can use objects created by this module to alter the behaviour
of CPANPLUS.

Please refer to the C<CPANPLUS::Backend> documentation on how to
obtain a C<CPANPLUS::Configure> object.

=head1 METHODS

=head2 $Configure = CPANPLUS::Configure->new( load_configs => BOOL )

This method returns a new object. Normal users will never need to
invoke the C<new> method, but instead retrieve the desired object via
a method call on a C<CPANPLUS::Backend> object.

=over 4

=item load_configs

Controls whether or not additional user configurations are to be loaded
or not. Defaults to C<true>.

=back

=cut

### store the CPANPLUS::Config object in a closure, so we only
### initialize it once.. otherwise, on a 2nd ->new, settings
### from configs on top of this one will be reset
{   my $Config;

    sub new {
        my $class   = shift;
        my %hash    = @_;

        ### XXX pass on options to ->init() like rescan?
        my ($load);
        my $tmpl    = {
            load_configs    => { default => 1, store => \$load },
        };

        check( $tmpl, \%hash ) or (
            warn Params::Check->last_error, return
        );

        $Config     ||= CPANPLUS::Config->new;
        my $self    = bless {}, $class;
        $self->conf( $Config );

        ### you want us to load other configs?
        ### these can override things in the default config
        $self->init if $load;

        ### after processing the config files, check what
        ### @INC and PERL5LIB are set to.
        $self->_lib( \@INC );
        $self->_perl5lib( $ENV{'PERL5LIB'} );

        return $self;
    }
}

=head2 $bool = $Configure->init( [rescan => BOOL])

Initialize the configure with other config files than just
the default 'CPANPLUS::Config'.

Called from C<new()> to load user/system configurations

If the C<rescan> option is provided, your disk will be
examined again to see if there are new config files that
could be read. Defaults to C<false>.

Returns true on success, false on failure.

=cut

### move the Module::Pluggable detection to runtime, rather
### than compile time, so that a simple 'require CPANPLUS'
### doesn't start running over your filesystem for no good
### reason. Make sure we only do the M::P call once though.
### we use $loaded to mark it
{   my $loaded;
    my $warned;
    sub init {
        my $self    = shift;
        my $obj     = $self->conf;
        my %hash    = @_;

        my ($rescan);
        my $tmpl    = {
            rescan  => { default => 0, store => \$rescan },
        };

        check( $tmpl, \%hash ) or (
            warn Params::Check->last_error, return
        );

        ### if the base dir is changed, we have to rescan it
        ### for any CPANPLUS::Config::* files as well, so keep
        ### track of it
        my $cur_base = $self->get_conf('base');

        ### warn if we find an old style config specified
        ### via environment variables
        {   my $env = ENV_CPANPLUS_CONFIG;
            if( $ENV{$env} and not $warned ) {
                $warned++;
                error(loc("Specifying a config file in your environment " .
                          "using %1 is obsolete.\nPlease follow the ".
                          "directions outlined in %2 or use the '%3' command\n".
                          "in the default shell to use custom config files.",
                          $env, "CPANPLUS::Configure->save", 's save'));
            }
        }

        {   ### make sure that the homedir is included now
            local @INC = ( LIB_DIR->($cur_base), @INC );

            ### only set it up once
            if( !$loaded++ or $rescan ) {
                ### find plugins & extra configs
                ### check $home/.cpanplus/lib as well
                require Module::Pluggable;

                Module::Pluggable->import(
                    search_path => ['CPANPLUS::Config'],
                    search_dirs => [ LIB_DIR->($cur_base) ],
                    except      => qr/::SUPER$/,
                    sub_name    => 'configs'
                );
            }

            ### do system config, user config, rest.. in that order
            ### apparently, on a 2nd invocation of -->configs, a
            ### ::ISA::CACHE package can appear.. that's bad...
            my %confs = map  { $_ => $_ }
                        grep { $_ !~ /::ISA::/ } __PACKAGE__->configs;
            my @confs = grep { defined }
                        map  { delete $confs{$_} } CONFIG_SYSTEM, CONFIG_USER;
            push @confs, sort keys %confs;

            for my $plugin ( @confs ) {
                msg(loc("Found config '%1'", $plugin),0);

                ### if we already did this the /last/ time around dont
                ### run the setup agian.
                if( my $loc = Module::Loaded::is_loaded( $plugin ) ) {
                    msg(loc("  Already loaded '%1' (%2)", $plugin, $loc), 0);
                    next;
                } else {
                    msg(loc("  Loading config '%1'", $plugin),0);

                    if( eval { load $plugin; 1 } ) {
                        msg(loc("  Loaded '%1' (%2)",
                            $plugin, Module::Loaded::is_loaded( $plugin ) ), 0);
                    } else {
                        error(loc("  Error loading '%1': %2", $plugin, $@));
                    }
                }

                if( $@ ) {
                    error(loc("Could not load '%1': %2", $plugin, $@));
                    next;
                }

                my $sub = $plugin->can('setup');
                $sub->( $self ) if $sub;
            }
        }

        ### did one of the plugins change the base dir? then we should
        ### scan the dirs again
        if( $cur_base ne $self->get_conf('base') ) {
            msg(loc("Base dir changed from '%1' to '%2', rescanning",
                    $cur_base, $self->get_conf('base')), 0);
            $self->init( @_, rescan => 1 );
        }

        ### clean up the paths once more, just in case
        $obj->_clean_up_paths;

        ### XXX in case the 'lib' param got changed, we need to
        ### add that now, or it's not propagating ;(
        {   my $lib = $self->get_conf('lib');
            my %inc = map { $_ => $_ } @INC;
            for my $l ( @$lib ) {
                push @INC, $l unless $inc{$l};
            }
            $self->_lib( \@INC );
        }

        return 1;
    }
}
=pod

=head2 can_save( [$config_location] )

Check if we can save the configuration to the specified file.
If no file is provided, defaults to your personal config.

Returns true if the file can be saved, false otherwise.

=cut

sub can_save {
    my $self = shift;
    my $file = shift || CONFIG_USER_FILE->();

    return 1 unless -e $file;

    chmod 0644, $file;
    return (-w $file);
}

=pod

=head2 $file = $conf->save( [$package_name] )

Saves the configuration to the package name you provided.
If this package is not C<CPANPLUS::Config::System>, it will
be saved in your C<.cpanplus> directory, otherwise it will
be attempted to be saved in the system wide directory.

If no argument is provided, it will default to your personal
config.

Returns the full path to the file if the config was saved,
false otherwise.

=cut

sub _config_pm_to_file {
    my $self = shift;
    my $pm   = shift or return;
    my $dir  = shift || CONFIG_USER_LIB_DIR->();

    ### only 3 types of files know: home, system and 'other'
    ### so figure out where to save them based on their type
    my $file;
    if( $pm eq CONFIG_USER ) {
        $file = CONFIG_USER_FILE->();

    } elsif ( $pm eq CONFIG_SYSTEM ) {
        $file = CONFIG_SYSTEM_FILE->();

    ### third party file
    } else {
        my $cfg_pkg = CONFIG . '::';
        unless( $pm =~ /^$cfg_pkg/ ) {
            error(loc(
                "WARNING: Your config package '%1' is not in the '%2' ".
                "namespace and will not be automatically detected by %3",
                $pm, $cfg_pkg, 'CPANPLUS'
            ));
        }

        $file = File::Spec->catfile(
            $dir,
            split( '::', $pm )
        ) . '.pm';
    }

    return $file;
}

sub save {
    my $self    = shift;
    my $pm      = shift || CONFIG_USER;
    my $savedir = shift || '';

    my $file = $self->_config_pm_to_file( $pm, $savedir ) or return;
    my $dir  = dirname( $file );

    unless( -d $dir ) {
        $self->_mkdir( dir => $dir ) or (
            error(loc("Can not create directory '%1' to save config to",$dir)),
            return
        )
    }
    return unless $self->can_save($file);

    ### find only accessors that are not private
    my @acc = sort grep { $_ !~ /^_/ } $self->conf->ls_accessors;

    ### for dumping the values
    use Data::Dumper;

    my @lines;
    for my $acc ( @acc ) {

        push @lines, "### $acc section", $/;

        for my $key ( $self->conf->$acc->ls_accessors ) {
            my $val = Dumper( $self->conf->$acc->$key );

            $val =~ s/\$VAR1\s+=\s+//;
            $val =~ s/;\n//;

            push @lines, '$'. "conf->set_${acc}( $key => $val );", $/;
        }
        push @lines, $/,$/;

    }

    my $str = join '', map { "    $_" } @lines;

    ### use a variable to make sure the pod parser doesn't snag it
    my $is      = '=';
    my $time    = gmtime;

    my $msg     = <<_END_OF_CONFIG_;
###############################################
###
###  Configuration structure for $pm
###
###############################################

#last changed: $time GMT

### minimal pod, so you can find it with perldoc -l, etc
${is}pod

${is}head1 NAME

$pm

${is}head1 DESCRIPTION

This is a CPANPLUS configuration file. Editing this
config changes the way CPANPLUS will behave

${is}cut

package $pm;

use strict;

sub setup {
    my \$conf = shift;

$str

    return 1;
}

1;

_END_OF_CONFIG_

    $self->_move( file => $file, to => "$file~" ) if -f $file;

    my $fh = new FileHandle;
    $fh->open(">$file")
        or (error(loc("Could not open '%1' for writing: %2", $file, $!)),
            return );

    $fh->print($msg);
    $fh->close;

    return $file;
}

=pod

=head2 options( type => TYPE )

Returns a list of all valid config options given a specific type
(like for example C<conf> of C<program>) or false if the type does
not exist

=cut

sub options {
    my $self = shift;
    my $conf = $self->conf;
    my %hash = @_;

    my $type;
    my $tmpl = {
        type    => { required       => 1, default   => '',
                     strict_type    => 1, store     => \$type },
    };

    check($tmpl, \%hash) or return;

    my %seen;
    return sort grep { !$seen{$_}++ }
                map { $_->$type->ls_accessors if $_->can($type)  }
                $self->conf;
    return;
}

=pod

=head1 ACCESSORS

Accessors that start with a C<_> are marked private -- regular users
should never need to use these.

See the C<CPANPLUS::Config> documentation for what items can be
set and retrieved.

=head2 get_SOMETHING( ITEM, [ITEM, ITEM, ... ] );

The C<get_*> style accessors merely retrieves one or more desired
config options.

=head2 set_SOMETHING( ITEM => VAL, [ITEM => VAL, ITEM => VAL, ... ] );

The C<set_*> style accessors set the current value for one
or more config options and will return true upon success, false on
failure.

=head2 add_SOMETHING( ITEM => VAL, [ITEM => VAL, ITEM => VAL, ... ] );

The C<add_*> style accessor adds a new key to a config key.

Currently, the following accessors exist:

=over 4

=item set|get_conf

Simple configuration directives like verbosity and favourite shell.

=item set|get_program

Location of helper programs.

=item _set|_get_build

Locations of where to put what files for CPANPLUS.

=item _set|_get_source

Locations and names of source files locally.

=item _set|_get_mirror

Locations and names of source files remotely.

=item _set|_get_fetch

Special settings pertaining to the fetching of files.

=back

=cut

sub AUTOLOAD {
    my $self    = shift;
    my $conf    = $self->conf;

    my $name    = $AUTOLOAD;
    $name       =~ s/.+:://;

    my ($private, $action, $field) =
                $name =~ m/^(_)?((?:[gs]et|add))_([a-z]+)$/;

    my $type = '';
    $type .= '_'    if $private;
    $type .= $field if $field;

    my $type_code = $conf->can($type);
    unless ( $type_code ) {
        error( loc("Invalid method type: '%1'", $name) );
        return;
    }
    my $type_obj = $type_code->();

    unless( scalar @_ ) {
        error( loc("No arguments provided!") );
        return;
    }

    ### retrieve a current value for an existing key ###
    if( $action eq 'get' ) {
        for my $key (@_) {
            my @list = ();

            ### get it from the user config first
            if( my $code = $type_obj->can($key) ) {
                push @list, $code->();

            ### XXX EU::AI compatibility hack to provide lookups like in
            ### cpanplus 0.04x; we renamed ->_get_build('base') to
            ### ->get_conf('base')
            } elsif ( $type eq '_build' and $key eq 'base' ) {
                return $self->get_conf($key);

            } else {
                error( loc(q[No such key '%1' in field '%2'], $key, $type) );
                return;
            }

            return wantarray ? @list : $list[0];
        }

    ### set an existing key to a new value ###
    } elsif ( $action eq 'set' ) {
        my %args = @_;

        while( my($key,$val) = each %args ) {

            if( my $code = $type_obj->can($key) ) {
                $code->( $val );

            } else {
                error( loc(q[No such key '%1' in field '%2'], $key, $type) );
                return;
            }
        }

        return 1;

    ### add a new key to the config ###
    } elsif ( $action eq 'add' ) {
        my %args = @_;

        while( my($key,$val) = each %args ) {

            if( $type_obj->can($key) ) {
                error( loc( q[Key '%1' already exists for field '%2'],
                            $key, $type));
                return;
            } else {
                $type_obj->mk_accessors( $key );
                $type_obj->$key( $val );
            }
        }
        return 1;

    } else {

        error( loc(q[Unknown action '%1'], $action) );
        return;
    }
}

sub DESTROY { 1 };

1;

=pod

=head1 BUG REPORTS

Please report bugs or other issues to E<lt>bug-cpanplus@rt.cpan.org<gt>.

=head1 AUTHOR

This module by Jos Boumans E<lt>kane@cpan.orgE<gt>.

=head1 COPYRIGHT

The CPAN++ interface (of which this module is a part of) is copyright (c)
2001 - 2007, Jos Boumans E<lt>kane@cpan.orgE<gt>. All rights reserved.

This library is free software; you may redistribute and/or modify it
under the same terms as Perl itself.

=head1 SEE ALSO

L<CPANPLUS::Backend>, L<CPANPLUS::Configure::Setup>, L<CPANPLUS::Config>

=cut

# Local variables:
# c-indentation-style: bsd
# c-basic-offset: 4
# indent-tabs-mode: nil
# End:
# vim: expandtab shiftwidth=4:


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Server.DataConverter.Moves.V4 {
    public class Move {

        #region Properties

        public string Name { get; set; }

        public int MaxPP { get; set; }

        public Enums.MoveType EffectType { get; set; }

        public Enums.PokemonType Element { get; set; }

        public Enums.MoveCategory MoveCategory { get; set; }

        public Enums.MoveRange RangeType { get; set; }

        public int Range { get; set; }

        public Enums.MoveTarget TargetType { get; set; }

        public int Data1 { get; set; }

        public int Data2 { get; set; }

        public int Data3 { get; set; }

        public int Accuracy { get; set; }

        public int HitTime { get; set; }

        public int AdditionalEffectData1 { get; set; }

        public int AdditionalEffectData2 { get; set; }

        public int AdditionalEffectData3 { get; set; }

        public bool PerPlayer { get; set; }

        public int KeyItem { get; set; }

        public int Sound { get; set; }

        public MoveAnimation AttackerAnim { get; set; }

        public MoveAnimation TravelingAnim { get; set; }

        public MoveAnimation DefenderAnim { get; set; }

        #endregion Properties

        public Move() {
            AttackerAnim = new MoveAnimation();
            TravelingAnim = new MoveAnimation();
            DefenderAnim = new MoveAnimation();
        }
    }
}


text:
import React from 'react';
import { UISref } from '@uirouter/react';
import { UIRouterContext } from '@uirouter/react-hybrid';

import {
  Application,
  InstanceReader,
  InstanceWriter,
  RecentHistoryService,
  Spinner,
  ILoadBalancer,
} from '@spinnaker/core';

import { ICloudFoundryInstance } from 'cloudfoundry/domain';
import { CloudFoundryInstanceDetailsSection } from './sections';
import { CloudFoundryInstanceActions } from './CloudFoundryInstanceActions';
import { flattenDeep } from 'lodash';

interface InstanceFromStateParams {
  instanceId: string;
}

interface InstanceManager {
  account: string;
  region: string;
  category: string; // e.g., serverGroup, loadBalancer.
  name: string; // Parent resource name, not instance name.
  instances: ICloudFoundryInstance[];
}

interface ICloudFoundryInstanceDetailsState {
  instance?: ICloudFoundryInstance;
  instanceIdNotFound: string;
  loading: boolean;
}

interface ICloudFoundryInstanceDetailsProps {
  app: Application;
  instance: InstanceFromStateParams;
  instanceWriter: InstanceWriter;
  loading: boolean;
}

@UIRouterContext
export class CloudFoundryInstanceDetails extends React.Component<
  ICloudFoundryInstanceDetailsProps,
  ICloudFoundryInstanceDetailsState
> {
  constructor(props: ICloudFoundryInstanceDetailsProps) {
    super(props);

    this.state = {
      loading: true,
      instanceIdNotFound: props.instance.instanceId,
    };
  }

  public componentDidMount(): void {
    this.props.app.ready().then(() => this.retrieveInstance(this.props.instance));
  }

  private retrieveInstance(instanceFromParams: InstanceFromStateParams): void {
    const instanceLocatorPredicate = (dataSource: InstanceManager) => {
      return dataSource.instances.some(possibleMatch => possibleMatch.id === instanceFromParams.instanceId);
    };

    const dataSources: InstanceManager[] = flattenDeep([
      this.props.app.getDataSource('serverGroups').data,
      this.props.app.getDataSource('loadBalancers').data,
      this.props.app
        .getDataSource('loadBalancers')
        .data.map((loadBalancer: ILoadBalancer) => loadBalancer.serverGroups),
    ]);

    const instanceManager = dataSources.find(instanceLocatorPredicate);

    if (instanceManager) {
      const recentHistoryExtraData: { [key: string]: string } = {
        region: instanceManager.region,
        account: instanceManager.account,
      };
      if (instanceManager.category === 'serverGroup') {
        recentHistoryExtraData.serverGroup = instanceManager.name;
      }
      RecentHistoryService.addExtraDataToLatest('instances', recentHistoryExtraData);
      InstanceReader.getInstanceDetails(instanceManager.account, instanceManager.region, instanceFromParams.instanceId)
        .then((instanceDetails: ICloudFoundryInstance) => {
          instanceDetails.account = instanceManager.account;
          instanceDetails.region = instanceManager.region;
          return instanceDetails;
        })
        .then(instance => {
          this.setState({
            instance,
            loading: false,
          });
        });
    }
  }

  public render(): JSX.Element {
    const { app, instanceWriter } = this.props;
    const { instance, instanceIdNotFound, loading } = this.state;
    const CloseButton = (

        <UISref to="^">

        </UISref>

    );
    const loadingHeader = () => (

        {CloseButton}

          <Spinner size="small" />

    );
    const notFoundHeader = () => (

        {CloseButton}

{instanceIdNotFound}

    );
    const instanceHeader = () => (

        {CloseButton}

{instance.name}

        <CloudFoundryInstanceActions application={app} instance={instance} instanceWriter={instanceWriter} />

    );
    const notFoundContent = () => (

Instance not found.

    );
    const instanceContent = () => (

        <CloudFoundryInstanceDetailsSection instance={instance} />

    );
    return (

        {loading && loadingHeader()}
        {!loading && instance && instanceHeader()}
        {!loading && instance && instanceContent()}
        {!loading && !instance && notFoundHeader()}
        {!loading && !instance && notFoundContent()}

    );
  }
}


text:
package com.google.cloud.apigeeregistry.v1.samples;

// [START apigeeregistry_v1_generated_Provisioning_CreateInstance_StringInstanceString_sync]
import com.google.cloud.apigeeregistry.v1.Instance;
import com.google.cloud.apigeeregistry.v1.LocationName;
import com.google.cloud.apigeeregistry.v1.ProvisioningClient;

public class SyncCreateInstanceStringInstanceString {

  public static void main(String[] args) throws Exception {
    syncCreateInstanceStringInstanceString();
  }

  public static void syncCreateInstanceStringInstanceString() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (ProvisioningClient provisioningClient = ProvisioningClient.create()) {
      String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
      Instance instance = Instance.newBuilder().build();
      String instanceId = "instanceId902024336";
      Instance response =
          provisioningClient.createInstanceAsync(parent, instance, instanceId).get();
    }
  }
}
// [END apigeeregistry_v1_generated_Provisioning_CreateInstance_StringInstanceString_sync]


text:
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import '../styles/index.less';

import { Demo } from './Demo';
import './demo.less';

const APP_ELEMENT = document.getElementById('app')!;
const render = (Component: React.ComponentClass<any>) => {
  ReactDOM.render(
    <AppContainer>
      <Component/>
    </AppContainer>,
    APP_ELEMENT,
  );
};

render(Demo);

declare var module: any;
if (module.hot) {
  module.hot.accept('./Demo', () => {
    render(require('./Demo').Demo);
  });
}


text:
/*
 * Copyright 2001-2004 The Apache Software Foundation.
 *
 * 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.
 */
/*
 * $Id: NodeSortRecordFactory.java,v 1.2.4.1 2005/09/06 09:53:40 pvedula Exp $
 */

package com.sun.org.apache.xalan.internal.xsltc.dom;

import com.sun.org.apache.xalan.internal.xsltc.DOM;
import com.sun.org.apache.xalan.internal.xsltc.Translet;
import com.sun.org.apache.xalan.internal.xsltc.TransletException;
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
import com.sun.org.apache.xml.internal.utils.LocaleUtility;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import java.util.Locale;
import java.text.Collator;

public class NodeSortRecordFactory {

    private static int DESCENDING = "descending".length();
    private static int NUMBER     = "number".length();

    private final DOM      _dom;
    private final String   _className;
    private Class _class;
    private SortSettings _sortSettings;

    /**
     *
     */
    protected Collator _collator;

    /**
     * Creates a NodeSortRecord producing object. The DOM specifies which tree
     * to get the nodes to sort from, the class name specifies what auxillary
     * class to use to sort the nodes (this class is generated by the Sort
     * class), and the translet parameter is needed for methods called by
     * this object.
     *
     * @deprecated This constructor is no longer used in generated code.  It
     *             exists only for backwards compatibility.
     */
     public NodeSortRecordFactory(DOM dom, String className, Translet translet,
                 String order[], String type[])
         throws TransletException
     {
         this(dom, className, translet, order, type, null, null);
     }

    /**
     * Creates a NodeSortRecord producing object. The DOM specifies which tree
     * to get the nodes to sort from, the class name specifies what auxillary
     * class to use to sort the nodes (this class is generated by the Sort
     * class), and the translet parameter is needed for methods called by
     * this object.
     */
     public NodeSortRecordFactory(DOM dom, String className, Translet translet,
                 String order[], String type[], String lang[],
                 String caseOrder[])
         throws TransletException
     {
         try {
             _dom = dom;
             _className = className;
             // This should return a Class definition if using TrAX
             _class = translet.getAuxiliaryClass(className);
             // This code is only run when the native API is used
             if (_class == null) {
                 _class = ObjectFactory.findProviderClass(className, true);
             }

             int levels = order.length;
             int[] iOrder = new int[levels];
             int[] iType = new int[levels];
             for (int i = 0; i < levels; i++) {
                  if (order[i].length() == DESCENDING) {
                      iOrder[i] = NodeSortRecord.COMPARE_DESCENDING;
                  }
                  if (type[i].length() == NUMBER) {
                      iType[i] = NodeSortRecord.COMPARE_NUMERIC;
                  }
             }

             // Old NodeSortRecordFactory constructor had no lang or case_order
             // arguments.  Provide default values in that case for binary
             // compatibility.
             String[] emptyStringArray = null;
             if (lang == null || caseOrder == null) {
                 int numSortKeys = order.length;
                 emptyStringArray = new String[numSortKeys];

                 // Set up array of zero-length strings as default values
                 // of lang and case_order
                 for (int i = 0; i < numSortKeys; i++) {
                     emptyStringArray[i] = "";
                 }
             }

             if (lang == null) {
                 lang = emptyStringArray;
             }
             if (caseOrder == null) {
                 caseOrder = emptyStringArray;
             }

             final int length = lang.length;
             Locale[] locales = new Locale[length];
             Collator[] collators = new Collator[length];
             for (int i = 0; i< length; i++){
                 locales[i] = LocaleUtility.langToLocale(lang[i]);
                 collators[i] = Collator.getInstance(locales[i]);
             }

             _sortSettings = new SortSettings((AbstractTranslet) translet,
                                              iOrder, iType, locales, collators,
                                              caseOrder);
        } catch (ClassNotFoundException e) {
            throw new TransletException(e);
        }
    }

    /**
     * Create an instance of a sub-class of NodeSortRecord. The name of this
     * sub-class is passed to us in the constructor.
     */
    public NodeSortRecord makeNodeSortRecord(int node, int last)
        throws ExceptionInInitializerError,
               LinkageError,
               IllegalAccessException,
               InstantiationException,
               SecurityException,
               TransletException {

        final NodeSortRecord sortRecord =
            (NodeSortRecord)_class.newInstance();
        sortRecord.initialize(node, last, _dom, _sortSettings);
        return sortRecord;
    }

    public String getClassName() {
        return _className;
    }

   private final void setLang(final String lang[]){

    }
}


text:
package org.hl7.v3;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for COCT_MT510000UV06.PolicyOrProgram complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="COCT_MT510000UV06.PolicyOrProgram">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <group ref="{urn:hl7-org:v3}InfrastructureRootElements"/>
 *         <element name="id" type="{urn:hl7-org:v3}II" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="code" type="{urn:hl7-org:v3}CD"/>
 *         <element name="statusCode" type="{urn:hl7-org:v3}CS" minOccurs="0"/>
 *         <element name="effectiveTime" type="{urn:hl7-org:v3}IVL_TS" minOccurs="0"/>
 *         <element name="confidentialityCode" type="{urn:hl7-org:v3}CE" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="coveredParty" type="{urn:hl7-org:v3}COCT_MT510000UV06.CoveredParty2"/>
 *         <element name="holder" type="{urn:hl7-org:v3}COCT_MT510000UV06.Holder" minOccurs="0"/>
 *         <element name="responsibleParty" type="{urn:hl7-org:v3}COCT_MT510000UV06.ResponsibleParty2" minOccurs="0"/>
 *         <element name="primaryPerformer" type="{urn:hl7-org:v3}COCT_MT510000UV06.PrimaryPerformer" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="author" type="{urn:hl7-org:v3}COCT_MT510000UV06.Author2" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="definition" type="{urn:hl7-org:v3}COCT_MT510000UV06.Definition3" minOccurs="0"/>
 *         <element name="replacementOf" type="{urn:hl7-org:v3}COCT_MT510000UV06.ReplacementOf" minOccurs="0"/>
 *         <element name="limitation1" type="{urn:hl7-org:v3}COCT_MT510000UV06.Limitation3" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="limitation2" type="{urn:hl7-org:v3}COCT_MT510000UV06.Limitation" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="coverageOf" type="{urn:hl7-org:v3}COCT_MT510000UV06.Coverage2" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *       <attGroup ref="{urn:hl7-org:v3}InfrastructureRootAttributes"/>
 *       <attribute name="nullFlavor" type="{urn:hl7-org:v3}NullFlavor" />
 *       <attribute name="classCode" use="required" type="{urn:hl7-org:v3}ActClass" fixed="COV" />
 *       <attribute name="moodCode" use="required" type="{urn:hl7-org:v3}ActMood" fixed="EVN" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "COCT_MT510000UV06.PolicyOrProgram", propOrder = {
    "realmCode",
    "typeId",
    "templateId",
    "id",
    "code",
    "statusCode",
    "effectiveTime",
    "confidentialityCode",
    "coveredParty",
    "holder",
    "responsibleParty",
    "primaryPerformer",
    "author",
    "definition",
    "replacementOf",
    "limitation1",
    "limitation2",
    "coverageOf"
})
public class COCTMT510000UV06PolicyOrProgram {

    protected List<CS> realmCode;
    protected II typeId;
    protected List<II> templateId;
    protected List<II> id;
    @XmlElement(required = true)
    protected CD code;
    protected CS statusCode;
    protected IVLTS effectiveTime;
    protected List<CE> confidentialityCode;
    @XmlElement(required = true, nillable = true)
    protected COCTMT510000UV06CoveredParty2 coveredParty;
    @XmlElementRef(name = "holder", namespace = "urn:hl7-org:v3", type = JAXBElement.class, required = false)
    protected JAXBElement<COCTMT510000UV06Holder> holder;
    @XmlElementRef(name = "responsibleParty", namespace = "urn:hl7-org:v3", type = JAXBElement.class, required = false)
    protected JAXBElement<COCTMT510000UV06ResponsibleParty2> responsibleParty;
    @XmlElement(nillable = true)
    protected List<COCTMT510000UV06PrimaryPerformer> primaryPerformer;
    @XmlElement(nillable = true)
    protected List<COCTMT510000UV06Author2> author;
    @XmlElementRef(name = "definition", namespace = "urn:hl7-org:v3", type = JAXBElement.class, required = false)
    protected JAXBElement<COCTMT510000UV06Definition3> definition;
    @XmlElementRef(name = "replacementOf", namespace = "urn:hl7-org:v3", type = JAXBElement.class, required = false)
    protected JAXBElement<COCTMT510000UV06ReplacementOf> replacementOf;
    @XmlElement(nillable = true)
    protected List<COCTMT510000UV06Limitation3> limitation1;
    @XmlElement(nillable = true)
    protected List<COCTMT510000UV06Limitation> limitation2;
    @XmlElement(nillable = true)
    protected List<COCTMT510000UV06Coverage2> coverageOf;
    @XmlAttribute(name = "nullFlavor")
    protected List<String> nullFlavor;
    @XmlAttribute(name = "classCode", required = true)
    protected List<String> classCode;
    @XmlAttribute(name = "moodCode", required = true)
    protected List<String> moodCode;

    /**
     * Gets the value of the realmCode property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the realmCode property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getRealmCode().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link CS }
     *
     *
     */
    public List<CS> getRealmCode() {
        if (realmCode == null) {
            realmCode = new ArrayList<CS>();
        }
        return this.realmCode;
    }

    /**
     * Gets the value of the typeId property.
     *
     * @return
     *     possible object is
     *     {@link II }
     *
     */
    public II getTypeId() {
        return typeId;
    }

    /**
     * Sets the value of the typeId property.
     *
     * @param value
     *     allowed object is
     *     {@link II }
     *
     */
    public void setTypeId(II value) {
        this.typeId = value;
    }

    /**
     * Gets the value of the templateId property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the templateId property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getTemplateId().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link II }
     *
     *
     */
    public List<II> getTemplateId() {
        if (templateId == null) {
            templateId = new ArrayList<II>();
        }
        return this.templateId;
    }

    /**
     * Gets the value of the id property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the id property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getId().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link II }
     *
     *
     */
    public List<II> getId() {
        if (id == null) {
            id = new ArrayList<II>();
        }
        return this.id;
    }

    /**
     * Gets the value of the code property.
     *
     * @return
     *     possible object is
     *     {@link CD }
     *
     */
    public CD getCode() {
        return code;
    }

    /**
     * Sets the value of the code property.
     *
     * @param value
     *     allowed object is
     *     {@link CD }
     *
     */
    public void setCode(CD value) {
        this.code = value;
    }

    /**
     * Gets the value of the statusCode property.
     *
     * @return
     *     possible object is
     *     {@link CS }
     *
     */
    public CS getStatusCode() {
        return statusCode;
    }

    /**
     * Sets the value of the statusCode property.
     *
     * @param value
     *     allowed object is
     *     {@link CS }
     *
     */
    public void setStatusCode(CS value) {
        this.statusCode = value;
    }

    /**
     * Gets the value of the effectiveTime property.
     *
     * @return
     *     possible object is
     *     {@link IVLTS }
     *
     */
    public IVLTS getEffectiveTime() {
        return effectiveTime;
    }

    /**
     * Sets the value of the effectiveTime property.
     *
     * @param value
     *     allowed object is
     *     {@link IVLTS }
     *
     */
    public void setEffectiveTime(IVLTS value) {
        this.effectiveTime = value;
    }

    /**
     * Gets the value of the confidentialityCode property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the confidentialityCode property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getConfidentialityCode().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link CE }
     *
     *
     */
    public List<CE> getConfidentialityCode() {
        if (confidentialityCode == null) {
            confidentialityCode = new ArrayList<CE>();
        }
        return this.confidentialityCode;
    }

    /**
     * Gets the value of the coveredParty property.
     *
     * @return
     *     possible object is
     *     {@link COCTMT510000UV06CoveredParty2 }
     *
     */
    public COCTMT510000UV06CoveredParty2 getCoveredParty() {
        return coveredParty;
    }

    /**
     * Sets the value of the coveredParty property.
     *
     * @param value
     *     allowed object is
     *     {@link COCTMT510000UV06CoveredParty2 }
     *
     */
    public void setCoveredParty(COCTMT510000UV06CoveredParty2 value) {
        this.coveredParty = value;
    }

    /**
     * Gets the value of the holder property.
     *
     * @return
     *     possible object is
     *     {@link JAXBElement }{@code <}{@link COCTMT510000UV06Holder }{@code >}
     *
     */
    public JAXBElement<COCTMT510000UV06Holder> getHolder() {
        return holder;
    }

    /**
     * Sets the value of the holder property.
     *
     * @param value
     *     allowed object is
     *     {@link JAXBElement }{@code <}{@link COCTMT510000UV06Holder }{@code >}
     *
     */
    public void setHolder(JAXBElement<COCTMT510000UV06Holder> value) {
        this.holder = value;
    }

    /**
     * Gets the value of the responsibleParty property.
     *
     * @return
     *     possible object is
     *     {@link JAXBElement }{@code <}{@link COCTMT510000UV06ResponsibleParty2 }{@code >}
     *
     */
    public JAXBElement<COCTMT510000UV06ResponsibleParty2> getResponsibleParty() {
        return responsibleParty;
    }

    /**
     * Sets the value of the responsibleParty property.
     *
     * @param value
     *     allowed object is
     *     {@link JAXBElement }{@code <}{@link COCTMT510000UV06ResponsibleParty2 }{@code >}
     *
     */
    public void setResponsibleParty(JAXBElement<COCTMT510000UV06ResponsibleParty2> value) {
        this.responsibleParty = value;
    }

    /**
     * Gets the value of the primaryPerformer property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the primaryPerformer property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getPrimaryPerformer().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link COCTMT510000UV06PrimaryPerformer }
     *
     *
     */
    public List<COCTMT510000UV06PrimaryPerformer> getPrimaryPerformer() {
        if (primaryPerformer == null) {
            primaryPerformer = new ArrayList<COCTMT510000UV06PrimaryPerformer>();
        }
        return this.primaryPerformer;
    }

    /**
     * Gets the value of the author property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the author property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getAuthor().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link COCTMT510000UV06Author2 }
     *
     *
     */
    public List<COCTMT510000UV06Author2> getAuthor() {
        if (author == null) {
            author = new ArrayList<COCTMT510000UV06Author2>();
        }
        return this.author;
    }

    /**
     * Gets the value of the definition property.
     *
     * @return
     *     possible object is
     *     {@link JAXBElement }{@code <}{@link COCTMT510000UV06Definition3 }{@code >}
     *
     */
    public JAXBElement<COCTMT510000UV06Definition3> getDefinition() {
        return definition;
    }

    /**
     * Sets the value of the definition property.
     *
     * @param value
     *     allowed object is
     *     {@link JAXBElement }{@code <}{@link COCTMT510000UV06Definition3 }{@code >}
     *
     */
    public void setDefinition(JAXBElement<COCTMT510000UV06Definition3> value) {
        this.definition = value;
    }

    /**
     * Gets the value of the replacementOf property.
     *
     * @return
     *     possible object is
     *     {@link JAXBElement }{@code <}{@link COCTMT510000UV06ReplacementOf }{@code >}
     *
     */
    public JAXBElement<COCTMT510000UV06ReplacementOf> getReplacementOf() {
        return replacementOf;
    }

    /**
     * Sets the value of the replacementOf property.
     *
     * @param value
     *     allowed object is
     *     {@link JAXBElement }{@code <}{@link COCTMT510000UV06ReplacementOf }{@code >}
     *
     */
    public void setReplacementOf(JAXBElement<COCTMT510000UV06ReplacementOf> value) {
        this.replacementOf = value;
    }

    /**
     * Gets the value of the limitation1 property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the limitation1 property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getLimitation1().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link COCTMT510000UV06Limitation3 }
     *
     *
     */
    public List<COCTMT510000UV06Limitation3> getLimitation1() {
        if (limitation1 == null) {
            limitation1 = new ArrayList<COCTMT510000UV06Limitation3>();
        }
        return this.limitation1;
    }

    /**
     * Gets the value of the limitation2 property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the limitation2 property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getLimitation2().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link COCTMT510000UV06Limitation }
     *
     *
     */
    public List<COCTMT510000UV06Limitation> getLimitation2() {
        if (limitation2 == null) {
            limitation2 = new ArrayList<COCTMT510000UV06Limitation>();
        }
        return this.limitation2;
    }

    /**
     * Gets the value of the coverageOf property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the coverageOf property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getCoverageOf().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link COCTMT510000UV06Coverage2 }
     *
     *
     */
    public List<COCTMT510000UV06Coverage2> getCoverageOf() {
        if (coverageOf == null) {
            coverageOf = new ArrayList<COCTMT510000UV06Coverage2>();
        }
        return this.coverageOf;
    }

    /**
     * Gets the value of the nullFlavor property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the nullFlavor property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getNullFlavor().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link String }
     *
     *
     */
    public List<String> getNullFlavor() {
        if (nullFlavor == null) {
            nullFlavor = new ArrayList<String>();
        }
        return this.nullFlavor;
    }

    /**
     * Gets the value of the classCode property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the classCode property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getClassCode().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link String }
     *
     *
     */
    public List<String> getClassCode() {
        if (classCode == null) {
            classCode = new ArrayList<String>();
        }
        return this.classCode;
    }

    /**
     * Gets the value of the moodCode property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the moodCode property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getMoodCode().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link String }
     *
     *
     */
    public List<String> getMoodCode() {
        if (moodCode == null) {
            moodCode = new ArrayList<String>();
        }
        return this.moodCode;
    }

}


text:
<?php _wpsc_admin_html_begin(); ?>
<title><?php esc_html_e( 'Manage Product Variations', 'wpsc' ); ?></title>

<?php
	do_action('admin_enqueue_scripts', $hook_suffix);
	do_action("admin_print_styles-$hook_suffix");
	do_action('admin_print_styles');
	do_action("admin_print_scripts-$hook_suffix");
	do_action('admin_print_scripts');
	do_action("admin_head-$hook_suffix");
	do_action('admin_head');
?>

<?php

$admin_body_class = ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );

?>
<body class="no-js wp-admin wp-core-ui wpsc-product-variation-iframe<?php echo $admin_body_class; ?>">

		<?php $this->display_tabs(); ?>

			<?php $this->display_current_tab(); ?>

<?php
do_action('admin_print_footer_scripts');
do_action("admin_footer-" . $GLOBALS['hook_suffix']);
?>


text:
<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\ArrayHelper;
use app\models\Curriculum;

/* @var $this yii\web\View */
/* @var $model app\models\Student */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php
        $modelos_educativos = array("MEFI", "MEyA");
     ?>

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'first_name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'last_name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'student_id')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'model')->radioList($modelos_educativos) ?>

    <?= $form->field($model, 'curriculum_id')->radioList(
        ArrayHelper::map(Curriculum::find()->all(), 'id', 'name'))
    ?>

    <?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>

        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

    <?php ActiveForm::end(); ?>