text:
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.

// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.

// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_FOR_EACH_RANGE_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_FOR_EACH_RANGE_HPP

#include <boost/mpl/assert.hpp>
#include <boost/concept/requires.hpp>
#include <boost/range.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_const.hpp>

#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/core/tags.hpp>

#include <boost/geometry/util/add_const_if_c.hpp>
#include <boost/geometry/views/box_view.hpp>

namespace boost { namespace geometry
{

#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace for_each
{

template <typename Range, typename Actor>
struct fe_range_range
{
    static inline void apply(Range & range, Actor & actor)
    {
        actor.apply(range);
    }
};

template <typename Polygon, typename Actor>
struct fe_range_polygon
{
    static inline void apply(Polygon & polygon, Actor & actor)
    {
        actor.apply(exterior_ring(polygon));

        // TODO: If some flag says true, also do the inner rings.
        // for convex hull, it's not necessary
    }
};

template <typename Box, typename Actor>
struct fe_range_box
{
    static inline void apply(Box & box, Actor & actor)
    {
        actor.apply(box_view<typename boost::remove_const<Box>::type>(box));
    }
};

template <typename Multi, typename Actor, typename SinglePolicy>
struct fe_range_multi
{
    static inline void apply(Multi & multi, Actor & actor)
    {
        for ( typename boost::range_iterator<Multi>::type
                it = boost::begin(multi); it != boost::end(multi); ++it)
        {
            SinglePolicy::apply(*it, actor);
        }
    }
};

}} // namespace detail::for_each
#endif // DOXYGEN_NO_DETAIL

#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{

template
<
    typename Geometry,
    typename Actor,
    typename Tag = typename tag<Geometry>::type
>
struct for_each_range
{
    BOOST_MPL_ASSERT_MSG
        (
            false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
            , (types<Geometry>)
        );
};

template <typename Linestring, typename Actor>
struct for_each_range<Linestring, Actor, linestring_tag>
    : detail::for_each::fe_range_range<Linestring, Actor>
{};

template <typename Ring, typename Actor>
struct for_each_range<Ring, Actor, ring_tag>
    : detail::for_each::fe_range_range<Ring, Actor>
{};

template <typename Polygon, typename Actor>
struct for_each_range<Polygon, Actor, polygon_tag>
    : detail::for_each::fe_range_polygon<Polygon, Actor>
{};

template <typename Box, typename Actor>
struct for_each_range<Box, Actor, box_tag>
    : detail::for_each::fe_range_box<Box, Actor>
{};

template <typename MultiPoint, typename Actor>
struct for_each_range<MultiPoint, Actor, multi_point_tag>
    : detail::for_each::fe_range_range<MultiPoint, Actor>
{};

template <typename Geometry, typename Actor>
struct for_each_range<Geometry, Actor, multi_linestring_tag>
    : detail::for_each::fe_range_multi
        <
            Geometry,
            Actor,
            detail::for_each::fe_range_range
                <
                    typename add_const_if_c
                        <
                            boost::is_const<Geometry>::value,
                            typename boost::range_value<Geometry>::type
                        >::type,
                    Actor
                >
        >
{};

template <typename Geometry, typename Actor>
struct for_each_range<Geometry, Actor, multi_polygon_tag>
    : detail::for_each::fe_range_multi
        <
            Geometry,
            Actor,
            detail::for_each::fe_range_polygon
                <
                    typename add_const_if_c
                        <
                            boost::is_const<Geometry>::value,
                            typename boost::range_value<Geometry>::type
                        >::type,
                    Actor
                >
        >
{};

} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH

namespace detail
{

template <typename Geometry, typename Actor>
inline void for_each_range(Geometry const& geometry, Actor & actor)
{
    dispatch::for_each_range
        <
            Geometry const,
            Actor
        >::apply(geometry, actor);
}

}

}} // namespace boost::geometry

#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_FOR_EACH_RANGE_HPP


