text:
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

require('es6-shim');

var $ = require('../util/jquery');
var defineClass = require('../util/define-class');

var Place = require('../place');
var DestinationInfo = require('./destination-info');
var DestinationMarker = require('./destination-marker');

var describeDestination = require('../describe-destination');

//named destination marker clients
var SEARCH_CLIENT = 'search';

var MapWidget = defineClass({
  publics: {
    getBounds: function() {
      return this.map.getBounds();
    },

    addControls: function(controlPosition, $controls) {
      var controls = this.map.controls[controlPosition];
      $controls.each(function() {
        controls.push(this);
      });
    },

    bindDestinations: function(destinations) {
      if (this.destinations) {
        this.destinations.onAdd.remove(this.handleDestinationAdd);
        this.destinations.onRemove.remove(this.handleDestinationRemove);
      }

      this.destinations = destinations;

      if (destinations) {
        destinations.onAdd.add(this.handleDestinationAdd);
        destinations.onRemove.add(this.handleDestinationRemove);
      }
    },

    getSelectedDestination: function() {
      return this.selectedDestination;
    },

    clearSearchMarkers: function() {
      $.each(this.searchMarkers, function() {
        this.removeClient(SEARCH_CLIENT);
      });
      this.searchMarkers = [];
    },

    closeActiveInfoWindow: function() {
      if (this.info) {
        this.info.close();
      }
    },

    deselectDestination: function() {
      if (this.selectedDestination) {
        this.selectedDestination.deselect();
      }
    },

    fitAll: function() {
      var geoms = [];

      function addToGeoms() {
        geoms.push({ location: this });
      }

      this.destinations.each(function() {
        if (this.hasPlace()) {
          if (this.leg && this.leg.sync) {
            $.each(this.leg.sync.routes[0]['overview_path'], addToGeoms);
          }
          geoms.push(this.getPlace().getGeometry());
        }
      });

      this.ensureGeomsVisible(geoms);
    },

    fitBounds: function(bounds) {
      this.map.fitBounds(bounds);
    },

    ensureVisible: function(place) {
      this.ensureGeomsVisible([place.getGeometry()]);
    },

    invalidateSize: function() {
      this.maps.event.trigger(this.map, 'resize');
    },

    /**
     * @return whether or not location selection is now enabled. Location
     *  selection can only be enabled when a destination slot has been selected.
     */
    enableLocationSelection: function() {
      if (this.selectedDestination) {
        this.map.setOptions({ draggableCursor: 'auto' });
        this.locationSelectionEnabled = true;
        return true;
      }
      return false;
    },

    disableLocationSelection: function() {
      this.map.setOptions({ draggableCursor: null });
      this.locationSelectionEnabled = false;
    },

    createPlacesService: function() {
      return new this.maps.places.PlacesService(this.map);
    },

    showSearchResults: function(results) {
      var self = this;

      this.clearSearchMarkers();
      this.closeActiveInfoWindow();

      this.fitGeoms(results.map(function(result) {
        return result.getGeometry();
      }));

      var dest = this.selectedDestination;
      if (results.length === 1 && dest) {
        /* It would be nice if we could distinguish between an autocomplete
         * click and a normal search so that we don't overwrite the search box
         * text for the autocomplete click.*/
        dest.setPlace(results[0]);
      } else if (results.length > 0) {
        $.each(results, function(i, place) {
          var marker = self.getOrCreateMarker(place, SEARCH_CLIENT,
            DestinationMarker.color.RED, null, false);
          self.searchMarkers.push(marker);

          marker.onClick.add(marker.restrictListenerToClient(function() {
            var dest = self.selectedDestination;
            if (dest) {
              dest.setPlace(place);
            }
          }));

          marker.deprioritizeClient();
        });
      }
    }
  },

  privates: {
    handleDestinationAdd: function(destination) {
      var self = this;

      this.destMeta.set(destination, {});

      destination.onPlaceChange.add(function(place) {
        self.handleDestinationPlaceChange(destination, place);
      });
      destination.onDeselect.add(function() {
        self.handleDestinationDeselect(destination);
      });
      destination.onSelect.add(function() {
        self.handleDestinationSelect(destination);
      });

      if (destination.hasNext()) {
        this.updateLeg(destination.getNext());
      }

      return destination;
    },

    handleDestinationRemove: function(destination) {
      var meta = this.destMeta.get(destination);

      if (meta.unbindMarker) {
        meta.unbindMarker();
      }

      if (meta.leg) {
        meta.leg.clear();
      }

      var next = this.destinations.get(destination.getIndex());
      if (next) {
        this.updateLeg(next);
      }

      destination.deselect();

      this.destMeta.delete(destination);
    },

    getOrCreateMarker: function(place, client, color, mergePredicate, update) {
      var self = this;

      var key = place.toKey();

      var marker = this.markers[key];
      if (marker) {
        if (!mergePredicate || mergePredicate(marker)) {
          marker.pushClient(client, color, update);
        } else {
          marker = null;
        }
      } else {
        marker = new DestinationMarker(this.maps, this.map, place,
          client, color);

        if (place.hasDetails()) {
          marker.onClick.add(function() {
            self.showDestinationInfo(marker);
          }, true);
        }

        this.markers[key] = marker;
        marker.onClear.add(function() {
          delete self.markers[key];
        });
      }

      return marker;
    },

    bindDestinationMarker: function(destination) {
      var self = this;

      var place = destination.getPlace();

      var marker = this.getOrCreateMarker(place, destination,
        this.getAppropriateDestinationMarkerColor(destination),
        function(marker) {
          return !marker.hasClient(destination);
        });

      if (!marker) {
        return;
      }

      marker.onClick.add(destination.select);
      function handleSelection() {
        marker.setColor(self.getAppropriateDestinationMarkerColor(destination));
      }
      destination.onSelect.add(handleSelection);
      destination.onDeselect.add(handleSelection);

      function handleOrdinalChange() {
        describeDestination.decorateMarker(marker, destination);
      }

      destination.onOrdinalChange.add(handleOrdinalChange);
      handleOrdinalChange();

      var meta = this.destMeta.get(destination);

      function unbind() {
        marker.removeClient(destination);
        marker.onClick.remove(destination.select);
        destination.onSelect.remove(handleSelection);
        destination.onDeselect.remove(handleSelection);
        destination.onOrdinalChange.remove(handleOrdinalChange);
        destination.onPlaceChange.remove(handlePlaceChange);
        if (meta.unbindMarker === unbind) {
          delete meta.unbindMarker;
        }
      }

      meta.unbindMarker = unbind;

      function handlePlaceChange(newPlace) {
        if ((place && place.toKey()) !== (newPlace && newPlace.toKey())) {
          unbind();
        }
      }

      destination.onPlaceChange.add(handlePlaceChange);
    },

    getAppropriateDestinationMarkerColor: function(destination) {
      return destination.isSelected()?
        DestinationMarker.color.GREEN : DestinationMarker.color.BLUE;
    },

    showDestinationInfo: function(destinationMarker) {
      if (!this.info) {
        this.info = new DestinationInfo(
          this.maps, this.map, destinationMarker.place);
      } else {
        this.info.setPlace(destinationMarker.place);
      }

      this.info.show(destinationMarker.marker);
    },

    handleDestinationPlaceChange: function(destination, place) {
      if (place) {
        this.bindDestinationMarker(destination);
      }

      if (destination.getPrevious()) {
        this.updateLeg(destination);
      }
      if (destination.getNext()) {
        this.updateLeg(destination.getNext());
      }
    },

    handleDestinationDeselect: function(destination) {
      this.selectedDestination = null;
      destination.onPlaceChange.remove(
        this.handleSelectedDestinationPlaceChange);
      this.disableLocationSelection();
    },

    handleDestinationSelect: function(destination) {
      this.deselectDestination();

      this.selectedDestination = destination;
      destination.onPlaceChange.add(this.handleSelectedDestinationPlaceChange);
      this.handleSelectedDestinationPlaceChange(destination.getPlace());
    },

    handleSelectedDestinationPlaceChange: function(place) {
      if (place) {
        this.disableLocationSelection();
        this.ensureVisible(place);
      } else {
        this.enableLocationSelection();
      }
    },

    updateLeg: function(destination) {
      var self = this;
      var maps = this.maps;
      var map = this.map;

      var a = destination.getPrevious().getPlace();
      var b = destination.getPlace();

      var meta = this.destMeta.get(destination);

      var leg = meta.leg;
      if (leg) {
        if (leg.async) {
          leg.async.reject();
        }
        leg.clear();
      } else {
        var renderer = new maps.DirectionsRenderer({
          preserveViewport: true,
          suppressMarkers: true
        });
        meta.leg = leg = {
          renderer: renderer,
          clear: function() {
            // setMap(null) seems to be the best way to clear the nav route
            renderer.setMap(null);
          }
        };
      }

      if (a && b) {
        var request = {
          origin: a.getLocation(),
          destination: b.getLocation(),
          travelMode: maps.TravelMode.DRIVING // TODO(rosswang): user choice
        };

        leg.async = $.Deferred();

        this.directionsService.route(request, function(result, status) {
          if (status === maps.DirectionsStatus.OK) {
            leg.async.resolve(result);
            leg.sync = result;
          } else {
            self.onError({ directionsStatus: status });
            leg.async.reject(status);
          }
        });

        leg.async.done(function(result) {
          leg.renderer.setDirections(result);
          leg.renderer.setMap(map);
        });
      }
    },

    centerOnCurrentLocation: function(navigator) {
      var self = this;
      var maps = this.maps;
      var map = this.map;

      // https://developers.google.com/maps/documentation/javascript/examples/map-geolocation
      if (navigator && navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(function(position) {
          var latLng = new maps.LatLng(
            position.coords.latitude, position.coords.longitude);
          map.setCenter(latLng);

          self.geocoder.geocode({ location: latLng },
            function(results, status) {
              var origin = self.destinations.get(0);
              if (status === maps.GeocoderStatus.OK &&
                  origin && !origin.hasPlace()) {
                origin.setPlace(new Place(results[0]));
              }
            });
          });
      }
    },

    ensureGeomsVisible: function(geoms) {
      var curBounds = this.map.getBounds();
      if (!geoms.every(function(geom) {
            return curBounds.contains(geom.location);
          })) {
        this.fitGeoms(geoms);
      }
    },

    fitGeoms: function(geoms) {
      var curBounds = this.map.getBounds();
      var curSize = curBounds.toSpan();
      function wontShrink(proposed) {
        var size = proposed.toSpan();
        return size.lat() >= curSize.lat() || size.lng() >= curSize.lng();
      }

      if (geoms.length === 1) {
        var geom = geoms[0];
        if (geom.viewport && wontShrink(geom.viewport)) {
          this.map.fitBounds(geom.viewport);
        } else {
          this.map.panTo(geom.location);
        }

      } else if (geoms.length > 1) {
        this.map.fitBounds(geoms.reduce(function(acc, geom) {
          if (geom.viewport) {
            acc.union(geom.viewport);
          } else {
            acc.extend(geom.location);
          }
          return acc;
        }, new this.maps.LatLngBounds()));
      }
    },

    selectLocation: function(latLng) {
      var self = this;
      var maps = this.maps;

      var dest = this.selectedDestination;
      if (dest) {
        if (this.locationSelectionEnabled) {
          self.geocoder.geocode({ location: latLng },
            function(results, status) {
              if (status === maps.GeocoderStatus.OK) {
                dest.setPlace(new Place(results[0]));

                /* If we've just picked a location like this, we probably don't
                 * care about search results anymore. */
                self.clearSearchMarkers();
              }
            });
        } else {
          dest.deselect();
          this.closeActiveInfoWindow();
        }
      }
    }
  },

  constants: ['$', 'maps'],
  events: {
    /**
     * @param bounds
     */
    onBoundsChange: '',

    /**
     * @param error A union with one of the following keys:
     *  directionsStatus
     */
    onError: 'memory'
  },

  // https://developers.google.com/maps/documentation/javascript/tutorial
  init: function(opts) {
    opts = opts || {};
    var self = this;

    var maps = opts.maps || global.google.maps;
    var navigator = opts.navigator || global.navigator;

    this.maps = maps;
    this.navigator = opts.navigator || global.navigator;
    this.geocoder = opts.geocoder || new maps.Geocoder();
    this.directionsService = new maps.DirectionsService();

    this.$ = $('<div>').addClass('map-canvas');

    this.searchMarkers = [];
    this.markers = {};
    this.destMeta = new Map();

    this.initialConfig = {
      center: new maps.LatLng(37.4184, -122.0880), //Googleplex
      zoom: 11
    };

    var map = new maps.Map(this.$[0], this.initialConfig);
    this.map = map;

    maps.event.addListener(map, 'click', function(e) {
      self.selectLocation(e.latLng);
    });
    maps.event.addListener(map, 'bounds_changed', function() {
      self.onBoundsChange(map.getBounds());
    });

    this.centerOnCurrentLocation(navigator);
  }
});

