text:
package dagger.extension.example.service;

import android.graphics.Bitmap;

import javax.inject.Inject;
import javax.inject.Singleton;

import dagger.extension.example.di.qualifier.RxScheduler;
import dagger.extension.example.model.forecast.threehours.ThreeHoursForecastWeather;
import dagger.extension.example.model.forecast.tomorrow.TomorrowWeather;
import dagger.extension.example.model.today.TodayWeather;
import io.reactivex.Observable;
import io.reactivex.Scheduler;

import static dagger.extension.example.di.qualifier.RxScheduler.Type.NETWORK;

@Singleton
public class WeatherService
{

    private final WeatherApi api;
    private final Scheduler scheduler;
    private final ImageRequestManager imageRequestManager;

    @Inject
    public WeatherService(WeatherApi api, @RxScheduler(NETWORK) Scheduler scheduler, ImageRequestManager imageRequestManager){
        this.api = api;
        this.scheduler = scheduler;
        this.imageRequestManager = imageRequestManager;
    }

    public Observable<Bitmap> loadIcon(String icon) {
        return imageRequestManager.load(icon)
                                  .take(1);
    }

    public Observable<TomorrowWeather> getTomorrowWeather(double longitude, double latitude)
    {
        return api.getTomorrowWeather(longitude, latitude)
                .subscribeOn(scheduler)
                .take(1);
    }

    public Observable<ThreeHoursForecastWeather> getForecastWeather(double longitude, double latitude)
    {
        return api.getForecastWeather(longitude, latitude)
                  .subscribeOn(scheduler)
                  .take(1);
    }

    public Observable<TodayWeather> getCurrentWeather(double longitude, double latitude)
    {
        return api.getCurrentWeather(longitude, latitude)
                  .subscribeOn(scheduler)
                  .take(1);
    }

}


text:
id])) has-error @endif">
	id }}">{{ $field->label }} @if ($field->required) * @endif
	<textarea class="form-control" name="field_{{ $field->id }}" id="field_{{ $field->id }}" rows="{{ (isset($field->typeData()['rows']) ? $field->typeData()['rows'] : 5) }}">{{ Input::old('field_' . $field->id) }}</textarea>

	@if (isset($invalid_fields['field_' . $field->id]))
		{{ $invalid_fields['field_' . $field->id] }}
	@endif

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <title>Bubble Charts</title>

    <link class="include" rel="stylesheet" type="text/css" href="../jquery.jqplot.min.css" />
    <link rel="stylesheet" type="text/css" href="examples.min.css" />
    <link type="text/css" rel="stylesheet" href="syntaxhighlighter/styles/shCoreDefault.min.css" />
    <link type="text/css" rel="stylesheet" href="syntaxhighlighter/styles/shThemejqPlot.min.css" />

            >Home
            >Docs
            >Download
            >Info
            >Donate

Bubble charts represent 3 dimensional data.  Data is passed in to a bubble chart as a series of [x, y, radius, <label or object>].  The optional fourth element of the data point can either be either a label string or an object having 'label' and/or 'color' properties to assign to the bubble.

By default, all bubbles are scaled according to the size of the plot area.  The radius value in the data point will be adjusted to fit the bubbles in the chart.  If the "autoscaleBubbles" option is set to false, the radius value in the data will be taken as a literal pixel value for the radius of the points.

The below chart show basic customization of bubble appearance with the "bubbleAlpha" and "highlightAlpha" options.

Company	R Value

Below is a basic bubble chart showing usage of the optional label and color properties passed in with the data.

The next chart uses the "bubbleGradients: true" option to specify gradient fills on the bubbles.  Radial gradients are not supported in IE* and will be automatically disabled.

*Radial gradients are not supported in IE 7 and IE 8 because they are not supported in the excanvas emulation layer used by jqPlot to render charts in IE 7 and IE 8.  jqPlot renders charts using the HTML canvas element which is supported by nearly every browser including IE 9.  Excanvas translates the canvas rendering to VML rendering for IE 7 and 8, but unfortunately does not properly handle radial gradients.

The following bubble chart shows the "autoscalePointsFactor" and "autoscaleMultiplier" options which can be used to control bubble scaling.  The "autoscalePointsFactor" options controls bubble scaling with the number of points on the plot.  A negative value will decrease bubble size and number of bubbles increases.  The "autoscaleMultiplier" will makes all bubbles larger or smaller for values greater  or less than 1.0.

