text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
    <name>ModelExplorerDialog</name>
    <message>
        <source>Model explorer</source>
        <extracomment>1.0</extracomment>
        <translation>Model explorer</translation>
    </message>
</context>
<context>
    <name>QtBoolEdit</name>
    <message>
        <source>True</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>False</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtBoolPropertyManager</name>
    <message>
        <source>True</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>False</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtCharEdit</name>
    <message>
        <source>Clear Char</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtColorEditWidget</name>
    <message>
        <source>...</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtColorPropertyManager</name>
    <message>
        <source>Red</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Green</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Blue</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Alpha</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtCursorDatabase</name>
    <message>
        <source>Arrow</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Up Arrow</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Cross</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Wait</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>IBeam</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Size Vertical</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Size Horizontal</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Size Backslash</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Size Slash</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Size All</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Blank</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Split Vertical</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Split Horizontal</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Pointing Hand</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Forbidden</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Open Hand</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Closed Hand</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>What's This</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Busy</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtFontEditWidget</name>
    <message>
        <source>...</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Select Font</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtFontPropertyManager</name>
    <message>
        <source>Family</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Point Size</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Bold</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Italic</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Underline</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Strikeout</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Kerning</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtKeySequenceEdit</name>
    <message>
        <source>Clear Shortcut</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtLocalePropertyManager</name>
    <message>
        <source>%1, %2</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Language</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Country</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtPointFPropertyManager</name>
    <message>
        <source>(%1, %2)</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>X</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Y</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtPointPropertyManager</name>
    <message>
        <source>(%1, %2)</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>X</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Y</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtPropertyBrowserUtils</name>
    <message>
        <source>[%1, %2, %3] (%4)</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>[%1, %2]</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtRectFPropertyManager</name>
    <message>
        <source>[(%1, %2), %3 x %4]</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>X</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Y</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Width</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Height</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtRectPropertyManager</name>
    <message>
        <source>[(%1, %2), %3 x %4]</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>X</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Y</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Width</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Height</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtSizeFPropertyManager</name>
    <message>
        <source>%1 x %2</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Width</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Height</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtSizePolicyPropertyManager</name>
    <message>
        <source><Invalid></source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>[%1, %2, %3, %4]</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Horizontal Policy</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Vertical Policy</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Horizontal Stretch</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Vertical Stretch</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtSizePropertyManager</name>
    <message>
        <source>%1 x %2</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Width</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>Height</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>QtTreePropertyBrowser</name>
    <message>
        <source>Property</source>
        <translation>Property</translation>
    </message>
    <message>
        <source>Value</source>
        <translation>Value</translation>
    </message>
</context>
<context>
    <name>me_materialLayer</name>
    <message>
        <source>noMaterial</source>
        <translation>No material</translation>
    </message>
    <message>
        <source>material</source>
        <translation>Material</translation>
    </message>
</context>
<context>
    <name>me_materials</name>
    <message>
        <source>No material</source>
        <translation>No material</translation>
    </message>
</context>
<context>
    <name>me_mo</name>
    <message>
        <source>overallHeight</source>
        <translation>Height, mm</translation>
    </message>
    <message>
        <source>overallWidth</source>
        <translation>Width, mm</translation>
    </message>
    <message>
        <source>perimeter</source>
        <translation>Perimeter, mm</translation>
    </message>
    <message>
        <source>area</source>
        <translation>Area, m²</translation>
    </message>
    <message>
        <source>innerSurfaceArea</source>
        <translation>Inner surface area, m²</translation>
    </message>
    <message>
        <source>innerSurfaceInternalArea</source>
        <translation>Inner surface internal area, m²</translation>
    </message>
    <message>
        <source>innerSurfaceExternalArea</source>
        <translation>Inner surface external area, m²</translation>
    </message>
    <message>
        <source>thickness</source>
        <translation>Thickness, mm / Depth, mm</translation>
    </message>
    <message>
        <source>length</source>
        <translation>Length, mm</translation>
    </message>
    <message>
        <source>width</source>
        <translation>Width, mm</translation>
    </message>
    <message>
        <source>height</source>
        <translation>Height, mm</translation>
    </message>
    <message>
        <source>volume</source>
        <translation>Volume cut by the opening, m³</translation>
    </message>
    <message>
        <source>netVolume</source>
        <translation>Net volume, m³</translation>
    </message>
    <message>
        <source>mass</source>
        <translation>Mass, kg</translation>
    </message>
    <message>
        <source>crossSectionOverallHeight</source>
        <translation>Cross section overall height, mm</translation>
    </message>
    <message>
        <source>crossSectionArea</source>
        <translation>Cross section area, m²</translation>
    </message>
    <message>
        <source>outerSurfaceArea</source>
        <translation>Outer surface area, m²</translation>
    </message>
    <message>
        <source>netArea</source>
        <translation>Area, m² / Top surface area, m²</translation>
    </message>
    <message>
        <source>netFloorArea</source>
        <translation>Net floor area, m²</translation>
    </message>
    <message>
        <source>netFootprintArea</source>
        <translation>Footprint area, m²</translation>
    </message>
    <message>
        <source>netSideArea</source>
        <translation>Side area, m²</translation>
    </message>
    <message>
        <source>totalSurfaceArea</source>
        <translation>Surface area, m²</translation>
    </message>
    <message>
        <source>grossVolume</source>
        <translation>Gross volume, m³</translation>
    </message>
    <message>
        <source>grossFloorArea</source>
        <translation>Gross floor area, m²</translation>
    </message>
    <message>
        <source>grossPerimeter</source>
        <translation>Perimeter, mm</translation>
    </message>
    <message>
        <source>numberOfRiser</source>
        <translation>Number of riser</translation>
    </message>
    <message>
        <source>numberOfTreads</source>
        <translation>Number of treads</translation>
    </message>
    <message>
        <source>riserHeight</source>
        <translation>Riser height, mm</translation>
    </message>
    <message>
        <source>treadLength</source>
        <translation>Tread length, mm</translation>
    </message>
    <message>
        <source>overallLength</source>
        <translation>Length, mm</translation>
    </message>
    <message>
        <source>angle_dimension</source>
        <translation>rad</translation>
    </message>
    <message>
        <source>length_dimension</source>
        <translation>mm</translation>
    </message>
    <message>
        <source>nominalArea</source>
        <translation>Nominal area, m²</translation>
    </message>
    <message>
        <source>crossSectionOverallWidth</source>
        <translation>Cross section overall width, mm</translation>
    </message>
    <message>
        <source>logical_false</source>
        <translation>No</translation>
    </message>
    <message>
        <source>logical_true</source>
        <translation>Yes</translation>
    </message>
    <message>
        <source>logical_indeterminate</source>
        <translation>Unknown</translation>
    </message>
    <message>
        <source>m2</source>
        <translation>m²</translation>
    </message>
    <message>
        <source>m3</source>
        <translation>m³</translation>
    </message>
    <message>
        <source>kg</source>
        <translation>kg</translation>
    </message>
</context>
<context>
    <name>me_modelObjects</name>
    <message>
        <source>Columns</source>
        <translation>Columns</translation>
    </message>
    <message>
        <source>Floors</source>
        <translation>Floors</translation>
    </message>
    <message>
        <source>Openings</source>
        <translation>Openings</translation>
    </message>
    <message>
        <source>Roofs</source>
        <translation>Roofs</translation>
    </message>
    <message>
        <source>Beams</source>
        <translation>Beams</translation>
    </message>
    <message>
        <source>Stairs</source>
        <translation>Stairs</translation>
    </message>
    <message>
        <source>Ramps</source>
        <translation>Ramps</translation>
    </message>
    <message>
        <source>Windows</source>
        <translation>Windows</translation>
    </message>
    <message>
        <source>Doors</source>
        <translation>Doors</translation>
    </message>
    <message>
        <source>Railings</source>
        <translation>Railings</translation>
    </message>
    <message>
        <source>Walls</source>
        <translation>Walls</translation>
    </message>
    <message>
        <source>Rooms</source>
        <translation>Rooms</translation>
    </message>
    <message>
        <source>Isolated foundations</source>
        <translation>Isolated foundations</translation>
    </message>
    <message>
        <source>Wall foundations</source>
        <translation>Wall foundations</translation>
    </message>
    <message>
        <source>Assembly instances</source>
        <translation>Assembly Instances</translation>
    </message>
    <message>
        <source>Elements</source>
        <translation>Elements</translation>
    </message>
    <message>
        <source>Equipment</source>
        <translation>Equipment</translation>
    </message>
    <message>
        <source>PlumbingFixtures</source>
        <translation>Plumbing fixtures</translation>
    </message>
    <message>
        <source>PipeAccessories</source>
        <translation>Pipe accessories</translation>
    </message>
    <message>
        <source>PipeFittings</source>
        <translation>Pipe fittings</translation>
    </message>
    <message>
        <source>Pipes</source>
        <translation>Pipes</translation>
    </message>
    <message>
        <source>OtherObjectGroup</source>
        <translation>Other</translation>
    </message>
    <message>
        <source>Routes</source>
        <translation>Routes</translation>
    </message>
    <message>
        <source>RoutePoints</source>
        <translation>Route points</translation>
    </message>
    <message>
        <source>Plates</source>
        <translation>Plates</translation>
    </message>
    <message>
        <source>Axes</source>
        <translation>Axes</translation>
    </message>
    <message>
        <source>Elevations</source>
        <translation>Elevations</translation>
    </message>
    <message>
        <source>Sections</source>
        <translation>Sections</translation>
    </message>
    <message>
        <source>AirDucts</source>
        <translation>Air ducts</translation>
    </message>
    <message>
        <source>Lines3D</source>
        <translation>Lines</translation>
    </message>
    <message>
        <source>Rebars</source>
        <translation>Rebars</translation>
    </message>
    <message>
        <source>Hatches</source>
        <translation>Hatches</translation>
    </message>
    <message>
        <source>TextShapes</source>
        <translation>Text shapes</translation>
    </message>
    <message>
        <source>Dimensions</source>
        <translation>Dimensions</translation>
    </message>
    <message>
        <source>AirAccessories</source>
        <translation>Air accessories</translation>
    </message>
    <message>
        <source>AirFittings</source>
        <translation>Air fittings</translation>
    </message>
    <message>
        <source>LineElectricalCircuits</source>
        <translation>Line electrical circuits</translation>
    </message>
    <message>
        <source>AirEquipment</source>
        <translation>Air equipment</translation>
    </message>
    <message>
        <source>LightFixtures</source>
        <translation>Light fixtures</translation>
    </message>
    <message>
        <source>DistributionBoards</source>
        <translation>Distribution boards</translation>
    </message>
    <message>
        <source>WiringAccessories</source>
        <translation>Wiring accessories</translation>
    </message>
