text:
import flatMap from 'lodash/flatMap';
import { assertNever } from 'assert-never';
import { DateTime } from 'luxon';
import { TFunction } from 'i18next';
import { notEmpty } from '@neinteractiveliterature/litform';

import Timespan, { FiniteTimespan } from '../Timespan';
import { timespanFromConvention, ConventionForTimespanUtils } from '../TimespanUtils';
import { formatLCM, getDateTimeFormat, timezoneNameForConvention, useAppDateTimeFormat } from '../TimeUtils';
import { TimeblockDefinition, TimeblockPreferenceOrdinality } from './TimeblockTypes';
import { TimeblockPreferenceFormItem } from '../FormAdmin/FormItemUtils';

export function getTimeblockTimespanForDisplay(timeblock: TimeblockDefinition): FiniteTimespan {
  return Timespan.finiteFromDateTimes(
    DateTime.fromObject({ year: 2020, month: 1, day: 1 }).plus({
      hours: timeblock.start.hour,
      minutes: timeblock.start.minute,
      seconds: timeblock.start.second,
    }),
    DateTime.fromObject({ year: 2020, month: 1, day: 1 }).plus({
      hours: timeblock.finish.hour,
      minutes: timeblock.finish.minute,
      seconds: timeblock.finish.second,
    }),
  );
}

export function describeTimeblock(timeblock: TimeblockDefinition, t: TFunction): string {
  const timespan = getTimeblockTimespanForDisplay(timeblock);

  return `${formatLCM(timespan.start, getDateTimeFormat('shortTime', t))} - ${formatLCM(
    timespan.finish,
    getDateTimeFormat('shortTime', t),
  )}`;
}

export function describeOrdinality(ordinality?: TimeblockPreferenceOrdinality | null): string {
  if (ordinality == null) {
    return "Don't care";
  }

  switch (ordinality) {
    case '1':
      return '1st choice';
    case '2':
      return '2nd choice';
    case '3':
      return '3rd choice';
    case 'X':
      return 'Prefer not';
    default:
      return assertNever(ordinality);
  }
}

function getDayStarts(convention: ConventionForTimespanUtils) {
  return timespanFromConvention(convention).getTimeHopsWithin(timezoneNameForConvention(convention), { unit: 'day' });
}

export type ConcreteTimeblock = {
  dayStart: DateTime;
  timeblock: TimeblockDefinition;
  label: string;
  timespan: FiniteTimespan;
};

function getAllPossibleTimeblocks(convention: ConventionForTimespanUtils, formItem: TimeblockPreferenceFormItem) {
  return flatMap(getDayStarts(convention), (dayStart) =>
    formItem.rendered_properties.timeblocks
      .map((timeblock) => {
        try {
          const timespan = Timespan.fromDateTimes(
            dayStart.set(timeblock.start),
            dayStart.set(timeblock.finish),
          ) as FiniteTimespan;

          const concreteTimeblock: ConcreteTimeblock = {
            dayStart,
            timeblock,
            label: timeblock.label,
            timespan,
          };

          return concreteTimeblock;
        } catch (error) {
          return null;
        }
      })
      .filter(notEmpty),
  );
}

function isTimeblockValid(
  convention: ConventionForTimespanUtils,
  formItem: TimeblockPreferenceFormItem,
  timeblock: ConcreteTimeblock,
) {
  const conventionTimespan = timespanFromConvention(convention);

  if (!conventionTimespan.overlapsTimespan(timeblock.timespan)) {
    return false;
  }

  const timeblockOmitted = formItem.rendered_properties.omit_timeblocks.some((omission) => {
    const omissionDate = DateTime.fromISO(omission.date, {
      zone: timezoneNameForConvention(convention),
    }).startOf('day');
    const dayStart = timeblock.timespan.start.startOf('day');
    return omission.label === timeblock.label && omissionDate.toMillis() === dayStart.toMillis();
  });

  return !timeblockOmitted;
}

export function getValidTimeblocks(
  convention: ConventionForTimespanUtils,
  formItem: TimeblockPreferenceFormItem,
): ConcreteTimeblock[] {
  return getAllPossibleTimeblocks(convention, formItem).filter((timeblock) =>
    isTimeblockValid(convention, formItem, timeblock),
  );
}

export type TimeblockColumn = {
  dayStart: DateTime;
  cells: (ConcreteTimeblock | null)[];
};

export function getValidTimeblockColumns(
  convention: ConventionForTimespanUtils,
  formItem: TimeblockPreferenceFormItem,
): TimeblockColumn[] {
  const allPossibleTimeblocks = getAllPossibleTimeblocks(convention, formItem);
  return getDayStarts(convention)
    .map((dayStart) => {
      const possibleTimeblocksForDayStart = allPossibleTimeblocks.filter(
        (timeblock) => dayStart.toMillis() === timeblock.dayStart.toMillis(),
      );

      return {
        dayStart,
        cells: possibleTimeblocksForDayStart.map((timeblock) =>
          isTimeblockValid(convention, formItem, timeblock) ? timeblock : null,
        ),
      };
    })
    .filter((column) => column.cells.some(notEmpty));
}

export type TimeblockRow = {
  timeblock: TimeblockDefinition;
  cells: (ConcreteTimeblock | null)[];
};

export function rotateTimeblockColumnsToRows(
  formItem: TimeblockPreferenceFormItem,
  columns: TimeblockColumn[],
): TimeblockRow[] {
  const columnCount = columns.length;

  return formItem.rendered_properties.timeblocks
    .map((timeblock, x) => {
      const row: (ConcreteTimeblock | null)[] = [];
      for (let y = 0; y < columnCount; y += 1) {
        const column = columns[y];
        row.push(column.cells[x]);
      }

      if (row.some((cell) => cell != null)) {
        return {
          timeblock,
          cells: row,
        };
      }

      return null;
    })
    .filter(notEmpty);
}

export function getColumnHeader(column: TimeblockColumn, format: ReturnType<typeof useAppDateTimeFormat>): string {
  return format(column.dayStart, 'longWeekday');
}


text:
require 'rails_helper'

describe Atmosphere::Api::V1::UsersController do
  include ApiHelpers

  let!(:user)  { create(:user) }
  let!(:user2) { create(:user) }
  let!(:admin) { create(:admin) }

  describe 'GET /users' do
    context 'when unauthenticated' do
      it 'returns 401 Unauthorized error' do
        get api('/users')
        expect(response.status).to eq 401
      end
    end

    context 'when authenticated as user' do
      it 'returns 200 Success' do
        get api('/users', user)
        expect(response.status).to eq 200
      end

      it 'returns basic information about users except for current user' do
        get api('/users', user)
        expect(users_response).to be_an Array
        expect(users_response.size).to eq 3

        expect(users_response[0]).to user_full_eq user
        expect(users_response[1]).to user_basic_eq user2
        expect(users_response[2]).to user_basic_eq admin
      end
    end

    context 'when authenticated as admin' do
      it 'returns full information about users' do
        get api('/users', admin)
        expect(users_response[0]).to user_full_eq user
        expect(users_response[1]).to user_full_eq user2
        expect(users_response[2]).to user_full_eq admin
      end
    end

    context 'search' do
      it 'searches using login' do
        get api("/users?login=#{user.login}", user)
        expect(users_response.size).to eq 1
        expect(users_response[0]).to user_full_eq user
      end
    end
  end

  describe 'GET /users/:id' do
    context 'when unauthenticated' do
      it 'returns 401 Unauthorized error' do
        get api("/users/#{user.id}")
        expect(response.status).to eq 401
      end
    end

    context 'when authenticated as user' do
      it 'returns 200 Success' do
        get api("/users/#{user.id}", user)
        expect(response.status).to eq 200
      end

      it 'returns full information about current user' do
        get api("/users/#{user.id}", user)
        expect(user_response).to user_full_eq user
      end

      it 'return 404 Not found for not existing user' do
        get api("/users/not_existing", user)
        expect(response.status).to eq 404
      end
    end

    context 'when authenticated as admin' do
      it 'returns full information about user' do
        get api("/users/#{user.id}", admin)
        expect(user_response).to user_full_eq user
      end
    end
  end

  def users_response
    json_response['users']
  end

  def user_response
    json_response['user']
  end
end

redpajama_set_name: RedPajamaGithub


text:
Package.describe({
  summary: "DB less realtime communication for meteor",
  version:"0.2.0",
  name:"lepozepo:streams",
  git:"https://github.com/Lepozepo/meteor-streams"
});

Package.on_use(function (api, where) {
  api.versionsFrom('METEOR@0.9.0');

  api.use('underscore', ['client', 'server']);
  api.add_files(['lib/ev.js', 'lib/server.js', 'lib/stream_permission.js'], 'server');
  api.add_files(['lib/ev.js', 'lib/client.js'], 'client');
});


text:
This is a mood-indexed music scanning service.

