text:
"""Group for Zigbee Home Automation."""
import asyncio
import collections
import logging
from typing import Any, Dict, List

import zigpy.exceptions

from homeassistant.helpers.entity_registry import async_entries_for_device
from homeassistant.helpers.typing import HomeAssistantType

from .helpers import LogMixin
from .typing import (
    ZhaDeviceType,
    ZhaGatewayType,
    ZhaGroupType,
    ZigpyEndpointType,
    ZigpyGroupType,
)

_LOGGER = logging.getLogger(__name__)

GroupMember = collections.namedtuple("GroupMember", "ieee endpoint_id")
GroupEntityReference = collections.namedtuple(
    "GroupEntityReference", "name original_name entity_id"
)

class ZHAGroupMember(LogMixin):
    """Composite object that represents a device endpoint in a Zigbee group."""

    def __init__(
        self, zha_group: ZhaGroupType, zha_device: ZhaDeviceType, endpoint_id: int
    ):
        """Initialize the group member."""
        self._zha_group: ZhaGroupType = zha_group
        self._zha_device: ZhaDeviceType = zha_device
        self._endpoint_id: int = endpoint_id

    @property
    def group(self) -> ZhaGroupType:
        """Return the group this member belongs to."""
        return self._zha_group

    @property
    def endpoint_id(self) -> int:
        """Return the endpoint id for this group member."""
        return self._endpoint_id

    @property
    def endpoint(self) -> ZigpyEndpointType:
        """Return the endpoint for this group member."""
        return self._zha_device.device.endpoints.get(self.endpoint_id)

    @property
    def device(self) -> ZhaDeviceType:
        """Return the zha device for this group member."""
        return self._zha_device

    @property
    def member_info(self) -> Dict[str, Any]:
        """Get ZHA group info."""
        member_info: Dict[str, Any] = {}
        member_info["endpoint_id"] = self.endpoint_id
        member_info["device"] = self.device.zha_device_info
        member_info["entities"] = self.associated_entities
        return member_info

    @property
    def associated_entities(self) -> List[GroupEntityReference]:
        """Return the list of entities that were derived from this endpoint."""
        ha_entity_registry = self.device.gateway.ha_entity_registry
        zha_device_registry = self.device.gateway.device_registry
        return [
            GroupEntityReference(
                ha_entity_registry.async_get(entity_ref.reference_id).name,
                ha_entity_registry.async_get(entity_ref.reference_id).original_name,
                entity_ref.reference_id,
            )._asdict()
            for entity_ref in zha_device_registry.get(self.device.ieee)
            if list(entity_ref.cluster_channels.values())[
                0
            ].cluster.endpoint.endpoint_id
            == self.endpoint_id
        ]

    async def async_remove_from_group(self) -> None:
        """Remove the device endpoint from the provided zigbee group."""
        try:
            await self._zha_device.device.endpoints[
                self._endpoint_id
            ].remove_from_group(self._zha_group.group_id)
        except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
            self.debug(
                "Failed to remove endpoint: %s for device '%s' from group: 0x%04x ex: %s",
                self._endpoint_id,
                self._zha_device.ieee,
                self._zha_group.group_id,
                str(ex),
            )

    def log(self, level: int, msg: str, *args) -> None:
        """Log a message."""
        msg = f"[%s](%s): {msg}"
        args = (f"0x{self._zha_group.group_id:04x}", self.endpoint_id) + args
        _LOGGER.log(level, msg, *args)

class ZHAGroup(LogMixin):
    """ZHA Zigbee group object."""

    def __init__(
        self,
        hass: HomeAssistantType,
        zha_gateway: ZhaGatewayType,
        zigpy_group: ZigpyGroupType,
    ):
        """Initialize the group."""
        self.hass: HomeAssistantType = hass
        self._zigpy_group: ZigpyGroupType = zigpy_group
        self._zha_gateway: ZhaGatewayType = zha_gateway

    @property
    def name(self) -> str:
        """Return group name."""
        return self._zigpy_group.name

    @property
    def group_id(self) -> int:
        """Return group name."""
        return self._zigpy_group.group_id

    @property
    def endpoint(self) -> ZigpyEndpointType:
        """Return the endpoint for this group."""
        return self._zigpy_group.endpoint

    @property
    def members(self) -> List[ZHAGroupMember]:
        """Return the ZHA devices that are members of this group."""
        return [
            ZHAGroupMember(
                self, self._zha_gateway.devices.get(member_ieee), endpoint_id
            )
            for (member_ieee, endpoint_id) in self._zigpy_group.members.keys()
            if member_ieee in self._zha_gateway.devices
        ]

    async def async_add_members(self, members: List[GroupMember]) -> None:
        """Add members to this group."""
        if len(members) > 1:
            tasks = []
            for member in members:
                tasks.append(
                    self._zha_gateway.devices[member.ieee].async_add_endpoint_to_group(
                        member.endpoint_id, self.group_id
                    )
                )
            await asyncio.gather(*tasks)
        else:
            await self._zha_gateway.devices[
                members[0].ieee
            ].async_add_endpoint_to_group(members[0].endpoint_id, self.group_id)

    async def async_remove_members(self, members: List[GroupMember]) -> None:
        """Remove members from this group."""
        if len(members) > 1:
            tasks = []
            for member in members:
                tasks.append(
                    self._zha_gateway.devices[
                        member.ieee
                    ].async_remove_endpoint_from_group(
                        member.endpoint_id, self.group_id
                    )
                )
            await asyncio.gather(*tasks)
        else:
            await self._zha_gateway.devices[
                members[0].ieee
            ].async_remove_endpoint_from_group(members[0].endpoint_id, self.group_id)

    @property
    def member_entity_ids(self) -> List[str]:
        """Return the ZHA entity ids for all entities for the members of this group."""
        all_entity_ids: List[str] = []
        for member in self.members:
            entity_references = member.associated_entities
            for entity_reference in entity_references:
                all_entity_ids.append(entity_reference["entity_id"])
        return all_entity_ids

    def get_domain_entity_ids(self, domain) -> List[str]:
        """Return entity ids from the entity domain for this group."""
        domain_entity_ids: List[str] = []
        for member in self.members:
            entities = async_entries_for_device(
                self._zha_gateway.ha_entity_registry, member.device.device_id
            )
            domain_entity_ids.extend(
                [entity.entity_id for entity in entities if entity.domain == domain]
            )
        return domain_entity_ids

    @property
    def group_info(self) -> Dict[str, Any]:
        """Get ZHA group info."""
        group_info: Dict[str, Any] = {}
        group_info["group_id"] = self.group_id
        group_info["name"] = self.name
        group_info["members"] = [member.member_info for member in self.members]
        return group_info

    def log(self, level: int, msg: str, *args):
        """Log a message."""
        msg = f"[%s](%s): {msg}"
        args = (self.name, self.group_id) + args
        _LOGGER.log(level, msg, *args)


text:
package org.ovirt.engine.core.common.action;

import org.ovirt.engine.core.compat.*;

public class VdsActionParameters extends VdcActionParametersBase {
    private static final long serialVersionUID = 3959465593772384532L;

    boolean runSilent;

    public VdsActionParameters(Guid vdsId) {
        _vdsId = vdsId;
    }

    private Guid _vdsId;

    public Guid getVdsId() {
        return _vdsId;
    }

    public void setVdsId(Guid value) {
        _vdsId = value;
    }

    public VdsActionParameters() {
    }

    public boolean isRunSilent() {
        return runSilent;
    }

    public void setRunSilent(boolean runSilent) {
        this.runSilent = runSilent;
    }
}

redpajama_set_name: RedPajamaGithub


text:
"""readline - Importing this module enables command line editing using
the pyrepl library.  The API is a subset of the GNU readline library.
It also contains extensions for multiline input.

Note that some of the functions present in the CPython module 'readline'
are only stubs at the moment.
"""

try:
    from pyrepl.readline import *
except ImportError:
    import sys
    if sys.platform == 'win32':
        raise ImportError("the 'readline' module is not available on Windows"
                          " (on either PyPy or CPython)")
    raise


text:
package org.teavm.flavour.routing.metadata;