</context>
<context>
    <name>me_propertyView</name>
    <message>
        <source>Calculated characteristics</source>
        <translation>Calculated characteristics</translation>
    </message>
    <message>
        <source>refresh</source>
        <translation>Refresh plugin</translation>
    </message>
    <message>
        <source>visible</source>
        <translation>Unhide object</translation>
    </message>
    <message>
        <source>hidden</source>
        <translation>Hide object</translation>
    </message>
    <message>
        <source>category</source>
        <translation>By category</translation>
    </message>
    <message>
        <source>list</source>
        <translation>In alphabet order</translation>
    </message>
    <message>
        <source>show</source>
        <translation>Show object</translation>
    </message>
    <message>
        <source>Parameters</source>
        <translation>Parameters</translation>
    </message>
    <message>
        <source>Properties</source>
        <translation>Properties</translation>
    </message>
</context>
<context>
    <name>me_reinforcement</name>
    <message>
        <source>name</source>
        <translation>Name</translation>
    </message>
    <message>
        <source>totalRebarLength</source>
        <translation>Total reinforcement rebar length, mm</translation>
    </message>
    <message>
        <source>totalRebarMass</source>
        <translation>Total reinforcement rebar mass, kg</translation>
    </message>
    <message>
        <source>reinforcementUnitCount</source>
        <translation>Reinforcement unit count</translation>
    </message>
    <message>
        <source>nominalLength</source>
        <translation>Nominal length</translation>
    </message>
    <message>
        <source>count</source>
        <translation>Count</translation>
    </message>
</context>
</TS>


text:
Expectations for DNS Seed operators
====================================

PandaPay Core attempts to minimize the level of trust in DNS seeds,
but DNS seeds still pose a small amount of risk for the network.
As such, DNS seeds must be run by entities which have some minimum
level of trust within the PandaPay community.

Other implementations of PandaPay software may also use the same
seeds and may be more exposed. In light of this exposure, this
document establishes some basic expectations for operating dnsseeds.

0. A DNS seed operating organization or person is expected to follow good
host security practices, maintain control of applicable infrastructure,
and not sell or transfer control of the DNS seed. Any hosting services
contracted by the operator are equally expected to uphold these expectations.

1. The DNS seed results must consist exclusively of fairly selected and
functioning PandaPay nodes from the public network to the best of the
operator's understanding and capability.

2. For the avoidance of doubt, the results may be randomized but must not
single-out any group of hosts to receive different results unless due to an
urgent technical necessity and disclosed.

3. The results may not be served with a DNS TTL of less than one minute.

4. Any logging of DNS queries should be only that which is necessary
for the operation of the service or urgent health of the PandaPay
network and must not be retained longer than necessary nor disclosed
to any third party.

5. Information gathered as a result of the operators node-spidering
(not from DNS queries) may be freely published or retained, but only
if this data was not made more complete by biasing node connectivity
(a violation of expectation (1)).

6. Operators are encouraged, but not required, to publicly document the
details of their operating practices.

7. A reachable email contact address must be published for inquiries
related to the DNS seed operation.

If these expectations cannot be satisfied the operator should
discontinue providing services and contact the active PandaPay
Core development team as well as posting on
[bitcoin-dev](https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev).

Behavior outside of these expectations may be reasonable in some
situations but should be discussed in public in advance.

See also
----------
- [bitcoin-seeder](https://github.com/sipa/bitcoin-seeder) is a reference implementation of a DNS seed.

redpajama_set_name: RedPajamaGithub


text:
feature 'Reviews', :js do
  given!(:someone) { create(:user, email: 'ryan@spree.com') }
  given!(:review) { create(:review, :approved, user: someone) }

  background do
    Spree::Reviews::Config.include_unapproved_reviews = false
  end

  context 'product with no review' do
    given!(:product_no_reviews) { create(:product) }
    scenario 'informs that no reviews has been written yet' do
      visit spree.product_path(product_no_reviews)
      expect(page).to have_text Spree.t(:no_reviews_available)
    end

    # Regression test for #103
    context 'shows correct number of previews' do
      background do
        create_list :review, 3, product: product_no_reviews, approved: true
        Spree::Reviews::Config[:preview_size] = 2
      end

      scenario 'displayed reviews are limited by the set preview size' do
        visit spree.product_path(product_no_reviews)
        expect(page.all('.review').count).to be(2)
      end
    end
  end

  context 'when anonymous user' do
    background do
      Spree::Reviews::Config.require_login = true
    end

    context 'visit product with review' do
      background do
        visit spree.product_path(review.product)
      end

      scenario 'can see review title' do
        expect(page).to have_text review.title
      end

      scenario 'can see a prompt to review' do
        expect(page).to have_text Spree.t(:write_your_own_review)
      end
    end
  end

  context 'when logged in user' do
    given!(:user) { create(:user) }

    background do
      sign_in_as! user
    end

    context 'visit product with review' do
      background do
        reset_spree_preferences
        visit spree.product_path(review.product)
      end

      scenario 'can see review title' do
        expect(page).to have_text review.title
      end

      scenario 'can see create new review button' do
        expect(page).to have_text Spree.t(:write_your_own_review)
      end

      scenario 'can create new review' do
        click_on Spree.t(:write_your_own_review)

        expect(page).to have_text Spree.t(:leave_us_a_review_for, name: review.product.name)
        expect(page).not_to have_text 'Show Identifier'

        within '#new_review' do
          click_star(3)

          fill_in 'review_name', with: user.email
          fill_in 'review_title', with: 'Great product!'
          fill_in 'review_review', with: 'Some big review text..'
          click_on 'Submit your review'
        end

        expect(page).to have_text Spree.t(:review_successfully_submitted)
        expect(page).not_to have_text 'Some big review text..'
      end
    end
  end

  context 'visits product with review where show_identifier is false' do
    given!(:user) { create(:user) }
    given!(:review) { create(:review, :approved, :hide_identifier, review: 'review text', user: user) }

    background do
      visit spree.product_path(review.product)
    end

    scenario 'show anonymous review' do
      expect(page).to have_text Spree.t(:anonymous)
      expect(page).to have_text 'review text'
    end
  end

  private

  def sign_in_as!(user)
    visit spree.login_path
    within '#new_spree_user' do
      fill_in 'Email', with: user.email
      fill_in 'Password', with: user.password
    end
    click_button 'Login'
  end

  def click_star(num)
    page.all(:xpath, "//a[@title='#{num} stars']")[0].click
  end
end


text:
package org.forestguardian.Helpers;

/**
 * Created by luisalonsomurillorojas on 1/4/17.
 */

public interface IContants {
    public static final int EARTH_RADIUS = 6371;//In kilometers
    public static final int GEO_CONST = 111320;
    public static final int GEO_CONST_2 = 110540;
    public static final String OVERPASS_REQUEST_FORMAT_AND_TIMEOUT = "[out:json][timeout:30]";
    public static final String OSM_FIRESTATION_AMENITY = "fire_station";
    public static final String OSM_RIVERS_WATERWAY = "river";
    //MODIS keys
    public static final String MODIS_LATITUDE = "LATITUDE";
    public static final String MODIS_LONGITUDE = "LONGITUDE";
    public static final String MODIS_BRIGHTNESS = "BRIGHTNESS";
    public static final String MODIS_SCAN = "SCAN";
    public static final String MODIS_TRACK = "TRACK";
    public static final String MODIS_ACQ_DATE = "ACQ_DATE";
    public static final String MODIS_ACQ_TIME = "ACQ_TIME";
    public static final String MODIS_SATELLITE = "SATELLITE";
    public static final String MODIS_CONFIDENCE = "CONFIDENCE";
    public static final String MODIS_VERSION = "VERSION";
    public static final String MODIS_BRIGHT_T31 = "BRIGHT_T31";
    public static final String MODIS_FRP = "FRP";
    public static final String MODIS_DAYNIGHT = "DAYNIGHT";
    //Basemaps
    public static final String FIRE_BASEMAP = "/maps/fires";
    public static final String TEMPERATURE_BASEMAP = "/maps/weather_perspective";
    public static final String WIND_BASEMAP = "/maps/windy";
    public static final String FOREST_BASEMAP = "/maps/forests";
    public static final String PRECIPITATION_BASEMAP = "/maps/protected_area";
    public static final String ADD_FIRE_BASEMAP = "javascript:showFiresLayer()";
    public static final String REMOVE_FIRE_BASEMAP = "javascript:hideFiresLayer()";
    public static final String ADD_TEMPERATURE_BASEMAP = "javascript:showWeatherLayer()";
    public static final String REMOVE_TEMPERATURE_BASEMAP = "javascript:hideWeatherLayer()";
    public static final String ADD_WIND_BASEMAPP = "javascript:showWindsLayer()";
    public static final String REMOVE_WIND_BASEMAP = "javascript:hideWindsLayer()";
    public static final String ADD_FOREST_BASEMAP = "javascript:showForestLayer()";
    public static final String REMOVE_FOREST_BASEMAP = "javascript:hideForestLayer()";

}


text:
            <form  class="ui fluid form segment" ng-submit="signIn()" data-ng-class="{ 'loading': loading, 'error': authError }">

Erreur !

{{ authError }}

                        Username

                            <input type="text" placeholder="Username" ng-model="user.username" required>

                        Password

                            <input type="password" placeholder="Password" ng-model="user.pwd" required>

                    <button class="positive ui button sixteen wide field">
                        Connect
                    </button>

            </form>


text:
package com.bearchoke.platform.domain.search.repository;

import com.bearchoke.platform.domain.search.dto.Location;

import java.util.List;

/**
 * Created by Bjorn Harvold
 * Date: 2/26/15
 * Time: 3:55 PM
 * Responsibility:
 */
public interface LocationRepository {
    List<Location> locationSearch(String userInput);
}


text:
import { factory } from '../../utils/factory.js'
import { combinationsNumber } from '../../plain/number/combinations.js'

const name = 'combinations'
const dependencies = ['typed']

export const createCombinations = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {
  /**
   * Compute the number of ways of picking `k` unordered outcomes from `n`
   * possibilities.
   *
   * Combinations only takes integer arguments.
   * The following condition must be enforced: k <= n.
   *
   * Syntax:
   *
   *     math.combinations(n, k)
   *
   * Examples:
   *
   *    math.combinations(7, 5) // returns 21
   *
   * See also:
   *
   *    combinationsWithRep, permutations, factorial
   *
   * @param {number | BigNumber} n    Total number of objects in the set
   * @param {number | BigNumber} k    Number of objects in the subset
   * @return {number | BigNumber}     Number of possible combinations.
   */
  return typed(name, {
    'number, number': combinationsNumber,

    'BigNumber, BigNumber': function (n, k) {
      const BigNumber = n.constructor
      let result, i
      const nMinusk = n.minus(k)
      const one = new BigNumber(1)

      if (!isPositiveInteger(n) || !isPositiveInteger(k)) {
        throw new TypeError('Positive integer value expected in function combinations')
      }
      if (k.gt(n)) {
        throw new TypeError('k must be less than n in function combinations')
      }

      result = one
      if (k.lt(nMinusk)) {
        for (i = one; i.lte(nMinusk); i = i.plus(one)) {
          result = result.times(k.plus(i)).dividedBy(i)
        }
      } else {
        for (i = one; i.lte(k); i = i.plus(one)) {
          result = result.times(nMinusk.plus(i)).dividedBy(i)
        }
      }

      return result
    }

    // TODO: implement support for collection in combinations
  })
})