text:
<idea-plugin version="2">
  <id>intellij.buck.plugin</id>
  <name>Buck for IDEA</name>
  <version>2.7.2</version>
  <category>Build</category>
  <vendor email="fb-plugins@fb.com" url="www.facebook.com">Facebook, Inc.</vendor>

  <description><![CDATA[
      An IntelliJ plugin for Buck build system.

Features:

Syntax highlighting for BUCK file

Keywords auto completion

Go to buck file with one click

Go to to paths of dependencies with one click

Buck file formatter

Buck line commenter

Buck dependencies sorter

    ]]></description>

  <change-notes><![CDATA[

        2.7.2
          Fixed a bug with NullPointerException in BuckEventsQueue.
          Fixed multiple edge cases with autodeps logic.

        2.7.1
          Updated upper-bound of plugin to 2016.2.

        2.7.0
          Sending events for Buck plugin IntelliJ actions.
          Added adb select path to Tools.

        2.6
          Improved server connect/disconnect.
          Moved actions from the UI thread.
          Fixed some compatibility issues.

        2.5
          Updated buck icons.
          Made all existing paths in a Buck file clickable.
          Improved grammar.
          Show popup on how to enable the toolbar.
          Disable choose target if indexing not over.

        2.4
          Added the plugin to the toolbar.
          Show successful/failed notification on action finished.
          Automatically find buck executable.
          Added install debugging.
          Minor bug fixes

        2.3
          Updated with the new buck API.
          Fixed old commands to work with Buck.

        2.2
        Fetch build status via websocket.
        Publish build status notifications.

        1.1
      1. Formatter for buck file
      2. Buck dependencies sorter
      3. Annotator for wrong buck dependency target
      4. Line commenter

    ]]>
  </change-notes>

  <idea-version since-build="139.0" until-build="162.*"/>

  <depends>com.intellij.modules.platform</depends>
  <depends>com.intellij.modules.lang</depends>

  <extensions defaultExtensionNs="com.intellij">
    <fileTypeFactory implementation="com.facebook.buck.intellij.ideabuck.file.BuckFileTypeFactory"/>
    <lang.parserDefinition
        language="Buck"
        implementationClass="com.facebook.buck.intellij.ideabuck.lang.BuckParserDefinition"/>
    <lang.syntaxHighlighterFactory
        key="Buck"
        implementationClass="com.facebook.buck.intellij.ideabuck.highlight.BuckSyntaxHighlighterFactory"/>
    <lang.formatter
        language="Buck"
        implementationClass="com.facebook.buck.intellij.ideabuck.format.BuckFormattingModelBuilder"/>
    <lang.importOptimizer
        language="Buck"
        implementationClass="com.facebook.buck.intellij.ideabuck.format.BuckImportOptimizer"/>
    <completion.contributor
        language="Buck"
        implementationClass="com.facebook.buck.intellij.ideabuck.completion.BuckCompletionContributor"/>
    <codeStyleSettingsProvider
        implementation="com.facebook.buck.intellij.ideabuck.config.BuckCodeStyleSettingsProvider"/>
    <langCodeStyleSettingsProvider
        implementation="com.facebook.buck.intellij.ideabuck.format.BuckLanguageCodeStyleSettingsProvider"/>
    <gotoDeclarationHandler
        implementation="com.facebook.buck.intellij.ideabuck.navigation.BuckGotoProvider"
        order="FIRST"/>
    <annotator language="Buck"
               implementationClass="com.facebook.buck.intellij.ideabuck.annotator.BuckAnnotator"/>
    <colorSettingsPage
        implementation="com.facebook.buck.intellij.ideabuck.config.BuckColorSettingsPage"/>
    <lang.commenter language="Buck"
                    implementationClass="com.facebook.buck.intellij.ideabuck.commenter.BuckCommenter"/>
    <lang.braceMatcher
        language="Buck"
        implementationClass="com.facebook.buck.intellij.ideabuck.format.BuckBraceMatcher"/>
    <quoteHandler
        fileType="Buck"
        className="com.facebook.buck.intellij.ideabuck.format.BuckQuoteHandler"/>
    <copyPastePreProcessor
        implementation="com.facebook.buck.intellij.ideabuck.format.BuckCopyPasteProcessor"/>
    <toolWindow
        id="Buck"
        anchor="bottom"
        icon="BuckIcons.BUCK_TOOL_WINDOW_ICON"
        factoryClass="com.facebook.buck.intellij.ideabuck.ui.BuckToolWindowFactory"/>
    <applicationConfigurable
        groupId="tools"
        displayName="Buck"
        id="buck.settings"
        instance="com.facebook.buck.intellij.ideabuck.config.BuckSettingsConfigurable"/>
    <projectService
        serviceImplementation="com.facebook.buck.intellij.ideabuck.build.BuckBuildManager"/>
    <projectService
        serviceImplementation="com.facebook.buck.intellij.ideabuck.ui.BuckUIManager"/>
  </extensions>

  <actions>
    <group id="buck.Menu">
      <action
          id="buck.GoToBuckFile"
          class="com.facebook.buck.intellij.ideabuck.actions.GoToBuckFile"
          text="Go to Buck file"
          description="Go to Buck file for this source file.">
        <keyboard-shortcut keymap="$default" first-keystroke="ctrl shift P"/>
      </action>
      <add-to-group anchor="first" group-id="BuildMenu"/>
      <add-to-group anchor="first" group-id="EditorPopupMenu"/>
      <add-to-group anchor="last" group-id="MainToolBar"/>
    </group>

    <group id="buck.BuildGroup">
      <separator></separator>
      <action class="com.facebook.buck.intellij.ideabuck.actions.ChooseTargetAction" id="buck.ChooseTarget">
        <keyboard-shortcut keymap="$default" first-keystroke="ctrl shift J"/>
      </action>
      <action class="com.facebook.buck.intellij.ideabuck.actions.BuckBuildAction" id="buck.Build">
        <keyboard-shortcut keymap="$default" first-keystroke="ctrl shift S"/>
      </action>
      <action class="com.facebook.buck.intellij.ideabuck.actions.BuckTestAction" id="buck.Test">
        <keyboard-shortcut keymap="$default" first-keystroke="ctrl shift Y"/>
      </action>
      <action class="com.facebook.buck.intellij.ideabuck.actions.BuckInstallAction" id="buck.Install">
        <keyboard-shortcut keymap="$default" first-keystroke="ctrl shift X"/>
      </action>
      <action class="com.facebook.buck.intellij.ideabuck.actions.BuckInstallDebugAction" id="buck.InstallDebug">
        <keyboard-shortcut keymap="$default" first-keystroke="ctrl shift D"/>
      </action>
      <action class="com.facebook.buck.intellij.ideabuck.actions.BuckUninstallAction" id="buck.Uninstall">
        <keyboard-shortcut keymap="$default" first-keystroke="ctrl shift M"/>
      </action>
      <action class="com.facebook.buck.intellij.ideabuck.actions.BuckKillAction" id="buck.Kill">
        <keyboard-shortcut keymap="$default" first-keystroke="ctrl shift L"/>
      </action>
      <action class="com.facebook.buck.intellij.ideabuck.actions.BuckProjectGenerationAction" id="buck.ProjectGeneration">
        <keyboard-shortcut keymap="$default" first-keystroke="ctrl shift B"/>
      </action>
      <add-to-group anchor="last" group-id="MainToolBar"/>
    </group>
  </actions>

  <application-components>
    <component>
      <implementation-class>com.facebook.buck.intellij.ideabuck.config.BuckSettingsProvider
      </implementation-class>
    </component>
  </application-components>

    <project-components>
        <component>
            <implementation-class>com.facebook.buck.intellij.ideabuck.config.BuckModule</implementation-class>
            <loadForDefaultProject />
        </component>
    </project-components>