## Major Dependencies
- [pygn python library](https://github.com/cweichen/pygn)
- [Gracenote Music API](https://www.gracenote.com/)

## Build
- get API key for [Gracenote Music API](https://developer.gracenote.com/user/me/apps)
- place client ID and key in `MusicConfig.py`
```
make all
```

## Run
To run the server
```
make start_server
```

## Test
To test if the server is correct
```
make start_test
```

## Clean
To clean the running environment
```
make clean
```


text:
var PROBES = {
    // method_name, message_id, JSON.stringify(arguments)
    'rpc-start': ['char *', 'int', 'char *'],

    // method_name, message_id, status, JSON.stringify(arguments)
    'rpc-msg': ['char *', 'int', 'int', 'char *'],

    // method_name, message_id
    'rpc-done': ['char *', 'int']
};
var PROVIDER;

///--- API

module.exports = function exportStaticProvider() {
    if (!PROVIDER) {
        try {
            var dtrace = require('dtrace-provider');
            PROVIDER = dtrace.createDTraceProvider('fast');

            Object.keys(PROBES).forEach(function (p) {
                var args = PROBES[p].splice(0);
                args.unshift(p);

                PROVIDER.addProbe.apply(PROVIDER, args);
            });
            PROVIDER.enable();
        } catch (e) {
            PROVIDER = {
                fire: function () {},
                enable: function () {},
                addProbe: function () {
                    return ({fire: function () {}});
                },
                removeProbe: function () {},
                disable: function () {}
            };
        }
    }

    return (PROVIDER);
}();


text:
package de.brockhaus.m2m.message;

public enum M2MDataType {

	FLOAT, BOOLEAN, STRING;

}


text:
package com.vaadin.tests.components.menubar;

import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Label;
import com.vaadin.ui.MenuBar;
import com.vaadin.ui.MenuBar.Command;
import com.vaadin.ui.MenuBar.MenuItem;

public class MenuBarFocus extends AbstractReindeerTestUI {

    /*
     * (non-Javadoc)
     *
     * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
     * VaadinRequest)
     */
    @Override
    protected void setup(VaadinRequest request) {
        final MenuBar bar = buildMenu();
        Button focusButton = buildButton(bar);

        addComponent(bar);
        addComponent(focusButton);
        getLayout().setSpacing(true);
    }

    private MenuBar buildMenu() {
        final MenuBar bar = new MenuBar();
        bar.setDescription("Root Menu");

        Command command = new Command() {

            @Override
            public void menuSelected(MenuItem selectedItem) {
                addComponent(new Label(selectedItem.getText() + " clicked"));

            }
        };

        // File
        final MenuItem file = bar.addItem("File", null);
        file.addItem("Foo", command);
        file.addItem("Bar", command);

        // Edit
        MenuItem edit = bar.addItem("Edit", null);
        edit.addItem("Baz", command);
        edit.addItem("Bay", command);

        bar.setTabIndex(2);
        return bar;
    }

    private Button buildButton(final MenuBar bar) {
        ClickListener buttonClickListener = new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                bar.focus();
            }
        };

        Button focusButton = new Button("Click me to focus the menubar",
                buttonClickListener);
        focusButton.setTabIndex(1);
        return focusButton;
    }

    /*
     * (non-Javadoc)
     *
     * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
     */
    @Override
    protected String getTestDescription() {
        return "This test checks if you can focus a menu bar on the client from the server side";
    }

    @Override
    protected Integer getTicketNumber() {
        return 7674;
    }

}


text:
import json
from decimal import Decimal
from functools import partial
from unittest.mock import ANY

from freezegun import freeze_time
from prices import Money, fixed_discount

from .....core.prices import quantize_price
from .....discount import DiscountValueType, VoucherType
from .....graphql.core.utils import to_global_id_or_none
from .....order.models import Order
from .....tests.fixtures import recalculate_order
from .....webhook.event_types import WebhookEventSyncType
from .....webhook.models import Webhook
from ...tasks import create_delivery_for_subscription_sync_event

TAXES_SUBSCRIPTION_QUERY = """
subscription {
  event {
    __typename
    ... on CalculateTaxes {
      taxBase {
        pricesEnteredWithTax
        currency
        shippingPrice {
          amount
        }
        address {
          id
        }
        channel {
            id
        }

        discounts {
          amount {
            amount
          }
        }

        lines {
          quantity
          chargeTaxes
          productName
          variantName
          productSku
          unitPrice {
            amount
          }

          totalPrice {
            amount
          }
          sourceLine {
            __typename
            ... on CheckoutLine {
              id
            }
            ... on OrderLine {
              id
            }
          }
        }
        sourceObject {
          __typename
          ... on Checkout {
            id
          }
          ... on Order {
            id
          }
        }
      }
    }
  }
}

"""

@freeze_time("2020-03-18 12:00:00")
def test_checkout_calculate_taxes(
    checkout_ready_to_complete,
    webhook_app,
    permission_handle_taxes,
):
    # given
    webhook_app.permissions.add(permission_handle_taxes)
    event_type = WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES
    webhook = Webhook.objects.create(
        name="Webhook",
        app=webhook_app,
        target_url="http://www.example.com/any",
        subscription_query=TAXES_SUBSCRIPTION_QUERY,
    )
    event_type = WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES
    webhook.events.create(event_type=event_type)

    # when
    deliveries = create_delivery_for_subscription_sync_event(
        event_type, checkout_ready_to_complete, webhook
    )

    # then
    assert json.loads(deliveries.payload.payload) == {
        "__typename": "CalculateTaxes",
        "taxBase": {
            "address": {
                "id": to_global_id_or_none(checkout_ready_to_complete.shipping_address)
            },
            "currency": "USD",
            "discounts": [],
            "channel": {"id": to_global_id_or_none(checkout_ready_to_complete.channel)},
            "lines": [
                {
                    "chargeTaxes": True,
                    "productName": "Test product",
                    "productSku": "123",
                    "quantity": 3,
                    "sourceLine": {
                        "id": to_global_id_or_none(
                            checkout_ready_to_complete.lines.first()
                        ),
                        "__typename": "CheckoutLine",
                    },
                    "totalPrice": {"amount": 30.0},
                    "unitPrice": {"amount": 10.0},
                    "variantName": "",
                }
            ],
            "pricesEnteredWithTax": True,
            "shippingPrice": {"amount": 10.0},
            "sourceObject": {
                "id": to_global_id_or_none(checkout_ready_to_complete),
                "__typename": "Checkout",
            },
        },
    }

@freeze_time("2020-03-18 12:00:00")
def test_checkout_calculate_taxes_with_free_shipping_voucher(
    checkout_with_voucher_free_shipping,
    webhook_app,
    permission_handle_taxes,
):
    # given
    checkout = checkout_with_voucher_free_shipping
    webhook_app.permissions.add(permission_handle_taxes)
    event_type = WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES
    webhook = Webhook.objects.create(
        name="Webhook",
        app=webhook_app,
        target_url="http://www.example.com/any",
        subscription_query=TAXES_SUBSCRIPTION_QUERY,
    )
    event_type = WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES
    webhook.events.create(event_type=event_type)

    # when
    deliveries = create_delivery_for_subscription_sync_event(
        event_type, checkout, webhook
    )

    # then
    assert json.loads(deliveries.payload.payload) == {
        "__typename": "CalculateTaxes",
        "taxBase": {
            "address": {"id": to_global_id_or_none(checkout.shipping_address)},
            "currency": "USD",
            "discounts": [],
            "channel": {"id": to_global_id_or_none(checkout.channel)},
            "lines": ANY,
            "pricesEnteredWithTax": True,
            "shippingPrice": {"amount": 0.0},
            "sourceObject": {
                "id": to_global_id_or_none(checkout),
                "__typename": "Checkout",
            },
        },
    }

@freeze_time("2020-03-18 12:00:00")
def test_checkout_calculate_taxes_with_voucher(
    checkout_with_voucher,
    webhook_app,
    permission_handle_taxes,
):

    # given
    webhook_app.permissions.add(permission_handle_taxes)
    event_type = WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES
    webhook = Webhook.objects.create(
        name="Webhook",
        app=webhook_app,
        target_url="http://www.example.com/any",
        subscription_query=TAXES_SUBSCRIPTION_QUERY,
    )
    event_type = WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES
    webhook.events.create(event_type=event_type)

    # when
    deliveries = create_delivery_for_subscription_sync_event(
        event_type, checkout_with_voucher, webhook
    )

    # then
    assert json.loads(deliveries.payload.payload) == {
        "__typename": "CalculateTaxes",
        "taxBase": {
            "address": None,
            "currency": "USD",
            "discounts": [{"amount": {"amount": 20.0}}],
            "channel": {"id": to_global_id_or_none(checkout_with_voucher.channel)},
            "lines": [
                {
                    "chargeTaxes": True,
                    "productName": "Test product",
                    "productSku": "123",
                    "quantity": 3,
                    "sourceLine": {
                        "id": to_global_id_or_none(checkout_with_voucher.lines.first()),
                        "__typename": "CheckoutLine",
                    },
                    "totalPrice": {"amount": 30.0},
                    "unitPrice": {"amount": 10.0},
                    "variantName": "",
                }
            ],
            "pricesEnteredWithTax": True,
            "shippingPrice": {"amount": 0.0},
            "sourceObject": {
                "id": to_global_id_or_none(checkout_with_voucher),
                "__typename": "Checkout",
            },
        },
    }

@freeze_time("2020-03-18 12:00:00")
def test_checkout_calculate_taxes_with_shipping_voucher(
    checkout_with_voucher,
    voucher,
    webhook_app,
    permission_handle_taxes,
):

    # given
    voucher.type = VoucherType.SHIPPING
    webhook_app.permissions.add(permission_handle_taxes)
    event_type = WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES
    webhook = Webhook.objects.create(
        name="Webhook",
        app=webhook_app,
        target_url="http://www.example.com/any",
        subscription_query=TAXES_SUBSCRIPTION_QUERY,
    )
    event_type = WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES
    webhook.events.create(event_type=event_type)

    # when
    deliveries = create_delivery_for_subscription_sync_event(
        event_type, checkout_with_voucher, webhook
    )

    # then
    assert json.loads(deliveries.payload.payload) == {
        "__typename": "CalculateTaxes",
        "taxBase": {
            "address": None,
            "currency": "USD",
            "discounts": [{"amount": {"amount": 20.0}}],
            "channel": {"id": to_global_id_or_none(checkout_with_voucher.channel)},
            "lines": [
                {
                    "chargeTaxes": True,
                    "productName": "Test product",
                    "productSku": "123",
                    "quantity": 3,
                    "sourceLine": {
                        "id": to_global_id_or_none(checkout_with_voucher.lines.first()),
                        "__typename": "CheckoutLine",
                    },
                    "totalPrice": {"amount": 30.0},
                    "unitPrice": {"amount": 10.0},
                    "variantName": "",
                }
            ],
            "pricesEnteredWithTax": True,
            "shippingPrice": {"amount": 0.0},
            "sourceObject": {
                "id": to_global_id_or_none(checkout_with_voucher),
                "__typename": "Checkout",
            },
        },
    }

@freeze_time("2020-03-18 12:00:00")
def test_checkout_calculate_taxes_empty_checkout(
    checkout,
    webhook_app,
    permission_handle_taxes,
):
    # given
    webhook_app.permissions.add(permission_handle_taxes)
    event_type = WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES
    webhook = Webhook.objects.create(
        name="Webhook",
        app=webhook_app,
        target_url="http://www.example.com/any",
        subscription_query=TAXES_SUBSCRIPTION_QUERY,
    )
    event_type = WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES
    webhook.events.create(event_type=event_type)

    # when
    deliveries = create_delivery_for_subscription_sync_event(
        event_type, checkout, webhook
    )

    # then
    assert json.loads(deliveries.payload.payload) == {
        "__typename": "CalculateTaxes",
        "taxBase": {
            "address": None,
            "channel": {"id": to_global_id_or_none(checkout.channel)},
            "currency": "USD",
            "discounts": [],
            "lines": [],
            "pricesEnteredWithTax": True,
            "shippingPrice": {"amount": 0.0},
            "sourceObject": {
                "id": to_global_id_or_none(checkout),
                "__typename": "Checkout",
            },
        },
    }

@freeze_time("2020-03-18 12:00:00")
def test_order_calculate_taxes(
    order_line, webhook_app, permission_handle_taxes, shipping_zone
):

    # given
    order = order_line.order
    expected_shipping_price = Money("2.00", order.currency)
    order.base_shipping_price = expected_shipping_price
    order.save()
    shipping_method = shipping_zone.shipping_methods.first()
    order.shipping_method = shipping_method
    webhook_app.permissions.add(permission_handle_taxes)
    event_type = WebhookEventSyncType.ORDER_CALCULATE_TAXES
    webhook = Webhook.objects.create(
        name="Webhook",
        app=webhook_app,
        target_url="http://www.example.com/any",
        subscription_query=TAXES_SUBSCRIPTION_QUERY,
    )
    event_type = WebhookEventSyncType.ORDER_CALCULATE_TAXES
    webhook.events.create(event_type=event_type)

    # when
    deliveries = create_delivery_for_subscription_sync_event(event_type, order, webhook)

    # then
    shipping_price_amount = shipping_method.channel_listings.get(
        channel=order.channel
    ).price.amount
    shipping_price_amount = quantize_price(shipping_price_amount, order.currency)
    assert expected_shipping_price != shipping_price_amount
    assert json.loads(deliveries.payload.payload) == {
        "__typename": "CalculateTaxes",
        "taxBase": {
            "address": {"id": to_global_id_or_none(order.shipping_address)},
            "currency": "USD",
            "discounts": [],
            "channel": {"id": to_global_id_or_none(order.channel)},
            "lines": [
                {
                    "chargeTaxes": True,
                    "productName": "Test product",
                    "productSku": "SKU_A",
                    "quantity": 3,
                    "sourceLine": {
                        "__typename": "OrderLine",
                        "id": to_global_id_or_none(order_line),
                    },
                    "totalPrice": {"amount": 36.9},
                    "unitPrice": {"amount": 12.3},
                    "variantName": "SKU_A",
                }
            ],
            "pricesEnteredWithTax": True,
            "shippingPrice": {"amount": expected_shipping_price.amount},
            "sourceObject": {
                "__typename": "Order",
                "id": to_global_id_or_none(order),
            },
        },
    }

@freeze_time("2020-03-18 12:00:00")
def test_order_calculate_taxes_with_discounts(
    order_line,
    webhook_app,
    permission_handle_taxes,
):

    # given
    order = order_line.order
    order.total = order_line.total_price + order.shipping_price
    order.undiscounted_total = order.total
    order.save()

    value = Decimal("20")
    discount = partial(fixed_discount, discount=Money(value, order.currency))
    order.total = discount(order.total)
    order.save()
    order.discounts.create(
        value_type=DiscountValueType.FIXED,
        value=value,
        reason="Discount reason",
        amount=(order.undiscounted_total - order.total).gross,  # type: ignore
    )
    recalculate_order(order)
    order.refresh_from_db()

    webhook_app.permissions.add(permission_handle_taxes)
    event_type = WebhookEventSyncType.ORDER_CALCULATE_TAXES
    webhook = Webhook.objects.create(
        name="Webhook",
        app=webhook_app,
        target_url="http://www.example.com/any",
        subscription_query=TAXES_SUBSCRIPTION_QUERY,
    )
    event_type = WebhookEventSyncType.ORDER_CALCULATE_TAXES
    webhook.events.create(event_type=event_type)

    # when
    deliveries = create_delivery_for_subscription_sync_event(event_type, order, webhook)

    # then
    assert json.loads(deliveries.payload.payload) == {
        "__typename": "CalculateTaxes",
        "taxBase": {
            "address": {"id": to_global_id_or_none(order.shipping_address)},
            "currency": "USD",
            "discounts": [{"amount": {"amount": 20.0}}],
            "channel": {"id": to_global_id_or_none(order.channel)},
            "lines": [
                {
                    "chargeTaxes": True,
                    "productName": "Test product",
                    "productSku": "SKU_A",
                    "quantity": 3,
                    "sourceLine": {
                        "__typename": "OrderLine",
                        "id": to_global_id_or_none(order_line),
                    },
                    "totalPrice": {"amount": 36.9},
                    "unitPrice": {"amount": 12.3},
                    "variantName": "SKU_A",
                }
            ],
            "pricesEnteredWithTax": True,
            "shippingPrice": {"amount": 0.0},
            "sourceObject": {"__typename": "Order", "id": to_global_id_or_none(order)},
        },
    }

@freeze_time("2020-03-18 12:00:00")
def test_order_calculate_taxes_empty_order(
    order, webhook_app, permission_handle_taxes, channel_USD
):

    # given
    order = Order.objects.create(channel=channel_USD, currency="USD")
    webhook_app.permissions.add(permission_handle_taxes)
    event_type = WebhookEventSyncType.ORDER_CALCULATE_TAXES
    webhook = Webhook.objects.create(
        name="Webhook",
        app=webhook_app,
        target_url="http://www.example.com/any",
        subscription_query=TAXES_SUBSCRIPTION_QUERY,
    )
    event_type = WebhookEventSyncType.ORDER_CALCULATE_TAXES
    webhook.events.create(event_type=event_type)

    # when
    deliveries = create_delivery_for_subscription_sync_event(event_type, order, webhook)

    # then
    assert json.loads(deliveries.payload.payload) == {
        "__typename": "CalculateTaxes",
        "taxBase": {
            "address": None,
            "currency": "USD",
            "discounts": [],
            "lines": [],
            "pricesEnteredWithTax": True,
            "shippingPrice": {"amount": 0.0},
            "channel": {"id": to_global_id_or_none(order.channel)},
            "sourceObject": {
                "__typename": "Order",
                "id": to_global_id_or_none(order),
            },
        },
    }


text:
package main

import (
	"context"
	"errors"
	"fmt"
	"testing"
)

type secretStore struct {
	store map[string]string
}

type fakeClient struct {
	project secretStore
}

func newFakeClient() *fakeClient {
	return &fakeClient{
		project: secretStore{
			store: make(map[string]string),
		},
	}
}
func (f *fakeClient) CreateSecret(ctx context.Context, secretID string) error {
	f.project.store[secretID] = ""
	return nil
}

func (f *fakeClient) AddSecretVersion(ctx context.Context, secretName string, payload []byte) error {
	f.project.store[secretName] = string(payload)
	return nil
}

func (f *fakeClient) GetSecretValue(ctx context.Context, secretName string, versionName string) ([]byte, bool, error) {
	if len(f.project.store) == 0 {
		return nil, false, errors.New("Secret was not created!")
	} else {
		if val, ok := f.project.store[secretName]; ok {
			return []byte(val), true, nil
		} else {
			err := fmt.Sprintf("Secret with name %s was never added", secretName)
			return nil, false, errors.New(err)
		}
	}
}

func (f *fakeClient) CheckSecret(ctx context.Context, secretName string) (bool, error) {
	if len(f.project.store) == 0 {
		return false, errors.New("Secret was not created!")
	} else {
		if _, ok := f.project.store[secretName]; ok {
			return true, nil
		} else {
			err := fmt.Sprintf("Secret with name %s was never added", secretName)
			return false, errors.New(err)
		}
	}
}

const (
	secretID = "prowjob-webhook-secrets"
	payload  = "xxx123"
)

func TestCreateSecrets(t *testing.T) {
	ctx := context.Background()
	f := newFakeClient()
	f.CreateSecret(ctx, secretID)
	if len(f.project.store) == 0 {
		t.Errorf("secret was not created successfully")
	}
}

func TestGetSecretValue(t *testing.T) {
	ctx := context.Background()
	f := newFakeClient()
	f.AddSecretVersion(ctx, secretID, []byte(payload))
	res, exist, err := f.GetSecretValue(ctx, secretID, "")
	if err != nil {
		t.Errorf("could not get secret value %v", err)
	}
	if !exist {
		t.Errorf("secret was not created")
	}
	if string(res) != payload {
		t.Errorf("wrong secret obtained")
	}
}


text:
using chromeos::CrosSettings;
using chromeos::DBusThreadManager;
using chromeos::UpdateEngineClient;
using chromeos::UserManager;
using chromeos::WizardController;

VersionUpdater* VersionUpdater::Create() {
  return new VersionUpdaterCros;
}

void VersionUpdaterCros::CheckForUpdate(const StatusCallback& callback) {
  callback_ = callback;

  UpdateEngineClient* update_engine_client =
      DBusThreadManager::Get()->GetUpdateEngineClient();
  update_engine_client->AddObserver(this);

  // Make sure that libcros is loaded and OOBE is complete.
  if (!WizardController::default_controller() ||
      WizardController::IsDeviceRegistered()) {
    update_engine_client->RequestUpdateCheck(
        base::Bind(&VersionUpdaterCros::OnUpdateCheck, base::Unretained(this)));
  }
}

void VersionUpdaterCros::RelaunchBrowser() const {
  DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart();
}

void VersionUpdaterCros::SetReleaseChannel(const std::string& channel) {
  DBusThreadManager::Get()->GetUpdateEngineClient()->SetReleaseTrack(channel);
  // For local owner set the field in the policy blob too.
  if (UserManager::Get()->IsCurrentUserOwner())
    CrosSettings::Get()->SetString(chromeos::kReleaseChannel, channel);
}

void VersionUpdaterCros::GetReleaseChannel(const ChannelCallback& cb) {
  channel_callback_ = cb;

  // TODO(jhawkins): Store on this object.
  UpdateEngineClient* update_engine_client =
      DBusThreadManager::Get()->GetUpdateEngineClient();

  // Request the channel information. Use the observer to track the help page
  // handler and ensure it does not get deleted before the callback.
  update_engine_client->GetReleaseTrack(
      base::Bind(&VersionUpdaterCros::UpdateSelectedChannel,
                 base::Unretained(this)));
}

VersionUpdaterCros::VersionUpdaterCros() {}

VersionUpdaterCros::~VersionUpdaterCros() {
  UpdateEngineClient* update_engine_client =
      DBusThreadManager::Get()->GetUpdateEngineClient();
  update_engine_client->RemoveObserver(this);
}

void VersionUpdaterCros::UpdateStatusChanged(
    const UpdateEngineClient::Status& status) {
  Status my_status = UPDATED;
  int progress = 0;

  switch (status.status) {
    case UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE:
      my_status = CHECKING;
      break;
    case UpdateEngineClient::UPDATE_STATUS_DOWNLOADING:
      progress = static_cast<int>(status.download_progress * 100.0);
      // Fall through.
    case UpdateEngineClient::UPDATE_STATUS_UPDATE_AVAILABLE:
      my_status = UPDATING;
      break;
    case UpdateEngineClient::UPDATE_STATUS_VERIFYING:
    case UpdateEngineClient::UPDATE_STATUS_FINALIZING:
      // Once download is finished progress is at 100%, is should no go down
      // while status is the same.
      progress = 100;
      my_status = UPDATING;
      break;
    case UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT:
      my_status = NEARLY_UPDATED;
      break;
    default:
      // TODO(jhawkins): Handle error conditions.
      break;
  }

  callback_.Run(my_status, progress, string16());
}

void VersionUpdaterCros::OnUpdateCheck(
    UpdateEngineClient::UpdateCheckResult result) {
  // If version updating is not implemented, this binary is the most up-to-date
  // possible with respect to automatic updating.
  if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED)
    callback_.Run(UPDATED, 0, string16());
}

