text:
import os
import shutil
import eos.log
import eos.tools
import eos.util

def _check_return_code(code):
    if code != 0:
        raise RuntimeError("repository operation failed")

def _remove_directory(directory):
    if os.path.exists(directory):
        shutil.rmtree(directory)

def _execute(command):
    print_command = eos.verbosity() > 1
    quiet = eos.verbosity() <= 2
    return eos.util.execute_command(command, print_command, quiet)

def _execute_and_capture_output(command):
    print_command = eos.verbosity() > 1
    return eos.util.execute_command_capture_output(command, print_command)

# -----

def hg_repo_exists(directory):
    # Is a more robust check possible? https://trac.sagemath.org/ticket/12128 says no.
    return os.path.exists(os.path.join(directory, ".hg"))

def git_repo_exists(directory):
    return (
        os.path.exists(os.path.join(directory, ".git"))
        and _execute_and_capture_output(eos.tools.command_git() + " -C " + directory + " rev-parse --git-dir")[0] == 0
    )

def hg_clone(url, directory):
    return _execute(eos.tools.command_hg() + " clone " + url + " " + directory)

def hg_pull(directory):
    return _execute(eos.tools.command_hg() + " pull -R " + directory)

def hg_purge(directory):
    return _execute(eos.tools.command_hg() + " purge -R " + directory + " --all --config extensions.purge=")

def hg_update_to_revision(directory, revision=None):
    if revision is None:
        revision = ""
    return _execute(eos.tools.command_hg() + " update -R " + directory + " -C " + revision)

def hg_update_to_branch_tip(directory, branch):
    return _execute(eos.tools.command_hg() + " update -R " + directory + " -C " + branch)

def hg_verify_commit_hash(directory, expected_commit_hash):
    rcode, out, err = _execute_and_capture_output(eos.tools.command_hg() + " -R " + directory + " --debug id -i")
    if rcode != 0:
        return False
    current_commit_hash = out
    hash_match = expected_commit_hash in current_commit_hash
    return hash_match

# -----

def git_clone(url, directory):
    return _execute(eos.tools.command_git() + " clone --recursive " + url + " " + directory)

def git_fetch(directory):
    return _execute(eos.tools.command_git() + " -C " + directory + " fetch --recurse-submodules")

def git_pull(directory):
    return _execute(eos.tools.command_git() + " -C " + directory + " pull --recurse-submodules")

def git_clean(directory):
    return _execute(eos.tools.command_git() + " -C " + directory + " clean -fxd")

def git_checkout(directory, branch=None):
    if branch is None:
        branch = ""  # making this effectively a no-op
    return _execute(eos.tools.command_git() + " -C " + directory + " checkout " + branch)

def git_submodule_update(directory):
    return _execute(eos.tools.command_git() + " -C " + directory + " submodule update")

def git_reset_to_revision(directory, revision=None):
    if revision is None:
        revision = "HEAD"
    return _execute(eos.tools.command_git() + " -C " + directory + " reset --hard " + revision)

def git_verify_commit_hash(directory, expected_commit_hash):
    rcode, out, err = _execute_and_capture_output(eos.tools.command_git() + " -C " + directory + " rev-parse HEAD")
    if rcode != 0:
        return False
    current_commit_hash = out
    hash_match = expected_commit_hash in current_commit_hash
    return hash_match

# -----

def svn_checkout(url, directory):
    return _execute(eos.tools.command_svn() + " checkout " + url + " " + directory)

# -----

def update_state_git(url, dst_dir, branch=None, revision=None):
    if not git_repo_exists(dst_dir):
        if url is None:
            return False
        _remove_directory(dst_dir)
        _check_return_code(git_clone(url, dst_dir))
    else:
        _check_return_code(git_clean(dst_dir))
        if url is not None:
            _check_return_code(git_fetch(dst_dir))

    if revision and revision != "":
        _check_return_code(git_reset_to_revision(dst_dir, revision))
    else:
        if not branch or branch == "":
            branch = "master"
        _check_return_code(git_checkout(dst_dir, branch))
        if url is not None:
            _check_return_code(git_pull(dst_dir))
    _check_return_code(git_submodule_update(dst_dir))

    if eos.util.is_sha1(revision) and not git_verify_commit_hash(dst_dir, revision):
        eos.log_error("SHA1 hash check failed")
        return False
    return True

def update_state_hg(url, dst_dir, branch=None, revision=None):
    if not hg_repo_exists(dst_dir):
        if url is None:
            return False
        _remove_directory(dst_dir)
        _check_return_code(hg_clone(url, dst_dir))
    else:
        _check_return_code(hg_purge(dst_dir))
        if url is not None:
            _check_return_code(hg_pull(dst_dir))

    if revision and revision != "":
        _check_return_code(hg_update_to_revision(dst_dir, revision))
    else:
        if not branch or branch == "":
            branch = "default"
        _check_return_code(hg_update_to_branch_tip(dst_dir, branch))

    if eos.util.is_sha1(revision) and not hg_verify_commit_hash(dst_dir, revision):
        eos.log_error("SHA1 hash check failed")
        return False
    return True

def update_state_svn(url, dst_dir, revision=None):
    _remove_directory(dst_dir)
    _check_return_code(svn_checkout(url, dst_dir))

    if revision and revision != "":
        eos.log_error("cannot update SVN repository to revision")
        return False
    return True

def update_state(repo_type, url, name, dst_dir, branch=None, revision=None):
    eos.log_verbose(
        "Updating repository for '"
        + name
        + "' (url = "
        + (url if url is not None else "")
        + ", target_dir = "
        + dst_dir
        + ")"
    )

    try:
        if repo_type == "git":
            success = update_state_git(url, dst_dir, branch=branch, revision=revision)
        elif repo_type == "hg":
            success = update_state_hg(url, dst_dir, branch=branch, revision=revision)
        elif repo_type == "svn":
            if url is None:
                eos.log_error("cannot execute local operations on SVN repository")
                return False
            success = update_state_svn(url, dst_dir, revision=revision)
        else:
            eos.log_error("unknown repository type '" + repo_type + "'")
            return False
    except RuntimeError:
        return False

    return success


text:
package ec2

import (
	"context"
	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
	"github.com/aws/aws-sdk-go-v2/service/ec2/types"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
	"time"
)

// Launches an EC2 Fleet. You can create a single EC2 Fleet that includes multiple
// launch specifications that vary by instance type, AMI, Availability Zone, or
// subnet. For more information, see Launching an EC2 Fleet
// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet.html) in the
// Amazon EC2 User Guide.
func (c *Client) CreateFleet(ctx context.Context, params *CreateFleetInput, optFns ...func(*Options)) (*CreateFleetOutput, error) {
	if params == nil {
		params = &CreateFleetInput{}
	}

	result, metadata, err := c.invokeOperation(ctx, "CreateFleet", params, optFns, c.addOperationCreateFleetMiddlewares)
	if err != nil {
		return nil, err
	}

	out := result.(*CreateFleetOutput)
	out.ResultMetadata = metadata
	return out, nil
}

type CreateFleetInput struct {

	// The configuration for the EC2 Fleet.
	//
	// This member is required.
	LaunchTemplateConfigs []types.FleetLaunchTemplateConfigRequest

	// The number of units to request.
	//
	// This member is required.
	TargetCapacitySpecification *types.TargetCapacitySpecificationRequest

	// Unique, case-sensitive identifier that you provide to ensure the idempotency of
	// the request. For more information, see Ensuring Idempotency
	// (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html).
	ClientToken *string

	// Reserved.
	Context *string

	// Checks whether you have the required permissions for the action, without
	// actually making the request, and provides an error response. If you have the
	// required permissions, the error response is DryRunOperation. Otherwise, it is
	// UnauthorizedOperation.
	DryRun *bool

	// Indicates whether running instances should be terminated if the total target
	// capacity of the EC2 Fleet is decreased below the current size of the EC2 Fleet.
	ExcessCapacityTerminationPolicy types.FleetExcessCapacityTerminationPolicy

	// Describes the configuration of On-Demand Instances in an EC2 Fleet.
	OnDemandOptions *types.OnDemandOptionsRequest

	// Indicates whether EC2 Fleet should replace unhealthy Spot Instances. Supported
	// only for fleets of type maintain. For more information, see EC2 Fleet health
	// checks
	// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/manage-ec2-fleet.html#ec2-fleet-health-checks)
	// in the Amazon EC2 User Guide.
	ReplaceUnhealthyInstances *bool

	// Describes the configuration of Spot Instances in an EC2 Fleet.
	SpotOptions *types.SpotOptionsRequest

	// The key-value pair for tagging the EC2 Fleet request on creation. For more
	// information, see Tagging your resources
	// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#tag-resources).
	// If the fleet type is instant, specify a resource type of fleet to tag the fleet
	// or instance to tag the instances at launch. If the fleet type is maintain or
	// request, specify a resource type of fleet to tag the fleet. You cannot specify a
	// resource type of instance. To tag instances at launch, specify the tags in a
	// launch template
	// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html#create-launch-template).
	TagSpecifications []types.TagSpecification

	// Indicates whether running instances should be terminated when the EC2 Fleet
	// expires.
	TerminateInstancesWithExpiration *bool

	// The fleet type. The default value is maintain.
	//
	// * maintain - The EC2 Fleet
	// places an asynchronous request for your desired capacity, and continues to
	// maintain your desired Spot capacity by replenishing interrupted Spot
	// Instances.
	//
	// * request - The EC2 Fleet places an asynchronous one-time request
	// for your desired capacity, but does submit Spot requests in alternative capacity
	// pools if Spot capacity is unavailable, and does not maintain Spot capacity if
	// Spot Instances are interrupted.
	//
	// * instant - The EC2 Fleet places a synchronous
	// one-time request for your desired capacity, and returns errors for any instances
	// that could not be launched.
	//
	// For more information, see EC2 Fleet request types
	// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-configuration-strategies.html#ec2-fleet-request-type)
	// in the Amazon EC2 User Guide.
	Type types.FleetType

	// The start date and time of the request, in UTC format (for example,
	// YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request
	// immediately.
	ValidFrom *time.Time

	// The end date and time of the request, in UTC format (for example,
	// YYYY-MM-DDTHH:MM:SSZ). At this point, no new EC2 Fleet requests are placed or
	// able to fulfill the request. If no value is specified, the request remains until
	// you cancel it.
	ValidUntil *time.Time

	noSmithyDocumentSerde
}

type CreateFleetOutput struct {

	// Information about the instances that could not be launched by the fleet.
	// Supported only for fleets of type instant.
	Errors []types.CreateFleetError

	// The ID of the EC2 Fleet.
	FleetId *string

	// Information about the instances that were launched by the fleet. Supported only
	// for fleets of type instant.
	Instances []types.CreateFleetInstance

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (c *Client) addOperationCreateFleetMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsEc2query_serializeOpCreateFleet{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsEc2query_deserializeOpCreateFleet{}, middleware.After)
	if err != nil {
		return err
	}
	if err = addSetLoggerMiddleware(stack, options); err != nil {
		return err
	}
	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
		return err
	}
	if err = addResolveEndpointMiddleware(stack, options); err != nil {
		return err
	}
	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
		return err
	}
	if err = addRetryMiddlewares(stack, options); err != nil {
		return err
	}
	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
		return err
	}
	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
		return err
	}
	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
		return err
	}
	if err = addClientUserAgent(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = addOpCreateFleetValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateFleet(options.Region), middleware.Before); err != nil {
		return err
	}
	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
		return err
	}
	if err = addResponseErrorMiddleware(stack); err != nil {
		return err
	}
	if err = addRequestResponseLogging(stack, options); err != nil {
		return err
	}
	return nil
}