/**
 * Test whether BigNumber n is a positive integer
 * @param {BigNumber} n
 * @returns {boolean} isPositiveInteger
 */
function isPositiveInteger (n) {
  return n.isInteger() && n.gte(0)
}


text:
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

from models import Base, CrawlPage
from data import CrawlSiteData, CrawlSiteListData

DEFAULT_ENGINE = 'sqlite:///:memory:'

class CrawlGraphManager(object):
    def __init__(self, engine=DEFAULT_ENGINE, autocommit=False, autoflush=False,
                 echo=False, drop_all_tables=False, clear_content=False):
        self.engine = create_engine(engine, echo=echo)
        if drop_all_tables:
            Base.metadata.drop_all(self.engine)
        Base.metadata.create_all(self.engine)
        self.Session = sessionmaker()
        self.Session.configure(bind=self.engine, autocommit=autocommit, autoflush=autoflush)
        self.session = self.Session()
        if clear_content:
            for name, table in Base.metadata.tables.items():
                self.session.execute(table.delete())

    @property
    def pages(self):
        return [page for page in CrawlPage.query(self.session).all()]

    @property
    def seeds(self):
        return self.session.query(CrawlPage).filter_by(is_seed=True).all()

    def add_page(self, url, status=200, n_redirects=0, is_seed=False, commit=True):
        page, created = CrawlPage.get_or_create(self.session, url=url)
        if created:
            page.is_seed = is_seed
        page.status = status
        page.n_redirects = n_redirects
        if commit:
            self.session.commit()
        return page

    def add_link(self, page, url, commit=True, status=200):
        link_page, created = CrawlPage.get_or_create(self.session, url=url)
        if created:
            link_page.status = status
        if link_page not in page.links:
            page.links.append(link_page)
        if commit:
            self.session.commit()
        return link_page

    def get_page(self, url):
        return self.session.query(CrawlPage).filter_by(url=url).first()

    def add_site(self, site, default_status=200, default_n_redirects=0):
        pages = site.pages if isinstance(site, CrawlSiteData) else site
        for i, (info, links) in enumerate(pages):
            if isinstance(info, tuple):
                if len(info) == 2:
                    status, page_url, n_redirects = (info[0], info[1], default_n_redirects)
                else:
                    status, page_url, n_redirects = info
            else:
                status, page_url, n_redirects = (default_status, info, default_n_redirects)
            page = self.add_page(url=page_url, status=status, n_redirects=n_redirects, is_seed=(i == 0))
            for link_url in links:
                self.add_link(page=page, url=link_url, status=default_status)

    def add_site_list(self, graph, default_status=200, default_n_redirects=0):
        sites = graph.sites if isinstance(graph, CrawlSiteListData) else graph
        for site in sites:
            self.add_site(site=site, default_status=default_status, default_n_redirects=default_n_redirects)

    def save(self):
        self.session.commit()

    def render(self, filename, label='', labelloc='t', labeljust='c',
               rankdir="TB", ranksep=0.7,
               fontname='Arial', fontsize=24,
               use_urls=False,
               node_fixedsize='true', nodesep=0.1, node_width=0.85, node_height=0.85, node_fontsize=15,
               include_ids=False):
        import pydot

        # Graph
        graph_args = {
            "rankdir": rankdir,
            "ranksep": ranksep,
            "nodesep": nodesep,
            "fontname": fontname,
            "fontsize": fontsize,
        }
        if label:
            graph_args.update({
                "labelloc": labelloc,
                "labeljust": labeljust,
                "label": label
            })
        graph = pydot.Dot(**graph_args)

        # Node
        node_args = {
            "fontsize": node_fontsize,
        }
        if use_urls:
            node_seed_shape = 'rectangle'
            node_shape = 'oval'
        else:
            node_seed_shape = 'square'
            node_shape = 'circle'
            node_args.update({
                "fixedsize": node_fixedsize,
                "width": node_width,
                "height": node_height,
            })

        graph.set_node_defaults(**node_args)
        for page in self.pages:
            graph.add_node(pydot.Node(name=self._clean_page_name(page, include_id=include_ids),
                                      fontname=fontname,
                                      fontsize=node_fontsize,
                                      shape=node_seed_shape if page.is_seed else node_shape))
            for link in page.links:
                graph.add_edge(pydot.Edge(self._clean_page_name(page, include_id=include_ids),
                                          self._clean_page_name(link, include_id=include_ids)))
        graph.write_png(filename)

    def _clean_page_name(self, page, include_id):
        cleaned_name = page.url
        cleaned_name = cleaned_name.replace('http://', '')
        cleaned_name = cleaned_name.replace('https://', '')
        if include_id:
            cleaned_name = "%d. %s" % (page.id, cleaned_name)
        return cleaned_name