public enum ParameterType {
    STRING,
    BYTE,
    SHORT,
    INTEGER,
    LONG,
    FLOAT,
    DOUBLE,
    BIG_INTEGER,
    BIG_DECIMAL,
    DATE,
    ENUM
}


text:
'use strict';
const ko = require('knockout');

class Cost {
    constructor (opts) {
        Cost.columnKeys.forEach(key => { this[key] = ko.observable(opts[key]); });

        this.displayName = ko.pureComputed(() => `${this.name()} (${this.value()})`);
    }

    static get columnKeys () {
        return [
            'id',
            'name',
            'value'
        ];
    }
}

module.exports = Cost;


text:
import {createVue, triggerEvent, triggerClick, destroyVM, waitImmediate} from '../util';

const DELAY = 1;

describe('InputNumber', () => {
  let vm;
  afterEach(() => {
    destroyVM(vm);
  });
  it('create', () => {
    vm = createVue({
      template: `
        <el-input-number v-model="value">
        </el-input-number>
      `,
      data() {
        return {
          value: 1
        };
      }
    }, true);
    let input = vm.$el.querySelector('input');

    expect(vm.value).to.be.equal(1);
    expect(input.value).to.be.equal('1');
  });
  it('decrease', done => {
    vm = createVue({
      template: `
        <el-input-number v-model="value" ref="input">
        </el-input-number>
      `,
      data() {
        return {
          value: 5
        };
      }
    }, true);

    let input = vm.$el.querySelector('input');
    let btnDecrease = vm.$el.querySelector('.el-input-number__decrease');

    triggerEvent(btnDecrease, 'mousedown');
    triggerClick(document, 'mouseup');

    vm.$nextTick(_ => {
      expect(vm.value).to.be.equal(4);
      expect(input.value).to.be.equal('4');
      done();
    });
  });
  it('increase', done => {
    vm = createVue({
      template: `
        <el-input-number v-model="value">
        </el-input-number>
      `,
      data() {
        return {
          value: 1.5
        };
      }
    }, true);

    let input = vm.$el.querySelector('input');
    let btnIncrease = vm.$el.querySelector('.el-input-number__increase');

    triggerEvent(btnIncrease, 'mousedown');
    triggerClick(document, 'mouseup');

    vm.$nextTick(_ => {
      expect(vm.value).to.be.equal(2.5);
      expect(input.value).to.be.equal('2.5');
      done();
    });
  });
  it('disabled', done => {
    vm = createVue({
      template: `
        <el-input-number v-model="value" disabled>
        </el-input-number>
      `,
      data() {
        return {
          value: 2
        };
      }
    }, true);

    let input = vm.$el.querySelector('input');
    let btnDecrease = vm.$el.querySelector('.el-input-number__decrease');
    let btnIncrease = vm.$el.querySelector('.el-input-number__increase');

    triggerEvent(btnDecrease, 'mousedown');
    triggerClick(document, 'mouseup');

    vm.$nextTick(_ => {
      expect(vm.value).to.be.equal(2);
      expect(input.value).to.be.equal('2');

      triggerEvent(btnIncrease, 'mousedown');
      triggerClick(document, 'mouseup');

      vm.$nextTick(_ => {
        expect(vm.value).to.be.equal(2);
        expect(input.value).to.be.equal('2');
        done();
      });
    });
  });
  it('step', done => {
    vm = createVue({
      template: `
        <el-input-number v-model="value" :step="3.2">
        </el-input-number>
      `,
      data() {
        return {
          value: 5
        };
      }
    }, true);

    let input = vm.$el.querySelector('input');
    let btnIncrease = vm.$el.querySelector('.el-input-number__increase');
    let btnDecrease = vm.$el.querySelector('.el-input-number__decrease');

    triggerEvent(btnIncrease, 'mousedown');
    triggerClick(document, 'mouseup');

    vm.$nextTick(_ => {
      expect(vm.value).to.be.equal(8.2);
      expect(input.value).to.be.equal('8.2');

      triggerEvent(btnDecrease, 'mousedown');
      triggerClick(document, 'mouseup');

      vm.$nextTick(_ => {
        expect(vm.value).to.be.equal(5);
        expect(input.value).to.be.equal('5');
        done();
      });
    });
  });
  it('step strictly', async() => {
    vm = createVue({
      template: `
        <el-input-number v-model="value" :step="1.2" step-strictly>
        </el-input-number>
      `,
      data() {
        return {
          value: 5
        };
      }
    }, true);

    let input = vm.$el.querySelector('input');
    await waitImmediate();
    expect(vm.value).to.be.equal(4.8);
    expect(input.value).to.be.equal('4.8');
    vm.value = '8';

    await waitImmediate();
    expect(vm.value).to.be.equal(8.4);
    expect(input.value).to.be.equal('8.4');
  });
  it('min', done => {
    vm = createVue({
      template: `
        <el-input-number v-model="value" :min="6">
        </el-input-number>
      `,
      data() {
        return {
          value: 6
        };
      }
    }, true);
    const vm2 = createVue({
      template: `
        <el-input-number v-model="value" :min="6">
        </el-input-number>
      `,
      data() {
        return {
          value: 3
        };
      }
    }, true);

    expect(vm2.value === 6);
    expect(vm2.$el.querySelector('input').value).to.be.equal('6');

    let input = vm.$el.querySelector('input');
    let btnDecrease = vm.$el.querySelector('.el-input-number__decrease');

    triggerEvent(btnDecrease, 'mousedown');
    triggerClick(document, 'mouseup');

    vm.$nextTick(_ => {
      expect(vm.value).to.be.equal(6);
      expect(input.value).to.be.equal('6');
      done();
    });
  });
  it('max', done => {
    vm = createVue({
      template: `
        <el-input-number v-model="value" :max="8">
        </el-input-number>
      `,
      data() {
        return {
          value: 8
        };
      }
    }, true);
    const vm2 = createVue({
      template: `
        <el-input-number v-model="value" :max="8">
        </el-input-number>
      `,
      data() {
        return {
          value: 100
        };
      }
    }, true);

    expect(vm2.value === 8);
    expect(vm2.$el.querySelector('input').value).to.be.equal('8');

    let input = vm.$el.querySelector('input');
    let btnIncrease = vm.$el.querySelector('.el-input-number__increase');

    triggerEvent(btnIncrease, 'mousedown');
    triggerClick(document, 'mouseup');

    vm.$nextTick(_ => {
      expect(vm.value).to.be.equal(8);
      expect(input.value).to.be.equal('8');
      done();
    });
  });
  describe('precision', () => {
    it('precision is 2', () => {
      vm = createVue({
        template: `
          <el-input-number v-model="value" :max="8" :precision="2">
          </el-input-number>
        `,
        data() {
          return {
            value: 6.999
          };
        }
      }, true);
      expect(vm.value === 7);
      expect(vm.$el.querySelector('input').value).to.be.equal('7.00');
    });

    it('precision greater than the precision of step', done => {
      vm = createVue({
        template: `
          <el-input-number v-model="value" :max="8" :precision="0" :step="0.1">
          </el-input-number>
        `,
        data() {
          return {
            value: 6.999
          };
        }
      }, true);
      const input = vm.$el.querySelector('input');
      const btnIncrease = vm.$el.querySelector('.el-input-number__increase');

      expect(vm.value === 7);
      expect(input.value).to.be.equal('7');

      triggerEvent(btnIncrease, 'mousedown');
      triggerClick(document, 'mouseup');

      vm.$nextTick(_ => {
        expect(vm.value).to.be.equal(7);
        expect(input.value).to.be.equal('7');
        done();
      });
    });
  });
  it('controls', () => {
    vm = createVue({
      template: `
        <el-input-number :controls="false" v-model="value" :max="8">
        </el-input-number>
      `,
      data() {
        return {
          value: 8
        };
      }
    }, true);

    expect(vm.$el.querySelector('.el-input-number__decrease')).to.not.exist;
    expect(vm.$el.querySelector('.el-input-number__increase')).to.not.exist;
  });
  it('invalid value reset', done => {
    vm = createVue({
      template: `
        <el-input-number v-model="value" :min="5" :max="10" ref="inputNumber">
        </el-input-number>
      `,
      data() {
        return {
          value: 5
        };
      }
    }, true);
    const inputNumber = vm.$refs.inputNumber;
    vm.value = 100;
    vm.$nextTick(_ => {
      expect(inputNumber.currentValue).to.be.equal(10);
      vm.value = 4;

      vm.$nextTick(_ => {
        expect(inputNumber.currentValue).to.be.equal(5);
        vm.value = 'dsajkhd';

        vm.$nextTick(_ => {
          expect(inputNumber.currentValue).to.be.equal(5);
          done();
        });
      });
    });
  });
  describe('event:change', () => {
    let spy;

    beforeEach(() => {
      vm = createVue({
        template: `
          <el-input-number v-model="value" ref="compo" :min='2' :max='3' :step='1'>
          </el-input-number>
        `,
        data() {
          return {
            value: 2
          };
        }
      }, true);
      spy = sinon.spy();
      vm.$refs.compo.$on('change', spy);
    });

    it('emit on input', done => {
      vm.$refs.compo.handleInputChange('3');
      setTimeout(_ => {
        expect(spy.calledOnce).to.be.true;
        expect(spy.args[0][0]).to.equal(3);
        done();
      }, DELAY);
    });

    it('emit on button', done => {
      const btnIncrease = vm.$el.querySelector('.el-input-number__increase');
      triggerEvent(btnIncrease, 'mousedown');
      triggerClick(document, 'mouseup');
      setTimeout(_ => {
        expect(spy.calledOnce).to.be.true;
        expect(spy.args[0][0]).to.equal(3);
        done();
      }, DELAY);
    });

    it('does not emit on programatic change', done => {
      vm.value = 3;
      setTimeout(_ => {
        expect(spy.notCalled).to.be.true;
        done();
      }, DELAY);
    });
  });
  it('event:focus & blur', done => {
    vm = createVue({
      template: `
        <el-input-number ref="input">
        </el-input-number>
      `
    }, true);

    const spyFocus = sinon.spy();
    const spyBlur = sinon.spy();

    vm.$refs.input.$on('focus', spyFocus);
    vm.$refs.input.$on('blur', spyBlur);
    vm.$el.querySelector('input').focus();
    vm.$el.querySelector('input').blur();

    vm.$nextTick(_ => {
      expect(spyFocus.calledOnce).to.be.true;
      expect(spyBlur.calledOnce).to.be.true;
      done();
    });
  });
  it('focus', done => {
    vm = createVue({
      template: `
        <el-input-number ref="input"></el-input-number>
      `
    }, true);

    const spy = sinon.spy();

    vm.$refs.input.$on('focus', spy);
    vm.$refs.input.focus();

    vm.$nextTick(_ => {
      expect(spy.calledOnce).to.be.true;
      done();
    });
  });

  describe('InputNumber Methods', () => {
    it('method:select', done => {
      const testContent = '123';

      vm = createVue({
        template: `
          <el-input-number
            ref="inputNumComp"
            :value="${testContent}"
          />
        `
      }, true);

      expect(vm.$refs.inputNumComp.$refs.input.$refs.input.selectionStart)
        .to.equal(testContent.length);
      expect(vm.$refs.inputNumComp.$refs.input.$refs.input.selectionEnd)
        .to.equal(testContent.length);

      vm.$refs.inputNumComp.select();

      vm.$nextTick(_ => {
        expect(vm.$refs.inputNumComp.$refs.input.$refs.input.selectionStart)
          .to.equal(0);
        expect(vm.$refs.inputNumComp.$refs.input.$refs.input.selectionEnd)
          .to.equal(testContent.length);

        done();
      });
    });
  });
});


