text:
<?php

	namespace database\modules;

	use database\crud\RParticipantAffiliates;

	/**
	*
	*	RParticipantAffiliatesInfo
	*
	* Provides High level features for interacting with the RParticipantAffiliates;
	*
	* This source code is auto-generated
    *
    * @author Victor Mwenda
    * Email : vmwenda.vm@gmail.com
    * Phone : +254(0)718034449
	*/
	class RParticipantAffiliatesInfo{

	private $build;
	private $client;
	private $action;
	private $r_participant_affiliates;
	private $table = 'r_participant_affiliates';
	/**
	 * RParticipantAffiliatesInfo
	 *
	 * Class to get all the r_participant_affiliates Information from the r_participant_affiliates table
	 * @param String $action
	 * @param String $client
	 * @param String $build
	 *
	 * @author Victor Mwenda
	 * Email : vmwenda.vm@gmail.com
	 * Phone : +254718034449
	 */
	public function __construct($action = "query", $client = "mobile-android",$build="user-build") {

		$this->client = $client;
		$this->action = $action;
		$this->build = $build;

		$this->r_participant_affiliates = new RParticipantAffiliates( $action, $client );

	}

		/**
	* Inserts data into the table[r_participant_affiliates] in the order below
	* array ('aff_id','affiliate')
	* is mappped into
	* array ($aff_id,$affiliate)
	* @return 1 if data was inserted,0 otherwise
	* if redundancy check is true, it inserts if the record if it never existed else.
	* if the record exists, it returns the number of times the record exists on the relation
	*/
	public function insert($aff_id,$affiliate,$redundancy_check= false, $printSQL = false) {
		$columns = array('aff_id','affiliate');
		$records = array($aff_id,$affiliate);
		return $this->r_participant_affiliates->insert_prepared_records($aff_id,$affiliate,$redundancy_check,$printSQL );
	}

 	/**
     * @param $distinct
     * @param string $extraSQL
     * @return string
     */
	public function query($distinct,$extraSQL=""){

		$columns = $records = array ();
		$queried_r_participant_affiliates = $this->r_participant_affiliates->fetch_assoc_in_r_participant_affiliates ($distinct, $columns, $records,$extraSQL );

		if($this->build == "eng-build"){
			return $this->query_eng_build($queried_r_participant_affiliates);
		}
		if($this->build == "user-build"){
			return $this->query_user_build($queried_r_participant_affiliates);
		}
	}
/**
     * Inserts records in a relation
     * The records are inserted in the relation columns in the order they are arranged in the array
     *
     * @param $records
     * @param bool $printSQL
     * @return bool|mysqli_result
     * @throws NullabilityException
     */
    public function insert_raw($records, $printSQL = false)
    {
        return $this->r_participant_affiliates->insert_raw($records, $printSQL);
    }

    /**
     * Inserts records in a relation
     * The records are matched alongside the columns in the relation
         * @param array $columns
         * @param array $records
         * @param bool $redundancy_check
         * @param bool $printSQL
         * @return mixed
         */
        public function insert_records_to_r_participant_affiliates(Array $columns, Array $records,$redundancy_check = false, $printSQL = false){
            return $this->r_participant_affiliates->insert_records_to_r_participant_affiliates($columns, $records,$redundancy_check,$printSQL);
        }

     /**
        * Performs a raw Query
        * @param $sql string sql to execute
        * @return string sql results
        * @throws \app\libs\marvik\libs\database\core\mysql\NullabilityException
        */
	public function rawQuery($sql){

		$queried_r_participant_affiliates = $this->r_participant_affiliates->get_database_utils()->rawQuery($sql);

		if($this->build == "eng-build"){
			return $this->query_eng_build($queried_r_participant_affiliates);
		}
		if($this->build == "user-build"){
			return $this->query_user_build($queried_r_participant_affiliates);
		}
	}

	public function query_eng_build($queried_r_participant_affiliates){
		if($this->client == "web-desktop"){
			return $this->export_query_html($queried_r_participant_affiliates);
		}
		if($this->client == "mobile-android"){
			return $this->export_query_json($queried_r_participant_affiliates);
		}
	}
	public function query_user_build($queried_r_participant_affiliates){
		if($this->client == "web-desktop"){
			return $this->export_query_html($queried_r_participant_affiliates);
		}
		if($this->client == "mobile-android"){
			return $this->export_query_json($queried_r_participant_affiliates);
		}
	}
	public function export_query_json($queried_r_participant_affiliates){
		$query_json = json_encode($queried_r_participant_affiliates);
		return $query_json;
	}
	public function export_query_html($queried_r_participant_affiliates){
		$query_html = "";
		foreach ( $queried_r_participant_affiliates as $r_participant_affiliates_row_items ) {
			$query_html .= $this->process_query_for_html_export ( $r_participant_affiliates_row_items );
		}
		return $query_html;
	}

	private function process_query_for_html_export ( $r_participant_affiliates_row_items ){
		$html_export ='

'  .$this->table.  '
';

		$aff_id = $r_participant_affiliates_row_items ['aff_id'];
	if ($aff_id  != null) {
	$html_export .= $this->parseHtmlExport ( 'aff_id', $aff_id  );
}
$affiliate = $r_participant_affiliates_row_items ['affiliate'];
	if ($affiliate  != null) {
	$html_export .= $this->parseHtmlExport ( 'affiliate', $affiliate  );
}

		return $html_export .='
';
	}

	private function parseHtmlExport($title,$message){
		return '

' . $title . '

' . $message . '

';
	}
} ?>