func newServiceMetadataMiddleware_opCreateFleet(region string) *awsmiddleware.RegisterServiceMetadata {
	return &awsmiddleware.RegisterServiceMetadata{
		Region:        region,
		ServiceID:     ServiceID,
		SigningName:   "ec2",
		OperationName: "CreateFleet",
	}
}

redpajama_set_name: RedPajamaGithub


text:
class Singer < ActiveRecord::Base
  has_many :albums
end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example: Street View Data Example</title>

    <input type="button" onclick="next()" value="Next"/>


text:
package org.analogweb.util;

import java.lang.reflect.Array;

/**
 * @author snowgoose
 */
public final class ArrayUtils {

	@SuppressWarnings("unchecked")
	public static <T> boolean isEmpty(T... anArray) {
		return isNotEmpty(anArray) == false;
	}

	@SuppressWarnings("unchecked")
	public static <T> boolean isNotEmpty(T... anArray) {
		return (anArray != null && anArray.length != 0);
	}

	@SuppressWarnings("unchecked")
	public static <T> T[] newArray(T... objects) {
		return objects;
	}

	@SuppressWarnings("unchecked")
	public static <T> T[] clone(Class<T> type, T... original) {
		return clone(type, 0, original);
	}

	@SuppressWarnings("unchecked")
	public static <T> T[] clone(Class<T> type, int additionalLength,
			T... original) {
		if (original == null) {
			return null;
		}
		if (type == null) {
			return original;
		}
		T[] array = (T[]) Array.newInstance(type, original.length
				+ additionalLength);
		System.arraycopy(original, 0, array, 0, original.length);
		return array;
	}

	@SuppressWarnings("unchecked")
	public static <T> T[] add(Class<T> clazz, T addition, T... original) {
		T[] array = clone(clazz, 1, original);
		if (array != null) {
			array[array.length - 1] = addition;
			return array;
		}
		return null;
	}
}


text:
import { Column, Entity, PrimaryGeneratedColumn } from "../../../src/index"

@Entity()
export class User {
    @PrimaryGeneratedColumn()
    id: number

    @Column()
    firstName: string

    @Column()
    lastName: string
}


text:
using Aspose.Slides.Export;

/*
This project uses Automatic Package Restore feature of NuGet to resolve Aspose.Slides for .NET API reference
when the project is build. Please check https://docs.nuget.org/consume/nuget-faq for more information.
If you do not wish to use NuGet, you can manually download Aspose.Slides for .NET API from http://www.aspose.com/downloads,
install it and then add its reference to this project. For any issues, questions or suggestions
please feel free to contact us using http://www.aspose.com/community/forums/default.aspx
*/

namespace Aspose.Slides.Examples.CSharp.Presentations.Conversion
{
    class PresentationToTIFFWithCustomImagePixelFormat
    {
        public static void Run()
        {
            //ExStart:PresentationToTIFFWithCustomImagePixelFormat
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Conversion();

            // Instantiate a Presentation object that represents a Presentation file
            using (Presentation presentation = new Presentation(dataDir + "DemoFile.pptx"))
            {
                TiffOptions options = new TiffOptions();

                options.PixelFormat = ImagePixelFormat.Format8bppIndexed;
                INotesCommentsLayoutingOptions notesOptions = options.NotesCommentsLayouting;
                notesOptions.NotesPosition = NotesPositions.BottomFull;
                /*
                ImagePixelFormat contains the following values (as could be seen from documentation):
                Format1bppIndexed; // 1 bits per pixel, indexed.
                Format4bppIndexed; // 4 bits per pixel, indexed.
                Format8bppIndexed; // 8 bits per pixel, indexed.
                Format24bppRgb; // 24 bits per pixel, RGB.
                Format32bppArgb; // 32 bits per pixel, ARGB.
                */

                // Save the presentation to TIFF with specified image size
                presentation.Save(dataDir + "Tiff_With_Custom_Image_Pixel_Format_out.tiff", SaveFormat.Tiff, options);
            }
            //ExEnd:PresentationToTIFFWithCustomImagePixelFormat
        }
    }
}


text:
         {{ text }}
        {{helper}}

        {{helper}}


text:
struct TestCleanup {
    TestCleanup() {}
    ~TestCleanup() {
        ds3_cleanup();
    }
};

BOOST_GLOBAL_FIXTURE( TestCleanup );

void test_log(const char* message, void* user_data) {
    fprintf(stderr, "Log Message: %s\n", message);
}

ds3_client* get_client_at_loglvl(ds3_log_lvl log_lvl) {
    ds3_client* client;

    ds3_error* error = ds3_create_client_from_env(&client);

    if (error != NULL) {
        fprintf(stderr, "Failed to construct ds3_client from enviornment variables: %s\n", error->message->value);
        ds3_free_error(error);
        BOOST_FAIL("Failed to setup client.");
    }

    ds3_client_register_logging(client, log_lvl, test_log, NULL);

    return client;
}

ds3_client* get_client() {
    return get_client_at_loglvl(DS3_INFO);
}

void print_error(const ds3_error* error) {
      if (NULL != error->message) {
        printf("ds3_error_message: %s\n", error->message->value);
      }
      if (error->error != NULL) {
          printf("ds3_status_code: %lu\n", error->error->status_code);
          printf("ds3_status_message: %s\n", error->error->status_message->value);
          printf("ds3_error_body: %s\n", error->error->error_body->value);
      }
}

void handle_error(ds3_error* error) {
    if (error != NULL) {
        print_error(error);
        ds3_free_error(error);
        BOOST_FAIL("Test failed with a ds3_error");
    }
}

void clear_bucket(const ds3_client* client, const char* bucket_name) {
    uint64_t i;
    ds3_request* request;
    ds3_error* error;
    ds3_get_bucket_response* bucket_response;

    request = ds3_init_get_bucket(bucket_name);
    error = ds3_get_bucket(client, request, &bucket_response);
    ds3_free_request(request);

    handle_error(error);

    for (i = 0; i < bucket_response->num_objects; i++) {
        if (bucket_response->objects[i].name->value[bucket_response->objects[i].name->size-1] == '/') {
            request = ds3_init_delete_folder(bucket_name, bucket_response->objects[i].name->value);
            error = ds3_delete_folder(client, request);
            ds3_free_request(request);
        } else {
            request = ds3_init_delete_object(bucket_name, bucket_response->objects[i].name->value);
            error = ds3_delete_object(client, request);
            ds3_free_request(request);
        }

        if (error != NULL) {
            fprintf(stderr, "Failed to delete object %s\n", bucket_response->objects[i].name->value);
            ds3_free_error(error);
        }
    }

    request = ds3_init_delete_bucket(bucket_name);
    error = ds3_delete_bucket(client, request);
    ds3_free_request(request);
    ds3_free_bucket_response(bucket_response);
    handle_error(error);
}

void populate_with_objects(const ds3_client* client, const char* bucket_name) {
    ds3_str* job_id = populate_with_objects_return_job(client, bucket_name);
    ds3_str_free(job_id);
}

ds3_bulk_object_list* default_object_list() {
    const char* books[5] = {"resources/beowulf.txt", "resources/sherlock_holmes.txt", "resources/tale_of_two_cities.txt", "resources/ulysses.txt", "resources/ulysses_large.txt"};
    return ds3_convert_file_list(books, 5);
}

ds3_request* populate_bulk_return_request(const ds3_client* client, const char* bucket_name, ds3_bulk_object_list* obj_list) {
    ds3_request* request = ds3_init_put_bucket(bucket_name);
    ds3_error* error = ds3_put_bucket(client, request);
    ds3_free_request(request);

    handle_error(error);

    request = ds3_init_put_bulk(bucket_name, obj_list);
    return request;
}

ds3_bulk_response* populate_bulk_return_response(const ds3_client* client, ds3_request* request) {
    ds3_bulk_response* response;
    ds3_error* error = ds3_bulk(client, request, &response);
    ds3_free_request(request);
    handle_error(error);
    return response;
}

ds3_str* populate_with_empty_objects(const ds3_client* client, const char* bucket_name) {
    ds3_bulk_object_list* obj_list = default_object_list();
    ds3_request* request = populate_bulk_return_request(client, bucket_name, obj_list);
    ds3_bulk_response* response = populate_bulk_return_response(client, request);
    ds3_free_bulk_object_list(obj_list);

    ds3_str* job_id = ds3_str_dup(response->job_id);
    ds3_free_bulk_response(response);
    return job_id;
}

ds3_get_available_chunks_response* ensure_available_chunks(const ds3_client* client, ds3_str* job_id) {
    ds3_request* request = NULL;
    ds3_error* error = NULL;
    bool retry_get;
    ds3_get_available_chunks_response* chunk_response;
    do {
        retry_get = false;
        request = ds3_init_get_available_chunks(job_id->value);
        error = ds3_get_available_chunks(client, request, &chunk_response);
        ds3_free_request(request);

        BOOST_REQUIRE(error == NULL);
        BOOST_REQUIRE(chunk_response != NULL);

        if (chunk_response->object_list->list_size == 0) {
            // if this happens we need to try the request
            BOOST_TEST_MESSAGE( "Hit retry, sleeping for: " << chunk_response->retry_after);
            retry_get = true;
            sleep(chunk_response->retry_after);
            ds3_free_available_chunks_response(chunk_response);
        }
    } while(retry_get);
    return chunk_response;
}

void populate_with_objects_from_bulk(const ds3_client* client, const char* bucket_name, ds3_bulk_response* response) {
    uint64_t i, n;
    ds3_error* error;
    ds3_request* request;

    ds3_get_available_chunks_response* chunk_response = ensure_available_chunks(client, response->job_id);

    for (i = 0; i < chunk_response->object_list->list_size; i++) {
        ds3_bulk_object_list* chunk_object_list = chunk_response->object_list->list[i];
        for (n = 0; n < chunk_object_list->size; n++) {
            ds3_bulk_object current_obj = chunk_object_list->list[n];
            FILE* file = fopen(current_obj.name->value, "r");

            request = ds3_init_put_object_for_job(bucket_name, current_obj.name->value, current_obj.offset,  current_obj.length, response->job_id->value);
            if (current_obj.offset > 0) {
                fseek(file, current_obj.offset, SEEK_SET);
            }
            error = ds3_put_object(client, request, file, ds3_read_from_file);
            ds3_free_request(request);

            fclose(file);
            handle_error(error);
        }
    }
    ds3_free_available_chunks_response(chunk_response);
}