</idea-plugin>

redpajama_set_name: RedPajamaGithub


text:
package org.apache.drill.exec.store.sys.store.provider;

import java.io.IOException;

import com.google.common.annotations.VisibleForTesting;
import org.apache.curator.framework.CuratorFramework;
import org.apache.drill.common.config.DrillConfig;
import org.apache.drill.exec.coord.zk.ZKClusterCoordinator;
import org.apache.drill.exec.exception.StoreException;
import org.apache.drill.exec.store.dfs.DrillFileSystem;
import org.apache.drill.exec.store.sys.PersistentStore;
import org.apache.drill.exec.store.sys.PersistentStoreRegistry;
import org.apache.drill.exec.store.sys.PersistentStoreConfig;
import org.apache.drill.exec.store.sys.store.LocalPersistentStore;
import org.apache.drill.exec.store.sys.store.ZookeeperPersistentStore;
import org.apache.hadoop.fs.Path;

public class ZookeeperPersistentStoreProvider extends BasePersistentStoreProvider {
//  private static final Logger logger = LoggerFactory.getLogger(ZookeeperPersistentStoreProvider.class);

  public static final String DRILL_EXEC_SYS_STORE_PROVIDER_ZK_BLOBROOT = "drill.exec.sys.store.provider.zk.blobroot";

  private final CuratorFramework curator;
  private final DrillFileSystem fs;
  private final Path blobRoot;

  public ZookeeperPersistentStoreProvider(final PersistentStoreRegistry<ZKClusterCoordinator> registry) throws StoreException {
    this(registry.getConfig(), registry.getCoordinator().getCurator());
  }

  @VisibleForTesting
  public ZookeeperPersistentStoreProvider(final DrillConfig config, final CuratorFramework curator) throws StoreException {
    this.curator = curator;

    if (config.hasPath(DRILL_EXEC_SYS_STORE_PROVIDER_ZK_BLOBROOT)) {
      blobRoot = new Path(config.getString(DRILL_EXEC_SYS_STORE_PROVIDER_ZK_BLOBROOT));
    }else{
      blobRoot = LocalPersistentStore.getLogDir();
    }

    try {
      this.fs = LocalPersistentStore.getFileSystem(config, blobRoot);
    } catch (IOException ex) {
      throw new StoreException("unable to get filesystem", ex);
    }
  }

  @Override
  public <V> PersistentStore<V> getOrCreateStore(final PersistentStoreConfig<V> config) throws StoreException {
    switch(config.getMode()){
    case BLOB_PERSISTENT:
      return new LocalPersistentStore<>(fs, blobRoot, config);
    case PERSISTENT:
      final ZookeeperPersistentStore<V> store = new ZookeeperPersistentStore<>(curator, config);
      try {
        store.start();
      } catch (Exception e) {
        throw new StoreException("unable to start zookeeper store", e);
      }
      return store;
    default:
      throw new IllegalStateException();
    }
  }

  @Override
  public void close() throws Exception {
    fs.close();
  }
}


text:
Server: Netscape-Communications/1.1
Date: Monday, 25-Nov-96 20:39:50 GMT
Content-type: text/html

<title>Davis gif</title>

Professor Ronald Davis

<!WA0>
<!WA1>

(Click on my head)

<APPLET codebase="/java/demo/AudioItem"
CODE=AudioItem WIDTH=10 HEIGHT=10>
<param name=snd value="http://cs.millersv.edu/sounds/loveuman.au">
If u had a Java enabled browser this would play sound
</APPLET>

(Click on the audio speaker above to play sound again)

<!WA2><!WA3>
Back To CS Main Page


text:
class FixMobileAppsInSystem < ActiveRecord::Migration
  def change
    PublicActivity.enabled = false
    MobileApp.where("status = ?", MobileApp.statuses[:published]).each { |ma| ma.published!}
  end
end


text:
=========
Abandoned
=========

This is no longer in active use; I've been using
beancount_ for several years.