module.exports = MapWidget;


text:
@interface PBMutableExtensionRegistry()
@property (retain) NSMutableDictionary* mutableClassMap;
@end

@implementation PBMutableExtensionRegistry

@synthesize mutableClassMap;

- (void) dealloc {
  self.mutableClassMap = nil;
  [super dealloc];
}

- (id) initWithClassMap:(NSMutableDictionary*) mutableClassMap_ {
  if ((self = [super initWithClassMap:mutableClassMap_])) {
    self.mutableClassMap = mutableClassMap_;
  }

  return self;
}

+ (PBMutableExtensionRegistry*) registry {
  return [[[PBMutableExtensionRegistry alloc] initWithClassMap:[NSMutableDictionary dictionary]] autorelease];
}

- (void) addExtension:(id<PBExtensionField>) extension {
  if (extension == nil) {
    return;
  }

  Class extendedClass = [extension extendedClass];
  id key = [self keyForClass:extendedClass];

  NSMutableDictionary* extensionMap = [classMap objectForKey:key];
  if (extensionMap == nil) {
    extensionMap = [NSMutableDictionary dictionary];
    [mutableClassMap setObject:extensionMap forKey:key];
  }

  [extensionMap setObject:extension
                   forKey:[NSNumber numberWithInteger:[extension fieldNumber]]];
}

@end

redpajama_set_name: RedPajamaGithub


text:
from sympy import Basic

new = Basic.__new__

def is_leaf(x):
    return not isinstance(x, Basic) or x.is_Atom


text:
public class InterpreterExample {

	public static void main(String[] args) {
		VariableExpression p = new VariableExpression("p");
		VariableExpression q = new VariableExpression("q");

		// (true and p) or (q and !p)
		BooleanExpression expr = new OrExpression(
				new AndExpression(new Constant(true), p),
				new AndExpression(q, new NotExpression(p)));

		Context context = new Context();
		context.assign(p, true);
		context.assign(q, true);
		System.out.println("p: true\nq: true\n   Result: " + expr.evaluate(context));

		context.assign(p, true);
		context.assign(q, false);
		System.out.println("p: true\nq: false\n   Result: " + expr.evaluate(context));

		context.assign(p, false);
		context.assign(q, true);
		System.out.println("p: false\nq: true\n   Result: " + expr.evaluate(context));

		context.assign(p, false);
		context.assign(q, false);
		System.out.println("p: false\nq: false\n   Result: " + expr.evaluate(context));
	}

}


text:
class CreateInterviews < ActiveRecord::Migration[4.2]
  def change
    create_table :interviews do |t|
      t.boolean :hired
      t.datetime :scheduled

      t.timestamps
    end
  end
end


text:
Spencer Whitehead

wcipeg.com
dmoj.com
uhunt.felix-halim.net
train.usaco.org
hackerrank.com

bipartite graphs
adjacency graphs

adjacency list is usually the way to go

depth first search

breadth first search
- keep a stack of already reached elements

traveling salesman


text:
  Signy-Montlibert est
       un village
       situé dans le département des Ardennes en Champagne-Ardenne. On dénombrait 81 habitants en 2008.

Le parc d'habitations, à Signy-Montlibert, était réparti en 2011 en un appartements et 64 maisons soit
 un marché relativement équilibré.

À proximité de Signy-Montlibert sont positionnées géographiquement les communes de
Herbeuval localisée à 3 km, 81 habitants,
Chauvency-Saint-Hubert à 5 km, 238 habitants,
Auflance à 4 km, 88 habitants,
Villy localisée à 5 km, 180 habitants,
Thonnelle à 5 km, 141 habitants,
Moiry à 2 km, 183 habitants,
 entre autres. De plus, Signy-Montlibert est située à seulement 29 km de Sedan.

Si vous envisagez de emmenager à Signy-Montlibert, vous pourrez aisément trouver une maison à vendre.


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>TorqueUtils (xenon-2.3.0 2.6.0 API for Xenon developers)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

nl.esciencecenter.xenon.adaptors.schedulers.torque

Class TorqueUtils

java.lang.Object

nl.esciencecenter.xenon.adaptors.schedulers.torque.TorqueUtils

final class TorqueUtils
extends java.lang.Object

Generator for GridEngine job script.

Field Summary

Fields

Modifier and Type
Field and Description

static java.lang.String
JOB_OPTION_JOB_CONTENTS

static java.lang.String
JOB_OPTION_JOB_SCRIPT

static java.lang.String
JOB_OPTION_RESOURCES

private static org.slf4j.Logger
LOGGER

private static int
MINUTES_PER_HOUR

static java.util.regex.Pattern
QUEUE_INFO_NAME

private static java.lang.String[]
VALID_JOB_OPTIONS

Constructor Summary

Constructors

Modifier
Constructor and Description

private
TorqueUtils()

Method Summary

All Methods Static Methods Concrete Methods

Modifier and Type
Method and Description

static java.lang.String
generate(JobDescription description,
        Path workdir)

static void
generateScriptContent(JobDescription description,
                     java.util.Formatter script)

protected static JobStatus
getJobStatusFromQstatInfo(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> info,
                         java.lang.String jobIdentifier)

static void
verifyJobDescription(JobDescription description)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

LOGGER

private static final org.slf4j.Logger LOGGER

MINUTES_PER_HOUR

private static final int MINUTES_PER_HOUR

See Also:

Constant Field Values

QUEUE_INFO_NAME

public static final java.util.regex.Pattern QUEUE_INFO_NAME

JOB_OPTION_JOB_SCRIPT

public static final java.lang.String JOB_OPTION_JOB_SCRIPT

See Also:

Constant Field Values

JOB_OPTION_JOB_CONTENTS

public static final java.lang.String JOB_OPTION_JOB_CONTENTS

See Also:

Constant Field Values

JOB_OPTION_RESOURCES

public static final java.lang.String JOB_OPTION_RESOURCES

See Also:

Constant Field Values

VALID_JOB_OPTIONS

private static final java.lang.String[] VALID_JOB_OPTIONS

Constructor Detail

TorqueUtils

private TorqueUtils()

Method Detail

verifyJobDescription

public static void verifyJobDescription(JobDescription description)
                                 throws XenonException

Throws:

XenonException

getJobStatusFromQstatInfo

protected static JobStatus getJobStatusFromQstatInfo(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> info,
                                                     java.lang.String jobIdentifier)
                                              throws XenonException

Throws:

XenonException

generateScriptContent

public static void generateScriptContent(JobDescription description,
                                         java.util.Formatter script)

generate

public static java.lang.String generate(JobDescription description,
                                        Path workdir)

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
#include "stdio.h"
#ifndef mips
#include "stdlib.h"
#endif
#include "xlisp.h"
#include "sound.h"

#include "falloc.h"
#include "cext.h"
#include "instrbowedfreq.h"

void bowed_freq_free();

typedef struct bowed_freq_susp_struct {
    snd_susp_node susp;
    long terminate_cnt;
    sound_type bowpress_env;
    long bowpress_env_cnt;
    sample_block_values_type bowpress_env_ptr;
    sound_type freq_env;
    long freq_env_cnt;
    sample_block_values_type freq_env_ptr;

    struct instr *mybow;
    int temp_ret_value;
    double frequency;
} bowed_freq_susp_node, *bowed_freq_susp_type;

	    #include "instr.h"

void bowed_freq_nn_fetch(register bowed_freq_susp_type susp, snd_list_type snd_list)
{
    int cnt = 0; /* how many samples computed */
    int togo;
    int n;
    sample_block_type out;
    register sample_block_values_type out_ptr;

    register sample_block_values_type out_ptr_reg;

    register struct instr * mybow_reg;
    register double frequency_reg;
    register sample_block_values_type freq_env_ptr_reg;
    register sample_block_values_type bowpress_env_ptr_reg;
    falloc_sample_block(out, "bowed_freq_nn_fetch");
    out_ptr = out->samples;
    snd_list->block = out;

    while (cnt < max_sample_block_len) { /* outer loop */
	/* first compute how many samples to generate in inner loop: */
	/* don't overflow the output sample block: */
	togo = max_sample_block_len - cnt;

	/* don't run past the bowpress_env input sample block: */
	susp_check_term_samples(bowpress_env, bowpress_env_ptr, bowpress_env_cnt);
	togo = min(togo, susp->bowpress_env_cnt);

	/* don't run past the freq_env input sample block: */
	susp_check_samples(freq_env, freq_env_ptr, freq_env_cnt);
	togo = min(togo, susp->freq_env_cnt);

	/* don't run past terminate time */
	if (susp->terminate_cnt != UNKNOWN &&
	    susp->terminate_cnt <= susp->susp.current + cnt + togo) {
	    togo = susp->terminate_cnt - (susp->susp.current + cnt);
	    if (togo == 0) break;
	}

	n = togo;
	mybow_reg = susp->mybow;
	frequency_reg = susp->frequency;
	freq_env_ptr_reg = susp->freq_env_ptr;
	bowpress_env_ptr_reg = susp->bowpress_env_ptr;
	out_ptr_reg = out_ptr;
	if (n) do { /* the inner sample computation loop */

	    controlChange(mybow_reg, 128, BOW_CONTROL_CHANGE_CONST * *bowpress_env_ptr_reg++);
            setFrequency(mybow_reg, frequency_reg + *freq_env_ptr_reg++);
	    *out_ptr_reg++ = (sample_type) tick(mybow_reg);
	} while (--n); /* inner loop */

	susp->mybow = mybow_reg;
	/* using freq_env_ptr_reg is a bad idea on RS/6000: */
	susp->freq_env_ptr += togo;
	/* using bowpress_env_ptr_reg is a bad idea on RS/6000: */
	susp->bowpress_env_ptr += togo;
	out_ptr += togo;
	susp_took(bowpress_env_cnt, togo);
	susp_took(freq_env_cnt, togo);
	cnt += togo;
    } /* outer loop */

    /* test for termination */
    if (togo == 0 && cnt == 0) {
	snd_list_terminate(snd_list);
    } else {
	snd_list->block_len = cnt;
	susp->susp.current += cnt;
    }
} /* bowed_freq_nn_fetch */

