text:
package demo.jaxrs.client;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.DeleteMethod;
import org.apache.commons.httpclient.methods.FileRequestEntity;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.io.CachedOutputStream;
import org.apache.cxf.resource.URIResolver;
import org.codehaus.jettison.json.JSONObject;

import java.io.File;
import java.io.InputStream;
import java.net.URL;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public final class Client {

    private Client() {
    }

    private String getJSONStringWithId(File file, String jsonRootElement, String orderId) throws Exception{
        String content = new Scanner(file).useDelimiter("\\Z").next(); //get the file content
        JSONObject obj = new JSONObject(content);   //parse it
        ((JSONObject)obj.get(jsonRootElement)).put("orderId", orderId); //add orderId under Order element

        return obj.toString();
    }

    public static void main(String args[]) throws Exception {
        // First set the URL of the service
        // Default is : http://localhost:9763/jaxrs_starbucks_service/services/Starbucks_Outlet_Service
        String serviceURL = "http://localhost:9763/jaxrs_starbucks_service/services/Starbucks_Outlet_Service";
        if (args[0] != null) {
            serviceURL = args[0];
        }

        String currentOrderId = null;

        // Sent HTTP GET request to query customer info
        System.out.println("Sent HTTP GET request to query order info of " + 123);
        URL url = new URL(serviceURL + "/orders/123");
        InputStream in = url.openStream();
        System.out.println(getStringFromInputStream(in));

        // Sent HTTP POST request to add customer
        System.out.println("\n");
        System.out.println("Sent HTTP POST request to add an order");
        Client client = new Client();
        String inputFile = client.getClass().getResource("add_order.xml").getFile();
        URIResolver resolver = new URIResolver(inputFile);
        File input = new File(resolver.getURI());
        PostMethod post = new PostMethod(serviceURL + "/orders");
        RequestEntity entity = new FileRequestEntity(input, "text/xml");
        post.setRequestEntity(entity);
        HttpClient httpclient = new HttpClient();

        try {
            int result = httpclient.executeMethod(post);
            System.out.println("Response status code: " + result);
            System.out.println("Response body: ");
            String response = post.getResponseBodyAsString();
            System.out.println(response);

            currentOrderId = getOrderId(response) ;
        } finally {
            // Release current connection to the connection pool once you are
            // done
            post.releaseConnection();
        }

        if (currentOrderId == null) {
            System.out.println("The retrieved order id is null. Either the POST operation was failed or some other error.");
            return;
        }

        // Sent HTTP GET request to query customer info
        System.out.println("\n");
        System.out.println("Sent HTTP GET request to query order info of " + currentOrderId);
        url = new URL(serviceURL + "/orders/"+currentOrderId);
        in = url.openStream();
        System.out.println(getStringFromInputStream(in));

        // Sent HTTP PUT request to update order
        System.out.println("\n");
        System.out.println("Sent HTTP PUT request to update order " + currentOrderId);
        inputFile = client.getClass().getResource("update_order.json").getFile();
        resolver = new URIResolver(inputFile);
        input = new File(resolver.getURI());
        String jsonString = client.getJSONStringWithId(input, "Order", currentOrderId);
        PutMethod put = new PutMethod(serviceURL + "/orders");
        entity = new StringRequestEntity(jsonString, "application/json", "utf-8");
        put.setRequestEntity(entity);
        httpclient = new HttpClient();

        try {
            int result = httpclient.executeMethod(put);
            System.out.println("Response status code: " + result);
            System.out.println("Response body: ");
            System.out.println(put.getResponseBodyAsStream());
        } finally {
            // Release current connection to the connection pool once you are
            // done
            put.releaseConnection();
        }

        // Sent HTTP PUT request to lock
        System.out.println("\n");
        System.out.println("Sent HTTP PUT request to lock the order " + currentOrderId);
        put = new PutMethod(serviceURL + "/orders/lock/" + currentOrderId);
        httpclient = new HttpClient();

        try {
            int result = httpclient.executeMethod(put);
            System.out.println("Response status code: " + result);
            System.out.println("Response body: ");
            System.out.println(put.getResponseBodyAsStream());
        } finally {
            // Release current connection to the connection pool once you are
            // done
            put.releaseConnection();
        }

        // Sent HTTP POST request to do payment
        System.out.println("\n");
        System.out.println("Sent HTTP POST request to do payment for order " + currentOrderId);
        inputFile = client.getClass().getResource("payment.json").getFile();
        resolver = new URIResolver(inputFile);
        input = new File(resolver.getURI());
        jsonString = client.getJSONStringWithId(input, "Payment", currentOrderId);
        post = new PostMethod(serviceURL + "/payment/"+currentOrderId);
        post.addRequestHeader("Accept" , "text/html");
        entity = new StringRequestEntity(jsonString, "application/json", "utf-8");
        post.setRequestEntity(entity);
        httpclient = new HttpClient();

        try {
            int result = httpclient.executeMethod(post);
            System.out.println("Response status code: " + result);
            System.out.println("Response body: ");
            System.out.println(post.getResponseBodyAsStream());
        } finally {
            // Release current connection to the connection pool once you are
            // done
            post.releaseConnection();
        }

        // Sent HTTP GET request to query payment
        System.out.println("\n");
        System.out.println("Sent HTTP GET request to query payment info for order " + currentOrderId);
        url = new URL(serviceURL + "/payment/"+currentOrderId);
        in = url.openStream();
        System.out.println(getStringFromInputStream(in));

        //HTTP DELETE request
        System.out.println("\n");
        System.out.println("Sent HTTP DELETE request to remove the order " + currentOrderId);
        DeleteMethod delete = new DeleteMethod(serviceURL + "/orders/"+currentOrderId);

        httpclient = new HttpClient();

        try {
            int result = httpclient.executeMethod(delete);
            System.out.println("Response status code: " + result);
            System.out.println("Response body: ");
            System.out.println(delete.getResponseBodyAsStream());
        } finally {
            // Release current connection to the connection pool once you are
            // done
            put.releaseConnection();
        }

        System.out.println("\n");
        System.exit(0);
    }

    /**
     * Retrieves the orderId from a json string.
     * Only lighweight string manipulations are performed since this is a client.
     *
     *     String response = "{\"Order\":{\"additions\":\"Caramel\",\"drinkName\":\"Mocha Flavored Coffee\"," +
     "\"locked\":false,\"orderId\" : \"4b650b9e-86c0-4561-92b2-050f8c61de05\"}}\n";
     * @param response json string
     * @return the orderId
     */
    private static String getOrderId(String response) {
        String regexString = "(?<=\"orderId\")\\s*:\\s*\"([a-z\\-0-9]*)";    // "orderId"\s*:\s*"([a-z\-0-9]*)"
        String match = null;                                              //(?<="orderId":")([a-z\-0-9]*)

        Pattern regex = Pattern.compile(regexString);
        Matcher m = regex.matcher(response);
        if (m.find()) {
            match = m.group();
            match = match.trim().replaceAll("\\s*:\\s*\"", "");
        }

        return match;
    }

    private static String getStringFromInputStream(InputStream in) throws Exception {
        CachedOutputStream bos = new CachedOutputStream();
        IOUtils.copy(in, bos);
        in.close();
        bos.close();
        return bos.getOut().toString();
    }

}


text:
require 'morpheus/api/api_client'

class Morpheus::NetworkDhcpRelaysInterface < Morpheus::RestInterface

  def base_path
    "/api/networks/servers"
  end

  def get_dhcp_relay(server_id, dhcp_relay_id, params={}, headers={})
    validate_id!(server_id)
    validate_id!(dhcp_relay_id)
    execute(method: :get, url: "#{base_path}/#{server_id}/dhcp-relays/#{dhcp_relay_id}", params: params, headers: headers)
  end

  def list_dhcp_relays(server_id, params={}, headers={})
    validate_id!(server_id)
    execute(method: :get, url: "#{base_path}/#{server_id}/dhcp-relays", params: params, headers: headers)
  end

  def create_dhcp_relay(server_id, payload, params={}, headers={})
    validate_id!(server_id)
    execute(method: :post, url: "#{base_path}/#{server_id}/dhcp-relays", params: params, payload: payload, headers: headers)
  end

  def update_dhcp_relay(server_id, dhcp_relay_id, payload, params={}, headers={})
    validate_id!(server_id)
    validate_id!(dhcp_relay_id)
    execute(method: :put, url: "#{base_path}/#{server_id}/dhcp-relays/#{dhcp_relay_id}", params: params, payload: payload, headers: headers)
  end

  def delete_dhcp_relay(server_id, dhcp_relay_id, params={}, headers={})
    validate_id!(server_id)
    validate_id!(dhcp_relay_id)
    execute(method: :delete, url: "#{base_path}/#{server_id}/dhcp-relays/#{dhcp_relay_id}", params: params, headers: headers)
  end
end

redpajama_set_name: RedPajamaGithub


text:
.class Lcom/google/common/eventbus/EventHandler;
.super Ljava/lang/Object;
.source "EventHandler.java"

# instance fields
.field private final method:Ljava/lang/reflect/Method;

.field private final target:Ljava/lang/Object;

# direct methods
.method constructor <init>(Ljava/lang/Object;Ljava/lang/reflect/Method;)V
    .locals 1
    .param p1, "target"    # Ljava/lang/Object;
    .param p2, "method"    # Ljava/lang/reflect/Method;

    .prologue
    .line 48
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 49
    const-string v0, "EventHandler target cannot be null."

    invoke-static {p1, v0}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 51
    const-string v0, "EventHandler method cannot be null."

    invoke-static {p2, v0}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 53
    iput-object p1, p0, Lcom/google/common/eventbus/EventHandler;->target:Ljava/lang/Object;

    .line 54
    iput-object p2, p0, Lcom/google/common/eventbus/EventHandler;->method:Ljava/lang/reflect/Method;

    .line 55
    const/4 v0, 0x1

    invoke-virtual {p2, v0}, Ljava/lang/reflect/Method;->setAccessible(Z)V

    .line 56
    return-void
.end method