ds3_str* populate_with_objects_return_job(const ds3_client* client, const char* bucket_name) {
    ds3_bulk_object_list* obj_list = default_object_list();
    ds3_request* request = populate_bulk_return_request(client, bucket_name, obj_list);
    ds3_bulk_response* response = populate_bulk_return_response(client, request);
    ds3_free_bulk_object_list(obj_list);

    ds3_str* job_id = ds3_str_dup(response->job_id);

    populate_with_objects_from_bulk(client, bucket_name, response);

    ds3_free_bulk_response(response);
    return job_id;
}

bool contains_object(const ds3_object* objects, uint64_t num_objects, const char* obj) {
    uint64_t i;
    for (i = 0; i < num_objects; i++) {
        if (strcmp(objects[i].name->value, obj) == 0) {
            return true;
        }
    }
    return false;
}

void free_client(ds3_client* client) {
    ds3_free_creds(client->creds);
    ds3_free_client(client);
}


text:
package org.jgroups.protocols;

import org.jgroups.Global;
import org.jgroups.JChannel;
import org.jgroups.protocols.pbcast.GMS;
import org.jgroups.protocols.pbcast.NAKACK2;
import org.jgroups.stack.Protocol;
import org.jgroups.util.Util;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

/**
 * Tests that unicast messages are not endlessly retransmitted when an ACK is dropped
 * (https://issues.jboss.org/browse/JGRP-1578)
 * @author Bela Ban
 * @since  3.3
 */
@Test(groups=Global.FUNCTIONAL,singleThreaded=true)
public class UNICAST_DroppedAckTest {
    protected JChannel a, b;

    protected void setup(Class<? extends Protocol> unicast_class) throws Exception {
        a=createChannel(unicast_class, "A");
        b=createChannel(unicast_class, "B");
        a.connect("UNICAST_DroppedAckTest");
        b.connect("UNICAST_DroppedAckTest");
        Util.waitUntilAllChannelsHaveSameSize(10000, 1000, a, b);
    }

    @AfterMethod protected void destroy() {Util.close(b, a);}

    @DataProvider
    static Object[][] configProvider() {
        return new Object[][]{
          {UNICAST.class},
          {UNICAST3.class}
        };
    }

    @Test(dataProvider="configProvider")
    public void testNotEndlessXmits(Class<? extends Protocol> unicast_class) throws Exception {
        setup(unicast_class);

        DISCARD discard_a=(DISCARD)a.getProtocolStack().findProtocol(DISCARD.class);
        discard_a.setDropDownUnicasts(5); // drops the next 5 ACKs

        for(int i=1; i <= 5; i++)
            b.send(a.getAddress(), i);

        Protocol unicast_b=b.getProtocolStack().findProtocol(UNICAST.class, UNICAST3.class);
        for(int i=0; i < 10; i++) {
            int num_unacked_msgs=numUnackedMessages(unicast_b);
            System.out.println("num_unacked_msgs=" + num_unacked_msgs);
            if(num_unacked_msgs == 0)
                break;
            Util.sleep(1000);
        }

        assert numUnackedMessages(unicast_b) == 0 : "num_unacked_msgs on B should be 0 but is " + numUnackedMessages(unicast_b);
    }

    protected int numUnackedMessages(Protocol unicast) {
        if(unicast instanceof UNICAST)
            return ((UNICAST)unicast).getNumUnackedMessages();
        if(unicast instanceof UNICAST3)
            return ((UNICAST3)unicast).getNumUnackedMessages();
        throw new IllegalArgumentException("Protocol " + unicast.getClass().getSimpleName() + " needs to be UNICAST or UNICAST3");
    }

    protected JChannel createChannel(Class<? extends Protocol> unicast_class, String name) throws Exception {
        return new JChannel(new Protocol[] {
          new SHARED_LOOPBACK(),
          new SHARED_LOOPBACK_PING(),
          new MERGE3().setValue("max_interval", 3000).setValue("min_interval", 1000),
          new NAKACK2(),
          new DISCARD(),
          unicast_class.newInstance().setValue("xmit_interval", 500),
          new GMS()
        }).name(name);
    }
}


text:
<?php

namespace Site\MangaBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class ThemeType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name')
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Site\MangaBundle\Entity\Theme'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'site_mangabundle_theme';
    }
}


text:
require "minicount/rails/version"

module Minicount
  module Rails
    class Engine < ::Rails::Engine
    end
  end
end


text:
layout: documentation
title: Tutorial - Build an iOS App
---

# Tutorial - Build an iOS App

Like the [Android app](android-app.md) you built in the previous step, the iOS
app is a simple mobile app that communicates with the
[backend server](backend-server.md).

Here, you'll do the following:

*   Review the source files for the app
*   Create a `BUILD` file
*   Build the app for the simulator
*   Find the build outputs
*   Run/Debug the app on the simulator
*   Build the app for a device
*   Install the app on a device

Note that, unlike with the Android app, you don't have to modify your
`WORKSPACE` file to add iOS-specific external dependencies.

If you're following the steps in this tutorial on macOS (OS X), you can go ahead
and build the sample iOS app as described below. If you are on Linux, skip ahead
to the [next step](backend-server.md).

## Review the source files

Let's take a look at the source files for the app. These are located in
`$WORKSPACE/ios-app/UrlGet`. Again, you're just looking at these files now to
become familiar with the structure of the app. You don't have to edit any of the
source files to complete this tutorial.

## Create a BUILD file

At a command-line prompt, open your new `BUILD` file for editing:

```bash
vi $WORKSPACE/ios-app/BUILD
```

## Add an objc_library rule