void bowed_freq_ss_fetch(register bowed_freq_susp_type susp, snd_list_type snd_list)
{
    int cnt = 0; /* how many samples computed */
    int togo;
    int n;
    sample_block_type out;
    register sample_block_values_type out_ptr;

    register sample_block_values_type out_ptr_reg;

    register struct instr * mybow_reg;
    register double frequency_reg;
    register sample_type freq_env_scale_reg = susp->freq_env->scale;
    register sample_block_values_type freq_env_ptr_reg;
    register sample_type bowpress_env_scale_reg = susp->bowpress_env->scale;
    register sample_block_values_type bowpress_env_ptr_reg;
    falloc_sample_block(out, "bowed_freq_ss_fetch");
    out_ptr = out->samples;
    snd_list->block = out;

    while (cnt < max_sample_block_len) { /* outer loop */
	/* first compute how many samples to generate in inner loop: */
	/* don't overflow the output sample block: */
	togo = max_sample_block_len - cnt;

	/* don't run past the bowpress_env input sample block: */
	susp_check_term_samples(bowpress_env, bowpress_env_ptr, bowpress_env_cnt);
	togo = min(togo, susp->bowpress_env_cnt);

	/* don't run past the freq_env input sample block: */
	susp_check_samples(freq_env, freq_env_ptr, freq_env_cnt);
	togo = min(togo, susp->freq_env_cnt);

	/* don't run past terminate time */
	if (susp->terminate_cnt != UNKNOWN &&
	    susp->terminate_cnt <= susp->susp.current + cnt + togo) {
	    togo = susp->terminate_cnt - (susp->susp.current + cnt);
	    if (togo == 0) break;
	}

	n = togo;
	mybow_reg = susp->mybow;
	frequency_reg = susp->frequency;
	freq_env_ptr_reg = susp->freq_env_ptr;
	bowpress_env_ptr_reg = susp->bowpress_env_ptr;
	out_ptr_reg = out_ptr;
	if (n) do { /* the inner sample computation loop */

	    controlChange(mybow_reg, 128, BOW_CONTROL_CHANGE_CONST * (bowpress_env_scale_reg * *bowpress_env_ptr_reg++));
            setFrequency(mybow_reg, frequency_reg + (freq_env_scale_reg * *freq_env_ptr_reg++));
	    *out_ptr_reg++ = (sample_type) tick(mybow_reg);
	} while (--n); /* inner loop */

	susp->mybow = mybow_reg;
	/* using freq_env_ptr_reg is a bad idea on RS/6000: */
	susp->freq_env_ptr += togo;
	/* using bowpress_env_ptr_reg is a bad idea on RS/6000: */
	susp->bowpress_env_ptr += togo;
	out_ptr += togo;
	susp_took(bowpress_env_cnt, togo);
	susp_took(freq_env_cnt, togo);
	cnt += togo;
    } /* outer loop */

    /* test for termination */
    if (togo == 0 && cnt == 0) {
	snd_list_terminate(snd_list);
    } else {
	snd_list->block_len = cnt;
	susp->susp.current += cnt;
    }
} /* bowed_freq_ss_fetch */

void bowed_freq_toss_fetch(susp, snd_list)
  register bowed_freq_susp_type susp;
  snd_list_type snd_list;
{
    long final_count = susp->susp.toss_cnt;
    time_type final_time = susp->susp.t0;
    long n;

    /* fetch samples from bowpress_env up to final_time for this block of zeros */
    while ((round((final_time - susp->bowpress_env->t0) * susp->bowpress_env->sr)) >=
	   susp->bowpress_env->current)
	susp_get_samples(bowpress_env, bowpress_env_ptr, bowpress_env_cnt);
    /* fetch samples from freq_env up to final_time for this block of zeros */
    while ((round((final_time - susp->freq_env->t0) * susp->freq_env->sr)) >=
	   susp->freq_env->current)
	susp_get_samples(freq_env, freq_env_ptr, freq_env_cnt);
    /* convert to normal processing when we hit final_count */
    /* we want each signal positioned at final_time */
    n = round((final_time - susp->bowpress_env->t0) * susp->bowpress_env->sr -
         (susp->bowpress_env->current - susp->bowpress_env_cnt));
    susp->bowpress_env_ptr += n;
    susp_took(bowpress_env_cnt, n);
    n = round((final_time - susp->freq_env->t0) * susp->freq_env->sr -
         (susp->freq_env->current - susp->freq_env_cnt));
    susp->freq_env_ptr += n;
    susp_took(freq_env_cnt, n);
    susp->susp.fetch = susp->susp.keep_fetch;
    (*(susp->susp.fetch))(susp, snd_list);
}

void bowed_freq_mark(bowed_freq_susp_type susp)
{
    sound_xlmark(susp->bowpress_env);
    sound_xlmark(susp->freq_env);
}

void bowed_freq_free(bowed_freq_susp_type susp)
{

	    deleteInstrument(susp->mybow);
    sound_unref(susp->bowpress_env);
    sound_unref(susp->freq_env);
    ffree_generic(susp, sizeof(bowed_freq_susp_node), "bowed_freq_free");
}

void bowed_freq_print_tree(bowed_freq_susp_type susp, int n)
{
    indent(n);
    stdputstr("bowpress_env:");
    sound_print_tree_1(susp->bowpress_env, n);

    indent(n);
    stdputstr("freq_env:");
    sound_print_tree_1(susp->freq_env, n);
}

sound_type snd_make_bowed_freq(double freq, sound_type bowpress_env, sound_type freq_env, rate_type sr)
{
    register bowed_freq_susp_type susp;
    /* sr specified as input parameter */
    time_type t0 = bowpress_env->t0;
    int interp_desc = 0;
    sample_type scale_factor = 1.0F;
    time_type t0_min = t0;
    falloc_generic(susp, bowed_freq_susp_node, "snd_make_bowed_freq");
    susp->mybow = initInstrument(BOWED, round(sr));
    controlChange(susp->mybow, 1, 0.0);;
    susp->temp_ret_value = noteOn(susp->mybow, freq, 1.0);
    susp->frequency = freq;

    /* select a susp fn based on sample rates */
    interp_desc = (interp_desc << 2) + interp_style(bowpress_env, sr);
    interp_desc = (interp_desc << 2) + interp_style(freq_env, sr);
    switch (interp_desc) {
      case INTERP_nn: susp->susp.fetch = bowed_freq_nn_fetch; break;
      case INTERP_ss: susp->susp.fetch = bowed_freq_ss_fetch; break;
      default: snd_badsr(); break;
    }

    susp->terminate_cnt = UNKNOWN;
    /* handle unequal start times, if any */
    if (t0 < bowpress_env->t0) sound_prepend_zeros(bowpress_env, t0);
    if (t0 < freq_env->t0) sound_prepend_zeros(freq_env, t0);
    /* minimum start time over all inputs: */
    t0_min = min(bowpress_env->t0, min(freq_env->t0, t0));
    /* how many samples to toss before t0: */
    susp->susp.toss_cnt = (long) ((t0 - t0_min) * sr + 0.5);
    if (susp->susp.toss_cnt > 0) {
	susp->susp.keep_fetch = susp->susp.fetch;
	susp->susp.fetch = bowed_freq_toss_fetch;
    }

    /* initialize susp state */
    susp->susp.free = bowed_freq_free;
    susp->susp.sr = sr;
    susp->susp.t0 = t0;
    susp->susp.mark = bowed_freq_mark;
    susp->susp.print_tree = bowed_freq_print_tree;
    susp->susp.name = "bowed_freq";
    susp->susp.log_stop_cnt = UNKNOWN;
    susp->susp.current = 0;
    susp->bowpress_env = bowpress_env;
    susp->bowpress_env_cnt = 0;
    susp->freq_env = freq_env;
    susp->freq_env_cnt = 0;
    return sound_create((snd_susp_type)susp, t0, sr, scale_factor);
}

sound_type snd_bowed_freq(double freq, sound_type bowpress_env, sound_type freq_env, rate_type sr)
{
    sound_type bowpress_env_copy = sound_copy(bowpress_env);
    sound_type freq_env_copy = sound_copy(freq_env);
    return snd_make_bowed_freq(freq, bowpress_env_copy, freq_env_copy, sr);
}


text:
id: 587d7b8f367417b2b2512b63
title: Use the filter Method to Extract Data from an Array
challengeType: 1
---

## Description

Another useful array function is Array.prototype.filter(), or simply filter(). The filter method returns a new array which is at most as long as the original array, but usually has fewer items.
Filter doesn't alter the original array, just like map. It takes a callback function that applies the logic inside the callback on each element of the array. If an element returns true based on the criteria in the callback function, then it is included in the new array.

## Instructions

The variable watchList holds an array of objects with information on several movies. Use a combination of filter and map to return a new array of objects with only title and rating keys, but where imdbRating is greater than or equal to 8.0. Note that the rating values are saved as strings in the object and you may want to convert them into numbers to perform mathematical operations on them.

## Tests

```yml
tests:
  - text: The <code>watchList</code> variable should not change.
    testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron", 'The <code>watchList</code> variable should not change.');
  - text: Your code should use the <code>filter</code> method.
    testString: assert(code.match(/\.filter/g), 'Your code should use the <code>filter</code> method.');
  - text: Your code should not use a <code>for</code> loop.
    testString: assert(!code.match(/for\s*?\(.+?\)/g), 'Your code should not use a <code>for</code> loop.');
  - text: '<code>filteredList</code> should equal <code>[{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]</code>.'
    testString: 'assert.deepEqual(filteredList, [{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}], ''<code>filteredList</code> should equal <code>[{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]</code>.'');'

```

## Challenge Seed