# virtual methods
.method public equals(Ljava/lang/Object;)Z
    .locals 5
    .param p1, "obj"    # Ljava/lang/Object;

    .prologue
    const/4 v1, 0x1

    const/4 v2, 0x0

    .line 91
    if-ne p0, p1, :cond_1

    .line 105
    :cond_0
    :goto_0
    return v1

    .line 95
    :cond_1
    if-nez p1, :cond_2

    move v1, v2

    .line 96
    goto :goto_0

    .line 99
    :cond_2
    invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v3

    invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v4

    if-eq v3, v4, :cond_3

    move v1, v2

    .line 100
    goto :goto_0

    :cond_3
    move-object v0, p1

    .line 103
    check-cast v0, Lcom/google/common/eventbus/EventHandler;

    .line 105
    .local v0, "other":Lcom/google/common/eventbus/EventHandler;
    iget-object v3, p0, Lcom/google/common/eventbus/EventHandler;->method:Ljava/lang/reflect/Method;

    iget-object v4, v0, Lcom/google/common/eventbus/EventHandler;->method:Ljava/lang/reflect/Method;

    invoke-virtual {v3, v4}, Ljava/lang/reflect/Method;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_4

    iget-object v3, p0, Lcom/google/common/eventbus/EventHandler;->target:Ljava/lang/Object;

    iget-object v4, v0, Lcom/google/common/eventbus/EventHandler;->target:Ljava/lang/Object;

    if-eq v3, v4, :cond_0

    :cond_4
    move v1, v2

    goto :goto_0
.end method

.method public handleEvent(Ljava/lang/Object;)V
    .locals 5
    .param p1, "event"    # Ljava/lang/Object;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/reflect/InvocationTargetException;
        }
    .end annotation

    .prologue
    .line 68
    :try_start_0
    iget-object v1, p0, Lcom/google/common/eventbus/EventHandler;->method:Ljava/lang/reflect/Method;

    iget-object v2, p0, Lcom/google/common/eventbus/EventHandler;->target:Ljava/lang/Object;

    const/4 v3, 0x1

    new-array v3, v3, [Ljava/lang/Object;

    const/4 v4, 0x0

    aput-object p1, v3, v4

    invoke-virtual {v1, v2, v3}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_0
    .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/lang/reflect/InvocationTargetException; {:try_start_0 .. :try_end_0} :catch_2

    .line 79
    return-void

    .line 69
    :catch_0
    move-exception v0

    .line 70
    .local v0, "e":Ljava/lang/IllegalArgumentException;
    new-instance v1, Ljava/lang/Error;

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Method rejected target/argument: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-direct {v1, v2, v0}, Ljava/lang/Error;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1

    .line 71
    .end local v0    # "e":Ljava/lang/IllegalArgumentException;
    :catch_1
    move-exception v0

    .line 72
    .local v0, "e":Ljava/lang/IllegalAccessException;
    new-instance v1, Ljava/lang/Error;

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Method became inaccessible: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-direct {v1, v2, v0}, Ljava/lang/Error;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1

    .line 73
    .end local v0    # "e":Ljava/lang/IllegalAccessException;
    :catch_2
    move-exception v0

    .line 74
    .local v0, "e":Ljava/lang/reflect/InvocationTargetException;
    invoke-virtual {v0}, Ljava/lang/reflect/InvocationTargetException;->getCause()Ljava/lang/Throwable;

    move-result-object v1

    instance-of v1, v1, Ljava/lang/Error;

    if-eqz v1, :cond_0

    .line 75
    invoke-virtual {v0}, Ljava/lang/reflect/InvocationTargetException;->getCause()Ljava/lang/Throwable;

    move-result-object v1

    check-cast v1, Ljava/lang/Error;

    throw v1

    .line 77
    :cond_0
    throw v0
.end method

.method public hashCode()I
    .locals 3

    .prologue
    .line 86
    const/16 v0, 0x1f

    .line 87
    .local v0, "PRIME":I
    iget-object v1, p0, Lcom/google/common/eventbus/EventHandler;->method:Ljava/lang/reflect/Method;

    invoke-virtual {v1}, Ljava/lang/reflect/Method;->hashCode()I

    move-result v1

    add-int/lit8 v1, v1, 0x1f

    mul-int/lit8 v1, v1, 0x1f

    iget-object v2, p0, Lcom/google/common/eventbus/EventHandler;->target:Ljava/lang/Object;

    invoke-virtual {v2}, Ljava/lang/Object;->hashCode()I

    move-result v2

    add-int/2addr v1, v2

    return v1
.end method

.method public toString()Ljava/lang/String;
    .locals 2

    .prologue
    .line 82
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "[wrapper "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-object v1, p0, Lcom/google/common/eventbus/EventHandler;->method:Ljava/lang/reflect/Method;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "]"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method


text:
package org.apache.carbondata.spark.testsuite.booleantype

import java.io.File

import org.apache.spark.sql.Row
import org.apache.spark.sql.test.util.QueryTest
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}

class BooleanDataTypesSortTest extends QueryTest with BeforeAndAfterEach with BeforeAndAfterAll {
  val rootPath = new File(this.getClass.getResource("/").getPath
    + "../../../..").getCanonicalPath

  override def beforeEach(): Unit = {
    sql("drop table if exists boolean_table")
    sql("drop table if exists boolean_table2")
  }

  override def afterAll(): Unit = {
    sql("drop table if exists boolean_table")
    sql("drop table if exists boolean_table2")
  }

  test("Sort_columns: sort one boolean column") {
    sql(
      s"""
         | CREATE TABLE boolean_table(
         | shortField SHORT,
         | booleanField BOOLEAN,
         | intField INT,
         | bigintField LONG,
         | doubleField DOUBLE,
         | stringField STRING,
         | timestampField TIMESTAMP,
         | decimalField DECIMAL(18,2),
         | dateField DATE,
         | charField CHAR(5),
         | floatField FLOAT,
         | complexData ARRAY<STRING>
         | )
         | STORED AS carbondata
         | TBLPROPERTIES('sort_columns'='booleanField')
       """.stripMargin)

    sql(
      s"""
         | CREATE TABLE boolean_table2(
         | shortField SHORT,
         | booleanField BOOLEAN
         | )
         | STORED AS carbondata
         | TBLPROPERTIES('sort_columns'='booleanField')
       """.stripMargin)

    val storeLocation = s"$rootPath/integration/spark/src/test/resources/bool/supportBooleanTwoBooleanColumns.csv"
    sql(
      s"""
         | LOAD DATA LOCAL INPATH '${storeLocation}'
         | INTO TABLE boolean_table
         | options('FILEHEADER'='shortField,booleanField,intField,bigintField,doubleField,stringField,timestampField,decimalField,dateField,charField,floatField,complexData')
           """.stripMargin)

    sql("insert into boolean_table2 select shortField,booleanField from boolean_table where shortField = 1 and booleanField = true")

    checkAnswer(
      sql("select shortField,booleanField from boolean_table"),
      Seq(Row(5, false), Row(1, false), Row(2, false), Row(1, false), Row(4, false), Row(1, false), Row(1, true), Row(1, true), Row(1, true), Row(3, true))
    )

    checkAnswer(
      sql("select shortField,booleanField from boolean_table2"),
      Seq(Row(1, true), Row(1, true), Row(1, true))
    )
  }

  test("Sort_columns: sort two boolean columns and other data type column") {
    sql(
      s"""
         | CREATE TABLE boolean_table(
         | shortField SHORT,
         | booleanField BOOLEAN,
         | intField INT,
         | bigintField LONG,
         | doubleField DOUBLE,
         | stringField STRING,
         | timestampField TIMESTAMP,
         | decimalField DECIMAL(18,2),
         | dateField DATE,
         | charField CHAR(5),
         | floatField FLOAT,
         | complexData ARRAY<STRING>,
         | booleanField2 BOOLEAN
         | )
         | STORED AS carbondata
         | TBLPROPERTIES('sort_columns'='shortField,booleanField,booleanField2')
       """.stripMargin)

    sql(
      s"""
         | CREATE TABLE boolean_table2(
         | shortField SHORT,
         | booleanField BOOLEAN,
         | booleanField2 BOOLEAN
         | )
         | STORED AS carbondata
         | TBLPROPERTIES('sort_columns'='shortField,booleanField,booleanField2')
       """.stripMargin)

    val storeLocation = s"$rootPath/integration/spark/src/test/resources/bool/supportBooleanTwoBooleanColumns.csv"
    sql(
      s"""
         | LOAD DATA LOCAL INPATH '${storeLocation}'
         | INTO TABLE boolean_table
         | options('FILEHEADER'='shortField,booleanField,intField,bigintField,doubleField,stringField,timestampField,decimalField,dateField,charField,floatField,complexData,booleanField2')
           """.stripMargin)

    sql("insert into boolean_table2 select shortField,booleanField,booleanField2 from boolean_table where shortField = 1 and booleanField = true")

    checkAnswer(
      sql("select shortField,booleanField,booleanField2 from boolean_table"),
      Seq(Row(5, false, true), Row(1, false, false), Row(2, false, false), Row(1, false, false), Row(4, false, false),
        Row(1, false, true), Row(1, true, true), Row(1, true, true), Row(1, true, true), Row(3, true, false))
    )

    checkAnswer(
      sql("select shortField,booleanField,booleanField2 from boolean_table2"),
      Seq(Row(1, true, true), Row(1, true, true), Row(1, true, true))
    )
  }
}


text:
package config

import (
	"fmt"
	"log"
)

func SetupLogger() {
	log.SetFlags(0)
	log.SetOutput(new(logWriter))
}

type logWriter struct{}

func (writer logWriter) Write(bytes []byte) (int, error) {
	return fmt.Print(string(bytes))
}


text:
<?php

namespace PHPExiftool\Driver\Tag\DICOM;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class TotalGain extends AbstractTag
{

    protected $Id = '0018,5040';

    protected $Name = 'TotalGain';

    protected $FullName = 'DICOM::Main';

    protected $GroupName = 'DICOM';

    protected $g0 = 'DICOM';

    protected $g1 = 'DICOM';

    protected $g2 = 'Image';

    protected $Type = '?';

    protected $Writable = false;

    protected $Description = 'Total Gain';

}


text:
<?php