text:
<!doctype html>

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>JSON to CSV</title>
<meta name="og:title" content="JSON to CSV" />

<meta name="description" content="A simple, in-browser JSON viewer, and CSV converter." />
<meta name="og:description" content="A simple, in-browser JSON viewer and CSV converter." />

<meta name="author" content="Eric Mill" />
<meta name="twitter:creator" content="@konklone" />
<meta name="twitter:url" content="http://konklone.io/json/" />

<link rel="shortcut icon" href="/favicon.png" />

<link href="assets/bootstrap.min.css" type="text/css" rel="stylesheet" />

<link href="assets/site.css" type="text/css" rel="stylesheet" />
<link href="assets/github.css" type="text/css" rel="stylesheet" />

Convert JSON to CSV

      Paste your JSON below.

      Click your JSON below to edit.

      Create a permalink any time.

      Please report bugs and send feedback on GitHub.

    <textarea class="editing"></textarea>

DROP JSON HERE

    Extremely large files may cause trouble — the conversion is done inside your browser.

      Below are the first few rows ( total).

        Download the entire CSV,

      or show the raw data.

      Your JSON will appear below as a table.

    <textarea class="editing" readonly></textarea>

  Made by @konklone. Thanks to @benbalter for help, and to @onyxfish for the amazing csvkit.


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingLeft="0dp"
    android:paddingRight="0dp">

    <LinearLayout
        android:id="@+id/removeCheckMark"
        android:layout_width="78dp"
        android:layout_height="78dp"
        android:background="@color/colorAccent"
        android:gravity="center_horizontal|center_vertical"
        android:visibility="gone">

        <ImageView
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:background="@color/colorAccent"
            android:gravity="center_horizontal|center_vertical"
            android:padding="0dp"
            android:src="@drawable/img_checkmark_white" />
    </LinearLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="78dp"
        android:layout_marginLeft="2dp">

        <TextView
            android:id="@+id/noteName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:gravity="center"
            android:lines="1"
            android:paddingLeft="10dp"
            android:paddingTop="10dp"
            android:text="TextView"
            android:textSize="20sp"
            tools:maxLines="1" />

        <TextView
            android:id="@+id/noteCreated"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:paddingRight="10dp"
            android:paddingTop="13dp"
            android:text="TextView"
            android:textSize="12sp" />
    </RelativeLayout>