text:
import random

def get_int(msg, minimum, default):
    while True:
        try:
            line = input(msg)
            if not line and default is not None:
                return default
            i = int(line)
            if i < minimum:
                print("must be >=", minimum)
            else:
                return i
        except ValueError as err:
            print(err)

rows = get_int("rows: ", 1, None)
columns = get_int("columns: ", 1, None)
minimum = get_int("minimum (or Enter for 0): ", -1000000, 0)

default = 1000
if default < minimum:
    default = 2 * minimum
maximum = get_int("maximum (or Enter for " + str(default) + "): ",
                  minimum, default)

row = 0
while row < rows:
    line = ""
    column = 0
    while column < columns:
        i = random.randint(minimum, maximum)
        s = str(i)
        while len(s) < 10:
            s = " " + s
        line += s
        column += 1
    print(line)
    row += 1

redpajama_set_name: RedPajamaGithub


text:
package org.pathwayeditor.notations.sbgnpd.export.biopepa;

import java.io.File;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.pathwayeditor.businessobjects.drawingprimitives.IDrawingNode;
import org.pathwayeditor.businessobjects.drawingprimitives.ILinkEdge;
import org.pathwayeditor.businessobjects.drawingprimitives.ILinkEdgeFactory;
import org.pathwayeditor.businessobjects.drawingprimitives.IModel;
import org.pathwayeditor.businessobjects.drawingprimitives.IRootNode;
import org.pathwayeditor.businessobjects.drawingprimitives.IShapeNode;
import org.pathwayeditor.businessobjects.drawingprimitives.IShapeNodeFactory;
import org.pathwayeditor.businessobjects.drawingprimitives.properties.IAnnotatedObject;
import org.pathwayeditor.businessobjects.drawingprimitives.properties.IIntegerAnnotationProperty;
import org.pathwayeditor.businessobjects.drawingprimitives.properties.IPlainTextAnnotationProperty;
import org.pathwayeditor.businessobjects.impl.facades.LinkEdgeFactoryFacade;
import org.pathwayeditor.businessobjects.impl.facades.RootNodeFacade;
import org.pathwayeditor.businessobjects.impl.facades.ShapeNodeFactoryFacade;
import org.pathwayeditor.businessobjects.management.IModelFactory;
import org.pathwayeditor.businessobjects.management.ModelFactory;
import org.pathwayeditor.businessobjects.notationsubsystem.ExportServiceException;
import org.pathwayeditor.businessobjects.typedefn.IShapeObjectType;
import org.pathwayeditor.notations.sbgnpd.export.sbgntext.SbgnTextExportController;
import org.pathwayeditor.notations.sbgnpd.services.SbgnPdNotationSubsystem;
import org.pathwayeditor.notations.sbgnpd.services.SbgnPdNotationSyntaxService;
import org.pathwayeditor.notationsubsystem.toolkit.definition.LinkObjectType;

