text:
typedef seqan::Rng<seqan::MersenneTwister> TRng;

inline void trimAfterSpace(seqan::CharString & s);

// ============================================================================
// Tags, Classes, Enums
// ============================================================================

// ----------------------------------------------------------------------------
// Class Fragment
// ----------------------------------------------------------------------------

class Fragment
{
public:
    // Index of contig to simulate on.
    int rId;
    // Begin and end position of the fragment.
    int beginPos, endPos;

    Fragment() : rId(-1), beginPos(0), endPos(0)
    {}
};

// ----------------------------------------------------------------------------
// Class FragmentSamplerImpl
// ----------------------------------------------------------------------------

// Abstract base class for the fragment generation classes.

class FragmentSamplerImpl
{
public:
    virtual void generate(Fragment & frag, int rId, unsigned contigLength,
                          std::vector<std::pair<int, int> > const & gapIntervals) = 0;
    virtual void generateMany(std::vector<Fragment> & frags, int rId, unsigned contigLength,
                              std::vector<std::pair<int, int> > const & gapIntervals,
                              unsigned count) = 0;
};

// ----------------------------------------------------------------------------
// Class UniformFragmentSamplerImpl
// ----------------------------------------------------------------------------

// Generation of fragments with uniform length.

class UniformFragmentSamplerImpl : public FragmentSamplerImpl
{
public:
    // Minimal and maximal fragment length.
    int minLength;
    int maxLength;
    // Lower bound on fragment size.
    int fragSizeLowerBound;

    // The random number generator to use.
    TRng & rng;
    // The probability density function for the simulation.
    seqan::Pdf<seqan::Uniform<int> > pdf;

    UniformFragmentSamplerImpl(TRng & rng, int minLength, int maxLength, int fragSizeLowerBound) :
            minLength(minLength), maxLength(maxLength), fragSizeLowerBound(fragSizeLowerBound),
            rng(rng), pdf(minLength, maxLength)
    {}

    virtual void generate(Fragment & frag, int rId, unsigned contigLength,
                          std::vector<std::pair<int, int> > const & gapIntervals);

    virtual void generateMany(std::vector<Fragment> & frags, int rId, unsigned contigLength,
                              std::vector<std::pair<int, int> > const & gapIntervals,
                              unsigned count);

    void _generate(Fragment & frag, int rId, unsigned contigLength,
                   std::vector<std::pair<int, int> > const & gapIntervals);
};

// ----------------------------------------------------------------------------
// Class NormalFragmentSamplerImpl
// ----------------------------------------------------------------------------

// Generation of fragments with normally distributed length.

class NormalFragmentSamplerImpl : public FragmentSamplerImpl
{
public:
    // Mean length and length standard deviation.
    int meanLength;
    int stdDevLength;
    // Lower bound on fragment size.
    int fragSizeLowerBound;

    // The random number generator to use.
    TRng & rng;
    // The probability density function for the simulation.
    seqan::Pdf<seqan::Normal> pdf;

    NormalFragmentSamplerImpl(TRng & rng, int meanLength, int stdDevLength, int fragSizeLowerBound) :
            meanLength(meanLength), stdDevLength(stdDevLength), fragSizeLowerBound(fragSizeLowerBound),
            rng(rng), pdf(meanLength, stdDevLength)
    {}

    virtual void generate(Fragment & frag, int rId, unsigned contigLength,
                          std::vector<std::pair<int, int> > const & gapIntervals);

    virtual void generateMany(std::vector<Fragment> & frags, int rId, unsigned contigLength,
                              std::vector<std::pair<int, int> > const & gapIntervals, unsigned count);

    void _generate(Fragment & frag, int rId, unsigned contigLength,
                   std::vector<std::pair<int, int> > const & gapIntervals);
};

// ----------------------------------------------------------------------------
// Class FragmentSampler
// ----------------------------------------------------------------------------

// Generator for sequence fragments.

class FragmentSampler
{
public:
    // Configuration for the generator.
    FragmentSamplerOptions options;

    // The actual generator implementation to use.
    std::SEQAN_AUTO_PTR_NAME<FragmentSamplerImpl> impl;

    FragmentSampler(TRng & rng, FragmentSamplerOptions const & options) : options(options)
    {
        if (options.model == FragmentSamplerOptions::UNIFORM)
            impl.reset(new UniformFragmentSamplerImpl(rng, options.minFragmentSize,
                                                      options.maxFragmentSize,
                                                      options.fragSizeLowerBound));
        else
            impl.reset(new NormalFragmentSamplerImpl(rng, options.meanFragmentSize,
                                                     options.stdDevFragmentSize,
                                                     options.fragSizeLowerBound));
    }

    // Generate a fragment given a contig id and the length of the contig.
    void generate(Fragment & frag, int rId, unsigned contigLength,
                  std::vector<std::pair<int, int> > const & gapIntervals)
    {
        impl->generate(frag, rId, contigLength, gapIntervals);
    }

    // Generate multiple fragments.
    void generateMany(std::vector<Fragment> & frags, int rId, unsigned contigLength,
                  std::vector<std::pair<int, int> > const & gapIntervals, unsigned count)
    {
        impl->generateMany(frags, rId, contigLength, gapIntervals, count);
    }
};

// ============================================================================
// Metafunctions
// ============================================================================

// ============================================================================
// Functions
// ============================================================================

// --------------------------------------------------------------------------
// Function overlapsWithInterval()
// --------------------------------------------------------------------------

template <class TIter, class T>
TIter _intervalLowerBound (TIter first, TIter last, const T & val)
{
    TIter it;
    typename std::iterator_traits<TIter>::difference_type count, step;
    count = std::distance(first,last);
    while (count>0)
    {
        it = first;
        step=count / 2;
        std::advance(it, step);
        if (it->first < val)
        {
            first=++it;
            count-=step+1;
        }
        else count=step;
    }
    return first;
}

template <class TIter, class T>
TIter _intervalUpperBound (TIter first, TIter last, const T & val)
{
    TIter it;
    typename std::iterator_traits<TIter>::difference_type count, step;
    count = std::distance(first,last);
    while (count > 0)
    {
        it = first;
        step = count / 2;
        std::advance(it, step);
        if (!(val < it->second))
        {
            first = ++it;
            count -= step + 1;
        }
        else count=step;
    }
    return first;
}

inline bool overlaps(int begin0, int end0, int begin1, int end1)
{ return (begin1 < end0 && begin0 < end1); }

// Returns whether the given interval overlaps with another interval.

inline bool overlapsWithInterval(std::vector<std::pair<int, int> > const & intervals,
                                 int beginPos, int endPos)
{
    typedef std::vector<std::pair<int, int> >::const_iterator TIter;
    TIter itL = _intervalLowerBound(intervals.begin(), intervals.end(), beginPos);
    if (itL != intervals.begin())
        --itL;
    TIter itU = _intervalUpperBound(intervals.begin(), intervals.end(), endPos);
    if (itU != intervals.end())
        ++itU;
    for (TIter it = itL; it != itU; ++it)
        if (overlaps(it->first, it->second, beginPos, endPos))
            return true;
    return false;
}

// --------------------------------------------------------------------------
// Function trimAfterSpace()
// --------------------------------------------------------------------------

// TODO(holtgrew): Put into header or SeqAn library.

// Trim after the first whitespace.
inline
void trimAfterSpace(seqan::CharString & s)
{
    unsigned i = 0;
    for (; i < length(s); ++i)
        if (isspace(s[i]))
            break;
    resize(s, i);
}

// TODO(holtgrew): Too much redundancy here.

void UniformFragmentSamplerImpl::generate(Fragment & frag, int rId, unsigned contigLength,
                                          std::vector<std::pair<int, int> > const & gapIntervals)
{
    _generate(frag, rId, contigLength, gapIntervals);
}

void UniformFragmentSamplerImpl::generateMany(std::vector<Fragment> & frags, int rId, unsigned contigLength,
                                              std::vector<std::pair<int, int> > const & gapIntervals,
                                              unsigned count)
{
    frags.resize(count);
    for (unsigned i = 0; i < count; ++i)
        _generate(frags[0], rId, contigLength, gapIntervals);
}

void UniformFragmentSamplerImpl::_generate(Fragment & frag, int rId, unsigned contigLength,
                                           std::vector<std::pair<int, int> > const & gapIntervals)
{
    int fragLength = 0;
    unsigned const MAX_TRIES = 1000;
    for (unsigned tryNo = 0; tryNo < MAX_TRIES; ++tryNo)
    {
        fragLength = pickRandomNumber(rng, pdf);
        if (fragLength <= 0 || fragLength > (int)contigLength ||
            (fragSizeLowerBound && fragSizeLowerBound > fragLength))
            continue;  // Try again

        seqan::Pdf<seqan::Uniform<int> > posPdf(0, contigLength - fragLength);
        int beginPos = pickRandomNumber(rng, posPdf);

        frag.rId = rId;
        frag.beginPos = beginPos;
        frag.endPos = beginPos + fragLength;

        if (overlapsWithInterval(gapIntervals, frag.beginPos, frag.endPos))
            continue;  // overlaps with a gap

        SEQAN_ASSERT_LEQ(frag.endPos, (int)contigLength);
        break;
    }
}

void NormalFragmentSamplerImpl::generate(Fragment & frag, int rId, unsigned contigLength,
                                         std::vector<std::pair<int, int> > const & gapIntervals)
{
    _generate(frag, rId, contigLength, gapIntervals);
}

void NormalFragmentSamplerImpl::generateMany(std::vector<Fragment> & frags, int rId, unsigned contigLength,
                                             std::vector<std::pair<int, int> > const & gapIntervals, unsigned count)
{
    frags.resize(count);
    for (unsigned i = 0; i < count; ++i)
        _generate(frags[i], rId, contigLength, gapIntervals);
}

void NormalFragmentSamplerImpl::_generate(Fragment & frag, int rId, unsigned contigLength,
                                          std::vector<std::pair<int, int> > const & gapIntervals)
{
    int fragLength = 0;
    unsigned const MAX_TRIES = 1000;
    unsigned tryNo = 0;
    for (; tryNo < MAX_TRIES; ++tryNo)
    {
        fragLength = static_cast<int>(pickRandomNumber(rng, pdf));
        if (fragLength <= 0 || fragLength > (int)contigLength ||
            (fragSizeLowerBound && fragSizeLowerBound > fragLength))
            continue;  // Try again

        seqan::Pdf<seqan::Uniform<int> > posPdf(0, contigLength - fragLength);
        int beginPos = pickRandomNumber(rng, posPdf);

        frag.rId = rId;
        frag.beginPos = beginPos;
        frag.endPos = beginPos + fragLength;

        if (overlapsWithInterval(gapIntervals, frag.beginPos, frag.endPos))
            continue;  // overlaps with a gap

        SEQAN_ASSERT_LEQ(frag.endPos, (int)contigLength);
        break;
    }

    if (tryNo == MAX_TRIES)
    {
        std::cerr << "WARNING: Tried " << MAX_TRIES << " times to sample fragment from contig of size "
                  << contigLength << ".  Giving up.\n";
    }
}