</LinearLayout>


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:layout_gravity="center_vertical|center_horizontal"
  android:background="#ecebeb"
  android:orientation="vertical">

  <LinearLayout
    android:background="@drawable/outerline"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <LinearLayout
      android:orientation="horizontal"
      android:layout_marginTop="@dimen/default_pading"
      android:layout_gravity="right"
      android:layout_width="match_parent"
      android:layout_height="wrap_content">

      <com.kanchi.periyava.old.Component.CircularImageView
        android:layout_marginLeft="@dimen/default_pading"
        android:id="@+id/icon"
        android:src="@drawable/periva_blessing"
        android:layout_width="32dp"
        android:layout_height="32dp" />

      <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="@dimen/default_pading"
        android:singleLine="true"
        android:layout_alignParentLeft="true"
        android:text="Radio & TV"
        android:textColor="@color/black"
        android:textStyle="bold"
        android:textSize="12dp" />
    </LinearLayout>

    <LinearLayout
      android:orientation="horizontal"
      android:layout_marginTop="@dimen/default_pading"
      android:layout_gravity="right"
      android:layout_width="match_parent"
      android:layout_height="wrap_content">

      <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="@dimen/default_pading"
        android:singleLine="true"
        android:layout_alignParentLeft="true"
        android:text="Radio"
        android:textColor="@color/black"
        android:textStyle="bold"
        android:textSize="12dp" />
    </LinearLayout>

    <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal">

      <RelativeLayout
        style="@style/dividing_two_larger"
        android:padding="@dimen/default_pading">

        <ImageView
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:layout_gravity="center"
          android:scaleType="fitXY"
          android:src="@drawable/log_kgp" />

        <ImageView
          android:layout_centerInParent="true"
          android:alpha=".90"
          android:layout_width="48dp"
          android:layout_height="48dp"
          android:src="@drawable/ic_play"/>

        <LinearLayout
          android:padding="@dimen/default_pading"
          android:orientation="vertical"
          android:background="@color/white"
          android:alpha="0.50"
          android:layout_alignParentBottom="true"
          android:layout_width="match_parent"
          android:layout_height="wrap_content">
          <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="India Live Streaming"
            android:textColor="@color/black"
            android:textSize="12dp" />
          <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:text="Now Playing ..... "
            android:textColor="@color/black"
            android:textSize="9dp" />
        </LinearLayout>

      </RelativeLayout>

      <RelativeLayout
        style="@style/dividing_two_larger"
        android:padding="@dimen/default_pading"

        >

        <ImageView
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:layout_gravity="center"
          android:scaleType="fitXY"
          android:src="@drawable/log_kgp2" />

        <ImageView
          android:layout_centerInParent="true"
          android:alpha=".90"
          android:layout_width="48dp"
          android:layout_height="48dp"
          android:src="@drawable/ic_play"/>

        <LinearLayout
          android:padding="@dimen/default_pading"
          android:orientation="vertical"
          android:background="@color/white"
          android:alpha="0.50"
          android:layout_alignParentBottom="true"
          android:layout_width="match_parent"
          android:layout_height="wrap_content">
          <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="US Live Streaming"
            android:textColor="@color/black"
            android:textSize="12dp" />
          <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:text="Now Playing ..... "
            android:textColor="@color/black"
            android:textSize="9dp" />
        </LinearLayout>
      </RelativeLayout>
    </LinearLayout>

    <LinearLayout
      android:orientation="horizontal"
      android:layout_marginTop="@dimen/default_pading"
      android:layout_gravity="right"
      android:layout_width="match_parent"
      android:layout_height="wrap_content">

      <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="@dimen/default_pading"
        android:singleLine="true"
        android:layout_alignParentLeft="true"
        android:text="Live Streaming"
        android:textColor="@color/black"
        android:textStyle="bold"
        android:textSize="12dp" />
    </LinearLayout>

    <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal">

      <RelativeLayout
        style="@style/dividing_two_larger"
        android:padding="@dimen/default_pading">

        <ImageView
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:layout_gravity="center"
          android:scaleType="fitXY"
          android:src="@drawable/acharaya68" />

        <ImageView
          android:padding="@dimen/default_pading"
          android:layout_alignParentRight="true"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:scaleType="fitXY"
          android:src="@drawable/ic_share" />

        <LinearLayout
          android:padding="@dimen/default_pading"
          android:orientation="vertical"
          android:background="@color/white"
          android:alpha="0.50"
          android:layout_alignParentBottom="true"
          android:layout_width="match_parent"
          android:layout_height="wrap_content">
          <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Anusham Live Streaming"
            android:textColor="@color/black"
            android:textSize="12dp" />
          <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:text="On 12-Sep-15 @ 12:AM"
            android:textColor="@color/black"
            android:textSize="9dp" />
        </LinearLayout>

      </RelativeLayout>

      <RelativeLayout
        android:background="@color/Gray"
        style="@style/dividing_two"
        android:padding="@dimen/default_pading">

        <ImageView
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:layout_gravity="center"
          android:scaleType="fitXY"
          android:visibility="gone"
          android:src="@drawable/acharaya69" />
        <ImageView
          android:padding="@dimen/default_pading"
          android:layout_alignParentRight="true"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:scaleType="fitXY"
          android:src="@drawable/ic_share" />

        <TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_alignParentRight="true"
          android:padding="@dimen/default_pading"
          android:singleLine="true"
          android:text="Live Streaming Schedules ..."
          android:textColor="@color/black"
          android:textSize="9dp"
          android:textStyle="bold" />
      </RelativeLayout>
    </LinearLayout>

  </LinearLayout>

</LinearLayout>


text:
<?php

namespace Wrapper\Fixture\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 */
class Article
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(length=128)
     */
    private $title;

    public function getId()
    {
        return $this->id;
    }

    public function setTitle($title)
    {
        $this->title = $title;
    }

    public function getTitle()
    {
        return $this->title;
    }
}


text:
<?php

class blu_instagram extends WP_Widget{

  function __construct(){
    parent::__construct('blu_instagram', 'Bluthemes - Instagram', array('classname' => 'blu_instagram', 'description' => __( 'Displays recent instagram images in a widget. Recommended for the sidebar.', 'bluth-admin') ));
  }

  function form($instance){

    $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );

    $title        = !empty($instance['title']) ? $instance['title'] : '';
    $access_token = !empty($instance['access_token']) ? $instance['access_token'] : '';
    $user_id      = !empty($instance['user_id']) ? $instance['user_id'] : '';
    $show_caption = !empty($instance['show_caption']) ? $instance['show_caption'] : 'always';

  ?>

    <label for="<?php echo $this->get_field_id('title'); ?>">Title

    <input type="text" style="width:100%" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>">

    <label for="<?php echo $this->get_field_id('access_token'); ?>">Access token

    <input type="text" style="width:100%" id="<?php echo $this->get_field_id('access_token'); ?>" name="<?php echo $this->get_field_name('access_token'); ?>" value="<?php echo $access_token; ?>">

    <label for="<?php echo $this->get_field_id('user_id'); ?>">User id

    <input type="text" style="width:100%" id="<?php echo $this->get_field_id('user_id'); ?>" name="<?php echo $this->get_field_name('user_id'); ?>" value="<?php echo $user_id; ?>">

    <label for="<?php echo $this->get_field_id('show_icon'); ?>">Show Instagram icon before the title

	<select style="width:100%" id="<?php echo $this->get_field_id('show_icon'); ?>" name="<?php echo $this->get_field_name('show_icon'); ?>">
	  	<option value="true" <?php echo ($instance['show_icon'] == 'true') ? 'selected=""' : ''; ?>>Yes</option>
	  	<option value="false" <?php echo ($instance['show_icon'] == 'false') ? 'selected=""' : ''; ?>>No</option>
	</select>

    <label for="<?php echo $this->get_field_id('show_caption'); ?>">Show Caption with images

	<select style="width:100%" id="<?php echo $this->get_field_id('show_caption'); ?>" name="<?php echo $this->get_field_name('show_caption'); ?>">
	  	<option value="always" <?php echo ($instance['show_caption'] == 'always') ? 'selected=""' : ''; ?>>Always</option>
	  	<option value="on_hover" <?php echo ($instance['show_caption'] == 'on_hover') ? 'selected=""' : ''; ?>>Only on hover</option>
	  	<option value="off" <?php echo ($instance['show_caption'] == 'off') ? 'selected=""' : ''; ?>>Off</option>
	</select>

  		Manually empty the cache
  		Press this to empty the cache (if the widget isn't fetching the newest image then you should use this)

	  Instructions

You need to authenticate yourself to our instagram app to get an access token to retrieve your images and display them on your page.

Attain your access token and user id by clicking here

Copy the access token and user id

Paste them in the input box below

Not recommended in the footer area because of sizing issues.

  <?php
  }

  function update($new_instance, $old_instance){
  	delete_transient( 'blu_instagram' );
    $instance = $old_instance;
    $instance['title']          = strip_tags($new_instance['title']);
    $instance['access_token']   = strip_tags($new_instance['access_token']);
    $instance['user_id']        = strip_tags($new_instance['user_id']);
    $instance['show_icon']      = strip_tags($new_instance['show_icon']);
    $instance['show_caption']   = strip_tags($new_instance['show_caption']);
    return $instance;
  }