public class BioPepaExportControllerTest {
	private static final String CANVAS_NAME = "testCanvas";
	private static final String EPN_COUNT_PROP_NAME = "entityCount";
	private static final String RATE_FWD_EQN_PROP_NAME = "fwdRate";
	private static final String RATE_REV_EQN_PROP_NAME = "revRate";

	private SbgnTextExportController testInstance;
	private File testFile;

	private IModel createTestCanvas(){
		SbgnPdNotationSubsystem sbgnSubsystem = new SbgnPdNotationSubsystem();
		SbgnPdNotationSyntaxService sbgnSyntax = sbgnSubsystem.getSyntaxService();
		IModelFactory canvasFact = new ModelFactory();
		canvasFact.setNotationSubsystem(sbgnSubsystem);
		canvasFact.setName(CANVAS_NAME);
		IModel canvas = canvasFact.createModel();
		IRootNode root = new RootNodeFacade(canvas.getGraph().getRoot());
		IShapeNode cmpt = createShapeNode(root, sbgnSyntax.getCompartment());
		IShapeNode mm1 = createShapeNode(cmpt, sbgnSyntax.getMacromolecule());
		setIntegerProperty(mm1.getAttribute(), EPN_COUNT_PROP_NAME, 100);
		createShapeNode(mm1, sbgnSyntax.getState());
		createShapeNode(mm1, sbgnSyntax.getUnitOfInf());
		IShapeNode mm2 = createShapeNode(cmpt, sbgnSyntax.getMacromolecule());
		setIntegerProperty(mm2.getAttribute(), EPN_COUNT_PROP_NAME, 1000);
		IShapeNode na = createShapeNode(cmpt, sbgnSyntax.getGeneticUnit());
		setIntegerProperty(na.getAttribute(), EPN_COUNT_PROP_NAME, 10000);
		createShapeNode(na, sbgnSyntax.getState());
		createShapeNode(na, sbgnSyntax.getState());
		IShapeNode process = createShapeNode(cmpt, sbgnSyntax.getProcess());
		setTextProperty(process.getAttribute(), RATE_FWD_EQN_PROP_NAME, "1 * 5");
		setTextProperty(process.getAttribute(), RATE_REV_EQN_PROP_NAME, "");
		createLinkEdge(mm1, process, sbgnSyntax.getConsumption());
		createLinkEdge(process, na, sbgnSyntax.getProduction());
		createLinkEdge(mm2, process, sbgnSyntax.getModulation());

		return canvas;
	}

	private void setIntegerProperty(IAnnotatedObject obj, String name, int value){
		IIntegerAnnotationProperty prop = (IIntegerAnnotationProperty)obj.getProperty(name);
		prop.setValue(value);
	}

	private void setTextProperty(IAnnotatedObject obj, String name, String value){
		IPlainTextAnnotationProperty prop = (IPlainTextAnnotationProperty)obj.getProperty(name);
		prop.setValue(value);
	}

	private static ILinkEdge createLinkEdge(IShapeNode source, IShapeNode target, LinkObjectType type) {
		ILinkEdgeFactory linkFact = new LinkEdgeFactoryFacade(source.getGraphElement().getGraph().edgeFactory());
		linkFact.setShapeNodePair(source, target);
		linkFact.setObjectType(type);
		return linkFact.createLinkEdge();
	}

	private static IShapeNode createShapeNode(IDrawingNode parent, IShapeObjectType objectType){
		IShapeNodeFactory shapeFact = new ShapeNodeFactoryFacade(parent.getGraphElement().getChildCompoundGraph().nodeFactory());
		shapeFact.setObjectType(objectType);
		IShapeNode cmpt = shapeFact.createShapeNode();
		return cmpt;
	}