```js
// the global variable
var watchList = [
                 {
                   "Title": "Inception",
                   "Year": "2010",
                   "Rated": "PG-13",
                   "Released": "16 Jul 2010",
                   "Runtime": "148 min",
                   "Genre": "Action, Adventure, Crime",
                   "Director": "Christopher Nolan",
                   "Writer": "Christopher Nolan",
                   "Actors": "Leonardo DiCaprio, Joseph Gordon-Levitt, Ellen Page, Tom Hardy",
                   "Plot": "A thief, who steals corporate secrets through use of dream-sharing technology, is given the inverse task of planting an idea into the mind of a CEO.",
                   "Language": "English, Japanese, French",
                   "Country": "USA, UK",
                   "Awards": "Won 4 Oscars. Another 143 wins & 198 nominations.",
                   "Poster": "http://ia.media-imdb.com/images/M/MV5BMjAxMzY3NjcxNF5BMl5BanBnXkFtZTcwNTI5OTM0Mw@@._V1_SX300.jpg",
                   "Metascore": "74",
                   "imdbRating": "8.8",
                   "imdbVotes": "1,446,708",
                   "imdbID": "tt1375666",
                   "Type": "movie",
                   "Response": "True"
                },
                {
                   "Title": "Interstellar",
                   "Year": "2014",
                   "Rated": "PG-13",
                   "Released": "07 Nov 2014",
                   "Runtime": "169 min",
                   "Genre": "Adventure, Drama, Sci-Fi",
                   "Director": "Christopher Nolan",
                   "Writer": "Jonathan Nolan, Christopher Nolan",
                   "Actors": "Ellen Burstyn, Matthew McConaughey, Mackenzie Foy, John Lithgow",
                   "Plot": "A team of explorers travel through a wormhole in space in an attempt to ensure humanity's survival.",
                   "Language": "English",
                   "Country": "USA, UK",
                   "Awards": "Won 1 Oscar. Another 39 wins & 132 nominations.",
                   "Poster": "http://ia.media-imdb.com/images/M/MV5BMjIxNTU4MzY4MF5BMl5BanBnXkFtZTgwMzM4ODI3MjE@._V1_SX300.jpg",
                   "Metascore": "74",
                   "imdbRating": "8.6",
                   "imdbVotes": "910,366",
                   "imdbID": "tt0816692",
                   "Type": "movie",
                   "Response": "True"
                },
                {
                   "Title": "The Dark Knight",
                   "Year": "2008",
                   "Rated": "PG-13",
                   "Released": "18 Jul 2008",
                   "Runtime": "152 min",
                   "Genre": "Action, Adventure, Crime",
                   "Director": "Christopher Nolan",
                   "Writer": "Jonathan Nolan (screenplay), Christopher Nolan (screenplay), Christopher Nolan (story), David S. Goyer (story), Bob Kane (characters)",
                   "Actors": "Christian Bale, Heath Ledger, Aaron Eckhart, Michael Caine",
                   "Plot": "When the menace known as the Joker wreaks havoc and chaos on the people of Gotham, the caped crusader must come to terms with one of the greatest psychological tests of his ability to fight injustice.",
                   "Language": "English, Mandarin",
                   "Country": "USA, UK",
                   "Awards": "Won 2 Oscars. Another 146 wins & 142 nominations.",
                   "Poster": "http://ia.media-imdb.com/images/M/MV5BMTMxNTMwODM0NF5BMl5BanBnXkFtZTcwODAyMTk2Mw@@._V1_SX300.jpg",
                   "Metascore": "82",
                   "imdbRating": "9.0",
                   "imdbVotes": "1,652,832",
                   "imdbID": "tt0468569",
                   "Type": "movie",
                   "Response": "True"
                },
                {
                   "Title": "Batman Begins",
                   "Year": "2005",
                   "Rated": "PG-13",
                   "Released": "15 Jun 2005",
                   "Runtime": "140 min",
                   "Genre": "Action, Adventure",
                   "Director": "Christopher Nolan",
                   "Writer": "Bob Kane (characters), David S. Goyer (story), Christopher Nolan (screenplay), David S. Goyer (screenplay)",
                   "Actors": "Christian Bale, Michael Caine, Liam Neeson, Katie Holmes",
                   "Plot": "After training with his mentor, Batman begins his fight to free crime-ridden Gotham City from the corruption that Scarecrow and the League of Shadows have cast upon it.",
                   "Language": "English, Urdu, Mandarin",
                   "Country": "USA, UK",
                   "Awards": "Nominated for 1 Oscar. Another 15 wins & 66 nominations.",
                   "Poster": "http://ia.media-imdb.com/images/M/MV5BNTM3OTc0MzM2OV5BMl5BanBnXkFtZTYwNzUwMTI3._V1_SX300.jpg",
                   "Metascore": "70",
                   "imdbRating": "8.3",
                   "imdbVotes": "972,584",
                   "imdbID": "tt0372784",
                   "Type": "movie",
                   "Response": "True"
                },
                {
                   "Title": "Avatar",
                   "Year": "2009",
                   "Rated": "PG-13",
                   "Released": "18 Dec 2009",
                   "Runtime": "162 min",
                   "Genre": "Action, Adventure, Fantasy",
                   "Director": "James Cameron",
                   "Writer": "James Cameron",
                   "Actors": "Sam Worthington, Zoe Saldana, Sigourney Weaver, Stephen Lang",
                   "Plot": "A paraplegic marine dispatched to the moon Pandora on a unique mission becomes torn between following his orders and protecting the world he feels is his home.",
                   "Language": "English, Spanish",
                   "Country": "USA, UK",
                   "Awards": "Won 3 Oscars. Another 80 wins & 121 nominations.",
                   "Poster": "http://ia.media-imdb.com/images/M/MV5BMTYwOTEwNjAzMl5BMl5BanBnXkFtZTcwODc5MTUwMw@@._V1_SX300.jpg",
                   "Metascore": "83",
                   "imdbRating": "7.9",
                   "imdbVotes": "876,575",
                   "imdbID": "tt0499549",
                   "Type": "movie",
                   "Response": "True"
                }
];

// Add your code below this line

var filteredList;

// Add your code above this line

console.log(filteredList);
```

## Solution

```js
// solution required
```


text:
class AddCheckupTruckToFiremen < ActiveRecord::Migration
  def change
    add_column(:firemen, :checkup_truck, :date)
  end
end


text:
package signature.compare.model;

import signature.model.IField;

/**
 * {@code IFieldDelta} models the delta between two {@link IField} instances.
 */
public interface IFieldDelta extends IMemberDelta<IField> {
}


text:
<!DOCTYPE HTML>

  <title>Test for basic sanity of the device storage API </title>

<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />

Mozilla Bug 717103


text:
// Regex to capture brackets of @font-face{ } or .some-class
const CLASS_BRACKET_REGEX = /(@|.)+{[^}]*\}/g;
const STYLESHEET_ID = 'co-font';
const _fontManagerMap = new WeakMap<HTMLDocument, FontManager>();

export const appendAdoptedStyleSheet = (doc: HTMLDocument, sheet: CSSStyleSheet) => {
  const anyDoc = doc as any;
  anyDoc.adoptedStyleSheets = [...anyDoc.adoptedStyleSheets, sheet];
};

export const removeAdoptedStyleSheets = (doc: HTMLDocument) => {
  const anyDoc = doc as any;
  anyDoc.adoptedStyleSheets = [];
};

const generateStyleSheetOldstyle = (_id: string, rootNode: HTMLDocument): CSSStyleSheet => {
  const doc = rootNode.ownerDocument || (rootNode as HTMLDocument);
  const parent = (rootNode as HTMLDocument).head || rootNode;
  const styleTag = doc.createElement('style');

  if (parent) parent.prepend(styleTag);
  return styleTag.sheet as CSSStyleSheet;
};

export class FontManager {
  private _fontCache: Set<string> = new Set();
  protected _sheet?: CSSStyleSheet;

  get sheet(): CSSStyleSheet | undefined {
    if (!this._sheet && this._rootNode !== undefined) {
      this._sheet = generateStyleSheetOldstyle(this._sheetID, this._rootNode);
    }
    return this._sheet;
  }

  static instance(doc: HTMLDocument = document): FontManager {
    let fontManager = _fontManagerMap.get(doc);
    if (!fontManager) {
      fontManager = new FontManager(doc, STYLESHEET_ID);
      _fontManagerMap.set(doc, fontManager);
    }
    return fontManager;
  }

  static deleteInstance(rootNode: HTMLDocument) {
    _fontManagerMap.delete(rootNode);
  }

  constructor(protected _rootNode: HTMLDocument | undefined, protected _sheetID: string) {}

  destroy() {
    if (!this._rootNode) return;
    removeAdoptedStyleSheets(this._rootNode);
    delete this._rootNode;
  }

  hasRule(key: string): boolean {
    return this._fontCache.has(key);
  }

  addRule(text: string, key: string) {
    const { sheet } = this;
    if (!sheet) return;
    if (this._fontCache.has(key)) return;
    this._fontCache.add(key);

    const items = text.match(CLASS_BRACKET_REGEX) || [];
    for (const item of items) {
      sheet.insertRule(item, sheet.cssRules.length);
    }
  }

  clearAll() {
    const { sheet } = this;
    if (!sheet) return;
    this._fontCache.clear();
    const list = Object.values(sheet.cssRules);
    for (let i = list.length - 1; i >= 0; i--) {
      sheet.deleteRule(i);
    }
  }
}


text:
#import <Cocoa/Cocoa.h>
#import <UnitKit/UnitKit.h>

// This class doesn't implement the UKTest protocol because it is not
// supposed to get picked up automatically out of a test bundle. Instead
// it is used by UKTestMacros to test out all of the macros.

@interface TestUKDoesNotRaiseException_Positive : NSObject {

}

@end


text:
from tests.test_helper import *

class TestSubscription(unittest.TestCase):
    @raises_with_regexp(KeyError, "'Invalid keys: bad_key'")
    def test_create_raises_exception_with_bad_keys(self):
        Subscription.create({"bad_key": "value"})

    @raises_with_regexp(KeyError, "'Invalid keys: bad_key'")
    def test_update_raises_exception_with_bad_keys(self):
        Subscription.update("id", {"bad_key": "value"})

    @raises(NotFoundError)
    def test_finding_empty_id_raises_not_found_exception(self):
        Subscription.find(" ")

    @raises(NotFoundError)
    def test_finding_None_id_raises_not_found_exception(self):
        Subscription.find(None)


text:
package com.baidubce.services.vcr.model;

import com.baidubce.auth.BceCredentials;
import com.baidubce.model.AbstractBceRequest;

/**
 * Vcr get media check result request.
 */
public class GetMediaRequest extends AbstractBceRequest {
    private String source;

    @Override
    public AbstractBceRequest withRequestCredentials(BceCredentials credentials) {
        this.setRequestCredentials(credentials);
        return this;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("GetMediaRequest{");
        sb.append("source='").append(source).append('\'');
        sb.append('}');
        return sb.toString();
    }
}


text:
/*! @license Firebase v4.3.1
Build: rev-b4fe95f
Terms: https://firebase.google.com/terms/ */

'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.MAX_NODE = exports.MaxNode = exports.ChildrenNode = undefined;

var _assert = require('../../../utils/assert');

var _util = require('../util/util');

var _SortedMap = require('../util/SortedMap');

var _Node = require('./Node');

var _snap = require('./snap');

var _PriorityIndex = require('./indexes/PriorityIndex');

var _KeyIndex = require('./indexes/KeyIndex');

var _IndexMap = require('./IndexMap');

var _LeafNode = require('./LeafNode');

var _comparators = require('./comparators');

/**
* Copyright 2017 Google Inc.
*
* 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.
*/
var __extends = undefined && undefined.__extends || function () {
    var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
        d.__proto__ = b;
    } || function (d, b) {
        for (var p in b) {
            if (b.hasOwnProperty(p)) d[p] = b[p];
        }
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() {
            this.constructor = d;
        }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
}();

// TODO: For memory savings, don't store priorityNode_ if it's empty.
var EMPTY_NODE;
/**
 * ChildrenNode is a class for storing internal nodes in a DataSnapshot
 * (i.e. nodes with children).  It implements Node and stores the
 * list of children in the children property, sorted by child name.
 *
 * @constructor
 * @implements {Node}
 */