  function widget($args, $instance){

    extract($args, EXTR_SKIP);

	echo $before_widget;

	$title = apply_filters('widget_title', $instance['title'] );

	if($title){

		if($instance['show_icon']){
			$title = ' '.$title;
		}
		echo $before_title . $title . $after_title;
	}
	?>

<?php

		if(empty($instance['user_id'])){
			echo '

Instagram user id not set
';
			echo '
Please add your user id in the input field for the widget

';
		}
		elseif(empty($instance['access_token'])){
			echo '

Instagram access token not set
';
			echo '
Please add your access token in the input field for the widget

';
		}else{

		    if(($cache = get_transient('blu_instagram')) === false){

		    	// get Photos
		    	$posts_data = @wp_remote_retrieve_body(@wp_remote_get("https://api.instagram.com/v1/users/".$instance['user_id']."/media/recent/?access_token=".$instance['access_token']));
			    try{
			        $posts = json_decode($posts_data);

			    }catch(Exception $ex){
			        $posts = false;
			    }

			    // get author data (followers, photos, following)
		    	$user_data = @wp_remote_retrieve_body(@wp_remote_get("https://api.instagram.com/v1/users/".$instance['user_id']."?access_token=".$instance['access_token']));
				try{
			        $user = json_decode($user_data);

			    }catch(Exception $ex){
			        $user = false;
			    }

				if($user and $posts and !isset($posts->meta->error_message) and !isset($user->meta->error_message)){
					// save to cache for 30 min
			        set_transient( 'blu_instagram', array('posts' => $posts_data, 'user' => $user_data), 1800);
				}else{
					delete_transient( 'blu_instagram' );
				}
		    }else{
				$posts 	= json_decode($cache['posts']);
				$user 	= json_decode($cache['user']);
		    }

				$interactions = array();
				if(!$user and !$posts){
					echo '

Could not load Instagram photos at this time

';
				}
				elseif(isset($posts->meta->error_message)){
					echo '

Error
';
					echo '
'.$posts->meta->error_message.'

';
				}
				else if(isset($user->meta->error_message)){
					echo '

Error
';
					echo '
'.$user->meta->error_message.'

';
				}
				else{ ?>

<?php echo $user->data->counts->followed_by ?>

						<?php _e('Followers', 'bluth_admin'); ?>

<?php echo $user->data->counts->follows ?>

						<?php _e('Following', 'bluth_admin'); ?>

<?php echo $user->data->counts->media ?>

						<?php _e('Photos', 'bluth_admin'); ?>

							<?php foreach ($posts->data as $post) { ?>

								<a href="<?php echo $post->link ?>" style="background-image: url('<?php echo $post->images->low_resolution->url ?>')">

										 <?php echo $post->comments->count ?>
										 <?php echo $post->likes->count ?>
										<?php if($instance['show_caption'] == 'always' || $instance['show_caption'] == 'on_hover'){ ?>
											<span class="caption_text <?php echo $instance['show_caption']; ?>"> <?php echo $post->caption->text ?>
										<?php } ?>
										<?php echo date('M j, Y', $post->created_time) ?>

							<?php } ?>

<?php
				}
			} ?>

<?php

	echo $after_widget;
  }
}
add_action( 'widgets_init', create_function('', 'return register_widget("blu_instagram");') );


text:
Ruby Engineer Coding Challenge
=======================

Hello!

We've come up with this relatively open-ended programming/engineering challenge that will allow you to demonstrate your skills from the comfort of your own workspace. In addition, we know your time is valuable, so please feel free to use your completed work as a portfolio piece.

We wish you the best of luck and can't wait to see what you create!

## Overview

Your goal is to develop a system to calculate the shipping cost for products of an order, based on it's weight and distance from origin to destination. The distribution points will be supplied to this system throught an API and the shipping cost will be calculated in another API, always aiming at the lowest cost to the customer.

To populate the database, another system will call the API informing the distance (in kilometers) between *origin* and *destination* of two distribution points. For example:
```
POST /distance
A B 10
```
```
POST /distance
B C 15
```
```
POST /distance
A C 30
```

In a second moment, the shopping system will call the API informing the total weight of the order, the source and destination points. The system should return the lowest shipping cost, using the formula: `cost = distance * weight * 0.15`. For example:

```
GET /cost?origin=A&destination=C&weight=5
18.75
```

Explanation: the shortest path from A to C is A -> B -> C = 25km. `cost = 25 * 5 * 0.15 = 18.75`

## Considerations

* The input format of distance should have the format `A B X`, where *0 < X <= 100000*. Wrong format or data should return an error;
* If a distance point already exists, should be replaced with the new value;
* The cost API should validate the given points and weight, where *0 < wheight <= 50*. If no path was found between *origin*  and *destination*, and error should be returned;
* The solution should be implemented in Ruby. You could use the frameworks that you're most used to.
* Both APIs will receive a large amount of requests: choose the design and technology wisely;

## Submission

You can follow the GitHub Fork/Pull Request workflow by [forking this repository](https://github.com/RakutenBrasil/backend-code-challenge/fork), commiting your changes, and submiting a pull request to us, explaning your solution, technical decisions and how configure/use on the README file. For more information about that, you can see this [GitHub article](https://help.github.com/articles/fork-a-repo/#propose-changes-to-someone-elses-project).

## What we are looking for

We are looking for several things with this challenge. First, of course, we're looking for your answer to be technically correct. Beyond that, we're also looking for:

* Is your code easy to read and understand?
* Are you following the usual conventions for Ruby development?
* How good are you at writing tests? And how easy are they to read and understand?
* Did you follow these directions?

We will of course **examine your code to see its correctness, readability, general elegance, architectural decisions, and modularity**. If/when you meet with us, be prepared to talk about why and how you design your solution. We also test your system with a large amount of data to mesure the performance and to see if we can break stuff.

That's it. There aren't any hidden gotchas or trick questions. That's really what we're going to do.

## License

We have licensed this project under the MIT license so that you may use this for a portfolio piece (or anything else!).

## Summary

Its a Rails-Api application that uses the Rails stack default with Rspec for automated tests.

## How to install

```
bundle install
bundle exec rake db:migrate
```

## How to run

```
bundle rails s
```

## How to run test suit

```
bundle exec rspec
```


text:
.class public final Lcom/google/android/gms/common/images/a;
.super Ljava/lang/Object;

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/google/android/gms/common/images/a$a;
    }
.end annotation

# instance fields
.field final op:Lcom/google/android/gms/common/images/a$a;

.field private oq:I

.field private or:I

.field os:I

.field private ot:I

.field private ou:Ljava/lang/ref/WeakReference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/WeakReference<Lcom/google/android/gms/common/images/ImageManager$OnImageLoadedListener;>;"
        }
    .end annotation
.end field

.field private ov:Ljava/lang/ref/WeakReference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/WeakReference<Landroid/widget/ImageView;>;"
        }
    .end annotation
.end field

.field private ow:Ljava/lang/ref/WeakReference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/WeakReference<Landroid/widget/TextView;>;"
        }
    .end annotation
.end field

.field private ox:I

.field private oy:Z

.field private oz:Z

# direct methods
.method public constructor <init>(I)V
    .locals 2

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    iput v0, p0, Lcom/google/android/gms/common/images/a;->oq:I

    const/4 v0, 0x0

    iput v0, p0, Lcom/google/android/gms/common/images/a;->or:I

    const/4 v0, -0x1

    iput v0, p0, Lcom/google/android/gms/common/images/a;->ox:I

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/google/android/gms/common/images/a;->oy:Z

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/google/android/gms/common/images/a;->oz:Z

    new-instance v0, Lcom/google/android/gms/common/images/a$a;

    const/4 v1, 0x0

    invoke-direct {v0, v1}, Lcom/google/android/gms/common/images/a$a;-><init>(Landroid/net/Uri;)V

    iput-object v0, p0, Lcom/google/android/gms/common/images/a;->op:Lcom/google/android/gms/common/images/a$a;

    iput p1, p0, Lcom/google/android/gms/common/images/a;->or:I

    return-void
.end method

.method public constructor <init>(Landroid/net/Uri;)V
    .locals 1

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    iput v0, p0, Lcom/google/android/gms/common/images/a;->oq:I

    const/4 v0, 0x0

    iput v0, p0, Lcom/google/android/gms/common/images/a;->or:I

    const/4 v0, -0x1

    iput v0, p0, Lcom/google/android/gms/common/images/a;->ox:I

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/google/android/gms/common/images/a;->oy:Z

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/google/android/gms/common/images/a;->oz:Z

    new-instance v0, Lcom/google/android/gms/common/images/a$a;

    invoke-direct {v0, p1}, Lcom/google/android/gms/common/images/a$a;-><init>(Landroid/net/Uri;)V

    iput-object v0, p0, Lcom/google/android/gms/common/images/a;->op:Lcom/google/android/gms/common/images/a$a;

    const/4 v0, 0x0

    iput v0, p0, Lcom/google/android/gms/common/images/a;->or:I

    return-void
.end method

.method private a(Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;)Lcom/google/android/gms/internal/dq;
    .locals 2

    const/4 v1, 0x0

    if-eqz p1, :cond_1

    instance-of v0, p1, Lcom/google/android/gms/internal/dq;

    if-eqz v0, :cond_0

    move-object v0, p1

    check-cast v0, Lcom/google/android/gms/internal/dq;

    invoke-virtual {v0}, Lcom/google/android/gms/internal/dq;->bC()Landroid/graphics/drawable/Drawable;

    move-result-object v1

    goto :goto_0

    :cond_0
    move-object v1, p1

    :cond_1
    :goto_0
    new-instance v0, Lcom/google/android/gms/internal/dq;

    invoke-direct {v0, v1, p2}, Lcom/google/android/gms/internal/dq;-><init>(Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;)V

    return-object v0