	@Before
	public void setUp() throws Exception {
		this.testInstance = new SbgnTextExportController();
		this.testFile = File.createTempFile("foo", "txt");
		this.testInstance.setExportFile(testFile);
		IModel canvasToExport = createTestCanvas();
		this.testInstance.setCanvasToExport(canvasToExport);
	}

	@After
	public void tearDown() throws Exception {
		this.testInstance = null;
		if(this.testFile != null){
//			this.testFile.delete();
		}
		this.testFile = null;
	}

	@Test
	public void testWriteCanvas() throws ExportServiceException{
		this.testInstance.exportFile();
		System.out.println("Test file=" + this.testFile.getPath());
	}
}


text:
package springfox.documentation.builders;

import springfox.documentation.service.Representation;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;

public class RepresentationBuilder {
  private org.springframework.http.MediaType mediaType;
  private ModelSpecificationBuilder modelBuilder;
  private final Map<String, EncodingBuilder> encodings = new HashMap<>();

  private ModelSpecificationBuilder modelSpecificationBuilder() {
    if (modelBuilder == null) {
      this.modelBuilder = new ModelSpecificationBuilder();
    }
    return modelBuilder;
  }

  public RepresentationBuilder model(Consumer<ModelSpecificationBuilder> model) {
    model.accept(modelSpecificationBuilder());
    return this;
  }

  public RepresentationBuilder mediaType(String mediaType) {
    this.mediaType = org.springframework.http.MediaType.parseMediaType(mediaType);
    return this;
  }

  public RepresentationBuilder mediaType(org.springframework.http.MediaType mediaType) {
    this.mediaType = mediaType;
    return this;
  }

  public RepresentationBuilder clearEncodings() {
    this.encodings.clear();
    return this;
  }

  private EncodingBuilder encodingForProperty(String property) {
    return this.encodings.computeIfAbsent(
        property,
        p -> new EncodingBuilder()
            .propertyRef(p));
  }

  public Function<Consumer<EncodingBuilder>, RepresentationBuilder> encoding(String property) {
    return encoding -> {
      encoding.accept(encodingForProperty(property));
      return this;
    };
  }

  public Representation build() {
    return new Representation(
        mediaType,
        modelBuilder.build(),
        encodings.values()
            .stream()
            .map(EncodingBuilder::build)
            .filter(Objects::nonNull)
            .collect(Collectors.toSet()));
  }

  public RepresentationBuilder copyOf(Representation other) {
    if (other != null) {
      other.getEncodings().forEach(e -> this.encoding(e.getPropertyRef())
          .apply(encoding -> encoding.copyOf(e)));
      this.mediaType(other.getMediaType())
          .model(m -> m.copyOf(other.getModel()));
    }
    return this;
  }
}


text:
using System;
using System.Diagnostics;
using Gibraltar.Messaging;
using Gibraltar.Serialization;
#pragma warning disable 1591

namespace Gibraltar.Monitor.Serialization
{
    public abstract class GibraltarCachedPacket : ICachedMessengerPacket, IEquatable<GibraltarCachedPacket>
    {
        private long m_Sequence;
        private DateTimeOffset m_TimeStamp;
        private Guid m_ID;
        private bool m_IsHeader;

        protected GibraltarCachedPacket(Guid packetID, bool isHeader)
        {
            ID = packetID;
            m_IsHeader = isHeader;
        }

        protected GibraltarCachedPacket(bool isHeader)
        {
            ID = Guid.NewGuid();
            m_IsHeader = isHeader;
        }

        /// <summary>
        /// The increasing sequence number of all packets for this session to be used as an absolute order sort.
        /// </summary>
        public long Sequence { get { return m_Sequence; } set { m_Sequence = value; } }

        public DateTimeOffset Timestamp { get { return m_TimeStamp; } set { m_TimeStamp = value; } }

        public Guid ID { get { return m_ID; } set { m_ID = value; } }