var ChildrenNode = function () {
    /**
     *
     * @param {!SortedMap.<string, !Node>} children_ List of children
     * of this node..
     * @param {?Node} priorityNode_ The priority of this node (as a snapshot node).
     * @param {!IndexMap} indexMap_
     */
    function ChildrenNode(children_, priorityNode_, indexMap_) {
        this.children_ = children_;
        this.priorityNode_ = priorityNode_;
        this.indexMap_ = indexMap_;
        this.lazyHash_ = null;
        /**
         * Note: The only reason we allow null priority is for EMPTY_NODE, since we can't use
         * EMPTY_NODE as the priority of EMPTY_NODE.  We might want to consider making EMPTY_NODE its own
         * class instead of an empty ChildrenNode.
         */
        if (this.priorityNode_) {
            (0, _snap.validatePriorityNode)(this.priorityNode_);
        }
        if (this.children_.isEmpty()) {
            (0, _assert.assert)(!this.priorityNode_ || this.priorityNode_.isEmpty(), 'An empty node cannot have a priority');
        }
    }
    Object.defineProperty(ChildrenNode, "EMPTY_NODE", {
        get: function get() {
            return EMPTY_NODE || (EMPTY_NODE = new ChildrenNode(new _SortedMap.SortedMap(_comparators.NAME_COMPARATOR), null, _IndexMap.IndexMap.Default));
        },
        enumerable: true,
        configurable: true
    });
    /** @inheritDoc */
    ChildrenNode.prototype.isLeafNode = function () {
        return false;
    };
    /** @inheritDoc */
    ChildrenNode.prototype.getPriority = function () {
        return this.priorityNode_ || EMPTY_NODE;
    };
    /** @inheritDoc */
    ChildrenNode.prototype.updatePriority = function (newPriorityNode) {
        if (this.children_.isEmpty()) {
            // Don't allow priorities on empty nodes
            return this;
        } else {
            return new ChildrenNode(this.children_, newPriorityNode, this.indexMap_);
        }
    };
    /** @inheritDoc */
    ChildrenNode.prototype.getImmediateChild = function (childName) {
        // Hack to treat priority as a regular child
        if (childName === '.priority') {
            return this.getPriority();
        } else {
            var child = this.children_.get(childName);
            return child === null ? EMPTY_NODE : child;
        }
    };
    /** @inheritDoc */
    ChildrenNode.prototype.getChild = function (path) {
        var front = path.getFront();
        if (front === null) return this;
        return this.getImmediateChild(front).getChild(path.popFront());
    };
    /** @inheritDoc */
    ChildrenNode.prototype.hasChild = function (childName) {
        return this.children_.get(childName) !== null;
    };
    /** @inheritDoc */
    ChildrenNode.prototype.updateImmediateChild = function (childName, newChildNode) {
        (0, _assert.assert)(newChildNode, 'We should always be passing snapshot nodes');
        if (childName === '.priority') {
            return this.updatePriority(newChildNode);
        } else {
            var namedNode = new _Node.NamedNode(childName, newChildNode);
            var newChildren = void 0,
                newIndexMap = void 0,
                newPriority = void 0;
            if (newChildNode.isEmpty()) {
                newChildren = this.children_.remove(childName);
                newIndexMap = this.indexMap_.removeFromIndexes(namedNode, this.children_);
            } else {
                newChildren = this.children_.insert(childName, newChildNode);
                newIndexMap = this.indexMap_.addToIndexes(namedNode, this.children_);
            }
            newPriority = newChildren.isEmpty() ? EMPTY_NODE : this.priorityNode_;
            return new ChildrenNode(newChildren, newPriority, newIndexMap);
        }
    };
    /** @inheritDoc */
    ChildrenNode.prototype.updateChild = function (path, newChildNode) {
        var front = path.getFront();
        if (front === null) {
            return newChildNode;
        } else {
            (0, _assert.assert)(path.getFront() !== '.priority' || path.getLength() === 1, '.priority must be the last token in a path');
            var newImmediateChild = this.getImmediateChild(front).updateChild(path.popFront(), newChildNode);
            return this.updateImmediateChild(front, newImmediateChild);
        }
    };
    /** @inheritDoc */
    ChildrenNode.prototype.isEmpty = function () {
        return this.children_.isEmpty();
    };
    /** @inheritDoc */
    ChildrenNode.prototype.numChildren = function () {
        return this.children_.count();
    };
    /** @inheritDoc */
    ChildrenNode.prototype.val = function (exportFormat) {
        if (this.isEmpty()) return null;
        var obj = {};
        var numKeys = 0,
            maxKey = 0,
            allIntegerKeys = true;
        this.forEachChild(_PriorityIndex.PRIORITY_INDEX, function (key, childNode) {
            obj[key] = childNode.val(exportFormat);
            numKeys++;
            if (allIntegerKeys && ChildrenNode.INTEGER_REGEXP_.test(key)) {
                maxKey = Math.max(maxKey, Number(key));
            } else {
                allIntegerKeys = false;
            }
        });
        if (!exportFormat && allIntegerKeys && maxKey < 2 * numKeys) {
            // convert to array.
            var array = [];
            for (var key in obj) {
                array[key] = obj[key];
            }return array;
        } else {
            if (exportFormat && !this.getPriority().isEmpty()) {
                obj['.priority'] = this.getPriority().val();
            }
            return obj;
        }
    };
    /** @inheritDoc */
    ChildrenNode.prototype.hash = function () {
        if (this.lazyHash_ === null) {
            var toHash_1 = '';
            if (!this.getPriority().isEmpty()) toHash_1 += 'priority:' + (0, _snap.priorityHashText)(this.getPriority().val()) + ':';
            this.forEachChild(_PriorityIndex.PRIORITY_INDEX, function (key, childNode) {
                var childHash = childNode.hash();
                if (childHash !== '') toHash_1 += ':' + key + ':' + childHash;
            });
            this.lazyHash_ = toHash_1 === '' ? '' : (0, _util.sha1)(toHash_1);
        }
        return this.lazyHash_;
    };
    /** @inheritDoc */
    ChildrenNode.prototype.getPredecessorChildName = function (childName, childNode, index) {
        var idx = this.resolveIndex_(index);
        if (idx) {
            var predecessor = idx.getPredecessorKey(new _Node.NamedNode(childName, childNode));
            return predecessor ? predecessor.name : null;
        } else {
            return this.children_.getPredecessorKey(childName);
        }
    };
    /**
     * @param {!Index} indexDefinition
     * @return {?string}
     */
    ChildrenNode.prototype.getFirstChildName = function (indexDefinition) {
        var idx = this.resolveIndex_(indexDefinition);
        if (idx) {
            var minKey = idx.minKey();
            return minKey && minKey.name;
        } else {
            return this.children_.minKey();
        }
    };
    /**
     * @param {!Index} indexDefinition
     * @return {?NamedNode}
     */
    ChildrenNode.prototype.getFirstChild = function (indexDefinition) {
        var minKey = this.getFirstChildName(indexDefinition);
        if (minKey) {
            return new _Node.NamedNode(minKey, this.children_.get(minKey));
        } else {
            return null;
        }
    };
    /**
     * Given an index, return the key name of the largest value we have, according to that index
     * @param {!Index} indexDefinition
     * @return {?string}
     */
    ChildrenNode.prototype.getLastChildName = function (indexDefinition) {
        var idx = this.resolveIndex_(indexDefinition);
        if (idx) {
            var maxKey = idx.maxKey();
            return maxKey && maxKey.name;
        } else {
            return this.children_.maxKey();
        }
    };
    /**
     * @param {!Index} indexDefinition
     * @return {?NamedNode}
     */
    ChildrenNode.prototype.getLastChild = function (indexDefinition) {
        var maxKey = this.getLastChildName(indexDefinition);
        if (maxKey) {
            return new _Node.NamedNode(maxKey, this.children_.get(maxKey));
        } else {
            return null;
        }
    };
    /**
     * @inheritDoc
     */
    ChildrenNode.prototype.forEachChild = function (index, action) {
        var idx = this.resolveIndex_(index);
        if (idx) {
            return idx.inorderTraversal(function (wrappedNode) {
                return action(wrappedNode.name, wrappedNode.node);
            });
        } else {
            return this.children_.inorderTraversal(action);
        }
    };
    /**
     * @param {!Index} indexDefinition
     * @return {SortedMapIterator}
     */
    ChildrenNode.prototype.getIterator = function (indexDefinition) {
        return this.getIteratorFrom(indexDefinition.minPost(), indexDefinition);
    };
    /**
     *
     * @param {!NamedNode} startPost
     * @param {!Index} indexDefinition
     * @return {!SortedMapIterator}
     */
    ChildrenNode.prototype.getIteratorFrom = function (startPost, indexDefinition) {
        var idx = this.resolveIndex_(indexDefinition);
        if (idx) {
            return idx.getIteratorFrom(startPost, function (key) {
                return key;
            });
        } else {
            var iterator = this.children_.getIteratorFrom(startPost.name, _Node.NamedNode.Wrap);
            var next = iterator.peek();
            while (next != null && indexDefinition.compare(next, startPost) < 0) {
                iterator.getNext();
                next = iterator.peek();
            }
            return iterator;
        }
    };
    /**
     * @param {!Index} indexDefinition
     * @return {!SortedMapIterator}
     */
    ChildrenNode.prototype.getReverseIterator = function (indexDefinition) {
        return this.getReverseIteratorFrom(indexDefinition.maxPost(), indexDefinition);
    };
    /**
     * @param {!NamedNode} endPost
     * @param {!Index} indexDefinition
     * @return {!SortedMapIterator}
     */
    ChildrenNode.prototype.getReverseIteratorFrom = function (endPost, indexDefinition) {
        var idx = this.resolveIndex_(indexDefinition);
        if (idx) {
            return idx.getReverseIteratorFrom(endPost, function (key) {
                return key;
            });
        } else {
            var iterator = this.children_.getReverseIteratorFrom(endPost.name, _Node.NamedNode.Wrap);
            var next = iterator.peek();
            while (next != null && indexDefinition.compare(next, endPost) > 0) {
                iterator.getNext();
                next = iterator.peek();
            }
            return iterator;
        }
    };
    /**
     * @inheritDoc
     */
    ChildrenNode.prototype.compareTo = function (other) {
        if (this.isEmpty()) {
            if (other.isEmpty()) {
                return 0;
            } else {
                return -1;
            }
        } else if (other.isLeafNode() || other.isEmpty()) {
            return 1;
        } else if (other === MAX_NODE) {
            return -1;
        } else {
            // Must be another node with children.
            return 0;
        }
    };
    /**
     * @inheritDoc
     */
    ChildrenNode.prototype.withIndex = function (indexDefinition) {
        if (indexDefinition === _KeyIndex.KEY_INDEX || this.indexMap_.hasIndex(indexDefinition)) {
            return this;
        } else {
            var newIndexMap = this.indexMap_.addIndex(indexDefinition, this.children_);
            return new ChildrenNode(this.children_, this.priorityNode_, newIndexMap);
        }
    };
    /**
     * @inheritDoc
     */
    ChildrenNode.prototype.isIndexed = function (index) {
        return index === _KeyIndex.KEY_INDEX || this.indexMap_.hasIndex(index);
    };
    /**
     * @inheritDoc
     */
    ChildrenNode.prototype.equals = function (other) {
        if (other === this) {
            return true;
        } else if (other.isLeafNode()) {
            return false;
        } else {
            var otherChildrenNode = other;
            if (!this.getPriority().equals(otherChildrenNode.getPriority())) {
                return false;
            } else if (this.children_.count() === otherChildrenNode.children_.count()) {
                var thisIter = this.getIterator(_PriorityIndex.PRIORITY_INDEX);
                var otherIter = otherChildrenNode.getIterator(_PriorityIndex.PRIORITY_INDEX);
                var thisCurrent = thisIter.getNext();
                var otherCurrent = otherIter.getNext();
                while (thisCurrent && otherCurrent) {
                    if (thisCurrent.name !== otherCurrent.name || !thisCurrent.node.equals(otherCurrent.node)) {
                        return false;
                    }
                    thisCurrent = thisIter.getNext();
                    otherCurrent = otherIter.getNext();
                }
                return thisCurrent === null && otherCurrent === null;
            } else {
                return false;
            }
        }
    };
    /**
     * Returns a SortedMap ordered by index, or null if the default (by-key) ordering can be used
     * instead.
     *
     * @private
     * @param {!Index} indexDefinition
     * @return {?SortedMap.<NamedNode, Node>}
     */
    ChildrenNode.prototype.resolveIndex_ = function (indexDefinition) {
        if (indexDefinition === _KeyIndex.KEY_INDEX) {
            return null;
        } else {
            return this.indexMap_.get(indexDefinition.toString());
        }
    };
    /**
     * @private
     * @type {RegExp}
     */
    ChildrenNode.INTEGER_REGEXP_ = /^(0|[1-9]\d*)$/;
    return ChildrenNode;
}();
exports.ChildrenNode = ChildrenNode;
/**
 * @constructor
 * @extends {ChildrenNode}
 * @private
 */