Bazel provides several build rules that you can use to build an app for the
iOS platform. For this tutorial, you'll first use the
[`objc_library`](/docs/be/objective-c.html#objc_library) rule to tell Bazel
how to build an
[static library](https://developer.apple.com/library/ios/technotes/iOSStaticLibraries/Introduction.html)
from the app source code and Xib files. Then you'll use the
`objc_binary` rule to tell it how to bundle the iOS application. (Note that
this is a minimal use case of the Objective-C rules in Bazel. For example, you
have to use the `ios_application` rule to build multi-architecture iOS
apps.)

Add the following to your `BUILD` file:

```python
objc_library(
    name = "UrlGetClasses",
    srcs = [
        "UrlGet/AppDelegate.m",
        "UrlGet/UrlGetViewController.m",
    ],
    hdrs = glob(["UrlGet/*.h"]),
    xibs = ["UrlGet/UrlGetViewController.xib"],
)
```

Note the name of the rule, `UrlGetClasses`.

## Add an objc_binary rule

The [`objc_binary`](/docs/be/objective-c.html#objc_binary) rule creates a
binary to be bundled in the application.

Add the following to your `BUILD` file:

```python
objc_binary(
    name = "ios-app-binary",
    srcs = [
        "UrlGet/main.m",
    ],
    deps = [
        ":UrlGetClasses",
    ],
)

```
Note how the `deps` attribute references the output of the
`UrlGetClasses` rule you added to the `BUILD` file above.

## Add an ios_application rule

The [`ios_application`](/docs/be/objective-c.html#ios_application) rule
creates the bundled `.ipa` archive file for the application and also generates
an Xcode project file.

Add the following to your `BUILD` file:

```python
ios_application(
    name = "ios-app",
    binary = ":ios-app-binary",
    infoplist = "UrlGet/UrlGet-Info.plist",
)
```

Now, save and close the file. You can compare your `BUILD` file to the
[completed example](https://github.com/bazelbuild/examples/blob/master/tutorial/ios-app/BUILD)
in the `master` branch of the GitHub repo.

## Build the app for the simulator

Make sure that your current working directory is inside your Bazel workspace:

```bash
cd $WORKSPACE
```

Now, enter the following to build the sample app:

```bash
bazel build //ios-app:ios-app
```

Bazel now launches and builds the sample app. During the build process, its
output will appear similar to the following:

```bash
INFO: Found 1 target...
Target //ios-app:ios-app up-to-date:
  bazel-bin/ios-app/ios-app.ipa
  bazel-bin/ios-app/ios-app.xcodeproj/project.pbxproj
INFO: Elapsed time: 3.765s, Critical Path: 3.44s
```

## Find the build outputs

The `.ipa` file and other outputs are located in the
`$WORKSPACE/bazel-bin/ios-app` directory.

## Run/Debug the app on the simulator

You can now run the app from Xcode using the iOS Simulator. To run the app,
open the project directory `$WORKSPACE/bazel-bin/ios-app/ios-app.xcodeproj` in
Xcode, choose an iOS Simulator as the runtime scheme and then click the **Run**
button.

**Note:** If you change anything about the project file set in Xcode (for
example, if you add or remove a file, or add or change a dependency), you must
rebuild the app using Bazel and then re-open the project.

## Build the app for a device

You need to set up bazel so that it can find the appropriate provisioning
profile for the device you want to build for. To set up the "default"
provisioning profile for all bazel builds:

   1. Go to [Apple Profiles](https://developer.apple.com/account/ios/profile/profileList.action)
      and download the appropriate provisioning profile for your device.
      If this is confusing, please refer to [Apple's documentation](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingProfiles/MaintainingProfiles.html).
   1. Move your profile into `$WORKSPACE/tools/objc`.
   1. Optional - You may want to add your profile to your `.gitignore`.
   1. Edit `$WORKSPACE/tools/objc/BUILD` and add:

      ```python
      filegroup(
          name = "default_provisioning_profile",
          srcs = ["<NAME OF YOUR PROFILE>.mobileprovision"],
      )
      ```

Now you should be able to build the app for your device:

```bash
bazel build //ios-app:ios-app --ios_multi_cpus=armv7,arm64
```

This will build the app "fat". If you would prefer just to build for
your specific device architecture you can designate a single architecture.

If you would like to select a specific Xcode version you can do so
with the `--xcode_version=7.2` option. If for some reason you need to specify
a specific SDK version you can use the `--ios_sdk_version=9.2` option, but the
`--xcode_version` should be sufficient in most circumstances.

If you would like to specify a minimum version of iOS to run against, you can
do so with the `--ios_minimum_os=7.0` option.

## Install the app on a device

The easiest way to install the app on the device is to launch Xcode and use the
`Windows > Devices` command. Select your plugged in device from the list on the
left, and then add the app by clicking on the "plus" sign under installed apps
and selecting the `.ipa` that you built.

If your app does not launch, please make sure that your device was on your
provisioning profile. The `View Device Logs` button on the `Devices` screen in
Xcode may provide other information as to what has gone wrong.

## What's next

The next step is to build a [backend server](backend-server.md) for the two
mobile apps you built in this tutorial.


text:
namespace DdpNet.UnitTest.Collections.TestObjects
{
    using Newtonsoft.Json.Linq;

    public class ComplexObject
    {
        public float testField;

        public bool TestBoolean { get; set; }

        public NestedObject NestedObject { get; set; }

        public ComplexObject CreateCopy()
        {
            return new ComplexObject()
            {
                TestBoolean = this.TestBoolean,
                testField = this.testField,
                NestedObject = this.NestedObject.CreateCopy()
            };
        }

        public JToken CreateJToken()
        {
            return JToken.FromObject(this);
        }
    }

    public class NestedObject
    {
        public string testfield;
        public int TestProperty { get; set; }

        public NestedObject CreateCopy()
        {
            return new NestedObject()
            {
                testfield = this.testfield,
                TestProperty = this.TestProperty
            };
        }
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.github.yingzhuo</groupId>
    <artifactId>spring-boot-web-blank</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.4.RELEASE</version>
    </parent>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <!-- spring-boot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>4.1.6.RELEASE</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>4.1.6.RELEASE</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-messaging</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-instrument</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>aopalliance</groupId>
            <artifactId>aopalliance</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.8.5</version>
        </dependency>

        <!-- druid -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.0.14</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.34</version>
        </dependency>

        <!-- mybatis -->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>1.2.2</version>
        </dependency>

        <!-- quartz -->
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <version>2.2.1</version>
            <exclusions>
                <exclusion>
                    <groupId>c3p0</groupId>
                    <artifactId>c3p0</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- activemq -->
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-core</artifactId>
            <version>5.7.0</version>
        </dependency>

        <!-- freemarker -->
        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
            <version>2.3.22</version>
        </dependency>

        <!-- guava -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>18.0</version>
        </dependency>

        <!-- commons -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.3.2</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>commons-net</groupId>
            <artifactId>commons-net</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>4.0</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.8</version>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>1.8.3</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>1.2.4.RELEASE</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>springloaded</artifactId>
                        <version>1.2.3.RELEASE</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <debug>true</debug>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>


text:
import BaseValidator from './base';

export default BaseValidator.create({
    properties: ['title', 'metaTitle', 'metaDescription'],

    title(model) {
        let title = model.get('title');

        if (validator.empty(title)) {
            model.get('errors').add('title', '请填写文章标题');
            this.invalidate();
        }

        if (!validator.isLength(title, 0, 150)) {
            model.get('errors').add('title', '标题不能超过150字');
            this.invalidate();
        }
    },

    metaTitle(model) {
        let metaTitle = model.get('metaTitle');

        if (!validator.isLength(metaTitle, 0, 150)) {
            model.get('errors').add('metaTitle', 'Meta 标题不能超过150字');
            this.invalidate();
        }
    },

    metaDescription(model) {
        let metaDescription = model.get('metaDescription');

        if (!validator.isLength(metaDescription, 0, 200)) {
            model.get('errors').add('metaDescription', 'Meta 简介不能超过200字');
            this.invalidate();
        }
    }
});


text:
namespace vosvideo
{
	namespace camera
	{
		class CameraPlayerProcess
		{
		public:
			CameraPlayerProcess(std::shared_ptr<vosvideo::communication::PubSubService> pubsubService,
				vosvideo::data::CameraConfMsg& conf,
				bool isLoggerOn);
			virtual ~CameraPlayerProcess();

			void Reconnect();
			void Send(const std::wstring& msg);
			// Stops the process
			void Shutdown();

		private:
			// Check if spawned process alive
			bool IsAlive();
			void Init();
			void Receive();
			void ReceiveAsync();

			std::shared_ptr<vosvideo::communication::PubSubService> pubSubService_;
			std::shared_ptr<vosvideo::communication::InterprocessComm> duplexChannel_;
			vosvideo::data::CameraConfMsg conf_;
			int32_t pid_ = -1;
			bool isLoggerOn_ = false;
		};
	}
}


text:
package org.tuxdevelop.spring.batch.lightmin.util;

import org.junit.Test;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.tuxdevelop.spring.batch.lightmin.exception.SpringBatchLightminApplicationException;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;

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

public class DomainParameterParserTest {

    @Test
    public void parseParametersTest() {
        final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
                DomainParameterParser.DATE_FORMAT_WITH_TIMESTAMP);
        final String parameters = "testS(String)=56788,testL(Long)=56,testD(date)=2015/03/27 23:19:24:120";
        final Map<String, Object> parameterMap = DomainParameterParser
                .parseParameters(parameters);
        assertThat(parameterMap).isNotNull();
        assertThat(parameterMap).isNotEmpty();
        assertThat(parameterMap.containsKey("testS")).isTrue();
        assertThat(parameterMap.containsKey("testL")).isTrue();
        assertThat(parameterMap.containsKey("testD")).isTrue();
        final String stringValue = (String) parameterMap.get("testS");
        final Long longValue = (Long) parameterMap.get("testL");
        final Date dateValue = (Date) parameterMap.get("testD");
        assertThat(stringValue).isEqualTo("56788");
        assertThat(longValue).isEqualTo(56L);
        assertThat(simpleDateFormat.format(dateValue)).isEqualTo(
                "2015/03/27 23:19:24:120");
    }

    @Test
    public void parseParametersUrlTest() {
        final String parameters = "targetDirectory(String)=./import/diff/," +
                "emailFile(String)=email.txt," +
                "currentFile(String)=./import/current/email_current.txt," +
                "lastWeekFile(String)=./import/archive/email_last_week.txt," +
                "pathToTempFolder(String)=./import/temp/," +
                "emailUrl(String)=https://www.robinsonabgleich.de/abgleichen/email/klartext-direct/97/0f88d453c73e9bd305667d7c072c2fe9," +
                "emailZipFile(String)=./import/zip/email.zip," +
                "maxLineCount(Long)=20000";

        final Map<String, Object> parameterMap = DomainParameterParser.parseParameters(parameters);
        assertThat(parameterMap).hasSize(8);
    }

    @Test
    public void parseParametersNullTest() {
        final Map<String, Object> parameterMap = DomainParameterParser
                .parseParameters(null);
        assertThat(parameterMap).isNotNull();
        assertThat(parameterMap).isEmpty();
    }

    @Test
    public void generateParameterStringEntryTest() {
        final String parameter = "test(String)=56788";
        final Entry<String, Object> entry = DomainParameterParser
                .generateParameterEntry(parameter);
        assertThat(entry.getKey()).isEqualTo("test");
        assertThat(entry.getValue()).isEqualTo("56788");
    }

    @Test
    public void generateParameterLongEntryTest() {
        final String parameter = "test(Long)=56";
        final Entry<String, Object> entry = DomainParameterParser
                .generateParameterEntry(parameter);
        assertThat(entry.getKey()).isEqualTo("test");
        assertThat(entry.getValue()).isEqualTo(56L);
    }

    @Test
    public void generateParameterDateEntryTest() {
        final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
                DomainParameterParser.DATE_FORMAT_WITH_TIMESTAMP);
        final String parameter = "test(date)=2015/03/27 23:19:24:120";
        final Entry<String, Object> entry = DomainParameterParser
                .generateParameterEntry(parameter);
        assertThat(entry.getKey()).isEqualTo("test");
        assertThat(simpleDateFormat.format(entry.getValue())).isEqualTo(
                "2015/03/27 23:19:24:120");
    }

    @Test
    public void generateParameterDoubleEntryTest() {
        final String parameter = "test(Double)=5.2212";
        final Entry<String, Object> entry = DomainParameterParser.generateParameterEntry(parameter);
        assertThat(entry.getKey()).isEqualTo("test");
        assertThat(entry.getValue()).isEqualTo(5.2212);
    }

    @Test
    public void parseDateWithTimeStampTest() {
        final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
                DomainParameterParser.DATE_FORMAT_WITH_TIMESTAMP);
        final String dateString = "2015/03/27 23:19:24:120";
        final Date date = DomainParameterParser.parseDate(dateString);
        assertThat(date).isNotNull();
        assertThat(simpleDateFormat.format(date)).isEqualTo(dateString);
    }

    @Test
    public void parseDateTest() {
        final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
                DomainParameterParser.DATE_FORMAT);
        final String dateString = "2015/03/27";
        final Date date = DomainParameterParser.parseDate(dateString);
        assertThat(date).isNotNull();
        assertThat(simpleDateFormat.format(date)).isEqualTo(dateString);
    }

    @Test(expected = SpringBatchLightminApplicationException.class)
    public void parseDateExceptionTest() {
        final String dateString = "2015/03:27";
        DomainParameterParser.parseDate(dateString);
    }

    @Test(expected = SpringBatchLightminApplicationException.class)
    public void createValueInstanceExceptionTest() {
        DomainParameterParser.createValueInstance("CLASS", "1234");
    }

    @Test
    public void parseJobParametersToStringTest() {
        final JobParameters jobParameters = new JobParametersBuilder().addLong("long", 1L).addString("String",
                "someString").toJobParameters();
        final String result = DomainParameterParser.parseJobParametersToString(jobParameters);
        assertThat(result).isEqualTo("String(String)=someString,long(Long)=1");
    }
}


text:
namespace ChilliSource
{
    CS_DEFINE_NAMEDTYPE(VolumeComponent);
}


text:
{
  "title": "🤯bookdown w/ runable exercises, & interactive JS extensions… 📕 \"Introduction to Econometrics w/ R\" by Christoph Hanck, Martin Arnold, Alexander Gerber & Martin Schmelzer https://t.co/SgP9CYDKkZ https://t.co/WQkb3FWJp9 #rstats #repeatTweet https://t.co/vj017el7u4",
  "date": "2019-01-16"
}

# blogdown

> **Jennifer Thompson** (@jent103; 54/8): .@apreshill's list of #blogdown don'ts:
> >
> - don't touch index.Rmd
> - don't touch /public
> - for goodness' sake, don't knit  [↪](https://twitter.com/xieyihui/status/1085304300258115584)

<!-- -->

> **Thomas Mock 👨🏼💻 @ #rstudioconf!** (@thomas_mock; 33/3): .@apreshill reminding us to never knit! just commit! when publishing your #blogdown site!
> >
> #RStudioConf Advanced R Markdown https://t.co/Vv3NKbBtxz  [↪](https://twitter.com/xieyihui/status/1085307823964278785)

<!-- -->

> **The R-Podcast (Eric)** (@theRcast; 25/6): 👏 Day 1 of the adv #rstats #rmarkdown at #rstudioconf 💼 with insights & resources!
> - @apreshill 🏋♀on  #blogdown #bookdown #xaringan #flexdashboard
> - @JoannaMellon 🔍 #learnr with real-time demo
> - me: 🚔#officer to create #powerpoint slides
> >
> 👀https://t.co/1rcevxSa0N  [↪](https://twitter.com/xieyihui/status/1085379602632056835)

<!-- -->

> **Alison Hill** (@apreshill; 24/1): I've arrived at that time in my workshop preparation when I refine my gif selection in my slides...(I promise there are very few)
> >
> This one serves many #rstats #blogdown purposes:
> 1) don't knit!
> 2) don't touch your public folder
> 3) don't touch your themes folder https://t.co/u9CBUNOY1u  [↪](https://twitter.com/xieyihui/status/1083791211222073344)

<!-- -->

> **Ming Tang** (@tangming2005; 18/6): reposting this using blogdown. added some links and typo checked by Rstudio! #rstats  Understanding p-value, multiple comparisons, FDR and q value https://t.co/TTR8EfM70u  [↪](https://twitter.com/xieyihui/status/1084543022199656448)

<!-- -->

> **Detlef Burkhardt 🚀** (@DetlefBurkhardt; 16/10): R2:D9 #100DaysOfCode <- R-Mark-Blog-Bookdown
> >
> Today I check the "blogability" of the #rstats-ecosystem. Learning the concepts of #knitr #rmarkdown #bookdown #blogdown #pandoc, mainly in @rstudio with a lot of input from @xieyihui.
> >
> \_
> #100DaysOfMLCode #301DaysOfCode #DataScience https://t.co/FmQl66keww  [↪](https://twitter.com/xieyihui/status/1084378104578146305)

<!-- -->

> **Thomas Mock 👨🏼💻 @ #rstudioconf!** (@thomas_mock; 9/1): Followup to close the #blogdown session!
> >
> Change things in your config.toml file - then serve_site() and see what happens! https://t.co/8Cle6uA69L  [↪](https://twitter.com/xieyihui/status/1085310210678444037)

<!-- -->

> **Alison Hill** (@apreshill; 8/0): @kara_woo wow 🥺
> >
> on a related note, prepping for a blogdown workshop, I did a search for blog posts on the topic and got like 1/3 of the way through reading someone's post and realized it was my blog post word for word. 🤔 but at least they didn't ask me to help tie up the loose ends 😂  [↪](https://twitter.com/xieyihui/status/1083210343390732289)

<!-- -->

> **Andrew Heiss, PhD** (@andrewheiss; 5/2): Important #rstats life hack if you want to prevent accidental knitting of blogdown and bookdown pages! https://t.co/ZjNZiZO9l5  [↪](https://twitter.com/xieyihui/status/1085353932950364160)

<!-- -->

> **Phillip Meintzer** (@FishPhilEh; 5/2): Awesome resource for creating your own academic web page using R blogdown! https://t.co/kBuWgI2W1E  [↪](https://twitter.com/xieyihui/status/1083123679964233728)

<!-- -->

> **Alexis Norris** (@AlexisLNorris; 5/0): @Hoosierflyman @chicaScientific @mgrntwrkr Have someone in your lab use #rstats to make the lab website! ✔Free ✔they learn R and make pretty figures for their papers
> https://t.co/GQ2z4sUrbv  [↪](https://twitter.com/xieyihui/status/1083593651375222789)

<!-- -->

> **Andrew Heiss, PhD** (@andrewheiss; 4/0): So I added random motivational messages to my .Rprofile, following this blog post by @mattdray, and it makes building blogdown sites kinda fun now #rstats https://t.co/aW53wG2Ypb https://t.co/kkIzT8cdu0  [↪](https://twitter.com/xieyihui/status/1083072269734240258)

<!-- -->

> **🇲🇽 Dr. Leonardo Collado-Torres** (@fellgernon; 3/2): *4* a collection of guides on how you can meet #rstats users & network for different types of individuals
> >
> From anon ways, to @Twitter lurking/posting, to #blogdown presence, etc
> >
> I've been talking a lot about @LIBDrstats https://t.co/9sUBa0LDaS but that's just 1 way #rstudioconf  [↪](https://twitter.com/xieyihui/status/1085406672036745216)

<!-- -->

> **Doctorb Zhian N. Kamvar** (@ZKamvar; 3/0): These were all super confusing to me when I was starting with blogdown. https://t.co/qftr71lWvE  [↪](https://twitter.com/xieyihui/status/1085323713166233600)

<!-- -->

> **Phillip Meintzer** (@FishPhilEh; 3/0): Following @dsquintana 's instructions, I was able to build myself a simple academic website using blogdown with #Rstats. Here's an early draft. I still have to incorporate my publications etc. https://t.co/iIQT2i7ckx  [↪](https://twitter.com/xieyihui/status/1083431128927617025)

<!-- -->

> **Andrew Heiss, PhD** (@andrewheiss; 2/0): @jent103 @apreshill I would *love* a way to disable knitting for blogdown sites from inside RStudio. I've accidentally hit command+shift+K waaaay too often in sites :(  [↪](https://twitter.com/xieyihui/status/1085316894180093952)

<!-- -->

> **Alison Hill** (@apreshill; 2/0): @SteveDX_ well technically you can delete the whole darn public/ folder, then serve your site again, if you are wanting to clean house!
> >
> I was mainly responding to this community post: https://t.co/YU22TOqwS0
> >
> In which the user wanted to edit the index.html  [↪](https://twitter.com/xieyihui/status/1083792296686972928)

<!-- -->

> **A_maninaworld** (@TomorrowsIcons; 1/1): What's an awesome package in R and what can I do with it? Here's a list of the most popular packages I've used so far: #ggplot2 #shiny #blogdown #rvest #knitr #Tidyverse . Any recommendations? #rstats @rstats4ds @hadleywickham @kdnuggets @RLadiesGlobal @Rbloggers  [↪](https://twitter.com/xieyihui/status/1084867573223772160)

<!-- -->

> **Thomas Mock 👨🏼💻 @ #rstudioconf!** (@thomas_mock; 1/0): @myadav2009 https://t.co/rrP8EIk1GK
> >
> Lots of details here!  [↪](https://twitter.com/xieyihui/status/1085523186014478337)

<!-- -->

> **Dale Maschette 🐟🧗♂** (@Dale_Masch; 1/0): @djnavarro sure...🤷♂ you know more about blogdown than I do.  [↪](https://twitter.com/xieyihui/status/1085411113741754373)

<!-- -->

> **Danielle Navarro** (@djnavarro; 1/0): @Dale_Masch *grumbles about how little she understands blogdown*  [↪](https://twitter.com/xieyihui/status/1085397901654790145)

<!-- -->

> **kostas kougioumoutzis** (@konkougioumou; 1/0): It may not be much, but in 3 years time, I went from completely #rstats illiterate (and self-taught) to design and publish my own website completely from within #r! A huge thank you to @xieyihui for his great and book package #blogdown!  [↪](https://twitter.com/xieyihui/status/1084853876401033216)

<!-- -->

> **Taras Kaduk** (@taraskaduk; 1/0): @ma_salmon just read your rOpenSci blog post about the site running on HUGO. Quick question: do I understand it right that it is straight-up HUGO, with no blogdown layer on top?  [↪](https://twitter.com/xieyihui/status/1083378067429576704)

<!-- -->

> **Taras Kaduk** (@taraskaduk; 1/0): @ma_salmon @_inundata "Ease to move around" was my reason, too. After realizing I can't easily switch to HUGO without rewriting .Rmd files into .md files with pre-generated images 😆
> >
> @_inundata, curious to know your opinion!
> https://t.co/X9UrIXD79U  [↪](https://twitter.com/xieyihui/status/1083477714005299200)

<!-- -->

> **espinielli** (@espinielli; 1/0): @ma_salmon @rOpenSci @_inundata Yes, I started from that and want to go to full blogdown...my big issue is designing the various (template) pages and relevant CSS in order to be good (enough) for desktop and mobile...
> Catching up on the new pages from old one in production to new one under dev a burden too😭  [↪](https://twitter.com/xieyihui/status/1083102248954146816)

<!-- -->

> **Samantha Toet** (@Samantha_Toet; 1/0): @toddmorling That's a great idea! That way you will be able to keep track of everything you learn and you can look back on it in a few years and see how you're improving and growing. I may be biased, but I recommend blogdown + hugo + netlify for deploying 🙂  [↪](https://twitter.com/xieyihui/status/1083070928878223361)

<!-- -->

> **Sascha Wolfer** (@sascha_wolfer; 0/1): Dear #rstats bloggers: I want to migrate my blog https://t.co/szJQGF9E8f from https://t.co/y3JAubIZvu to a blogdown-based solution. What do I have to think of? How, for example, can I connect it to @Rbloggers? Can I get free web space somewhere? Anything else? Thx 4 ur help!  [↪](https://twitter.com/xieyihui/status/1084018582143549441)

<!-- -->

> **Mahesh Yadav** (@myadav2009; 0/0): @thomas_mock I am not able to understand the #blogdown thread, but seems very interesting. Any book or article on that? Thanks  [↪](https://twitter.com/xieyihui/status/1085340512867966976)

<!-- -->

> **Alex Albright** (@AllbriteAllday; 0/0): @xieyihui Is there a way to specify a featured image for a post on my #blogdown website? (So that the featured image -- rather than the first image -- shows up when I link to the post on twitter/fb/etc.) #rstats  [↪](https://twitter.com/xieyihui/status/1084929247767027717)

<!-- -->

> **A_maninaworld** (@TomorrowsIcons; 0/0): Check out https://t.co/omWI4nnpN4 . You can do so much through #blogdown and #netlify #rstats  [↪](https://twitter.com/xieyihui/status/1084180631003762689)

<!-- -->

> **Ed_0110100001101001 💡⚙🛠☕** (@ed19741; 0/0): How to load the same needed packages in multiple blogdown posts? https://t.co/Y7cH5vJsDs  [↪](https://twitter.com/xieyihui/status/1084588006588207104)

<!-- -->

> **Ming Tang** (@tangming2005; 0/0): Adding citations to posts in blogdown.  https://t.co/m3GBHw9Ziu  [↪](https://twitter.com/xieyihui/status/1084541850109833217)

<!-- -->

> **Rex Douglass** (@RexDouglass; 0/0): https://t.co/7zn37IBL8L  [↪](https://twitter.com/xieyihui/status/1083801386460995585)

<!-- -->

> **Benjamin Wolfe** (@BenjaminWolfe; 0/0): @xieyihui 😁
> >
> Awesome! I mean I really did put a lot of work into my reproducible example.
> >
> I've really enjoyed #xaringan by the way, and am thinking of starting with #blogdown. I guess I'm just saying I'm a big fan of your work! https://t.co/GO8Eag6YTo  [↪](https://twitter.com/xieyihui/status/1083736511215009792)

<!-- -->

> **Henrik Bengtsson** (@henrikbengtsson; 0/0): Q: I set today's date but not time in my #rstats blogdown/#gohugo yaml;
> >
> date: 2019-01-10
> >
> => RSS pubDate to be 'Mon, 10 Jan 2019 00:00:00 +0000' => causes some aggregators (eg @RBloggers) not to relay them. Shld I use date+late time:
> >
> date: 2019-01-10 23:59:59 -0700
> >
> instead?  [↪](https://twitter.com/xieyihui/status/1083522157123067904)

<!-- -->

> **Taras Kaduk** (@taraskaduk; 0/0): @ma_salmon Thanks! Since rOpenSci is very R heavy, were there any particular reasons to keep it hugo-only and not adopt blogdown?
> See my question on the same issue here: https://t.co/X9UrIXD79U  [↪](https://twitter.com/xieyihui/status/1083397194785349632)

<!-- -->

> **hello!** (@mryap; 0/0): Explore and find it possible to run @xieyihui #blogdown site https://t.co/Ty3PdxDEuq with @rstudio in the cloud using @Netlify and @github. I just need to find a better @GoHugoIO theme to fit the images #rstats  [↪](https://twitter.com/xieyihui/status/1083344825339047937)

<!-- -->

# bookdown

> **Mara Averick** (@dataandme; 96/22): 🤯bookdown w/ runable exercises, & interactive JS extensions…
> 📕 "Introduction to Econometrics w/ R"  by Christoph Hanck, Martin Arnold, Alexander Gerber & Martin Schmelzer https://t.co/SgP9CYDKkZ
> https://t.co/WQkb3FWJp9 #rstats #repeatTweet https://t.co/vj017el7u4  [↪](https://twitter.com/xieyihui/status/1083087575781396482)

<!-- -->

> **Max Kuhn** (@topepos; 74/11): Slowly starting to commit GitHub resources for the new book (https://t.co/bNeNSVDj3G) as we prepare for the last set of draft chapters.
> >
> Just added the source data sets to https://t.co/oqqIbtR6gM
> >
> #rstats https://t.co/kXQMmjpEWw  [↪](https://twitter.com/xieyihui/status/1083810506069155842)

<!-- -->

> **We are R-Ladies** (@WeAreRLadies; 54/17): 8) "R Markdown: The Definitive Guide" by @xieyihui @fly_upside_down & @StatGarrett .  A great technical reference guide to.. you guessed it.. RMarkdown in #rstats!
> >
> https://t.co/lUHNXQfCMe https://t.co/RlJlBH09NY  [↪](https://twitter.com/xieyihui/status/1084983127758565376)

<!-- -->

> **Filippo Chiarello** (@f_chiare; 17/4): Super happy of the cover of my PhD thesis! 😄 Some #NLP and #wordcloud to represent the main verbs, nouns and adjectives I've used in my work, proudly written in #bookdown. Hopefully next year I'll present some of the content at #rstudioconf 🧐 https://t.co/GZNSDIriAJ  [↪](https://twitter.com/xieyihui/status/1085243753730895872)

<!-- -->

> **Thomas Mock 👨🏼💻 @ #rstudioconf!** (@thomas_mock; 13/0): . @apreshill Spitting YAML fire while covering her highly customized Bookdown!
> >
> #RStudioConf Advanced R Markdown workshop https://t.co/yZUTsM3vco  [↪](https://twitter.com/xieyihui/status/1085284496809885696)

<!-- -->

> **McMaster Soc Sci** (@McMasterSocSci; 5/2): "Reproducible Econometrics Using R" by  Jeffrey Racine, Senator William McMaster Chair in Econometrics. #rstats #rmarkdown #bookdown https://t.co/fwOAv4cLj2  [↪](https://twitter.com/xieyihui/status/1084167822073348096)

<!-- -->

> **Matthew Hendrickson** (@mjhendrickson; 5/1): @WeAreRLadies Efficient R Programming by Colin Gillespie @jumping_uk and @robinlovelace
> https://t.co/gGE5Qa7QDO  [↪](https://twitter.com/xieyihui/status/1084994027559227392)

<!-- -->

> **Matthew Hendrickson** (@mjhendrickson; 5/1): @WeAreRLadies Exploratory Data Analysis by @rdpeng
> https://t.co/SWn2xyHW3T  [↪](https://twitter.com/xieyihui/status/1084993493330808837)

<!-- -->

> **Alex  Papageorgiou** (@alpapag; 3/1): R for marketing e-book by @LeuvenU University's marketing dept https://t.co/BkmyoUehk3 #rstats  [↪](https://twitter.com/xieyihui/status/1083653994256445440)

<!-- -->

> **Stas Kolenikov** (@StatStas; 3/0): It is very fitting that this #bookdown @GitHub project would pop up in my feed in the middle of the #RStudioConf workshop on Advanced R Markdown!
> Danke @fraukolos for bringing this to my attention
> cc: @apreshill @xieyihui https://t.co/djrVFznFqk  [↪](https://twitter.com/xieyihui/status/1085226248333414400)

<!-- -->

> **Elías Eyþórsson** (@eliaseythorsson; 2/3): Is there anyway to create a list of tables, list of figures in word with #pandoc and @xieyihui's #bookdown ? I honestly can't find a yes / no answer in documentation and my attempts have not worked. Don't know whether to give up or continue trying. #rstats #phdchat  [↪](https://twitter.com/xieyihui/status/1084055745451229184)

<!-- -->

> **Chanel Meyers** (@chanelkmeyers; 2/0): @k_e_scott_1 My RAs loved YaRrr! https://t.co/R203Zzfxre  [↪](https://twitter.com/xieyihui/status/1084662672187056128)

<!-- -->

> **Toju** (@TojYouSo; 2/0): Do you use datacamp? Is it worth it? Or is there enough material out there for free - blogs/books on bookdown etc https://t.co/F4Gm80hq7f  [↪](https://twitter.com/xieyihui/status/1083646706951041024)

<!-- -->

> **Mathew 'Night Science' Ling** (@lingtax; 2/0): @emilyandthelime @Dale_Masch @dataandme @LisaDeBruine @djnavarro But that example above isn't a datacamp type activity.  Plus there are internal options for exercises in bookdown now. https://t.co/TiGt6PvpP9  [↪](https://twitter.com/xieyihui/status/1083299258441162752)

<!-- -->

> **Mathew 'Night Science' Ling** (@lingtax; 2/0): @Dale_Masch @emilyandthelime @dataandme @LisaDeBruine @djnavarro We have my old shiny one as well that we could use / adapt, in case we didn't care for D3. Details here: https://t.co/RlpXdXZOjr  [↪](https://twitter.com/xieyihui/status/1083228232852197377)

<!-- -->

> **Eduardo Guamán Daquilema** (@guamandseduardo; 2/0): Introduction to Data Exploration and Analysis with #RStats by Michael Mahoney
> 🔗#bookdown: https://t.co/FfEoY1fw5N https://t.co/HX4cjtnE4B  [↪](https://twitter.com/xieyihui/status/1083159862891159552)

<!-- -->

> **Dataiku** (@dataiku; 1/1): What should you be adding to your data science toolbelt? |
> https://t.co/g22CdJl3OK #datascience #python #bookdown #dataflow #featuretools #keras  [↪](https://twitter.com/xieyihui/status/1085184351976022017)

<!-- -->

> **Albert Krewinkel** (@kraut0xA; 1/1): @eliaseythorsson @xieyihui Not sure about bookdown, but pandoc does not. But there are various extensions that should help. E.g., pandoc-crossref might be helpful: https://t.co/BboV4freVM  [↪](https://twitter.com/xieyihui/status/1084058801010028544)

<!-- -->

> **Udayan Roy** (@UdayanRoy62; 1/0): Can anyone show me how to insert interactive multiple-choice questions -- as in the "Try It" boxes at https://t.co/tugPOFchsU -- in a #bookdown book? Please help.  [↪](https://twitter.com/xieyihui/status/1085412548655099904)

<!-- -->

> **Darren L Dahly** (@statsepi; 1/0): @Tfeend Yeah, once the module has run, we'll put everything on Youtube and github w/bookdown (mid-March).  [↪](https://twitter.com/xieyihui/status/1084206751031930880)

<!-- -->

> **Pedro Carrillo** (@PedroCarrillo; 1/0): bookdown: Authoring Books and Technical Documents with R Markdown #R https://t.co/O74SZyswUH  [↪](https://twitter.com/xieyihui/status/1083659237107122181)

<!-- -->

> **Bruno Lopes** (@BrunoLopes2855; 1/0): @toddmorling @R4DScommunity Peng is a good author, and this book for beginners is free. On https://t.co/HnYQC18ULN you can find other free books, for all levels.
> >
> I would also check the books by  Grolemund and Wickham - specially R 4 Data Science and Hands On Programming.
> >
> https://t.co/Y4HkXMUhT8  [↪](https://twitter.com/xieyihui/status/1083152831677431808)

<!-- -->

> **Udayan Roy** (@UdayanRoy62; 0/0): @xieyihui Is it possible to insert interactive multiple-choice questions -- as in the "Try It" boxes at https://t.co/tugPOFchsU -- in Bookdown? Please help.  [↪](https://twitter.com/xieyihui/status/1085411722159112193)

<!-- -->

> **Udayan Roy** (@UdayanRoy62; 0/0): @StatGarrett Is it possible to insert interactive multiple-choice questions -- as in the "Try It" boxes at https://t.co/tugPOFchsU -- in Bookdown? Please help.  [↪](https://twitter.com/xieyihui/status/1085410988176932865)

<!-- -->

> **Mike Rustell** (@mikerustell; 0/0): Work in progress https://t.co/hTqXeOYdsb  [↪](https://twitter.com/xieyihui/status/1085310896077983744)

<!-- -->

> **Steven Senior** (@stevensenior; 0/0): PhD thesis written in bookdown. Full marks. 👏 👏👏👏 https://t.co/YZQQ9Uzg1z  [↪](https://twitter.com/xieyihui/status/1085264410770317312)

<!-- -->

> **Oleksiy Anokhin** (@OleksiyAnokhin; 0/0): https://t.co/bNMX76BjU8  [↪](https://twitter.com/xieyihui/status/1084869706140565504)

<!-- -->

> **gradschool whisperer** (@TJ__Murphy; 0/0): So I'm  stitching together a bunch of handouts into an #rstats based online bookdown for my biostats course and its already over 20 chapters and I had no idea #blackhole  [↪](https://twitter.com/xieyihui/status/1083405520457908224)

<!-- -->

> **Maëlle Salmon 🐟** (@ma_salmon; 0/0): @espinielli @rOpenSci Well *I* started working for rOpenSci after the transition, that was mainly managed by @_inundata. Also note that https://t.co/50VMq23iYK is Hugo but not blogdown.
> For my own blog I used a standard theme with minimal tweaks, and recommend reading https://t.co/vacLkKRpPE  [↪](https://twitter.com/xieyihui/status/1083008963241635840)

<!-- -->

# knitr

> **Elio Campitelli** (@d_olivaw; 9/2): I need to knit a WIP paper to pdf and word, so I added this to my #knitr YAML.
> >
> #rstats https://t.co/q8YbILuRN1  [↪](https://twitter.com/xieyihui/status/1084892720479551488)

<!-- -->

> **Alison Hill** (@apreshill; 8/1): @JenRichmondPhD Try adding this at the top of your .R script:
> #' ---
> #' output: github_document
> #' ---
> >
> See https://t.co/AXnatObT08
> >
> As taught in @JennyBryan's What They Forgot workshop (knitr::spin is what actually happens under the hood I believe)  [↪](https://twitter.com/xieyihui/status/1083016529120129024)

<!-- -->

> **Martin John Hadley** (@martinjhnhadley; 7/1): I feel this is one of @xieyihui's #rstats knitr secrets (just like <!--html_preserve-->)... did I miss the documentation for latex, markdown and html rendering for code chunks? https://t.co/KOvuf0NKEQ  [↪](https://twitter.com/xieyihui/status/1083409601146568704)

<!-- -->

> **Yihui Xie** (@xieyihui; 6/1): @martinjhnhadley That worked just by accident. These "engines" don't exist in knitr, and the default behavior is just to echo the code: https://t.co/XFkCbFCiXz So ```{latex} is the same as ```latex. The latter is valid Pandoc Markdown syntax and triggers syntax highlighting.  [↪](https://twitter.com/xieyihui/status/1083575819795087360)

<!-- -->

> **Chris Beeley** (@ChrisBeeley; 5/0): Ooh, I'm doing parameterised RMarkdown for the first time today (done it with Shiny before, just not knitr style).
> >
> Super simple. I'm even doing some non standard evaluation with it.
> >
> Nice :-)  [↪](https://twitter.com/xieyihui/status/1085106560030908417)

<!-- -->

> **Florian @ Real Scientists DE** (@realsci_DE; 5/0): Man kann bspw. mit #rstats, #rmarkdown, #knitr und #papaja Dokumente im perfekten APA-Stil entwerfen. Eine Riesenarbeit und -leistung von @xieyihui, @FrederikAust und Co! Es ist zwar mehr Arbeit, eindeutig, aber es lohnt sich.  [↪](https://twitter.com/xieyihui/status/1083736103721549824)

<!-- -->

> **Sebastian Sauer** (@sauer_sebastian; 2/0): Writing your texts in #rmarkdown? Struggling with long lines in version control? Check out `wrap_rmd()` in package #knitr to wrap the long lines. https://t.co/7J9gJhhlbn  [↪](https://twitter.com/xieyihui/status/1084800763572953090)

<!-- -->

> **Robin Neumann** (@funktoriell; 1/0): @AlizeNero Fun fact: I did use knitr for generating reports with R in the past (https://t.co/6Ibyp2BqPI) 😂🤓
> >
> But offline-non-computer-knitting is also very awesome!  [↪](https://twitter.com/xieyihui/status/1083448441701916674)

<!-- -->

> **John Avocado 陳約翰** (@SuperCroup; 0/1): Placing two tables side by side using 'knitr' and 'kableExtra'
> >
> #rstats
> >
> https://t.co/b3OkXbsnSq  [↪](https://twitter.com/xieyihui/status/1085412966344941568)

<!-- -->

> **Zorro Notorious M. E. B.** (@znmeb; 0/1): @gronke @zotero BibLaTeX supports more types than BibTeX, but I'm not sure how that integrates in R Markdown / knitr / pandoc. Certainly one can cite packages now; the default is "Manual".  [↪](https://twitter.com/xieyihui/status/1083176259922710528)

<!-- -->

> **RPubs recent entry** (@RPubsRecent; 0/0): Test of Knitr https://t.co/uys6ESc3oP  [↪](https://twitter.com/xieyihui/status/1085050697631059968)

<!-- -->

> **TKwa** (@RansuuSan; 0/0): RとMarkDownをゆるく橋渡しするのに、knitrは良さそう  [↪](https://twitter.com/xieyihui/status/1083386603857338368)

<!-- -->

# pagedown

> **niszet🎍🌅** (@niszet0; 1/0): https://t.co/bExm8qC5wq  [↪](https://twitter.com/xieyihui/status/1083911829854670848)

<!-- -->

> **Romain Lesur** (@RLesur; 1/0): @DrArunSahni @dannyjnwong @jbedford84 @PQIPNews We've planned to automate the pdf generation with headless Chrome automation (like puppeteer), see https://t.co/9fE7W1Ejqd
> Stay tuned!  [↪](https://twitter.com/xieyihui/status/1083822661204168710)

<!-- -->

# tinytex

> **statgenet@KyotoU** (@StatgenetJ; 4/1): RmarkdownでポスターサイズのPDF作成:
> devtools::install_github("brentthorne/posterdown")
> tinytex::install_tinytex()
> >
> https://t.co/Yj5x5OSKqi https://t.co/yjlnfMyHDY  [↪](https://twitter.com/xieyihui/status/1083336364651728896)

<!-- -->

> **Mitchell O'Hara-Wild** (@mitchoharawild; 4/0): @JenRichmondPhD To knit a document to PDF you will need LaTeX installed. The easiest way to do this in R is using @xieyihui's tinytex package:
> install.packages("tinytex")
> tinytex::install_tinytex()  [↪](https://twitter.com/xieyihui/status/1083235633324220416)

<!-- -->

> **Jessica Streeter** (@phillynerd; 1/2): Current feels: stoked to put a massive analysis to bed. love rmarkdown, wish tinytex and kableExtra played together nicely though. So many headaches still :/ #rstats #myrjourney  [↪](https://twitter.com/xieyihui/status/1085277000313507841)

<!-- -->

> **Frederick Solt** (@fredericksolt; 1/0): @Daniel_Laurison Approximately me, last week.  Eventually got my problem all squared away, though, thanks to @xieyihui! https://t.co/cVIzc02c6E  [↪](https://twitter.com/xieyihui/status/1084875824669564928)

<!-- -->

> **zenrud** (@ZenrudMB; 0/0): TinyTeX: A lightweight and easy-to-maintain LaTeX distribution https://t.co/d6kVgERV7M #Tinytex #Latex  [↪](https://twitter.com/xieyihui/status/1085213045452955648)

<!-- -->

> **Debian upload** (@DebianUpload; 0/0): New upload: r-cran-tinytex 0.10-1 by Dylan Aïssi into unstable... https://t.co/wqI1yiKL9p  [↪](https://twitter.com/xieyihui/status/1084402184446492673)

<!-- -->

> **CRAN Package Updates** (@CRANberriesFeed; 0/0): CRAN updates: laeken poweRlaw spatstat tinytex https://t.co/y5W2NTKSXT #rstats  [↪](https://twitter.com/xieyihui/status/1083408712830734337)

<!-- -->

# xaringan

> **Florian Privé** (@privefl; 13/0): @humanfactorsio @ma_salmon @hadleywickham This maybe? https://t.co/Bs3z5Y8RBr  [↪](https://twitter.com/xieyihui/status/1085433104519622657)

<!-- -->

> **Emil Hvitfeldt** (@Emil_Hvitfeldt; 7/0): #rstudioconf FOMO have set in.
> [✔] - Unhealthy amount of Twitter
> [✔] - Stealing css tricks for xaringan  [↪](https://twitter.com/xieyihui/status/1085244296318439424)

<!-- -->

> **Thomas Mock 👨🏼💻 @ #rstudioconf!** (@thomas_mock; 7/0): Pretty pictures in Xaringan presentations!
> >
> #RStudioConf https://t.co/HmsZrz4b0P  [↪](https://twitter.com/xieyihui/status/1085202093726666752)

<!-- -->

> **Olivier Gimenez 🖖** (@oaggimenez; 4/0): On a technical side: To build the slides, I used the awesome #markdown by @xieyihui and the RU theme for #xaringan #html presentation https://t.co/kFTJtQSALF by @jvcasill. To create a PDF, I used decktape https://t.co/KufRACQqzA by @astefanut w/ the xaringan::decktape() command.  [↪](https://twitter.com/xieyihui/status/1085492130909425664)

<!-- -->

> **Chris Mainey** (@chrismainey; 3/0): Teaching stats with #Rmarkdown and #slidify worked brilliantly today. Going to try #xaringan for next weeks session, after @ma_salmon recommendation. Great work @xieyihui !  [↪](https://twitter.com/xieyihui/status/1083774916858658816)

<!-- -->

> **Grant McDermott** (@grant_mcdermott; 2/0): @ivanjrudik I like the metropolis theme. https://t.co/VROyOQwkVc
> >
> Having said that, I've pretty much switched over all my slides to HTML / R Markdown (using the xaringan package). In fact, they even have a metropolis clone, which is what I'm using here: https://t.co/JWmeyUzuCB  [↪](https://twitter.com/xieyihui/status/1084879720682905600)

<!-- -->

> **Maëlle Salmon 🐟** (@ma_salmon; 2/0): @chrismainey It seems xaringan is the most popular package for this these days. 🙂  [↪](https://twitter.com/xieyihui/status/1083448337532182533)

<!-- -->

> **Daniel Arantes** (@D_O_Arantes; 1/0): @humanfactorsio @ma_salmon @hadleywickham #<< in xaringan?  [↪](https://twitter.com/xieyihui/status/1085470469212594176)

<!-- -->

> **Tareef Kawaf** (@tareefk; 1/0): @YatesHeath I haven't done as much with PPT to be honest.  I typically use ioslides.   I have plans to play with xaringan, and maybe I can concoct a real use case for using PPT.   You should, in theory be able to use any number of html widgets based packages and get rmarkdown to snapshot  [↪](https://twitter.com/xieyihui/status/1084777472196075520)

<!-- -->

> **Charles T. Gray** (@cantabile; 1/0): Ha, and sure enough, @JenRichmondPhD, first xaringan::infinite_moon_reader() for the day.  [↪](https://twitter.com/xieyihui/status/1084296319647178753)

<!-- -->

> **Maëlle Salmon 🐟** (@ma_salmon; 1/0): @chrismainey I don't think I ever used slidify. I like xaringan and feel that its popularity means you're more likely to get support when you have questions  [↪](https://twitter.com/xieyihui/status/1083457789027061772)

<!-- -->

> **Chris Mainey** (@chrismainey; 0/0): Hi #rstats, does anyone know how I can use incremental bullet points with #xaringan in Markdown?  [↪](https://twitter.com/xieyihui/status/1085134931897081856)

<!-- -->

> **Heath Yates** (@YatesHeath; 0/0): @tareefk Thanks. You got me intrigued and thinking about dabbling away from PPT and in favor of HTML widgets. I did some googling, but can you offer a fav website or GitHub repo that demo's ioslides? Xaringan sounds interesting too. Thanks Tareef! :)  [↪](https://twitter.com/xieyihui/status/1085004405928325120)

<!-- -->

> **Dangerous Kidd** (@CHlLEANS; 0/0): @Tehx_15 @xNashoohh @ScoriaNetwork Sasuke el xidori tmbn el xaringan  [↪](https://twitter.com/xieyihui/status/1083525534175412225)

<!-- -->

# yihui.name

> **Jozef Hajnala** (@jozefhajnala; 11/5): 🧙♂Pretty html/pdf reports directly from R scripts!
> >
> ICYMI, with knitr::spin or rmarkdown::render you can make reports directly from #rstats scripts without creating an #RMarkdown file, just by adding simple comment tags! Example from @xieyihui himself: https://t.co/8Xap87WeTc https://t.co/7D4oYBlN7C  [↪](https://twitter.com/xieyihui/status/1082740953868312581)

<!-- -->

> **Sebastian Sauer** (@sauer_sebastian; 1/1): Tip of my day by @xieyihui: "Don't Use Spaces or Underscores in File Paths; Use Dashes Instead" when working with Latex/Rmarkdown #spacepain https://t.co/NwQzQOixvH  [↪](https://twitter.com/xieyihui/status/1085120716066967552)

<!-- -->

> **Chung-hong Chan** (@chainsawriot; 1/0): In case you don't know, his Chinese blog is even more interesting.
> https://t.co/J3kL66ueBN https://t.co/iYS5JrNA8h  [↪](https://twitter.com/xieyihui/status/1083321717546803202)

<!-- -->

> **tunggul mubowo** (@mubowo; 0/0): knitr chunk options and package options https://t.co/z63EADqibj  [↪](https://twitter.com/xieyihui/status/1082996937392050176)

<!-- -->


text:
<?hh // strict
namespace traitorous\option;

use traitorous\Option;
use traitorous\option\Some;
use traitorous\option\None;

final class OptionFactory {

    public static function fromValue<T>(?T $a): Option<T> {
        if ($a === null) {
            return new None();
        } else {
            return new Some($a);
        }
    }

}


text:
// Code generated by lister-gen. DO NOT EDIT.

package v1

import (
	"k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/labels"
	"k8s.io/client-go/tools/cache"
	v1 "knative.dev/eventing/pkg/apis/messaging/v1"
)

// SubscriptionLister helps list Subscriptions.
// All objects returned here must be treated as read-only.
type SubscriptionLister interface {
	// List lists all Subscriptions in the indexer.
	// Objects returned here must be treated as read-only.
	List(selector labels.Selector) (ret []*v1.Subscription, err error)
	// Subscriptions returns an object that can list and get Subscriptions.
	Subscriptions(namespace string) SubscriptionNamespaceLister
	SubscriptionListerExpansion
}

// subscriptionLister implements the SubscriptionLister interface.
type subscriptionLister struct {
	indexer cache.Indexer
}

// NewSubscriptionLister returns a new SubscriptionLister.
func NewSubscriptionLister(indexer cache.Indexer) SubscriptionLister {
	return &subscriptionLister{indexer: indexer}
}

// List lists all Subscriptions in the indexer.
func (s *subscriptionLister) List(selector labels.Selector) (ret []*v1.Subscription, err error) {
	err = cache.ListAll(s.indexer, selector, func(m interface{}) {
		ret = append(ret, m.(*v1.Subscription))
	})
	return ret, err
}

// Subscriptions returns an object that can list and get Subscriptions.
func (s *subscriptionLister) Subscriptions(namespace string) SubscriptionNamespaceLister {
	return subscriptionNamespaceLister{indexer: s.indexer, namespace: namespace}
}

// SubscriptionNamespaceLister helps list and get Subscriptions.
// All objects returned here must be treated as read-only.
type SubscriptionNamespaceLister interface {
	// List lists all Subscriptions in the indexer for a given namespace.
	// Objects returned here must be treated as read-only.
	List(selector labels.Selector) (ret []*v1.Subscription, err error)
	// Get retrieves the Subscription from the indexer for a given namespace and name.
	// Objects returned here must be treated as read-only.
	Get(name string) (*v1.Subscription, error)
	SubscriptionNamespaceListerExpansion
}

// subscriptionNamespaceLister implements the SubscriptionNamespaceLister
// interface.
type subscriptionNamespaceLister struct {
	indexer   cache.Indexer
	namespace string
}

// List lists all Subscriptions in the indexer for a given namespace.
func (s subscriptionNamespaceLister) List(selector labels.Selector) (ret []*v1.Subscription, err error) {
	err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
		ret = append(ret, m.(*v1.Subscription))
	})
	return ret, err
}

// Get retrieves the Subscription from the indexer for a given namespace and name.
func (s subscriptionNamespaceLister) Get(name string) (*v1.Subscription, error) {
	obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
	if err != nil {
		return nil, err
	}
	if !exists {
		return nil, errors.NewNotFound(v1.Resource("subscription"), name)
	}
	return obj.(*v1.Subscription), nil
}


text:
@implementation HWPhoto

@end


text:
package it.unibz.inf.ontop.parser;

import it.unibz.inf.ontop.io.ModelIOManager;
import it.unibz.inf.ontop.model.OBDADataFactory;
import it.unibz.inf.ontop.model.OBDAModel;
import it.unibz.inf.ontop.model.impl.OBDADataFactoryImpl;
import it.unibz.inf.ontop.owlrefplatform.core.QuestPreferences;
import it.unibz.inf.ontop.owlrefplatform.owlapi.*;
import org.junit.Before;
import org.junit.Test;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.io.ToStringRenderer;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

/**
 * Class to test if annotation property can be treated as data property and object property
 *
 *
 */
public class PrefixSourceTest {

    private OBDADataFactory fac;

    Logger log = LoggerFactory.getLogger(this.getClass());
    private OBDAModel obdaModel;
    private OWLOntology ontology;

    final String owlFile = "src/test/resources/movieontology.owl";
    final String obdaFile = "src/test/resources/newPrefixMovieOntology.obda";

    @Before
    public void setUp() throws Exception {

        fac = OBDADataFactoryImpl.getInstance();

        // Loading the OWL file
        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
        ontology = manager.loadOntologyFromOntologyDocument((new File(owlFile)));

        // Loading the OBDA data
        obdaModel = fac.getOBDAModel();

        ModelIOManager ioManager = new ModelIOManager(obdaModel);
        ioManager.load(obdaFile);

    }

    @Test
    public void testPrefixInsideURI() throws Exception {

        QuestPreferences p = new QuestPreferences();

//        p.setCurrentValueOf(QuestPreferences.SQL_GENERATE_REPLACE, QuestConstants.FALSE);

        String queryBind = "PREFIX :  <http://www.movieontology.org/2009/10/01/movieontology.owl>" +
                "PREFIX mo:  <http://www.movieontology.org/2009/10/01/movieontology.owl#>" +
                "PREFIX mo2:		<http://www.movieontology.org/2009/11/09/movieontology.owl#>" +
                "\n" +
                "SELECT  ?r " +

                "WHERE {?x a mo:East_Asian_Company ; mo2:hasCompanyLocation ?r .  \n" +

                "}";

        String results = runTestQuery(p, queryBind);
        assertEquals("<http://example.com/resource/?repository=repo&uri=http://www.movieontology.org/2009/10/01/movieontology.owl/China-24951>", results);
    }

    private String runTestQuery(QuestPreferences p, String query) throws Exception {

        // Creating a new instance of the reasoner
        QuestOWLFactory factory = new QuestOWLFactory();
        QuestOWLConfiguration config = QuestOWLConfiguration.builder().obdaModel(obdaModel).preferences(p).build();
        QuestOWL reasoner = factory.createReasoner(ontology, config);

        // Now we are ready for querying
        QuestOWLConnection conn = reasoner.getConnection();
        QuestOWLStatement st = conn.createStatement();

        log.debug("Executing query: ");
        log.debug("Query: \n{}", query);

        long start = System.nanoTime();
        QuestOWLResultSet res = st.executeTuple(query);
        long end = System.nanoTime();

        double time = (end - start) / 1000;
        String result = "";
        int count = 0;
        while (res.nextRow()) {
            count += 1;
            if (count == 1) {
                for (int i = 1; i <= res.getColumnCount(); i++) {
                    log.debug("Example result " + res.getSignature().get(i - 1) + " = " + res.getOWLObject(i));

                }
                result = ToStringRenderer.getInstance().getRendering(res.getOWLObject("r"));
            }
        }
        log.debug("Total results: {}", count);

        assertFalse(count == 0);

        log.debug("Elapsed time: {} ms", time);

        return result;

    }

}


text:
class AddStepOrderToTrainingStepTypes < ActiveRecord::Migration
  def up
    change_table :training_step_types do |t|
      t.integer :step_order, :limit => 3, :null => false, :default => 0, :comment => "Overall order for this training step type"
    end

    add_index :training_step_types, :step_order
  end

  def down
    raise ActiveRecord::IrreversibleMigration
  end
  # ---------------------------------------------------------------------------
end


text:
package features.sentencelevel;

import java.util.List;

import edu.stanford.nlp.ling.CoreAnnotations.PartOfSpeechAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.TextAnnotation;
import edu.stanford.nlp.trees.semgraph.SemanticGraph;
import edu.stanford.nlp.trees.semgraph.SemanticGraphEdge;
import edu.stanford.nlp.trees.semgraph.SemanticGraphCoreAnnotations.CollapsedCCProcessedDependenciesAnnotation;
import edu.stanford.nlp.util.CoreMap;
import TermExtraction.CLTDependency;
import TermExtraction.DependencyExtractor;
import tutorial.Tutorial;

public class ModalVerbFeature {
	public static boolean eval(Tutorial tutorial, int currentSection)
	{
		List<CoreMap> sentences = tutorial.sectionElements.get(currentSection).getAPIElementSentences(true);
		String api = tutorial.sectionElements.get(currentSection).getApiElement().getAPIElementName();
		api = api.replaceAll("\\(", "").replaceAll("\\)", "").replaceAll("\\.", "-").toLowerCase();

		boolean hasMD = false;
		for (CoreMap sent:sentences)
		{
			SemanticGraph dependencies = sent.get(CollapsedCCProcessedDependenciesAnnotation.class);

			for (SemanticGraphEdge edge:dependencies.edgeIterable())
			{
				String relation = String.valueOf(edge.getRelation()).toLowerCase();

				String dependent = edge.getDependent().get(TextAnnotation.class).toLowerCase();
				String governor = edge.getGovernor().get(TextAnnotation.class).toLowerCase();

				if (dependent.startsWith("clt_" + api) || governor.startsWith("clt_" + api))
				{

					if (edge.getGovernor().get(PartOfSpeechAnnotation.class).startsWith("VB"))
						relation+=DependencyExtractor.getDepenencyExtensions(dependencies, edge.getGovernor().get(TextAnnotation.class));

					if (edge.getDependent().get(PartOfSpeechAnnotation.class).startsWith("VB"))
						relation+=DependencyExtractor.getDepenencyExtensions(dependencies, edge.getDependent().get(TextAnnotation.class));

					if (relation.contains("_MD") || relation.contains("_TO"))
						hasMD = true;
				}
			}
		}

		return hasMD;
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="BannerLayoutStyle">
        <attr name="selectedIndicatorColor" format="color|reference" />
        <attr name="unSelectedIndicatorColor" format="color|reference" />
        <attr name="indicatorShape" format="enum">
            <enum name="rect" value="0" />
            <enum name="oval" value="1" />
        </attr>

        <attr name="selectedIndicatorHeight" format="dimension|reference" />
        <attr name="selectedIndicatorWidth" format="dimension|reference" />

        <attr name="unSelectedIndicatorHeight" format="dimension|reference" />
        <attr name="unSelectedIndicatorWidth" format="dimension|reference" />

        <attr name="indicatorPosition" format="enum">
            <enum name="centerBottom" value="0" />
            <enum name="rightBottom" value="1" />
            <enum name="leftBottom" value="2" />
            <enum name="centerTop" value="3" />
            <enum name="rightTop" value="4" />
            <enum name="leftTop" value="5" />
        </attr>

        <attr name="indicatorSpace" format="dimension|reference" />
        <attr name="indicatorMargin" format="dimension|reference" />
        <attr name="autoPlayDuration" format="integer|reference" />
        <attr name="scrollDuration" format="integer|reference" />
        <attr name="isAutoPlay" format="boolean"/>
        <attr name="defaultImage" format="integer|reference"/>
    </declare-styleable>
</resources>