void VersionUpdaterCros::UpdateSelectedChannel(const std::string& channel) {
  channel_callback_.Run(channel);
}


text:
/*!
    \file  gd32f4xx_misc.c
    \brief MISC driver
*/

/*
    Copyright (C) 2016 GigaDevice

    2016-08-15, V1.0.0, firmware for GD32F4xx
*/

#include "gd32f4xx_misc.h"

/*!
    \brief      set the priority group
    \param[in]  nvic_prigroup: the NVIC priority group
      \arg        NVIC_PRIGROUP_PRE0_SUB4:0 bits for pre-emption priority 4 bits for subpriority
      \arg        NVIC_PRIGROUP_PRE1_SUB3:1 bits for pre-emption priority 3 bits for subpriority
      \arg        NVIC_PRIGROUP_PRE2_SUB2:2 bits for pre-emption priority 2 bits for subpriority
      \arg        NVIC_PRIGROUP_PRE3_SUB1:3 bits for pre-emption priority 1 bits for subpriority
      \arg        NVIC_PRIGROUP_PRE4_SUB0:4 bits for pre-emption priority 0 bits for subpriority
    \param[out] none
    \retval     none
*/
void nvic_priority_group_set(uint32_t nvic_prigroup)
{
    /* set the priority group value */
    SCB->AIRCR = NVIC_AIRCR_VECTKEY_MASK | nvic_prigroup;
}