.. _beancount: https://github.com/beancount/beancount

This repo is archived and will eventually be deleted.

============
gnucash-util
============

This is a collection of utilities for automating GnuCash tasks using
the GnuCash python bindings.

This has only been tested(*) on:

  * linux (Ubuntu 10.04.1 "lucid") with
  * GnuCash 2.4.0-1~getdeb1~lucid (obtained from getdeb.net) and
  * python 2.6.5.

Patches and new scripts are welcome. See https://github.com/bstpierre/gnucash-util

(*) Where "tested" is equivalent to small values of "Works for me!".


text:
Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # Code is not reloaded between requests.
  config.cache_classes = true

  # Eager load code on boot. This eager loads most of Rails and
  # your application in memory, allowing both threaded web servers
  # and those relying on copy on write to perform better.
  # Rake tasks automatically ignore this option for performance.
  config.eager_load = true

  # Full error reports are disabled and caching is turned on.
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
  # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
  # config.require_master_key = true

  # Disable serving static files from the `/public` folder by default since
  # Apache or NGINX already handles this.
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

  # Compress JavaScripts and CSS.
  config.assets.js_compressor = Uglifier.new(harmony: true)
  # config.assets.css_compressor = :sass

  # Do not fallback to assets pipeline if a precompiled asset is missed.
  config.assets.compile = false

  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
  # config.action_controller.asset_host = 'http://assets.example.com'

  # Specifies the header that your server uses for sending files.
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

  # Store uploaded files on Amazon S3
  config.active_storage.service = :amazon

  # Mount Action Cable outside main process or domain
  # config.action_cable.mount_path = nil
  # config.action_cable.url = 'wss://example.com/cable'
  # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  config.force_ssl = true

  # Use the lowest log level to ensure availability of diagnostic information
  # when problems arise.
  config.log_level = :debug

  # Prepend all log lines with the following tags.
  config.log_tags = [ :request_id ]

  # Use a different cache store in production.
  # config.cache_store = :mem_cache_store

  # Use a real queuing backend for Active Job (and separate queues per environment)
  # config.active_job.queue_adapter     = :resque
  # config.active_job.queue_name_prefix = "notebook_#{Rails.env}"

  config.action_mailer.perform_caching = false

  # Ignore bad email addresses and do not raise email delivery errors.
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
  # config.action_mailer.raise_delivery_errors = false

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation cannot be found).
  # config.i18n.fallbacks = true # old versions of rails
  config.i18n.fallbacks = [I18n.default_locale]

  # Send deprecation notices to registered listeners.
  config.active_support.deprecation = :notify

  # Use default logging formatter so that PID and timestamp are not suppressed.
  config.log_formatter = ::Logger::Formatter.new

  # Use a different logger for distributed setups.
  # require 'syslog/logger'
  # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')

  if ENV["RAILS_LOG_TO_STDOUT"].present?
    logger           = ActiveSupport::Logger.new(STDOUT)
    logger.formatter = config.log_formatter
    config.logger    = ActiveSupport::TaggedLogging.new(logger)
  end

  # Do not dump schema after migrations.
  config.active_record.dump_schema_after_migration = false

  # Whitelist HashWithIndifferentAccess/TimeWithZone for changelog serialization
  # config.active_record.yaml_column_permitted_classes = [HashWithIndifferentAccess, ActiveSupport::TimeWithZone, Time]
  config.active_record.use_yaml_unsafe_load = true

  # Devise default url options
  config.action_mailer.default_url_options = { host: 'www.notebook.ai' }
  config.active_job.default_url_options    = { host: 'www.notebook.ai' }
  ActionMailer::Base.smtp_settings = {
    :address        => "smtp.sendgrid.net",
    :port           => 587,
    :authentication => :plain,
    :user_name      => ENV['SENDGRID_USERNAME'],
    :password       => ENV['SENDGRID_PASSWORD'],
    :domain         => ENV['SENDGRID_DOMAIN'],
    :enable_starttls_auto => true
  }

  # Settings for API key usage:
  # authentication: :plain,
  # user_name:      'apikey',
  # password:       ENV['SENDGRID_API_KEY']

  # S3 settings for Paperclip uploads
  config.paperclip_defaults = {
    storage: :s3,
    s3_credentials: {
      bucket:            ENV.fetch('S3_BUCKET_NAME',        'notebook-content-uploads'),
      s3_region:         ENV.fetch('AWS_REGION',            'us-east-1'),
      access_key_id:     ENV.fetch('AWS_ACCESS_KEY_ID'),
      secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY')
    }
  }

  # Set production Stripe API key
  Stripe.api_key                = ENV['STRIPE_API_KEY']
  config.stripe_publishable_key = ENV['STRIPE_PUBLISHABLE_KEY']
end


text:
You light a small fire in the middle of the marshmallow room.

You stoke the fire by fanning the flames.

The higher the flames grow, the more you fan them.

As the fire grows, a sweet aroma fills the room and the ceiling becomes ever so slightly brown just above the fire.

This situation has the potential to go terribly wrong.

The walls around you begin to melt, globs of flaming marshmallow falling all around you. What do you do?

As you somehow avoid the globs of marshmallow using your reflexes, you notice a big enough opening in the melted
walls for you to squeeze through.