text:
function annotation(anno_id) {

    // *******************************************
    // Private variables:
    // *******************************************

    this.pts_x = new Array();
    this.pts_y = new Array();

    this.is_selected;
    this.graphics = null;
    this.all_lines = null;
    this.first_point = null;
    this.anno_id = anno_id;
    //   this.div_attach = 'moz_canvas';
    this.div_attach = 'myCanvas_bg';
    this.lastx = -1;
    this.lasty = -1;
    this.CloseErrorFlag = 0;

    // This array stores graphics objects for each control point
    this.control_points = new Array();
    this.selectedControlPoint = -1;
    this.center_point = 0;
    this.center_x;
    this.center_y;

    // *******************************************
    // Public methods:
    // *******************************************

    this.GetObjName = function () {
        return $(LM_xml).children("annotation").children("object").eq(this.anno_id).children("name").text();
    };

    this.GetUsername = function () {
        return $(LM_xml).children("annotation").children("object").eq(this.anno_id).children("polygon").children("username").text();
    };

    this.GetAutomatic = function() {
        if($(LM_xml).children("annotation").children("object").eq(this.anno_id).children("automatic").length > 0) {
            return parseInt($(LM_xml).children("annotation").children("object").eq(this.anno_id).children("automatic").text());
        }
        return 0;
    };

    this.GetDeleted = function () {
        return parseInt($(LM_xml).children("annotation").children("object").eq(this.anno_id).children("deleted").text());
    };

    this.GetVerified = function () {
        return parseInt($(LM_xml).children("annotation").children("object").eq(this.anno_id).children("verified").text());
    };

    this.GetOccluded = function() {
        return $(LM_xml).children("annotation").children("object").eq(this.anno_id).children("occluded").text();
    };

    this.GetAttributes = function() {
        return $(LM_xml).children("annotation").children("object").eq(this.anno_id).children("attributes").text();
    };

    this.GetParts = function() {
        parts = [];
        if ($(LM_xml).children("annotation").children("object").eq(this.anno_id).children("parts").length>0) {
            tmp = $(LM_xml).children("annotation").children("object").eq(this.anno_id).children("parts").children("hasparts").text();
            if (tmp.length>0) {
                // if it is not empty, split and trasnform to numbers
                parts = tmp.split(",");
                for (var j=0; j<parts.length; j++) {parts[j] = parseInt(parts[j], 10);}
            }
        }
        return parts;
    };

    this.SetDivAttach = function(da) {
        this.div_attach = da;
    };

    this.GetAnnoID = function () {
        return this.anno_id;
    };

    // Get the array of X control points.
    this.GetPtsX = function () {
        return this.pts_x;
    };

    this.CreatePtsX = function (numpts) {
        this.pts_x = Array(numpts);
    };

    // Get the array of Y control points.
    this.GetPtsY = function () {
        return this.pts_y;
    };

    this.CreatePtsY = function (numpts) {
        this.pts_y = Array(numpts);
    };

    // Refresh last control point (set to be the last entered control point):
    this.RefreshLastControlPoint = function () {
        this.lastx = this.pts_x[this.pts_x.length-1];
        this.lasty = this.pts_y[this.pts_y.length-1];
    };

    // Select this polygon.
    this.SelectPoly = function () {
        this.is_selected = 1;
    };

    // Unselect this polygon.
    this.UnselectPoly = function () {
        this.is_selected = 0;
    };

    // Draws first control point of a new polygon.
    this.AddFirstControlPoint = function (x,y) {
        var im_ratio = main_image.GetImRatio();
        x = Math.round(x/im_ratio);
        y = Math.round(y/im_ratio);

        // 7.31.06 - disallow making a point at x=1. move it to x=2 instead.
        // This is because where there are points at x=1, there are lines
        // missing.
        if(x==1) x=2;

        this.pts_x.push(x);
        this.pts_y.push(y);

        this.lastx = x;
        this.lasty = y;
    };

    // Adds a new control point to the polygon.
    this.AddControlPoint = function (x,y) {
        if(this.CloseErrorFlag) {
            this.CloseErrorFlag = 0;
            return;
        }
        x = Math.round(x/main_image.GetImRatio());
        y = Math.round(y/main_image.GetImRatio());

        // 7.31.06 - disallow making a point at x=1. move it to x=2 instead.
        // This is because where there are points at x=1, there are lines
        // missing.
        if(x==1) {
            x=2;
        }

        this.pts_x.push(x);
        this.pts_y.push(y);

        if(!this.all_lines) this.all_lines = Array();

        var line_idx = this.all_lines.length;
        var color = '#0000ff'; // blue
        this.all_lines.push(new graphics(this.div_attach,
                                         'sGraphics'+this.anno_id+'_'+line_idx));
        this.all_lines[line_idx].DrawLineSegment(this.lastx,this.lasty,x,y,
                                                 main_image.GetImRatio(),color);
        this.all_lines[line_idx].SetAttribute('style','cursor:crosshair;');

        // Move the first control point to be on top of any drawn lines.
        this.first_point.MoveToTop();

        this.lastx = x;
        this.lasty = y;
    };

    // Closes the polygon.  Returns 1 if close was successful, 0 otherwise.
    this.ClosePolygon = function () {
      this.lastx = -1;
      this.lasty = -1;
      return 1;
    };

    // Set attribute of drawn polygon.
    this.SetAttribute = function(field,value) {
      this.graphics.SetAttribute(field,value);
    };

    // Draw a polygon given this annotation's control points.
    this.DrawPolygon = function (im_ratio) {
      if(!this.graphics) {
	this.graphics = new graphics(this.div_attach,'sGraphics'+this.anno_id);
      }

      // Determine if an angle has been labeled:
      var strtok = this.GetObjName().split(/ /);
      var isAngle = 0;
      for(var i = 0; i < strtok.length; i++) {
	if(strtok[i]=='angle') isAngle = 1;
      }

      if(this.GetPtsX().length==1) {
	this.graphics.DrawFlag(Math.round(this.GetPtsX()[0]*im_ratio),
			       Math.round(this.GetPtsY()[0]*im_ratio));
      }
      else if((this.GetPtsX().length==3) && isAngle) {
	this.graphics.DrawPolyLine(this.GetPtsX(),this.GetPtsY(),this.getObjectColor(this.anno_id),im_ratio);
      }
      else if(this.GetAutomatic()==1) {
	this.graphics.DrawDashedPolygon(this.GetPtsX(),this.GetPtsY(),
					this.getObjectColor(this.anno_id),im_ratio,this.GetObjName());
      }
      else {
	this.graphics.DrawPolygon(this.GetPtsX(),this.GetPtsY(),
				  this.getObjectColor(this.anno_id),im_ratio,this.GetObjName());
      }
    };

    // Draw a poly-line given this annotation's control points (i.e.
    // don't connect the last point to the first point).  This function
    // is used when we zoom.
    this.DrawPolyLine = function (im_ratio) {
      var im_ratio = main_image.GetImRatio();
      this.SelectPoly();

        var color = '#0000ff'; // blue
        var im_ratio = main_image.GetImRatio();
        if(!this.all_lines) this.all_lines = Array();
        else {
            for(var i = 0; i < this.all_lines.length; i++) {
                this.all_lines[i].ClearDrawing();
            }
            this.all_lines = Array();
        }
        for(var i = 0; i < this.pts_x.length-1; i++) {
            this.all_lines.push(new graphics(this.div_attach,'sGraphics'+this.anno_id+'_'+(i-1)));
            this.all_lines[i].DrawLineSegment(this.pts_x[i],this.pts_y[i],
                                              this.pts_x[i+1],this.pts_y[i+1],
                                              im_ratio,color);
            this.all_lines[i].SetAttribute('style','cursor:crosshair;');
        }

        if(this.first_point) {
            this.first_point.ClearDrawing();
        }
        this.first_point = new graphics(this.div_attach,'first_point');
        this.first_point.DrawPoint(Math.round(this.pts_x[0]*im_ratio),
                                   Math.round(this.pts_y[0]*im_ratio),'#00ff00',6);

        this.first_point.SetAttribute('onmousedown','var event=new Object(); event.button=2;main_handler.DrawCanvasMouseDown(event);');
        this.first_point.SetAttribute('onmouseover','main_handler.MousedOverFirstControlPoint();');
        //       this.first_point.SetAttribute('onmousedown','var event=new Object(); event.button=2;parent.main_handler.DrawCanvasMouseDown(event);');
        //       this.first_point.SetAttribute('onmouseover','parent.main_handler.MousedOverFirstControlPoint();');

	// Refresh last control point:
	this.RefreshLastControlPoint();
    };

    // Deletes the annotation's polygon from the screen.
    this.DeletePolygon = function () {
        if(this.graphics) {
            this.graphics.ClearDrawing();
            this.graphics = null;
        }
        this.RemoveFirstPoint();
        this.RemoveAllLines();
        this.RemoveControlPoints();
        this.RemoveCenterOfMass();
    };

    // Deletes the last control point that the user entered.
    this.DeleteLastControlPoint = function () {
        if(this.pts_x.length>1) {
            if(this.all_lines) {
                var l = this.all_lines.length;
                this.all_lines[l-1].ClearDrawing();
                this.all_lines = this.all_lines.slice(0,l-1);
            }
            else {
                this.all_lines[0].ClearDrawing();
                this.all_lines = null;
            }
            this.ShortenPts();
            return 1;
        }
        return 0;
    };

    // Fill the interior of the polygon.
    this.FillPolygon = function () {
      if(this.graphics) this.graphics.FillPolygon();
    };

    // Unfill the interior of the polygon.
    this.UnfillPolygon = function () {
      if(this.graphics) this.graphics.UnfillPolygon();
    };

    // When you move the mouse over the first control point, then make it
    // bigger to indicate it should be clicked on.  Do this if two or more
    // lines have been drawn.
    this.MouseOverFirstPoint = function () {
        //     if(this.pts_x.length>=3) {
        if(this.pts_x.length>=2) { // Allow users to annotate lines
            var im_ratio = main_image.GetImRatio();
            this.RemoveFirstPoint();
            this.first_point = new graphics(this.div_attach,'first_point');
            this.first_point.DrawPoint(Math.round(this.pts_x[0]*im_ratio),
                                       Math.round(this.pts_y[0]*im_ratio),'#00ff00',8);
            this.first_point.SetAttribute('onmousedown','var event=new Object(); event.button=2;main_handler.DrawCanvasMouseDown(event);');
            this.first_point.SetAttribute('onmouseout','main_handler.MousedOutFirstControlPoint();');
            // 	this.first_point.SetAttribute('onmousedown','var event=new Object(); event.button=2;parent.main_handler.DrawCanvasMouseDown(event);');
            // 	this.first_point.SetAttribute('onmouseout','parent.main_handler.MousedOutFirstControlPoint();');
            this.first_point.SetAttribute('style','cursor:pointer;');
        }
    };

    // When you move the mouse over the first control point, then make it
    // bigger to indicate it should be clicked on.  Do this if two or more
    // lines have been drawn.
    this.MouseOutFirstPoint = function () {
        var im_ratio = main_image.GetImRatio();
        this.RemoveFirstPoint();
        this.first_point = new graphics(this.div_attach,'first_point');
        this.first_point.DrawPoint(Math.round(this.pts_x[0]*im_ratio),
                                   Math.round(this.pts_y[0]*im_ratio),'#00ff00',6);
        this.first_point.SetAttribute('onmousedown','var event=new Object(); event.button=2;main_handler.DrawCanvasMouseDown(event);');
        this.first_point.SetAttribute('onmouseover','main_handler.MousedOverFirstControlPoint();');
        //       this.first_point.SetAttribute('onmousedown','var event=new Object(); event.button=2;parent.main_handler.DrawCanvasMouseDown(event);');
        //       this.first_point.SetAttribute('onmouseover','parent.main_handler.MousedOverFirstControlPoint();');
    };

    // This function shows all control points for an annotation it takes in
    // arrays of x and y points
    this.ShowControlPoints = function () {
        var im_ratio = main_image.GetImRatio();
        if(!this.control_points) this.control_points = new Array();
        for(i=0; i<this.pts_x.length; i++) {
            this.control_points.push(new graphics(this.div_attach,this.anno_id + ':ctrl_point#'+ i));
            this.control_points[i].DrawPoint(Math.round(this.pts_x[i]*im_ratio),Math.round(this.pts_y[i]*im_ratio),'#00ff00',5);
        }
    };

    this.StartMoveControlPoint = function (x,y,im_ratio) {
        var i = this.getNearestControlPoint(x,y,im_ratio);
        if(i>=0) {
            this.RemoveCenterOfMass();
            this.selectedControlPoint = i;
            this.MoveControlPoint(x,y,im_ratio);
            return 1;
        }
        return 0;
    };

    this.MoveControlPoint = function (x,y,im_ratio) {
        var i = this.selectedControlPoint;
        this.pts_x[i] = Math.round(x/im_ratio);
        this.pts_y[i] = Math.round(y/im_ratio);

        this.pts_x[i] = Math.max(Math.min(this.pts_x[i],main_image.width_orig),1);
        this.pts_y[i] = Math.max(Math.min(this.pts_y[i],main_image.height_orig),1);

        // Adjust polygon:
        this.graphics.ClearDrawing();
        this.DrawPolygon(im_ratio);

        // Adjust control points:
        this.RemoveControlPoints();
        this.ShowControlPoints();
    };

    this.StartMoveCenterOfMass = function (x,y,im_ratio) {
        var d = Math.sqrt(Math.pow(Math.round(this.center_x*im_ratio)-x,2)+Math.pow(Math.round(this.center_y*im_ratio)-y,2));
        if(d<=4) {
            this.RemoveControlPoints();
            this.MoveCenterOfMass(x,y,im_ratio);
            return 1;
        }
        return 0;
    };

    this.MoveCenterOfMass = function(x,y,im_ratio) {
        var dx = Math.round(x/im_ratio)-this.center_x;
        var dy = Math.round(y/im_ratio)-this.center_y;

        // Adjust dx,dy to make sure we don't go outside of the image:
        for(i=0; i<this.pts_x.length; i++) {
            dx = Math.max(this.pts_x[i]+dx,1)-this.pts_x[i];
            dy = Math.max(this.pts_y[i]+dy,1)-this.pts_y[i];
            dx = Math.min(this.pts_x[i]+dx,main_image.width_orig)-this.pts_x[i];
            dy = Math.min(this.pts_y[i]+dy,main_image.height_orig)-this.pts_y[i];
        }

        for(i=0; i<this.pts_x.length; i++) {
            this.pts_x[i] = Math.round(this.pts_x[i]+dx);
            this.pts_y[i] = Math.round(this.pts_y[i]+dy);
        }
        this.center_x = Math.round(im_ratio*(dx+this.center_x));
        this.center_y = Math.round(im_ratio*(dy+this.center_y));

        // Adjust polygon:
        this.graphics.ClearDrawing();
        this.DrawPolygon(im_ratio);

        // Adjust control points:
        this.RemoveControlPoints();
        this.ShowControlPoints();

        this.RemoveCenterOfMass();
        this.ShowCenterOfMass(im_ratio);
    };

    this.getNearestControlPoint = function (x,y,im_ratio) {
        var d = 4;
        var cpt = -1;
        for(i=0; i<this.pts_x.length; i++) {
            var j = Math.sqrt(Math.pow(Math.round(this.pts_x[i]*im_ratio)-x,2)+Math.pow(Math.round(this.pts_y[i]*im_ratio)-y,2));
            if(j<d) {
                d = j;
                cpt = i;
            }
        }
        return cpt;
    };

    this.centerOfMass = function () {
        var x = this.pts_x;
        var y = this.pts_y;
        var length = x.length;
        var mdpts_x = new Array();
        var mdpts_y = new Array();
        var lengths = new Array();

        if(length==1) {
            this.center_x = x[0];
            this.center_y = y[0];
            return;
        }

        for(i=1; i < length; i++) {
            mdpts_x[i-1] = Math.round((x[i-1] + x[i])/2);
            mdpts_y[i-1] = Math.round((y[i-1] + y[i])/2);
            lengths[i-1] = Math.round(Math.sqrt(Math.pow(x[i-1] - x[i], 2) +
                                                Math.pow(y[i-1] - y[i], 2)));
        }
        mdpts_x[length - 1] = Math.round((x[0] + x[length - 1])/2);
        mdpts_y[length - 1] = Math.round((y[0] + y[length - 1])/2);
        lengths[i-1] = Math.round(Math.sqrt(Math.pow(x[0] - x[length - 1], 2) +
                                            Math.pow(y[0] - y[length - 1], 2)));

        var sumlengths = 0;
        var length_l = lengths.length;
        for(i = 0; i < length_l; i++) {
            sumlengths = sumlengths + lengths[i];
        }

        this.center_x = 0;
        for(i = 0; i < length_l; i++) {
            this.center_x = this.center_x + mdpts_x[i]*lengths[i];
        }
        this.center_x = this.center_x / sumlengths;

        this.center_y = 0;
        for(i = 0; i < length_l; i++) {
            this.center_y = this.center_y + mdpts_y[i]*lengths[i];
        }
        this.center_y = this.center_y / sumlengths;
    };

    // This function shows the middle grab point for a polygon
    // the point to be shown is given as input
    this.ShowCenterOfMass = function(im_ratio) {
        this.centerOfMass();
        if(!this.center_point) {
            this.center_point = new graphics(this.div_attach,'center_point');
        }
        var MarkerSize = 8;
        if(this.pts_x.length==1) MarkerSize = 6;

        this.center_point.DrawPoint(Math.round(this.center_x*im_ratio),
                                    Math.round(this.center_y*im_ratio),'red',MarkerSize);
    };

    // This function removes the middle grab point for a polygon
    this.RemoveCenterOfMass = function() {
        if(this.center_point) {
            this.center_point.ClearDrawing();
            this.center_point = null;
        }
    };

    // Gets the (x,y) point where a popup bubble can be attached.
    this.GetPopupPoint = function () {
        var im_ratio = main_image.GetImRatio();
        var pt = Array(2);
        pt[0] = Math.round(this.pts_x[0]*im_ratio);
        pt[1] = Math.round(this.pts_y[0]*im_ratio);
        return pt;
    };

    // Returns the closest point to (x,y) that lies along the boundary of
    // the polygon.
    this.ClosestPoint = function (x,y) {
        var eps = 1e-3;
        var shortestDist = Infinity;
        var pt = new Array(3);
        var xs = this.pts_x;
        var ys = this.pts_y;
        var thisdist;

        for(var i=0, j=xs.length-1;i<xs.length;j=i,i++) {
            thisdist = this.dist(x,y,xs[j],ys[j]); //snap to nearby edges
            if(thisdist<shortestDist) {
                shortestDist = thisdist;
                pt[0] = xs[j];
                pt[1] = ys[j];
                pt[2] = thisdist;
            }

            var xi = xs[i], yi = ys[i];
            var xj = xs[j], yj = ys[j];

            var l = (xj-xi)*(xj-xi) + (yj-yi)*(yj-yi);
            var k = ((x-xi)*(xj-xi) + (y-yi)*(yj-yi))/l;
            var xt = k*(xj-xi)+xi;
            var yt = k*(yj-yi)+yi;

            if(Math.min(xi,xj)-eps <= xt && xt <= Math.max(xi,xj)+eps &&
               Math.min(yi,yj)-eps <= yt && yt <= Math.max(yi,yj)+eps) {
                thisdist = this.dist(x,y,xt,yt);
                if(thisdist<shortestDist) {
                    shortestDist = thisdist;
                    pt[0] = xt;
                    pt[1] = yt;
                    pt[2] = thisdist;
                }
            }
        }
        return pt;
    };

    // *******************************************
    // Private methods:
    // *******************************************

    this.RemoveFirstPoint = function () {
        if(this.first_point) {
            this.first_point.ClearDrawing();
            this.first_point = null;
        }
    };

    // Remove all lines.
    this.RemoveAllLines = function () {
        if(this.all_lines) {
            for(var i = 0; i < this.all_lines.length; i++) {
                this.all_lines[i].ClearDrawing();
            }
            this.all_lines = null;
        }
    };

    // This function removes all displayed control points from an annotation
    this.RemoveControlPoints = function () {
        if(this.control_points) {
            for(i=0; i<this.control_points.length; i++) {
                this.control_points[i].ClearDrawing();
            }
            this.control_points = null;
        }
    };

    this.charCodeAt = function (text,position) {
        var tmp = text.substring(position,position+1);
        for(var i=1;i<=255;i++) if(unescape('%'+i.toString(16)) == tmp) return i;
        return 0;
    };

    this.getObjectColor = function (p) {
        //if the polygon is still open, then its color should be blue.  (7.27.06)
        if(this.is_selected && (this.lastx!=-1)) return "#0000ff";
        if(this.GetDeleted()) return "#888888";

        //otherwise:
        var objectColors = new Array(14);
        objectColors[0] = "009900"; // good
        objectColors[1] = "00ff00"; // maybe
        objectColors[2] = "ccff00"; // good
        objectColors[3] = "ffff00"; // same as 2
        objectColors[4] = "ffcc00"; // maybe
        objectColors[5] = "ff9999"; // good
        objectColors[6] = "cc0033"; // maybe
        objectColors[7] = "ff33cc"; // good
        objectColors[8] = "9933ff"; // maybe
        objectColors[9] = "990099"; // bad
        objectColors[10] = "000099"; // bad
        objectColors[11] = "006699"; // bad
        objectColors[12] = "00ccff"; // good
        objectColors[13] = "999900"; // bad

        // case insensative hashing:
        var name = this.GetObjName().toUpperCase();
        var hash = 0;
        for(var i=0;i<name.length;i++) { //hash code based on name
            hash += this.charCodeAt(name,i);
        }
        hash = (((hash + 567) * 1048797) % 14); //pseudo-randomize
        return "#"+ objectColors[hash];
    };

    this.ShortenPts = function () {
        var l = this.pts_x.length;
        this.pts_x = this.pts_x.slice(0,l-1);
        this.pts_y = this.pts_y.slice(0,l-1);
        this.lastx = this.pts_x[l-2];
        this.lasty = this.pts_y[l-2];
    };

    // Compute the L2 distance between two Cartesian points.
    this.dist = function (x0,y0,x1,y1) {
        return Math.sqrt((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1));
    };
}