var MaxNode = function (_super) {
    __extends(MaxNode, _super);
    function MaxNode() {
        return _super.call(this, new _SortedMap.SortedMap(_comparators.NAME_COMPARATOR), ChildrenNode.EMPTY_NODE, _IndexMap.IndexMap.Default) || this;
    }
    MaxNode.prototype.compareTo = function (other) {
        if (other === this) {
            return 0;
        } else {
            return 1;
        }
    };
    MaxNode.prototype.equals = function (other) {
        // Not that we every compare it, but MAX_NODE is only ever equal to itself
        return other === this;
    };
    MaxNode.prototype.getPriority = function () {
        return this;
    };
    MaxNode.prototype.getImmediateChild = function (childName) {
        return ChildrenNode.EMPTY_NODE;
    };
    MaxNode.prototype.isEmpty = function () {
        return false;
    };
    return MaxNode;
}(ChildrenNode);
exports.MaxNode = MaxNode;
/**
 * Marker that will sort higher than any other snapshot.
 * @type {!MAX_NODE}
 * @const
 */

var MAX_NODE = exports.MAX_NODE = new MaxNode();
Object.defineProperties(_Node.NamedNode, {
    MIN: {
        value: new _Node.NamedNode(_util.MIN_NAME, ChildrenNode.EMPTY_NODE)
    },
    MAX: {
        value: new _Node.NamedNode(_util.MAX_NAME, MAX_NODE)
    }
});
/**
 * Reference Extensions
 */
_KeyIndex.KeyIndex.__EMPTY_NODE = ChildrenNode.EMPTY_NODE;
_LeafNode.LeafNode.__childrenNodeConstructor = ChildrenNode;
(0, _snap.setMaxNode)(MAX_NODE);
(0, _PriorityIndex.setMaxNode)(MAX_NODE);
//# sourceMappingURL=ChildrenNode.js.map


text:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->

    <meta name="description" content="@yield('description')">
    <meta name="author" content="@yield('author')">

    <title>@yield('title') | Bang</title>

    <!-- Bootstrap core CSS -->
    <link href="{{ asset('/assets/css/app.css') }}" rel="stylesheet">

</head>

<body>

@include('layouts.partials.header')
@include('layouts.partials.errors')

<div class="container">
@section('content')
    This is the default content
@show
</div><!-- /.container -->

@include('layouts.partials.footer')

<!-- JavaScript -->
<script src="{{ asset('/assets/js/manifest.js') }}"></script>
<script src="{{ asset('/assets/js/vendor.js') }}"></script>
<script src="{{ asset('/assets/js/app.js') }}"></script>
</body>
</html>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
in Crous & Braun, CBS Diversity Ser. (Utrecht) 1: 276 (2003)

#### Original name
Selenosporium minutissimum Desm.

### Remarks
null


text:
using namespace std;

namespace openworld {
  class DummyBalanceSnowModel : public SnowModel {
  protected:
    MatrixGeographicMap<double> volumes;

  public:
  DummyBalanceSnowModel(GeographicMap<double>& initial, DividedRange time)
    : SnowModel(time), volumes(initial) {
    }

    virtual SnowModel* clone() {
      return new DummyBalanceSnowModel(volumes, time);
    }

    // returns the snowcover
    virtual GeographicMap<double>& operator[](Measure tt) {
      return 100 * (volumes > 0);
    }

    virtual void inform(GeographicMap<double>& newMeltVolume, GeographicMap<double>& newSnowVolume) {
      volumes += newSnowVolume - newMeltVolume;
    }

    GeographicMap<double>& getVolumes() {
      return volumes;
    }
  };
}

#endif


text:
The file [we2e-test.js](we2e-test.js) contains e2e tests for endpoint addition and deletion.
For this purpose the [protractor](http://angular.github.io/protractor) framework is used. Before running the tests,
make sure that you have executed the command
```
$ ./node_modules/protractor/bin/webdriver-manager update
```
under the project's root directory. The webdriver-manager is a helper tool to easily get an instance
of a Selenium Server running. To run the tests, first, start the application and then execute the _protractor_ grunt
task under the project's root directory

```
$ grunt protractor
```


text:
<!DOCTYPE html>

	<meta charset="UTF-8">
	<title>Charts - VM UI Framework</title>
	<link rel="icon" type="image/x-icon" href="../../favicon.ico" />
	<link rel="stylesheet" type="text/css" href="../../../templates/sketch/css/import.css" />
	<link rel="stylesheet" type="text/css" href="../../css/sketch/docs.css" />

Examples

Layout

Core

Icons

Extras

Plugins

Templates

Resources

JavaScript Plugins

Current Plugin

Charts

Code

Overview

Usage

Options

Events

Specific Chart Documentation and Demos

Area Charts

Bar Charts

Column Charts

Line Charts

Pie Charts

Scatter Charts

Overview

Web applications often need some sort of charts or graphs, but there are few viable options that
					aren't commercial, poorly-documented, bound up in a restrictive open source license, or Flash-based.
					The charts in VM UI Framework are SVG-based and responsive, meaning that you can use them easily
					for all modern browsers and devices. There are alse options for making each chart interactive and
					animated.

Return to top

Usage

There are five basic chart types, each of which has the ability to be customized. The chart type is
					assigned via class to a <div> element. Additional chart types like histograms
					and pyramid charts can be created by modifiying the basic chart types. Inline charts (sometimes
					called sparklines) are also possible by prefixing the word inline to the chart class.

Chart Types

									Chart Types

									Type
									Class
									Inline Class

									Area chart
									areaChart
									inlineAreaChart

									Bar chart
									barChart
									inlineBarChart

									Line chart
									lineChart
									inlineLineChart

									Pie chart
									pieChart
									inlinePieChart

									Scatter chart
									scatterChart
									inlineScatterChart

Data is passed into a chart via the data-chartData attribute. The value for
							data-chartData should be an array of objects, formatted like the example
							below:

Chart Data Example

<div class="areaChart" data-chartData="[
{
	x:[0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100],
	y:[0,1,6,3,17,12,24,38,15,87,75,45,23,12,73,17,45,87,99,34,20]
},
{
	x:[0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100],
	y:[23,15,65,33,37,32,34,36,25,47,75,40,63,22,43,10,46,68,69,68,60]
}
]"></div>

Not all chart types will require both x and y values for each series. Some charts
					will support empty data sets and pie charts will accept only one series of data. See the
					documentation for each specific chart for more information.

Each chart also supports numerous options through the data-chartOptions attribute,
					which accepts a JSON-formatted string of options, which are detailed in the options section. An
					example of the data-chartOptions attribute formatting is below:

Chart Options Example

<div class="areaChart" data-chartData="[
	{
		x:[0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100],
		y:[0,1,6,3,17,12,24,38,15,87,75,45,23,12,73,17,45,87,99,34,20]
	},
	{
		x:[0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100],
		y:[23,15,65,33,37,32,34,36,25,47,75,40,63,22,43,10,46,68,69,68,60]
	}
]"

data-chartOptions="{
	showAxisLabels: true,
	showAxisLines: true,
	showTicksY: true,
	showTicksX: true,
	showIntervalLabels: true,
	showTitle: true,
	title: 'Axis & Labels'
}"></div>

Current Chart Limitations

Charts are very flexible and dynamic, but they have some limitations. Future versions may or may not
	 				fix these issues.

No animation in Internet Explorer or Safari. Charts will animate in other browsers, but remain static in
	 					current versions Internet Explorer and Safari.

Dates can only be on the x-axis.

Updating the graph requires refreshing the canvas. The chart will be erased and redrawn rather
	 					than manipulated directly. See the events section for more detail on how
	 					to update a chart.

Missing values are not supported. Each series must be continuous, without gaps.

When To Use Each Chart Type

Chart Use Cases

	 						Chart Use Cases

	 						Chart Type
	 						Use Cases

	 						Area Chart
	 						Track one or more sets of data over time or to compare multiple
	 							sets of data. Area charts are similar in purpose to line charts, but provide more
	 							visual emphasis.

	 						Bar Chart
	 						Compare many items in multiple categories to each other.

	 						Column Chart
	 						Compare a few items to each other. Track a single or a minimal
	 							number of categories over time.

	 						Histogram (bar)
	 						Compare many items in a single category to each other.

	 						Histogram (column)
	 						Track a single variable over time. Chart the distribution of
	 							a single variable.

	 						Inline Charts (any)
	 						Only use when the general scope of information is needed at a
	 							glance. If there is a need for specific data points, use a larger chart.

	 						Line Chart
	 						Track one or more sets of data over time or to compare multiple
	 							sets of data.

	 						Pie Chart
	 						Show the relationship of individual parts to the whole for a
	 							single series of data.

	 						Pyramid Chart
	 						Compare two similar sets of data that differ in only one
	 							aspect.

	 						Scatter Chart
	 						Show the relationship between or plot the distribution of two
	 							variables.

Return to top

Options

Not every option will apply to every chart type. See the documentation for each specific chart for
	 				relevant options for that particular chart. No options are required for the most basic chart
	 				types.