But then you notice a rat entering that opening too.

[Enter that opening](magic-world/alice.md)

[Start screaming seeing the rat](fire/alone.md)

[Save yourself!](run-away/outside.md)

[Begin to eat!](eating/inside.md)

[Succumb to your marshmallow-y grave!](succumb/game-over.md)

[Turn on the chocolate sprinkler!](sprinkler/eating-chocolate.md)

[Stop, drop, and roll.](stop-drop-roll/stop-drop-roll.md)

[Call the marshmallow wall repair guy, Marshall M. Aloe](call-marshall/call-marshall.md)

[Pull graham crackers from inside your jacket](graham-crackers/graham-crackers.md)

[Say xyzzy.](xyzzy/xyzzy.md)

[Extinguish fire.](extinguish-fire/extinguish-fire.md)

[Drink some coffee.](../coffee/coffee.md)
[Sleep]


text:
package ucar.nc2.internal.dataset;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.stream.Collectors;
import javax.annotation.concurrent.Immutable;
import ucar.nc2.Group;
import ucar.nc2.Structure;
import ucar.nc2.Variable;
import ucar.nc2.constants.AxisType;
import ucar.nc2.dataset.CoordinateAxis;
import ucar.nc2.dataset.CoordinateSystem;
import ucar.nc2.dataset.CoordinateTransform;
import ucar.nc2.dataset.NetcdfDataset;
import ucar.nc2.dataset.VariableDS;
import ucar.nc2.internal.dataset.transform.vertical.VerticalCTBuilder;

/** A helper class for NetcdfDataset to build and manage coordinates. */
@Immutable
public class CoordinatesHelper {
  private static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(CoordinatesHelper.class);
  private final ImmutableList<CoordinateAxis> coordAxes;
  private final List<CoordinateSystem> coordSystems;
  private final List<CoordinateTransform> coordTransforms;

  public List<CoordinateAxis> getCoordAxes() {
    return coordAxes;
  }

  public List<CoordinateSystem> getCoordSystems() {
    return coordSystems;
  }

  public Optional<CoordinateSystem> findCoordSystem(String name) {
    return coordSystems.stream().filter(cs -> cs.getName().equals(name)).findFirst();
  }

  public List<CoordinateTransform> getCoordTransforms() {
    return coordTransforms;
  }

  private CoordinatesHelper(Builder builder, NetcdfDataset ncd) {
    List<CoordinateAxis> axes = new ArrayList<>();
    addAxes(ncd.getRootGroup(), axes);
    this.coordAxes = ImmutableList.copyOf(axes);

    coordTransforms =
        builder.coordTransforms.stream().map(ct -> ct.build(ncd)).filter(Objects::nonNull).collect(Collectors.toList());

    coordTransforms.addAll(builder.verticalCTBuilders.stream().map(ct -> ct.makeVerticalCT(ncd))
        .filter(Objects::nonNull).collect(Collectors.toList()));

    this.coordSystems = builder.coordSys.stream().map(s -> s.build(ncd, this.coordAxes, this.coordTransforms))
        .collect(Collectors.toList());
  }

  private void addAxes(Group group, List<CoordinateAxis> axes) {
    for (Variable v : group.getVariables()) {
      if (v instanceof CoordinateAxis) {
        axes.add((CoordinateAxis) v);
      }
      if (v instanceof Structure) {
        Structure s = (Structure) v;
        for (Variable nested : s.getVariables()) {
          if (nested instanceof CoordinateAxis) {
            axes.add((CoordinateAxis) nested);
          }
        }
      }
    }
    for (Group nestedGroup : group.getGroups()) {
      addAxes(nestedGroup, axes);
    }
  }

  ////////////////////////////////////////////////////////////////////////////////////////////////////

  public static Builder builder() {
    return new Builder();
  }

  public static class Builder {
    public List<CoordinateAxis.Builder> coordAxes = new ArrayList<>();
    public List<CoordinateSystem.Builder> coordSys = new ArrayList<>();
    public List<CoordinateTransform.Builder> coordTransforms = new ArrayList<>();
    List<VerticalCTBuilder> verticalCTBuilders = new ArrayList<>();
    private boolean built;

    public Builder addCoordinateAxis(CoordinateAxis.Builder axis) {
      if (axis == null) {
        return this;
      }
      coordAxes.add(axis);
      return this;
    }

    public Builder addCoordinateAxes(Collection<CoordinateAxis.Builder> axes) {
      Preconditions.checkNotNull(axes);
      axes.forEach(a -> addCoordinateAxis(a));
      return this;
    }

    private Optional<CoordinateAxis.Builder> findAxisByVerticalSearch(Variable.Builder vb, String shortName) {
      Optional<Variable.Builder<?>> axis = vb.getParentGroupBuilder().findVariableOrInParent(shortName);
      if (axis.isPresent()) {
        if (axis.get() instanceof CoordinateAxis.Builder) {
          return Optional.of((CoordinateAxis.Builder) axis.get());
        }
      }
      return Optional.empty();
    }

    private Optional<CoordinateAxis.Builder> findAxisByFullName(String fullName) {
      return coordAxes.stream().filter(axis -> axis.getFullName().equals(fullName)).findFirst();
    }