text:
SOURCE=appbuilds/releases/GitBook/win/
TITLE=GitBook
OUTPUT=appbuilds/releases/gitbook-win.zip

echo "Building Windows Release ZIP file: $OUTPUT"

cd ${SOURCE} && zip -ru ../../gitbook-win.zip ./*


text:
package org.apache.lucene.facet.taxonomy.directory;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.facet.FacetField;
import org.apache.lucene.facet.FacetTestCase;
import org.apache.lucene.facet.FacetsConfig;
import org.apache.lucene.facet.DrillDownQuery;
import org.apache.lucene.facet.taxonomy.FacetLabel;
import org.apache.lucene.facet.taxonomy.TaxonomyReader;
import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter.MemoryOrdinalMap;
import org.apache.lucene.facet.taxonomy.writercache.TaxonomyWriterCache;
import org.apache.lucene.facet.taxonomy.writercache.Cl2oTaxonomyWriterCache;
import org.apache.lucene.facet.taxonomy.writercache.LruTaxonomyWriterCache;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.SegmentInfos;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.store.AlreadyClosedException;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.TestUtil;
import org.junit.Test;

public class TestDirectoryTaxonomyWriter extends FacetTestCase {

  // A No-Op TaxonomyWriterCache which always discards all given categories, and
  // always returns true in put(), to indicate some cache entries were cleared.
  private static TaxonomyWriterCache NO_OP_CACHE = new TaxonomyWriterCache() {

    @Override
    public void close() {}
    @Override
    public int get(FacetLabel categoryPath) { return -1; }
    @Override
    public boolean put(FacetLabel categoryPath, int ordinal) { return true; }
    @Override
    public boolean isFull() { return true; }
    @Override
    public void clear() {}

  };

  @Test
  public void testCommit() throws Exception {
    // Verifies that nothing is committed to the underlying Directory, if
    // commit() wasn't called.
    Directory dir = newDirectory();
    DirectoryTaxonomyWriter ltw = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE_OR_APPEND, NO_OP_CACHE);
    assertFalse(DirectoryReader.indexExists(dir));
    ltw.commit(); // first commit, so that an index will be created
    ltw.addCategory(new FacetLabel("a"));

    IndexReader r = DirectoryReader.open(dir);
    assertEquals("No categories should have been committed to the underlying directory", 1, r.numDocs());
    r.close();
    ltw.close();
    dir.close();
  }

  @Test
  public void testCommitUserData() throws Exception {
    // Verifies taxonomy commit data
    Directory dir = newDirectory();
    DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE_OR_APPEND, NO_OP_CACHE);
    taxoWriter.addCategory(new FacetLabel("a"));
    taxoWriter.addCategory(new FacetLabel("b"));
    Map<String, String> userCommitData = new HashMap<>();
    userCommitData.put("testing", "1 2 3");
    taxoWriter.setCommitData(userCommitData);
    taxoWriter.close();
    DirectoryReader r = DirectoryReader.open(dir);
    assertEquals("2 categories plus root should have been committed to the underlying directory", 3, r.numDocs());
    Map <String, String> readUserCommitData = r.getIndexCommit().getUserData();
    assertTrue("wrong value extracted from commit data",
        "1 2 3".equals(readUserCommitData.get("testing")));
    assertNotNull(DirectoryTaxonomyWriter.INDEX_EPOCH + " not found in commitData", readUserCommitData.get(DirectoryTaxonomyWriter.INDEX_EPOCH));
    r.close();

    // open DirTaxoWriter again and commit, INDEX_EPOCH should still exist
    // in the commit data, otherwise DirTaxoReader.refresh() might not detect
    // that the taxonomy index has been recreated.
    taxoWriter = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE_OR_APPEND, NO_OP_CACHE);
    taxoWriter.addCategory(new FacetLabel("c")); // add a category so that commit will happen
    taxoWriter.setCommitData(new HashMap<String, String>(){{
      put("just", "data");
    }});
    taxoWriter.commit();

    // verify taxoWriter.getCommitData()
    assertNotNull(DirectoryTaxonomyWriter.INDEX_EPOCH
        + " not found in taoxWriter.commitData", taxoWriter.getCommitData().get(DirectoryTaxonomyWriter.INDEX_EPOCH));
    taxoWriter.close();

    r = DirectoryReader.open(dir);
    readUserCommitData = r.getIndexCommit().getUserData();
    assertNotNull(DirectoryTaxonomyWriter.INDEX_EPOCH + " not found in commitData", readUserCommitData.get(DirectoryTaxonomyWriter.INDEX_EPOCH));
    r.close();

    dir.close();
  }

  @Test
  public void testRollback() throws Exception {
    // Verifies that if rollback is called, DTW is closed.
    Directory dir = newDirectory();
    DirectoryTaxonomyWriter dtw = new DirectoryTaxonomyWriter(dir);
    dtw.addCategory(new FacetLabel("a"));
    dtw.rollback();
    try {
      dtw.addCategory(new FacetLabel("a"));
      fail("should not have succeeded to add a category following rollback.");
    } catch (AlreadyClosedException e) {
      // expected
    }

    dir.close();
  }

  @Test
  public void testRecreateRollback() throws Exception {
    // Tests rollback with OpenMode.CREATE
    Directory dir = newDirectory();
    new DirectoryTaxonomyWriter(dir).close();
    assertEquals(1, getEpoch(dir));
    new DirectoryTaxonomyWriter(dir, OpenMode.CREATE).rollback();
    assertEquals(1, getEpoch(dir));

    dir.close();
  }

  @Test
  public void testEnsureOpen() throws Exception {
    // verifies that an exception is thrown if DTW was closed
    Directory dir = newDirectory();
    DirectoryTaxonomyWriter dtw = new DirectoryTaxonomyWriter(dir);
    dtw.close();
    try {
      dtw.addCategory(new FacetLabel("a"));
      fail("should not have succeeded to add a category following close.");
    } catch (AlreadyClosedException e) {
      // expected
    }
    dir.close();
  }

  private void touchTaxo(DirectoryTaxonomyWriter taxoWriter, FacetLabel cp) throws IOException {
    taxoWriter.addCategory(cp);
    taxoWriter.setCommitData(new HashMap<String, String>(){{
      put("just", "data");
    }});
    taxoWriter.commit();
  }

  @Test
  public void testRecreateAndRefresh() throws Exception {
    // DirTaxoWriter lost the INDEX_EPOCH property if it was opened in
    // CREATE_OR_APPEND (or commit(userData) called twice), which could lead to
    // DirTaxoReader succeeding to refresh().
    Directory dir = newDirectory();

    DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE_OR_APPEND, NO_OP_CACHE);
    touchTaxo(taxoWriter, new FacetLabel("a"));

    TaxonomyReader taxoReader = new DirectoryTaxonomyReader(dir);

    touchTaxo(taxoWriter, new FacetLabel("b"));

    TaxonomyReader newtr = TaxonomyReader.openIfChanged(taxoReader);
    taxoReader.close();
    taxoReader = newtr;
    assertEquals(1, Integer.parseInt(taxoReader.getCommitUserData().get(DirectoryTaxonomyWriter.INDEX_EPOCH)));

    // now recreate the taxonomy, and check that the epoch is preserved after opening DirTW again.
    taxoWriter.close();
    taxoWriter = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE, NO_OP_CACHE);
    touchTaxo(taxoWriter, new FacetLabel("c"));
    taxoWriter.close();

    taxoWriter = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE_OR_APPEND, NO_OP_CACHE);
    touchTaxo(taxoWriter, new FacetLabel("d"));
    taxoWriter.close();

    newtr = TaxonomyReader.openIfChanged(taxoReader);
    taxoReader.close();
    taxoReader = newtr;
    assertEquals(2, Integer.parseInt(taxoReader.getCommitUserData().get(DirectoryTaxonomyWriter.INDEX_EPOCH)));

    taxoReader.close();
    dir.close();
  }

  @Test
  public void testBackwardsCompatibility() throws Exception {
    // tests that if the taxonomy index doesn't have the INDEX_EPOCH
    // property (supports pre-3.6 indexes), all still works.
    Directory dir = newDirectory();

    // create an empty index first, so that DirTaxoWriter initializes indexEpoch to 1.
    new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, null)).close();

    DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE_OR_APPEND, NO_OP_CACHE);
    taxoWriter.close();

    DirectoryTaxonomyReader taxoReader = new DirectoryTaxonomyReader(dir);
    assertEquals(1, Integer.parseInt(taxoReader.getCommitUserData().get(DirectoryTaxonomyWriter.INDEX_EPOCH)));
    assertNull(TaxonomyReader.openIfChanged(taxoReader));
    taxoReader.close();

    dir.close();
  }

  public void testConcurrency() throws Exception {
    final int ncats = atLeast(100000); // add many categories
    final int range = ncats * 3; // affects the categories selection
    final AtomicInteger numCats = new AtomicInteger(ncats);
    final Directory dir = newDirectory();
    final ConcurrentHashMap<String,String> values = new ConcurrentHashMap<>();
    final double d = random().nextDouble();
    final TaxonomyWriterCache cache;
    if (d < 0.7) {
      // this is the fastest, yet most memory consuming
      cache = new Cl2oTaxonomyWriterCache(1024, 0.15f, 3);
    } else if (TEST_NIGHTLY && d > 0.98) {
      // this is the slowest, but tests the writer concurrency when no caching is done.
      // only pick it during NIGHTLY tests, and even then, with very low chances.
      cache = NO_OP_CACHE;
    } else {
      // this is slower than CL2O, but less memory consuming, and exercises finding categories on disk too.
      cache = new LruTaxonomyWriterCache(ncats / 10);
    }
    if (VERBOSE) {
      System.out.println("TEST: use cache=" + cache);
    }
    final DirectoryTaxonomyWriter tw = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE, cache);
    Thread[] addThreads = new Thread[atLeast(4)];
    for (int z = 0; z < addThreads.length; z++) {
      addThreads[z] = new Thread() {
        @Override
        public void run() {
          Random random = random();
          while (numCats.decrementAndGet() > 0) {
            try {
              int value = random.nextInt(range);
              FacetLabel cp = new FacetLabel(Integer.toString(value / 1000), Integer.toString(value / 10000),
                  Integer.toString(value / 100000), Integer.toString(value));
              int ord = tw.addCategory(cp);
              assertTrue("invalid parent for ordinal " + ord + ", category " + cp, tw.getParent(ord) != -1);
              String l1 = FacetsConfig.pathToString(cp.components, 1);
              String l2 = FacetsConfig.pathToString(cp.components, 2);
              String l3 = FacetsConfig.pathToString(cp.components, 3);
              String l4 = FacetsConfig.pathToString(cp.components, 4);
              values.put(l1, l1);
              values.put(l2, l2);
              values.put(l3, l3);
              values.put(l4, l4);
            } catch (IOException e) {
              throw new RuntimeException(e);
            }
          }
        }
      };
    }

    for (Thread t : addThreads) t.start();
    for (Thread t : addThreads) t.join();
    tw.close();

    DirectoryTaxonomyReader dtr = new DirectoryTaxonomyReader(dir);
    // +1 for root category
    if (values.size() + 1 != dtr.getSize()) {
      for(String value : values.keySet()) {
        FacetLabel label = new FacetLabel(FacetsConfig.stringToPath(value));
        if (dtr.getOrdinal(label) == -1) {
          System.out.println("FAIL: path=" + label + " not recognized");
        }
      }
      fail("mismatch number of categories");
    }

    int[] parents = dtr.getParallelTaxonomyArrays().parents();
    for (String cat : values.keySet()) {
      FacetLabel cp = new FacetLabel(FacetsConfig.stringToPath(cat));
      assertTrue("category not found " + cp, dtr.getOrdinal(cp) > 0);
      int level = cp.length;
      int parentOrd = 0; // for root, parent is always virtual ROOT (ord=0)
      FacetLabel path = new FacetLabel();
      for (int i = 0; i < level; i++) {
        path = cp.subpath(i + 1);
        int ord = dtr.getOrdinal(path);
        assertEquals("invalid parent for cp=" + path, parentOrd, parents[ord]);
        parentOrd = ord; // next level should have this parent
      }
    }

    IOUtils.close(dtr, dir);
  }

  private long getEpoch(Directory taxoDir) throws IOException {
    SegmentInfos infos = new SegmentInfos();
    infos.read(taxoDir);
    return Long.parseLong(infos.getUserData().get(DirectoryTaxonomyWriter.INDEX_EPOCH));
  }

  @Test
  public void testReplaceTaxonomy() throws Exception {
    Directory input = newDirectory();
    DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(input);
    int ordA = taxoWriter.addCategory(new FacetLabel("a"));
    taxoWriter.close();

    Directory dir = newDirectory();
    taxoWriter = new DirectoryTaxonomyWriter(dir);
    int ordB = taxoWriter.addCategory(new FacetLabel("b"));
    taxoWriter.addCategory(new FacetLabel("c"));
    taxoWriter.commit();

    long origEpoch = getEpoch(dir);

    // replace the taxonomy with the input one
    taxoWriter.replaceTaxonomy(input);

    // LUCENE-4633: make sure that category "a" is not added again in any case
    taxoWriter.addTaxonomy(input, new MemoryOrdinalMap());
    assertEquals("no categories should have been added", 2, taxoWriter.getSize()); // root + 'a'
    assertEquals("category 'a' received new ordinal?", ordA, taxoWriter.addCategory(new FacetLabel("a")));

    // add the same category again -- it should not receive the same ordinal !
    int newOrdB = taxoWriter.addCategory(new FacetLabel("b"));
    assertNotSame("new ordinal cannot be the original ordinal", ordB, newOrdB);
    assertEquals("ordinal should have been 2 since only one category was added by replaceTaxonomy", 2, newOrdB);

    taxoWriter.close();

    long newEpoch = getEpoch(dir);
    assertTrue("index epoch should have been updated after replaceTaxonomy", origEpoch < newEpoch);

    dir.close();
    input.close();
  }

  @Test
  public void testReaderFreshness() throws Exception {
    // ensures that the internal index reader is always kept fresh. Previously,
    // this simple scenario failed, if the cache just evicted the category that
    // is being added.
    Directory dir = newDirectory();
    DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir, OpenMode.CREATE, NO_OP_CACHE);
    int o1 = taxoWriter.addCategory(new FacetLabel("a"));
    int o2 = taxoWriter.addCategory(new FacetLabel("a"));
    assertTrue("ordinal for same category that is added twice should be the same !", o1 == o2);
    taxoWriter.close();
    dir.close();
  }

  @Test
  public void testCommitNoEmptyCommits() throws Exception {
    // LUCENE-4972: DTW used to create empty commits even if no changes were made
    Directory dir = newDirectory();
    DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir);
    taxoWriter.addCategory(new FacetLabel("a"));
    taxoWriter.commit();

    long gen1 = SegmentInfos.getLastCommitGeneration(dir);
    taxoWriter.commit();
    long gen2 = SegmentInfos.getLastCommitGeneration(dir);
    assertEquals("empty commit should not have changed the index", gen1, gen2);

    taxoWriter.close();
    dir.close();
  }

  @Test
  public void testCloseNoEmptyCommits() throws Exception {
    // LUCENE-4972: DTW used to create empty commits even if no changes were made
    Directory dir = newDirectory();
    DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir);
    taxoWriter.addCategory(new FacetLabel("a"));
    taxoWriter.commit();

    long gen1 = SegmentInfos.getLastCommitGeneration(dir);
    taxoWriter.close();
    long gen2 = SegmentInfos.getLastCommitGeneration(dir);
    assertEquals("empty commit should not have changed the index", gen1, gen2);

    taxoWriter.close();
    dir.close();
  }

  @Test
  public void testPrepareCommitNoEmptyCommits() throws Exception {
    // LUCENE-4972: DTW used to create empty commits even if no changes were made
    Directory dir = newDirectory();
    DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir);
    taxoWriter.addCategory(new FacetLabel("a"));
    taxoWriter.prepareCommit();
    taxoWriter.commit();

    long gen1 = SegmentInfos.getLastCommitGeneration(dir);
    taxoWriter.prepareCommit();
    taxoWriter.commit();
    long gen2 = SegmentInfos.getLastCommitGeneration(dir);
    assertEquals("empty commit should not have changed the index", gen1, gen2);

    taxoWriter.close();
    dir.close();
  }

  @Test
  public void testHugeLabel() throws Exception {
    Directory indexDir = newDirectory(), taxoDir = newDirectory();
    IndexWriter indexWriter = new IndexWriter(indexDir, newIndexWriterConfig(new MockAnalyzer(random())));
    DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir, OpenMode.CREATE, new Cl2oTaxonomyWriterCache(2, 1f, 1));
    FacetsConfig config = new FacetsConfig();

    // Add one huge label:
    String bigs = null;
    int ordinal = -1;

    int len = FacetLabel.MAX_CATEGORY_PATH_LENGTH - 4; // for the dimension and separator
    bigs = TestUtil.randomSimpleString(random(), len, len);
    FacetField ff = new FacetField("dim", bigs);
    FacetLabel cp = new FacetLabel("dim", bigs);
    ordinal = taxoWriter.addCategory(cp);
    Document doc = new Document();
    doc.add(ff);
    indexWriter.addDocument(config.build(taxoWriter, doc));

    // Add tiny ones to cause a re-hash
    for (int i = 0; i < 3; i++) {
      String s = TestUtil.randomSimpleString(random(), 1, 10);
      taxoWriter.addCategory(new FacetLabel("dim", s));
      doc = new Document();
      doc.add(new FacetField("dim", s));
      indexWriter.addDocument(config.build(taxoWriter, doc));
    }

    // when too large components were allowed to be added, this resulted in a new added category
    assertEquals(ordinal, taxoWriter.addCategory(cp));

    IOUtils.close(indexWriter, taxoWriter);

    DirectoryReader indexReader = DirectoryReader.open(indexDir);
    TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoDir);
    IndexSearcher searcher = new IndexSearcher(indexReader);
    DrillDownQuery ddq = new DrillDownQuery(new FacetsConfig());
    ddq.add("dim", bigs);
    assertEquals(1, searcher.search(ddq, 10).totalHits);

    IOUtils.close(indexReader, taxoReader, indexDir, taxoDir);
  }

  @Test
  public void testReplaceTaxoWithLargeTaxonomy() throws Exception {
    Directory srcTaxoDir = newDirectory(), targetTaxoDir = newDirectory();

    // build source, large, taxonomy
    DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(srcTaxoDir);
    int ord = taxoWriter.addCategory(new FacetLabel("A", "1", "1", "1", "1", "1", "1"));
    taxoWriter.close();

    taxoWriter = new DirectoryTaxonomyWriter(targetTaxoDir);
    int ordinal = taxoWriter.addCategory(new FacetLabel("B", "1"));
    assertEquals(1, taxoWriter.getParent(ordinal)); // call getParent to initialize taxoArrays
    taxoWriter.commit();

    taxoWriter.replaceTaxonomy(srcTaxoDir);
    assertEquals(ord - 1, taxoWriter.getParent(ord));
    taxoWriter.close();

    srcTaxoDir.close();
    targetTaxoDir.close();
  }

}


text:
<?php
namespace Neos\Cache;

/**
 * Interface for objects which are cache aware and are collaborative when it comes to storing them in a cache.
 *
 * @api
 */