if ( ! function_exists( 'mb_setup' ) ):
function mb_setup() {

	/****************************************
	Backend
	*****************************************/

	// Clean up the head
	remove_action('wp_head', 'rsd_link');
	remove_action('wp_head', 'wlwmanifest_link');
	remove_action('wp_head', 'wp_generator');
	remove_action('wp_head', 'wp_shortlink_wp_head');

	// Register menus
	register_nav_menus( array(
		'primary' => __( 'Primary Menu', 'mbbasetheme' ),
	) );

	// Register Widget Areas
	add_action( 'widgets_init', 'mb_widgets_init' );

	// Execute shortcodes in widgets
	// add_filter('widget_text', 'do_shortcode');

	// Add RSS links to head
	add_theme_support( 'automatic-feed-links' );

	// Add Editor Style
	add_editor_style( 'editor-style.css' );

	// Don't update theme
	add_filter( 'http_request_args', 'mb_dont_update_theme', 5, 2 );

	// Prevent File Modifications
	define ( 'DISALLOW_FILE_EDIT', true );

	// Set Content Width
	if ( ! isset( $content_width ) ) $content_width = 900;

	// Enable Post Thumbnails
	add_theme_support( 'post-thumbnails' );

	// Add Image Sizes
	// add_image_size( $name, $width = 0, $height = 0, $crop = false );
	add_image_size( 'homepage-thumb', 768, 461, true ); // 768 pixels wide by 461 pixels tall, hard crop mode
	// Enable Custom Headers
	// add_theme_support( 'custom-header' );

	// Enable Custom Backgrounds
	// add_theme_support( 'custom-background' );

	// Remove Dashboard Meta Boxes
	add_action('wp_dashboard_setup', 'mb_remove_dashboard_widgets' );

	// Change Admin Menu Order
	add_filter('custom_menu_order', 'mb_custom_menu_order');
	add_filter('menu_order', 'mb_custom_menu_order');

	// Hide Admin Areas that are not used
	add_action( 'admin_menu', 'mb_remove_menu_pages' );

	// Remove default link for images
	add_action('admin_init', 'mb_imagelink_setup', 10);

	// Show Kitchen Sink in WYSIWYG Editor
	add_filter( 'tiny_mce_before_init', 'mb_unhide_kitchensink' );

	// Define custom post type capabilities for use with Members
	add_action( 'admin_init', 'mb_add_post_type_caps' );

	/****************************************
	Frontend
	*****************************************/

	// Add Post Formats Theme Support
	// add_theme_support( 'post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'audio', 'chat', 'video') );

	// Enqueue scripts
	add_action( 'wp_enqueue_scripts', 'mb_scripts' );

	// Remove Query Strings From Static Resources
	add_filter('script_loader_src', 'mb_remove_script_version', 15, 1);
	add_filter('style_loader_src', 'mb_remove_script_version', 15, 1);

	// Remove Read More Jump
	add_filter('the_content_more_link', 'mb_remove_more_jump_link');

}
endif; // mb_setup
add_action('after_setup_theme', 'mb_setup');


text:
<?php

/*
 * This file is part of Sulu.
 *
 * (c) MASSIVE ART WebServices GmbH
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Sulu\Bundle\SecurityBundle\EventListener;

use Sulu\Component\Security\Authentication\UserInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;

/**
 * Sets the locale of the current User to the request. Required for the translator to work properly.
 */
class UserLocaleListener
{
    /**
     * @var TokenStorageInterface
     */
    private $tokenStorage;

    public function __construct(TokenStorageInterface $tokenStorage)
    {
        $this->tokenStorage = $tokenStorage;
    }

    /**
     * Sets the locale of the current User to the request, if a User is logged in.
     *
     * @param GetResponseEvent $event
     */
    public function copyUserLocaleToRequest(GetResponseEvent $event)
    {
        $token = $this->tokenStorage->getToken();
        if (!$token) {
            return;
        }

        $user = $token->getUser();
        if (!$user instanceof UserInterface) {
            return;
        }

        $event->getRequest()->setLocale($user->getLocale());
    }
}


text:
<?php

namespace Truffo\eZContentDecoratorBundle\Decorator;

use eZ\Publish\API\Repository\Values\Content\Location;
use eZ\Publish\API\Repository\Values\Content\Query;
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class ContentDecorator implements ContainerAwareInterface
{
    /**
     * @var \Symfony\Component\DependencyInjection\ContainerInterface
     */
    protected $container;

    /**
     * @var \eZ\Publish\API\Repository\Repository
     */
    protected $repository;

    /**
     * @var \eZ\Publish\API\Repository\Values\Content\Location
     */
    protected $location = null;

    /**
     * @var \eZ\Publish\API\Repository\Values\Content\Content
     */
    protected $content = null;

    /**
     * @var string
     */
    protected $contentTypeIdentifier = null;

    /**
     * @param ContainerInterface $container
     * @param Location $location
     * @param $contentTypeIdentifier
     */
    public function __construct(ContainerInterface $container, Location $location, $contentTypeIdentifier)
    {

        $this->container = $container;
        $this->repository = $this->container->get('ezpublish.api.repository');

        $this->location = $location;
        $this->contentTypeIdentifier = $contentTypeIdentifier;
    }

    /**
     * @param ContainerInterface $container
     */
    public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
        $this->repository = $this->container->get('ezpublish.api.repository');
    }

    /**
     * @return \eZ\Publish\API\Repository\Values\Content\Content
     */
    public function getContent()
    {
        if ($this->content == null) {
            $this->content = $this->repository->getContentService()
                ->loadContent($this->location->contentId);
        }
        return $this->content;
    }

    /**
     * @return Location
     */
    public function getLocation()
    {
        return $this->location;
    }

    /**
     * @return string
     */
    public function getContentTypeIdentifier()
    {
        return $this->contentTypeIdentifier;
    }

}


text:
<bill session="110" type="h" number="286" updated="2009-01-08T17:19:37-05:00">
	<status><introduced date="1167973200" datetime="2007-01-05"/></status>

	<introduced date="1167973200" datetime="2007-01-05"/>
	<titles>
		<title type="official" as="introduced">To amend the Metric Conversion Act of 1975 to require Federal agencies to impose certain requirements on recipients of awards for scientific and engineering research.</title>
	</titles>
	<sponsor id="400119"/>
	<cosponsors>

	</cosponsors>
	<actions>
		<action date="1167973200" datetime="2007-01-05"><text>Referred to the House Committee on Science and Technology.</text></action>
		<action date="1170219600" datetime="2007-01-31"><text>Referred to the Subcommittee on Technology and Innovation.</text></action>
	</actions>
	<committees>

	</committees>
	<relatedbills>

	</relatedbills>
	<subjects>

	</subjects>
	<amendments>

	</amendments>
	<summary>
	1/5/2007--Introduced.<br/>Amends the Metric Conversion Act of 1975 to require guidelines on government use of the metric system of measurement to require any federal agency transaction providing for a person to perform scientific or engineering research with federal funding to include provisions: (1) clearly identifying the extent to which such system or other systems of measurement will be used under the transaction and requiring such use; and (2) assigning such person the financial responsibility for failure to follow such requirements.
	</summary>
</bill>


text:
package org.spongepowered.common.config.category;

import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;

import java.util.ArrayList;
import java.util.List;

@ConfigSerializable
public class BlockTrackingCategory extends ConfigCategory {

    @Setting(value = "enabled", comment = "If enabled, adds player tracking support for block positions. Note: This should only be disabled if you do not care who caused a block to change.")
    private boolean enabled = true;

    @Setting(value = "block-blacklist", comment = "Add block ids you wish to blacklist for player block placement tracking.")
    private List<String> blockBlacklist = new ArrayList<>();

    public boolean isEnabled() {
        return this.enabled;
    }

    public void setEnabled(boolean flag) {
        this.enabled = flag;
    }

    public List<String> getBlockBlacklist() {
        return this.blockBlacklist;
    }
}


text:
package main

import (
	"encoding/json"
	"github.com/jthomas/ow"
)

type Params struct {
	Payload string `json:"payload"`
}

type Result struct {
	Reversed string `json:"reversed"`
}

func reverse_string(to_reverse string) string {
	chars := []rune(to_reverse)
	for i, j := 0, len(chars)-1; i < j; i, j = i+1, j-1 {
		chars[i], chars[j] = chars[j], chars[i]
	}
	return string(chars)
}

func main() {
	ow.RegisterAction(func(value json.RawMessage) (interface{}, error) {
		var params Params
		err := json.Unmarshal(value, &params)
		if err != nil {
			return nil, err
		}
		return Result{Reversed: reverse_string(params.Payload)}, nil
	})
}


text:
Users can read about MyBatis-Spring-Boot-Starter-Test in the following translations:

English

简体中文

## What is MyBatis-Spring-Boot-Starter-Test?