/*!
    \brief      enable NVIC request
    \param[in]  nvic_irq: the NVIC interrupt request, detailed in IRQn_Type
    \param[in]  nvic_irq_pre_priority: the pre-emption priority needed to set
    \param[in]  nvic_irq_sub_priority: the subpriority needed to set
    \param[out] none
    \retval     none
*/
void nvic_irq_enable(uint8_t nvic_irq, uint8_t nvic_irq_pre_priority,
                     uint8_t nvic_irq_sub_priority)
{
    uint32_t temp_priority = 0x00U, temp_pre = 0x00U, temp_sub = 0x00U;
    /* use the priority group value to get the temp_pre and the temp_sub */
    if(((SCB->AIRCR) & (uint32_t)0x700U)==NVIC_PRIGROUP_PRE0_SUB4){
        temp_pre=0U;
        temp_sub=0x4U;
    }else if(((SCB->AIRCR) & (uint32_t)0x700U)==NVIC_PRIGROUP_PRE1_SUB3){
        temp_pre=1U;
        temp_sub=0x3U;
    }else if(((SCB->AIRCR) & (uint32_t)0x700U)==NVIC_PRIGROUP_PRE2_SUB2){
        temp_pre=2U;
        temp_sub=0x2U;
    }else if(((SCB->AIRCR) & (uint32_t)0x700U)==NVIC_PRIGROUP_PRE3_SUB1){
        temp_pre=3U;
        temp_sub=0x1U;
    }else if(((SCB->AIRCR) & (uint32_t)0x700U)==NVIC_PRIGROUP_PRE4_SUB0){
        temp_pre=4U;
        temp_sub=0x0U;
    }else{
    }
    /* get the temp_priority to fill the NVIC->IP register */
    temp_priority = (uint32_t)nvic_irq_pre_priority << (0x4U - temp_pre);
    temp_priority |= nvic_irq_sub_priority &(0x0FU >> (0x4U - temp_sub));
    temp_priority = temp_priority << 0x04U;
    NVIC->IP[nvic_irq] = (uint8_t)temp_priority;
    /* enable the selected IRQ */
    NVIC->ISER[nvic_irq >> 0x05U] = (uint32_t)0x01U << (nvic_irq & (uint8_t)0x1FU);
}

/*!
    \brief      disable NVIC request
    \param[in]  nvic_irq: the NVIC interrupt request, detailed in IRQn_Type
    \param[out] none
    \retval     none
*/
void nvic_irq_disable(uint8_t nvic_irq)
{
    /* disable the selected IRQ.*/
    NVIC->ICER[nvic_irq >> 0x05] = (uint32_t)0x01 << (nvic_irq & (uint8_t)0x1F);
}

/*!
    \brief      set the NVIC vector table base address
    \param[in]  nvic_vict_tab: the RAM or FLASH base address
      \arg        NVIC_VECTTAB_RAM: RAM base address
      \are        NVIC_VECTTAB_FLASH: Flash base address
    \param[in]  offset: Vector Table offset
    \param[out] none
    \retval     none
*/
void nvic_vector_table_set(uint32_t nvic_vict_tab, uint32_t offset)
{
    SCB->VTOR = nvic_vict_tab | (offset & NVIC_VECTTAB_OFFSET_MASK);
}

/*!
    \brief      set the state of the low power mode
    \param[in]  lowpower_mode: the low power mode state
      \arg        SCB_LPM_SLEEP_EXIT_ISR: if chose this para, the system always enter low power
                    mode by exiting from ISR
      \arg        SCB_LPM_DEEPSLEEP: if chose this para, the system will enter the DEEPSLEEP mode
      \arg        SCB_LPM_WAKE_BY_ALL_INT: if chose this para, the lowpower mode can be woke up
                    by all the enable and disable interrupts
    \param[out] none
    \retval     none
*/
void system_lowpower_set(uint8_t lowpower_mode)
{
    SCB->SCR |= (uint32_t)lowpower_mode;
}

/*!
    \brief      reset the state of the low power mode
    \param[in]  lowpower_mode: the low power mode state
      \arg        SCB_LPM_SLEEP_EXIT_ISR: if chose this para, the system will exit low power
                    mode by exiting from ISR
      \arg        SCB_LPM_DEEPSLEEP: if chose this para, the system will enter the SLEEP mode
      \arg        SCB_LPM_WAKE_BY_ALL_INT: if chose this para, the lowpower mode only can be
                    woke up by the enable interrupts
    \param[out] none
    \retval     none
*/
void system_lowpower_reset(uint8_t lowpower_mode)
{
    SCB->SCR &= (~(uint32_t)lowpower_mode);
}

/*!
    \brief      set the systick clock source
    \param[in]  systick_clksource: the systick clock source needed to choose
      \arg        SYSTICK_CLKSOURCE_HCLK: systick clock source is from HCLK
      \arg        SYSTICK_CLKSOURCE_HCLK_DIV8: systick clock source is from HCLK/8
    \param[out] none
    \retval     none
*/

void systick_clksource_set(uint32_t systick_clksource)
{
    if(SYSTICK_CLKSOURCE_HCLK == systick_clksource ){
        /* set the systick clock source from HCLK */
        SysTick->CTRL |= SYSTICK_CLKSOURCE_HCLK;
    }else{
        /* set the systick clock source from HCLK/8 */
        SysTick->CTRL &= SYSTICK_CLKSOURCE_HCLK_DIV8;
    }
}


text:
package agent

import (
	"fmt"
	"runtime"

	"github.com/skydive-project/skydive/config"
	"github.com/skydive-project/skydive/graffiti/graph"
	"github.com/skydive-project/skydive/graffiti/logging"
	"github.com/skydive-project/skydive/plugin"
	"github.com/skydive-project/skydive/probe"
	"github.com/skydive-project/skydive/topology"
	tp "github.com/skydive-project/skydive/topology/probes"
	"github.com/skydive-project/skydive/topology/probes/bess"
	"github.com/skydive-project/skydive/topology/probes/blockdev"
	"github.com/skydive-project/skydive/topology/probes/docker"
	"github.com/skydive-project/skydive/topology/probes/hardware"
	"github.com/skydive-project/skydive/topology/probes/libvirt"
	"github.com/skydive-project/skydive/topology/probes/lldp"
	"github.com/skydive-project/skydive/topology/probes/lxd"
	"github.com/skydive-project/skydive/topology/probes/netlink"
	"github.com/skydive-project/skydive/topology/probes/netns"
	"github.com/skydive-project/skydive/topology/probes/neutron"
	"github.com/skydive-project/skydive/topology/probes/opencontrail"
	"github.com/skydive-project/skydive/topology/probes/ovn"
	"github.com/skydive-project/skydive/topology/probes/ovsdb"
	"github.com/skydive-project/skydive/topology/probes/runc"
	"github.com/skydive-project/skydive/topology/probes/socketinfo"
	"github.com/skydive-project/skydive/topology/probes/vpp"
)

func registerStaticProbes() {
	blockdev.Register()
	netlink.Register()
	topology.RegisterContainer()
	lldp.Register()
	lxd.Register()
	neutron.Register()
	opencontrail.Register()
	ovsdb.Register()
	libvirt.Register()
	ovn.Register()
	hardware.Register()
}

// NewTopologyProbe creates a new topology probe
func NewTopologyProbe(name string, ctx tp.Context, bundle *probe.Bundle) (probe.Handler, error) {
	switch name {
	case "blockdev":
		return blockdev.NewProbe(ctx, bundle)
	case "netlink":
		return netlink.NewProbe(ctx, bundle)
	case "netns":
		return netns.NewProbe(ctx, bundle)
	case "ovsdb":
		return ovsdb.NewProbe(ctx, bundle)
	case "lxd":
		return lxd.NewProbe(ctx, bundle)
	case "docker":
		return docker.NewProbe(ctx, bundle)
	case "lldp":
		return lldp.NewProbe(ctx, bundle)
	case "neutron":
		return neutron.NewProbe(ctx, bundle)
	case "opencontrail":
		return opencontrail.NewProbe(ctx, bundle)
	case "socketinfo":
		return socketinfo.NewProbe(ctx, bundle)
	case "libvirt":
		return libvirt.NewProbe(ctx, bundle)
	case "runc":
		return runc.NewProbe(ctx, bundle)
	case "vpp":
		return vpp.NewProbe(ctx, bundle)
	case "bess":
		return bess.NewProbe(ctx, bundle)
	case "hardware":
		return hardware.NewProbe(ctx, bundle)
	default:
		return nil, fmt.Errorf("unsupported probe %s", name)
	}
}

func loadPluginProbes(ctx tp.Context, bundle *probe.Bundle) error {
	plugins, err := plugin.LoadTopologyPlugins()
	if err != nil {
		return err
	}

	for _, p := range plugins {
		p.Register()
	}

	// then register agent plugins
	for _, p := range plugins {
		if p.AgentCtor != nil {
			handler, err := p.AgentCtor(ctx, bundle)
			if err != nil {
				return fmt.Errorf("Failed to instantiate plugin %s: %s", p.Name, err)
			}

			bundle.AddHandler(p.Name, handler)
		}
	}

	return nil
}

// NewTopologyProbeBundle creates a new topology probe.Bundle based on the configuration
func NewTopologyProbeBundle(g *graph.Graph, hostNode *graph.Node) (*probe.Bundle, error) {
	registerStaticProbes()

	ctx := tp.Context{
		Logger:   logging.GetLogger(),
		Config:   config.GetConfig(),
		Graph:    g,
		RootNode: hostNode,
	}

	bundle := probe.NewBundle()
	if err := loadPluginProbes(ctx, bundle); err != nil {
		return nil, err
	}

	probeList := []string{"hardware"}
	if runtime.GOOS == "linux" {
		probeList = append(probeList, "netlink", "netns")
	}

	probeList = append(probeList, config.GetStringSlice("agent.topology.probes")...)
	logging.GetLogger().Infof("Topology probes: %v", probeList)

	if runtime.GOOS == "linux" {
		nlHandler, err := NewTopologyProbe("netlink", ctx, bundle)
		if err != nil {
			return nil, err
		}
		bundle.AddHandler("netlink", nlHandler)

		nsHandler, err := NewTopologyProbe("netns", ctx, bundle)
		if err != nil {
			return nil, err
		}
		bundle.AddHandler("netns", nsHandler)
	}

	for _, t := range probeList {
		if bundle.GetHandler(t) != nil {
			continue
		}

		handler, err := NewTopologyProbe(t, ctx, bundle)
		if err != nil {
			return nil, err
		} else if handler != nil {
			bundle.AddHandler(t, handler)
		}
	}

	return bundle, nil
}


text:
            <a href="<?php echo $prefix;?>index.php">
Home

            <a href="<?php echo $prefix;?>products">
Products

            <a href="<?php echo $prefix;?>industries">
Industries Served

            <a href="<?php echo $prefix;?>news-events">
News & Events

            <a href="<?php echo $prefix;?>career">
Career

            <a href="<?php echo $prefix;?>about/history.php">
About

            <a href="<?php echo $prefix;?>contact">
Contact Us

        © 2012 Gamako. Site by Antikode.


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

<TITLE>
L-Index
</TITLE>

<META NAME="date" CONTENT="2012-04-09">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
      Use
      Tree
      Deprecated
    Index
      Help

 PREV LETTER
 NEXT LETTER

  FRAMES
 NO FRAMES

  All Classes

A B C D F G I L M O P R S T U

L

listAlbums() -
Method in interface cs213.photoAlbum.control.Control

Returns a list of all the albums that the Current User has.

listAlbums() -
Method in class cs213.photoAlbum.control.Controller

Returns a list of all the albums that the Current User has.

listPhotoInfo(String) -
Method in interface cs213.photoAlbum.control.Control

list the information for a photo with the given name.