    public Optional<CoordinateAxis.Builder> findAxisByType(CoordinateSystem.Builder csys, AxisType type) {
      for (CoordinateAxis.Builder<?> axis : getAxesForSystem(csys)) {
        if (axis.axisType == type) {
          return Optional.of(axis);
        }
      }
      return Optional.empty();
    }

    public boolean replaceCoordinateAxis(CoordinateAxis.Builder<?> axis) {
      Optional<CoordinateAxis.Builder> want = findAxisByFullName(axis.getFullName());
      want.ifPresent(v -> coordAxes.remove(v));
      addCoordinateAxis(axis);
      return want.isPresent();
    }

    // LOOK dedup
    public Builder addCoordinateSystem(CoordinateSystem.Builder cs) {
      Preconditions.checkNotNull(cs);
      coordSys.add(cs);
      return this;
    }

    public Builder addVerticalCTBuilder(VerticalCTBuilder vctb) {
      verticalCTBuilders.add(vctb);
      return this;
    }

    Optional<CoordinateSystem.Builder> findCoordinateSystem(String coordAxesNames) {
      Preconditions.checkNotNull(coordAxesNames);
      return coordSys.stream().filter(cs -> cs.coordAxesNames.equals(coordAxesNames)).findFirst();
    }

    public Builder addCoordinateSystems(Collection<CoordinateSystem.Builder> systems) {
      Preconditions.checkNotNull(systems);
      coordSys.addAll(systems);
      return this;
    }

    public Builder addCoordinateTransform(CoordinateTransform.Builder ct) {
      Preconditions.checkNotNull(ct);
      if (!findCoordinateTransform(ct.name).isPresent()) {
        coordTransforms.add(ct);
      }
      return this;
    }

    public Builder addCoordinateTransforms(Collection<CoordinateTransform.Builder> transforms) {
      Preconditions.checkNotNull(transforms);
      transforms.forEach(ct -> addCoordinateTransform(ct));
      return this;
    }

    private Optional<CoordinateTransform.Builder> findCoordinateTransform(String ctName) {
      Preconditions.checkNotNull(ctName);
      return coordTransforms.stream().filter(ct -> ct.name.equals(ctName)).findFirst();
    }

    private List<CoordinateAxis.Builder<?>> getAxesForSystem(CoordinateSystem.Builder cs) {
      Preconditions.checkNotNull(cs);
      List<CoordinateAxis.Builder<?>> axes = new ArrayList<>();
      StringTokenizer stoker = new StringTokenizer(cs.coordAxesNames);
      while (stoker.hasMoreTokens()) {
        String vname = stoker.nextToken();
        Optional<CoordinateAxis.Builder> vbOpt = findAxisByFullName(vname);
        if (vbOpt.isPresent()) {
          axes.add(vbOpt.get());
        } else {
          throw new IllegalArgumentException("Cant find axis " + vname);
        }
      }
      return axes;
    }

    String makeCanonicalName(VariableDS.Builder<?> vb, String axesNames) {
      Preconditions.checkNotNull(axesNames);
      List<CoordinateAxis.Builder> axes = new ArrayList<>();
      StringTokenizer stoker = new StringTokenizer(axesNames);
      while (stoker.hasMoreTokens()) {
        String vname = stoker.nextToken();
        Optional<CoordinateAxis.Builder> vbOpt = findAxisByFullName(vname);
        if (!vbOpt.isPresent()) {
          vbOpt = findAxisByVerticalSearch(vb, vname);
        }
        if (vbOpt.isPresent()) {
          axes.add(vbOpt.get());
        } else {
          // TODO this should fail, leaving it here to match current behavior.
          log.warn("No axis named {}", vname);
          // throw new IllegalArgumentException("Cant find axis " + vname);
        }
      }
      return makeCanonicalName(axes);
    }

    String makeCanonicalName(List<CoordinateAxis.Builder> axes) {
      Preconditions.checkNotNull(axes);
      return axes.stream().sorted(new AxisComparator()).map(a -> a.getFullName()).collect(Collectors.joining(" "));
    }

    public CoordinatesHelper build(NetcdfDataset ncd) {
      Preconditions.checkNotNull(ncd);
      if (built)
        throw new IllegalStateException("already built");
      built = true;
      return new CoordinatesHelper(this, ncd);
    }

    // Check if this Coordinate System is complete for v, ie if v dimensions are a subset..
    public boolean isComplete(CoordinateSystem.Builder<?> cs, VariableDS.Builder<?> vb) {
      Preconditions.checkNotNull(cs);
      Preconditions.checkNotNull(vb);
      // TODO using strings instead of Dimensions, to avoid exposing mutable Dimension objects.
      // TODO Might reconsider in 6.
      Set<String> varDomain = ImmutableSet.copyOf(vb.getDimensionsAll().iterator());
      HashSet<String> csDomain = new HashSet<>();
      getAxesForSystem(cs).forEach(axis -> csDomain.addAll(axis.getDimensionsAll()));
      return CoordinateSystem.isSubset(varDomain, csDomain);
    }