The MyBatis-Spring-Boot-Starter-Test help creating a test cases for MyBatis component using the [MyBatis-Spring-Boot-Starter](http://www.mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/).

By using this module you will can be:

* Can use the `@MybatisTest` that setup test components for testing pure MyBatis component
* Can import dependency artifacts for performing tests for pure MyBatis component

## Requirements

The MyBatis-Spring-Boot-Starter-Test requires following versions:

| MyBatis-Spring-Boot-Starter-Test | Spring Boot    | Java            |
|----------------------------------|----------------|-----------------|
| **3.0**                          | 3.0            | 17 or higher    |
| **2.3**                          | 2.5 - 2.7      | 8 or higher     |
| **2.2**                          | 2.5 - 2.7      | 8 or higher     |
| **2.1**                          | 2.1 - 2.4      | 8 or higher     |
| **~~2.0 (EOL)~~**                | ~~2.0 or 2.1~~ | ~~8 or higher~~ |
| **~~1.3 (EOL)~~**                | ~~1.5~~        | ~~6 or higher~~ |
| **~~1.2 (EOL)~~**                | ~~1.4~~        | ~~6 or higher~~ |

## Installation

### Maven

If you are using Maven just add the following dependency to your `pom.xml`:

```xml
<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter-test</artifactId>
    <version>${project.version}</version>
    <scope>test</scope>
</dependency>
```

### Gradle

If using gradle add this to your `build.gradle`:

```groovy
dependencies {
    testCompile("org.mybatis.spring.boot:mybatis-spring-boot-starter-test:${project.version}")
}
```

## Using @MybatisTest

The `@MybatisTest` can be used if you want to test MyBatis components(Mapper interface and `SqlSession`).
By default it will configure MyBatis(MyBatis-Spring) components(`SqlSessionFactory` and `SqlSessionTemplate`),
configure MyBatis mapper interfaces and configure an in-memory embedded database.
MyBatis tests are transactional and rollback at the end of each test by default,
for more details refer to the relevant section in the [Spring Reference Documentation](https://docs.spring.io/spring/docs/current/spring-framework-reference/testing.html#testcontext-tx-enabling-transactions).
Also regular `@Component` beans will not be loaded into the `ApplicationContext`.

### Test for Mapper interface

if you create a test case for following mapper interface, you add just `@MybatisTest` on your test case class.

Mapper interface :

```java
package sample.mybatis.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import sample.mybatis.domain.City;

@Mapper
public interface CityMapper {

    @Select("SELECT * FROM CITY WHERE state = #{state}")
    City findByState(@Param("state") String state);

}
```

TestCase class :

```java
package sample.mybatis.mapper;

import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.mybatis.spring.boot.test.autoconfigure.MybatisTest;
import sample.mybatis.domain.City;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringRunner;

import static org.assertj.core.api.Assertions.assertThat;

@RunWith(SpringRunner.class)
@MybatisTest
public class CityMapperTest {

    @Autowired
    private CityMapper cityMapper;

    @Test
    public void findByStateTest() {
        City city = cityMapper.findByState("CA");
        assertThat(city.getName()).isEqualTo("San Francisco");
        assertThat(city.getState()).isEqualTo("CA");
        assertThat(city.getCountry()).isEqualTo("US");
    }

}
```

### Test for DAO pattern

if you create a test case for following DAO class, you add just `@MybatisTest` and `@Import` on your test case class.

DAO class :

```java
package sample.mybatis.dao;

import org.apache.ibatis.session.SqlSession;
import sample.mybatis.domain.City;

import org.springframework.stereotype.Component;

@Component
public class CityDao {

    private final SqlSession sqlSession;

    public CityDao(SqlSession sqlSession) {
        this.sqlSession = sqlSession;
    }

    public City selectCityById(long id) {
        return this.sqlSession.selectOne("selectCityById", id);
    }

}
```

TestCase class :

```java
package sample.mybatis.dao;

import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.mybatis.spring.boot.test.autoconfigure.MybatisTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringRunner;
import sample.mybatis.domain.City;

import static org.assertj.core.api.Assertions.assertThat;

@RunWith(SpringRunner.class)
@MybatisTest
@Import(CityDao.class)
public class CityDaoTest {

    @Autowired
    private CityDao cityDao;

    @Test
    public void selectCityByIdTest() {
        City city = cityDao.selectCityById(1);
        assertThat(city.getName()).isEqualTo("San Francisco");
        assertThat(city.getState()).isEqualTo("CA");
        assertThat(city.getCountry()).isEqualTo("US");
    }

}
```

## Using a real database

The In-memory embedded databases generally work well for tests since they are fast and don't require any developer installation.
However if you prefer to run tests against a real database, you can use the `@AutoConfigureTestDatabase` as follow:

```java
package sample.mybatis.mapper;
// ...
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;

@RunWith(SpringRunner.class)
@MybatisTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
public class CityMapperTest {
    // ...
}
```

## Prevent detecting a real @SpringBootApplication

The `@MybatisTest` will detect a class that annotated `@SpringBootApplication` by default.
Therefore by depend on bean definition methods, there is case that an unexpected error is occurred or unnecessary components are loaded into `ApplicationContext`.
This behavior can prevent by creating a `@SpringBootApplication` class into same package as test class as follow:

```java
package sample.mybatis.mapper;

import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
class MapperTestApplication {

}
```

## Use together with other @***Test

If you use the `@MybatisTest` together with other `@***Test`(e.g. `@WebMvcTest`),
Please consider to use the `@AutoConfigureMybatis` because `@***Test` annotation cannot specify two or more on same test.

Target classes for testing:

```java
@RestController
public class PingController {
  PingMapper mapper;

  PingController(PingMapper mapper) {
    this.mapper = mapper;
  }

  @GetMapping("ping")
  String ping() {
    return mapper.ping();
  }
}
```

```java
@Mapper
public interface PingMapper {
@Select("SELECT 'OK'")
  String ping();
}
```

Test class:

```java
@RunWith(SpringRunner.class)
@WebMvcTest
@AutoConfigureMybatis // Specify instead of @MybatisTest
public class PingTests {

  @Autowired
  private MockMvc mvc;

  @Test
  public void ping() throws Exception {
    this.mvc.perform(get("/ping"))
        .andExpect(status().isOk())
        .andExpect(content().string("OK"));
  }

}
```

## Using @MybatisTest on JUnit 5

The `@MybatisTest` can be used on JUnit 5.

```java
@ExtendWith(SpringExtension.class)
@MybatisTest
public class CityMapperTest {
    // ...
}
```

Since 2.0.1, the `@ExtendWith(SpringExtension.class)` can omit as follow:

```java
@MybatisTest
public class CityMapperTest {
    // ...
}
```

## Appendix

### Imported auto-configuration

The `@MybatisTest` will import following auto-configuration classes.

* `org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration`
* `org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration`
* `org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration`
* `org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration`
* `org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration`
* `org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration`
* `org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration`
* `org.springframework.boot.autoconfigure.sql.init.SqlInitializationAutoConfiguration`
* `org.mybatis.spring.boot.autoconfigure.MybatisLanguageDriverAutoConfiguration`
* `org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration`

### Running Samples

The project provides two samples so you play and experiment with them.

| Category | Sample | Description |
| :--- | :--- | :--- |
| Core | [1st Sample](https://github.com/mybatis/spring-boot-starter/tree/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-annotation) | Show the simplest scenario with just a mapper and a bean where the mapper is injected into. This is the sample we saw in the Quick Setup section. |
|      | [2nd Sample](https://github.com/mybatis/spring-boot-starter/tree/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-xml) | Shows how to use a Mapper that has its statements in an xml file and Dao that uses an `SqlSessionTemplate`. |
| JVM Language | [3rd Sample](https://github.com/mybatis/spring-boot-starter/tree/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-kotlin) | Shows how to use with kotlin. |
|              | [4th Sample](https://github.com/mybatis/spring-boot-starter/tree/master/mybatis-spring-boot-samples/mybatis-spring-boot-sample-groovy) | Shows how to use with groovy. |


text:
from django.contrib import admin

from mls_api import models

class PlayerAdmin(admin.ModelAdmin):
    pass

class PlayerTabularInline(admin.TabularInline):
    model = models.Player

class GameAdmin(admin.ModelAdmin):
    pass

class CompetitionAdmin(admin.ModelAdmin):
    prepopulated_fields = {'slug': ('name',)}

class TeamAdmin(admin.ModelAdmin):
    prepopulated_fields = {'slug': ('name',)}
    inlines = [
        PlayerTabularInline,
    ]

class GamePlayerAdmin(admin.ModelAdmin):
    pass

admin.site.register(models.Team, TeamAdmin)
admin.site.register(models.Competition, CompetitionAdmin)
admin.site.register(models.Player, PlayerAdmin)
admin.site.register(models.Game, GameAdmin)
admin.site.register(models.GamePlayer, GamePlayerAdmin)
admin.site.register(models.FormationPlayer)
admin.site.register(models.FormationLine)
admin.site.register(models.Formation)


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

class Produtos extends CI_Controller
{

    private $categorias;

    public function __construct()
    {
        parent::__construct();
        $this->load->model('Categorias_model', 'modelcategorias');
        $this->categorias = $this->modelcategorias->listar_categorias();
        $this->load->model('Produtos_model', 'modelprodutos');
        $this->load->model('Usuarios_model', 'modelusuarios');
        $this->modelusuarios->validar($this->router->class, $this->router->method);
    }

    public function index($pular = null)
    {
        $this->load->library('table');
        $this->load->library('pagination');
        $config['base_url'] = base_url("administracao/produtos/index");
        $config['total_rows'] = $this->modelprodutos->contar();
        $produtos_por_pagina = 5;
        $config['per_page'] = $produtos_por_pagina;
        $this->pagination->initialize($config);
        $dados['links_paginacao'] = $this->pagination->create_links();
        $dados['produtos'] = $this->modelprodutos->listar($pular, $produtos_por_pagina);
        $dados['categorias'] = $this->categorias;
        $this->load->view('administracao/html_header');
        $this->load->view('administracao/header');
        $this->load->view('administracao/produtos', $dados);
        $this->load->view('administracao/footer');
        $this->load->view('administracao/html_footer');
    }

    public function adicionar()
    {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('txt_codigo', 'Código', 'required|min_length[3]|is_unique[produtos.codigo]');
        $this->form_validation->set_rules('txt_titulo', 'Nome da categoria', 'required|min_length[3]');
        $this->form_validation->set_rules('txt_preco', 'Preço', 'required|decimal|min_length[3]');
        $this->form_validation->set_rules('txt_largura_caixa_mm', 'Largura (mm)', 'required|integer|min_length[3]');
        $this->form_validation->set_rules('txt_altura_caixa_mm', 'Altura (mm)', 'required|integer|min_length[3]');
        $this->form_validation->set_rules('txt_comprimento_caixa_mm', 'Comprimento (mm)', 'required|integer|min_length[3]');
        $this->form_validation->set_rules('txt_peso_gramas', 'Peso (gramas)', 'required|integer|min_length[2]');
        $this->form_validation->set_rules('txt_descricao', 'Descricao', 'required|min_length[30]');
        if ($this->form_validation->run() == FALSE) {
            $this->index();
        } else {
            $codigo = $this->input->post('txt_codigo');
            $titulo = $this->input->post('txt_titulo');
            $preco = $this->input->post('txt_preco');
            $largura = $this->input->post('txt_largura_caixa_mm');
            $altura = $this->input->post('txt_altura_caixa_mm');
            $comprimento = $this->input->post('txt_comprimento_caixa_mm');
            $peso = $this->input->post('txt_peso_gramas');
            $descricao = $this->input->post('txt_descricao');
            $categoriaid = $this->input->post('categorias');
            if ($this->modelprodutos->adicionar($codigo, $titulo, $preco, $largura, $altura, $comprimento, $peso, $descricao, $categoriaid)) {
                redirect(base_url('administracao/produtos'));
            } else {
                echo "Houve um erro ao cadastrar a categoria.";
            }
        }
    }

    public function alterar($produto)
    {
        $dados['produto'] = $this->modelprodutos->detalhes_produto($produto);
        $this->load->view('administracao/html_header');
        $this->load->view('administracao/header');
        $this->load->view('administracao/alterar_produto', $dados);
        $this->load->view('administracao/footer');
        $this->load->view('administracao/html_footer');
    }

    public function salvar_alteracoes()
    {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('txt_codigo', 'Código', 'required|min_length[3]');
        $this->form_validation->set_rules('txt_titulo', 'Nome da categoria', 'required|min_length[3]');
        $this->form_validation->set_rules('txt_preco', 'Preço', 'required|decimal|min_length[3]');
        $this->form_validation->set_rules('txt_largura_caixa_mm', 'Largura (mm)', 'required|integer|min_length[3]');
        $this->form_validation->set_rules('txt_altura_caixa_mm', 'Altura (mm)', 'required|integer|min_length[3]');
        $this->form_validation->set_rules('txt_comprimento_caixa_mm', 'Comprimento (mm)', 'required|integer|min_length[3]');
        $this->form_validation->set_rules('txt_peso_gramas', 'Peso (gramas)', 'required|integer|min_length[2]');
        $this->form_validation->set_rules('txt_descricao', 'Descricao', 'required|min_length[30]');
        if ($this->form_validation->run() == FALSE) {
            //$this->index();
            echo "Houve um erro ao cadastrar o produto.";
        } else {

            $id = $this->input->post('id');
            $codigo = $this->input->post('txt_codigo');
            $titulo = $this->input->post('txt_titulo');
            $preco = $this->input->post('txt_preco');
            $largura = $this->input->post('txt_largura_caixa_mm');
            $altura = $this->input->post('txt_altura_caixa_mm');
            $comprimento = $this->input->post('txt_comprimento_caixa_mm');
            $peso = $this->input->post('txt_peso_gramas');
            $descricao = $this->input->post('txt_descricao');
            if ($this->modelprodutos->salvar_alteracoes($id, $codigo, $titulo, $preco, $largura, $altura, $comprimento, $peso, $descricao)) {
                redirect(base_url('administracao/produtos/alterar/' . $id));
            } else {
                echo "Houve um erro ao cadastrar o produto.";
            }
        }
    }

    public function nova_foto()
    {
        $id = $this->input->post('id');
        $config['upload_path'] = './assets/img/produtos';
        $config['allowed_types'] = 'jpg';
        $config['file_name'] = $id . ".jpg";
        $config['overwrite'] = TRUE;
        $this->load->library('upload', $config);
        if (!$this->upload->do_upload()) {
            echo $this->upload->display_errors();
        } else {
            $config2['source_image'] = './assets/img/produtos/' . $id . '.jpg';
            $config2['create_thumb'] = FALSE;
            $config2['width'] = 400;
            $config2['height'] = 400;
            $this->load->library('image_lib', $config2);
            if ($this->image_lib->resize()) {
                redirect(base_url('administracao/produtos/alterar/' . $id));
            } else {
                echo $this->image_lib->display_errors();
            }
        }
    }

    public function excluir($produto)
    {
        if ($this->modelprodutos->excluir($produto)) {
            redirect(base_url('administracao/produtos'));
        } else {
            echo "Houve um erro ao excluir o produto.";
        }
    }
}


text:
using System;
using OpenQA.Selenium;
using TestStack.Seleno.PageObjects;
using TestStack.Seleno.PageObjects.Actions;
using TestStack.Seleno.Tests.Specify;
using TestStack.Seleno.Tests.TestObjects;
using NSubstitute;
using FluentAssertions;
using By = TestStack.Seleno.PageObjects.Locators.By;

namespace TestStack.Seleno.Tests.PageObjects.Actions.Navigator
{
    class PageNavigatorJQueryBySpecs : SpecificationFor<PageNavigator>
    {
        private TestPage _page;
        private readonly TestPage _expectedPage = new TestPage();
        private readonly By.jQueryBy _jquerySelector = By.jQuery("selector");
        private Action<IWebElement> _action;

        public override void EstablishContext()
        {
            SubstituteFor<IComponentFactory>().CreatePage<TestPage>().Returns(_expectedPage);
            SubstituteFor<IExecutor>().ActionOnLocator(Arg.Any<By.jQueryBy>(), Arg.Do<Action<IWebElement>>(a => _action = a));
        }

        public void When_navigating_by_jquery()
        {
            _page = SUT.To<TestPage>(_jquerySelector);
        }

        public void Then_navigate_using_jquery_selector()
        {
            SubstituteFor<IExecutor>().Received().ActionOnLocator(_jquerySelector, Arg.Any<Action<IWebElement>>());
            var webElement = Substitute.For<IWebElement>();
            _action(webElement);
            webElement.Received().Click();
        }

        public void And_return_initialised_page()
        {
            _page.Should().Be(_expectedPage);
        }
    }
}


text:
package at.magiun.core.statistics

import at.magiun.core.model.data.{DatasetMetadata, Distribution, VariableType}
import at.magiun.core.model.ontology.OntologyClass
import at.magiun.core.{MainModule, UnitTest}

class AlgorithmRecommenderTest extends UnitTest {

  private val mainModule = new MainModule {}
  private val algorithmRecommender = mainModule.algorithmRecommender
  private val spark = mainModule.spark
  private val ontology = mainModule.algorithmOntology

  it should s"recommend the ${OntologyClass.LinearLeastRegression.toString} for dataset metadata of a small dataset" in {
    val datasetMetadata = DatasetMetadata(
      VariableType.Continuous,
      Distribution.Normal,
      0.9,
      0.95,
      200,
      30,
      6000
    )

    val recommendations = algorithmRecommender.recommend(datasetMetadata)

    recommendations.size should be(3)
    recommendations should contain(OntologyClass.Algorithm)
    recommendations should contain(OntologyClass.Regression)
    recommendations should contain(OntologyClass.LinearLeastRegression)
  }

  it should s"not recommend ${OntologyClass.LinearLeastRegression.toString} for dataset with percentage of normal distribution < 0.8" in {
    val datasetMetadata = DatasetMetadata(
      VariableType.Continuous,
      Distribution.Normal,
      0.7,
      0.95,
      200,
      30,
      6000
    )

    val recommendations = algorithmRecommender.recommend(datasetMetadata)

    recommendations.size should be(2)
    recommendations shouldNot contain(OntologyClass.LinearLeastRegression)
  }

  it should s"not recommend ${OntologyClass.LinearLeastRegression.toString} for dataset with percentage of continuous variably tye < 0.8" in {
    val datasetMetadata = DatasetMetadata(
      VariableType.Continuous,
      Distribution.Normal,
      0.95,
      0.7,
      200,
      30,
      6000
    )

    val recommendations = algorithmRecommender.recommend(datasetMetadata)

    recommendations.size should be(2)
    recommendations shouldNot contain(OntologyClass.LinearLeastRegression)
  }

  it should s"not recommend ${OntologyClass.LinearLeastRegression.toString} for dataset with observation-variable ratio < 20" in {
    val datasetMetadata = DatasetMetadata(
      VariableType.Continuous,
      Distribution.Normal,
      0.95,
      0.7,
      200,
      10,
      6000
    )

    val recommendations = algorithmRecommender.recommend(datasetMetadata)

    recommendations.size should be(2)
    recommendations shouldNot contain(OntologyClass.LinearLeastRegression)
  }
}


text:
ssh-keyscan master > /home/vagrant/.ssh/known_hosts
ssh-keyscan execd1 >> /home/vagrant/.ssh/known_hosts
ssh-keyscan execd2 >> /home/vagrant/.ssh/known_hosts
chmod 0600 /home/vagrant/.ssh/known_hosts
chown vagrant /home/vagrant/.ssh/known_hosts

ssh-keyscan master > /root/.ssh/known_hosts
ssh-keyscan execd1 >> /root/.ssh/known_hosts
ssh-keyscan execd2 >> /root/.ssh/known_hosts
chmod 0600 /root/.ssh/known_hosts

# Expected to have the UGE demo tar.gz here in vagrant directory
# if you don't have then download them from http://www.univa.com

# 1.) Extract UGE packages in subdirectory
if [ -d /vagrant/UGE ]; then
   rm -rf /vagrant/UGE
fi
mkdir /vagrant/UGE
cd /vagrant/UGE

# Select which UGE version is going to be installed.
# When the demo tar.gz verion specifed exists (can be
# downloaded from www.univa.com for free), we take
# them. Otherwise we check if a uge-lx-amd64.tar.gz
# and a uge-common.gar.gz exits. This I use for for
# setting a symlink to a specific version I want
# to install.

#VERSION="8.1.5-demo"
#VERSION="8.3.1p6-demo"
#VERSION="8.3.1p7"
VERSION="8.4.0-demo"

if [ -f ../ge-$VERSION-bin-lx-amd64.tar.gz ]; then
   tar zxvpf ../ge-$VERSION-bin-lx-amd64.tar.gz
   tar zxvpf ../ge-$VERSION-common.tar.gz
elif [ -f ../uge-lx-amd64.tar.gz ]; then
   tar zxvfp ../uge-lx-amd64.tar.gz
   tar zxvfp ../uge-common.tar.gz
else
   echo "NO UGE PACKES FOUND! ABORTING!"
   exit 1
fi

# 2.) Perfom auto installation
echo "Starting auto-installation of Univa Grid Engine"
export TERM=xterm
./inst_sge -m -x -auto ../auto_install_template

# 2.1) Adapt the cluster (/bin/csh is not installed in box)
source /vagrant/UGE/default/common/settings.sh
# change shell to /bin/sh from /bin/csh
qconf -mattr queue shell /bin/sh all.q

# 3.) Change .bashrc of vagrant/root user in order to source UGE environment
echo "source /vagrant/UGE/default/common/settings.sh" >> /home/vagrant/.bashrc
echo "source /vagrant/UGE/default/common/settings.sh" >> /root/.bashrc

# FINISHED
echo "Installation of UGE finished"

# Install gcc
echo Installing GCC
yum install -y gcc

# EPEL package support installation
cd
wget http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
rpm -ivh epel-release-7-8.noarch.rpm

# GOLANG support
yum install -y golang

echo "/nfs   192.168.10.0/24(rw,async)" >> /etc/exports
echo "portmap: 192.168.10.0/24" >> /etc/hosts.allow
service nfs restart
service nfs-server restart
ssh execd1 mount /nfs
ssh execd2 mount /nfs


text:
_**Important: This package will not be further developed and supported. Please consider switching to our new pytorch-based package [SchNetPack](https://github.com/atomistic-machine-learning/schnetpack)!**_

SchNet is a deep learning architecture that allows for spatially and chemically
resolved insights into quantum-mechanical observables of atomistic systems.

Requirements:
- python 3.4
- ASE
- numpy
- tensorflow (>=1.0)

See the `scripts` folder for training and evaluation of SchNet
model for predicting the total energy (U0) for the GDB-9 data set.

## Install

    python3 setup.py install

## Examples

### QM9

Download and convert QM9 data set:

    python3 load_qm9.py <qm9destination>

Train QM9 energy (U0) prediction:

    python3 train_energy_force.py <qm9destination>/qm9.db ./modeldir ./split50k.npz
        --ntrain 50000 --nval 10000 --fit_energy --atomref <qm9destination>/atomref.npz

### Potential energy surface

Predict force and energy for fullerene C20 configuration

    python scripts/example_md_predictor.py ./models/c20/ ./models/c20/C20.xyz

Relax geometry:

    python scripts/example_md_predictor.py ./models/c20/ ./models/c20/C20.xyz --relax

## References

If you use SchNet in your research, please cite:

*K.T. Schütt. P.-J. Kindermans, H. E. Sauceda, S. Chmiela, A. Tkatchenko, K.-R. Müller.
SchNet: A continuous-filter convolutional neural network for modeling quantum interactions.*
Advances in Neural Information Processing Systems 30, pp. 992-1002 (2017)

*K.T. Schütt. F. Arbabzadah. S. Chmiela, K.-R. Müller, A. Tkatchenko.
Quantum-chemical insights from deep tensor neural networks.*
Nature Communications **8**. 13890 (2017)
doi: [10.1038/ncomms13890](http://dx.doi.org/10.1038/ncomms13890)


text:
using namespace cppexpose;
using std::string;

template <typename T>
class StoredValueInstantiation_test : public testing::Test
{
public:
    StoredValueInstantiation_test()
    {
    }

protected:
};

typedef ::testing::Types<bool, float, double, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, string, std::array<int, 4>> InstantiationTypes;
TYPED_TEST_CASE(StoredValueInstantiation_test, InstantiationTypes);

// StoredValue instantiaton (read/write)

TYPED_TEST(StoredValueInstantiation_test, instantiateStoredValue)
{
    auto storedVal = cppassist::make_unique<StoredValue<TypeParam>>();

    ASSERT_EQ(typeid(typename std::remove_cv<TypeParam>::type), storedVal->type());
}


text:
#include <linux/interrupt.h>
#include <linux/gpio.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/sysfs.h>

#include "../iio.h"
#include "../ring_generic.h"
#include "../ring_sw.h"
#include "../trigger.h"
#include "../sysfs.h"

#include "ad7606.h"

int ad7606_scan_from_ring(struct iio_dev *indio_dev, unsigned ch)
{
	struct iio_ring_buffer *ring = indio_dev->ring;
	int ret;
	u16 *ring_data;

	ring_data = kmalloc(ring->access->get_bytes_per_datum(ring),
			    GFP_KERNEL);
	if (ring_data == NULL) {
		ret = -ENOMEM;
		goto error_ret;
	}
	ret = ring->access->read_last(ring, (u8 *) ring_data);
	if (ret)
		goto error_free_ring_data;

	ret = ring_data[ch];

error_free_ring_data:
	kfree(ring_data);
error_ret:
	return ret;
}

/**
 * ad7606_ring_preenable() setup the parameters of the ring before enabling
 *
 * The complex nature of the setting of the nuber of bytes per datum is due
 * to this driver currently ensuring that the timestamp is stored at an 8
 * byte boundary.
 **/
static int ad7606_ring_preenable(struct iio_dev *indio_dev)
{
	struct ad7606_state *st = iio_priv(indio_dev);
	struct iio_ring_buffer *ring = indio_dev->ring;
	size_t d_size;

	d_size = st->chip_info->num_channels *
		 st->chip_info->channels[0].scan_type.storagebits / 8;

	if (ring->scan_timestamp) {
		d_size += sizeof(s64);

		if (d_size % sizeof(s64))
			d_size += sizeof(s64) - (d_size % sizeof(s64));
	}

	if (ring->access->set_bytes_per_datum)
		ring->access->set_bytes_per_datum(ring, d_size);

	st->d_size = d_size;

	return 0;
}

/**
 * ad7606_trigger_handler_th() th/bh of trigger launched polling to ring buffer
 *
 **/
static irqreturn_t ad7606_trigger_handler_th_bh(int irq, void *p)
{
	struct iio_poll_func *pf = p;
	struct iio_dev *indio_dev = pf->private_data;
	struct ad7606_state *st = iio_priv(indio_dev);

	gpio_set_value(st->pdata->gpio_convst, 1);

	return IRQ_HANDLED;
}

/**
 * ad7606_poll_bh_to_ring() bh of trigger launched polling to ring buffer
 * @work_s:	the work struct through which this was scheduled
 *
 * Currently there is no option in this driver to disable the saving of
 * timestamps within the ring.
 * I think the one copy of this at a time was to avoid problems if the
 * trigger was set far too high and the reads then locked up the computer.
 **/
static void ad7606_poll_bh_to_ring(struct work_struct *work_s)
{
	struct ad7606_state *st = container_of(work_s, struct ad7606_state,
						poll_work);
	struct iio_dev *indio_dev = iio_priv_to_dev(st);
	struct iio_ring_buffer *ring = indio_dev->ring;
	s64 time_ns;
	__u8 *buf;
	int ret;

	buf = kzalloc(st->d_size, GFP_KERNEL);
	if (buf == NULL)
		return;

	if (st->have_frstdata) {
		ret = st->bops->read_block(st->dev, 1, buf);
		if (ret)
			goto done;
		if (!gpio_get_value(st->pdata->gpio_frstdata)) {
			/* This should never happen. However
			 * some signal glitch caused by bad PCB desgin or
			 * electrostatic discharge, could cause an extra read
			 * or clock. This allows recovery.
			 */
			ad7606_reset(st);
			goto done;
		}
		ret = st->bops->read_block(st->dev,
			st->chip_info->num_channels - 1, buf + 2);
		if (ret)
			goto done;
	} else {
		ret = st->bops->read_block(st->dev,
			st->chip_info->num_channels, buf);
		if (ret)
			goto done;
	}

	time_ns = iio_get_time_ns();

	if (ring->scan_timestamp)
		memcpy(buf + st->d_size - sizeof(s64),
			&time_ns, sizeof(time_ns));

	ring->access->store_to(indio_dev->ring, buf, time_ns);
done:
	gpio_set_value(st->pdata->gpio_convst, 0);
	iio_trigger_notify_done(indio_dev->trig);
	kfree(buf);
}

static const struct iio_ring_setup_ops ad7606_ring_setup_ops = {
	.preenable = &ad7606_ring_preenable,
	.postenable = &iio_triggered_ring_postenable,
	.predisable = &iio_triggered_ring_predisable,
};

int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev)
{
	struct ad7606_state *st = iio_priv(indio_dev);
	int ret;

	indio_dev->ring = iio_sw_rb_allocate(indio_dev);
	if (!indio_dev->ring) {
		ret = -ENOMEM;
		goto error_ret;
	}

	/* Effectively select the ring buffer implementation */
	indio_dev->ring->access = &ring_sw_access_funcs;
	indio_dev->pollfunc = iio_alloc_pollfunc(&ad7606_trigger_handler_th_bh,
						 &ad7606_trigger_handler_th_bh,
						 0,
						 indio_dev,
						 "%s_consumer%d",
						 indio_dev->name,
						 indio_dev->id);
	if (indio_dev->pollfunc == NULL) {
		ret = -ENOMEM;
		goto error_deallocate_sw_rb;
	}

	/* Ring buffer functions - here trigger setup related */

	indio_dev->ring->setup_ops = &ad7606_ring_setup_ops;
	indio_dev->ring->scan_timestamp = true ;

	INIT_WORK(&st->poll_work, &ad7606_poll_bh_to_ring);

	/* Flag that polled ring buffering is possible */
	indio_dev->modes |= INDIO_RING_TRIGGERED;
	return 0;

error_deallocate_sw_rb:
	iio_sw_rb_free(indio_dev->ring);
error_ret:
	return ret;
}

void ad7606_ring_cleanup(struct iio_dev *indio_dev)
{
	if (indio_dev->trig) {
		iio_put_trigger(indio_dev->trig);
		iio_trigger_dettach_poll_func(indio_dev->trig,
					      indio_dev->pollfunc);
	}
	iio_dealloc_pollfunc(indio_dev->pollfunc);
	iio_sw_rb_free(indio_dev->ring);
}


text:
import { connect } from 'react-redux';
import { selectFollowedTags } from 'redux/selectors/tags';
import { selectMutedChannels } from 'redux/selectors/blocked';
import { selectSubscriptions } from 'redux/selectors/subscriptions';
import { selectHomepageData } from 'redux/selectors/settings';
import ChannelsFollowingManagePage from './view';

const select = (state) => ({
  followedTags: selectFollowedTags(state),
  subscribedChannels: selectSubscriptions(state),
  blockedChannels: selectMutedChannels(state),
  homepageData: selectHomepageData(state),
});

export default connect(select)(ChannelsFollowingManagePage);


text:
package com.google.idea.blaze.base.lang.buildfile.references;

import com.google.idea.blaze.base.lang.buildfile.completion.FilePathLookupElement;
import com.google.idea.blaze.base.lang.buildfile.psi.BuildFile;
import com.google.idea.blaze.base.lang.buildfile.psi.StringLiteral;
import com.google.idea.blaze.base.lang.buildfile.search.BlazePackage;
import com.google.idea.blaze.base.model.primitives.Label;
import com.google.idea.blaze.base.model.primitives.WorkspacePath;
import com.google.idea.blaze.base.settings.Blaze;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NullableLazyValue;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileFilter;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.util.PathUtil;
import com.intellij.util.PlatformIcons;
import icons.BlazeIcons;
import javax.annotation.Nullable;
import javax.swing.Icon;

/** The data relevant to finding file lookups. */
public class FileLookupData {

  /** The type of path string format */
  public enum PathFormat {
    /** BUILD label without a leading '//', which can only reference targets in the same package. */
    PackageLocal,
    /** a BUILD label with leading '//', which can reference targets in other packages. */
    NonLocal,
    /** a path string which can reference any files, and has no leading '//'. */
    NonLocalWithoutInitialBackslashes,
    /** a path string referencing only directories, with no leading '//'. */
    NonLocalWithoutInitialBackslashesOnlyDirectories,
  }

  @Nullable
  public static FileLookupData nonLocalFileLookup(String originalLabel, StringLiteral element) {
    return nonLocalFileLookup(
        originalLabel, element.getContainingFile(), element.getQuoteType(), PathFormat.NonLocal);
  }

  @Nullable
  public static FileLookupData nonLocalFileLookup(
      String originalLabel,
      @Nullable BuildFile containingFile,
      QuoteType quoteType,
      PathFormat pathFormat) {
    if (originalLabel.indexOf(':') != -1) {
      // it's a package-local reference
      return null;
    }
    // handle the single '/' case by calling twice.
    String relativePath = StringUtil.trimStart(StringUtil.trimStart(originalLabel, "/"), "/");
    if (relativePath.startsWith("/")) {
      return null;
    }
    boolean onlyDirectories = pathFormat != PathFormat.NonLocalWithoutInitialBackslashes;
    VirtualFileFilter filter = vf -> !onlyDirectories || vf.isDirectory();
    return new FileLookupData(
        originalLabel, containingFile, null, relativePath, pathFormat, quoteType, filter);
  }

  @Nullable
  public static FileLookupData packageLocalFileLookup(String originalLabel, StringLiteral element) {
    if (originalLabel.startsWith("/")) {
      return null;
    }
    BlazePackage blazePackage = element.getBlazePackage();
    BuildFile baseBuildFile = blazePackage != null ? blazePackage.buildFile : null;
    return packageLocalFileLookup(originalLabel, element, baseBuildFile, null);
  }

  @Nullable
  public static FileLookupData packageLocalFileLookup(
      String originalLabel,
      StringLiteral element,
      @Nullable BuildFile basePackage,
      @Nullable VirtualFileFilter fileFilter) {
    if (basePackage == null) {
      return null;
    }
    Label packageLabel = basePackage.getPackageLabel();
    if (packageLabel == null) {
      return null;
    }
    String basePackagePath = packageLabel.blazePackage().relativePath();
    String filePath = basePackagePath + "/" + LabelUtils.getRuleComponent(originalLabel);
    return new FileLookupData(
        originalLabel,
        basePackage,
        basePackagePath,
        filePath,
        PathFormat.PackageLocal,
        element.getQuoteType(),
        fileFilter);
  }

  private final String originalLabel;
  private final BuildFile containingFile;
  @Nullable private final String containingPackage;
  public final String filePathFragment;
  public final PathFormat pathFormat;
  private final QuoteType quoteType;
  @Nullable private final VirtualFileFilter fileFilter;

  private FileLookupData(
      String originalLabel,
      @Nullable BuildFile containingFile,
      @Nullable String containingPackage,
      String filePathFragment,
      PathFormat pathFormat,
      QuoteType quoteType,
      @Nullable VirtualFileFilter fileFilter) {

    this.originalLabel = originalLabel;
    this.containingFile = containingFile;
    this.containingPackage = containingPackage;
    this.fileFilter = fileFilter;
    this.filePathFragment = filePathFragment;
    this.pathFormat = pathFormat;
    this.quoteType = quoteType;

    assert (pathFormat != PathFormat.PackageLocal
        || (containingPackage != null && containingFile != null));
  }

  public boolean acceptFile(Project project, VirtualFile file) {
    if (fileFilter != null && !fileFilter.accept(file)) {
      return false;
    }
    if (pathFormat != PathFormat.PackageLocal) {
      return true;
    }
    if (file.equals(containingFile.getOriginalFile().getVirtualFile())) {
      return false;
    }
    boolean blazePackage =
        Blaze.getBuildSystemProvider(project).findBuildFileInDirectory(file) != null;
    return !blazePackage;
  }

  public FilePathLookupElement lookupElementForFile(
      Project project, VirtualFile file, @Nullable WorkspacePath workspacePath) {
    NullableLazyValue<Icon> icon =
        new NullableLazyValue<Icon>() {
          @Override
          protected Icon compute() {
            if (file.findChild("BUILD") != null) {
              return BlazeIcons.BuildFile;
            }
            if (file.isDirectory()) {
              return PlatformIcons.FOLDER_ICON;
            }
            PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
            return psiFile != null ? psiFile.getIcon(0) : AllIcons.FileTypes.Any_type;
          }
        };
    String fullLabel =
        workspacePath != null ? getFullLabel(workspacePath.relativePath()) : file.getPath();
    String itemText = workspacePath != null ? getItemText(workspacePath.relativePath()) : fullLabel;
    return new FilePathLookupElement(fullLabel, itemText, quoteType, icon);
  }

  private String getFullLabel(String relativePath) {
    if (pathFormat != PathFormat.PackageLocal) {
      if (pathFormat == PathFormat.NonLocal) {
        relativePath = "//" + relativePath;
      }
      return relativePath;
    }
    String prefix;
    int colonIndex = originalLabel.indexOf(':');
    if (originalLabel.startsWith("/")) {
      prefix = colonIndex == -1 ? originalLabel + ":" : originalLabel.substring(0, colonIndex + 1);
    } else {
      prefix = originalLabel.substring(0, colonIndex + 1);
    }
    return prefix + getItemText(relativePath);
  }

  private String getItemText(String relativePath) {
    if (pathFormat == PathFormat.PackageLocal) {
      if (containingPackage.length() > relativePath.length()) {
        return "";
      }
      return StringUtil.trimStart(relativePath.substring(containingPackage.length()), "/");
    }
    String parentPath = PathUtil.getParentPath(relativePath);
    while (!parentPath.isEmpty()) {
      if (filePathFragment.startsWith(parentPath + "/")) {
        return StringUtil.trimStart(relativePath, parentPath + "/");
      } else if (filePathFragment.startsWith(parentPath)) {
        return StringUtil.trimStart(relativePath, parentPath);
      }
      parentPath = PathUtil.getParentPath(parentPath);
    }
    return relativePath;
  }
}


text:
> Trying to implement websockets in Python with the help of the package from [Websocketd.com](http://websocketd.com/)

## Instructions to run:
* Download the Websocketd binary from the above link
* Make sure that you have installed Python2 with sqlite3 module
* Clone the repo to your system and enter into the directory
* Make note of your systems IP address
* Change the IP address in deptNotes.html file on line 21 as shown:
```javascript
  var ws = new WebSocket('ws://0.0.0.0:8080/');
```
* Run python webserver with the following command:
~~~
>> python -m SimpleHTTPServer 8181
~~~
* Run the websocket server with the following command:
~~~
>> websocketd --port 8080 python wsUpdate.py
~~~
* In the web browser/s enter the path for the hosted page as shown:
~~~
http://<your-IP-address>:8181/deptNotes.html
~~~
Let me know whar you think.


text:
This notebook uses a variety of methods to generate compression dictionaries for a database of Shakespeare text

Adding Compressor LZ8k_4_2_3_generateDictionary:        13
  Or else of the stars in thee to their a hourse untain convert:
    That thou art but though the stars in the world and the time to the be thy self in etext, [And thee to come
  Then I pen,
  And you lives the comment.
     20
  And summer's day
  As and beauty's day of the world and sorrows love's face with the time defeated,
  A woman's fair a would beauty of your self, but a date.
  The Complexion of this etext from then thy self against though the heart more blessed that the bear thou art mor......

Adding Compressor LZ8k_4_2_3_generateMarkov: But
 enefore do thies than my mine own thy conted to bright,
  Who lov'st they shall indem INC., AND And in wand seem sheaves, the takes first-born fair age)
  Dever all not so,
  Sternal cold and all a-
jeecked theirs,
    28

I Lce well
  Be stay keeps yet me blic domain and for ever shakespeare,
    Make think of thee the streasure....

Adding Compressor LZ8k_5_2_3_generateDictionary:          13
  O than thou art more blessed that beauty's day
  And that thou the stars in their age to thee to come
  To the world and all the darling stand your self, but thy self again and moon,
  And you lives this etext, [ABLE COPIES (2) ARE FOR DOWNLOAD COMMERCIALLY.  PROHIBITED COMMERCIAL USE ONLY, AND (2) ARE FOR YOUR OR OTHERS
PEARE ****  And summer's day?
  That the etext in thy self in eternal cold?
  Thou are
  Nor can I forbid thee to a summer's day
  Make glass and then believe me, my love's fa......

Adding Compressor LZ8k_5_2_3_generateMarkov: rts, death before love's leaves,
    Let there love's lendows gifeye me....

Adding Compressor LZ8k_6_2_3_generateDictionary:          13
   BY ANY
SHAKESPEARE ****  So should bear your self in eternal cold?

  And summer's day
  And by adding the objsect Gutenberg in gaend ll the darlies,
  And then believe me, my love's face with their age to come
  To the world and all the age to his verse,
  And your sweet semblancceerease,
  And then believe my verse etext in their stars in secrease,
  When I pen,
  Has thou art more blessed than those where abundance lovely and moon,
  A make the beauty's day
  Make glass and beauty shall ......

Adding Compressor LZ8k_6_2_3_generateMarkov: ut flaaid metranight,
  An shines, sohfirs tded huse bge IeNrom Andts oilere all heaven finly  Aslf hlen db.u...

Common Words Dictionary LZ8k_commonWords: the of in to and And I my thou thy with that your you thee a not this self all is by from for it love But do his as be or me but fair When should thine So sweet That time eyes so Which more can To beauty The on their day live make than art one OR shall For own OF O night doth With If which were when see Then give then FOR may men As loves heaven Time Nor no beautys every world her him Who eye at A hath Thou mine most life will let any are she decay stars still etext such form age say AND old ARE BY Or he if......

field | sum | avg | stddev | nulls
----- | --- | --- | ------ | -----
BZ0.compressMs                             | 190.7361 | 1.9463 | 0.3409 | 2
BZ0.compressed                             | 32701.0000 | 333.6837 | 114.9140 | 2
BZ0.uncompressMs                           | 24.7510 | 0.2526 | 0.0404 | 2
BZ0.uncompressed                           | 50402.0000 | 525.0208 | 221.1105 | 4
LZ0.compressMs                             | 51.0048 | 0.5152 | 0.3057 | 1
LZ0.compressed                             | 30083.0000 | 303.8687 | 115.4449 | 1
LZ0.uncompressMs                           | 2.7045 | 0.0276 | 0.0072 | 2
LZ0.uncompressed                           | 51619.0000 | 521.4040 | 223.2918 | 1
LZ8k_4_2_3_generateDictionary.compressMs   | 64.4263 | 0.6574 | 0.2987 | 2
LZ8k_4_2_3_generateDictionary.compressed   | 25379.0000 | 258.9694 | 105.5585 | 2
LZ8k_4_2_3_generateDictionary.uncompressMs | 15.7999 | 0.1629 | 0.1611 | 3
LZ8k_4_2_3_generateDictionary.uncompressed | 51619.0000 | 521.4040 | 223.2918 | 1
LZ8k_4_2_3_generateMarkov.compressMs       | 60.2785 | 0.6151 | 0.2991 | 2
LZ8k_4_2_3_generateMarkov.compressed       | 28849.0000 | 294.3776 | 111.6229 | 2
LZ8k_4_2_3_generateMarkov.uncompressMs     | 15.5916 | 0.1607 | 0.1862 | 3
LZ8k_4_2_3_generateMarkov.uncompressed     | 50729.0000 | 522.9794 | 223.5268 | 3
LZ8k_5_2_3_generateDictionary.compressMs   | 76.2603 | 0.7782 | 0.3510 | 2
LZ8k_5_2_3_generateDictionary.compressed   | 25855.0000 | 263.8265 | 103.7194 | 2
LZ8k_5_2_3_generateDictionary.uncompressMs | 16.6868 | 0.1703 | 0.1317 | 2
LZ8k_5_2_3_generateDictionary.uncompressed | 50998.0000 | 525.7526 | 222.9550 | 3
LZ8k_5_2_3_generateMarkov.compressMs       | 53.8619 | 0.5496 | 0.3073 | 2
LZ8k_5_2_3_generateMarkov.compressed       | 29652.0000 | 302.5714 | 113.7821 | 2
LZ8k_5_2_3_generateMarkov.uncompressMs     | 11.0381 | 0.1126 | 0.1024 | 2
LZ8k_5_2_3_generateMarkov.uncompressed     | 50939.0000 | 519.7857 | 223.8498 | 2
LZ8k_6_2_3_generateDictionary.compressMs   | 67.6617 | 0.6904 | 0.3575 | 2
LZ8k_6_2_3_generateDictionary.compressed   | 28364.0000 | 289.4286 | 112.8790 | 2
LZ8k_6_2_3_generateDictionary.uncompressMs | 16.6384 | 0.1715 | 0.1464 | 3
LZ8k_6_2_3_generateDictionary.uncompressed | 50314.0000 | 524.1042 | 221.2751 | 4
LZ8k_6_2_3_generateMarkov.compressMs       | 60.6022 | 0.6121 | 0.3297 | 1
LZ8k_6_2_3_generateMarkov.compressed       | 29978.0000 | 302.8081 | 112.9744 | 1
LZ8k_6_2_3_generateMarkov.uncompressMs     | 14.4643 | 0.1461 | 0.1429 | 1
LZ8k_6_2_3_generateMarkov.uncompressed     | 50522.0000 | 526.2708 | 220.6230 | 4
LZ8k_commonWords.compressMs                | 64.0420 | 0.6602 | 0.2719 | 3
LZ8k_commonWords.compressed                | 25517.0000 | 265.8021 | 112.6906 | 4
LZ8k_commonWords.uncompressMs              | 16.3719 | 0.1671 | 0.1211 | 2
LZ8k_commonWords.uncompressed              | 51619.0000 | 521.4040 | 223.2918 | 1


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<txg:Texgit xmlns:txg="http://gilmatryx.googlepages.com/Texgit"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://gilmatryx.googlepages.com/Texgit file:////home/gilmar/WORKSPACE/TexgitSchema.xsd"
	version="1.0-academic">

	<FlatFile>
		<layout>
			<name>Arquivo-RemessaCNAB400</name>
			<version>Version 08, Published: 02/01/2012</version>
			<description>
				XML para funcionamento com o Jrimum.
				Banco Real
				Cnab 400
				SWFactory Consultoria e Sistemas
				www.swfactory.com.br
				antoniorocha@gmail.com
			</description>
		</layout>
		<GroupOfRecords>
			<Record name="Header" description="Protocolo de comunicação" >
				<GroupOfFields>
					<IdType name="CodigoDoRegistro" value="0" length="1" position="1" />
					<Field name="CodigoRemessa" length="1" />
					<Field name="LiteralRemessa" length="7" value="REMESSA" />
					<Field name="CodigoServico" length="2" />
					<Field name="LiteralServico" length="15" value="COBRANCA" />
					<Field name="Filler" length="1" />
					<Field name="Agencia" length="4" padding="ZERO_LEFT" />
					<Field name="Filler" length="1" />
					<Field name="Conta" length="7" padding="ZERO_LEFT" />
					<Field name="Filler" length="7" padding="ZERO_LEFT" />
					<Field name="NomeEmpresa" length="30" />
					<Field name="CodigoBanco" length="3" padding="ZERO_LEFT" value="356" />
					<Field name="NomeBanco" length="15" value="BANCO REAL"/>
					<Field name="DataGravacao" length="6" type="DATE" format="DATE_DDMMYY" />
					<Field name="NumeroSequencialRemessa" length="8" padding="ZERO_LEFT" />
					<Field name="Filler" length="286" />
					<Field name="NumeroSequencialRegistro" length="6" padding="ZERO_LEFT" />
				</GroupOfFields>
			</Record>

			<Record name="TransacaoTitulo" repeatable="true">
				<GroupOfFields>
					<IdType name="CodigoRegistro" value="1" length="1" position="1" />
					<Field name="InscricaoEmpresa" length="2"  padding="ZERO_LEFT" />
					<Field name="NumeroInscricao" length="14" padding="ZERO_LEFT" />
					<Field name="Filler" length="1" padding="ZERO_LEFT" />
					<Field name="Agencia" length="4" padding="ZERO_LEFT" />
					<Field name="Filler" length="1" />
					<Field name="Conta" length="7" padding="ZERO_LEFT" />
					<Field name="Filler" length="7" />
					<Field name="UsoEmpresa" length="25" />
					<Field name="Filler" length="2" padding="ZERO_LEFT" />
					<Field name="NossoNumero" length="7" padding="ZERO_LEFT" />
					<Field name="Multa" length="1" />
					<Field name="DiasMulta" length="2" padding="ZERO_LEFT" />
					<Field name="TipoMulta" length="1" />
					<Field name="ValorMulta" length="13" type="BIGDECIMAL" format="DECIMAL_DD" padding="ZERO_LEFT" />
					<Field name="Filler" length="7" />
					<Field name="Contrato" length="9" padding="ZERO_LEFT" />
					<Field name="Filler" length="3" />
					<Field name="VariacaoCarteira" length="1" />
					<Field name="CodigoOcorrencia" length="2" type="INTEGER" value="1" padding="ZERO_LEFT" />
					<Field name="SeuNumero" length="10" />
					<Field name="Vencimento" length="6" />
					<Field name="ValorTitulo" length="13" type="BIGDECIMAL" format="DECIMAL_DD" padding="ZERO_LEFT" />
					<Field name="CodigoBanco" length="3" value="356" padding="ZERO_LEFT" />
					<Field name="AgenciaCobradora" length="5" padding="ZERO_LEFT" />
					<Field name="EspecieTitulo" length="2" padding="ZERO_LEFT" />
					<Field name="Aceite" length="1" />
					<Field name="DataEmissao" length="6" type="DATE" format="DATE_DDMMYY" />
					<Field name="DiasProtesto" length="2" padding="ZERO_LEFT" value="06" />
					<Field name="Filler" length="2" />
					<Field name="TipoJuros" length="1" />
					<Field name="ValorJuros" length="12" />
					<Field name="DataDesconto" length="6" padding="ZERO_LEFT" />
					<Field name="ValorDesconto" length="13" type="BIGDECIMAL" format="DECIMAL_DD" padding="ZERO_LEFT" />
					<Field name="IOC" length="13" type="BIGDECIMAL" format="DECIMAL_DD" padding="ZERO_LEFT"  />
					<Field name="ValorAbatimento" length="13" type="BIGDECIMAL" format="DECIMAL_DD" padding="ZERO_LEFT" />
					<Field name="TipoSacado" length="2" padding="ZERO_LEFT" />
					<Field name="DocumentoSacado" length="14" padding="ZERO_LEFT" />
					<Field name="NomeSacado" length="40" />
					<Field name="EnderecoSacado" length="40" />
					<Field name="BairroSacado" length="12" />
					<Field name="CepSacado" length="8" padding="ZERO_LEFT" />
					<Field name="CidadeSacado" length="15" />
					<Field name="EstadoSacado" length="2" />
					<Field name="SacadorAvalista" length="40" />
					<Field name="Moeda" length="1" padding="ZERO_LEFT"/>
					<Field name="TipoMoeda" length="2" padding="ZERO_LEFT" />
					<Field name="NumeroSequencialRegistro" length="6" padding="ZERO_LEFT" />
				</GroupOfFields>

			</Record>

			<Record name="Trailler">
				<GroupOfFields>
					<IdType name="CodigoDoRegistro" value="9" length="1" position="1" />
					<Field name="QuantidadeTitulos" length="6" />
					<Field name="ValorTotalTitulos" length="13" />
					<Field name="Filler" length="374" />
					<Field name="NumeroSequencialRegistro" length="6" padding="ZERO_LEFT" />
				</GroupOfFields>
			</Record>
		</GroupOfRecords>
	</FlatFile>

</txg:Texgit>