listPhotoInfo(String) -
Method in class cs213.photoAlbum.control.Controller

list the information for a photo with the given name.

listPhotos(String) -
Method in interface cs213.photoAlbum.control.Control

Returns a list of photos inside of the album with the given album name.

listPhotos(String) -
Method in class cs213.photoAlbum.control.Controller

Returns a list of photos inside of the album with the given album name.

listUsers() -
Method in interface cs213.photoAlbum.control.Control

Returns the Arraylist of users.

listUsers() -
Method in class cs213.photoAlbum.control.Controller

Returns the Arraylist of users.

load() -
Method in class cs213.photoAlbum.model.Backend

When this method is called, it will read the user.data file from the data folder,
 and use it populate the list of users and their data.

load() -
Method in interface cs213.photoAlbum.model.BackendInterface

When this method is called, it will read the user.data file from the data folder,
 and use it populate the list of users and their data.

login(String) -
Method in interface cs213.photoAlbum.control.Control

Sets the global variable currentUser to the given userID if the userID exists in the list of users.

login(String) -
Method in class cs213.photoAlbum.control.Controller

Sets the global variable currentUser to the given userID if the userID exists in the list of users.

logout() -
Method in interface cs213.photoAlbum.control.Control

Attempts to save the user list containing all the information on users, albums, photos and tags, and then exists the program.

logout() -
Method in class cs213.photoAlbum.control.Controller

Attempts to save the user list containing all the information on users, albums, photos and tags, and then exists the program.

      Overview
      Package
      Class
      Use
      Tree
      Deprecated
    Index
      Help

 PREV LETTER
 NEXT LETTER

  FRAMES
 NO FRAMES

  All Classes

A B C D F G I L M O P R S T U


text:
package net.nemerosa.ontrack.acceptance.browser;

import java.io.IOException;

public class ConfigurationException extends RuntimeException {
    public ConfigurationException(String message, IOException ex) {
        super(message, ex);
    }
}


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\CustomerOrdersIngredientsSearch */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin([
        'action' => ['index'],
        'method' => 'get',
    ]); ?>

    <?= $form->field($model, 'id') ?>

    <?= $form->field($model, 'created_on') ?>

    <?= $form->field($model, 'category') ?>

    <?= $form->field($model, 'ingredient_id') ?>

    <?= $form->field($model, 'ingredient_percent') ?>

    <?php // echo $form->field($model, 'modified_by') ?>

    <?php // echo $form->field($model, 'modified_on') ?>

    <?php // echo $form->field($model, 'order_id') ?>

        <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
        <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>

    <?php ActiveForm::end(); ?>


text:
find ./build ! -name .gitkeep ! -wholename ./build -delete
rm -rf Debug
rm -rf Release


text:
package com.coolweather.app.fragment;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.coolweather.app.R;
/**
 * Created by DT on 2016/4/16.
 */
public class MenuLeftFragment extends Fragment {
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState)
    {
        return inflater.inflate(R.layout.layout_menu, container, false);
    }
}


text:
package main

import (
	"fmt"

	"os"

	log "github.com/Sirupsen/logrus"
	"github.com/docopt/docopt-go"
	"github.com/projectcalico/calicoctl/calicoctl/commands"
)

func main() {
	doc := `Usage:
  calicoctl [options] <command> [<args>...]

    create    Create a resource by filename or stdin.
    replace   Replace a resource by filename or stdin.
    apply     Apply a resource by filename or stdin.  This creates a resource
              if it does not exist, and replaces a resource if it does exists.
    delete    Delete a resource identified by file, stdin or resource type and
              name.
    get       Get a resource identified by file, stdin or resource type and
              name.
    config    Manage system-wide and low-level node configuration options.
    ipam      IP address management.
    node      Calico node management.
    version   Display the version of calicoctl.

Options:
  -h --help               Show this screen.
  -l --log-level=<level>  Set the log level (one of panic, fatal, error,
                          warn, info, debug) [default: panic]

Description:
  The calicoctl command line tool is used to manage Calico network and security
  policy, to view and manage endpoint configuration, and to manage a Calico
  node instance.

  See 'calicoctl <command> --help' to read about a specific subcommand.
`
	arguments, _ := docopt.Parse(doc, nil, true, commands.VERSION_SUMMARY, true, false)

	if logLevel := arguments["--log-level"]; logLevel != nil {
		parsedLogLevel, err := log.ParseLevel(logLevel.(string))
		if err != nil {
			fmt.Printf("Unknown log level: %s, expected one of: \n"+
				"panic, fatal, error, warn, info, debug.\n", logLevel)
			os.Exit(1)
		} else {
			log.SetLevel(parsedLogLevel)
			log.Infof("Log level set to %v", parsedLogLevel)
		}
	}

	if arguments["<command>"] != nil {
		command := arguments["<command>"].(string)
		args := append([]string{command}, arguments["<args>"].([]string)...)

		switch command {
		case "create":
			commands.Create(args)
		case "replace":
			commands.Replace(args)
		case "apply":
			commands.Apply(args)
		case "delete":
			commands.Delete(args)
		case "get":
			commands.Get(args)
		case "version":
			commands.Version(args)
		case "node":
			commands.Node(args)
		case "ipam":
			commands.IPAM(args)
		case "config":
			commands.Config(args)
		default:
			fmt.Fprintf(os.Stderr, "Unknown command: %q\n", command)
			fmt.Println(doc)
			os.Exit(1)
		}
	}
}


text:
#include "pico/stdlib.h"
#include "pico/multicore.h"
#include "hardware/sync.h"
#include "hardware/irq.h"
#include "hardware/structs/scb.h"
#include "hardware/structs/sio.h"
#include "hardware/regs/psm.h"
#include "hardware/claim.h"
#if PICO_USE_STACK_GUARDS
#include "pico/runtime.h"
#endif

static inline void multicore_fifo_push_blocking_inline(uint32_t data) {
    // We wait for the fifo to have some space
    while (!multicore_fifo_wready())
        tight_loop_contents();

    sio_hw->fifo_wr = data;

    // Fire off an event to the other core
    __sev();
}

void multicore_fifo_push_blocking(uint32_t data) {
    multicore_fifo_push_blocking_inline(data);
}

bool multicore_fifo_push_timeout_us(uint32_t data, uint64_t timeout_us) {
    absolute_time_t end_time = make_timeout_time_us(timeout_us);
    // We wait for the fifo to have some space
    while (!multicore_fifo_wready()) {
        tight_loop_contents();
        if (time_reached(end_time)) return false;
    }

    sio_hw->fifo_wr = data;

    // Fire off an event to the other core
    __sev();
    return true;
}

static inline uint32_t multicore_fifo_pop_blocking_inline(void) {
    // If nothing there yet, we wait for an event first,
    // to try and avoid too much busy waiting
    while (!multicore_fifo_rvalid())
        __wfe();

    return sio_hw->fifo_rd;
}

uint32_t multicore_fifo_pop_blocking() {
    return multicore_fifo_pop_blocking_inline();
}

bool multicore_fifo_pop_timeout_us(uint64_t timeout_us, uint32_t *out) {
    absolute_time_t end_time = make_timeout_time_us(timeout_us);
    // If nothing there yet, we wait for an event first,
    // to try and avoid too much busy waiting
    while (!multicore_fifo_rvalid()) {
        __wfe();
        if (time_reached(end_time)) return false;
    }

    *out = sio_hw->fifo_rd;
    return true;
}

// Default stack for core1 ... if multicore_launch_core1 is not included then .stack1 section will be garbage collected
static uint32_t __attribute__((section(".stack1"))) core1_stack[PICO_CORE1_STACK_SIZE / sizeof(uint32_t)];

static void __attribute__ ((naked)) core1_trampoline(void) {
    __asm("pop {r0, r1, pc}");
}

int core1_wrapper(int (*entry)(void), void *stack_base) {
#if PICO_USE_STACK_GUARDS
    // install core1 stack guard
    runtime_install_stack_guard(stack_base);
#endif
    irq_init_priorities();
    return (*entry)();
}

void multicore_reset_core1() {
    // Use atomic aliases just in case core 1 is also manipulating some posm state
    io_rw_32 *power_off = (io_rw_32 *) (PSM_BASE + PSM_FRCE_OFF_OFFSET);
    io_rw_32 *power_off_set = hw_set_alias(power_off);
    io_rw_32 *power_off_clr = hw_clear_alias(power_off);

    // Hard-reset core 1.
    // Reading back confirms the core 1 reset is in the correct state, but also
    // forces APB IO bridges to fence on any internal store buffering
    *power_off_set = PSM_FRCE_OFF_PROC1_BITS;
    while (!(*power_off & PSM_FRCE_OFF_PROC1_BITS)) tight_loop_contents();

    // Bring core 1 back out of reset. It will drain its own mailbox FIFO, then push
    // a 0 to our mailbox to tell us it has done this.
    *power_off_clr = PSM_FRCE_OFF_PROC1_BITS;
}

void multicore_sleep_core1() {
    multicore_reset_core1();
    // note we give core1 an invalid stack pointer, as it should not be used
    // note also if we ge simply passed a function that returned immediately, we'd end up in core1_hang anyway
    //  however that would waste 2 bytes for that function (the horror!)
    extern void core1_hang(void); // in crt0.S
    multicore_launch_core1_raw(core1_hang, (uint32_t *) -1, scb_hw->vtor);
}

void multicore_launch_core1_with_stack(void (*entry)(void), uint32_t *stack_bottom, size_t stack_size_bytes) {
    assert(!(stack_size_bytes & 3u));
    uint32_t *stack_ptr = stack_bottom + stack_size_bytes / sizeof(uint32_t);
    // push 2 values onto top of stack for core1_trampoline
    stack_ptr -= 3;
    stack_ptr[0] = (uintptr_t) entry;
    stack_ptr[1] = (uintptr_t) stack_bottom;
    stack_ptr[2] = (uintptr_t) core1_wrapper;
    multicore_launch_core1_raw(core1_trampoline, stack_ptr, scb_hw->vtor);
}

void multicore_launch_core1(void (*entry)(void)) {
    extern char __StackOneBottom;
    uint32_t *stack_limit = (uint32_t *) &__StackOneBottom;
    // hack to reference core1_stack although that pointer is wrong.... core1_stack should always be <= stack_limit, if not boom!
    uint32_t *stack = core1_stack <= stack_limit ? stack_limit : (uint32_t *) -1;
    multicore_launch_core1_with_stack(entry, stack, sizeof(core1_stack));
}

void multicore_launch_core1_raw(void (*entry)(void), uint32_t *sp, uint32_t vector_table) {
    uint32_t cmd_sequence[] = {0, 0, 1, (uintptr_t) vector_table, (uintptr_t) sp, (uintptr_t) entry};

    uint seq = 0;
    do {
        uint cmd = cmd_sequence[seq];
        // we drain before sending a 0
        if (!cmd) {
            multicore_fifo_drain();
            __sev(); // core 1 may be waiting for fifo space
        }
        multicore_fifo_push_blocking(cmd);
        uint32_t response = multicore_fifo_pop_blocking();
        // move to next state on correct response otherwise start over
        seq = cmd == response ? seq + 1 : 0;
    } while (seq < count_of(cmd_sequence));
}

#define LOCKOUT_MAGIC_START 0x73a8831e
#define LOCKOUT_MAGIC_END (LOCKOUT_MAGIC_START ^ -1)

static_assert(SIO_IRQ_PROC1 == SIO_IRQ_PROC0 + 1, "");