#endif  // #ifndef EXTRAS_APPS_MASON2_FRAGMENT_GENERATION_H_


text:
/**
 * The record type for an object containing functions for
 *     serializing part of the workspace.
 *
 * @namespace Blockly.serialization.ISerializer
 */
import * as goog from '../../closure/goog/goog.js';
goog.declareModuleId('Blockly.serialization.ISerializer');

import type {Workspace} from '../workspace.js';

/**
 * Serializes and deserializes a plugin or system.
 *
 * @alias Blockly.serialization.ISerializer.ISerializer
 */
export interface ISerializer {
  /**
   * A priority value used to determine the order of deserializing state.
   * More positive priorities are deserialized before less positive
   * priorities. Eg if you have priorities (0, -10, 10, 100) the order of
   * deserialiation will be (100, 10, 0, -10).
   * If two serializers have the same priority, they are deserialized in an
   * arbitrary order relative to each other.
   */
  priority: number;

  /* eslint-disable no-unused-vars, valid-jsdoc */

  /**
   * Saves the state of the plugin or system.
   *
   * @param workspace The workspace the system to serialize is associated with.
   * @returns A JS object containing the system's state, or null if there is no
   *     state to record.
   */
  save(workspace: Workspace): Object|null;
  /* eslint-enable valid-jsdoc */

  /**
   * Loads the state of the plugin or system.
   *
   * @param state The state of the system to deserialize. This will always be
   *     non-null.
   * @param workspace The workspace the system to deserialize is associated
   *     with.
   */
  load(state: Object, workspace: Workspace): void;

  /**
   * Clears the state of the plugin or system.
   *
   * @param workspace The workspace the system to clear the state of is
   *     associated with.
   */
  clear(workspace: Workspace): void;
}
/* eslint-enable no-unused-vars */

redpajama_set_name: RedPajamaGithub


text:
namespace TraktApiSharp.Objects.Post.Scrobbles.Responses.Json.Reader
{
    using Basic.Json.Reader;
    using Enums;
    using Get.Movies.Json.Reader;
    using Newtonsoft.Json;
    using Objects.Json;
    using System.Threading;
    using System.Threading.Tasks;

    internal class MovieScrobblePostResponseObjectJsonReader : AObjectJsonReader<ITraktMovieScrobblePostResponse>
    {
        public override async Task<ITraktMovieScrobblePostResponse> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            if (jsonReader == null)
                return await Task.FromResult(default(ITraktMovieScrobblePostResponse));

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
            {
                var sharingReader = new SharingObjectJsonReader();
                var movieReader = new MovieObjectJsonReader();
                ITraktMovieScrobblePostResponse movieScrobbleResponse = new TraktMovieScrobblePostResponse();

                while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
                {
                    var propertyName = jsonReader.Value.ToString();

                    switch (propertyName)
                    {
                        case JsonProperties.SCROBBLE_POST_RESPONSE_PROPERTY_NAME_ID:
                            {
                                var value = await JsonReaderHelper.ReadUnsignedLongIntegerAsync(jsonReader, cancellationToken);

                                if (value.First)
                                    movieScrobbleResponse.Id = value.Second;

                                break;
                            }
                        case JsonProperties.SCROBBLE_POST_RESPONSE_PROPERTY_NAME_ACTION:
                            movieScrobbleResponse.Action = await JsonReaderHelper.ReadEnumerationValueAsync<TraktScrobbleActionType>(jsonReader, cancellationToken);
                            break;
                        case JsonProperties.SCROBBLE_POST_RESPONSE_PROPERTY_NAME_PROGRESS:
                            {
                                var value = await JsonReaderHelper.ReadFloatValueAsync(jsonReader, cancellationToken);

                                if (value.First)
                                    movieScrobbleResponse.Progress = value.Second;

                                break;
                            }
                        case JsonProperties.SCROBBLE_POST_RESPONSE_PROPERTY_NAME_SHARING:
                            movieScrobbleResponse.Sharing = await sharingReader.ReadObjectAsync(jsonReader, cancellationToken);
                            break;
                        case JsonProperties.MOVIE_SCROBBLE_POST_RESPONSE_PROPERTY_NAME_MOVIE:
                            movieScrobbleResponse.Movie = await movieReader.ReadObjectAsync(jsonReader, cancellationToken);
                            break;
                        default:
                            await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);
                            break;
                    }
                }

                return movieScrobbleResponse;
            }

            return await Task.FromResult(default(ITraktMovieScrobblePostResponse));
        }
    }
}


text:
using System;
using System.Threading.Tasks;
using GalaSoft.MvvmLight;

namespace MvvmLightListRowBindings.Droid.ViewModels
{
	public class CountdownViewItem:ViewModelBase
	{
	    private readonly DateTime _expirationTimestamp;

		public CountdownViewItem(TimeSpan timespan)
		{
			if (timespan == null) throw new ArgumentNullException (nameof (timespan));
			_expirationTimestamp = DateTime.UtcNow + timespan;
			Countdown ();
		}

		string _remainingTimeString;
		public string RemainingTimeString {
			get {
				return _remainingTimeString;
			}
			set {
				if (value == _remainingTimeString) return;
				_remainingTimeString = value;
				RaisePropertyChanged (nameof (RemainingTimeString));
			}
		}

		private async void Countdown ()
		{
			while (DateTime.UtcNow < _expirationTimestamp)
			{
				var remainingTime = _expirationTimestamp - DateTime.UtcNow;
				RemainingTimeString = remainingTime.ToString (@"hh\:mm\:ss");
				await Task.Delay(millisecondsDelay: 1000);
			}

			RemainingTimeString = "Timer Expired";
		}
	}

}


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('visit', '0009_auto_20150429_0450'),
    ]

    operations = [
        migrations.CreateModel(
            name='Location',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('name', models.CharField(unique=True, max_length=255)),
            ],
            options={
                'ordering': ('name',),
            },
        ),
        migrations.AlterField(
            model_name='visit',
            name='location',
            field=models.ForeignKey(related_name='visits', to='visit.Location'),
        ),
    ]


text:
<?php

/**
 * Shopping Cart widget class
 *
 * @since 3.8
 *
 * @todo  Check if widget_wp_shopping_cart_init function is still required?
 */
class WP_Widget_Shopping_Cart extends WP_Widget {

	/**
	 * Widget Constuctor
	 */
	function WP_Widget_Shopping_Cart() {

		$widget_ops = array(
			'classname'   => 'widget_wpsc_shopping_cart',
			'description' => __( 'Shopping Cart Widget', 'wpsc' )
		);

		$this->WP_Widget( 'wpsc_shopping_cart', __( '(WPEC) Shopping Cart', 'wpsc' ), $widget_ops );

	}

	/**
	 * Widget Output
	 *
	 * @param $args (array)
	 * @param $instance (array) Widget values.
	 *
	 */
	function widget( $args, $instance ) {

		extract( $args );

		// Create fancy collapser
		$fancy_collapser = '';
		if ( $instance['show_sliding_cart'] == 1 ) {
			if ( isset($_SESSION['slider_state']) && is_numeric( $_SESSION['slider_state'] ) ) {
				if ( $_SESSION['slider_state'] == 0 ) {
					$collapser_image = 'plus.png';
				} else {
					$collapser_image = 'minus.png';
				}
				$fancy_collapser = ' ';
			} else {
				if ( ! wpsc_get_customer_meta( 'nzshpcart' ) ) {
					$collapser_image = 'plus.png';
				} else {
					$collapser_image = 'minus.png';
				}
				$fancy_collapser = ' ';
			}
		}

		// Start widget output
		$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Shopping Cart', 'wpsc' ) : $instance['title'] );
		echo $before_widget;

		if ( $title )
			echo $before_title . $title . $fancy_collapser . $after_title;

		// Set display state
		$display_state = '';
		if ( ( ( isset( $_SESSION['slider_state'] ) && ( $_SESSION['slider_state'] == 0 ) ) || ( wpsc_cart_item_count() < 1 ) ) && ( get_option( 'show_sliding_cart' ) == 1 ) )
			$display_state = 'style="display: none;"';

		// Output start, if we are not allowed to save results ( WPSC_DONT_CACHE ) load the cart using ajax
		$use_object_frame = false;
		if ( WPSC_PAGE_CACHE_IN_USE  ) {
			echo '
';
			if ( ( strstr( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) == false ) && ( $use_object_frame == true ) ) {
				?>
				<object codetype="text/html" type="text/html" data="index.php?wpsc_action=cart_html_page" border="0">

<?php _e( 'Loading...', 'wpsc' ); ?>

				</object>
				<?php
			} else {
				?>

<?php _e( 'Loading...', 'wpsc' ); ?>

				<?php
			}
			echo '
';
		} else {
			echo '
';
			include( wpsc_get_template_file_path( 'wpsc-cart_widget.php' ) );
			echo '
';
		}

		// End widget output
		echo $after_widget;

	}

	/**
	 * Update Widget
	 *
	 * @param $new_instance (array) New widget values.
	 * @param $old_instance (array) Old widget values.
	 *
	 * @return (array) New values.
	 */
	function update( $new_instance, $old_instance ) {

		$instance = $old_instance;
		$instance['title']  = strip_tags( $new_instance['title'] );
		$instance['show_sliding_cart']  = strip_tags( $new_instance['show_sliding_cart'] );
		return $instance;
	}

	/**
	 * Widget Options Form
	 *
	 * @param $instance (array) Widget values.
	 */
	function form( $instance ) {
		global $wpdb;

		// Defaults
		$instance = wp_parse_args( (array)$instance, array(
			'title' => __( 'Shopping Cart', 'wpsc' ),
			'show_sliding_cart' => 0
		) );

		// Values
		$title = esc_attr( $instance['title'] );
		$show_sliding_cart = esc_attr( $instance['show_sliding_cart'] );
		if( 1 == $show_sliding_cart)
			$show_sliding_cart = 'checked="checked"';
		else
			$show_sliding_cart = '';
		?>

			<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'wpsc' ); ?>
			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" />

		<input type='hidden' name="<?php echo $this->get_field_name( 'show_sliding_cart' ); ?>" value='0' />

			<label for="<?php echo $this->get_field_id('show_sliding_cart'); ?>"><?php _e( 'Use Sliding Cart:', 'wpsc' ); ?>
			<input id="<?php echo $this->get_field_id( 'show_sliding_cart' ); ?>" name="<?php echo $this->get_field_name( 'show_sliding_cart' ); ?>" type="checkbox" value="1" <?php echo $show_sliding_cart; ?> />

		<?php
	}
}
add_action( 'widgets_init', create_function( '', 'return register_widget("WP_Widget_Shopping_Cart");' ) );

?>