    public boolean containsAxes(CoordinateSystem.Builder cs, List<CoordinateAxis.Builder> dataAxes) {
      Preconditions.checkNotNull(cs);
      Preconditions.checkNotNull(dataAxes);
      List<CoordinateAxis.Builder<?>> csAxes = getAxesForSystem(cs);
      return csAxes.containsAll(dataAxes);
    }

    public boolean containsAxisTypes(CoordinateSystem.Builder cs, List<AxisType> axisTypes) {
      Preconditions.checkNotNull(cs);
      Preconditions.checkNotNull(axisTypes);
      List<CoordinateAxis.Builder<?>> csAxes = getAxesForSystem(cs);
      for (AxisType axisType : axisTypes) {
        if (!containsAxisTypes(csAxes, axisType))
          return false;
      }
      return true;
    }

    private boolean containsAxisTypes(List<CoordinateAxis.Builder<?>> axes, AxisType want) {
      for (CoordinateAxis.Builder axis : axes) {
        if (axis.axisType == want)
          return true;
      }
      return false;
    }
  }

  private static class AxisComparator implements java.util.Comparator<CoordinateAxis.Builder> {
    public int compare(CoordinateAxis.Builder c1, CoordinateAxis.Builder c2) {
      AxisType t1 = c1.axisType;
      AxisType t2 = c2.axisType;

      if ((t1 == null) && (t2 == null))
        return c1.getFullName().compareTo(c2.getFullName());
      if (t1 == null)
        return -1;
      if (t2 == null)
        return 1;

      return t1.axisOrder() - t2.axisOrder();
    }
  }
}


text:
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Routing;
using Microsoft.AspNet.Routing.Template;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Migrap.AspNet.Routing.Template {
    public class SubdomainTemplateRoute : INamedRouter, IRouter {
        private readonly TemplateRoute _innerRoute;
        private readonly IRouter _target;
        private readonly string _subdomainTemplate;
        private readonly TemplateMatcher _matcher;
        private ILogger _logger;

        public SubdomainTemplateRoute(IRouter target, string subdomainTemplate, string routeTemplate, IInlineConstraintResolver inlineConstraintResolver)
            : this(target, subdomainTemplate, routeTemplate, null, null, null, inlineConstraintResolver) {
        }

        public SubdomainTemplateRoute(IRouter target, string subdomainTemplate, string routeTemplate, IDictionary<string, object> defaults, IDictionary<string, object> constraints, IDictionary<string, object> dataTokens, IInlineConstraintResolver inlineConstraintResolver)
            : this(target, null, subdomainTemplate, routeTemplate, defaults, constraints, dataTokens, inlineConstraintResolver) {
        }

        public SubdomainTemplateRoute(IRouter target, string routeName, string subdomainTemplate, string routeTemplate, IDictionary<string, object> defaults, IDictionary<string, object> constraints, IDictionary<string, object> dataTokens, IInlineConstraintResolver inlineConstraintResolver) {
            _innerRoute = new TemplateRoute(target, routeName, routeTemplate, defaults, constraints, dataTokens, inlineConstraintResolver);
            _subdomainTemplate = subdomainTemplate;
            _target = target;

            _matcher = new TemplateMatcher(TemplateParser.Parse(subdomainTemplate), Defaults);

            Name = routeName;
        }

        public string Name { get; }

        public IReadOnlyDictionary<string, object> Defaults => _innerRoute.Defaults;

        public IReadOnlyDictionary<string, object> DataTokens => _innerRoute.Defaults;

        public string RouteTemplate => _innerRoute.RouteTemplate;

        public string SubdomainTemplate => _subdomainTemplate;

        public VirtualPathData GetVirtualPath(VirtualPathContext context) {
            foreach(var parameter in _matcher.Template.Parameters) {
                context.Values.Remove(parameter.Name);
            }
            return _innerRoute.GetVirtualPath(context);
        }

        public async Task RouteAsync(RouteContext context) {
            EnsureLoggers(context.HttpContext);
            using(_logger.BeginScope("SubdomainTemplateRoute.RouteAsync")) {
                var host = context.HttpContext.Request.Host.Value;

                if(host.Contains(":")) {
                    host = host.Substring(0, host.IndexOf(":"));
                }

                var values = _matcher.Match(host);
                if(values == null) {
                    _logger.Log(x => x.Verbose, x => x.LogVerbose(nameof(SubdomainTemplateRoute) + " " + Name + " - Host \"" + context.HttpContext.Request.Host + "\" did not match."));
                    return;
                }

                var oldRouteData = context.RouteData;
                var newRouteData = new RouteData(oldRouteData);

                newRouteData.DataTokens.MergeValues(DataTokens);
                newRouteData.Routers.Add(_target);
                newRouteData.Values.MergeValues(values);

                try {
                    context.RouteData = newRouteData;
                    await _innerRoute.RouteAsync(context);
                }
                finally {
                    if(!context.IsHandled) {
                        context.RouteData = oldRouteData;
                    }
                }
            }
        }

        public override string ToString() {
            return _subdomainTemplate + "/" + RouteTemplate;
        }

        private void EnsureLoggers(HttpContext context) {
            if(_logger == null) {
                _logger = context.RequestServices.GetRequiredService<ILoggerFactory>().CreateLogger<TemplateRoute>();
            }
        }
    }
}