.end method

.method private a(Landroid/graphics/drawable/Drawable;ZZZ)V
    .locals 7

    iget v0, p0, Lcom/google/android/gms/common/images/a;->os:I

    packed-switch v0, :pswitch_data_0

    goto :goto_0

    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
        :pswitch_2
    .end packed-switch

    :pswitch_0
    if-nez p3, :cond_1

    iget-object v0, p0, Lcom/google/android/gms/common/images/a;->ou:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/google/android/gms/common/images/ImageManager$OnImageLoadedListener;

    move-object v6, v0

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/google/android/gms/common/images/a;->op:Lcom/google/android/gms/common/images/a$a;

    iget-object v0, v0, Lcom/google/android/gms/common/images/a$a;->uri:Landroid/net/Uri;

    invoke-interface {v6, v0, p1, p4}, Lcom/google/android/gms/common/images/ImageManager$OnImageLoadedListener;->onImageLoaded(Landroid/net/Uri;Landroid/graphics/drawable/Drawable;Z)V

    :cond_0
    return-void

    :pswitch_1
    iget-object v0, p0, Lcom/google/android/gms/common/images/a;->ov:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/widget/ImageView;

    move-object v6, v0

    if-eqz v0, :cond_1

    move-object v0, p0

    move-object v1, v6

    move-object v2, p1

    move v3, p2

    move v4, p3

    move v5, p4

    invoke-direct/range {v0 .. v5}, Lcom/google/android/gms/common/images/a;->a(Landroid/widget/ImageView;Landroid/graphics/drawable/Drawable;ZZZ)V

    return-void

    :pswitch_2
    iget-object v0, p0, Lcom/google/android/gms/common/images/a;->ow:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    move-object p4, v0

    if-eqz v0, :cond_1

    move-object v0, p0

    move-object v1, p4

    iget v2, p0, Lcom/google/android/gms/common/images/a;->ox:I

    move-object v3, p1

    move v4, p2

    move v5, p3

    invoke-direct/range {v0 .. v5}, Lcom/google/android/gms/common/images/a;->a(Landroid/widget/TextView;ILandroid/graphics/drawable/Drawable;ZZ)V

    :cond_1
    :goto_0
    return-void
.end method

.method private a(Landroid/widget/ImageView;Landroid/graphics/drawable/Drawable;ZZZ)V
    .locals 4

    if-nez p4, :cond_0

    if-nez p5, :cond_0

    const/4 v0, 0x1

    goto :goto_0

    :cond_0
    const/4 v0, 0x0

    :goto_0
    move v2, v0

    if-eqz v0, :cond_1

    instance-of v0, p1, Lcom/google/android/gms/internal/dr;

    if-eqz v0, :cond_1

    move-object v0, p1

    check-cast v0, Lcom/google/android/gms/internal/dr;

    invoke-virtual {v0}, Lcom/google/android/gms/internal/dr;->bE()I

    move-result v3

    iget v0, p0, Lcom/google/android/gms/common/images/a;->or:I

    if-eqz v0, :cond_1

    iget v0, p0, Lcom/google/android/gms/common/images/a;->or:I

    if-ne v3, v0, :cond_1

    return-void

    :cond_1
    invoke-direct {p0, p3, p4}, Lcom/google/android/gms/common/images/a;->a(ZZ)Z

    move-result p3

    move-object v3, p2

    if-eqz p3, :cond_2

    invoke-virtual {p1}, Landroid/widget/ImageView;->getDrawable()Landroid/graphics/drawable/Drawable;

    move-result-object v0

    invoke-direct {p0, v0, p2}, Lcom/google/android/gms/common/images/a;->a(Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;)Lcom/google/android/gms/internal/dq;

    move-result-object v3

    :cond_2
    invoke-virtual {p1, v3}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    instance-of v0, p1, Lcom/google/android/gms/internal/dr;

    if-eqz v0, :cond_5

    move-object v0, p1

    check-cast v0, Lcom/google/android/gms/internal/dr;

    move-object p1, v0

    if-eqz p5, :cond_3

    iget-object v0, p0, Lcom/google/android/gms/common/images/a;->op:Lcom/google/android/gms/common/images/a$a;

    iget-object p2, v0, Lcom/google/android/gms/common/images/a$a;->uri:Landroid/net/Uri;

    goto :goto_1

    :cond_3
    const/4 p2, 0x0

    :goto_1
    invoke-virtual {p1, p2}, Lcom/google/android/gms/internal/dr;->d(Landroid/net/Uri;)V

    if-eqz v2, :cond_4

    iget p2, p0, Lcom/google/android/gms/common/images/a;->or:I

    goto :goto_2

    :cond_4
    const/4 p2, 0x0

    :goto_2
    invoke-virtual {p1, p2}, Lcom/google/android/gms/internal/dr;->H(I)V

    :cond_5
    if-eqz p3, :cond_6

    move-object v0, v3

    check-cast v0, Lcom/google/android/gms/internal/dq;

    const/16 v1, 0xfa

    invoke-virtual {v0, v1}, Lcom/google/android/gms/internal/dq;->startTransition(I)V

    :cond_6
    return-void
.end method