interface CacheAwareInterface
{
    /**
     * Returns a string which distinctly identifies this object and thus can be used as an identifier for cache entries
     * related to this object.
     *
     * @return string
     */
    public function getCacheEntryIdentifier();
}


text:
package com.izhbg.typz.database.service;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import com.izhbg.typz.database.dto.MainTableColumn;

/**
 *  主表列接口
* @author caixl
* @date 2016-5-12 下午5:25:21
*
 */
public interface MainTableColumnService {

	/**
	 * 根据主表Id获取主表列信息
	 * @param mainTableId
	 * @return
	 * @throws Exception
	 */
	public List<MainTableColumn> findByMainTableId(String mainTableId) throws Exception;
	/**
	 * 根据列ID获取列信息
	 * @param mainTableColumnId
	 * @return
	 * @throws Exception
	 */
	public MainTableColumn findByMainTableColumnId(String mainTableColumnId) throws Exception;
	/**
	 * 根据主表ID删除主表列信息
	 * @param mainTableId
	 * @throws Exception
	 */
	public void deleteByMainTableId(String mainTableId) throws Exception;
	/**
	 * 批量删除列信息
	 * @param maintablecolumnids
	 * @throws Exception
	 */
	public void deleteByMainTableColumnIds(String[] maintablecolumnids) throws Exception;
	/**
	 * 加载主表列信息
	 * @param mainTableId
	 * @throws Exception
	 */
	public void saveLoadMainTableColumn(String mainTableId) throws Exception;
	/**
	 * 添加主表列信息
	 * @param mainTableColumn
	 * @throws Exception
	 */
	public void add(MainTableColumn mainTableColumn) throws Exception;
	/**
	 * 更新主表列信息
	 * @param mainTableColumn
	 * @throws Exception
	 */
	public void update(MainTableColumn mainTableColumn) throws Exception;
	/**
	 * 根据主表列主键ID删除主表列信息
	 * @param mainTableColumnId
	 * @throws Exception
	 */
	public void deleteByMainTableColumnId(String mainTableColumnId) throws Exception;
	/**
	 * 批量修改主表列信息
	 * @param request
	 * @throws Exception
	 */
	public void updateMainTableColumns(HttpServletRequest request) throws Exception;
}