        public bool IsHeader { get { return m_IsHeader; } }

            /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.
        /// </returns>
        /// <param name="other">An object to compare with this object.</param>
        public override bool Equals(object other)
        {
            //use our type-specific override
            return Equals(other as GibraltarCachedPacket);
        }

        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.
        /// </returns>
        /// <param name="other">An object to compare with this object.</param>
        public bool Equals(GibraltarCachedPacket other)
        {
            //Careful - can be null
            if (other == null)
            {
                return false; // since we're a live object we can't be equal.
            }

            return ((Sequence == other.Sequence)
                && (Timestamp == other.Timestamp)
                && (ID == other.ID));
        }

        /// <summary>
        /// Provides a representative hash code for objects of this type to spread out distribution
        /// in hash tables.
        /// </summary>
        /// <remarks>Objects which consider themselves to be Equal (a.Equals(b) returns true) are
        /// expected to have the same hash code.  Objects which are not Equal may have the same
        /// hash code, but minimizing such overlaps helps with efficient operation of hash tables.
        /// </remarks>
        /// <returns>
        /// an int representing the hash code calculated for the contents of this object
        /// </returns>
        public override int GetHashCode()
        {
            int myHash = (int) (m_Sequence >> 32) ^ (int) (m_Sequence); // Fold long Sequence down to 32-bit hash code

            myHash ^= m_TimeStamp.GetHashCode(); // Fold in hash code for DateTimeOffset member TimeStamp
            myHash ^= m_ID.GetHashCode(); // Fold in hash code for GUID

            return myHash;
        }

        #region IPacket Members

        private const int Version = 1;

        /// <summary>
        /// The list of packets that this packet depends on.
        /// </summary>
        /// <returns>An array of IPackets, or null if there are no dependencies.</returns>
        IPacket[] IPacket.GetRequiredPackets()
        {
            //the majority of packets have no dependencies
            return null;
        }

        PacketDefinition IPacket.GetPacketDefinition()
        {
            const string typeName = nameof(GibraltarCachedPacket);
            var definition = new PacketDefinition(typeName, Version, false);

            definition.Fields.Add("Sequence", FieldType.Int64);
            definition.Fields.Add("TimeStamp", FieldType.DateTimeOffset);
            definition.Fields.Add("ID", FieldType.Guid);
            definition.Fields.Add("IsHeader", FieldType.Bool);
            return definition;
        }

        void IPacket.WriteFields(PacketDefinition definition, SerializedPacket packet)
        {
#if DEBUG
            if (m_TimeStamp == DateTimeOffset.MinValue && Debugger.IsAttached)
                Debugger.Break(); // Stop the debugger before the Assert
            Debug.Assert(m_TimeStamp.Year > 1 ); //watch for timestamp being some variation of zero
#endif

            packet.SetField("Sequence", m_Sequence);
            packet.SetField("TimeStamp", m_TimeStamp);
            packet.SetField("ID", m_ID);
            packet.SetField("IsHeader", m_IsHeader);
        }

        void IPacket.ReadFields(PacketDefinition definition, SerializedPacket packet)
        {
            switch (definition.Version)
            {
                case 1:
                    packet.GetField("Sequence", out m_Sequence);
                    packet.GetField("TimeStamp", out m_TimeStamp);
                    packet.GetField("ID", out m_ID);
                    packet.GetField("IsHeader", out m_IsHeader);
                    break;
            }
        }

        #endregion

    }
}


text:
#include <e_os.h>
#include <openssl/macros.h>
#include <openssl/rand.h>

#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
# include <windows.h>
# if OPENSSL_API_COMPAT < 0x10100000L

# define DEPRECATED_RAND_FUNCTIONS_DEFINED

int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam)
{
    RAND_poll();
    return RAND_status();
}

void RAND_screen(void)
{
    RAND_poll();
}
# endif
#endif

#ifndef DEPRECATED_RAND_FUNCTIONS_DEFINED
NON_EMPTY_TRANSLATION_UNIT
#endif