Chart Options

	 						Chart Options

	 						Option
	 						Description
	 						Default Value
	 						Values

	 						animate
	 						Animates the chart.
	 						false
	 						true, false

	 						animationDuration
	 						The duration of the chart animation in seconds.
	 						1
	 						Any positive number

	 						axisColor
	 						The hex color of the axis lines.
	 						#333
	 						Any hex color code as a string

	 						aspectRatio
	 						The aspect ratio of the entire chart area, including labels
	 							and keys.
	 						[16, 9]
	 						An array of 2 positive integers [x, y]

	 						colors
	 						The hex colors for each series of chart data.
	 						['#058DC7', '#A006C7', '#C7062D', '#06C740',
	 							'#C7A006', '#EEE', '#CCC', '#999', '#666', '#333', '#000']
	 						An array of hex codes [color1, color2, ...]

	 						dataLabels
	 						Labels for each series of data, will also show in the key.
	 							If no labels are provided, labels will be 'Series 1', 'Series 2', etc.
	 						[]
	 						An array of strings equal to the number of series ['Label 1',
	 							'Label 2', ...]

	 						dateEnd
	 						Sets the end date for a time-based chart.
	 							xAxisIsDate must be enabled.
	 						null
	 						'now' or any date string

	 						dateFormat
	 						Formats the date by replacing placeholders in a string.
	 							xAxisIsDate must be enabled.
	 						'%b %d'
	 						A string of any combination of options from the
	 							MooTools Date Object

	 						dateIntervalUnit
	 						Sets the inverval unit for a date.
	 							xAxisIsDate must be enabled.
	 						'day'
	 						'year', 'month', 'week',
	 							'day', 'hour', 'minute', 'second',
	 							'ms'

	 						dateIntervalValue
	 						Sets the interval value for a date.
	 							xAxisIsDate must be enabled.
	 						1
	 						Any positive integer

	 						dateStart
	 						Sets the start date for a time-based chart.
	 							xAxisIsDate must be enabled.
	 						null
	 						'now' or any date string

	 						decimalPrecisionX
	 						The number of decimal places shown on x-axis interval labels
	 							or pie tips; does not affect placement or other tip types.
	 						0
	 						0 or any positive integer

	 						decimalPrecisionY
	 						The number of decimal places shown on y-axis interval labels;
	 							does not affect placement or any tips.
	 						0
	 						0 or any positive integer

	 						gridColor
	 						The hex color of the grid lines.
	 						'#DDD'
	 						Any hex color string

	 						histogram
	 						Removes the gap between columns or bars to create a histogram.
	 						false
	 						true, false

	 						keyPosition
	 						The position of the key. The showKey option must
	 							also be enabled.
	 						'bottom'
	 						'top', 'bottom', 'left',
	 							'right'

	 						keyWidthPercentage
	 						The width percentage of the key in relation to the entire
	 							chart area, applicable only for left and right key positions.
	 						12
	 						Any positive integer

	 						maxX
	 						The maximum value of the x-axis.
	 						null
	 						Any number

	 						maxY
	 						The maximum value of the y-axis.
	 						null
	 						Any number

	 						minX
	 						The minimum value of the x-axis.
	 						0
	 						Any number

	 						minY
	 						The minimum value of the y-axis.
	 						0
	 						Any number

	 						pyramid
	 						Turns a bar chart with exactly 2 data series, one with all
	 							positive values and the other with all negative values, into a pyramid chart.
	 						false
	 						true, false

	 						showAreaLines
	 						Toggles a line chart overlay on an area chart.
	 						false
	 						true, false

	 						showAxisLabels
	 						Toggles both the x and y axis labels.
	 						false
	 						true, false

	 						showAxisLines
	 						Toggles both the x and y axis lines.
	 						false
	 						true, false

	 						showGridX
	 						Toggles the x-axis grid lines.
	 						false
	 						true, false

	 						showGridY
	 						Toggles the y-axis grid lines.
	 						false
	 						true, false

	 						showIntervalLabels
	 						Toggles interval labels on both axises.
	 						false
	 						true, false

	 						showIntervalLabelsX
	 						Toggles interval labels on the x-axis.
	 						false
	 						true, false

	 						showIntervalLabelsY
	 						Toggles interval labels on the y-axis.
	 						false
	 						true, false

	 						showKey
	 						Toggles the chart key.
	 						false
	 						true, false

	 						showLineFill
	 						Toggles an area chart overlay for line charts.
	 						false
	 						true, false

	 						showPoints
	 						Toggles individual data points for area and line charts.
	 						false
	 						true, false

	 						showTicksX
	 						Toggles tick marks along the x-axis.
	 						false
	 						true, false

	 						showTicksY
	 						Toggles tick marks along the y-axis.
	 						false
	 						true, false

	 						showTips
	 						Toggles tooltips for all charts. Line charts and area charts
	 							must have showPoints enabled for tips to show.
	 						false
	 						true, false

	 						showTitle
	 						Toggles the chart title.
	 						false
	 						true, false

	 						textColor
	 						The color of all text in the chart.
	 						"#000"
	 						Any hex color string

	 						title
	 						The title of the chart.
	 						"Untitled Chart"
	 						Any string

	 						tickColor
	 						The color of all tick marks.
	 						"#333"
	 						Any hex color string

	 						tipText
	 						An array of HTML text strings to customize the tip text, one
	 							string for each series. Placeholders in the string (surrounded by curly braces {}) can
	 							be replaced by values or labels from the chart. Placeholders options include: {x}, {y},
	 							{xAxis}, {yAxis}, {piePercent} and {label}.
	 						[]
	 						An array of HTML strings with placeholders, one string for each
	 							series

	 						xAxisLabel
	 						The label for the x-axis.
	 						"x-axis"
	 						Any string

	 						xInterval
	 						The interval for the x-axis.
	 						25
	 						Any positive number

	 						xAxisIsDate
	 						Toggles the date options for a chart. Any coordinate values
	 							for the x-axis entered in the data-chartData attribute will be
	 							ignored.
	 						false
	 						true, false

	 						xLabels
	 						An array of labels for the x-axis matching the number of
	 							intervals. If no labels are entered, the chart will default to using numbers. To
	 							skip labels for an interval, use null as a placeholder in the array.
	 						[]
	 						An array of any combination of numbers, strings, or nulls matching
	 							the number of intervals

	 						yAxisLabel
	 						The label for the y-axis.
	 						"y-axis"
	 						Any string

	 						yInterval
	 						The interval for the y-axis.
	 						25
	 						Any positive number

	 						yLabelWidthPercentage
	 						The width percentage (in relation to the entire chart area)
	 							of y interval labels, if they are enabled.
	 						5
	 						Any positive number

	 						yLabels
	 						An array of labels for the y-axis matching the number of
	 							intervals. If no labels are entered, the chart will default to using numbers. To
	 							skip labels for an interval, use null as a placeholder in the array.
	 						[]
	 						An array of any combination of numbers, strings, or nulls matching
	 							the number of intervals

Return to top

Events

Each chart type has an updateChart event, which allows the chart to be updated
	 				dynamically. The event is bound to the chart container element and can be fired using MooTools'
	 				fireEvent
	 				method.

New data can be passed directly to the chart via fireEvent. If no new data is passed
	 				through	fireEvent, then the plugin will pull the data and options from the data
	 				attributes.

Note When the updateChart event is fired, the plugin
	 				will rerender the chart completely.

Examples of how to use the updateChart event can be found in the Dynamic Data examples
	 				on the individual chart documentation.

Return to top

Want to continue the tour?

See Area Charts In Action

Back to Plugin Autoloading

Quick Links:

Website

GitHub

Report an issue

Return to top

VM UI Framework is created, owned, maintained by
					Virtuosi	Media, Inc. © 2012-2013.


text:
package com.techempower.ee7.jpa;

import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceUnit;
import javax.persistence.SynchronizationType;

public class PersistenceResources {

  @PersistenceUnit
  private EntityManagerFactory entityManagerFactory;

  @Produces
  @RequestScoped
  public EntityManager entityManager() {
    return entityManagerFactory.createEntityManager(SynchronizationType.UNSYNCHRONIZED);
  }

  protected void closeEntityManager(@Disposes EntityManager entityManager) {
    if (entityManager.isOpen()) {
      entityManager.close();
    }
  }
}


text:
FROM alpine:3.4

RUN \
	echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories \
	&& apk --no-cache add yarn \
	&& mkdir -p /usr/src/app

WORKDIR /usr/src/app

ENTRYPOINT ["yarn"]

CMD ["--version"]


text:
import { Connection } from 'typeorm';
import { Address } from 'cmpd-common-api';

const faker = require('faker');

const createAddress = i => {
  let address: any = {};

  address.householdId = i + 1;
  address.type = 'home';
  address.street = faker.address.streetAddress('###');
  address.street2 = i % 7 === 0 ? faker.address.secondaryAddress() : '';
  address.city = i % 8 === 0 ? faker.address.city() : 'Charlotte';
  address.state = i % 8 === 0 ? faker.address.stateAbbr() : 'NC';
  address.zip = faker.address.zipCode();

  return address;
};

export default async (connection: Connection) => {
  for (let i = 0; i < 25; i++) {
    const address = Address.fromJSON(createAddress(i));

    await address.save();
  }
};


text:
@interface FTSocketDataSerializer : NSObject

#pragma mark - Initialization

- (instancetype)initWithSocketData:(FTSocketData *)data;
- (instancetype)initWithSocketRawData:(NSString *)rawData;

#pragma mark - Serialization

- (NSString *)serialize;
- (FTSocketData *)deserialize;

@end


text:
package org.apache.axis2.webapp;

import org.apache.axis2.Constants;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.transport.http.AxisServlet;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 *
 */
public class AxisAdminServlet extends AxisServlet {
    private static final long serialVersionUID = -6740625806509755370L;

    protected transient AdminAgent agent;

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse res)
            throws ServletException, IOException {
        doGet(req, res);
    }

    @Override
    protected void doGet(HttpServletRequest req,
                         HttpServletResponse resp) throws ServletException, IOException {
        try {
            req.getSession().setAttribute(Constants.SERVICE_PATH, configContext.getServicePath());
            agent.handle(req, resp);
        } catch (Exception e) {
            throw new ServletException(e);
        }
    }

    @Override
    public void init(ServletConfig config) throws ServletException {
        super.init(config);
        ServletContext servletContext = config.getServletContext();
        this.configContext =
                (ConfigurationContext) servletContext.getAttribute(CONFIGURATION_CONTEXT);
        servletContext.setAttribute(this.getClass().getName(), this);
        agent = new AdminAgent(configContext);
        this.servletConfig = config;
    }

    @Override
    public void init() throws ServletException {
        if (this.servletConfig != null) {
            init(this.servletConfig);
        }
    }
}


text:
module Musicality

# Abstraction of a musical pitch. Contains values for octave and semitone.
#
# Octaves represent the largest means of differing two pitches. Each
# octave added will double the ratio. At zero octaves, the ratio is
# 1.0. At one octave, the ratio will be 2.0. Each semitone is an increment
# of less-than-power-of-two.
#
# Semitones are the primary steps between octaves. The number of
# semitones per octave is 12.