static mutex_t lockout_mutex;
static bool lockout_in_progress;

// note this method is in RAM because lockout is used when writing to flash
// it only makes inline calls
static void __isr __not_in_flash_func(multicore_lockout_handler)(void) {
    multicore_fifo_clear_irq();
    while (multicore_fifo_rvalid()) {
        if (sio_hw->fifo_rd == LOCKOUT_MAGIC_START) {
            uint32_t save = save_and_disable_interrupts();
            multicore_fifo_push_blocking_inline(LOCKOUT_MAGIC_START);
            while (multicore_fifo_pop_blocking_inline() != LOCKOUT_MAGIC_END) {
                tight_loop_contents(); // not tight but endless potentially
            }
            restore_interrupts(save);
            multicore_fifo_push_blocking_inline(LOCKOUT_MAGIC_END);
        }
    }
}

static void check_lockout_mutex_init(void) {
    // use known available lock - we only need it briefly
    uint32_t save = hw_claim_lock();
    if (!mutex_is_initialzed(&lockout_mutex)) {
        mutex_init(&lockout_mutex);
    }
    hw_claim_unlock(save);
}

void multicore_lockout_victim_init() {
    check_lockout_mutex_init();
    uint core_num = get_core_num();
    irq_set_exclusive_handler(SIO_IRQ_PROC0 + core_num, multicore_lockout_handler);
    irq_set_enabled(SIO_IRQ_PROC0 + core_num, true);
}

static bool multicore_lockout_handshake(uint32_t magic, absolute_time_t until) {
    uint irq_num = SIO_IRQ_PROC0 + get_core_num();
    bool enabled = irq_is_enabled(irq_num);
    if (enabled) irq_set_enabled(irq_num, false);
    bool rc = false;
    do {
        int64_t next_timeout_us = absolute_time_diff_us(get_absolute_time(), until);
        if (next_timeout_us < 0) {
            break;
        }
        multicore_fifo_push_timeout_us(magic, next_timeout_us);
        next_timeout_us = absolute_time_diff_us(get_absolute_time(), until);
        if (next_timeout_us < 0) {
            break;
        }
        uint32_t word = 0;
        if (!multicore_fifo_pop_timeout_us(next_timeout_us, &word)) {
            break;
        }
        if (word == magic) {
            rc = true;
        }
    } while (!rc);
    if (enabled) irq_set_enabled(irq_num, true);
    return rc;
}

static bool multicore_lockout_start_block_until(absolute_time_t until) {
    check_lockout_mutex_init();
    if (!mutex_enter_block_until(&lockout_mutex, until)) {
        return false;
    }
    hard_assert(!lockout_in_progress);
    bool rc = multicore_lockout_handshake(LOCKOUT_MAGIC_START, until);
    lockout_in_progress = rc;
    mutex_exit(&lockout_mutex);
    return rc;
}

bool multicore_lockout_start_timeout_us(uint64_t timeout_us) {
    return multicore_lockout_start_block_until(make_timeout_time_us(timeout_us));
}

void multicore_lockout_start_blocking() {
    multicore_lockout_start_block_until(at_the_end_of_time);
}

static bool multicore_lockout_end_block_until(absolute_time_t until) {
    assert(mutex_is_initialzed(&lockout_mutex));
    if (!mutex_enter_block_until(&lockout_mutex, until)) {
        return false;
    }
    assert(lockout_in_progress);
    bool rc = multicore_lockout_handshake(LOCKOUT_MAGIC_END, until);
    if (rc) {
        lockout_in_progress = false;
    }
    mutex_exit(&lockout_mutex);
    return rc;
}

bool multicore_lockout_end_timeout_us(uint64_t timeout_us) {
    return multicore_lockout_end_block_until(make_timeout_time_us(timeout_us));
}

void multicore_lockout_end_blocking() {
    multicore_lockout_end_block_until(at_the_end_of_time);
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Ophiobolus myrti Gucevic

### Remarks
null


text:
package org.drip.function.r1tor1;

/*
 * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 */

/*!
 * Copyright (C) 2017 Lakshmi Krishnamurthy
 * Copyright (C) 2016 Lakshmi Krishnamurthy
 * Copyright (C) 2015 Lakshmi Krishnamurthy
 *
 *  This file is part of DRIP, a free-software/open-source library for buy/side financial/trading model
 *  	libraries targeting analysts and developers
 *  	https://lakshmidrip.github.io/DRIP/
 *
 *  DRIP is composed of four main libraries:
 *
 *  - DRIP Fixed Income - https://lakshmidrip.github.io/DRIP-Fixed-Income/
 *  - DRIP Asset Allocation - https://lakshmidrip.github.io/DRIP-Asset-Allocation/
 *  - DRIP Numerical Optimizer - https://lakshmidrip.github.io/DRIP-Numerical-Optimizer/
 *  - DRIP Statistical Learning - https://lakshmidrip.github.io/DRIP-Statistical-Learning/
 *
 *  - DRIP Fixed Income: Library for Instrument/Trading Conventions, Treasury Futures/Options,
 *  	Funding/Forward/Overnight Curves, Multi-Curve Construction/Valuation, Collateral Valuation and XVA
 *  	Metric Generation, Calibration and Hedge Attributions, Statistical Curve Construction, Bond RV
 *  	Metrics, Stochastic Evolution and Option Pricing, Interest Rate Dynamics and Option Pricing, LMM
 *  	Extensions/Calibrations/Greeks, Algorithmic Differentiation, and Asset Backed Models and Analytics.
 *
 *  - DRIP Asset Allocation: Library for model libraries for MPT framework, Black Litterman Strategy
 *  	Incorporator, Holdings Constraint, and Transaction Costs.
 *
 *  - DRIP Numerical Optimizer: Library for Numerical Optimization and Spline Functionality.
 *
 *  - DRIP Statistical Learning: Library for Statistical Evaluation and Machine Learning.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *   	you may not use this file except in compliance with the License.
 *
 *  You may obtain a copy of the License at
 *  	http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  	distributed under the License is distributed on an "AS IS" BASIS,
 *  	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 *  See the License for the specific language governing permissions and
 *  	limitations under the License.
 */

/**
 * FunctionClassSupremum implements the Univariate Function that corresponds to the Supremum among the
 *  specified Class of Functions.
 *
 * @author Lakshmi Krishnamurthy
 */

public class FunctionClassSupremum extends org.drip.function.definition.R1ToR1 {
	class IndexSupremum {
		int _iIndex = -1;
		double _dblSupremum = java.lang.Double.NaN;

		IndexSupremum (
			final int iIndex,
			final double dblSupremum)
		{
			_iIndex = iIndex;
			_dblSupremum = dblSupremum;
		}
	};

	private org.drip.function.definition.R1ToR1[] _aAUClass = null;

	private IndexSupremum supremum (
		final double dblVariate)
	{
		int iIndex = 0;
		int iNumFunction = _aAUClass.length;

		try {
			double dblSupremum = _aAUClass[0].evaluate (dblVariate);

			for (int i = 1; i < iNumFunction; ++i) {
				double dblValue = _aAUClass[i].evaluate (dblVariate);

				if (dblValue > dblSupremum) {
					iIndex = i;
					dblSupremum = dblValue;
				}
			}

			return new IndexSupremum (iIndex, dblSupremum);
		} catch (java.lang.Exception e) {
			e.printStackTrace();
		}

		return null;
	}

	/**
	 * FunctionClassSupremum Cnstructor
	 *
	 * @param aAUClass Array of Functions in the Class
	 *
	 * @throws java.lang.Exception Thrown if the Inputs are Invalid
	 */

	public FunctionClassSupremum (
		final org.drip.function.definition.R1ToR1[] aAUClass)
		throws java.lang.Exception
	{
		super (null);

		if (null == (_aAUClass = aAUClass) || 0 == _aAUClass.length)
			throw new java.lang.Exception ("FunctionClassSupremum ctr => Invalid Inputs");
	}

	/**
	 * Retrieve the Class of Functions
	 *
	 * @return The Class of Functions
	 */

	public org.drip.function.definition.R1ToR1[] functionClass()
	{
		return _aAUClass;
	}

	/**
	 * Retrieve the Supremum Function corresponding to the specified Variate
	 *
	 * @param dblVariate The Variate
	 *
	 * @return The Supremum Function corresponding to the specified Variate
	 */

	public org.drip.function.definition.R1ToR1 supremumFunction (
		final double dblVariate)
	{
		IndexSupremum is = supremum (dblVariate);

		return null == is ? null : _aAUClass[is._iIndex];
	}

	@Override public double evaluate (
		final double dblVariate)
		throws java.lang.Exception
	{
		IndexSupremum is = supremum (dblVariate);

		if (null == is) throw new java.lang.Exception ("FunctionClassSupremum::evaluate => Invalid Inputs");

		return is._dblSupremum;
	}

	@Override public double derivative (
		final double dblVariate,
		final int iOrder)
		throws java.lang.Exception
	{
		IndexSupremum is = supremum (dblVariate);

		if (null == is)
			throw new java.lang.Exception ("FunctionClassSupremum::derivative => Invalid Inputs");

		return _aAUClass[is._iIndex].derivative (dblVariate, iOrder);
	}

	@Override public double integrate (
		final double dblBegin,
		final double dblEnd)
		throws java.lang.Exception
	{
		IndexSupremum is = supremum (0.5 * (dblBegin + dblEnd));

		if (null == is) throw new java.lang.Exception ("FunctionClassSupremum::integrate => Invalid Inputs");

		return _aAUClass[is._iIndex].integrate (dblBegin, dblEnd);
	}
}


text:
<?php

namespace Earls\LeaseBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Landlordspropertymanagers
 *
 * @ORM\Table(name="landlordspropertymanagers")
 * @ORM\Entity
 */
class Landlordspropertymanagers
{
    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=45, nullable=true)
     */
    private $name;

    /**
     * @var string
     *
     * @ORM\Column(name="address", type="string", length=45, nullable=true)
     */
    private $address;

    /**
     * @var string
     *
     * @ORM\Column(name="postalZip", type="string", length=45, nullable=true)
     */
    private $postalzip;

    /**
     * @var string
     *
     * @ORM\Column(name="attention", type="string", length=255, nullable=true)
     */
    private $attention;

    /**
     * @var string
     *
     * @ORM\Column(name="phone", type="string", length=45, nullable=true)
     */
    private $phone;

    /**
     * @var string
     *
     * @ORM\Column(name="fax", type="string", length=45, nullable=true)
     */
    private $fax;

    /**
     * @var integer
     *
     * @ORM\Column(name="landlordPropertyManID", type="smallint")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $landlordpropertymanid;

    /**
     * @var \Earls\LeaseBundle\Entity\Northamericancities
     *
     * @ORM\ManyToOne(targetEntity="Earls\LeaseBundle\Entity\Northamericancities")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="city", referencedColumnName="northAmericanCityID")
     * })
     */
    private $city;

    /**
     * @var \Earls\LeaseBundle\Entity\Provincestate
     *
     * @ORM\ManyToOne(targetEntity="Earls\LeaseBundle\Entity\Provincestate")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="provinceStateID", referencedColumnName="provinceStateID")
     * })
     */
    private $provincestateid;

    /**
     * Set name
     *
     * @param string $name
     * @return Landlordspropertymanagers
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set address
     *
     * @param string $address
     * @return Landlordspropertymanagers
     */
    public function setAddress($address)
    {
        $this->address = $address;

        return $this;
    }

    /**
     * Get address
     *
     * @return string
     */
    public function getAddress()
    {
        return $this->address;
    }

    /**
     * Set postalzip
     *
     * @param string $postalzip
     * @return Landlordspropertymanagers
     */
    public function setPostalzip($postalzip)
    {
        $this->postalzip = $postalzip;

        return $this;
    }

    /**
     * Get postalzip
     *
     * @return string
     */
    public function getPostalzip()
    {
        return $this->postalzip;
    }

    /**
     * Set attention
     *
     * @param string $attention
     * @return Landlordspropertymanagers
     */
    public function setAttention($attention)
    {
        $this->attention = $attention;

        return $this;
    }

    /**
     * Get attention
     *
     * @return string
     */
    public function getAttention()
    {
        return $this->attention;
    }

    /**
     * Set phone
     *
     * @param string $phone
     * @return Landlordspropertymanagers
     */
    public function setPhone($phone)
    {
        $this->phone = $phone;

        return $this;
    }

    /**
     * Get phone
     *
     * @return string
     */
    public function getPhone()
    {
        return $this->phone;
    }

    /**
     * Set fax
     *
     * @param string $fax
     * @return Landlordspropertymanagers
     */
    public function setFax($fax)
    {
        $this->fax = $fax;

        return $this;
    }

    /**
     * Get fax
     *
     * @return string
     */
    public function getFax()
    {
        return $this->fax;
    }

    /**
     * Get landlordpropertymanid
     *
     * @return integer
     */
    public function getLandlordpropertymanid()
    {
        return $this->landlordpropertymanid;
    }

    /**
     * Set city
     *
     * @param \Earls\LeaseBundle\Entity\Northamericancities $city
     * @return Landlordspropertymanagers
     */
    public function setCity(\Earls\LeaseBundle\Entity\Northamericancities $city = null)
    {
        $this->city = $city;

        return $this;
    }

    /**
     * Get city
     *
     * @return \Earls\LeaseBundle\Entity\Northamericancities
     */
    public function getCity()
    {
        return $this->city;
    }

    /**
     * Set provincestateid
     *
     * @param \Earls\LeaseBundle\Entity\Provincestate $provincestateid
     * @return Landlordspropertymanagers
     */
    public function setProvincestateid(\Earls\LeaseBundle\Entity\Provincestate $provincestateid = null)
    {
        $this->provincestateid = $provincestateid;

        return $this;
    }

    /**
     * Get provincestateid
     *
     * @return \Earls\LeaseBundle\Entity\Provincestate
     */
    public function getProvincestateid()
    {
        return $this->provincestateid;
    }
}