This chart also demonstrates some of the highlighting options.  Bubble highlighting is controlled with the "highlightMouseOver" and "highlightMouseDown" boolean options.  Here the "highlightMouseDown: true" option is set which causes the plot to highlight on mousedown (click).  This automatically sets the "highlightMouseOver" option to false.

Events are also trigger with plot interaction.  Specifically, "jqplotDataHighlight", "jqplotDataUnhighlight", "jqplotDataClick" and "jqplotDataRightClick" events are triggered.  Handlers are passed an event object, the series index, the point index, and the bubble data.

AJAX and JSON Data Loading via Data Renderers

Animated Charts

Animated Dashboard Sample - Filled Line with Log Axis

Area Chart

Area Chart 2

Axis Labels

Axis Labels and Rotated Text

Bar Charts

Bar Colors Example

Bezier Curve Plots

Block Plots

Bubble Charts

Bubble Plots

Candlestick and Open Hi Low Close Charts

Chart Theming

Charts with Fill Between Lines

Cumulative Density Function Chart

Dashed Lines with Smoothing

Data Point Highlighting, Tooltips and Cursor Tracking

Data Point labels

Date Axes

Date Axes 2

Date Axes, Rotated Labels and Zooming

Draw Lines on Plots - Canvas Overlay

Draw Rectangles on Plots

Engel Curves

Error Bands and Confidence Intervals

Filled (Area) Charts

Force Plot to Have Tick at 0 or 100

Hidden Plots

Highlighting, Dragging Points, Cursor and Trend Lines

Line Charts and Options

Lorenz Curves

Mekko Charts

Meter Gauge

Open Hi Low Close and Candlestick Charts

Pie Charts and Options

Pie Charts and Options 2

Pie and Donut Charts

Plot Creation with jQuery Selectors

Plot Zooming and Cursor Control

Probability Density Function Chart

Pyramid Chart By Age

Pyramid Charts

Pyramid Charts 2

Quintile Pyramid Charts

Resizable Plots

Rotated Labels and Font Styling

Smoothed Lines

Vertical and Horizontal Bar Charts

Waterfall Charts

Waterfall Charts 2

Zoom Options

Zoom Proxy - Control one plot from another

Zooming

Zooming with Date and Log Axes


text:
<?php

/**
 * @file
 * Contains \Drupal\text\Tests\Formatter\TextFormatterTest.
 */

namespace Drupal\text\Tests\Formatter;

use Drupal\filter\Entity\FilterFormat;
use Drupal\system\Tests\Entity\EntityUnitTestBase;

/**
 * Tests the text formatters functionality.
 *
 * @group text
 */
class TextFormatterTest extends EntityUnitTestBase {

  /**
   * The entity type used in this test.
   *
   * @var string
   */
  protected $entityType = 'entity_test';

  /**
   * The bundle used in this test.
   *
   * @var string
   */
  protected $bundle = 'entity_test';

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array('text');

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    entity_create('filter_format', array(
      'format' => 'my_text_format',
      'name' => 'My text format',
      'filters' => array(
        'filter_autop' => array(
          'module' => 'filter',
          'status' => TRUE,
        ),
      ),
    ))->save();

    entity_create('field_storage_config', array(
      'field_name' => 'formatted_text',
      'entity_type' => $this->entityType,
      'type' => 'text',
      'settings' => array(),
    ))->save();
    entity_create('field_config', array(
      'entity_type' => $this->entityType,
      'bundle' => $this->bundle,
      'field_name' => 'formatted_text',
      'label' => 'Filtered text',
    ))->save();
  }

  /**
   * Tests all text field formatters.
   */
  public function testFormatters() {
    $formatters = array(
      'text_default',
      'text_trimmed',
      'text_summary_or_trimmed',
    );

    // Create the entity to be referenced.
    $entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
    $entity->formatted_text = array(
      'value' => 'Hello, world!',
      'format' => 'my_text_format',
    );
    $entity->save();

    foreach ($formatters as $formatter) {
      // Verify the text field formatter's render array.
      $build = $entity->get('formatted_text')->view(array('type' => $formatter));
      drupal_render($build[0]);
      $this->assertEqual($build[0]['#markup'], "
Hello, world!
\n");
      $this->assertEqual($build[0]['#cache']['tags'], FilterFormat::load('my_text_format')->getCacheTags(), format_string('The @formatter formatter has the expected cache tags when formatting a formatted text field.', array('@formatter' => $formatter)));
    }
  }

}