# @author James Tunnell
#
# @!attribute [r] octave
#   @return [Integer] The pitch octave.
# @!attribute [r] semitone
#   @return [Integer] The pitch semitone.
#
class Pitch
  include Comparable
  include Packable

  attr_reader :octave, :semitone, :cent, :total_cents

  #The default number of semitones per octave is 12, corresponding to
  # the twelve-tone equal temperment tuning system.
  SEMITONES_PER_OCTAVE = PitchClass::MOD
  CENTS_PER_SEMITONE = 100
  CENTS_PER_OCTAVE = SEMITONES_PER_OCTAVE * CENTS_PER_SEMITONE

  # The base ferquency is C0
  BASE_FREQ = 16.351597831287414

  def initialize octave:0, semitone:0, cent: 0
    raise NonIntegerError, "octave #{octave} is not an integer" unless octave.is_a?(Integer)
    raise NonIntegerError, "semitone #{semitone} is not an integer" unless semitone.is_a?(Integer)
    raise NonIntegerError, "cent #{cent} is not an integer" unless cent.is_a?(Integer)

    @octave = octave
    @semitone = semitone
    @cent = cent
    @total_cents = (@octave*SEMITONES_PER_OCTAVE + @semitone)*CENTS_PER_SEMITONE + @cent
    balance!
  end

  # Return the pitch's frequency, which is determined by multiplying the base
  # frequency and the pitch ratio. Base frequency defaults to DEFAULT_BASE_FREQ,
  # but can be set during initialization to something else by specifying the
  # :base_freq key.
  def freq
    return self.ratio() * BASE_FREQ
  end

  # Calculate the pitch ratio. Raises 2 to the power of the total cent
  # count divided by cents-per-octave.
  # @return [Float] ratio
  def ratio
    2.0**(@total_cents.to_f / CENTS_PER_OCTAVE)
  end

  # Override default hash method.
  def hash
    return @total_cents
  end

  # Compare pitch equality using total semitone
  def ==(other)
    return (self.class == other.class &&
      @total_cents == other.total_cents)
  end

  def eql?(other)
    self == other
  end

  # Compare pitches. A higher ratio or total semitone is considered larger.
  # @param [Pitch] other The pitch object to compare.
  def <=> (other)
    @total_cents <=> other.total_cents
  end

  # rounds to the nearest semitone
  def round
    if @cent == 0
      self.clone
    else
      Pitch.new(semitone: (@total_cents / CENTS_PER_SEMITONE.to_f).round)
    end
  end

  # diff in (rounded) semitones
  def diff other
    Rational(@total_cents - other.total_cents, CENTS_PER_SEMITONE)
  end

  def transpose semitones
    Pitch.new(cent: (@total_cents + semitones * CENTS_PER_SEMITONE).round)
  end

  def + semitones
    transpose(semitones)
  end

  def - semitones
    transpose(-semitones)
  end

  def total_semitones
    Rational(@total_cents, CENTS_PER_SEMITONE)
  end

  def self.from_semitones semitones
    Pitch.new(cent: (semitones * CENTS_PER_SEMITONE).round)
  end

  def clone
    Pitch.new(cent: @total_cents)
  end

  def natural?
    [0,2,4,5,7,9,11].include?(semitone)
  end

  def self.pc_str semitone, sharpit
    case semitone
    when 0 then "C"
    when 1 then sharpit  ? "C#" : "Db"
    when 2 then "D"
    when 3 then sharpit  ? "D#" : "Eb"
    when 4 then "E"
    when 5 then "F"
    when 6 then sharpit  ? "F#" : "Gb"
    when 7 then "G"
    when 8 then sharpit  ? "G#" : "Ab"
    when 9 then "A"
    when 10 then sharpit  ? "A#" : "Bb"
    when 11 then "B"
    end
  end

  def to_s(sharpit = false)
    letter = Pitch.pc_str(semitone, sharpit)
    if @cent == 0
      return letter + octave.to_s
    elsif @cent > 0
      return letter + octave.to_s + "+" + @cent.to_s
    else
      return letter + octave.to_s + @cent.to_s
    end
  end

  def self.from_ratio ratio
    raise NonPositiveError, "ratio #{ratio} is not > 0" unless ratio > 0
    x = Math.log2 ratio
    new(cent: (x * CENTS_PER_OCTAVE).round)
  end

  def self.from_freq freq
    from_ratio(freq / BASE_FREQ)
  end

  private

  # Balance out the octave and semitone count.
  def balance!
    centsTotal = @total_cents

    @octave = centsTotal / CENTS_PER_OCTAVE
    centsTotal -= @octave * CENTS_PER_OCTAVE

    @semitone = centsTotal / CENTS_PER_SEMITONE
    centsTotal -= @semitone * CENTS_PER_SEMITONE

    @cent = centsTotal
    return self
  end
end

end


text:
require File.dirname(__FILE__) + "/autotest_helper"

class Autotest

  describe Rspec do
    describe "adding spec.opts --options" do
      before(:each) do
        @rspec_autotest = Rspec.new
      end

      it "should return the command line option to add spec.opts if the options file exists" do
        File.stub!(:exist?).and_return true
        @rspec_autotest.add_options_if_present.should == "-O spec/spec.opts "
      end

      it "should return an empty string if no spec.opts exists" do
        File.stub!(:exist?).and_return false
        Rspec.new.add_options_if_present.should == ""
      end
    end

    describe "commands" do
      before(:each) do
        @rspec_autotest = Rspec.new
        @rspec_autotest.stub!(:ruby).and_return "ruby"
        @rspec_autotest.stub!(:add_options_if_present).and_return "-O spec/spec.opts"

        @ruby = @rspec_autotest.ruby
        @spec_cmd = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec'))
        @options = @rspec_autotest.add_options_if_present
        @files_to_test = {
          :spec => ["file_one", "file_two"]
        }
        # this is not the inner representation of Autotest!
        @rspec_autotest.stub!(:files_to_test).and_return @files_to_test
        @files_to_test.stub!(:keys).and_return @files_to_test[:spec]
        @to_test = @files_to_test.keys.flatten.join ' '
      end

      it "should make the appropriate test command" do
        @rspec_autotest.make_test_cmd(@files_to_test).should == "#{@ruby} #{@spec_cmd} #{@to_test} #{@options}"
      end

      it "should return a blank command for no files" do
        @rspec_autotest.make_test_cmd({}).should == ''
      end
    end

    describe "mappings" do

      before(:each) do
        @lib_file = "lib/something.rb"
        @spec_file = "spec/something_spec.rb"
        @rspec_autotest = Rspec.new
        @rspec_autotest.hook :initialize
      end

      it "should find the spec file for a given lib file" do
        @rspec_autotest.should map_specs([@spec_file]).to(@lib_file)
      end

      it "should find the spec file if given a spec file" do
        @rspec_autotest.should map_specs([@spec_file]).to(@spec_file)
      end

      it "should ignore files in spec dir that aren't specs" do
        @rspec_autotest.should map_specs([]).to("spec/spec_helper.rb")
      end

      it "should ignore untracked files (in @file)"  do
        @rspec_autotest.should map_specs([]).to("lib/untracked_file")
      end
    end

    describe "consolidating failures" do
      before(:each) do
        @rspec_autotest = Rspec.new

        @spec_file = "spec/autotest/some_spec.rb"
        @rspec_autotest.instance_variable_set("@files", {@spec_file => Time.now})
        @rspec_autotest.stub!(:find_files_to_test).and_return true
      end

      it "should return no failures if no failures were given in the output" do
        @rspec_autotest.consolidate_failures([[]]).should == {}
      end

      it "should return a hash with the spec filename => spec name for each failure or error" do
        @rspec_autotest.stub!(:test_files_for).and_return "spec/autotest/some_spec.rb"
        failures = [
          [
            "false should be false",
            "expected: true,\n     got: false (using ==)\n#{@spec_file}:203:"
          ]
        ]
        @rspec_autotest.consolidate_failures(failures).should == {
          @spec_file => ["false should be false"]
        }
      end

      it "should not include the subject file" do
        subject_file = "lib/autotest/some.rb"
        @rspec_autotest.stub!(:test_files_for).and_return "spec/autotest/some_spec.rb"
        failures = [
          [
            "false should be false",
            "expected: true,\n     got: false (using ==)\n#{subject_file}:143:\n#{@spec_file}:203:"
          ]
        ]
        @rspec_autotest.consolidate_failures(failures).keys.should_not include(subject_file)
      end
    end
  end
end


text:
package com.yjl.javabase.thinkinjava.exceptions;//: exceptions/WithFinally.java
// Finally Guarantees cleanup.

public class WithFinally {
  static Switch sw = new Switch();
  public static void main(String[] args) {
    try {
      sw.on();
      // Code that can throw exceptions...
      OnOffSwitch.f();
    } catch(OnOffException1 e) {
      System.out.println("OnOffException1");
    } catch(OnOffException2 e) {
      System.out.println("OnOffException2");
    } finally {
      sw.off();
    }
  }
} /* Output:
on
off
*///:~


text:
   /**
    *  Gets URI that identifies the test.
    *  @return uri identifier of test
    */
function getTargetURI() {
      return "http://www.w3.org/2001/DOM-Test-Suite/level3/core/domstringlistitem02";
   }

var docsLoaded = -1000000;
var builder = null;

//
//   This function is called by the testing framework before
//      running the test suite.
//
//   If there are no configuration exceptions, asynchronous
//        document loading is started.  Otherwise, the status
//        is set to complete and the exception is immediately
//        raised when entering the body of the test.
//
function setUpPage() {
   setUpPageStatus = 'running';
   try {
     //
     //   creates test document builder, may throw exception
     //
     builder = createConfiguredBuilder();

      docsLoaded = 0;

      var docRef = null;
      if (typeof(this.doc) != 'undefined') {
        docRef = this.doc;
      }
      docsLoaded += preload(docRef, "doc", "hc_staff");

       if (docsLoaded == 1) {
          setUpPageStatus = 'complete';
       }
    } catch(ex) {
    	catchInitializationError(builder, ex);
        setUpPageStatus = 'complete';
    }
}

//
//   This method is called on the completion of
//      each asychronous load started in setUpTests.
//
//   When every synchronous loaded document has completed,
//      the page status is changed which allows the
//      body of the test to be executed.
function loadComplete() {
    if (++docsLoaded == 1) {
        setUpPageStatus = 'complete';
    }
}

/**
*
	The item method of the DOMStringList Returns the indexth item in the collection.
	If index is greater than or equal to the number of DOMStrings in the list, this returns null.

	Invoke the first item on the list of parameters returned by the DOMConfiguration object and
	make sure it is not null.  Then invoke the 100th item and verify that null is returned.

* @author IBM
* @author Jenny Hsu
* @see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMStringList-item
*/
function domstringlistitem02() {
   var success;
    if(checkInitialization(builder, "domstringlistitem02") != null) return;
    var doc;
      var paramList;
      var domConfig;
      var listSize;
      var retStr;

      var docRef = null;
      if (typeof(this.doc) != 'undefined') {
        docRef = this.doc;
      }
      doc = load(docRef, "doc", "hc_staff");
      domConfig = doc.domConfig;

      paramList = domConfig.parameterNames;

      retStr = paramList.item(0);
      assertNotNull("domstringlistitem02_notNull",retStr);
retStr = paramList.item(100);
      assertNull("domstringlistitem02_null",retStr);

}

function runTest() {
   domstringlistitem02();
}