text:
  // Jcrop jQuery plugin function
  $.fn.Jcrop = function(options,callback){
    options = options || {};

    var first = this.eq(0).data('Jcrop');
    var args = Array.prototype.slice.call(arguments);

    // Return API if requested
    if (options == 'api') { return first; }

    // Allow calling API methods (with arguments)
    else if (first && (typeof options == 'string')) {

      // Call method if it exists
      if (first[options]) {
        args.shift();
        first[options].apply(first,args);
        return first;
      }

      // Unknown input/method does not exist
      return false;
    }

    // Otherwise, loop over selected elements
    this.each(function(){
      var t = this, $t = $(this);
      var exists = $t.data('Jcrop');
      var obj;

      // If Jcrop already exists on this element only setOptions()
      if (exists)
        exists.setOptions(options);

      else {

        if (!options.stageConstructor)
          options.stageConstructor = $.Jcrop.stageConstructor;

        options.stageConstructor(this,options,function(stage,options){
          var selection = options.setSelect;
          if (selection) delete(options.setSelect);

          var obj = $.Jcrop.attach(stage.element,options);

          if (typeof stage.attach == 'function')
            stage.attach(obj);

          $t.data('Jcrop',obj);

          if (selection) {
            obj.newSelection();
            obj.setSelect(selection);
          }

          if (typeof callback == 'function')
            callback.call(obj);
        });
      }

      return this;
    });
  };


text:
package com.netflix.spinnaker.clouddriver.cloudrun.description.manifest;

import com.netflix.spinnaker.clouddriver.cloudrun.deploy.description.AbstractCloudrunCredentialsDescription;
import com.netflix.spinnaker.clouddriver.cloudrun.model.CloudrunService;
import java.util.HashSet;
import java.util.Set;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class CloudrunCleanupArtifactsDescription extends AbstractCloudrunCredentialsDescription {
  Set<CloudrunService> manifests = new HashSet<>();
}


text:
namespace device {

struct OpenXrScenePlane {  // XR_SCENE_COMPONENT_TYPE_PLANE_MSFT
  using Id = base::StrongAlias<OpenXrScenePlane, XrUuidMSFT>;
  using Alignment = ::XrScenePlaneAlignmentTypeMSFT;
  using Extent = XrExtent2Df;
  OpenXrScenePlane(const XrSceneComponentMSFT& component,
                   const XrScenePlaneMSFT& plane);
  OpenXrScenePlane(const OpenXrScenePlane& other);
  ~OpenXrScenePlane();
  OpenXrScenePlane& operator=(const OpenXrScenePlane& other);

  OpenXrScenePlane::Id id_;
  OpenXrSceneObject::Id parent_id_;
  XrTime update_time_;
  Alignment alignment_;
  Extent size_;
  uint64_t mesh_buffer_id_;
  bool supports_indices_uint16_;
  XrSceneComponentLocationMSFT location_;
};

}  // namespace device

#endif  // DEVICE_VR_OPENXR_OPENXR_SCENE_PLANE_H_


text:
<?php include("../partials/header.php"); ?>

				<?php include("../partials/side-menu.php"); ?>

Profile

					<?php include("content.php"); ?>

<?php include("../partials/footer.php"); ?>


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/FruitPictures.iml" filepath="$PROJECT_DIR$/FruitPictures.iml" />
      <module fileurl="file://$PROJECT_DIR$/FruitiPcture.iml" filepath="$PROJECT_DIR$/FruitiPcture.iml" />
      <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
      <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
      <module fileurl="file://$PROJECT_DIR$/gooview/gooview.iml" filepath="$PROJECT_DIR$/gooview/gooview.iml" />
      <module fileurl="file://$PROJECT_DIR$/gooview/gooview.iml" filepath="$PROJECT_DIR$/gooview/gooview.iml" />
    </modules>
  </component>
</project>


text:
/**
 * Poster v0.1.0
 * A React webapp to list upcoming movies and maintain a watchlist, powered by TMDb
 *
 * Author: Kushal Pandya <kushalspandya@gmail.com> (https://doublslash.com)
 * Date: 17 June, 2016
 * License: MIT
 *
 * Section > MovieDetail
 */

import React from "react";
import HTTP from "superagent";
import Modal from "react-modal";

import LoadingAnimation from "../../../Widgets/LoadingAnimation";

export default
class MovieDetail extends React.Component {
    baseURL = "http://localhost:9000/api";
    noPosterImage = "dist/assets/images/no_poster.png";
    noProfileImage = "dist/assets/images/no_profile.png";

    months = [
        "January",
        "February",
        "March",
        "April",
        "May",
        "June",
        "July",
        "August",
        "September",
        "October",
        "November",
        "December"
    ];

    constructor() {
        super();
        this.state = {
            movie: {},
            openModal: false,
            loadCompleted: false
        }
    }

    componentWillMount() {
        const { movieId } = this.props.params;

        this.request = HTTP.get(`${this.baseURL}/movie/info/${movieId}`).end((err, res) => {
            if (err || !res.ok)
                console.log("Something went wrong", err);
            else
            {
                this.setState({
                    loadCompleted: true,
                    movie: res.body
                })
            }
        });
    }

    componentWillUnmount() {
        this.request.abort();
    }

    handleClickPoster() {
        if (this.state.movie.poster_path.medium)
            this.setState({openModal: true});
    }

    handleClickCloseModal() {
        this.setState({openModal: false});
    }

    renderCrewItem(person, i, arr) {
        const personPermaLink = "https://www.themoviedb.org/person/";

        return (

                <a href={`${personPermaLink}${person.id}`} target="_blank">{person.name}{i < arr.length - 1 ? ', ' : ''}

        );
    }

    renderCastItem(person) {
        const personPermaLink = "https://www.themoviedb.org/person/";

        return (

                    <a href={`${personPermaLink}${person.id}`} class="person-name" target="_blank">{person.name}

as {person.character || 'NA'}

        );
    }

    renderPosterModal() {
        const { movie } = this.state;

        return (
            <Modal
                isOpen={this.state.openModal}
                shouldCloseOnOverlayClick={true}
                onRequestClose={this.handleClickCloseModal.bind(this)}
                class="poster-modal">
                ×

            </Modal>
        );
    }

    render() {
        const { movie } = this.state;
        const { credits } = movie;
        const crewPermaLink = `https://www.themoviedb.org/movie/${movie.id}/cast`;
        const releaseDate = new Date(movie.release_date);
        const releaseDateString = `${releaseDate.getDate()} ${this.months[releaseDate.getMonth()]}, ${releaseDate.getUTCFullYear()}`;

        return (

                <LoadingAnimation
                    visible={!this.state.loadCompleted}
                    loadMessage="Loading movie details..."
                />
                {(() => {
                    if (this.state.loadCompleted)
                        return (

                                                Rating

                                                    {movie.vote_average}

                                                Released	{releaseDateString}

                                                Running time	{movie.runtime} minutes

                                                Budget	${movie.budget}

                                                Revenue	${movie.revenue}

{movie.title}

({releaseDate.getUTCFullYear()})

Overview

{movie.overview}

Tagline

{movie.tagline}

Genres

                                            {
                                                movie.genres.map((genre, i) => {
                                                    return (
                                                        {genre.name}
                                                    );
                                                })
                                            }

Crew

                                                    Director{credits.directors.length > 1 ? 's' : ''}:
                                                    {credits.directors.map(this.renderCrewItem)}

                                                    Writer{credits.writers.length > 1 ? 's' : ''}:
                                                    {credits.writers.map(this.renderCrewItem)}

                                                    Producer{credits.producers.length > 1 ? 's' : ''}:
                                                    {credits.producers.map(this.renderCrewItem)}

                                        Show all →

Actors

                                            {
                                                credits.actors.map((actor) => {
                                                    return (

{this.renderCastItem(actor)}

                                                    );
                                                })
                                            }

                                        Show all →

Production Company

                                            {
                                                movie.production_companies.map((company, i, arr) => {
                                                    return (
                                                        <a href={`https://www.themoviedb.org/company/${company.id}`} target="_blank" key={company.id}>{company.name}{i < arr.length - 1 ? ', ' : ''}
                                                    );
                                                })
                                            }

                                {this.renderPosterModal()}

                        );
                })()}

        );
    }
}


text:
<?php

namespace SelfService\Document;

use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;

/**
 * @ODM\EmbeddedDocument
 * @author Ryan J. Geyer <me@ryangeyer.com>
 */
class Deployment extends AbstractResource {

  public $resource_type = "deployment";

  /**
   * @ODM\Hash
   * @var array|string
   */
  public $name;

  /**
   * @ODM\String
   * @var string
   */
  public $server_tag_scope;

  /**
   * @ODM\Collection
   * @var array
   */
  public $inputs;

  /**
   * @ODM\Collection
   * @var array
   */
  public $servers;