text:
$assemblyInfoPath = $args[0]
$packageVersion =[convert]::ToString($args[1])
$assemblyVersion =[convert]::ToString($args[2])
$assemblyFileVersion = [convert]::ToString($args[3])

$assemblyInformationalVersionPattern = '^\[assembly: AssemblyInformationalVersion\("(.*)"\)\]$'
$assemblyVersionPattern = '^\[assembly: AssemblyVersion\("(.*)"\)\]$'
$assemblyFileVersionPattern = '^\[assembly: AssemblyFileVersion\("(.*)"\)\]$'

(Get-Content $assemblyInfoPath) | ForEach-Object{
	if ($_ -match $assemblyInformationalVersionPattern)
	{
        '[assembly: AssemblyInformationalVersion("{0}")]' -f $packageVersion
    }
    elseif ($_ -match $assemblyVersionPattern)
	{
        '[assembly: AssemblyVersion("{0}")]' -f $assemblyVersion
    }
    elseif ($_ -match $assemblyFileVersionPattern)
	{
        '[assembly: AssemblyFileVersion("{0}")]' -f $assemblyFileVersion
    }
	else
	{
        $_
    }
} | Set-Content $assemblyInfoPath


text:
(function _init()
{
   if ((!("SFW" in window) && setTimeout(_init,100))
       || SFW.delay_init("sfw_calendar",_init, "table"))
      return;

   if (!SFW.derive(_calendar, "calendar", "table"))
      return;

   function _calendar(base, doc, caller, data)
   {
      SFW.types["table"].call(this,base,doc,caller,data);
   }

   _calendar.prototype.process_cell_click = function(td)
   {
      var rval = null;
      var task = this.get_data_value("on_cell_click");
      if (task)
      {
         rval = {
            task:task,
            id_name:this.get_cell_click_id_name(),
            did:td.getAttribute("data-date")
         };

         function f(n) { return n.nodeType==1 && class_includes(n,"day_content"); }
         var container = SFW.find_child_matches(td,f,true);
         if (container && container.getAttribute("data-id"))
            rval.target = container;
      }

      return rval;
   };

   _calendar.prototype.process_day_click = function(t, did)
   {
      var url = this.get_data_value("on_day_click");
      if (url)
      {
         url += "=" + did;
         empty_el(this.host());
         SFW.open_interaction(SFW.stage, url, this, {caldoc:this.xmldoc(),did:did});
      }
   };

   _calendar.prototype.process_month_jump = function(month)
   {
      var url = SFW.update_location_arg("mdate", month);
      if (url)
         window.location = url;

      return false;
   };

   _calendar.prototype.get_calmove_url = function(button)
   {
      var base = this.top().getAttribute("data-url-calmove_base");
      var jump = button.getAttribute("data-jump");
      if (!base)
         SFW.alert("Missing calmove_base");
      else if (!jump)
         SFW.alert("Missing data-jump value");
      else
         return base + "=" + jump;

      return null;
   };

   _calendar.prototype.process_button_calmove = function(button, callback)
   {
      var url = get_calmove_url(button);
      if (url)
         window.location = url;
   };

   _calendar.prototype.replot = function(result)
   {
      var top = this.top();
      var host = top.parentNode;
      if (!result)
         result = this.result();

      this.pre_transform();
      SFW.xslobj.transformFill(host, result);
      this.post_transform();
   };

   _calendar.prototype.process = function (e,t)
   {
      var did, tag, mon, top = this.top();

      if (e.type!="click")
         return true;

      // Preserve value of 't' for default process function:
      var tel = t;

      while (tel && tel!=top)
      {
         if (tel.nodeType==1 && (tag=tel.tagName.toLowerCase()))
         {
            if (tag=="td" && (did=tel.getAttribute("data-name")))
               return this.process_cell_click(tel, did);
            else if (tag=="button" && (mon=tel.getAttribute("data-jump")))
               return this.process_month_jump(mon);
         }

         tel = tel.parentNode;
      }

      return this.call_super_event("table", "process", arguments);
   };

   function _day_from_click(el)
   {
      while(el)
      {
         if (el.nodeType==1)
         {
            if (class_includes(el,"cal_day") && el.getAttribute("data-name"))
               return el;
         }
         el = el.parentNode;
      }

      return el;
   }

   // _calendar.prototype.get_el_click_info = function(el)
   // {
   //    var did, dname, task, rval=null;
   //    if ((did=el.getAttribute("data-id")) && class_includes(el,"day_content")
   //        || (dname=el.getAttribute("data-name")) && class_includes(el,"cal_day"))
   //    {
   //       rval = { target : el,
   //                task   : this.get_on_click_value("day", el.tagName.toLowerCase()),
   //                idname : this.get_click_id_name("td") || this.get_click_id_name("day")
   //              };

   //       if (did)
   //          rval.did = did;
   //       else if (dname)
   //          rval.dname = dname;
   //    }
   //    return rval;
   // };

   _calendar.prototype.get_el_click_info = function(el)
   {
      var rval = { target : el };
      var dayel = _day_from_click(el);
      var did;
      if (dayel)
      {
         rval.task = this.get_on_click_value("day",el.tagName.toLowerCase());
         rval.idname = this.get_click_id_name("td");
         rval.dname = dayel.getAttribute("data-name");
         if (rval.idname=="id")
            rval.idname = this.get_click_id_name("day");

         function f(n)
         {
            if (n.nodeType==1 && class_includes(n,"day_content"))
            {
               rval.target = n;
               if ((did=n.getAttribute("data-id")))
                  rval.did = did;
               return true;
            }
         }

         SFW.find_child_matches(dayel,f,true,false);
      }
      return rval;
   }

   _calendar.prototype.process = function (e,t)
   {
      var clickinfo, tag, mon, top = this.top();

      if (e.type!="click")
         return true;

      // Preserve the arguments for last-resort call to table::process().
      var tel = t;
      while (tel && tel!=top)
      {
         if ((tag=tel.tagName.toLowerCase())=="button" &&
             (mon=tel.getAttribute("data-jump")))
            return this.process_month_jump(mon);
         if ((click_info = this.get_el_click_info(tel)))
            return this.process_click_info(click_info);

         tel = tel.parentNode;
      }

      return this.call_super_event("table", "process", arguments);
   };

})();