text:
if(!dojo._hasResource["dojox.off"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojox.off"] = true;
dojo.provide("dojox.off");
dojo.require("dojox.off._common");

}


text:
package club.cookbean.sparrow.cache;

import club.cookbean.sparrow.exception.CacheWritingException;
import club.cookbean.sparrow.redis.Cacheable;
import club.cookbean.sparrow.writer.CacheWriter;

/**
 * Created by Bennett Dong

 * Date : 2017/8/4

 * Mail: dongshujin.beans@gmail.com

 * Desc:
 */
public interface Writable {

    void deleteWithWriter(String key) throws CacheWritingException;

    void deleteAllWithWriter(String... key) throws CacheWritingException;

    void setWithWriter(String key, Cacheable value) throws CacheWritingException;

    long lpushWithWriter(String key, Cacheable... values) throws CacheWritingException;

    long saddWithWriter(final String key, final Cacheable... values) throws CacheWritingException;
}


text:
import * as actions from "./author.actions";
import { addOrUpdate, pluckOut } from "../core";

export const removeAuthorReducer = (state, action) => {
    if (action instanceof actions.RemoveAuthorAction)
        pluckOut({ items: state.authors, value: action.entity.id });
    return state;
}

export const addAuthorReducer = (state, action) => {
    if (action instanceof actions.AddOrUpdateAuthorAction) {
        addOrUpdate({ items: state.authors, item: action.entity });
    }
    return state;
}

export const allAuthorsReducer = (state, action) => {
    if (action instanceof actions.AllAuthorsAction) {
        state.authors = action.entities;
    }
    return state;
}

export const setCurrentAuthorReducer = (state, action) => {
    if (action instanceof actions.SetCurrentAuthorAction) {
        state.currentAuthorId = action.id;
    }
    return state;
}


text:
**Final Year Project'16 [B.E.]**

Project Phase - 1 [PP1]
----------------------

###[Project Approval Presentation](https://github.com/suraj-jayakumar/capstoneproject/blob/master/PP1%20Project%20Approval/Project%20Review%20Presentation.pptx)

###[Project Review Presentation](https://github.com/suraj-jayakumar/capstoneproject/blob/master/PP1%20Project%20Approval/Project%20Review%20Presentation.pptx)

### [Literature Survey](https://github.com/suraj-jayakumar/capstoneproject/tree/master/PP1%20Literature%20Survey%20Review)

### [Report](https://github.com/suraj-jayakumar/capstoneproject/tree/master/PP1%20Report)

### [Pre-alpha]

#### Movie Sentiment HeartBeat
* Collect Tweets of particular movie and store it in .csv file
* Run NBayesClassifier.py first
* Run normalplot.py parallely to get sentiment heartbeat graph

#### Stream Tweets
Run GetTweets.py or newTwitterStream.py to stream tweets based on topic

Project Phase - 2 [PP2]
------------------------
## [Architecture Details](https://github.com/suraj-jayakumar/capstoneproject/blob/master/PP2%20src/T1.png)

* **Data Collection Center**
      - [Stream ~2000+ Tweets of a given user](https://github.com/suraj-jayakumar/capstoneproject/blob/master/PP2%20src/data_collection_center/StreamTweets.py)
      - [Stream ~2000+ Tweets for a given topic](https://github.com/suraj-jayakumar/capstoneproject/blob/master/PP2%20src/data_collection_center/TweetsByTopic.py)

* **Training Datsets Used**
      - [Huge Tweet Corpus - Classified](http://help.sentiment140.com/for-students/)
      - [University of Michigan Sentiment Analysis competition on Kaggle](https://inclass.kaggle.com/c/si650winter11)
      - [Twitter Sentiment Corpus by Niek Sanders](http://www.sananalytics.com/lab/twitter-sentiment/)

* **Preprocessing**
      - [Tweet Data Cleaning](https://github.com/suraj-jayakumar/sentiment-analysis/blob/master/src/supervised_learning/classifier_tweets/PreProcessing.py)
* **Supervised Learning Model**
      - [Naive-Bayes Classifier for Tweets](https://github.com/suraj-jayakumar/sentiment-analysis/blob/master/src/supervised_learning/classifier_tweets/TrainData.py)
      - [Naive-Bayes Classifier for Articles](https://github.com/suraj-jayakumar/sentiment-analysis/blob/master/src/supervised_learning/classifier_articles/simpleNB)
      - [Multinomial Baysian Classifier using Term Frequency - Inverse Document Frequency [TF-IDF]  for Articles](https://github.com/suraj-jayakumar/sentiment-analysis/blob/master/src/supervised_learning/classifier_articles/multinomialNB)
      - [Long Short Term Memory [LSTM] with Word2Vector Model [word2vec]  for Articles](https://github.com/suraj-jayakumar/sentiment-analysis/blob/master/src/supervised_learning/classifier_articles/lstm_w2v)
      - [Long Short Term Memory [LSTM] with Document2Vector Model [doc2vec]  for Articles](https://github.com/suraj-jayakumar/sentiment-analysis/tree/master/src/supervised_learning/classifier_articles/lstm_d2v)
* **Visualization Center**
      - Word Cloud Graph(https://github.com/suraj-jayakumar/sentiment-analysis/blob/master/src/visualization/wordcloud.py)
      - Stacked Represenation of Postive and Negative Tweets(https://github.com/suraj-jayakumar/sentiment-analysis/blob/master/src/visualization/bar_stacked.py)
      - Location Bubble Graph

© 2015-2016 Suraj Jayakumar under [MIT License](https://github.com/suraj-jayakumar/capstoneproject/blob/master/LICENSE.txt "Title")


text:
package net.blay09.mods.cookingbook.block;

import net.blay09.mods.cookingbook.CookingForBlockheads;
import net.blay09.mods.cookingbook.CookingConfig;
import net.blay09.mods.cookingbook.client.render.SinkBlockRenderer;
import net.blay09.mods.cookingbook.registry.CookingRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;

public class BlockSink extends BlockContainer {

    public BlockSink() {
        super(Material.wood);

        setBlockName("cookingbook:sink");
        setCreativeTab(CookingForBlockheads.creativeTab);
        setStepSound(soundTypeWood);
        setHardness(5f);
        setResistance(10f);
        setBlockBounds(0.0625f, 0f, 0.0625f, 0.9375f, 0.975f, 0.9375f);
    }

    @Override
    public void onBlockAdded(World worldIn, int x, int y, int z) {
        super.onBlockAdded(worldIn, x, y, z);
        findOrientation(worldIn, x, y, z);
    }

    private void findOrientation(World world, int x, int y, int z) {
        if (!world.isRemote) {
            Block block = world.getBlock(x, y, z - 1);
            Block block1 = world.getBlock(x, y, z + 1);
            Block block2 = world.getBlock(x - 1, y, z);
            Block block3 = world.getBlock(x + 1, y, z);
            byte side = 3;
            if (block.isOpaqueCube() && !block1.isOpaqueCube()) {
                side = 3;
            }
            if (block1.isOpaqueCube() && !block.isOpaqueCube()) {
                side = 2;
            }
            if (block2.isOpaqueCube() && !block3.isOpaqueCube()) {
                side = 5;
            }
            if (block3.isOpaqueCube() && !block2.isOpaqueCube()) {
                side = 4;
            }
            world.setBlockMetadataWithNotify(x, y, z, side, 2);
        }
    }

    @Override
    public boolean isOpaqueCube()
    {
        return false;
    }

    @Override
    public boolean renderAsNormalBlock() {
        return false;
    }

    @Override
    public int getRenderType() {
        return SinkBlockRenderer.RENDER_ID;
    }

    @Override
    public void registerBlockIcons(IIconRegister iconRegister) {
    }

    @Override
    public IIcon getIcon(int side, int metadata) {
        return Blocks.log.getIcon(side, 1);
    }

    @Override
    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
        if (FluidContainerRegistry.isEmptyContainer(player.getHeldItem())) {
            FluidStack fluidStack = null;
            int amount = FluidContainerRegistry.getContainerCapacity(new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME), player.getHeldItem());
            if(CookingConfig.sinkRequiresWater) {
                TileEntitySink sink = (TileEntitySink) world.getTileEntity(x, y, z);
                if(sink.getWaterAmount() >= amount) {
                    fluidStack = sink.drain(ForgeDirection.UNKNOWN, amount, true);
                }
            } else {
                fluidStack = new FluidStack(FluidRegistry.WATER, amount);
            }
            if(fluidStack != null && fluidStack.amount >= amount) {
                ItemStack filledContainer = FluidContainerRegistry.fillFluidContainer(fluidStack, player.getHeldItem());
                if (filledContainer != null) {
                    if (player.getHeldItem().stackSize <= 1) {
                        player.inventory.setInventorySlotContents(player.inventory.currentItem, filledContainer);
                    } else {
                        if (player.inventory.addItemStackToInventory(filledContainer)) {
                            player.getHeldItem().stackSize--;
                        }
                    }
                }
                spawnParticles(world, x, y, z);
            }
            return true;
        } else if(FluidContainerRegistry.isFilledContainer(player.getHeldItem())) {
            FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(player.getHeldItem());
            if(CookingConfig.sinkRequiresWater) {
                TileEntitySink sink = (TileEntitySink) world.getTileEntity(x, y, z);
                sink.fill(ForgeDirection.UNKNOWN, fluidStack, true);
            }
            ItemStack emptyContainer = FluidContainerRegistry.drainFluidContainer(player.getHeldItem());
            if(emptyContainer != null) {
                if(player.getHeldItem().stackSize <= 1) {
                    player.inventory.setInventorySlotContents(player.inventory.currentItem, emptyContainer);
                } else {
                    if(player.inventory.addItemStackToInventory(emptyContainer)) {
                        player.getHeldItem().stackSize--;
                    }
                }
            }
            spawnParticles(world, x, y, z);
            return true;
        } else {
            ItemStack resultStack = CookingRegistry.getSinkOutput(player.getHeldItem());
            if(resultStack != null) {
                ItemStack oldItem = player.getHeldItem();
                NBTTagCompound tagCompound = oldItem.getTagCompound();
                ItemStack newItem = resultStack.copy();
                newItem.setTagCompound(tagCompound);
                if(oldItem.stackSize <= 1) {
                    player.inventory.setInventorySlotContents(player.inventory.currentItem, newItem);
                } else {
                    if(player.inventory.addItemStackToInventory(newItem)) {
                        oldItem.stackSize--;
                    }
                }
                spawnParticles(world, x, y, z);
                return true;
            } else {
                if(CookingConfig.sinkRequiresWater) {
                    TileEntitySink sink = (TileEntitySink) world.getTileEntity(x, y, z);
                    if(sink.getWaterAmount() < FluidContainerRegistry.BUCKET_VOLUME) {
                        return false;
                    }
                }
                spawnParticles(world, x, y, z);
            }
        }
        return false;
    }

    public void spawnParticles(World world, int x, int y, int z) {
        int metadata = world.getBlockMetadata(x, y, z);
        float dripWaterX = 0f;
        float dripWaterZ = 0f;
        switch(metadata) {
            case 2: dripWaterZ = 0.25f; dripWaterX = -0.05f; break;
            case 3: dripWaterX = 0.25f; break;
            case 4: dripWaterX = 0.25f; dripWaterZ = 0.25f; break;
            case 5: dripWaterZ = -0.05f; break;
        }
        float particleX = (float) x + 0.5f;
        float particleY = (float) y + 1.25f;
        float particleZ = (float) z + 0.5f;
        world.spawnParticle("dripWater", (double) particleX + dripWaterX, (double) particleY - 0.45f, (double) particleZ + dripWaterZ, 0, 0, 0);
        for(int i = 0; i < 5; i++) {
            world.spawnParticle("splash", (double) particleX + Math.random() - 0.5f, (double) particleY + Math.random() - 0.5f, (double) particleZ + Math.random() - 0.5f, 0, 0, 0);
        }
    }

    @Override
    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase placer, ItemStack itemStack) {
        int l = MathHelper.floor_double((double) (placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
        if (l == 0) {
            world.setBlockMetadataWithNotify(x, y, z, 2, 2);
        }
        if (l == 1) {
            world.setBlockMetadataWithNotify(x, y, z, 5, 2);
        }
        if (l == 2) {
            world.setBlockMetadataWithNotify(x, y, z, 3, 2);
        }
        if (l == 3) {
            world.setBlockMetadataWithNotify(x, y, z, 4, 2);
        }
    }

    @Override
    public TileEntity createNewTileEntity(World world, int metadata) {
        return new TileEntitySink();
    }

}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.prestosql.plugin.localfile;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.prestosql.spi.connector.ColumnHandle;
import io.prestosql.spi.connector.ColumnMetadata;
import io.prestosql.spi.type.Type;

import java.util.Objects;

import static com.google.common.base.MoreObjects.toStringHelper;
import static java.util.Objects.requireNonNull;

public class LocalFileColumnHandle
        implements ColumnHandle
{
    public static final int SERVER_ADDRESS_ORDINAL_POSITION = -1;
    public static final String SERVER_ADDRESS_COLUMN_NAME = "server_address";

    private final String columnName;
    private final Type columnType;
    private final int ordinalPosition;

    @JsonCreator
    public LocalFileColumnHandle(
            @JsonProperty("columnName") String columnName,
            @JsonProperty("columnType") Type columnType,
            @JsonProperty("ordinalPosition") int ordinalPosition)
    {
        this.columnName = requireNonNull(columnName, "columnName is null");
        this.columnType = requireNonNull(columnType, "columnType is null");
        this.ordinalPosition = ordinalPosition;
    }

    @JsonProperty
    public String getColumnName()
    {
        return columnName;
    }

    @JsonProperty
    public Type getColumnType()
    {
        return columnType;
    }

    @JsonProperty
    public int getOrdinalPosition()
    {
        return ordinalPosition;
    }

    public ColumnMetadata toColumnMetadata()
    {
        return new ColumnMetadata(columnName, columnType);
    }

    @Override
    public boolean equals(Object o)
    {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        LocalFileColumnHandle that = (LocalFileColumnHandle) o;
        return Objects.equals(columnName, that.columnName) &&
                Objects.equals(columnType, that.columnType) &&
                Objects.equals(ordinalPosition, that.ordinalPosition);
    }

    @Override
    public int hashCode()
    {
        return Objects.hash(columnName, columnType, ordinalPosition);
    }

    @Override
    public String toString()
    {
        return toStringHelper(this)
                .add("columnName", columnName)
                .add("columnType", columnType)
                .add("ordinalPosition", ordinalPosition)
                .toString();
    }
}


text:
package main

import (
	"context"
	"crypto/sha256"
	"encoding/hex"
	"flag"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"strings"

	"github.com/google/go-github/v24/github"
	"golang.org/x/oauth2"
	yaml "gopkg.in/yaml.v2"
)

type AssetDetails struct {
	Url      string
	Filename string
	Sha      string
}

type DefaultVersion struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
}

type Manifest struct {
	DefaultVersions []DefaultVersion `yaml:"default_versions"`
	Dependencies    []Dependency     `yaml:"dependencies"`
}

// Adapted from ioutil.WriteFile
func copyToFile(filepath string, source io.Reader) error {
	f, err := os.Create(filepath)
	if err != nil {
		return err
	}
	_, err = io.Copy(f, source)
	if err1 := f.Close(); err == nil {
		err = err1
	}
	return err
}

func downloadFile(filepath string, url string) error {
	// Get the data
	resp, err := http.Get(url)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	// Write the body to file
	err = copyToFile(filepath, resp.Body)
	if err != nil {
		return err
	}

	return nil
}

func getAssetSha(assetDetails AssetDetails) (sha string) {
	tmpDir, err := ioutil.TempDir("/tmp", "create_buildpacks")
	if err != nil {
		log.Fatalf("Temporary download dir could not be created %v", err)
	}
	defer os.RemoveAll(tmpDir)

	downloadFileName := fmt.Sprintf("%s/%s", tmpDir, assetDetails.Filename)
	err = downloadFile(downloadFileName, assetDetails.Url)
	if err != nil {
		log.Fatalf("File %s could not be downloaded to %s %v", assetDetails.Url, downloadFileName, err)
	}
	f, err := os.Open(downloadFileName)
	if err != nil {
		log.Fatalf("File %s could not be opened %v", downloadFile, err)
	}
	defer f.Close()
	hasher := sha256.New()
	if _, err := io.Copy(hasher, f); err != nil {
		log.Fatalf("Calculating SHA256SUM of %s failed %v", downloadFileName, err)
	}
	return hex.EncodeToString(hasher.Sum(nil))
}

func readManifest(ctx context.Context, githubClient *github.Client, buildpack Buildpack, latestRelease *github.RepositoryRelease) (manifest Manifest) {
	fileContent, _, _, err := githubClient.Repositories.GetContents(
		ctx,
		"cloudfoundry",
		buildpack.RepoName,
		"manifest.yml",
		&github.RepositoryContentGetOptions{
			Ref: *latestRelease.TagName,
		},
	)
	if err != nil {
		// log.Fatalf("could not get contents for manifest for %s, %v", buildpack.RepoName, err)
		return manifest
	}
	fileBytes, err := fileContent.GetContent()
	if err != nil {
		log.Fatalf("could not read contents for manifest for %s, %v", buildpack.RepoName, err)
	}
	err = yaml.Unmarshal([]byte(fileBytes), &manifest)
	if err != nil {
		log.Fatalf("could not unmarshal manifest as YAML, %v", err)
	}
	return manifest
}

func downloadSha(url, repoName string) (shasum string) {
	resp, err := http.Get(url)
	if err != nil {
		log.Fatalf("could not download shasum for %s, %v", repoName, err)
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatalf("could not read response for shasum for %s, %v", repoName, err)
	}
	return strings.Split(string(body), " ")[0]
}

func getAssetDetails(assets []github.ReleaseAsset, repoName, nameFilter string) (assetDetails AssetDetails, ok bool) {
	ok = false
	for _, asset := range assets {
		assetName := *asset.Name
		if nameFilter != "" && !strings.Contains(assetName, nameFilter) {
			continue
		}
		if strings.HasSuffix(assetName, ".zip") {
			assetDetails.Url = *asset.BrowserDownloadURL
			assetDetails.Filename = assetName
			ok = true
		}
		if strings.HasSuffix(assetName, "SHA256SUM.txt") {
			assetDetails.Sha = downloadSha(*asset.BrowserDownloadURL, repoName)
		}
	}
	return assetDetails, ok
}

func main() {
	var result *Buildpacks
	err := yaml.NewDecoder(os.Stdin).Decode(&result)
	if err != nil {
		log.Fatalf("could not unmarshal YAML from stdin: %v", err)
	}

	ctx := context.Background()
	var githubClient *github.Client
	githubToken, ok := os.LookupEnv("GITHUB_API_TOKEN")
	if !ok {
		log.Printf("environment variable GITHUB_API_TOKEN not set. If GitHub communication errors are seen, you may need to export a token with 'public_repo' access")
		githubClient = github.NewClient(nil)
	} else {
		ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: githubToken})
		tc := oauth2.NewClient(ctx, ts)
		githubClient = github.NewClient(tc)
	}

	flag.Parse()
	buildpacks_to_update := map[string]bool{}
	args := flag.Args()
	if len(args) == 0 {
		log.Printf("Will update all buildpacks in the configuration file")
		for _, buildpack := range result.Buildpacks {
			buildpacks_to_update[buildpack.Name] = true
		}
	} else {
		log.Printf("Will update the following buildpacks if they existin the configuration file: %v", args)
		for _, arg := range args {
			buildpacks_to_update[arg] = true
		}
	}

	buildpackConfig := Buildpacks{}
	for _, buildpack := range result.Buildpacks {
		log.Printf("Checking %s", buildpack.Name)
		if _, found := buildpacks_to_update[buildpack.Name]; !found {
			log.Printf("Skipping updating %s (%s) because it was not given as an argumetn\n", buildpack.Name, buildpack.Stack)
			buildpackConfig.Buildpacks = append(buildpackConfig.Buildpacks, buildpack)
			continue
		}

		log.Printf("Processing %s (%s)\n", buildpack.Name, buildpack.Stack)
		latestRelease, _, err := githubClient.Repositories.GetLatestRelease(ctx, "cloudfoundry", buildpack.RepoName)
		if err != nil {
			log.Fatalf("could not get latest release for %s, %v", buildpack.RepoName, err)
		}

		assetDetails, ok := getAssetDetails(latestRelease.Assets, buildpack.RepoName, buildpack.Stack)
		if !ok {
			assetDetails, ok = getAssetDetails(latestRelease.Assets, buildpack.RepoName, "")
			if !ok {
				log.Fatalf("could not find assets for release %s", *latestRelease.URL)
			}
		}

		manifest := readManifest(ctx, githubClient, buildpack, latestRelease)
		if assetDetails.Sha == "" {
			log.Printf("SHA for %s %s could not be read. Downloading %s to determine correct SHA for buildpack config.\n", buildpack.Name, *latestRelease.TagName, assetDetails.Url)
			assetDetails.Sha = getAssetSha(assetDetails)

		}
		newBuildpack := Buildpack{
			Name:         buildpack.Name,
			RepoName:     buildpack.RepoName,
			Stack:        buildpack.Stack,
			Filename:     assetDetails.Filename,
			Sha:          assetDetails.Sha,
			Url:          assetDetails.Url,
			Version:      *latestRelease.TagName,
			Dependencies: manifest.Dependencies,
		}

		buildpackConfig.Buildpacks = append(buildpackConfig.Buildpacks, newBuildpack)
	}
	newBuildpacksYaml, err := yaml.Marshal(buildpackConfig)
	if err != nil {
		log.Fatalf("could not marshal buildpackConfig into yaml, %v", err)
	}
	fmt.Print(string(newBuildpacksYaml))
}


text:
package com.skynav.ttv.model.value;

public interface Color {
    double getRed();
    double getGreen();
    double getBlue();
    double getAlpha();
}


text:
import ApiProxy from './ApiProxy';
import NoteInput from './NoteInput';

class MidiIn extends ApiProxy {
    constructor(target) {
        super(target);
        this._extendMethodClassMap({
            'createNoteInput': NoteInput,
        });
    }
}

/**
 * Instances of this interface are used to setup handler functions for incoming MIDI messages
 * from a specific MIDI hardware.
 *
 * @since Bitwig Studio 1.0
 */
declare interface MidiIn {
    /**
     * Registers a callback for receiving short (normal) MIDI messages on this MIDI input port.
     *
     * @param {function} callback a callback function that receives three integer parameters:
                    1. the status byte
                    2. the data1 value
                    2. the data2 value
     * @throws ControlSurfaceException
     * @since Bitwig Studio 1.0
     */
    setMidiCallback(callback?: Function): void;

    /**
     * Registers a callback for receiving sysex MIDI messages on this MIDI input port.
     *
     * @param {function} callback a callback function that takes a single string argument
     * @throws ControlSurfaceException
     * @since Bitwig Studio 1.0
     */
    setSysexCallback(callback?: Function): void;

    /**
     * Creates a note input that appears in the track input choosers in Bitwig Studio.
     * This method must be called within the `init()` function of the script.
     * The messages matching the given mask parameter will be fed directly to the application, and are not processed
     * by the script.
     *
     * @param {string} name the name of the note input as it appears in the track input choosers in Bitwig Studio
     * @param {string} masks a filter string formatted as hexadecimal value with `?` as wildcard. For example
                 `80????` would match note-off on channel 1 (0). When this parameter is {@null},
                 a standard filter will be used to forward note-related messages on channel 1 (0).
     * @return {NoteInput} the object representing the requested note input
     * @throws ControlSurfaceException
     * @since Bitwig Studio 1.0
     */
    createNoteInput(name?: string, ...masks: string[]): NoteInput;

}

export default MidiIn;


text:
<resources>
    <string name="number_picker_increment_button">Ko'paytirish</string>
    <string name="number_picker_decrement_button">Kamaytirish</string>
    <string name="time_picker_increment_minute_button">Daqiqani ko'paytirish</string>
    <string name="time_picker_decrement_minute_button">Daqiqani kamaytirish</string>
    <string name="time_picker_increment_hour_button">Soatni ko'paytirish</string>
    <string name="time_picker_decrement_hour_button">Soatni kamaytirish</string>
    <string name="time_picker_increment_set_pm_button">PM o'rnatish</string>
    <string name="time_picker_decrement_set_am_button">AM o'rnatish</string>
    <string name="date_picker_prev_month_button">Avvalgi oy</string>
    <string name="date_picker_next_month_button">Keyingi oy</string>
    <string name="hour_picker_description">Doiradan soatni tanlang</string>
    <string name="minute_picker_description">Doiradan daqiqani tanlang</string>
    <string name="select_hours">Soatlarni tanlash</string>
    <string name="select_minutes">Daqiqalarni tanlash</string>
    <string name="select_day">Oy va kunni tanlash</string>
    <string name="select_year">Yilni tanlash</string>
    <string name="time_picker_hour_label">soat</string>
    <string name="time_picker_minute_label">daqiqa</string>
    <string name="time_picker_header_text">Vaqtni sozlash</string>
    <string name="time_picker_input_error">Vaqt xato ko'rsatilgan</string>
    <string name="time_picker_prompt_label">Vaqtni kiriting</string>
    <string name="time_picker_text_input_mode_description">Vaqtni kiritish uchun matn kiritish rejimiga o'ting.</string>
    <string name="time_picker_radial_mode_description">Vaqtni kiritish uchun soat rejimiga o'ting.</string>
</resources>


text:
<?php

namespace AppBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Response;

class CartControllerTest extends WebTestCase
{
    public function testBuyProductByRegisteredCustomer()
    {
        $client = static::createClient();

        //dodaję produkty, sprawdzam czy przekierował do cart_menu
        $client->request('GET', '/add-to-cart/978-0010465284');
        $this->assertTrue($client->getResponse()->isRedirect('/cart'));
        $client->request('GET', '/add-to-cart/978-0040892976');
        $crawler = $client->followRedirect();

        //testuję od razu CartController:cartcontentAction(), czyli liczba produktów w koszyku.
        $this->assertTrue($crawler->filter('div.quantityKosz:contains("2")')->count() > 0);

        //testuję od razu usuwanie jednego produktu CartController:cartMenuAction() gdy kliknięto "usuń" przy produkcie.
        $crawler = $client->request('GET', '/cart/978-0040892976');
        $this->assertTrue($crawler->filter('div.quantityKosz:contains("1")')->count() > 0);
        $this->assertTrue($crawler->filter('td > a:contains("978-0010465284")')->count() > 0);
        $this->assertTrue($crawler->filter('td > a:contains("978-0040892976")')->count() == 0);

        //wybiera "zamawiam" i zostaję przekierowany do wyboru autoryzacji.
        $link = $crawler->filter('a:contains("zamawiam")')->link();
        $crawler = $client->click($link);
        $this->assertTrue($crawler->filter('html:contains("Wybierz sposób autoryzacji")')->count() > 0);

        //wybieram "zaloguj"
        $link = $crawler->filter('a:contains("zaloguj")')->link();
        $client->click($link);
        $crawler = $client->followRedirect();
        $this->assertTrue($crawler->filter('html:contains("Login")')->count() > 0);

        //Podaje dane logowania i zosaję przekierowany do formularza dostawy.
        $form = $crawler->selectButton('_submit')->form();
        $client->submit($form,[
            '_username'=>'chinczyk',
            '_password'=>'hinolp9',
        ]);
        $client->followRedirect();
        $crawler = $client->followRedirect();
        $this->assertTrue($crawler->filter('html:contains("Dostawa - formularz")')->count() > 0);

        //wypełniam dane, zatwierdzam i dostaję przekierowany do podsumowania zamówienia.
        $form = $crawler->selectButton('dostawa[zapisz]')->form();
        $client->submit($form);
        $crawler = $client->followRedirect();
        $this->assertTrue($crawler->filter('html:contains("zamówione produkty:")')->count() > 0);

        //Testuję od razu CartController:cartclearAction()
        $crawler = $client->request('GET', '/cart-clear');
        $this->assertTrue($crawler->filter('h3.szaryKlocek:contains("Koszyk pusty")')->count() > 0);
        $this->assertTrue($crawler->filter('div.quantityKosz:contains("0")')->count() > 0);
    }

    public function testBuyProductByUnregisteredCustomer()
    {
        $client = static::createClient();

        $client->request('GET', '/add-to-cart/978-0010465284');
        $crawler = $client->followRedirect();

        //wybiera "zamawiam" i zostaję przekierowany do wyboru autoryzacji.
        $link = $crawler->filter('a:contains("zamawiam")')->link();
        $crawler = $client->click($link);
        $this->assertTrue($crawler->filter('html:contains("Wybierz sposób autoryzacji")')->count() > 0);

        //wybieram "kup bez rejestracji"
        $link = $crawler->filter('a:contains("kup bez rejestracji")')->link();
        $crawler = $client->click($link);
        $this->assertTrue($crawler->filter('html:contains("Dostawa - formularz")')->count() > 0);

        //wypełniam dane, zatwierdzam i dostaję przekierowany do podsumowania zamówienia.
        $form = $crawler->selectButton('dostawa[zapisz]')->form();
        $client->submit($form,[
            'dostawa[name]'=>'paweł',
            'dostawa[surname]'=>'chryplewicz',
            'dostawa[email]'=>'chryplewiczpawel@wp.pl',
            'dostawa[street]'=>'ddd',
            'dostawa[houseNumber]'=>'22',
            'dostawa[apartmentNumber]'=>'2',
            'dostawa[postalCode]'=>'59-300',
            'dostawa[city]'=>'Lubin',
            'dostawa[nip]'=>'1234567890',
            'dostawa[phoneNumber]'=>'78687677',
        ]);
        $crawler = $client->followRedirect();
        $this->assertTrue($crawler->filter('html:contains("zamówione produkty:")')->count() > 0);
    }

    public function testAuthorization()
    {
        $client = static::createClient();
        $crawler = $client->request('GET', '/authorization');

        $this->assertTrue($crawler->filter('h3:contains("Wybierz sposób autoryzacji")')->count() > 0);
    }

    public function testCartMenu()
    {
        $client = static::createClient();
        $crawler = $client->request('GET', '/cart');

        //testuję gdy wchodzę do kosza gdy kosz pusty
        $this->assertTrue($crawler->filter('html:contains("Koszyk pusty.")')->count() > 0);
        //refaktor: wyświetla stronę w wersji deweloperskiej, stąd nie ma ikony koszyka ani szarego boxu z komunikatem, lecz surowy błąd. Poprawić by wyświetlał w wersji produkcyjnej i odkomentować dwie poniższe linie.
//        $this->assertTrue($crawler->filter('h3.szaryKlocek:contains("Błąd. Koszyk pusty.")')->count() > 0);
//        $this->assertTrue($crawler->filter('div.quantityKosz:contains("0")')->count() > 0);
    }

//        $client = static::createClient([], [
//            'PHP_AUTH_USER' => 'chinczyk',
//            'PHP_AUTH_PW' => 'hinolp9',
//        ]);
//        $content = $client->getResponse()->getContent();
//        $f=0;

//    public function testBuyProductByRegisteredCustomer()
//    {
//        $client = static::createClient();
//        $crawler = $client->request('GET', '/book/');
//
//        $link = $crawler
//            ->filter('a:contains("Accountant")')
//            ->link()
//        ;
//
//        $crawler = $client->click($link);
//        $this->assertTrue($crawler->filter('html:contains("Mississippi")')->count() > 0);
//    }

}


text:
Subir imágenes

No hay imágenes cargadas

                      Borrar imagen

                <form class="card dropzone well"
                    method="POST"
                    enctype="multipart/form-data"
                    title="Agregar imágenes"
                    ng-dropzone
                    dropzone="zone.dropzone"
                    dropzone-config="zone.dropzoneConfig"
                    event-handlers="{ 'addedfile': zone.dzAddedFile, 'error': zone.dzError,  'sending': zone.sending, 'success': zone.success }">
                </form>

            Terminar


text:
namespace {

const wchar_t kChromiumBinariesName[] = L"Chromium Binaries";

}  // namespace

ChromiumBinariesDistribution::ChromiumBinariesDistribution()
    : BrowserDistribution(
          CHROME_BINARIES,
          scoped_ptr<AppRegistrationData>(new NonUpdatingAppRegistrationData(
              base::string16(L"Software\\").append(kChromiumBinariesName)))),
      browser_distribution_(
          BrowserDistribution::GetSpecificDistribution(CHROME_BROWSER)) {
}

ChromiumBinariesDistribution::ChromiumBinariesDistribution(
    scoped_ptr<AppRegistrationData> app_reg_data)
    : BrowserDistribution(CHROME_BINARIES, std::move(app_reg_data)),
      browser_distribution_(
          BrowserDistribution::GetSpecificDistribution(CHROME_BROWSER)) {}

base::string16 ChromiumBinariesDistribution::GetBaseAppName() {
  NOTREACHED();
  return base::string16();
}

base::string16 ChromiumBinariesDistribution::GetBrowserProgIdPrefix() {
  NOTREACHED();
  return base::string16();
}

base::string16 ChromiumBinariesDistribution::GetBrowserProgIdDesc() {
  NOTREACHED();
  return base::string16();
}

base::string16 ChromiumBinariesDistribution::GetDisplayName() {
  return kChromiumBinariesName;
}

base::string16 ChromiumBinariesDistribution::GetShortcutName(
    ShortcutType shortcut_type) {
  NOTREACHED();
  return base::string16();
}

base::string16 ChromiumBinariesDistribution::GetBaseAppId() {
  NOTREACHED();
  return base::string16();
}

base::string16 ChromiumBinariesDistribution::GetInstallSubDir() {
  return browser_distribution_->GetInstallSubDir();
}

base::string16 ChromiumBinariesDistribution::GetPublisherName() {
  NOTREACHED();
  return base::string16();
}

base::string16 ChromiumBinariesDistribution::GetAppDescription() {
  NOTREACHED();
  return base::string16();
}

base::string16 ChromiumBinariesDistribution::GetLongAppDescription() {
  NOTREACHED();
  return base::string16();
}

std::string ChromiumBinariesDistribution::GetSafeBrowsingName() {
  NOTREACHED();
  return std::string();
}

base::string16 ChromiumBinariesDistribution::GetRegistryPath() {
  NOTREACHED();
  // Handling a NOTREACHED() with anything but a default return value is unusual
  // but in this case returning the empty string would point the caller at the
  // root of the registry which could have disastrous consequences.
  return BrowserDistribution::GetRegistryPath();
}

base::string16 ChromiumBinariesDistribution::GetUninstallRegPath() {
  NOTREACHED();
  return base::string16();
}

BrowserDistribution::DefaultBrowserControlPolicy
    ChromiumBinariesDistribution::GetDefaultBrowserControlPolicy() {
  return DEFAULT_BROWSER_UNSUPPORTED;
}

int ChromiumBinariesDistribution::GetIconIndex(ShortcutType shortcut_type) {
  NOTREACHED();
  return 0;
}

bool ChromiumBinariesDistribution::GetChromeChannel(base::string16* channel) {
  NOTREACHED();
  return false;
}

base::string16 ChromiumBinariesDistribution::GetCommandExecuteImplClsid() {
  return base::string16();
}


text:
/*************************************************************************/
/*                                                                       */
/*  Copyright (c) 1994 Stanford University                               */
/*                                                                       */
/*  All rights reserved.                                                 */
/*                                                                       */
/*  Permission is given to use, copy, and modify this software for any   */
/*  non-commercial purpose as long as this copyright notice is not       */
/*  removed.  All other uses, including redistribution in whole or in    */
/*  part, are forbidden without prior written permission.                */
/*                                                                       */
/*  This software is provided with absolutely no warranty and no         */
/*  support.                                                             */
/*                                                                       */
/*************************************************************************/

/*************************************************************************
*                                                                        *
*     main.c:  Starting point for rendering system.                      *
*                                                                        *
      Usage:  VOLREND num_processes input_file [-a]

      where input_file is head for the head data set. i.e. the filename
          without a suffix.
      and the -a option enables adaptive sampling of pixels.

*************************************************************************/

#include "incl.h"
#include <sys/time.h>
#include <sys/resource.h>
#include "tiffio.h"

#define SH_MEM_AMT 60000000

MAIN_ENV

#include "anl.h"

struct GlobalMemory *Global;

int image_section[NI];
int voxel_section[NM];

int num_nodes,frame;
int num_blocks,num_xblocks,num_yblocks;
PIXEL *image_address;
MPIXEL *mask_image_address;
PIXEL *image_block,*mask_image_block;
PIXEL *shd_address;
BOOLEAN *sbit_address;
long shd_length;
short image_len[NI], mask_image_len[NI];
uint32_t image_length, mask_image_length;
char *filename[FILENAME_STRING_SIZE];
void Render_Loop();

mclock(stoptime,starttime,exectime)
     unsigned long stoptime,starttime,*exectime;
{
  if (stoptime < starttime)
    *exectime = ((MAX_INT - starttime) + stoptime)/1000;
  else
    *exectime = (stoptime - starttime)/1000;
}

main(argc, argv)
     int argc;
     char *argv[];
{
  if ((argc < 3) || (strncmp(argv[1],"-h",strlen("-h")) == 0) || (strncmp(argv[1],"-h",strlen("-H")) == 0)){
    printf("usage:  VOLREND num_processes input_file\n");
    exit(-1);
  }

  MAIN_INITENV(, SH_MEM_AMT);

  num_nodes = atoi(argv[1]);

  strcpy(filename,argv[2]);

  if (argc == 4) {
    if (strncmp(argv[3],"-a",strlen("-a")) == 0)
      adaptive = YES;
    else {
      printf("usage:  VOLREND num_processes input_file [-a] \n");
      exit(-1);
    }
  }

  Frame();

  if (num_nodes > 1)
    WAIT_FOR_END(num_nodes);
  MAIN_END;
}

Frame()
{
  unsigned long starttime,stoptime,exectime,i;

  Init_Options();

  printf("*****Entering init_decomposition with num_nodes = %d\n",num_nodes);
  fflush(stdout);

  Init_Decomposition();

  printf("*****Exited init_decomposition with num_nodes = %d\n",num_nodes);
  fflush(stdout);

  Global = (struct GlobalMemory *)NU_MALLOC(sizeof(struct GlobalMemory),0);
  BARINIT(Global->SlaveBarrier);
  BARINIT(Global->TimeBarrier);
  LOCKINIT(Global->IndexLock);
  LOCKINIT(Global->CountLock);
  ALOCKINIT(Global->QLock,MAX_NUMPROC+1);

  /* load dataset from file to each node */
#ifndef RENDER_ONLY
  CLOCK(starttime);
  Load_Map(filename);
  CLOCK(stoptime);
  mclock(stoptime,starttime,&exectime);
  printf("wall clock execution time to load map:  %u ms\n", exectime);
#endif

  CLOCK(starttime);
#ifndef RENDER_ONLY
  Compute_Normal();
#ifdef PREPROCESS
  Store_Normal(filename);
#endif
#else
  Load_Normal(filename);
#endif
  CLOCK(stoptime);
  mclock(stoptime,starttime,&exectime);
  printf("wall clock execution time to compute normal:  %u ms\n", exectime);

  CLOCK(starttime);
#ifndef RENDER_ONLY
  Compute_Opacity();
#ifdef PREPROCESS
  Store_Opacity(filename);
#endif
#else
  Load_Opacity(filename);
#endif
  CLOCK(stoptime);
  mclock(stoptime,starttime,&exectime);
  printf("wall clock execution time to compute opacity:  %u ms\n", exectime);

  Compute_Pre_View();
  shd_length = LOOKUP_SIZE;
  Allocate_Shading_Table(&shd_address,&sbit_address,shd_length);
  /* allocate space for image */
  image_len[X] = frust_len;
  image_len[Y] = frust_len;
  image_length = image_len[X] * image_len[Y];
  Allocate_Image(&image_address,image_length);

  if (num_nodes == 1) {
    block_xlen = image_len[X];
    block_ylen = image_len[Y];
    num_blocks = 1;
    num_xblocks = 1;
    num_yblocks = 1;
    image_block = image_address;
  }
  else {
    num_xblocks = ROUNDUP((float)image_len[X]/(float)block_xlen);
    num_yblocks = ROUNDUP((float)image_len[Y]/(float)block_ylen);
    num_blocks = num_xblocks * num_yblocks;
    Lallocate_Image(&image_block,block_xlen*block_ylen);
  }

  CLOCK(starttime);
#ifndef RENDER_ONLY
  Compute_Octree();
#ifdef PREPROCESS
  Store_Octree(filename);
#endif
#else
  Load_Octree(filename);
#endif
  CLOCK(stoptime);
  mclock(stoptime,starttime,&exectime);
  printf("wall clock execution time to compute octree:  %u ms\n", exectime);

#ifdef PREPROCESS
  return;
#endif

  if (adaptive) {
    for (i=0; i<NI; i++) {
      mask_image_len[i] = image_len[i];
    }
    mask_image_length = image_length;
    Allocate_MImage(&mask_image_address, mask_image_length);
    if (num_nodes == 1)
      mask_image_block = (PIXEL *)mask_image_address;
    else
      Lallocate_Image(&mask_image_block, block_xlen*block_ylen);
  }

#ifndef RENDER_ONLY
  Deallocate_Map(&map_address);
#endif

  Global->Index = NODE0;

  printf("\nRendering...\n");
  printf("node\tframe\ttime\titime\trays\thrays\tsamples trilirped\n");

  //for (i=1; i<num_nodes; i++)
  CREATE(Render_Loop, num_nodes)

  //Render_Loop();
}

void Render_Loop()
{
  int step,i,dim,pid;
  PIXEL *local_image_address;
  MPIXEL *local_mask_image_address;
  PIXEL *local_shd_address;
  char outfile[FILENAME_STRING_SIZE],cmd[FILENAME_STRING_SIZE];
  int image_partition,mask_image_partition,shd_table_partition;
  float inv_num_nodes;
  int my_node;
  int zz;
  int zzz;
  PIXEL *p;

  LOCK(Global->IndexLock);
  my_node = Global->Index++;
  UNLOCK(Global->IndexLock);
  my_node = my_node%num_nodes;

/*  POSSIBLE ENHANCEMENT:  Here's where one might bind the process to a
    processor, if one wanted to.
*/

  inv_num_nodes = 1.0/(float)num_nodes;
  image_partition = ROUNDUP(image_length*inv_num_nodes);
  mask_image_partition = ROUNDUP(mask_image_length*inv_num_nodes);

#ifdef DIM
  for (dim=0; dim<NM; dim++) {
#endif

    for (step=0; step<ROTATE_STEPS; step++) { /* do rotation sequence */

/*  POSSIBLE ENHANCEMENT:  Here is where one might reset statistics, if
    		one wanted to.
*/

      frame = step;
      /* initialize images here */
      local_image_address = image_address + image_partition * my_node;
      local_mask_image_address = mask_image_address +
	mask_image_partition * my_node;

      BARRIER(Global->SlaveBarrier,num_nodes);

      if (my_node == num_nodes-1) {
	for (i=image_partition*my_node; i<image_length; i++)
	  *local_image_address++ = background;
	if (adaptive)
	  for (i=mask_image_partition*my_node; i<mask_image_length; i++)
	    *local_mask_image_address++ = NULL_PIXEL;
      }
      else {
	for (i=0; i<image_partition; i++)
	  *local_image_address++ = background;
	if (adaptive)
	  for (i=0; i<mask_image_partition; i++)
	    *local_mask_image_address++ = NULL_PIXEL;
      }

      if (my_node == ROOT) {
#ifdef DIM
	Select_View((float)STEP_SIZE, dim);
#else
        Select_View((float)STEP_SIZE, Y);
#endif
}

      BARRIER(Global->SlaveBarrier,num_nodes);

      Global->Counter = num_nodes;
      Global->Queue[num_nodes][0] = num_nodes;
      Global->Queue[my_node][0] = 0;

      Render(my_node);

      if (my_node == ROOT) {
	if (ROTATE_STEPS > 1) {
#ifdef DIM
	  sprintf(outfile, "%s_%d",filename, 1000+dim*ROTATE_STEPS+step);
#else
	  sprintf(outfile, "%s_%d.tiff",filename, 1000+step);
#endif
/*	  Store_Image(outfile);
          p = image_address;
          for (zz = 0;zz < image_length;zz++) {
            tiff_image[zz] = (int) ((*p)*256*256*256 + (*p)*256*256 +
				    (*p)*256 + (*p));
	    p++;
          }
tiff_save_rgba(outfile,tiff_image,image_len[X],image_len[Y]);  */
WriteGrayscaleTIFF(outfile, image_len[X],image_len[Y],image_len[X], image_address);
	} else {
/*	  Store_Image(filename);
	  p = image_address;
          for (zz = 0;zz < image_length;zz++) {
            tiff_image[zz] = (int) ((*p)*256*256*256 + (*p)*256*256 +
				    (*p)*256 + (*p));
	    p++;
          }
tiff_save_rgba(filename,tiff_image,image_len[X],image_len[Y]);    */
          strcat(filename,".tiff");
WriteGrayscaleTIFF(filename, image_len[X],image_len[Y],image_len[X], image_address);
	}
      }
    }
#ifdef DIM
  }
#endif
}

Error(string,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)
     char string[], *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8;
{
  fprintf(stderr,string,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
  exit(1);
}

Allocate_Image(address, length)
     PIXEL **address;
     long length;
{
  unsigned int i,j,size,type_per_page,count,block;
  unsigned int p,numbytes;

  printf("    Allocating image of %ld bytes...\n",
	 length*sizeof(PIXEL));

  *address = (PIXEL *)NU_MALLOC(length*sizeof(PIXEL),0);

  if (*address == NULL)
    Error("    No space available for image.\n");

  for (i=0; i<length; i++) *(*address+i) = 0;

}

Allocate_MImage(address, length)
     MPIXEL **address;
     long length;
{
  unsigned int i,j,size,type_per_page,count,block;
  unsigned int p,numbytes;

  printf("    Allocating image of %ld bytes...\n",
	 length*sizeof(MPIXEL));

  *address = (MPIXEL *)NU_MALLOC(length*sizeof(MPIXEL),0);

  if (*address == NULL)
    Error("    No space available for image.\n");

/*  POSSIBLE ENHANCEMENT:  Here's where one might distribute the
    opacity map among physical memories if one wanted to.
*/

  for (i=0; i<length; i++) *(*address+i) = 0;

}

Lallocate_Image(address, length)
     PIXEL **address;
     long length;
{
  //char *calloc();
  int i;
  unsigned int p,numbytes;

  printf("    Allocating image of %ld bytes...\n",
	 length*sizeof(PIXEL));
  *address = (PIXEL *)calloc(length,sizeof(PIXEL));
  if (*address == NULL)
    Error("    No space available for image.\n");

}

Store_Image(filename)
     char filename[];
{
  char local_filename[FILENAME_STRING_SIZE];
  int fd;
  short pix_version;
  short local_image_len[NI+1]; /* dimension larger than NI for backwards     */
                               /* compatibility of .pix file with no color   */

  local_image_len[X] = image_len[X];
  local_image_len[Y] = image_len[Y];
  local_image_len[2] = 1;

  pix_version = PIX_CUR_VERSION;
  strcpy(local_filename,filename);
  strcat(local_filename,".pix");
  fd = Create_File(local_filename);
  Write_Shorts(fd,&pix_version,(long)sizeof(pix_version));

  Write_Shorts(fd,local_image_len,(long)sizeof(local_image_len));
  Write_Longs(fd,&image_length,(long)sizeof(image_length));

  Write_Bytes(fd,image_address,(long)(image_length*sizeof(PIXEL)));
  Close_File(fd);
}

Allocate_Shading_Table(address1,address2,length)
     PIXEL **address1,**address2;
     long length;
{
  unsigned int i,size,type_per_page;
  unsigned int p,numbytes;

  printf("    Allocating shade lookup table of %ld bytes...\n",
	 length*sizeof(PIXEL));

/*  POSSIBLE ENHANCEMENT:  If you want to replicate the shade table,
    replace the macro with a simple malloc in the line below */

  *address1 = (PIXEL *)NU_MALLOC(length,sizeof(PIXEL),0);

  if (*address1 == NULL)
    Error("    No space available for table.\n");

/*  POSSIBLE ENHANCEMENT:  Here's where one might distribute the
    shading table among physical memories if one wanted to.
*/

  for (i=0; i<length; i++) *(*address1+i) = 0;

}

Init_Decomposition()
{
  int factors[MAX_NUMPROC];
  double processors,newfactor;
  int i,sq,cu,maxcu,count;

  /* figure out what to divide dimensions of image and volume by to */
  /* partition data and computation to processors                   */
  if (num_nodes == 1) {
    image_section[X] = 1;
    image_section[Y] = 1;
    voxel_section[X] = 1;
    voxel_section[Y] = 1;
    voxel_section[Z] = 1;
  }
  else {
    count = 1;
    processors = (double)num_nodes;
    sq = (int)sqrt(processors);
    cu = (int)pow(processors,1.0/3.0);
    factors[0] = 1;

    for (i=2; i<sq; i++) {
      if (FRACT(processors/(double)i) == 0.0) {
        factors[count++] = i;
        if (i <= cu) {
          maxcu = i;
          newfactor = (double)(num_nodes/i);
        }
      }
    }
    count--;
    image_section[X] = factors[count];
    image_section[Y] = num_nodes/factors[count];

    sq = (int)sqrt(newfactor);
    count = 1;

    for (i=2; i<sq; i++) {
      if (FRACT(newfactor/(double)i) == 0.0)
        factors[count++] = i;
    }
    count--;
    voxel_section[X] = MIN(factors[count],maxcu);
    voxel_section[Y] = MAX(factors[count],maxcu);
    voxel_section[Z] = (int)newfactor/factors[count];
  }
}

/*
 * WriteGrayscaleTIFF
 *
 * Create a grayscale TIFF image.  The input is a sequence of bytes in an
 * array (each byte representing one pixel).  This is converted into a
 * compressed TIFF image file.
 *
 * Return value is 1 for success, 0 for failure.
 */

int
WriteGrayscaleTIFF(filename, width, height, scanbytes, data)
char *filename;         /* file to write to */
int width, height;      /* size of image */
int scanbytes;          /* length of each scanline in bytes */
unsigned char *data;    /* image data */
{
    unsigned long y;
    double factor;
    int c;
    unsigned short cmap[256];           /* output color map */
    TIFF *outimage;                     /* TIFF image handle */

    /* create a grayscale ramp for the output color map */
    factor = (double)((1 << 16) - 1) / (double)((1 << 8) - 1);
    for (c = 0; c < 256; c++)
        cmap[c] = (int)(c * factor);

    /* open and initialize output file */
    if ((outimage = TIFFOpen(filename, "w")) == NULL)
        return(0);
    TIFFSetField(outimage, TIFFTAG_IMAGEWIDTH, width);
    TIFFSetField(outimage, TIFFTAG_IMAGELENGTH, height);
    TIFFSetField(outimage, TIFFTAG_BITSPERSAMPLE, 8);
    TIFFSetField(outimage, TIFFTAG_SAMPLESPERPIXEL, 1);
    TIFFSetField(outimage, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
    TIFFSetField(outimage, TIFFTAG_COMPRESSION, COMPRESSION_LZW);
    TIFFSetField(outimage, TIFFTAG_ORIENTATION, ORIENTATION_BOTLEFT);
    TIFFSetField(outimage, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
    TIFFSetField(outimage, TIFFTAG_COLORMAP, cmap, cmap, cmap);

    /* write the image data */
    for (y = 0; y < height; y++) {
        if (!TIFFWriteScanline(outimage, data, y, 0)) {
            TIFFClose(outimage);
            return(0);
        }
        data += scanbytes;
    }

    /* close the file */
    TIFFClose(outimage);
    return(1);
}


text:
package service

import (
	"fmt"
	"reflect"

	proto "github.com/golang/protobuf/proto"

	"github.com/chai2010/qingcloud-go/pkg/client"
)

// Reference imports to suppress errors if they are not otherwise used.
var (
	_ = fmt.Errorf
	_ = reflect.Invalid

	_ = proto.Marshal
	_ = client.NewClient
)

func init() {
	TypeInfoMap["CreateNicsInput"] = reflect.TypeOf((*CreateNicsInput)(nil))
	TypeInfoMap["CreateNicsOutput"] = reflect.TypeOf((*CreateNicsOutput)(nil))
	TypeInfoMap["DescribeNicsInput"] = reflect.TypeOf((*DescribeNicsInput)(nil))
	TypeInfoMap["DescribeNicsOutput"] = reflect.TypeOf((*DescribeNicsOutput)(nil))
	TypeInfoMap["AttachNicsInput"] = reflect.TypeOf((*AttachNicsInput)(nil))
	TypeInfoMap["AttachNicsOutput"] = reflect.TypeOf((*AttachNicsOutput)(nil))
	TypeInfoMap["DetachNicsInput"] = reflect.TypeOf((*DetachNicsInput)(nil))
	TypeInfoMap["DetachNicsOutput"] = reflect.TypeOf((*DetachNicsOutput)(nil))
	TypeInfoMap["ModifyNicAttributesInput"] = reflect.TypeOf((*ModifyNicAttributesInput)(nil))
	TypeInfoMap["ModifyNicAttributesOutput"] = reflect.TypeOf((*ModifyNicAttributesOutput)(nil))
	TypeInfoMap["DeleteNicsInput"] = reflect.TypeOf((*DeleteNicsInput)(nil))
	TypeInfoMap["DeleteNicsOutput"] = reflect.TypeOf((*DeleteNicsOutput)(nil))
}

type NicServiceInterface interface {
	CreateNics(in *CreateNicsInput) (out *CreateNicsOutput, err error)
	DescribeNics(in *DescribeNicsInput) (out *DescribeNicsOutput, err error)
	AttachNics(in *AttachNicsInput) (out *AttachNicsOutput, err error)
	DetachNics(in *DetachNicsInput) (out *DetachNicsOutput, err error)
	ModifyNicAttributes(in *ModifyNicAttributesInput) (out *ModifyNicAttributesOutput, err error)
	DeleteNics(in *DeleteNicsInput) (out *DeleteNicsOutput, err error)
}

type NicService struct {
	ServerInfo *ServerInfo
}

func NewNicService(server *ServerInfo) (p *NicService) {
	return &NicService{
		ServerInfo: server,
	}
}

func init() {
	ServiceApiSpecMap["CreateNics"] = ServiceApiSpec{
		ServiceName:    "NicService",
		ActionName:     "CreateNics",
		InputTypeName:  "CreateNicsInput",
		OutputTypeName: "CreateNicsOutput",
		HttpMethod:     "GET",

		ServiceType: reflect.TypeOf((*NicService)(nil)),
		InputType:   reflect.TypeOf((*CreateNicsInput)(nil)),
		OutputType:  reflect.TypeOf((*CreateNicsOutput)(nil)),
	}
	ServiceApiSpecMap["DescribeNics"] = ServiceApiSpec{
		ServiceName:    "NicService",
		ActionName:     "DescribeNics",
		InputTypeName:  "DescribeNicsInput",
		OutputTypeName: "DescribeNicsOutput",
		HttpMethod:     "GET",

		ServiceType: reflect.TypeOf((*NicService)(nil)),
		InputType:   reflect.TypeOf((*DescribeNicsInput)(nil)),
		OutputType:  reflect.TypeOf((*DescribeNicsOutput)(nil)),
	}
	ServiceApiSpecMap["AttachNics"] = ServiceApiSpec{
		ServiceName:    "NicService",
		ActionName:     "AttachNics",
		InputTypeName:  "AttachNicsInput",
		OutputTypeName: "AttachNicsOutput",
		HttpMethod:     "GET",

		ServiceType: reflect.TypeOf((*NicService)(nil)),
		InputType:   reflect.TypeOf((*AttachNicsInput)(nil)),
		OutputType:  reflect.TypeOf((*AttachNicsOutput)(nil)),
	}
	ServiceApiSpecMap["DetachNics"] = ServiceApiSpec{
		ServiceName:    "NicService",
		ActionName:     "DetachNics",
		InputTypeName:  "DetachNicsInput",
		OutputTypeName: "DetachNicsOutput",
		HttpMethod:     "GET",

		ServiceType: reflect.TypeOf((*NicService)(nil)),
		InputType:   reflect.TypeOf((*DetachNicsInput)(nil)),
		OutputType:  reflect.TypeOf((*DetachNicsOutput)(nil)),
	}
	ServiceApiSpecMap["ModifyNicAttributes"] = ServiceApiSpec{
		ServiceName:    "NicService",
		ActionName:     "ModifyNicAttributes",
		InputTypeName:  "ModifyNicAttributesInput",
		OutputTypeName: "ModifyNicAttributesOutput",
		HttpMethod:     "GET",

		ServiceType: reflect.TypeOf((*NicService)(nil)),
		InputType:   reflect.TypeOf((*ModifyNicAttributesInput)(nil)),
		OutputType:  reflect.TypeOf((*ModifyNicAttributesOutput)(nil)),
	}
	ServiceApiSpecMap["DeleteNics"] = ServiceApiSpec{
		ServiceName:    "NicService",
		ActionName:     "DeleteNics",
		InputTypeName:  "DeleteNicsInput",
		OutputTypeName: "DeleteNicsOutput",
		HttpMethod:     "GET",

		ServiceType: reflect.TypeOf((*NicService)(nil)),
		InputType:   reflect.TypeOf((*DeleteNicsInput)(nil)),
		OutputType:  reflect.TypeOf((*DeleteNicsOutput)(nil)),
	}
}

func (p *NicService) CreateNics(input *CreateNicsInput) (output *CreateNicsOutput, err error) {
	client := client.NewClient(
		p.ServerInfo.GetApiServer(),
		p.ServerInfo.GetAccessKeyId(),
		p.ServerInfo.GetSecretAccessKey(),
		p.ServerInfo.GetZone(),
	)

	if input == nil {
		input = new(CreateNicsInput)
	}

	output = new(CreateNicsOutput)
	err = client.CallMethod("CreateNics", "GET", input, output, nil)
	if err != nil {
		return nil, err
	}

	return
}

func (p *NicService) DescribeNics(input *DescribeNicsInput) (output *DescribeNicsOutput, err error) {
	client := client.NewClient(
		p.ServerInfo.GetApiServer(),
		p.ServerInfo.GetAccessKeyId(),
		p.ServerInfo.GetSecretAccessKey(),
		p.ServerInfo.GetZone(),
	)

	if input == nil {
		input = new(DescribeNicsInput)
	}

	output = new(DescribeNicsOutput)
	err = client.CallMethod("DescribeNics", "GET", input, output, nil)
	if err != nil {
		return nil, err
	}

	return
}

func (p *NicService) AttachNics(input *AttachNicsInput) (output *AttachNicsOutput, err error) {
	client := client.NewClient(
		p.ServerInfo.GetApiServer(),
		p.ServerInfo.GetAccessKeyId(),
		p.ServerInfo.GetSecretAccessKey(),
		p.ServerInfo.GetZone(),
	)

	if input == nil {
		input = new(AttachNicsInput)
	}

	output = new(AttachNicsOutput)
	err = client.CallMethod("AttachNics", "GET", input, output, nil)
	if err != nil {
		return nil, err
	}

	return
}

func (p *NicService) DetachNics(input *DetachNicsInput) (output *DetachNicsOutput, err error) {
	client := client.NewClient(
		p.ServerInfo.GetApiServer(),
		p.ServerInfo.GetAccessKeyId(),
		p.ServerInfo.GetSecretAccessKey(),
		p.ServerInfo.GetZone(),
	)

	if input == nil {
		input = new(DetachNicsInput)
	}

	output = new(DetachNicsOutput)
	err = client.CallMethod("DetachNics", "GET", input, output, nil)
	if err != nil {
		return nil, err
	}

	return
}

func (p *NicService) ModifyNicAttributes(input *ModifyNicAttributesInput) (output *ModifyNicAttributesOutput, err error) {
	client := client.NewClient(
		p.ServerInfo.GetApiServer(),
		p.ServerInfo.GetAccessKeyId(),
		p.ServerInfo.GetSecretAccessKey(),
		p.ServerInfo.GetZone(),
	)

	if input == nil {
		input = new(ModifyNicAttributesInput)
	}

	output = new(ModifyNicAttributesOutput)
	err = client.CallMethod("ModifyNicAttributes", "GET", input, output, nil)
	if err != nil {
		return nil, err
	}

	return
}

func (p *NicService) DeleteNics(input *DeleteNicsInput) (output *DeleteNicsOutput, err error) {
	client := client.NewClient(
		p.ServerInfo.GetApiServer(),
		p.ServerInfo.GetAccessKeyId(),
		p.ServerInfo.GetSecretAccessKey(),
		p.ServerInfo.GetZone(),
	)

	if input == nil {
		input = new(DeleteNicsInput)
	}

	output = new(DeleteNicsOutput)
	err = client.CallMethod("DeleteNics", "GET", input, output, nil)
	if err != nil {
		return nil, err
	}

	return
}


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

	<title>Replaceport</title>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<meta name="copyright" content="" />
	<meta name="author" content="" />
	<meta name="rating" content="general" />
	<meta name="robots" content="all" />

	<link rel="shortcut icon" href="favicon.ico" />

	<link rel="stylesheet" href="styles/settings.css" type="text/css" media="screen, projection">
	<link rel="stylesheet" href="styles/layout.css" type="text/css" media="screen, projection">

Home

About

FAQ

Contact

Register

Login

Replaceport

					<form name="" id="" class="" method="" action="">
						<fieldset>

Username<input type="text" name="" id="" class="short" value="" placeholder="Username">

Password<input type="password" name="" id="" class="short" value="" placeholder="">

						</fieldset>
					</form>

					<form name="" id="" class="" method="" action="">
						<fieldset>
						<legend></legend>

<input type="text" name="" id="" class="" value="" placeholder="Keywords">

<input type="submit" name="" id="" class="" value="Search" placeholder="">

						</fieldset>
					</form>

Mods

Files

Parts

Crafts

Apps

Community

Saved Games

Most Popular

Project Title

v1.0

Author Name
* * * * *
10 000

							<form name="" id="" class="" method="" action="">
								<fieldset>
								<legend></legend>

<input type="button" name="" id="" class="" value="Watch" placeholder="">

<input type="button" name="" id="" class="" value="Report" placeholder="">

								</fieldset>
							</form>

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

Project Title

v1.0

Author Name
* * * * *
10 000

							<form name="" id="" class="" method="" action="">
								<fieldset>
								<legend></legend>

<input type="button" name="" id="" class="" value="Watch" placeholder="">

<input type="button" name="" id="" class="" value="Report" placeholder="">

								</fieldset>
							</form>

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

Top Rated

Project Title

v1.0

Author Name
* * * * *
10 000

							<form name="" id="" class="" method="" action="">
								<fieldset>
								<legend></legend>

<input type="button" name="" id="" class="" value="Watch" placeholder="">

<input type="button" name="" id="" class="" value="Report" placeholder="">

								</fieldset>
							</form>

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

Project Title

v1.0

Author Name
* * * * *
10 000

							<form name="" id="" class="" method="" action="">
								<fieldset>
								<legend></legend>

<input type="button" name="" id="" class="" value="Watch" placeholder="">

<input type="button" name="" id="" class="" value="Report" placeholder="">

								</fieldset>
							</form>

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

Latest Releases

Project Title

v1.0

Author Name
* * * * *
10 000

							<form name="" id="" class="" method="" action="">
								<fieldset>
								<legend></legend>

<input type="button" name="" id="" class="" value="Watch" placeholder="">

<input type="button" name="" id="" class="" value="Report" placeholder="">

								</fieldset>
							</form>

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

Project Title

v1.0

Author Name
* * * * *
10 000

							<form name="" id="" class="" method="" action="">
								<fieldset>
								<legend></legend>

<input type="button" name="" id="" class="" value="Watch" placeholder="">

<input type="button" name="" id="" class="" value="Report" placeholder="">

								</fieldset>
							</form>

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

What is Replaceport?

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

About Us

Privacy Policy

Terms of Use

Submission Guidelines

Copyright © Replaceport