text:
class Car(object):
    """A car class"""
    def __init__(self, model, make, color):
        self.model = model
        self.make = make
        self.color = color
        self.price = None

    def get_price(self):
        return self.price

    def set_price(self, value):
        self.price = value

availableCars = []
def main():
    global availableCars

    #Create a new car obj
    carObj = Car("Maruti SX4", "2011", "Black")
    carObj.set_price(950000)  # Set price
    # Add this to available cars
    availableCars.append(carObj)

    print('TEST SUCEEDED')

if __name__ == '__main__':
    main()


text:
layout: post
title: The Chaos and Grace of Life
author: Manal Ghosain
categories:
tags:
---

![Scattered leaves](/images/leaves.jpg)

> "Chaos is the score upon which reality is written." ~Henry Miller

As I opened the door to leave my house, the wrath of the wind shoved me right back in. The skies were angry. The rain unapologetically slapped me in the face as I dared to step out.

Walking in that weather felt like an extreme sport. I could barely keep my balance on the slippery ground peppered with lifeless and discarded leaves underneath my feet.

It was a dreary day by all measures. Everything was unravelling and out of control. I thought to myself: What a mess!

Needless to say my mood mirrored my *perception* of my surrounding environment. I felt frustrated that I had to go out in this weather. I resisted everything. I did manage to get my errand done and come back home, but the dark mood persisted.

I can't tell you what inspired what came next—other than the life within me connecting with something much bigger than my depressed little ego.

Standing in my office, looking out the window at the maple tree across from my house—almost twice the height of the building—I witnessed nature's torture of this innocent tree. The gusts pushed and prodded; the relentless rain pummeled it mercilessly till the mission was accomplished: the tree was stripped of what was left of its leaves, standing bare and exposed to more of the same.

Yet, this magnificent tree was standing tall, dignified and silent, bending when it needed to—but rooted in its truth and the loving earth that holds it closely.

Then my imagination kicked in. In that moment I thought: What if this was the first time the tree ever experienced such violence? Would it try to kick the wind, or punch the rain? Would it fight back for its survival? Would it try to run away, not knowing that it would be a suicidal mission?

Did the tree ever wonder what had it done to deserve this punishment? And if it wasn't alone, did it compare itself to other trees?

What's the intelligence behind this calm reaction?

All I can think of was the grace of life that binds us together with every living breathing being—the quiet intelligence that transcends the unfathomable violence, the deep knowing that there is beauty and order beyond what *appears* to be ugly chaos.

## The grace behind the mess

The tree didn't need religious teachings, or schooling to gain faith and knowledge. It didn't need to search for the best location to plant itself, or go shopping for the best soil it needed.

The tree simply exists and knows how to exist by the grace and power of the life within.

## What is grace?

I couldn't think of a better word than grace to describe what the neighboring tree inspired in me.

Grace is all of the following, and much more.

**Beauty**

There is beauty in everything—if we're willing to let go of our conditioned responses and revert back to our true nature.

Birth is shockingly painful, bloody and gross. But it also is one of the most awe-inspiring moments of existence—witnessing the emergence of new life. We're used to accepting the mess because we fully appreciate the beauty that follows.

Death is stinking decay and rot. We learn to abhor death. We ignore the peace of a journey coming to an end. We mourn the loss of what was, instead of celebrating the beauty that existed and will continue to reverberate in our memories.

Between life and death, we face our own seasonal changes in health and circumstance. The grace within endures personal storms, knowing that there is beauty within that shines through, no matter what.

**Dignity**

All of life moves with silent dignity, even in the most tumultuous of times.

The wrath of nature may strip a tree of its leaves, but it cannot take away its dignified stillness, even if the storm was strong enough to uproot it out of life.

No amount of force, can strip a human being of their essence and dignity, without their permission.

We may be forced to withstand pain and hardship. But we can always hold our heads high and remain true to who we are.

**Ease and surrender**

The tree knows that fighting the wind will only break it, and rejecting the rain will only deprive it of its vital nourishment. Instead of fighting reality, it bends and yields.

A tree doesn't whine, or feel bad for itself. It chooses to hold still, and survive.

When we allow life to unfold without resisting and complaining, we can ease into change, and emerge much stronger than we've ever been.

The tree might consider the wind nature's leaf blower that's helping it shed the old in preparation for the new. We can view the pouring rain in our lives as a way of cleansing our minds and hearts before a fresh start.

**Elegance**

Nature is messy, and life is chaotic—not very elegant on the surface. But when we look at the bigger picture of creation, we see the graceful hands of energy and matter shaping stars and galaxies, and molding planets and moons.

There is equal elegance in the subtle waves of tranquil waters and the high monstrous waves crashing ashore.

*The rhythm of life that's been refined over billions of years beats in everything and everyone. We just need to tune in.*

**Faith and trust**

The inner knowing that all is unfolding as intended is what sustains life in all its forms. Grace manifests in the calm knowing that any challenge serves a purpose greater than its pain.

We [trust](/trusting-life/) that life will take care of our newborns as much as a tree trusts that there will be spring after winter.

Grace—the calm yet ceaseless resilience—is what gets us to pull through, pick ourselves up, and try again.

Life is messy and changeable. It doesn't unfold in neat packages. No matter what life throws at us, we can always choose grace.