.method private a(Landroid/widget/TextView;ILandroid/graphics/drawable/Drawable;ZZ)V
    .locals 5

    invoke-direct {p0, p4, p5}, Lcom/google/android/gms/common/images/a;->a(ZZ)Z

    move-result p4

    move-object p5, p3

    invoke-static {}, Lcom/google/android/gms/internal/fg;->cI()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-virtual {p1}, Landroid/widget/TextView;->getCompoundDrawablesRelative()[Landroid/graphics/drawable/Drawable;

    move-result-object v2

    goto :goto_0

    :cond_0
    invoke-virtual {p1}, Landroid/widget/TextView;->getCompoundDrawables()[Landroid/graphics/drawable/Drawable;

    move-result-object v2

    :goto_0
    aget-object v3, v2, p2

    if-eqz p4, :cond_1

    invoke-direct {p0, v3, p3}, Lcom/google/android/gms/common/images/a;->a(Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;)Lcom/google/android/gms/internal/dq;

    move-result-object p5

    :cond_1
    if-nez p2, :cond_2

    move-object p3, p5

    goto :goto_1

    :cond_2
    const/4 v0, 0x0

    aget-object p3, v2, v0

    :goto_1
    const/4 v0, 0x1

    if-ne p2, v0, :cond_3

    move-object v3, p5

    goto :goto_2

    :cond_3
    const/4 v0, 0x1

    aget-object v3, v2, v0

    :goto_2
    const/4 v0, 0x2

    if-ne p2, v0, :cond_4

    move-object v4, p5

    goto :goto_3

    :cond_4
    const/4 v0, 0x2

    aget-object v4, v2, v0

    :goto_3
    const/4 v0, 0x3

    if-ne p2, v0, :cond_5

    move-object p2, p5

    goto :goto_4

    :cond_5
    const/4 v0, 0x3

    aget-object p2, v2, v0

    :goto_4
    invoke-static {}, Lcom/google/android/gms/internal/fg;->cI()Z

    move-result v0

    if-eqz v0, :cond_6

    invoke-virtual {p1, p3, v3, v4, p2}, Landroid/widget/TextView;->setCompoundDrawablesRelativeWithIntrinsicBounds(Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;)V

    goto :goto_5

    :cond_6
    invoke-virtual {p1, p3, v3, v4, p2}, Landroid/widget/TextView;->setCompoundDrawablesWithIntrinsicBounds(Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;)V

    :goto_5
    if-eqz p4, :cond_7

    move-object v0, p5

    check-cast v0, Lcom/google/android/gms/internal/dq;

    const/16 v1, 0xfa

    invoke-virtual {v0, v1}, Lcom/google/android/gms/internal/dq;->startTransition(I)V

    :cond_7
    return-void
.end method

.method private a(ZZ)Z
    .locals 1

    iget-boolean v0, p0, Lcom/google/android/gms/common/images/a;->oy:Z

    if-eqz v0, :cond_1

    if-nez p2, :cond_1

    if-eqz p1, :cond_0

    iget-boolean v0, p0, Lcom/google/android/gms/common/images/a;->oz:Z

    if-eqz v0, :cond_1

    :cond_0
    const/4 v0, 0x1

    return v0

    :cond_1
    const/4 v0, 0x0

    return v0
.end method

# virtual methods
.method public final F(I)V
    .locals 0

    iput p1, p0, Lcom/google/android/gms/common/images/a;->or:I

    return-void
.end method

.method final a(Landroid/content/Context;Landroid/graphics/Bitmap;Z)V
    .locals 2

    invoke-static {p2}, Lcom/google/android/gms/internal/ds;->d(Ljava/lang/Object;)V

    new-instance v0, Landroid/graphics/drawable/BitmapDrawable;

    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    invoke-direct {v0, v1, p2}, Landroid/graphics/drawable/BitmapDrawable;-><init>(Landroid/content/res/Resources;Landroid/graphics/Bitmap;)V

    move-object p1, v0

    const/4 v0, 0x0

    const/4 v1, 0x1

    invoke-direct {p0, p1, p3, v0, v1}, Lcom/google/android/gms/common/images/a;->a(Landroid/graphics/drawable/Drawable;ZZZ)V

    return-void
.end method

.method public final a(Landroid/widget/ImageView;)V
    .locals 1

    invoke-static {p1}, Lcom/google/android/gms/internal/ds;->d(Ljava/lang/Object;)V

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/google/android/gms/common/images/a;->ou:Ljava/lang/ref/WeakReference;

    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/google/android/gms/common/images/a;->ov:Ljava/lang/ref/WeakReference;

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/google/android/gms/common/images/a;->ow:Ljava/lang/ref/WeakReference;

    const/4 v0, -0x1

    iput v0, p0, Lcom/google/android/gms/common/images/a;->ox:I

    const/4 v0, 0x2

    iput v0, p0, Lcom/google/android/gms/common/images/a;->os:I

    invoke-virtual {p1}, Ljava/lang/Object;->hashCode()I

    move-result v0

    iput v0, p0, Lcom/google/android/gms/common/images/a;->ot:I

    return-void
.end method

.method public final a(Lcom/google/android/gms/common/images/ImageManager$OnImageLoadedListener;)V
    .locals 3

    invoke-static {p1}, Lcom/google/android/gms/internal/ds;->d(Ljava/lang/Object;)V

    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/google/android/gms/common/images/a;->ou:Ljava/lang/ref/WeakReference;

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/google/android/gms/common/images/a;->ov:Ljava/lang/ref/WeakReference;

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/google/android/gms/common/images/a;->ow:Ljava/lang/ref/WeakReference;

    const/4 v0, -0x1

    iput v0, p0, Lcom/google/android/gms/common/images/a;->ox:I

    const/4 v0, 0x1

    iput v0, p0, Lcom/google/android/gms/common/images/a;->os:I

    const/4 v0, 0x2

    new-array v0, v0, [Ljava/lang/Object;

    const/4 v1, 0x0

    aput-object p1, v0, v1

    iget-object v1, p0, Lcom/google/android/gms/common/images/a;->op:Lcom/google/android/gms/common/images/a$a;

    const/4 v2, 0x1

    aput-object v1, v0, v2

    invoke-static {v0}, Lcom/google/android/gms/internal/ee;->hashCode([Ljava/lang/Object;)I

    move-result v0

    iput v0, p0, Lcom/google/android/gms/common/images/a;->ot:I

    return-void
.end method

.method final b(Landroid/content/Context;Z)V
    .locals 3

    const/4 v2, 0x0

    iget v0, p0, Lcom/google/android/gms/common/images/a;->or:I

    if-eqz v0, :cond_0

    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    iget v1, p0, Lcom/google/android/gms/common/images/a;->or:I

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v2

    :cond_0
    const/4 v0, 0x0

    const/4 v1, 0x0

    invoke-direct {p0, v2, p2, v0, v1}, Lcom/google/android/gms/common/images/a;->a(Landroid/graphics/drawable/Drawable;ZZZ)V

    return-void
.end method

.method public final equals(Ljava/lang/Object;)Z
    .locals 2

    instance-of v0, p1, Lcom/google/android/gms/common/images/a;

    if-nez v0, :cond_0

    const/4 v0, 0x0

    return v0

    :cond_0
    if-ne p0, p1, :cond_1

    const/4 v0, 0x1

    return v0

    :cond_1
    move-object v0, p1

    check-cast v0, Lcom/google/android/gms/common/images/a;

    invoke-virtual {v0}, Lcom/google/android/gms/common/images/a;->hashCode()I

    move-result v0

    invoke-virtual {p0}, Lcom/google/android/gms/common/images/a;->hashCode()I

    move-result v1

    if-ne v0, v1, :cond_2

    const/4 v0, 0x1

    return v0

    :cond_2
    const/4 v0, 0x0

    return v0
.end method

.method public final hashCode()I
    .locals 1

    iget v0, p0, Lcom/google/android/gms/common/images/a;->ot:I

    return v0
.end method

.method final r(Landroid/content/Context;)V
    .locals 4

    const/4 v3, 0x0

    iget v0, p0, Lcom/google/android/gms/common/images/a;->oq:I

    if-eqz v0, :cond_0

    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    iget v1, p0, Lcom/google/android/gms/common/images/a;->oq:I

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v3

    :cond_0
    const/4 v0, 0x0

    const/4 v1, 0x1

    const/4 v2, 0x0

    invoke-direct {p0, v3, v0, v1, v2}, Lcom/google/android/gms/common/images/a;->a(Landroid/graphics/drawable/Drawable;ZZZ)V

    return-void
.end method


text:
dojo.provide("plugins.dojox.Timing");

/*

	1. REPEATEDLY POLL WHILE WAITING FOR EVENTS TO FINISH

	2. CARRY OUT A SPECIFIED ACTION ON COMPLETION

*/

// TIMER
dojo.require("dojox.timing");

// INHERITS
//dojo.require("plugins.core.Common");

dojo.declare( "plugins.dojox.Timing",
	//[ plugins.core.Common ],
	null,
{

////}

// PARENT WIDGET
parentWidget : null,

// INTERVAL IN 1000ths OF A SECOND
timingInterval : 5000,

constructor : function(args) {
	console.log("IO.constructor     plugins.dojox.Timing.constructor");
	this.pollProgress 	= args.pollProgress;
	this.onEnd 			= args.onEnd;

	// INSTANTIATE NEW TIMER
	this.setTimer();
},

postCreate : function() {
	console.log("IO.postCreate    plugins.workflow.Controller.postCreate()");
	this.startup();
},

startup : function () {
	console.log("IO.startup    plugins.dojox.Timing.startup()");

},

setTimer : function () {
	console.log("RunStatus.setTimer    this.timerInterval: " + this.timerInterval);

	if ( this.timer != null ) {
		return;
	}

	this.timer = new dojox.timing.Timer;
	this.timer.setInterval(this.timerInterval);	// 1000ths OF A SECOND
	var thisObject = this;
	this.timer.onTick = function()
	{
		console.log("RunStatus.setTimer    onTick()");
		console.log("RunStatus.setTimer    time: " + new Date().toTimeString());

		// STOP POLLING WHEN THE LAST RUNNING ITEM HAS
		// COMPLETED (I.E., WHEN 'this.completed' == true)
		console.log("RunStatus.setTimer     thisObject.completed: " + dojo.toJson(thisObject.completed));
		if ( thisObject.completed == true )
		{
			console.log("RunStatus.setTimer     Stopping timer because thisObject.completed: " + thisObject.completed);
			thisObject.stopTimer();
			return;
		}

        setTimeout(function() {
            try {
                console.log("RunStatus.setTimer     Doing setTimeout(this.queryStatus(this.runner))");
                thisObject.queryStatus(thisObject.runner);
            } catch(error) {
                console.log("RunStatus.setTimer     Error doing setTimeout(this.queryStatus(this.runner)): " + dojo.toJson(error));
            }
        }, 100);

	};	//	timer.onTick
},

getStatus : function (runner, singleton) {
// KEEP POLLING SERVER FOR RUN STATUS UNTIL COMPLETE
	console.log("RunStatus.getStatus      plugins.workflow.Controller.getStatus(runner, singleton)");
	console.log("RunStatus.getStatus      runner: " + runner);
	console.log("RunStatus.getStatus      singleton: " + singleton);

	console.log("RunStatus.getStatus     this.polling: " + this.polling);
	if ( this.polling == true )
	{
		console.log("RunStatus.getStatus     Returning because this.polling is TRUE");
		return;
	}
	this.polling = true;

	if ( runner != null )	this.runner = runner;
	else
	{
		var stageNumber = 1;
		this.runner	= this.createRunner(stageNumber);
	}

    dojo.removeClass(this.toggle, 'timerStopped');
    dojo.addClass(this.toggle, 'timerStarted');

	// SET MESSAGE
	this.displayWorkflowStatus("loading");

	var project		=	this.runner.project;
	var workflow	=	this.runner.workflow;
	var start		=	this.runner.start;
	var childNodes	=	this.runner.childNodes;
	console.log("RunStatus.getStatus      project: " + project);
	console.log("RunStatus.getStatus      workflow: " + workflow);
	console.log("RunStatus.getStatus      start: " + start);
	console.log("RunStatus.getStatus      childNodes.length: " + childNodes.length);

	// SANITY CHECKS
	if ( project == null ) { return; }
	if ( workflow == null ) { return; }
	if ( start == null ) { return; }
	if ( childNodes == null || ! childNodes || childNodes.length == 0 )
	{
		console.log("RunStatus.getStatus      No childNodes in dropTarget. Returning...");
		return;
	}

    // FIRST QUERY
    this.queryStatus(this.runner);
	if ( singleton != null ) {
		console.log("RunStatus.getStatus     Quitting getStatus early because singleton");
		this.stopTimer();
		return;
	}

	// START TIMER
	console.log("RunStatus.getStatus     Doing this.timer.start()");
	this.completed = false;
	this.timer.start();
},

queryStatus : function (runner) {
// QUERY RUN STATUS ON SERVER

	// GENERATE QUERY FOR THIS WORKFLOW
	var url = this.cgiUrl;
	var query 			= 	new Object;
	query.username  	= 	runner.username;
	query.sessionid 	= 	runner.sessionid;
	query.project   	= 	runner.project;
	query.workflow  	= 	runner.workflow;
	query.mode 			= 	"getStatus";
	query.module 		= 	"Agua::Workflow";
	console.log("RunStatus.queryStatus    query: " + dojo.toJson(query));

	var thisObject = this;
	dojo.xhrPut(
	{
		url: url,
		putData: dojo.toJson(query),
		handleAs: "json",
		timeout : 50000,
		sync: false,
		load: function(response) {
			thisObject.handleStatus(runner, response)
		}
	});
},

handleStatus : function (runner, response) {

	var project		=	this.runner.project;
	var workflow	=	this.runner.workflow;
	var start		=	this.runner.start;
	var childNodes	=	this.runner.childNodes;
	console.log("RunStatus.handleStatus      project: " + project);
	console.log("RunStatus.handleStatus      workflow: " + workflow);
	console.log("RunStatus.handleStatus      start: " + start);
	console.log("RunStatus.handleStatus      childNodes.length: " + childNodes.length);

	console.log("RunStatus.handleStatus     response: " + dojo.toJson(response));

	if ( response == null )	return;
	if ( response.stages == null )	return false;

	// SET MESSAGE
	this.displayWorkflowStatus("processing");

	// SAVE RESPONSE
	this.response = response;

	// SET COMPLETED FLAG
	this.completed = true;

	// SET THE NODE CLASSES BASED ON STATUS
	console.log("RunStatus.handleStatus    Setting class of " + response.stages.length  + " stage nodes");

	// CHANGE CSS ON RUN NODES
	var startIndex = runner.start - 1;
	if ( startIndex < 0 ) startIndex = 0;
	console.log("RunStatus.handleStatus    startIndex: " + startIndex);
	for ( var i = startIndex; i < response.stages.length; i++ )
	{
		var nodeClass = response.stages[i].status;
		console.log("RunStatus.handleStatus    response nodeClass " + i + ": " + nodeClass);
		dojo.removeClass(runner.childNodes[i], 'stopped');
		dojo.removeClass(runner.childNodes[i], 'waiting');
		dojo.removeClass(runner.childNodes[i], 'running');
		dojo.removeClass(runner.childNodes[i], 'completed');
		dojo.addClass(runner.childNodes[i], nodeClass);

		// UNSET COMPLETED FLAG IF ANY NODE IS NOT COMPLETED
		if ( nodeClass != "completed" )
		{
			console.log("RunStatus.handleStatus    Setting this.completed = false");
			this.completed = false;
		}
	}

	if ( this.completed == true )
	{
		this.stopTimer();
	}
	console.log("RunStatus.handleStatus    this.completed: " + this.completed);

	console.log("RunStatus.handleStatus     BEFORE Agua.updateStagesStatus(startIndex, response)");
	Agua.updateStagesStatus(response.stages);
	console.log("RunStatus.handleStatus     AFTER Agua.updateStagesStatus(startIndex, response)");

	console.log("RunStatus.handleStatus     BEFORE this.showStatus(startIndex, response)");
	this.showStatus(response);
	console.log("RunStatus.handleStatus     AFTER this.showStatus(startIndex, response)");
}

});


text:
using System;
using System.Collections.Generic;
using NUnit.Framework;

namespace MoreLinq.Test
{
    [TestFixture]
    public class ExceptByTest
    {
        [Test]
        public void SimpleExceptBy()
        {
            string[] first = { "aaa", "bb", "c", "dddd" };
            string[] second = { "xx", "y" };
            var result = first.ExceptBy(second, x => x.Length);
            result.AssertSequenceEqual("aaa", "dddd");
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void ExceptByNullFirstSequence()
        {
            string[] first = null;
            string[] second = { "aaa" };
            first.ExceptBy(second, x => x.Length);
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void ExceptByNullSecondSequence()
        {
            string[] first = { "aaa" };
            string[] second = null;
            first.ExceptBy(second, x => x.Length);
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void ExceptByNullKeySelector()
        {
            string[] first = { "aaa" };
            string[] second = { "aaa" };
            first.ExceptBy(second, (Func<string, string>)null);
        }

        [Test]
        public void ExceptByIsLazy()
        {
            new BreakingSequence<string>().ExceptBy(new string[0], x => x.Length);
        }

        [Test]
        public void ExceptByDoesNotRepeatSourceElementsWithDuplicateKeys()
        {
            string[] first = { "aaa", "bb", "c", "a", "b", "c", "dddd" };
            string[] second = { "xx" };
            var result = first.ExceptBy(second, x => x.Length);
            result.AssertSequenceEqual("aaa", "c", "dddd");
        }

        [Test]
        public void ExceptByWithComparer()
        {
            string[] first = { "first", "second", "third", "fourth" };
            string[] second = { "FIRST" , "thiRD", "FIFTH" };
            var result = first.ExceptBy(second, word => word, StringComparer.OrdinalIgnoreCase);
            result.AssertSequenceEqual("second", "fourth");
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void ExceptByNullFirstSequenceWithComparer()
        {
            string[] first = null;
            string[] second = { "aaa" };
            first.ExceptBy(second, x => x.Length, EqualityComparer<int>.Default);
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void ExceptByNullSecondSequenceWithComparer()
        {
            string[] first = { "aaa" };
            string[] second = null;
            first.ExceptBy(second, x => x.Length, EqualityComparer<int>.Default);
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void ExceptByNullKeySelectorWithComparer()
        {
            string[] first = { "aaa" };
            string[] second = { "aaa" };
            first.ExceptBy(second, null, EqualityComparer<string>.Default);
        }

        [Test]
        public void ExceptByNullComparer()
        {
            string[] first = { "aaa", "bb", "c", "dddd" };
            string[] second = { "xx", "y" };
            var result = first.ExceptBy(second, x => x.Length, null);
            result.AssertSequenceEqual("aaa", "dddd");
        }

        [Test]
        public void ExceptByIsLazyWithComparer()
        {
            new BreakingSequence<string>().ExceptBy(new string[0], x => x, StringComparer.Ordinal);
        }
    }
}