text:
namespace JSLintNet.Models
{
    using System.Diagnostics.CodeAnalysis;
    using Newtonsoft.Json;

    /// <summary>
    /// Contains the details of a JSLint error.
    /// </summary>
    [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called by JSON serializer.")]
    public class JSLintError : IJSLintError
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="JSLintError"/> class.
        /// </summary>
        [JsonConstructor]
        internal JSLintError()
        {
        }

        /// <summary>
        /// Gets the line (relative to 0) at which the lint was found.
        /// </summary>
        [JsonProperty("line")]
        public int Line { get; private set; }

        /// <summary>
        /// Gets the character (relative to 0) at which the lint was found.
        /// </summary>
        [JsonProperty("character")]
        public int Character { get; private set; }

        /// <summary>
        /// Gets the problem.
        /// </summary>
        [JsonProperty("reason")]
        public string Reason { get; private set; }

        /// <summary>
        /// Gets the text line in which the problem occurred.
        /// </summary>
        [JsonProperty("evidence")]
        public string Evidence { get; private set; }

        /// <summary>
        /// Gets the error code.
        /// </summary>
        /// <value>
        /// The error code.
        /// </value>
        [JsonProperty("code")]
        public string Code { get; private set; }
    }
}


text:
package shiver.me.timbers.waiting.execution;

import shiver.me.timbers.waiting.Wait;

import java.util.concurrent.Callable;

public class WaitingDefaultsMethod implements WaitingDefaults {

    @Wait
    @Override
    public <T> T defaultsMethod(Callable<T> callable) throws Exception {
        return callable.call();
    }
}


text:
namespace disruptor {

template<typename T>
class EventPublisher {
 public:
    EventPublisher(RingBuffer<T>* ring_buffer) : ring_buffer_(ring_buffer) {}

    void PublishEvent(EventTranslatorInterface<T>* translator) {
        int64_t sequence = ring_buffer_->Next();
        translator->TranslateTo(sequence, ring_buffer_->Get(sequence));
        ring_buffer_->Publish(sequence);
    }

 private:
    RingBuffer<T>* ring_buffer_;
};

};  // namespace disruptor

#endif


text:
/* - Coeus web framework -------------------------
 *
 * Licensed under the Apache License, Version 2.0.
 *
 * Author: Spiros Tzavellas
 */
package com.tzavellas.coeus.http.multipart

import java.io.File
import java.util.{ Map => JMap }
import javax.servlet.{ ServletContext, ServletContextEvent }
import javax.servlet.http.HttpServletRequest
import scala.collection.mutable.ArrayBuffer
import org.apache.commons.fileupload.disk.{ DiskFileItem, DiskFileItemFactory }
import org.apache.commons.fileupload.servlet.{ FileCleanerCleanup, ServletFileUpload }
import com.tzavellas.coeus.util.internal.MultiMap

/**
 * An implementation of {@code MultipartRequestParser} that uses Apache Commons fileupload.
 *
 *
This implementation stores the files smaller that {@code sizeThreshold} in memory and
 * the files larger than {@code sizeThreshold} in temporary files under the {@code repository}
 * directory. Any temporary files created for a request are automatically deleted at the end of
 * the request's execution.

 *
 *
If {@code repository} is {@code null} (the default) then the directory returned by
 * {@code System.getProperty("java.io.tmpdir")} is used to store any temporary files.

 *
 *
The default size threshold for in memory files is 10KB.

 *
 *
This class requires commons-fileupload and commons-io.

 *
 * @param sizeThreshold the size threshold after which the files are stored on disk
 * @param repository the directory under which the temporary files are created
 */
class CommonsMultipartRequestParser(sizeThreshold: Int = 10240, repository: File = null) extends MultipartRequestParser {

  private val upload = new ServletFileUpload(new DiskFileItemFactory(sizeThreshold, repository))

  def init(context: ServletContext) {
    (new FileCleanerCleanup).contextInitialized(new ServletContextEvent(context))
  }

  def destroy(context: ServletContext) {
    (new FileCleanerCleanup).contextDestroyed(new ServletContextEvent(context))
  }

  def parse(request: HttpServletRequest): MultipartHttpServletRequest = {
    val items = upload.parseRequest(request).iterator.asInstanceOf[java.util.Iterator[DiskFileItem]]
    val files = new MultiMap[String, FormFile]
    val params = new MultiMap[String, String]

    while (items.hasNext) {
      val item = items.next
      if (item.isFormField) {
        params.add(item.getFieldName, item.getString)
      } else {
        files.add(item.getFieldName, new CommonsFormFile(item))
      }
    }
    new MultipartHttpServletRequest(request, paramsMap(params), paramsMap(files))
  }

  def cleanupFiles(request: MultipartHttpServletRequest) {
    val files = request.getFileMap.values.iterator
    while (files.hasNext) {
      files.next.foreach { _.delete() }
    }
  }

  private def paramsMap[T](mmap: MultiMap[String, T])(implicit m: Manifest[T]) = {
    val jmap = new java.util.HashMap[String, Array[T]](mmap.size)
    for ((key, values) <- mmap) {
      jmap.put(key, values.toArray(m))
    }
    jmap
  }
}


text:
'use strict';

angular.module('core').controller('HomeController', ['$scope', '$interval', 'timer', 'Authentication', function ($scope, $interval, timer, Authentication) {
    $scope.authentication = Authentication;

    $scope.authenticated = (Authentication.user !== '');

    var initialTime = 1500000;

    $scope.currentTime = initialTime;

    $scope.startTimer = function() {
      timer.start($scope);
    };

    $scope.stopTimer = function() {
      timer.stop($scope);
    };

    $scope.resetTimer = function() {
      timer.reset($scope, initialTime);
    };

    $scope.shortBreakMessage = function() {
      return (timer.pomodoroDone) && (timer.pomodoroCount % 3 !== 0);
    };

    $scope.longBreakMessage = function() {
      return (timer.pomodoroCount !== 0) && (timer.pomodoroCount % 3 === 0);
    };

    // Remove Completed Tasks on Timer Completion (Consider implementing)

    // $scope.removeCompleted = function() {
    //   for (var i in $scope.tasks) {
    //     if ($scope.tasks[i].taskComplete) {
    //       $scope.tasks.splice(i, 1);
    //     }
    //   }
    // };

  }]);


text:
package cinema.crew

import akka.kernel.Bootable
import akka.actor.ActorSystem
import com.typesafe.config.ConfigFactory
import java.net.InetAddress

class GraphGrip extends Bootable {
  // Akka was giving me problems with the default .getHostAddress()
  // For some reason, .getHostName() works, so that's why I'm doing this.
  val myHostName = InetAddress.getLocalHost().getHostName()
  val myConfig = """
    akka {
      actor {
        provider = "akka.remote.RemoteActorRefProvider"
      }
      remote {
        transport = "akka.remote.netty.NettyRemoteTransport"
        netty {
          #hostname = """ + "\"" + myHostName + "\"" + """
          hostname = "127.0.0.1"
          port = 2552
          message-frame-size = 500 MiB
        }
      }
    }
    """
  println("Deployed on: " + myHostName)
  val customConf = ConfigFactory.parseString(myConfig)

  val system = ActorSystem("GraphGrip", ConfigFactory.load(customConf))

  def startup() {
  }

  def shutdown() {
    system.shutdown()
  }
}

object GraphGrip {
  def main(args: Array[String]) {
    new GraphGrip
    println("Started GraphGrip - waiting for messages...")
  }
}