text:
package org.elasticsearch.action;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.common.Nullable;

public class WriteFailureException extends ElasticsearchException implements ElasticsearchWrapperException {
    @Nullable
    private final String mappingTypeToUpdate;

    public WriteFailureException(Throwable cause, String mappingTypeToUpdate) {
        super(null, cause);
        assert cause != null;
        this.mappingTypeToUpdate = mappingTypeToUpdate;
    }

    public String getMappingTypeToUpdate() {
        return mappingTypeToUpdate;
    }
}


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
function* x() {
  var _arr = [];

  for (var _i = 0; _i < _arr.length; _i++) {
    var a = _arr[_i];var _iteratorNormalCompletion = true;
    var _didIteratorError = false;
    var _iteratorError = undefined;

    try {
      for (var _iterator = a[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
        var b = _step.value;

        yield 1;
      }
    } catch (err) {
      _didIteratorError = true;
      _iteratorError = err;
    } finally {
      try {
        if (!_iteratorNormalCompletion && _iterator["return"]) {
          _iterator["return"]();
        }
      } finally {
        if (_didIteratorError) {
          throw _iteratorError;
        }
      }
    }
  }
}

function y() {
  return [].concat(babelHelpers.toConsumableArray(x()));
}

exports.y = y;


text:
"""Support for BSH Home Connect appliances."""

import asyncio
from datetime import timedelta
import logging

from requests import HTTPError
import voluptuous as vol

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_oauth2_flow, config_validation as cv
from homeassistant.util import Throttle

from . import api, config_flow
from .const import DOMAIN, OAUTH2_AUTHORIZE, OAUTH2_TOKEN

_LOGGER = logging.getLogger(__name__)

SCAN_INTERVAL = timedelta(minutes=1)

CONFIG_SCHEMA = vol.Schema(
    {
        DOMAIN: vol.Schema(
            {
                vol.Required(CONF_CLIENT_ID): cv.string,
                vol.Required(CONF_CLIENT_SECRET): cv.string,
            }
        )
    },
    extra=vol.ALLOW_EXTRA,
)

PLATFORMS = ["binary_sensor", "sensor", "switch"]

async def async_setup(hass: HomeAssistant, config: dict) -> bool:
    """Set up Home Connect component."""
    hass.data[DOMAIN] = {}

    if DOMAIN not in config:
        return True

    config_flow.OAuth2FlowHandler.async_register_implementation(
        hass,
        config_entry_oauth2_flow.LocalOAuth2Implementation(
            hass,
            DOMAIN,
            config[DOMAIN][CONF_CLIENT_ID],
            config[DOMAIN][CONF_CLIENT_SECRET],
            OAUTH2_AUTHORIZE,
            OAUTH2_TOKEN,
        ),
    )

    return True

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
    """Set up Home Connect from a config entry."""
    implementation = await config_entry_oauth2_flow.async_get_config_entry_implementation(
        hass, entry
    )

    hc_api = api.ConfigEntryAuth(hass, entry, implementation)

    hass.data[DOMAIN][entry.entry_id] = hc_api

    await update_all_devices(hass, entry)

    for component in PLATFORMS:
        hass.async_create_task(
            hass.config_entries.async_forward_entry_setup(entry, component)
        )

    return True

async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
    """Unload a config entry."""
    unload_ok = all(
        await asyncio.gather(
            *[
                hass.config_entries.async_forward_entry_unload(entry, component)
                for component in PLATFORMS
            ]
        )
    )
    if unload_ok:
        hass.data[DOMAIN].pop(entry.entry_id)

    return unload_ok

@Throttle(SCAN_INTERVAL)
async def update_all_devices(hass, entry):
    """Update all the devices."""
    data = hass.data[DOMAIN]
    hc_api = data[entry.entry_id]
    try:
        await hass.async_add_executor_job(hc_api.get_devices)
        for device_dict in hc_api.devices:
            await hass.async_add_executor_job(device_dict["device"].initialize)
    except HTTPError as err:
        _LOGGER.warning("Cannot update devices: %s", err.response.status_code)


text:
// Add the finished solution here when you receive it.

// Person 2: Write Pseudocode (Dan Shapiro)
/*
Question 1 Steps:
1. define function: add
2. function should take two parameters, int1, and int2
3. add int1 to int2
4. print result of operation to console
Question 2 Steps:
1. define function odd
2. function should take an array as a parameter
3. use modulus operator to check if array has an odd number of values
4. If odd, add up each element in the array
  - create counter variable
  - add each subsequent value to counter variable with each iteration
5. Output value to console
Question 3 Steps:
1. define function even
2. function should take an array as a parameter
3. use modulus operator to check if array has an even number of values
4. If even, add up each element in the array
  - create counter variable
  - add each subsequent value to counter variable with each iteration
5. Output value to console.
Question 4 Steps:
1. define function mean
2. function should take an array as a parameter
3. initialize counter variable and incrementally add each value of array to counter variable
4. divide final value of counter variable by length of array
5. output value to console
Question 5 Steps:
1. define function meanOdd
2. function should take an array as a parameter
3. check to see if number of values in array is an odd number. If odd:
4. initialize counter variable and incrementally add each value of array to counter variable
5. divide final value of counter variable by length of array
6. output value to console
Question 6 Steps:
1. define function meanEven
2. function should take an array as a parameter
3. check to see if number of values in array is an even number. If even:
4. initialize counter variable and incrementally add each value of array to counter variable
5. divide final value of counter variable by length of array
6. output value to console
Question 7 Steps:
1. define function median
2. function should take array as a parameter
3. sort array by numerical value
4. find length of array and divide by 2 (this will find the midpoint)
5. output value at midpoint index
Question 8 Steps:
1. define function medianEven
2. function should take array as a parameter
3. sort array by numerical value
4. use modulus operator to check if even number of values
5. find length of array and divide by 2 (this will return a decimal value like 4.5)
6. return values at +0.5 and -0.5 of the midpont (the two nearest whole values)
7. add those two numbers and divide by 2
8. Output value to console.
Question 9 Steps:
1. define function medianOdd
2. function should take array as a parameter
3. Check to make sure even number of values in array
4.  sort array by numerical value
5. find length of array and divide by 2 (this will find the midpoint)
6. output value at midpoint index
*/

/*
//Person 3: Pseudocode to code (Sami Zhang)
//Question 1
function add(int1, int2) {
    return int1 + int2;
}

console.log(add(1, 2))

//Question 2
var numbers = [1,2,3,4];

function odd (numbers) {
    var total = 0;
    for (var i in numbers) {
        if (i % 2 == 0){
            total += numbers[i];
        }
    }
    return total;
}

console.log(odd(numbers))

//Question 3
var numbers = [1,2,3,4]

function even (numbers) {
    var total = 0;
    for (var i in numbers) {
        if (i % 2 == 1){
            total += numbers[i];
        }
    }
    return total;
}

console.log(even(numbers))

//Question 4
var numbers = [1,2,3,4];

function mean (numbers) {
    var total = 0;
    var i;
    for (i = 0; i < numbers.length; i += 1) {
        total += numbers[i];
    }
    return total / numbers.length;
}

console.log(mean(numbers))

//Question 5
var numbers = [1,2,3,4,3];

function meanOdd (numbers) {
    var total = 0;
    var i;
    for (i = 0; i < numbers.length; i += 1) {
        if (i % 2 == 0) {
            total += numbers[i];
        }
    }
    return total / numbers.length;
}

console.log(meanOdd(numbers))

//Question 6
var numbers = [1,2,3,4,3];

function meanEven (numbers) {
    var total = 0;
    var i;
    for (i = 0; i < numbers.length; i += 1) {
        if (i % 2 == 1) {
            total += numbers[i];
        }
    }
    return total / numbers.length;
}

console.log(meanEven(numbers))

//Question 7
var numbers = [1,2,3,4,3,5,7,9,1,5,4];

function median (numbers) {
    numbers.sort()
    var midpoint = numbers.length / 2 //I don't think this is the right way to find the median...
    return midpoint
}

console.log(median(numbers))

//Question 8
var numbers = [1,2,3,4,3,5,7,9,1,5,4];

function medianEven (numbers) {
    numbers.sort();
    var i;
    for (i = 0; i < numbers.length; i += 1) {
           if (i % 2 == 1) {
               var total = numbers.length / 2;
           }
       }
     return total;
}

console.log(medianEven(numbers))

//Question 9
var numbers = [1,2,3,4,3,5,7,9,1,5,4];

function medianOdd (numbers) {
    numbers.sort();
    var i;
    for (i = 0; i < numbers.length; i += 1) {
           if (i % 2 == 0) {
               var total = numbers.length / 2;
           }
       }
     return total;
}

console.log(medianOdd(numbers))

*/
// ____________________________________

//Person 4: Refactor and User Stories (Erica Lloyd)

//Question 1
//Initial Solution
// function add(int1, int2) {
//     return int1 + int2;
// }
//USER STORY: As a user, I want to add 2 integers

//REFACTOR: If number must be an integer (int1, int2),
//round to nearest integer
function add(int1, int2) {
    return Math.round(int1) + Math.round(int2);
}
//Test code
console.log(add(1, 2));

//--------------------------------------------------------
//Question 2
//Initial Solution
// function odd (numbers) {
//     var total = 0;
//     for (var i in numbers) {
//         if (i % 2 == 0){
//             total += numbers[i];
//         }
//     }
//     return total;
// }
//USER STORY: As a user, I want to calculate the sum of
//the values at the even positions in a list of numbers

//REFACTOR
var numbers = [1,2,3,4];
function odd (numbers) {
    var total = 0;
    for (i in numbers) {
      (i % 2 == 0) ? total+=numbers[i] : null;
    }
    return total;
}

//How to calculate sum of odd numbers
// function odd (numbers) {
//   var total = 0;
//   for (i in numbers) {
//     if (numbers[i] % 2 == 1){
//      total+=numbers[i];
//    }
//   }
//   return total;
// }

//Test code
console.log(odd(numbers));
//------------------------------------------------------

//Question 3
//Initial Solution
// function even (numbers) {
//     var total = 0;
//     for (var i in numbers) {
//         if (i % 2 == 1){
//             total += numbers[i];
//         }
//     }
//     return total;
// }
//USER STORY: As a user, I want to calculate the sum of the values at
// the odd positions in a list of numbers

//REFACTOR
var numbers = [1,2,3,4]
function even (numbers) {
    var total = 0;
    for (i in numbers) {
      (i % 2 == 1) ? total+=numbers[i] : null;
    }
    return total;
}

//How to calculate sum of even numbers
// function even(numbers) {
//   var total = 0;
//   for (i in numbers) {
//     if (numbers[i] % 2 == 0){
//      total+=numbers[i];
//     }
//   }
//   return total;
// }

//Test code
console.log(even(numbers))
//---------------------------------------------------

//Question 4
//Initial Solution
// function mean (numbers) {
//     var total = 0;
//     var i;
//     for (i = 0; i < numbers.length; i += 1) {
//         total += numbers[i];
//     }
//     return total / numbers.length;
// }
//USER STORY: As a user, I want to calculate the mean of
//a list of numbers

//REFACTOR
var numbers = [1,2,3,4];
function mean (numbers) {
    var total = numbers.reduce(function (a,b){
      return a + b;
    });
    return total / numbers.length;
}
//Test code
console.log(mean(numbers))
//-------------------------------------------------------

//Question 5

//Initial Solution
// function meanOdd (numbers) {
//     var total = 0;
//     var i;
//     for (i = 0; i < numbers.length; i += 1) {
//         if (i % 2 == 0) {
//             total += numbers[i];
//         }
//     }
//     return total / numbers.length;
// }
//USER STORY:As a user, I want to calculate the mean of the values at
//the even positions in a list of numbers

//REFACTOR
var numbers = [1,2,3,4,3];
function meanOdd (numbers) {
    var total = 0;
    for (var i in numbers){
      (i % 2 == 0) ? total+=numbers[i] : null;
    }
    return total / numbers.length;
}

//How to calculate mean of odd numbers
// function meanOdd (numbers) {
//     var oddTotal = 0;
//     var oddCount = 0;

//     for (var i in numbers){
//       if(numbers[i] % 2 == 1) {
//         oddTotal += numbers[i];
//         oddCount ++;
//       }
//     }

//     return oddTotal / oddCount;
// }

//Test code
console.log(meanOdd(numbers))
//------------------------------------------------------

//Question 6

//Initial Solution
// function meanEven (numbers) {
//     var total = 0;
//     var i;
//     for (i = 0; i < numbers.length; i += 1) {
//         if (i % 2 == 1) {
//             total += numbers[i];
//         }
//     }
//     return total / numbers.length;
// }
//USER STORY: As a user, I want to calculate the mean of the values at
//the odd positions in a list of numbers

//REFACTOR
var numbers = [1,2,3,4,3];
function meanEven (numbers) {
    var total = 0;
    for (var i in numbers){
      (i % 2 == 1) ? total+=numbers[i] : null;
    }
    return total / numbers.length;
}

//How to calculate mean of even numbers
// function meanEven (numbers) {
//     var evenTotal = 0;
//     var evenCount = 0;

//     for (var i in numbers){
//       if(numbers[i] % 2 == 0) {
//         evenTotal += numbers[i];
//         evenCount ++;
//       }
//     }

//     return evenTotal / evenCount;
// }

//Test code
console.log(meanEven(numbers))
//--------------------------------------------------------

//Question 7

//Initial Soltution
// function median (numbers) {
//     numbers.sort()
//     var midpoint = numbers.length / 2 //I don't think this is the right way to find the median...
//     return midpoint
// }
//USER STORY: As a user, I want to calculate half the length of
// a list of numbers

// REFACTOR
var numbers = [1,2,3,4,3,5,7,9,1,5,4];
function median (numbers) {
    return numbers.length / 2;
}

//How to find median
// function median (numbers) {
//     var midpoint1;
//     var midpoint2;
//     var median;
//     //Sort the Array
//     numbers.sort();
//     //If number of elements (length of Array) is odd, the median is the
//     //value at the midpoint of the array
//     if (numbers.length % 2 == 1){
//       midpoint1 = Math.floor(numbers.length / 2);
//       median = numbers[midpoint1];
//     }
//     //Else if number of elements is even, the median is the sum of the
//     //2 middle values divided by 2
//     else{
//       midpoint1 = (numbers.length/2) - 1;
//       midpoint2 = numbers.length/2;
//       median = (numbers[midpoint1] + numbers[midpoint2])/2;
//     }
//     return median;
// }

//Test Code
console.log(median(numbers))
//---------------------------------------------------------------

//Question 8

//Initial Solution
// function medianEven (numbers) {
//     numbers.sort();
//     var i;
//     for (i = 0; i < numbers.length; i += 1) {
//            if (i % 2 == 1) {
//                var total = numbers.length / 2;
//            }
//        }
//      return total;
// }
//USER STORY: As a user, I want to calculate half the length of
//a list of numbers

//REFACTOR
var numbers = [1,2,3,4,3,5,7,9,1,5,4];
function medianEven (numbers) {
     return numbers.length/2;
}

//How to calculate median of even numbers
// function medianEven (numbers) {
//   var evenNums = [];
//   var midpoint1;
//   var midpoint2;
//   var median;

//   //Iterate through array, if the value at an index is even
//   //push it onto the evenNums array
//   for (i in numbers){
//     if(numbers[i] % 2 ==0){
//       evenNums.push(numbers[i]);
//     }
//   }

//   //Calculate the median of the evenNums

//   //Sort the even numbers
//   evenNums.sort();

//   //If number of elements (length of Array) is odd, the median is the
//   //value at the midpoint of the array
//   if (evenNums.length % 2 == 1){
//     midpoint1 = Math.floor(evenNums.length / 2);
//     median = evenNums[midpoint1];
//   }
//   //Else if number of elements is even, the median is the sum of the
//   //2 middle values divided by 2
//   else{
//     midpoint1 = (evenNums.length/2) - 1;
//     midpoint2 = evenNums.length/2;
//     median = (evenNums[midpoint1] + evenNums[midpoint2])/2;
//   }
//   return median;
// }

//Test code
console.log(medianEven(numbers))
//----------------------------------------------------------

//Question 9

//Initial Solution
// function medianOdd (numbers) {
//     numbers.sort();
//     var i;
//     for (i = 0; i < numbers.length; i += 1) {
//            if (i % 2 == 0) {
//                var total = numbers.length / 2;
//            }
//        }
//      return total;
// }
//USER STORY: As a a user, I want to calculate half the length
//of a list of numbers

//REFACTOR
var numbers = [1,2,3,4,3,5,7,9,1,5,4];
function medianOdd (numbers) {
  return numbers.length/2;
}
//Test Code
console.log(medianOdd(numbers))

// _______________
// Tests:  Do not alter code below this line.

// oddLengthArray  = [1, 2, 3, 4, 5, 5, 7]
// evenLengthArray = [4, 4, 5, 5, 6, 6, 6, 7]

// function assert(test, message, test_number) {
//   if (!test) {
//     console.log(test_number + "false");
//     throw "ERROR: " + message;
//   }
//   console.log(test_number + "true");
//   return true;
// }

// // tests for sum
// assert(
//   (sum instanceof Function),
//   "sum should be a Function.",
//   "1. "
// )

// assert(
//   sum(oddLengthArray) === 27,
//   "sum should return the sum of all elements in an array with an odd length.",
//   "2. "
// )

// assert(
//   sum(evenLengthArray) === 43,
//   "sum should return the sum of all elements in an array with an even length.",
//   "3. "
// )

// // tests for mean
// assert(
//   (mean instanceof Function),
//   "mean should be a Function.",
//   "4. "
// )

// assert(
//   mean(oddLengthArray) === 3.857142857142857,
//   "mean should return the average of all elements in an array with an odd length.",
//   "5. "
// )

// assert(
//   mean(evenLengthArray) === 5.375,
//   "mean should return the average of all elements in an array with an even length.",
//   "6. "
// )

// // tests for median
// assert(
//   (median instanceof Function),
//   "median should be a Function.",
//   "7. "
// )

// assert(
//   median(oddLengthArray) === 4,
//   "median should return the median value of all elements in an array with an odd length.",
//   "8. "
// )

// assert(
//   median(evenLengthArray) === 5.5,
//   "median should return the median value of all elements in an array with an even length.",
//   "9. "
// )


text:
@interface LoginViewController : UIViewController
{
    CGFloat width;
    CGFloat height;
    UITextField* username;
    UITextField* password;
    UIButton *loginbutton;
    UIActivityIndicatorView *activityIndicator;
    NSString *name;
    NSString *registration;
}

@end


text:
@class SHMediaItem;

@interface SHImageMediaItemViewController : UIViewController

@property (nonatomic) BOOL disablePinchAndZoomOnImage;
@property (nonatomic) UIViewContentMode contentMode;

@end


text:
import os
import random
from multiprocessing import Pool, cpu_count

BUILD_ROOT = '/tmp/'

def ensure_dir(f):
    d = os.path.dirname(f)
    if not os.path.exists(d):
        os.makedirs(d)
    return d

def create_build_path():
    dirname = hex(random.randint(2**24, 2**32))[2:]
    build_path = os.path.join(BUILD_ROOT, dirname)
    if not os.path.exists(build_path):
        os.makedirs(build_path)
    return build_path

def build_one(path):
    """ build rst file on 'src/'+path, generate pdf on 'dist/'+path """
    build_path = create_build_path()
    dirname = os.path.dirname(os.path.join('src', path))

    if os.path.exists(os.path.join('src', path)) and path.endswith('.rst'):
        os.system('rm -rf {}/*'.format(build_path))
        os.system('cp conf/* {}'.format(build_path))
        os.system('cp {}/* {}/'.format(dirname, build_path))
        rstfname = path.rsplit('/', 1)[-1]
        name, dot, ext = rstfname.partition('.')
        xetexfname = name + dot + 'xetex'
        pdffname = name + dot + 'pdf'
        os.system('cd {build_path} && ' \
                  'rst2xetex.py --latex-preamble="" {rstfname} {xetexfname} && ' \
                  'xelatex {xetexfname}'.format(**locals()))
        target_path = ensure_dir('dist/{}'.format(path))
        os.system('mv {build_path}/*.pdf {target_path}'.format(**locals()))

    os.system('rm -rf {}'.format(build_path))

def clear_all():
    os.system('rm -rf dist/*')

def build_all(concurrency=None):
    clear_all()
    pool = Pool(concurrency or cpu_count()*2)
    for root, dirs, files in os.walk('src'):
        for filename in files:
            if filename.endswith('.rst'):
                #build_one(os.path.join(root[4:], filename))
                pool.apply_async(build_one, [os.path.join(root[4:], filename)])
    pool.close()
    pool.join()

if __name__ == '__main__':
    build_all()


text:
//
// This code was auto-generated by AFNOR StoredProcedureSystem, version 1.0
//

using Bivi.Data.Context;
using Bivi.Domaine;
using Bivi.Business.Depots;
using System.Linq;

namespace Bivi.Data.Depots
{
    public partial class DepotRechercheTypeDoc : Depot<RechercheTypeDoc>, IDepotRechercheTypeDoc
    {
        /// <summary>
        /// Initialise une nouvelle instance du dépôt.
        /// </summary>
        /// <param name="dataContext">Contexte de la base de donnée.</param>
        public DepotRechercheTypeDoc(IBiviDbContext dataContext)
            : base(dataContext)
        {
        }
    }
}


text:
namespace prayzzz.Common.Enums
{
    public enum OrderingDirection
    {
        Asc,
        Desc
    }
}


text:
using System;
using System.Text;
using System.ComponentModel;

#if WINDOWS_UWP

using Windows.Security.Cryptography;
using Windows.Security.Cryptography.Core;

#else

using System.Security.Cryptography;

#endif

namespace Cauldron.Interception
{
    ///
    /// Provides usefull extension methods
    ///
    public static class ExtensionsInterception
    {
        ///
        /// Creates a new <see cref="Type"/> that implements the properties of an interface defined by <typeparamref name="T"/>
        /// and copies all value of <paramref name="anon"/> to the new object.
        ///
        /// <typeparam name="T">The type of interface to implement</typeparam>
        /// <param name="anon">The anonymous object</param>
        /// <returns>A new object implementing the interface defined by <typeparamref name="T"/></returns>
        /// <example>
        /// In some special cases (e.g. unit tests) it may be required to convert an anonymous type to a type that implements a certain interface.
        /// This also can be handy in situations where it is an overkill to create a new class.
        /// Lazy programmers will love this. To achieve this, a new type is weaved into your assembly.
        /// <para/>
        /// The following examples illustrates how the weaver modifies your code.
        /// <para/>
        /// Your code:
        ///
        /// private static void Main(string[] args)
        /// {
        ///     var sample = new { Index = 0, Name = "Hello" }.CreateType<ISampleInterface>();
        ///     Console.WriteLine(sample.Name);
        /// }
        ///
        /// Your code will look like this after the weaver's modification:
        ///
        /// private static void Main(string[] args)
        /// {
        ///     var sample = Assign(new
        ///     {
        ///         Index = 0,
        ///         Name = "Hello"
        ///     });
        ///     Console.WriteLine(sample.Name);
        /// }
        ///
        /// The weaver creates a new type that implements the ISampleInterface.
        ///
        /// [EditorBrowsable(EditorBrowsableState.Never)]
        /// [Serializable]
        /// public sealed class SampleInterfaceCauldronAnonymousType : ISampleInterface
        /// {
        ///     public int Index { get; set; }
        ///     public string Name { get; set; }
        /// }
        ///
        /// The weaver also adds a new method that maps the values from the anonymous type to the SampleInterfaceCauldronAnonymousType.
        ///
        /// [EditorBrowsable(EditorBrowsableState.Never)]
        /// private static SampleInterfaceCauldronAnonymousType Assign(AnonymousType<int, string> anonymousType)
        /// {
        ///     return new SampleInterfaceCauldronAnonymousType
        ///     {
        ///         Index = anonymousType.Index,
        ///         Name = anonymousType.Name
        ///     };
        /// }
        ///
        /// </example>
        public static T CreateType<T>(this object anon) where T : class
        {
            /* NOTE: This will be implemented by Cauldron.Interception.Fody */
            throw new NotImplementedException("No weaving happend.");
        }

        /// <exclude/>
        [EditorBrowsable(EditorBrowsableState.Never)]
        public static string GetSHA256Hash(this string value)
        {
#if WINDOWS_UWP
            var sha = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha512);
            var buffer = CryptographicBuffer.ConvertStringToBinary(value, BinaryStringEncoding.Utf8);

            var hashed = sha.HashData(buffer);
            byte[] bytes;

            CryptographicBuffer.CopyToByteArray(hashed, out bytes);
            return Convert.ToBase64String(bytes);
#elif NETCORE

            using (var sha = SHA256.Create())
                return Convert.ToBase64String(sha.ComputeHash(UTF8Encoding.UTF8.GetBytes(value)));
#else
            using (var sha = SHA256.Create())
                return Convert.ToBase64String(sha.ComputeHash(UTF8Encoding.UTF8.GetBytes(value)));

#endif
        }

        /// <exclude/>
        [EditorBrowsable(EditorBrowsableState.Never)]
        public static void TryDisposeInternal(this object context)
        {
            var disposable = context as IDisposable;
            disposable?.Dispose();
        }
    }
}


text:
import { window } from 'global';

if (window) {
  window.STORYBOOK_ENV = 'react';
}