  /**
   * @ODM\Collection
   * @var array
   */
  public $server_arrays;
}


text:
module Ical
  module Helpers
    module UiEventHelper
      def ui_event_for(*args)
        domid = args.first
        options = args.extract_options!
        options[:url] = {} unless options[:url]
        options[:actions] = {} unless options[:actions]
        render(:file => 'shared/_ui_event_for.js.haml', :locals => {:domid => domid, :url => options[:url], :actions => options[:actions]})
      end
    end
  end
end


text:
<?php

namespace app\models;

use Yii;

use app\models\general\GeneralMessage;

/**
 * This is the model class for table "tbl_ref_kelulusan_e_laporan".
 *
 * @property integer $id
 * @property string $desc
 * @property integer $aktif
 * @property integer $created_by
 * @property integer $updated_by
 * @property string $created
 * @property string $updated
 */
class RefKelulusanELaporan extends \yii\db\ActiveRecord
{
    const KELULUSAN_YA = 1;
    const KELULUSAN_TIDAK = 2;

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'tbl_ref_kelulusan_e_laporan';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['desc'], 'required', 'message' => GeneralMessage::yii_validation_required],
            [['aktif', 'created_by', 'updated_by'], 'integer', 'message' => GeneralMessage::yii_validation_integer],
            [['created', 'updated'], 'safe'],
            [['desc'], 'string', 'max' => 80, 'tooLong' => GeneralMessage::yii_validation_string_max],
            [['desc'], 'filter', 'filter' => function ($value) {
                return  \common\models\general\GeneralFunction::filterXSS($value);
            }],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'desc' => 'Desc',
            'aktif' => 'Aktif',
            'created_by' => 'Created By',
            'updated_by' => 'Updated By',
            'created' => 'Created',
            'updated' => 'Updated',
        ];
    }
}


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>fh-dotnet-sdk: FHXamarinAndroidSDK/Resources/Resource.designer.cs File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

fh-dotnet-sdk

Classes |
Namespaces

Resource.designer.cs File Reference

Classes

class  	FHXamarinAndroidSDK.Resource

class  	FHXamarinAndroidSDK.Resource.Attribute

class  	FHXamarinAndroidSDK.Resource.Color

class  	FHXamarinAndroidSDK.Resource.Drawable

class  	FHXamarinAndroidSDK.Resource.Id

class  	FHXamarinAndroidSDK.Resource.Integer

class  	FHXamarinAndroidSDK.Resource.String

class  	FHXamarinAndroidSDK.Resource.Styleable

Namespaces

namespace  	FHXamarinAndroidSDK

FHXamarinAndroidSDK

Resources

Resource.designer.cs

Generated by

     1.8.12


text:
/** APIs and Classes implementing the Stats component used for document frequency calculations. */
package org.apache.solr.search.stats;


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;

using Microsoft.Scripting;

using IronPython.Runtime.Exceptions;

namespace IronPython {

    [Serializable, CLSCompliant(true)]
    public sealed class PythonOptions : LanguageOptions {

        private readonly ReadOnlyCollection<string>/*!*/ _arguments;
        private readonly ReadOnlyCollection<string>/*!*/ _warningFilters;
        private readonly bool _warnPy3k, _python30;
        private readonly bool _bytesWarning;
        private readonly bool _debug;
        private readonly int _recursionLimit;
        private readonly Severity _indentationInconsistencySeverity;
        private readonly bool _stripDocStrings;
        private readonly bool _optimize;
        private readonly bool _inspect;
        private readonly bool _noUserSite;
        private readonly bool _noSite;
        private readonly bool _ignoreEnvironment;
        private readonly bool _verbose;
        private readonly bool _frames, _fullFrames, _tracing;
        private readonly Version _version;
        private readonly Regex _noDebug;
        private readonly int? _gcStress;
        private bool _enableProfiler;
        private readonly bool _lightweightScopes;

        /// <summary>
        /// Gets the collection of command line arguments.
        /// </summary>
        public ReadOnlyCollection<string>/*!*/ Arguments {
            get { return _arguments; }
        }

        /// <summary>
        ///  Should we strip out all doc strings (the -O command line option).
        /// </summary>
        public bool Optimize {
            get { return _optimize; }
        }

        /// <summary>
        ///  Should we strip out all doc strings (the -OO command line option).
        /// </summary>
        public bool StripDocStrings {
            get { return _stripDocStrings; }
        }

        /// <summary>
        ///  List of -W (warning filter) options collected from the command line.
        /// </summary>
        public ReadOnlyCollection<string>/*!*/ WarningFilters {
            get { return _warningFilters; }
        }

        /// <summary>
        /// Enables warnings related to Python 3.0 features.
        /// </summary>
        public bool WarnPython30 {
            get { return _warnPy3k; }
        }

        /// <summary>
        /// Enables 3.0 features that are implemented in IronPython.
        /// </summary>
        public bool Python30 {
            get {
                return _python30;
            }
        }

        public bool BytesWarning {
            get { return _bytesWarning; }
        }

        /// <summary>
        /// Enables debugging support.  When enabled a .NET debugger can be attached
        /// to the process to step through Python code.
        /// </summary>
        public bool Debug {
            get { return _debug; }
        }

        /// <summary>
        /// Enables inspect mode.  After running the main module the REPL will be started
        /// within that modules context.
        /// </summary>
        public bool Inspect {
            get { return _inspect; }
        }

        /// <summary>
        /// Suppresses addition of the user site directory.  This is ignored by IronPython
        /// except for updating sys.flags.
        /// </summary>
        public bool NoUserSite {
            get { return _noUserSite; }
        }

        /// <summary>
        /// Disables import site on startup.
        /// </summary>
        public bool NoSite {
            get { return _noSite; }
        }

        /// <summary>
        /// Ignore environment variables that configure the IronPython context.
        /// </summary>
        public bool IgnoreEnvironment {
            get { return _ignoreEnvironment; }
        }

        /// <summary>
        /// Enables the verbose option which traces import statements.  This is ignored by IronPython
        /// except for setting sys.flags.
        /// </summary>
        public bool Verbose {
            get { return _verbose; }
        }

        /// <summary>
        /// Sets the maximum recursion depth.  Setting to Int32.MaxValue will disable recursion
        /// enforcement.
        /// </summary>
        public int RecursionLimit {
            get { return _recursionLimit; }
        }

        /// <summary>
        /// Makes available sys._getframe.  Local variables will not be available in frames unless the
        /// function calls locals(), dir(), vars(), etc...  For ensuring locals are always available use
        /// the FullFrames option.
        /// </summary>
        public bool Frames {
            get {
                return _frames;
            }
        }

        /// <summary>
        /// Makes available sys._getframe.  All locals variables will live on the heap (for a considerable
        /// performance cost) enabling introspection of all code.
        /// </summary>
        public bool FullFrames {
            get {
                return _fullFrames;
            }
        }

        /// <summary>
        /// Tracing is always available.  Without this option tracing is only enabled when sys.settrace
        /// is called. This means code that was already running before sys.settrace will not be debuggable.
        ///
        /// With this option pdb.set_trace and pdb.post_mortem will always work properly.
        /// </summary>
        public bool Tracing {
            get {
                return _tracing;
            }
        }

        /// <summary>
        /// Severity of a warning that indentation is formatted inconsistently.
        /// </summary>
        public Severity IndentationInconsistencySeverity {
            get { return _indentationInconsistencySeverity; }
        }

        /// <summary>
        /// Forces all code to be compiled in a mode in which the code can be reliably collected by the CLR.
        /// </summary>
        public bool LightweightScopes {
            get {
                return _lightweightScopes;
            }
        }

        /// <summary>
        /// Enable profiling code
        /// </summary>
        public bool EnableProfiler {
            get { return _enableProfiler; }
            set { _enableProfiler = value; }
        }

        public int? GCStress {
            get { return _gcStress; }
        }

        /// <summary>
        /// Returns a regular expression of Python files which should not be emitted in debug mode.
        /// </summary>
        public Regex NoDebug {
            get {
                return _noDebug;
            }
        }

        public PythonOptions()
            : this(null) {
        }

        /// <summary>
        /// Gets the CPython version which IronPython will emulate.  Currently limited
        /// to either 2.6 or 3.0.
        /// </summary>
        public Version PythonVersion {
            get {
                return _version;
            }
        }

        public PythonOptions(IDictionary<string, object> options)
            : base(EnsureSearchPaths(options)) {

            _arguments = GetStringCollectionOption(options, "Arguments") ?? EmptyStringCollection;
            _warningFilters = GetStringCollectionOption(options, "WarningFilters", ';', ',') ?? EmptyStringCollection;

            _warnPy3k = GetOption(options, "WarnPy3k", false);
            _bytesWarning = GetOption(options, "BytesWarning", false);
            _debug = GetOption(options, "Debug", false);
            _inspect = GetOption(options, "Inspect", false);
            _noUserSite = GetOption(options, "NoUserSite", false);
            _noSite = GetOption(options, "NoSite", false);
            _ignoreEnvironment = GetOption(options, "IgnoreEnvironment", false);
            _verbose = GetOption(options, "Verbose", false);
            _optimize = GetOption(options, "Optimize", false);
            _stripDocStrings = GetOption(options, "StripDocStrings", false);
            _recursionLimit = GetOption(options, "RecursionLimit", Int32.MaxValue);
            _indentationInconsistencySeverity = GetOption(options, "IndentationInconsistencySeverity", Severity.Ignore);
            _enableProfiler = GetOption(options, "EnableProfiler", false);
            _lightweightScopes = GetOption(options, "LightweightScopes", false);
            _fullFrames = GetOption(options, "FullFrames", false);
            _frames = _fullFrames || GetOption(options, "Frames", false);
            _gcStress = GetOption<int?>(options, "GCStress", null);
            _tracing = GetOption(options, "Tracing", false);
            _noDebug = GetOption(options, "NoDebug", (Regex)null);

            object value;
            if (options != null && options.TryGetValue("PythonVersion", out value)) {
                if (value is Version) {
                    _version = (Version)value;
                } else if (value is string) {
                    _version = new Version((string)value);
                } else {
                    throw new ValueErrorException("Expected string or Version for PythonVersion");
                }

                if (_version != new Version(2, 7) && _version != new Version(3, 0)) {
                    throw new ValueErrorException("Expected Version to be 2.7 or 3.0");
                }
            } else {
                _version = new Version(2, 7);
            }

            _python30 = _version == new Version(3, 0);
        }

        private static IDictionary<string, object> EnsureSearchPaths(IDictionary<string, object> options) {
            if (options == null) {
                return new Dictionary<string, object>() { { "SearchPaths", new[] { "." } } };
            } else if (!options.ContainsKey("SearchPaths")) {
                options["SearchPaths"] = new [] { "." };
            }
            return options;
        }
    }
}


text:
/**
 * Created by Administrator on 04/08/2016.
 */

define(function (require) {
    "use strict";
    var _ = require("underscore"),
        Backbone = require('backbone');

    return Backbone.View.extends({

        // some more code here

        events: {
            'submit form': 'uploadFile'
        },

        uploadFile: function (event) {
            var values = {};

            if (event) {
                event.preventDefault();
            }

            _.each(this.$('form').serializeArray(), function (input) {
                values[input.name] = input.value;
            })

            this.model.save(values, {
                iframe: true,
                files: this.$('form :file'),
                data: values
            });
        }
    });
});


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

<wicket:extend>

[repositories message]

[repositories panel]

</wicket:extend>