text:
try:
    from test_config import UPSConfig, EndiciaConfig
    from test_config import FedexConfigDebug as FedexConfig
except:
    print 'HELLO THERE! test_config not found. If you want to run this test, you need to setup test_config.py with your account information.'
    raise

import os, tempfile
from shipping import Package, Address, Product
import sys
sys.path.append('../')

import ups
import endicia
import fedex

shipper = Address('Adobe', "345 Park Avenue", 'San Jose', 'CA', 95110, 'US', phone='5122901212', email='ben@ordoro.com')
recipient = Address('Apple', "1 Infinite Loop", 'Cupertino', 'CA', 95014, 'US', phone='5122901212', email='ben@ordoro.com')
bad_recipient = Address('Apple', "1 Park Place.", 'San Diego', 'CA', 95014, 'US', phone='5122901212', email='ben@ordoro.com', address2='#502')
recipient_intl = Address('Apple', "1 Infinite Loop", 'Cupertino', 'CA', 95014, 'CA', phone='5122901212', email='ben@ordoro.com')
recipient_intl2 = Address('Bazaarvoice', 'One Lyric Square', 'London', '', 'W6 0NB', 'GB', phone='+44 (0)208 080', email='ben@ordoro.com')
# recipient_intl3 = Address('Bazaarvoice', '111 Rue Francis de Pressensé', 'villeurbanne', '', '69100', 'FR', phone='+44 (0)208 080', email='ben@ordoro.com')
recipient_intl4 = Address('Some Recipient', '24 Tennant st', 'EDINBURGH', 'Midlothian', 'EH6 5ND', 'GB', phone='+44 (0)208 080', email='ben@ordoro.com')
# recipient_intl5 = Address('Bazaarvoice', 'Flat 3 Gainsborough Court', 'London', '', 'W6 0NB', 'GB', phone='+44 (0)208 080', email='ben@ordoro.com')
# recipient_intl6 = Address('Bazaarvoice', 'One Lyric Square', 'London', '', 'W6 0NB', 'GB', phone='+44 (0)208 080', email='ben@ordoro.com')

def _show_file(extension, data):
    with tempfile.NamedTemporaryFile(suffix=extension, delete=False) as temp_file:
        temp_file.write(data)
        os.system('open %s' % temp_file.name)

class P(object):
    def __init__(self, **kwargs):
        for key, value in kwargs.items():
            setattr(self, key, value)

def TestUPS():
    packages = [ Package(20.0 * 16, 12, 12, 12, value=1000, require_signature=3, reference='a12302b') ]

    intl_packages = [ Package(2.0 * 16, 12, 12, 12, value=100, require_signature=2, reference='a12302b') ]
    products = [
        Product(total=10, value=2, quantity=5, description='It\'s just a bunch of widgets', country = 'CA'),
        Product(total=10, value=2, quantity=5, description='It\'s just a bunch of widgets', country = 'CA')
    ]

    u = ups.UPS(UPSConfig, debug=True)

    for r in ( recipient_intl2, recipient_intl4, ):
        try:
            validate = True
            r.is_residence = True
            response = u.label(intl_packages, shipper, r, ups.SERVICES[9][0], ups.PACKAGES[5][0], validate, [ 'test@mytrashmail.com '], create_commercial_invoice=True, customs_info=products)
            status = response['status']
            print 'Status: %s' % status,
            for info in response['shipments']:
                print 'tracking: %s, cost: %s' % (info['tracking_number'], info['cost'])
                # _show_file(extension='.gif', data=info['label'])
            # _show_file(extension='.pdf', data=response['international_document']['pdf'])
        except ups.UPSError as e:
            print e

    for r in ( recipient, shipper, bad_recipient, recipient_intl ):
        try:
            print u.validate(r)
        except ups.UPSError as e:
            print e

        try:
            validate = False
            r.is_residence = True
            response = u.label(packages, shipper, r, ups.SERVICES[2][0], ups.PACKAGES[7][0], validate, [ 'test@mytrashmail.com '])
            status = response['status']
            print 'Status: %s' % status,
            for info in response['shipments']:
                print 'tracking: %s, cost: %s' % (info['tracking_number'], info['cost'])
                # _show_file(extension='.gif', data=info['label'])
        except ups.UPSError as e:
            print e

        return

        for package_type in ups.PACKAGES:
            package_code = package_type[0]
            try:
                response = u.rate(packages, package_code, shipper, r)
                print response
            except ups.UPSError as e:
                print e

def TestEndiciaLabel():
    package = endicia.Package(endicia.Package.shipment_types[0], 20, endicia.Package.shapes[1], 10, 10, 10)
    package_intl = endicia.Package(endicia.Package.international_shipment_types[0], 20, endicia.Package.shapes[3], 10, 10, 10)
    customs = [ endicia.Customs('hello', 1, 2, 100, 'Bermuda'), endicia.Customs('Thingy', 10, 16, 80, 'Bahamas') ]

    debug = True
    req0 = endicia.LabelRequest(EndiciaPartnerID, EndiciaAccountID, EndiciaPassphrase, package_intl, shipper, recipient_intl, contents_type='Merchandise', customs_info=customs, debug=debug)
    req1 = endicia.LabelRequest(EndiciaPartnerID, EndiciaAccountID, EndiciaPassphrase, package, shipper, recipient, debug=debug)
    req2 = endicia.LabelRequest(EndiciaPartnerID, EndiciaAccountID, EndiciaPassphrase, package, shipper, recipient, stealth=False, debug=debug)
    req3 = endicia.LabelRequest(EndiciaPartnerID, EndiciaAccountID, EndiciaPassphrase, package, shipper, recipient, insurance='ENDICIA', insurance_amount=1.0, debug=debug)
    req4 = endicia.LabelRequest(EndiciaPartnerID, EndiciaAccountID, EndiciaPassphrase, package, shipper, recipient, customs_form='Form2976A', customs_info=customs, contents_type='Merchandise', debug=debug)

    for request in [ req0, req1, req2, req3, req4 ]:
        response = request.send()

        print response
        if not isinstance(response, endicia.Error):
            _show_file(extension='.png', data=response.label)

    return response

def TestEndicia():
    debug = True

    # TestEndiciaLabel()

    # Rate
    packages = [ Package(20.0 * 16, 12, 12, 12, value=100) ]

    en = endicia.Endicia(EndiciaConfig)
    for shape in endicia.Package.shapes:
        try:
            response = en.rate(packages, shape, shipper, recipient)
            print response
        except endicia.EndiciaError as e:
            print e

    # # Account Status
    # request = endicia.AccountStatusRequest(EndiciaPartnerID, EndiciaAccountID, EndiciaPassphrase, debug=debug)
    # response = request.send()
    # print response

    # # Recredit
    # request = endicia.RecreditRequest(EndiciaPartnerID, EndiciaAccountID, EndiciaPassphrase, 10.00, debug=debug)
    # response = request.send()
    # print response

    # Change Password
    # request = endicia.ChangePasswordRequest(EndiciaPartnerID, EndiciaAccountID, EndiciaPassphrase, 'ord7oro', debug=debug)
    # response = request.send()
    # print response

    # Refund
    # request = endicia.RefundRequest(EndiciaPartnerID, EndiciaAccountID, EndiciaPassphrase, tracking_number, debug=debug)
    # response = request.send()
    # print response

def TestFedexGroundCertification():
    test_cases = [
        (
            Address('TC #4', '20 FedEx Parkway', 'Kansas City', 'MO', 64112, 'US', address2='2nd Floor Suite 2001', phone=5152961616, is_residence=False),
            fedex.Package(20.0 * 16, 12, 12, 12),
            fedex.SERVICES[0],
            fedex.PACKAGES[-1],
            False, # Email alert
            False, # Evening
        ),
        (
            Address('TC #20', '456 Roswell Rd', 'Atlanta', 'GA', 30328, 'US', phone=5152961616),
            fedex.Package(20.0 * 16, 5, 5, 108),
            fedex.SERVICES[1],
            fedex.PACKAGES[-1],
            False, # Email alert
            False, # Evening
        ),
        (
            Address('TC #21', '987 Main St', 'Boston', 'MA', '02129', 'US', phone=5152961616),
            fedex.Package(20.0 * 16, 5, 5, 108, require_signature=True),
            fedex.SERVICES[1],
            fedex.PACKAGES[-1],
            False, # Email alert
            False, # Evening
        ),
        (
            Address('TC #23', '321 Jay St', 'New York', 'NY', '11201', 'US', phone=5152961616),
            fedex.Package(20.0 * 16, 5, 5, 108, require_signature=True),
            fedex.SERVICES[1],
            fedex.PACKAGES[-1],
            False, # Email alert
            True,  # Evening
        ),
        (
            Address('TC #24', '456 Roswell Rd', 'Atlanta', 'GA', 30328, 'US', phone=5152961616),
            fedex.Package(20.0 * 16, 5, 5, 108, require_signature=True),
            fedex.SERVICES[1],
            fedex.PACKAGES[-1],
            False, # Email alert
            True,  # Evening
        ),
    ]

    f = fedex.Fedex(FedexConfig)

    for case in test_cases:
        try:
            print case
            recipient, package, service, package_type, email, evening = case
            packages = [ package ]
            response = f.label(packages, package_type, service, shipper, recipient, email, evening=evening)

            for info in response['info']:
                _show_file(extension='.png', data=info['label'])
        except fedex.FedexError as e:
            print e

def TestFedexExpressCertification():
    test_cases = [
        (
            Address('TC #1', '123 Bishop Rd', 'Honolulu', 'HI', 96819, 'US', phone=5152961616),
            fedex.Package(1.0 * 16, 12, 12, 12),
            fedex.SERVICES[5],
            fedex.PACKAGES[0],
            False, # Email alert
            False, # Evening
        ),
        (
            Address('TC #4', '789 Davies', 'Englewood', 'CO', 80112, 'US', phone=5152961616),
            fedex.Package(1.0 * 16, 12, 12, 12),
            fedex.SERVICES[4],
            fedex.PACKAGES[0],
            False, # Email alert
            False, # Evening
        ),
        (
            Address('TC #7', '6050 Rockwell Ave', 'Anchorage', 'AK', 99501, 'US', phone=5152961616),
            fedex.Package(5.0 * 16, 12, 12, 12),
            fedex.SERVICES[3],
            fedex.PACKAGES[1],
            False, # Email alert
            False, # Evening
        ),
        (
            Address('TC #8', '44 Binney St', 'Boston', 'MA', 02115, 'US', phone=5152961616),
            fedex.Package(1.0 * 16, 12, 12, 12),
            fedex.SERVICES[6],
            fedex.PACKAGES[0],
            False, # Email alert
            False, # Evening
        ),
        (
            Address('TC #9', '16 Court St', 'New York', 'NY', 10211, 'US', phone=5152961616),
            fedex.Package(8.0 * 16, 7, 10, 15),
            fedex.SERVICES[6],
            fedex.PACKAGES[3],
            False, # Email alert
            False, # Evening
        ),
        (
            Address('TC #10', 'SW 129th St', 'Miami', 'FL', 33156, 'US', phone=5152961616),
            fedex.Package(1.0 * 16, 12, 12, 12),
            fedex.SERVICES[2],
            fedex.PACKAGES[0],
            False, # Email alert
            False, # Evening
        ),
        (
            Address('TC #11', '36 Charles Lane', 'Baltimore', 'MD', 21201, 'US', phone=5152961616),
            fedex.Package(150 * 16, 10, 10, 15),
            fedex.SERVICES[2],
            fedex.PACKAGES[3],
            False, # Email alert
            False, # Evening
        ),
    ]

    f = fedex.Fedex(FedexConfig)

    for case in test_cases:
        try:
            print case
            recipient, package, service, package_type, email, evening = case
            packages = [ package ]
            response = f.label(packages, package_type, service, shipper, recipient, email, evening=evening)

            for info in response['info']:
                _show_file(extension='.png', data=info['label'])
        except fedex.FedexError as e:
            print e

def TestFedexProd():
    test_cases = [
        (
            Address('TC #4', '20 FedEx Parkway', 'Kansas City', 'MO', 64112, 'US', address2='2nd Floor Suite 2001', phone=5152961616, is_residence=False),
            fedex.Package(20.0 * 16, 12, 12, 12),
            fedex.SERVICES[0],
            fedex.PACKAGES[-1],
            False, # Email alert
            False, # Evening
        ),
    ]

    from test_config import FedexConfigProd

    f = fedex.Fedex(FedexConfigProd, debug=False)

    for case in test_cases:
        try:
            print case
            recipient, package, service, package_type, email, evening = case
            packages = [ package ]
            response = f.label(packages, package_type, service, shipper, recipient, email, evening=evening)

            for info in response['info']:
                _show_file(extension='.png', data=info['label'])
        except fedex.FedexError as e:
            print e

def TestFedex():
    f = fedex.Fedex(FedexConfig)

    packages = [
        fedex.Package(100, 12, 12, 12, 100.0, dry_ice_weight_in_ozs=54.27),
    ]

    for service in fedex.SERVICES:
        for package_type in fedex.PACKAGES:
            try:
                print service, package_type,
                response = f.label(packages, package_type, service, shipper, recipient, True)
                status = response['status']
                print 'Status: %s' % status,
                for shipment_info in response['shipments']:
                    print 'tracking: %s, cost: %s' % (shipment_info['tracking_number'], shipment_info['cost'])
                #     _show_file(extension='.png', data=info['label'])
            except fedex.FedexError as e:
                print e

    for package_type in fedex.PACKAGES:
        try:
            response = f.rate(packages, package_type, shipper, recipient)
            print response
        except fedex.FedexError as e:
            print e

if __name__ == '__main__':
    TestUPS()
    #TestUSPS()
    # TestEndicia()
    #TestFedex()
    #TestFedexGroundCertification()
    #TestFedexExpressCertification()
    #TestFedexProd()


text:
require_relative '../spec_helper'

describe 'Script GET routes' do

  before do
      make_auth
  end

  describe 'get scripts' do
    before { get '/collections/scripts' }

    it 'is ok' do
      expect(last_response.status).to eq 200
    end

    it 'is JSON array of strings' do
      array_of_strings? last_response.body
    end
  end

end

redpajama_set_name: RedPajamaGithub


text:
    $ bundle install
    $ bundle exec -- rackup

Then install this integration on integrations page in HipChat administration page.
Specify the application capability URL (e.g. http://example.com:4567/cap).


text:
.class Lcom/android/server/NetworkTimeUpdateService$3;
.super Landroid/content/BroadcastReceiver;
.source "NetworkTimeUpdateService.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/server/NetworkTimeUpdateService;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/server/NetworkTimeUpdateService;

# direct methods
.method constructor <init>(Lcom/android/server/NetworkTimeUpdateService;)V
    .locals 0

    iput-object p1, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method

# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 14

    invoke-virtual/range {p2 .. p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v0

    const-string/jumbo v9, "NetworkTimeUpdateService"

    new-instance v10, Ljava/lang/StringBuilder;

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

    const-string/jumbo v11, "onReceive + intent "

    invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v10

    invoke-virtual/range {p2 .. p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v11

    invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v10

    invoke-virtual {v10}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v10

    invoke-static {v9, v10}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    const-string/jumbo v9, "com.samsung.android.knox.intent.action.UPDATE_NTP_PARAMETERS_INTERNAL"

    invoke-virtual {v9, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v9

    if-eqz v9, :cond_6

    const-string/jumbo v9, "enterprise_policy_new"

    invoke-virtual {p1, v9}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/samsung/android/knox/EnterpriseDeviceManager;

    invoke-virtual {v1}, Lcom/samsung/android/knox/EnterpriseDeviceManager;->getDateTimePolicy()Lcom/samsung/android/knox/datetime/DateTimePolicy;

    move-result-object v9

    invoke-virtual {v9}, Lcom/samsung/android/knox/datetime/DateTimePolicy;->getNtpInfo()Lcom/samsung/android/knox/datetime/NtpInfo;

    move-result-object v3

    if-eqz v3, :cond_5

    invoke-virtual {v3}, Lcom/samsung/android/knox/datetime/NtpInfo;->getServer()Ljava/lang/String;

    move-result-object v9

    if-eqz v9, :cond_5

    invoke-virtual {v3}, Lcom/samsung/android/knox/datetime/NtpInfo;->getPollingInterval()J

    move-result-wide v4

    const-wide/16 v10, 0x0

    cmp-long v9, v10, v4

    if-eqz v9, :cond_1

    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

    invoke-static {v9, v4, v5}, Lcom/android/server/NetworkTimeUpdateService;->-set4(Lcom/android/server/NetworkTimeUpdateService;J)J

    :goto_0
    invoke-virtual {v3}, Lcom/samsung/android/knox/datetime/NtpInfo;->getPollingInterval()J

    move-result-wide v6

    const-wide/16 v10, 0x0

    cmp-long v9, v10, v6

    if-eqz v9, :cond_2

    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

    invoke-static {v9, v6, v7}, Lcom/android/server/NetworkTimeUpdateService;->-set5(Lcom/android/server/NetworkTimeUpdateService;J)J

    :goto_1
    invoke-virtual {v3}, Lcom/samsung/android/knox/datetime/NtpInfo;->getMaxAttempts()I

    move-result v2

    if-eqz v2, :cond_3

    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

    invoke-static {v9, v2}, Lcom/android/server/NetworkTimeUpdateService;->-set8(Lcom/android/server/NetworkTimeUpdateService;I)I

    :goto_2
    invoke-virtual {v3}, Lcom/samsung/android/knox/datetime/NtpInfo;->getTimeErrorThreshold()I

    move-result v8

    int-to-long v10, v8

    const-wide/16 v12, 0x0

    cmp-long v9, v12, v10

    if-eqz v9, :cond_4

    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

    invoke-static {v9, v8}, Lcom/android/server/NetworkTimeUpdateService;->-set6(Lcom/android/server/NetworkTimeUpdateService;I)I

    :goto_3
    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

    const/4 v10, 0x1

    invoke-static {v9, v10}, Lcom/android/server/NetworkTimeUpdateService;->-set3(Lcom/android/server/NetworkTimeUpdateService;Z)Z

    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

    const/4 v10, 0x0

    invoke-static {v9, v10}, Lcom/android/server/NetworkTimeUpdateService;->-set7(Lcom/android/server/NetworkTimeUpdateService;I)I

    :goto_4
    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

    invoke-static {v9}, Lcom/android/server/NetworkTimeUpdateService;->-get0(Lcom/android/server/NetworkTimeUpdateService;)Landroid/os/Handler;

    move-result-object v9

    const/4 v10, 0x4

    invoke-virtual {v9, v10}, Landroid/os/Handler;->obtainMessage(I)Landroid/os/Message;

    move-result-object v9

    invoke-virtual {v9}, Landroid/os/Message;->sendToTarget()V

    :cond_0
    :goto_5
    return-void

    :cond_1
    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

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

    move-result-object v10

    const v11, 0x10e0094

    invoke-virtual {v10, v11}, Landroid/content/res/Resources;->getInteger(I)I

    move-result v10

    int-to-long v10, v10

    invoke-static {v9, v10, v11}, Lcom/android/server/NetworkTimeUpdateService;->-set4(Lcom/android/server/NetworkTimeUpdateService;J)J

    goto :goto_0

    :cond_2
    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

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

    move-result-object v10

    const v11, 0x10e0095

    invoke-virtual {v10, v11}, Landroid/content/res/Resources;->getInteger(I)I

    move-result v10

    int-to-long v10, v10

    invoke-static {v9, v10, v11}, Lcom/android/server/NetworkTimeUpdateService;->-set5(Lcom/android/server/NetworkTimeUpdateService;J)J

    goto :goto_1

    :cond_3
    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

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

    move-result-object v10

    const v11, 0x10e0096

    invoke-virtual {v10, v11}, Landroid/content/res/Resources;->getInteger(I)I

    move-result v10

    invoke-static {v9, v10}, Lcom/android/server/NetworkTimeUpdateService;->-set8(Lcom/android/server/NetworkTimeUpdateService;I)I

    goto :goto_2

    :cond_4
    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

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

    move-result-object v10

    const v11, 0x10e0097

    invoke-virtual {v10, v11}, Landroid/content/res/Resources;->getInteger(I)I

    move-result v10

    invoke-static {v9, v10}, Lcom/android/server/NetworkTimeUpdateService;->-set6(Lcom/android/server/NetworkTimeUpdateService;I)I

    goto :goto_3

    :cond_5
    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

    const/4 v10, 0x0

    invoke-static {v9, v10}, Lcom/android/server/NetworkTimeUpdateService;->-set3(Lcom/android/server/NetworkTimeUpdateService;Z)Z

    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

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

    move-result-object v10

    const v11, 0x10e0094

    invoke-virtual {v10, v11}, Landroid/content/res/Resources;->getInteger(I)I

    move-result v10

    int-to-long v10, v10

    invoke-static {v9, v10, v11}, Lcom/android/server/NetworkTimeUpdateService;->-set4(Lcom/android/server/NetworkTimeUpdateService;J)J

    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

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

    move-result-object v10

    const v11, 0x10e0095

    invoke-virtual {v10, v11}, Landroid/content/res/Resources;->getInteger(I)I

    move-result v10

    int-to-long v10, v10

    invoke-static {v9, v10, v11}, Lcom/android/server/NetworkTimeUpdateService;->-set5(Lcom/android/server/NetworkTimeUpdateService;J)J

    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

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

    move-result-object v10

    const v11, 0x10e0096

    invoke-virtual {v10, v11}, Landroid/content/res/Resources;->getInteger(I)I

    move-result v10

    invoke-static {v9, v10}, Lcom/android/server/NetworkTimeUpdateService;->-set8(Lcom/android/server/NetworkTimeUpdateService;I)I

    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

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

    move-result-object v10

    const v11, 0x10e0097

    invoke-virtual {v10, v11}, Landroid/content/res/Resources;->getInteger(I)I

    move-result v10

    invoke-static {v9, v10}, Lcom/android/server/NetworkTimeUpdateService;->-set6(Lcom/android/server/NetworkTimeUpdateService;I)I

    goto/16 :goto_4

    :cond_6
    const-string/jumbo v9, "android.intent.action.BOOT_COMPLETED"

    invoke-virtual {v9, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v9

    if-eqz v9, :cond_0

    iget-object v9, p0, Lcom/android/server/NetworkTimeUpdateService$3;->this$0:Lcom/android/server/NetworkTimeUpdateService;

    const/4 v10, 0x1

    invoke-static {v9, v10}, Lcom/android/server/NetworkTimeUpdateService;->-set0(Lcom/android/server/NetworkTimeUpdateService;Z)Z

    goto/16 :goto_5
.end method


text:
package ltistarter.model;

import javax.persistence.*;

@Entity
@Table(name = "config")
public class ConfigEntity extends BaseEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "config_id", nullable = false, insertable = true, updatable = true)
    private long id;
    @Basic
    @Column(name = "config_name", nullable = false, insertable = true, updatable = true, length = 255)
    private String name;
    @Basic
    @Column(name = "config_value", nullable = true, insertable = true, updatable = true, length = 4096)
    private String value;

    public ConfigEntity() {
    }

    public ConfigEntity(String name, String value) {
        assert name != null;
        this.name = name;
        this.value = value;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ConfigEntity that = (ConfigEntity) o;

        if (id != that.id) return false;
        if (!name.equals(that.name)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (id ^ (id >>> 32));
        result = 31 * result + name.hashCode();
        return result;
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <ImageView
        android:id="@+id/fruit_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@mipmap/ic_launcher"/>
    <TextView
        android:id="@+id/fruit_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginLeft="10dp"/>

</LinearLayout>


text:
/**
 * Buttons
 *
 * All different kind of buttons,
 * which are used in application
 *
 * @base button Normal button
 * @modifier .large Large button
 * @modifier :disabled Button unable to be pressed
 * @modifier .large:disabled Large button disabled
 * @example <button>Button text</button>
 */


text:
"{{wsadmin}}" -user "{{wasUser}}" -password "{{wasPwd}}" -c "$AdminApp install {{targetEar}} {-appname {{earAppName}} -nodeployejb}"

"{{wsadmin}}" -user "{{wasUser}}" -password "{{wasPwd}}" -c "$AdminControl invoke [$AdminControl queryNames type=ApplicationManager,*] startApplication {{earAppName}}"

"{{xmlaccess}}" -user "{{portalUser}}" -password "{{portalPwd}}" -url "http://{{portalHost}}:{{portalPort}}/wps/config/{{vpContext}}" -in "{{xmlThemesSkins}}" -out "{{tempDir}}/result_themesSkins_{{vpContext}}.xml"


text:
ACCEPTED

#### According to
Interim Register of Marine and Nonmarine Genera

#### Published in
Ber. Verh. Preuss. Akad. Wiss. , 1846, Tab. p. 385.

#### Original name
null

### Remarks
null


text:
.. _scale:

*************************
Scaling to large datasets
*************************

pandas provides data structures for in-memory analytics, which makes using pandas
to analyze datasets that are larger than memory datasets somewhat tricky. Even datasets
that are a sizable fraction of memory become unwieldy, as some pandas operations need
to make intermediate copies.

This document provides a few recommendations for scaling your analysis to larger datasets.
It's a complement to :ref:`enhancingperf`, which focuses on speeding up analysis
for datasets that fit in memory.

But first, it's worth considering *not using pandas*. pandas isn't the right
tool for all situations. If you're working with very large datasets and a tool
like PostgreSQL fits your needs, then you should probably be using that.
Assuming you want or need the expressiveness and power of pandas, let's carry on.

.. ipython:: python

   import pandas as pd
   import numpy as np

.. ipython:: python
   :suppress:

   from pandas._testing import _make_timeseries

   # Make a random in-memory dataset
   ts = _make_timeseries(freq="30S", seed=0)
   ts.to_csv("timeseries.csv")
   ts.to_parquet("timeseries.parquet")

Load less data
--------------

.. ipython:: python
   :suppress:

   # make a similar dataset with many columns
   timeseries = [
       _make_timeseries(freq="1T", seed=i).rename(columns=lambda x: f"{x}_{i}")
       for i in range(10)
   ]
   ts_wide = pd.concat(timeseries, axis=1)
   ts_wide.to_parquet("timeseries_wide.parquet")

Suppose our raw dataset on disk has many columns::

                        id_0    name_0       x_0       y_0  id_1   name_1       x_1  ...  name_8       x_8       y_8  id_9   name_9       x_9       y_9
   timestamp                                                                         ...
   2000-01-01 00:00:00  1015   Michael -0.399453  0.095427   994    Frank -0.176842  ...     Dan -0.315310  0.713892  1025   Victor -0.135779  0.346801
   2000-01-01 00:01:00   969  Patricia  0.650773 -0.874275  1003    Laura  0.459153  ...  Ursula  0.913244 -0.630308  1047    Wendy -0.886285  0.035852
   2000-01-01 00:02:00  1016    Victor -0.721465 -0.584710  1046  Michael  0.524994  ...     Ray -0.656593  0.692568  1064   Yvonne  0.070426  0.432047
   2000-01-01 00:03:00   939     Alice -0.746004 -0.908008   996   Ingrid -0.414523  ...   Jerry -0.958994  0.608210   978    Wendy  0.855949 -0.648988
   2000-01-01 00:04:00  1017       Dan  0.919451 -0.803504  1048    Jerry -0.569235  ...   Frank -0.577022 -0.409088   994      Bob -0.270132  0.335176
   ...                   ...       ...       ...       ...   ...      ...       ...  ...     ...       ...       ...   ...      ...       ...       ...
   2000-12-30 23:56:00   999       Tim  0.162578  0.512817   973    Kevin -0.403352  ...     Tim -0.380415  0.008097  1041  Charlie  0.191477 -0.599519
   2000-12-30 23:57:00   970     Laura -0.433586 -0.600289   958   Oliver -0.966577  ...   Zelda  0.971274  0.402032  1038   Ursula  0.574016 -0.930992
   2000-12-30 23:58:00  1065     Edith  0.232211 -0.454540   971      Tim  0.158484  ...   Alice -0.222079 -0.919274  1022      Dan  0.031345 -0.657755
   2000-12-30 23:59:00  1019    Ingrid  0.322208 -0.615974   981   Hannah  0.607517  ...   Sarah -0.424440 -0.117274   990   George -0.375530  0.563312
   2000-12-31 00:00:00   937    Ursula -0.906523  0.943178  1018    Alice -0.564513  ...   Jerry  0.236837  0.807650   985   Oliver  0.777642  0.783392

   [525601 rows x 40 columns]

To load the columns we want, we have two options.
Option 1 loads in all the data and then filters to what we need.

.. ipython:: python

   columns = ["id_0", "name_0", "x_0", "y_0"]

   pd.read_parquet("timeseries_wide.parquet")[columns]

Option 2 only loads the columns we request.

.. ipython:: python

   pd.read_parquet("timeseries_wide.parquet", columns=columns)

If we were to measure the memory usage of the two calls, we'd see that specifying
``columns`` uses about 1/10th the memory in this case.

With :func:`pandas.read_csv`, you can specify ``usecols`` to limit the columns
read into memory. Not all file formats that can be read by pandas provide an option
to read a subset of columns.

Use efficient datatypes
-----------------------

The default pandas data types are not the most memory efficient. This is
especially true for text data columns with relatively few unique values (commonly
referred to as "low-cardinality" data). By using more efficient data types, you
can store larger datasets in memory.

.. ipython:: python

   ts = pd.read_parquet("timeseries.parquet")
   ts

Now, let's inspect the data types and memory usage to see where we should focus our
attention.

.. ipython:: python

   ts.dtypes

.. ipython:: python

   ts.memory_usage(deep=True)  # memory usage in bytes

The ``name`` column is taking up much more memory than any other. It has just a
few unique values, so it's a good candidate for converting to a
:class:`Categorical`. With a Categorical, we store each unique name once and use
space-efficient integers to know which specific name is used in each row.

.. ipython:: python

   ts2 = ts.copy()
   ts2["name"] = ts2["name"].astype("category")
   ts2.memory_usage(deep=True)

We can go a bit further and downcast the numeric columns to their smallest types
using :func:`pandas.to_numeric`.

.. ipython:: python

   ts2["id"] = pd.to_numeric(ts2["id"], downcast="unsigned")
   ts2[["x", "y"]] = ts2[["x", "y"]].apply(pd.to_numeric, downcast="float")
   ts2.dtypes

.. ipython:: python

   ts2.memory_usage(deep=True)

.. ipython:: python

   reduction = ts2.memory_usage(deep=True).sum() / ts.memory_usage(deep=True).sum()
   print(f"{reduction:0.2f}")

In all, we've reduced the in-memory footprint of this dataset to 1/5 of its
original size.

See :ref:`categorical` for more on ``Categorical`` and :ref:`basics.dtypes`
for an overview of all of pandas' dtypes.

Use chunking
------------

Some workloads can be achieved with chunking: splitting a large problem like "convert this
directory of CSVs to parquet" into a bunch of small problems ("convert this individual CSV
file into a Parquet file. Now repeat that for each file in this directory."). As long as each chunk
fits in memory, you can work with datasets that are much larger than memory.

.. note::

   Chunking works well when the operation you're performing requires zero or minimal
   coordination between chunks. For more complicated workflows, you're better off
   :ref:`using another library <scale.other_libraries>`.

Suppose we have an even larger "logical dataset" on disk that's a directory of parquet
files. Each file in the directory represents a different year of the entire dataset.

.. ipython:: python
   :suppress:

   import pathlib

   N = 12
   starts = [f"20{i:>02d}-01-01" for i in range(N)]
   ends = [f"20{i:>02d}-12-13" for i in range(N)]

   pathlib.Path("data/timeseries").mkdir(exist_ok=True)

   for i, (start, end) in enumerate(zip(starts, ends)):
       ts = _make_timeseries(start=start, end=end, freq="1T", seed=i)
       ts.to_parquet(f"data/timeseries/ts-{i:0>2d}.parquet")

::

   data
   └── timeseries
       ├── ts-00.parquet
       ├── ts-01.parquet
       ├── ts-02.parquet
       ├── ts-03.parquet
       ├── ts-04.parquet
       ├── ts-05.parquet
       ├── ts-06.parquet
       ├── ts-07.parquet
       ├── ts-08.parquet
       ├── ts-09.parquet
       ├── ts-10.parquet
       └── ts-11.parquet

Now we'll implement an out-of-core ``value_counts``. The peak memory usage of this
workflow is the single largest chunk, plus a small series storing the unique value
counts up to this point. As long as each individual file fits in memory, this will
work for arbitrary-sized datasets.

.. ipython:: python

   %%time
   files = pathlib.Path("data/timeseries/").glob("ts*.parquet")
   counts = pd.Series(dtype=int)
   for path in files:
       # Only one dataframe is in memory at a time...
       df = pd.read_parquet(path)
       # ... plus a small Series ``counts``, which is updated.
       counts = counts.add(df["name"].value_counts(), fill_value=0)
   counts.astype(int)

Some readers, like :meth:`pandas.read_csv`, offer parameters to control the
``chunksize`` when reading a single file.

Manually chunking is an OK option for workflows that don't
require too sophisticated of operations. Some operations, like ``groupby``, are
much harder to do chunkwise. In these cases, you may be better switching to a
different library that implements these out-of-core algorithms for you.

.. _scale.other_libraries:

Use other libraries
-------------------

pandas is just one library offering a DataFrame API. Because of its popularity,
pandas' API has become something of a standard that other libraries implement.
The pandas documentation maintains a list of libraries implementing a DataFrame API
in :ref:`our ecosystem page <ecosystem.out-of-core>`.

For example, `Dask`_, a parallel computing library, has `dask.dataframe`_, a
pandas-like API for working with larger than memory datasets in parallel. Dask
can use multiple threads or processes on a single machine, or a cluster of
machines to process data in parallel.

We'll import ``dask.dataframe`` and notice that the API feels similar to pandas.
We can use Dask's ``read_parquet`` function, but provide a globstring of files to read in.

.. ipython:: python
   :okwarning:

   import dask.dataframe as dd

   ddf = dd.read_parquet("data/timeseries/ts*.parquet", engine="pyarrow")
   ddf

Inspecting the ``ddf`` object, we see a few things

* There are familiar attributes like ``.columns`` and ``.dtypes``
* There are familiar methods like ``.groupby``, ``.sum``, etc.
* There are new attributes like ``.npartitions`` and ``.divisions``

The partitions and divisions are how Dask parallelizes computation. A **Dask**
DataFrame is made up of many pandas DataFrames. A single method call on a
Dask DataFrame ends up making many pandas method calls, and Dask knows how to
coordinate everything to get the result.

.. ipython:: python

   ddf.columns
   ddf.dtypes
   ddf.npartitions

One major difference: the ``dask.dataframe`` API is *lazy*. If you look at the
repr above, you'll notice that the values aren't actually printed out; just the
column names and dtypes. That's because Dask hasn't actually read the data yet.
Rather than executing immediately, doing operations build up a **task graph**.

.. ipython:: python

   ddf
   ddf["name"]
   ddf["name"].value_counts()

Each of these calls is instant because the result isn't being computed yet.
We're just building up a list of computation to do when someone needs the
result. Dask knows that the return type of a ``pandas.Series.value_counts``
is a pandas Series with a certain dtype and a certain name. So the Dask version
returns a Dask Series with the same dtype and the same name.

To get the actual result you can call ``.compute()``.

.. ipython:: python

   %time ddf["name"].value_counts().compute()

At that point, you get back the same thing you'd get with pandas, in this case
a concrete pandas Series with the count of each ``name``.

Calling ``.compute`` causes the full task graph to be executed. This includes
reading the data, selecting the columns, and doing the ``value_counts``. The
execution is done *in parallel* where possible, and Dask tries to keep the
overall memory footprint small. You can work with datasets that are much larger
than memory, as long as each partition (a regular pandas DataFrame) fits in memory.

By default, ``dask.dataframe`` operations use a threadpool to do operations in
parallel. We can also connect to a cluster to distribute the work on many
machines. In this case we'll connect to a local "cluster" made up of several
processes on this single machine.

.. code-block:: python

   >>> from dask.distributed import Client, LocalCluster

   >>> cluster = LocalCluster()
   >>> client = Client(cluster)
   >>> client
   <Client: 'tcp://127.0.0.1:53349' processes=4 threads=8, memory=17.18 GB>

Once this ``client`` is created, all of Dask's computation will take place on
the cluster (which is just processes in this case).

Dask implements the most used parts of the pandas API. For example, we can do
a familiar groupby aggregation.

.. ipython:: python

   %time ddf.groupby("name")[["x", "y"]].mean().compute().head()

The grouping and aggregation is done out-of-core and in parallel.

When Dask knows the ``divisions`` of a dataset, certain optimizations are
possible. When reading parquet datasets written by dask, the divisions will be
known automatically. In this case, since we created the parquet files manually,
we need to supply the divisions manually.

.. ipython:: python

   N = 12
   starts = [f"20{i:>02d}-01-01" for i in range(N)]
   ends = [f"20{i:>02d}-12-13" for i in range(N)]

   divisions = tuple(pd.to_datetime(starts)) + (pd.Timestamp(ends[-1]),)
   ddf.divisions = divisions
   ddf

Now we can do things like fast random access with ``.loc``.

.. ipython:: python

   ddf.loc["2002-01-01 12:01":"2002-01-01 12:05"].compute()

Dask knows to just look in the 3rd partition for selecting values in 2002. It
doesn't need to look at any other data.

Many workflows involve a large amount of data and processing it in a way that
reduces the size to something that fits in memory. In this case, we'll resample
to daily frequency and take the mean. Once we've taken the mean, we know the
results will fit in memory, so we can safely call ``compute`` without running
out of memory. At that point it's just a regular pandas object.

.. ipython:: python
   :okwarning:

   @savefig dask_resample.png
   ddf[["x", "y"]].resample("1D").mean().cumsum().compute().plot()

These Dask examples have all be done using multiple processes on a single
machine. Dask can be `deployed on a cluster
<https://docs.dask.org/en/latest/setup.html>`_ to scale up to even larger
datasets.

You see more dask examples at https://examples.dask.org.

.. _Dask: https://dask.org
.. _dask.dataframe: https://docs.dask.org/en/latest/dataframe.html


text:
@interface QuestionController : BaseController

@property (weak, nonatomic) IBOutlet UIButton *commitButton;
@property (weak, nonatomic) IBOutlet UITableView *tableview;
@property (nonatomic,strong) PhoneModel *phoneModel;

- (IBAction)CommitQuestionAction:(id)sender;

@end


text:
/**************************************************************************************
 * Fixed-point MP3 decoder
 * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com)
 * June 2003
 *
 * buffers.c - allocation and freeing of internal MP3 decoder buffers
 *
 * All memory allocation for the codec is done in this file, so if you don't want
 *  to use other the default system malloc() and free() for heap management this is
 *  the only file you'll need to change.
 **************************************************************************************/

// J.Sz. 21/04/2006 #include "hlxclib/stdlib.h"		/* for malloc, free */

#include "coder.h"

#define static_buffers
#ifdef static_buffers
MP3DecInfo  mp3DecInfo;     //  0x7f0 =  2032
SubbandInfo sbi;            // 0x2204 =  8708
IMDCTInfo mi;               // 0x1b20 =  6944
HuffmanInfo hi;             // 0x1210 =  4624
DequantInfo di;             //  0x348 =   840
ScaleFactorInfo sfi;        //  0x124 =   292
SideInfo si;                //  0x148 =   328
FrameHeader fh;             //   0x38 =    56
#else
#include "mem.h"
//#define malloc
//#define free
#endif

/**************************************************************************************
 * Function:    ClearBuffer
 *
 * Description: fill buffer with 0's
 *
 * Inputs:      pointer to buffer
 *              number of bytes to fill with 0
 *
 * Outputs:     cleared buffer
 *
 * Return:      none
 *
 * Notes:       slow, platform-independent equivalent to memset(buf, 0, nBytes)
 **************************************************************************************/
void ClearBuffer(void *buf, int nBytes)
{
	int i;
	unsigned char *cbuf = (unsigned char *)buf;

	for (i = 0; i < nBytes; i++)
		cbuf[i] = 0;

}

/**************************************************************************************
 * Function:    AllocateBuffers
 *
 * Description: allocate all the memory needed for the MP3 decoder
 *
 * Inputs:      none
 *
 * Outputs:     none
 *
 * Return:      pointer to MP3DecInfo structure (initialized with pointers to all
 *                the internal buffers needed for decoding, all other members of
 *                MP3DecInfo structure set to 0)
 *
 * Notes:       if one or more mallocs fail, function frees any buffers already
 *                allocated before returning
 *
 *              Changed by Kasper Jepsen to support static buffers as well.
 *
 **************************************************************************************/
MP3DecInfo *AllocateBuffers(void)
{
  MP3DecInfo *mp3DecInfo_pointer;
  #ifdef static_buffers
  mp3DecInfo_pointer = (MP3DecInfo*)&mp3DecInfo;
  ClearBuffer((void*)&mp3DecInfo, sizeof(MP3DecInfo));

  	mp3DecInfo.FrameHeaderPS =     (void*)&fh;
	mp3DecInfo.SideInfoPS =        (void*)&si;
	mp3DecInfo.ScaleFactorInfoPS = (void*)&sfi;
	mp3DecInfo.HuffmanInfoPS =     (void*)&hi;
	mp3DecInfo.DequantInfoPS =     (void*)&di;
	mp3DecInfo.IMDCTInfoPS =       (void*)&mi;
	mp3DecInfo.SubbandInfoPS =     (void*)&sbi;

	/* important to do this - DSP primitives assume a bunch of state variables are 0 on first use */
    ClearBuffer((void*)&fh,  sizeof(FrameHeader));
	ClearBuffer((void*)&si,  sizeof(SideInfo));
	ClearBuffer((void*)&sfi, sizeof(ScaleFactorInfo));
	ClearBuffer((void*)&hi,  sizeof(HuffmanInfo));
	ClearBuffer((void*)&di,  sizeof(DequantInfo));
	ClearBuffer((void*)&mi,  sizeof(IMDCTInfo));
	ClearBuffer((void*)&sbi, sizeof(SubbandInfo));
   // return mp3DecInfo_pointer;

  #else
	FrameHeader *fh;
	SideInfo *si;
	ScaleFactorInfo *sfi;
	HuffmanInfo *hi;
	DequantInfo *di;
	IMDCTInfo *mi;
	SubbandInfo *sbi;

	mp3DecInfo_pointer = (MP3DecInfo *)malloc(sizeof(MP3DecInfo));
	if (!mp3DecInfo_pointer)
		return 0;
	ClearBuffer(mp3DecInfo_pointer, sizeof(MP3DecInfo));

	fh =  (FrameHeader *)     malloc(sizeof(FrameHeader));
	si =  (SideInfo *)        malloc(sizeof(SideInfo));
	sfi = (ScaleFactorInfo *) malloc(sizeof(ScaleFactorInfo));
	hi =  (HuffmanInfo *)     malloc(sizeof(HuffmanInfo));
	di =  (DequantInfo *)     malloc(sizeof(DequantInfo));
	mi =  (IMDCTInfo *)       malloc(sizeof(IMDCTInfo));
	sbi = (SubbandInfo *)     malloc(sizeof(SubbandInfo));

	mp3DecInfo_pointer->FrameHeaderPS =     (void *)fh;
	mp3DecInfo_pointer->SideInfoPS =        (void *)si;
	mp3DecInfo_pointer->ScaleFactorInfoPS = (void *)sfi;
	mp3DecInfo_pointer->HuffmanInfoPS =     (void *)hi;
	mp3DecInfo_pointer->DequantInfoPS =     (void *)di;
	mp3DecInfo_pointer->IMDCTInfoPS =       (void *)mi;
	mp3DecInfo_pointer->SubbandInfoPS =     (void *)sbi;

	if (!fh || !si || !sfi || !hi || !di || !mi || !sbi) {
		FreeBuffers(mp3DecInfo_pointer);	/* safe to call - only frees memory that was successfully allocated */
		return 0;
	}

	/* important to do this - DSP primitives assume a bunch of state variables are 0 on first use */
	//Optimized away.. hmm
    ClearBuffer(fh,  sizeof(FrameHeader));
	ClearBuffer(si,  sizeof(SideInfo));
	ClearBuffer(sfi, sizeof(ScaleFactorInfo));
	ClearBuffer(hi,  sizeof(HuffmanInfo));
	ClearBuffer(di,  sizeof(DequantInfo));
	ClearBuffer(mi,  sizeof(IMDCTInfo));
	ClearBuffer(sbi, sizeof(SubbandInfo));

#endif
	return mp3DecInfo_pointer;
}

#ifndef static_buffers
#define SAFE_FREE(x)	{if (x)	free(x);	(x) = 0;}	/* helper macro */
#endif

/**************************************************************************************
 * Function:    FreeBuffers
 *
 * Description: frees all the memory used by the MP3 decoder
 *
 * Inputs:      pointer to initialized MP3DecInfo structure
 *
 * Outputs:     none
 *
 * Return:      none
 *
 * Notes:       safe to call even if some buffers were not allocated (uses SAFE_FREE)
 **************************************************************************************/
void FreeBuffers(MP3DecInfo *mp3DecInfo)
{
#ifndef static_buffers
    if (!mp3DecInfo)
		return;

	SAFE_FREE(mp3DecInfo->FrameHeaderPS);
	SAFE_FREE(mp3DecInfo->SideInfoPS);
	SAFE_FREE(mp3DecInfo->ScaleFactorInfoPS);
	SAFE_FREE(mp3DecInfo->HuffmanInfoPS);
	SAFE_FREE(mp3DecInfo->DequantInfoPS);
	SAFE_FREE(mp3DecInfo->IMDCTInfoPS);
	SAFE_FREE(mp3DecInfo->SubbandInfoPS);

	SAFE_FREE(mp3DecInfo);
#endif
}


text:
@implementation PHCache

+ (PHCache *)sharedPHCache {
    static PHCache *sharedPHCache = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedPHCache = [[PHCache alloc] init];
        sharedPHCache.fetchResults = [[NSMutableDictionary alloc] init];
    });
    return sharedPHCache;
}

-(void) cleanCache {
    if(self.fetchResults) {
        self.fetchResults = [[NSMutableDictionary alloc] init];
    }
}

-(NSString *) cacheFetchResultAndReturnUUID:(PHFetchResult *)fetchResult andObjectType:(Class)objectType andOrginalFetchParams:(NSDictionary *)params {
    NSString *uuid = [[NSUUID UUID] UUIDString];
    @synchronized (self.fetchResults) {
        [self.fetchResults setObject:[[PHCachedFetchResult alloc] initWithFetchResult:fetchResult andObjectType:objectType andOriginalFetchParams:params] forKey:uuid];
    }
    return uuid;
}

-(NSString *) cacheFetchResultWithUUID:(PHFetchResult *)fetchResult andObjectType:(Class)objectType andUUID:(NSString *)uuid andOrginalFetchParams:(NSDictionary *)params  {
    @synchronized (self.fetchResults) {
        [self.fetchResults setObject:[[PHCachedFetchResult alloc] initWithFetchResult:fetchResult andObjectType:objectType andOriginalFetchParams:params] forKey:uuid];
    }
    return uuid;
}

-(void) removeFetchResultFromCacheWithUUID:(NSString *)uuid {
    @synchronized (self.fetchResults) {
        [self.fetchResults removeObjectForKey:uuid];
    }
}

-(PHCachedFetchResult *) getFetchResultFromCacheWithuuid:(NSString *)uuid {
    @synchronized (self.fetchResults) {
        return [self.fetchResults objectForKey:uuid];
    }
}

@end


text:
using UnityEngine;
using System.Collections;

public class MouseCursor : MonoBehaviour {

    //The texture that's going to replace the current cursor
    public Texture2D cursorTexture;

    //This variable flags whether the custom cursor is active or not
    public bool ccEnabled = false;

    void Start() {
        //Call the 'SetCustomCursor' (see below) with a delay of 2 seconds.
        cursorTexture = (Texture2D)Resources.Load("dc", typeof(Texture2D));
        Invoke("SetCustomCursor", 0.10f);
    }

    void OnDisable() {
        //Resets the cursor to the default
        Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
        //Set the _ccEnabled variable to false
        this.ccEnabled = false;
    }

    private void SetCustomCursor() {
        //Replace the 'cursorTexture' with the cursor
        Cursor.SetCursor(this.cursorTexture, Vector2.zero, CursorMode.Auto);
        Debug.Log("Custom cursor has been set.");
        //Set the ccEnabled variable to true
        this.ccEnabled = true;
    }
}


text:
package form;

/**
 * Created by hushe on 2017/12/22.
 */
public class UserLogForm {
    private String userId;

    private String target;

    private String message;

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}


text:
#ifndef JUCE_COMBOBOX_H_INCLUDED
#define JUCE_COMBOBOX_H_INCLUDED

//==============================================================================
/**
    A component that lets the user choose from a drop-down list of choices.

    The combo-box has a list of text strings, each with an associated id number,
    that will be shown in the drop-down list when the user clicks on the component.

    The currently selected choice is displayed in the combo-box, and this can
    either be read-only text, or editable.

    To find out when the user selects a different item or edits the text, you
    can register a ComboBox::Listener to receive callbacks.

    @see ComboBox::Listener
*/
class JUCE_API  ComboBox  : public Component,
                            public SettableTooltipClient,
                            public LabelListener,  // (can't use Label::Listener due to idiotic VC2005 bug)
                            public ValueListener,
                            private AsyncUpdater
{
public:
    //==============================================================================
    /** Creates a combo-box.

        On construction, the text field will be empty, so you should call the
        setSelectedId() or setText() method to choose the initial value before
        displaying it.

        @param componentName    the name to set for the component (see Component::setName())
    */
    explicit ComboBox (const String& componentName = String::empty);

    /** Destructor. */
    ~ComboBox();

    //==============================================================================
    /** Sets whether the test in the combo-box is editable.

        The default state for a new ComboBox is non-editable, and can only be changed
        by choosing from the drop-down list.
    */
    void setEditableText (bool isEditable);

    /** Returns true if the text is directly editable.
        @see setEditableText
    */
    bool isTextEditable() const noexcept;

    /** Sets the style of justification to be used for positioning the text.

        The default is Justification::centredLeft. The text is displayed using a
        Label component inside the ComboBox.
    */
    void setJustificationType (Justification justification);

    /** Returns the current justification for the text box.
        @see setJustificationType
    */
    Justification getJustificationType() const noexcept;

    //==============================================================================
    /** Adds an item to be shown in the drop-down list.

        @param newItemText      the text of the item to show in the list
        @param newItemId        an associated ID number that can be set or retrieved - see
                                getSelectedId() and setSelectedId(). Note that this value can not
                                be 0!
        @see setItemEnabled, addSeparator, addSectionHeading, getNumItems, getItemText, getItemId
    */
    void addItem (const String& newItemText, int newItemId);

    /** Adds an array of items to the drop-down list.
        The item ID of each item will be its index in the StringArray + firstItemIdOffset.
    */
    void addItemList (const StringArray& items, int firstItemIdOffset);

    /** Adds a separator line to the drop-down list.

        This is like adding a separator to a popup menu. See PopupMenu::addSeparator().
    */
    void addSeparator();

    /** Adds a heading to the drop-down list, so that you can group the items into
        different sections.

        The headings are indented slightly differently to set them apart from the
        items on the list, and obviously can't be selected. You might want to add
        separators between your sections too.

        @see addItem, addSeparator
    */
    void addSectionHeading (const String& headingName);

    /** This allows items in the drop-down list to be selectively disabled.

        When you add an item, it's enabled by default, but you can call this
        method to change its status.

        If you disable an item which is already selected, this won't change the
        current selection - it just stops the user choosing that item from the list.
    */
    void setItemEnabled (int itemId, bool shouldBeEnabled);

    /** Returns true if the given item is enabled. */
    bool isItemEnabled (int itemId) const noexcept;

    /** Changes the text for an existing item.
    */
    void changeItemText (int itemId, const String& newText);

    /** Removes all the items from the drop-down list.

        If this call causes the content to be cleared, and a change-message
        will be broadcast according to the notification parameter.

        @see addItem, getNumItems
    */
    void clear (NotificationType notification = sendNotificationAsync);

    /** Returns the number of items that have been added to the list.

        Note that this doesn't include headers or separators.
    */
    int getNumItems() const noexcept;

    /** Returns the text for one of the items in the list.
        Note that this doesn't include headers or separators.
        @param index    the item's index from 0 to (getNumItems() - 1)
    */
    String getItemText (int index) const;

    /** Returns the ID for one of the items in the list.
        Note that this doesn't include headers or separators.
        @param index    the item's index from 0 to (getNumItems() - 1)
    */
    int getItemId (int index) const noexcept;

    /** Returns the index in the list of a particular item ID.
        If no such ID is found, this will return -1.
    */
    int indexOfItemId (int itemId) const noexcept;

    //==============================================================================
    /** Returns the ID of the item that's currently shown in the box.

        If no item is selected, or if the text is editable and the user
        has entered something which isn't one of the items in the list, then
        this will return 0.

        @see setSelectedId, getSelectedItemIndex, getText
    */
    int getSelectedId() const noexcept;

    /** Returns a Value object that can be used to get or set the selected item's ID.

        You can call Value::referTo() on this object to make the combo box control
        another Value object.
    */
    Value& getSelectedIdAsValue()                       { return currentId; }

    /** Sets one of the items to be the current selection.

        This will set the ComboBox's text to that of the item that matches
        this ID.

        @param newItemId        the new item to select
        @param notification     determines the type of change notification that will
                                be sent to listeners if the value changes
        @see getSelectedId, setSelectedItemIndex, setText
    */
    void setSelectedId (int newItemId,
                        NotificationType notification = sendNotificationAsync);

    //==============================================================================
    /** Returns the index of the item that's currently shown in the box.

        If no item is selected, or if the text is editable and the user
        has entered something which isn't one of the items in the list, then
        this will return -1.

        @see setSelectedItemIndex, getSelectedId, getText
    */
    int getSelectedItemIndex() const;

    /** Sets one of the items to be the current selection.

        This will set the ComboBox's text to that of the item at the given
        index in the list.

        @param newItemIndex     the new item to select
        @param notification     determines the type of change notification that will
                                be sent to listeners if the value changes
        @see getSelectedItemIndex, setSelectedId, setText
    */
    void setSelectedItemIndex (int newItemIndex,
                               NotificationType notification = sendNotificationAsync);

    //==============================================================================
    /** Returns the text that is currently shown in the combo-box's text field.

        If the ComboBox has editable text, then this text may have been edited
        by the user; otherwise it will be one of the items from the list, or
        possibly an empty string if nothing was selected.

        @see setText, getSelectedId, getSelectedItemIndex
    */
    String getText() const;

    /** Sets the contents of the combo-box's text field.

        The text passed-in will be set as the current text regardless of whether
        it is one of the items in the list. If the current text isn't one of the
        items, then getSelectedId() will return -1, otherwise it wil return
        the approriate ID.

        @param newText          the text to select
        @param notification     determines the type of change notification that will
                                be sent to listeners if the text changes
        @see getText
    */
    void setText (const String& newText,
                  NotificationType notification = sendNotificationAsync);

    /** Programmatically opens the text editor to allow the user to edit the current item.

        This is the same effect as when the box is clicked-on.
        @see Label::showEditor();
    */
    void showEditor();

    /** Pops up the combo box's list.
        This is virtual so that you can override it with your own custom popup
        mechanism if you need some really unusual behaviour.
    */
    virtual void showPopup();

    /** Hides the combo box's popup list, if it's currently visible. */
    void hidePopup();

    /** Returns true if the popup menu is currently being shown. */
    bool isPopupActive() const noexcept                 { return menuActive; }

    /** Adds the items in this ComboBox to the given menu. */
    virtual void addItemsToMenu (PopupMenu&) const;

    //==============================================================================
    /**
        A class for receiving events from a ComboBox.

        You can register a ComboBox::Listener with a ComboBox using the ComboBox::addListener()
        method, and it will be called when the selected item in the box changes.

        @see ComboBox::addListener, ComboBox::removeListener
    */
    class JUCE_API  Listener
    {
    public:
        /** Destructor. */
        virtual ~Listener() {}

        /** Called when a ComboBox has its selected item changed. */
        virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
    };

    /** Registers a listener that will be called when the box's content changes. */
    void addListener (Listener* listener);

    /** Deregisters a previously-registered listener. */
    void removeListener (Listener* listener);

    //==============================================================================
    /** Sets a message to display when there is no item currently selected.
        @see getTextWhenNothingSelected
    */
    void setTextWhenNothingSelected (const String& newMessage);

    /** Returns the text that is shown when no item is selected.
        @see setTextWhenNothingSelected
    */
    String getTextWhenNothingSelected() const;

    /** Sets the message to show when there are no items in the list, and the user clicks
        on the drop-down box.

        By default it just says "no choices", but this lets you change it to something more
        meaningful.
    */
    void setTextWhenNoChoicesAvailable (const String& newMessage);

    /** Returns the text shown when no items have been added to the list.
        @see setTextWhenNoChoicesAvailable
    */
    String getTextWhenNoChoicesAvailable() const;

    //==============================================================================
    /** Gives the ComboBox a tooltip. */
    void setTooltip (const String& newTooltip) override;

    /** This can be used to allow the scroll-wheel to nudge the chosen item.
        By default it's disabled, and I'd recommend leaving it disabled if there's any
        chance that the control might be inside a scrollable list or viewport.
    */
    void setScrollWheelEnabled (bool enabled) noexcept;

    //==============================================================================
    /** A set of colour IDs to use to change the colour of various aspects of the combo box.

        These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
        methods.

        To change the colours of the menu that pops up, you can set the colour IDs in PopupMenu::ColourIDs.

        @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
    */
    enum ColourIds
    {
        backgroundColourId  = 0x1000b00,    /**< The background colour to fill the box with. */
        textColourId        = 0x1000a00,    /**< The colour for the text in the box. */
        outlineColourId     = 0x1000c00,    /**< The colour for an outline around the box. */
        buttonColourId      = 0x1000d00,    /**< The base colour for the button (a LookAndFeel class will probably use variations on this). */
        arrowColourId       = 0x1000e00,    /**< The colour for the arrow shape that pops up the menu */
    };

    //==============================================================================
    /** This abstract base class is implemented by LookAndFeel classes to provide
        ComboBox functionality.
    */
    struct JUCE_API  LookAndFeelMethods
    {
        virtual ~LookAndFeelMethods() {}

        virtual void drawComboBox (Graphics&, int width, int height, bool isButtonDown,
                                   int buttonX, int buttonY, int buttonW, int buttonH,
                                   ComboBox&) = 0;

        virtual Font getComboBoxFont (ComboBox&) = 0;

        virtual Label* createComboBoxTextBox (ComboBox&) = 0;

        virtual void positionComboBoxText (ComboBox&, Label& labelToPosition) = 0;
    };

    //==============================================================================
    /** @internal */
    void labelTextChanged (Label*) override;
    /** @internal */
    void enablementChanged() override;
    /** @internal */
    void colourChanged() override;
    /** @internal */
    void focusGained (Component::FocusChangeType) override;
    /** @internal */
    void focusLost (Component::FocusChangeType) override;
    /** @internal */
    void handleAsyncUpdate() override;
    /** @internal */
    String getTooltip() override                        { return label->getTooltip(); }
    /** @internal */
    void mouseDown (const MouseEvent&) override;
    /** @internal */
    void mouseDrag (const MouseEvent&) override;
    /** @internal */
    void mouseUp (const MouseEvent&) override;
    /** @internal */
    void mouseWheelMove (const MouseEvent&, const MouseWheelDetails&) override;
    /** @internal */
    void lookAndFeelChanged() override;
    /** @internal */
    void paint (Graphics&) override;
    /** @internal */
    void resized() override;
    /** @internal */
    bool keyStateChanged (bool) override;
    /** @internal */
    bool keyPressed (const KeyPress&) override;
    /** @internal */
    void valueChanged (Value&) override;
    /** @internal */
    void parentHierarchyChanged() override;

    // These methods' bool parameters have changed: see their new method signatures.
    JUCE_DEPRECATED (void clear (bool));
    JUCE_DEPRECATED (void setSelectedId (int, bool));
    JUCE_DEPRECATED (void setSelectedItemIndex (int, bool));
    JUCE_DEPRECATED (void setText (const String&, bool));

private:
    //==============================================================================
    struct ItemInfo
    {
        ItemInfo (const String&, int itemId, bool isEnabled, bool isHeading);
        bool isSeparator() const noexcept;
        bool isRealItem() const noexcept;

        String name;
        int itemId;
        bool isEnabled : 1, isHeading : 1;
    };

    OwnedArray<ItemInfo> items;
    Value currentId;
    int lastCurrentId;
    bool isButtonDown, separatorPending, menuActive, scrollWheelEnabled;
    float mouseWheelAccumulator;
    ListenerList<Listener> listeners;
    ScopedPointer<Label> label;
    String textWhenNothingSelected, noChoicesMessage;

    ItemInfo* getItemForId (int) const noexcept;
    ItemInfo* getItemForIndex (int) const noexcept;
    bool selectIfEnabled (int index);
    bool nudgeSelectedItem (int delta);
    void sendChange (NotificationType);
    void showPopupIfNotActive();

    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ComboBox)
};

/** This typedef is just for compatibility with old code - newer code should use the ComboBox::Listener class directly. */
typedef ComboBox::Listener ComboBoxListener;

#endif   // JUCE_COMBOBOX_H_INCLUDED


text:
using base::TimeDelta;
using base::TimeTicks;
using WebKit::WebSize;
using WebKit::WebCanvas;
using WebKit::WebViewBenchmarkSupport;
using WebKit::WebRect;
using std::vector;

namespace {

// This is a base class for timing the painting of the current webpage to
// custom WebCanvases.
class CustomPaintBenchmark
    : public content::RenderingBenchmark,
      public WebViewBenchmarkSupport::PaintClient {
 public:
  CustomPaintBenchmark(const std::string& name,
                       WebViewBenchmarkSupport::PaintMode paint_mode)
      : content::RenderingBenchmark(name),
        paint_mode_(paint_mode) { }

  virtual WebCanvas* willPaint(const WebSize& size) OVERRIDE {
    WebCanvas* canvas = createCanvas(size);
    before_time_ = TimeTicks::HighResNow();
    return canvas;
  }

  virtual void didPaint(WebCanvas* canvas) OVERRIDE {
    paint_time_total_ += (TimeTicks::HighResNow() - before_time_);
    delete canvas;
  }

  virtual double Run(WebViewBenchmarkSupport* support) OVERRIDE {
    paint_time_total_ = TimeDelta();
    support->paint(this, paint_mode_);
    return paint_time_total_.InMillisecondsF();
  }

 private:
  virtual WebCanvas* createCanvas(const WebSize& size) = 0;

  TimeTicks before_time_;
  TimeDelta paint_time_total_;
  const WebViewBenchmarkSupport::PaintMode paint_mode_;
};

class BitmapCanvasPaintBenchmark : public CustomPaintBenchmark {
 public:
  BitmapCanvasPaintBenchmark(const std::string& name,
                             WebViewBenchmarkSupport::PaintMode paint_mode)
      : CustomPaintBenchmark(name, paint_mode) { }

 private:
  virtual WebCanvas* createCanvas(const WebSize& size) OVERRIDE {
    return skia::CreateBitmapCanvas(size.width, size.height, false);
  }
};

class CanvasCountBenchmark
    : public content::RenderingBenchmark,
      public WebViewBenchmarkSupport::PaintClient {
 public:
  CanvasCountBenchmark(const std::string& name,
                       WebViewBenchmarkSupport::PaintMode paint_mode)
      : content::RenderingBenchmark(name),
        canvas_count_(0),
        paint_mode_(paint_mode) { }

  virtual WebCanvas* willPaint(const WebSize& size) OVERRIDE {
    ++canvas_count_;
    return SkCreateNullCanvas();
  }

  virtual void didPaint(WebCanvas* canvas) OVERRIDE {
    delete canvas;
  }

  virtual double Run(WebViewBenchmarkSupport* support) OVERRIDE {
    canvas_count_ = 0;
    support->paint(this, paint_mode_);
    return canvas_count_;
  }
 private:
  int canvas_count_;
  const WebViewBenchmarkSupport::PaintMode paint_mode_;
};

class NullCanvasPaintBenchmark : public CustomPaintBenchmark {
 public:
  NullCanvasPaintBenchmark(const std::string& name,
                           WebViewBenchmarkSupport::PaintMode paint_mode)
      : CustomPaintBenchmark(name, paint_mode) { }

 private:
  virtual WebCanvas* createCanvas(const WebSize& size) OVERRIDE {
    return SkCreateNullCanvas();
  }
};

class SkPicturePaintBenchmark : public CustomPaintBenchmark {
 public:
  SkPicturePaintBenchmark(const std::string& name,
                          WebViewBenchmarkSupport::PaintMode paint_mode)
      : CustomPaintBenchmark(name, paint_mode) { }

  virtual void didPaint(WebCanvas* canvas) OVERRIDE {
    DCHECK(picture_.getRecordingCanvas() == canvas);
    picture_.endRecording();
    CustomPaintBenchmark::didPaint(NULL);
  }

 private:
  virtual WebCanvas* createCanvas(const WebSize& size) OVERRIDE {
    return picture_.beginRecording(size.width, size.height);
  }

  SkPicture picture_;
};

// Base class for timing the replaying of the SkPicture into canvases.
class TiledReplayBenchmark
    : public content::RenderingBenchmark,
      public WebViewBenchmarkSupport::PaintClient {
 public:
  TiledReplayBenchmark(const std::string& name,
                       WebViewBenchmarkSupport::PaintMode paint_mode)
      : RenderingBenchmark(name),
        paint_mode_(paint_mode) {}

  virtual WebCanvas* willPaint(const WebSize& size) OVERRIDE {
    return picture_.beginRecording(size.width, size.height);
  }

  virtual void didPaint(WebCanvas* canvas) OVERRIDE {
    DCHECK(picture_.getRecordingCanvas() == canvas);
    picture_.endRecording();

    const vector<WebRect> repaint_tiles = GetRepaintTiles(
        WebSize(picture_.width(), picture_.height()));

    vector<WebRect>::const_iterator it;
    for (it = repaint_tiles.begin(); it != repaint_tiles.end(); ++it) {
      WebRect tile = *it;
      scoped_ptr<WebCanvas> canvas(
          skia::CreateBitmapCanvas(tile.width, tile.height, false));
      TimeTicks before_time = TimeTicks::HighResNow();
      canvas->translate(-tile.x, -tile.y);
      picture_.draw(canvas.get());
      paint_time_total_ += (TimeTicks::HighResNow() - before_time);
    }
  }

  virtual double Run(WebViewBenchmarkSupport* support) OVERRIDE {
    paint_time_total_ = TimeDelta();
    support->paint(this, paint_mode_);
    return paint_time_total_.InMillisecondsF();
  }

 private:
  virtual vector<WebRect> GetRepaintTiles(const WebSize& layer_size) const = 0;

  TimeDelta paint_time_total_;
  SkPicture picture_;
  const WebViewBenchmarkSupport::PaintMode paint_mode_;
};

class SquareTiledReplayBenchmark : public TiledReplayBenchmark {
 public:
  SquareTiledReplayBenchmark(const std::string& name,
                             WebViewBenchmarkSupport::PaintMode paint_mode,
                             int tile_size)
      : TiledReplayBenchmark(name, paint_mode),
        tile_size_(tile_size) {
    CHECK_GT(tile_size, 0);
  }

 private:
  virtual vector<WebRect> GetRepaintTiles(
      const WebSize& layer_size) const OVERRIDE {
    vector<WebRect> tiles;
    for (int x = 0; x < layer_size.width; x += tile_size_) {
      for (int y = 0; y < layer_size.height; y += tile_size_) {
        int width = std::min(layer_size.width - x, tile_size_);
        int height = std::min(layer_size.height - y, tile_size_);
        tiles.push_back(WebRect(x, y, width, height));
      }
    }
    return tiles;
  }

  int tile_size_;
};

class LayerWidthTiledReplayBenchmark : public TiledReplayBenchmark {
 public:
  LayerWidthTiledReplayBenchmark(const std::string& name,
                                 WebViewBenchmarkSupport::PaintMode paint_mode,
                                 int tile_height)
      : TiledReplayBenchmark(name, paint_mode),
        tile_height_(tile_height) {
    CHECK_GT(tile_height, 0);
  }

 private:
  virtual vector<WebRect> GetRepaintTiles(
      const WebSize& layer_size) const OVERRIDE {
    vector<WebRect> tiles;
    for (int y = 0; y < layer_size.height; y += tile_height_) {
      int height = std::min(layer_size.height - y, tile_height_);
      tiles.push_back(WebRect(0, y, layer_size.width, height));
    }
    return tiles;
  }

  int tile_height_;
};

}  // anonymous namespace

namespace content {

ScopedVector<RenderingBenchmark> AllRenderingBenchmarks() {
  ScopedVector<RenderingBenchmark> benchmarks;
  benchmarks.push_back(new BitmapCanvasPaintBenchmark(
      "PaintEverythingToBitmapMs",
      WebViewBenchmarkSupport::PaintModeEverything));
  benchmarks.push_back(new NullCanvasPaintBenchmark(
      "PaintEverythingToNullCanvasMs",
      WebViewBenchmarkSupport::PaintModeEverything));
  benchmarks.push_back(new CanvasCountBenchmark(
      "LayerCount",
      WebViewBenchmarkSupport::PaintModeEverything));
  benchmarks.push_back(new SkPicturePaintBenchmark(
      "PaintEverythingToSkPictureMs",
      WebViewBenchmarkSupport::PaintModeEverything));
  benchmarks.push_back(new SquareTiledReplayBenchmark(
      "RepaintEverythingTo256x256BitmapMs",
      WebViewBenchmarkSupport::PaintModeEverything,
      256));
  benchmarks.push_back(new SquareTiledReplayBenchmark(
      "RepaintEverythingTo128x128BitmapMs",
      WebViewBenchmarkSupport::PaintModeEverything,
      128));
  benchmarks.push_back(new SquareTiledReplayBenchmark(
      "RepaintEverythingTo512x512BitmapMs",
      WebViewBenchmarkSupport::PaintModeEverything,
      512));
  benchmarks.push_back(new LayerWidthTiledReplayBenchmark(
      "RepaintEverythingToLayerWidthx256BitmapMs",
      WebViewBenchmarkSupport::PaintModeEverything,
      256));
  benchmarks.push_back(new LayerWidthTiledReplayBenchmark(
      "RepaintEverythingToLayerWidthx128BitmapMs",
      WebViewBenchmarkSupport::PaintModeEverything,
      128));
  benchmarks.push_back(new LayerWidthTiledReplayBenchmark(
      "RepaintEverythingToLayerWidthx64BitmapMs",
      WebViewBenchmarkSupport::PaintModeEverything,
      64));
  benchmarks.push_back(new LayerWidthTiledReplayBenchmark(
      "RepaintEverythingToLayerWidthx512BitmapMs",
      WebViewBenchmarkSupport::PaintModeEverything,
      512));
  return benchmarks.Pass();
}

}  // namespace content


text:
/*
    RateIt
    version 0.99.2
    03/07/2011
    http://rateit.codeplex.com
    Twitter: @gjunge

*/
(function ($) {
    $.fn.rateit = function (p1, p2) {
        //quick way out.
        var options = {}; var mode = 'init';
        if (this.length == 0) return this;

        var tp1 = $.type(p1);
        if (tp1 == 'object' || p1 === undefined || p1 == null) {
            options = $.extend({}, $.fn.rateit.defaults, p1); //wants to init new rateit plugin(s).
        }
        else if (tp1 == 'string' && p2 === undefined) {
            return this.data('rateit-' + p1); //wants to get a value.
        }
        else if (tp1 == 'string') {
            mode = 'setvalue'
        }

        return this.each(function () {
            var item = $(this);

            //shorten all the item.data('rateit-XXX'), will save space in closure compiler, will be like item.data('XXX') will become x('XXX')
            var itemdata = function (key, value) { return item.data('rateit-' + key, value); };

            //add the rate it class.
            if (!item.hasClass('rateit')) item.addClass('rateit');

            var ltr = item.css('direction') != 'rtl';

            // set value mode
            if (mode == 'setvalue') {
                if (!itemdata('init')) throw 'Can\'t set value before init';

                //if readonly now and it wasn't readonly, remove the eventhandlers.
                if (p1 == 'readonly' && !itemdata('readonly')) {
                    item.find('.rateit-range').unbind();
                    itemdata('wired', false);
                }

                if (itemdata('backingfld')) {
                    //if we have a backing field, check which fields we should update.
                    //In case of input[type=range], although we did read its attributes even in browsers that don't support it (using fld.attr())
                    //we only update it in browser that support it (&& fld[0].min only works in supporting browsers), not only does it save us from checking if it is range input type, it also is unnecessary.
                    var fld = $(itemdata('backingfld'));
                    if (p1 == 'value') fld.val(p2);
                    if (p1 == 'min' && fld[0].min) fld[0].min = p2;
                    if (p1 == 'max' && fld[0].max) fld[0].max = p2;
                    if (p1 == 'step' && fld[0].step) fld[0].step = p2;
                }

                itemdata(p1, p2);
            }

            //init rateit plugin
            if (!itemdata('init')) {

                //get our values, either from the data-* html5 attribute or from the options.
                itemdata('min', itemdata('min') || options.min);
                itemdata('max', itemdata('max') || options.max);
                itemdata('step', itemdata('step') || options.step);
                itemdata('readonly', itemdata('readonly') !== undefined ? itemdata('readonly') : options.readonly);
                itemdata('resetable', itemdata('resetable') !== undefined ? itemdata('resetable') : options.resetable);
                itemdata('backingfld', itemdata('backingfld') || options.backingfld);
                itemdata('starwidth', itemdata('starwidth') || options.starwidth);
                itemdata('starheight', itemdata('starheight') || options.starheight);
                itemdata('value', itemdata('value') || options.min);
                //are we LTR or RTL?

                if (itemdata('backingfld')) {
                    //if we have a backing field, hide it, and get its value, and override defaults if range.
                    var fld = $(itemdata('backingfld'));
                    itemdata('value', fld.hide().val());

                    if (fld[0].nodeName == 'INPUT') {
                        if (fld[0].type == 'range' || fld[0].type == 'text') { //in browsers not support the range type, it defaults to text

                            itemdata('min', parseInt(fld.attr('min')) || itemdata('min')); //if we would have done fld[0].min it wouldn't have worked in browsers not supporting the range type.
                            itemdata('max', parseInt(fld.attr('max')) || itemdata('max'));
                            itemdata('step', parseInt(fld.attr('step')) || itemdata('step'));
                        }
                    }
                    if (fld[0].nodeName == 'SELECT' && fld[0].options.length > 1) {
                        itemdata('min', Number(fld[0].options[0].value));
                        itemdata('max', Number(fld[0].options[fld[0].length - 1].value));
                        itemdata('step', Number(fld[0].options[1].value) - Number(fld[0].options[0].value));
                    }
                }

                //Create the necessart tags.
                item.append('

');

                item.append('

');

                var $simplified = item.find('.rateit-simplified');

                var simplified = [{
                    text: 'must see',
                    score: 10,
                }, {
                    text: 'want to see',
                    score: 7,
                }, {
                    text: 'maybe',
                    score: 3,
                }, {
                    text: 'not interested',
                    score: 0,
                }, {
                    text: 'not voted',
                    skip: true,
                    score: -1,
                }];

                for (var i = 0; i < simplified.length; i++) {
                    var data = simplified[i];
                    var d = $('
');

                    d.data('score', data.score);
                    d.text(data.text)

                    console.log(item.closest('li').find('h3 a').text(), itemdata('value'), data.score, itemdata('value') == data.score)

                    // if (itemdata('value') == data.score) {
                    if (parseInt(itemdata('value'), 10) == data.score) {
                        d.addClass('selected');
                    }

                    if (data.skip) {
                        d.addClass('skip');
                    }

                    $simplified.append(d);
                }

                //if we are in RTL mode, we have to change the float of the "reset button"
                if (!ltr) {
                    item.find('.rateit-reset').css('float', 'right');
                    item.find('.rateit-selected').addClass('rateit-selected-rtl');
                    item.find('.rateit-hover').addClass('rateit-hover-rtl');
                }
                itemdata('init', true);
            }

            //set the range element to fit all the stars.
            var range = item.find('.rateit-range');
            range.width(itemdata('starwidth') * (itemdata('max') - itemdata('min'))).height(itemdata('starheight'));

            //set the value if we have it.
            if (itemdata('value')) {
                var score = (itemdata('value') - itemdata('min')) * itemdata('starwidth');
                item.find('.rateit-selected').width(score);
            }

            var resetbtn = item.find('.rateit-reset');

            var calcRawScore = function (element, event) {
                var pageX = (event.changedTouches) ? event.changedTouches[0].pageX : event.pageX;

                var offsetx = pageX - $(element).offset().left;
                if (!ltr) offsetx = range.width() - offsetx;
                if (offsetx > range.width()) offsetx = range.width();
                if (offsetx < 0) offsetx = 0;

                return score = Math.ceil(offsetx / itemdata('starwidth') * (1 / itemdata('step')));
            };

            if (!itemdata('readonly')) {
                //if we are not read only, add all the events

                //if we have a reset button, set the event handler.
                if (itemdata('resetable')) {
                    resetbtn.click(function () {
                        itemdata('value', itemdata('min'));
                        range.find('.rateit-hover').hide().width(0);
                        range.find('.rateit-selected').width(0).show();
                        if (itemdata('backingfld')) $(itemdata('backingfld')).val(itemdata('min'));
                        item.trigger('reset');
                    });

                }
                else {
                    resetbtn.hide();
                }

                //when the mouse goes over the range div, we set the "hover" stars.
                if (!itemdata('wired')) {
                    item.on('click', '.rateit-simplified div:not(.selected,.skip)', function(e) {
                        item.find('.rateit-simplified div').removeClass('selected');
                        var $$ = $(e.currentTarget);
                        $$.addClass('selected');

                        var score = $$.data('score') * 2;

                        if (score < 0) {
                            return;
                        }

                        var newvalue = (score * itemdata('step')) + itemdata('min');
                        itemdata('value', newvalue);

                        range.find('.rateit-selected').width(score * itemdata('starwidth') * itemdata('step')).show();
                        item.trigger('hover', [null]).trigger('rated', [newvalue]);
                    });

                    range.bind('touchmove touchend', touchHandler); //bind touch events
                    range.mousemove(function (e) {
                        var score = calcRawScore(this, e);
                        var w = score * itemdata('starwidth') * itemdata('step');
                        var h = range.find('.rateit-hover');
                        if (h.data('width') != w) {
                            range.find('.rateit-selected').hide();
                            h.width(w).show().data('width', w);
                            item.trigger('hover', [(score * itemdata('step')) + itemdata('min')]);
                        }
                    });
                    //when the mouse leaves the range, we have to hide the hover stars, and show the current value.
                    range.mouseleave(function (e) {
                        range.find('.rateit-hover').hide().width(0).data('width', '');
                        item.trigger('hover', [null]);
                        range.find('.rateit-selected').show();
                    });
                    //when we click on the range, we have to set the value, hide the hover.
                    range.mouseup(function (e) {
                        var score = calcRawScore(this, e);

                        var newvalue = (score * itemdata('step')) + itemdata('min');
                        itemdata('value', newvalue);
                        if (itemdata('backingfld')) {
                            $(itemdata('backingfld')).val(newvalue);
                        }
                        range.find('.rateit-hover').hide();
                        range.find('.rateit-selected').width(score * itemdata('starwidth') * itemdata('step')).show();

                        item.trigger('hover', [null]).trigger('rated', [newvalue]);
                    });

                    itemdata('wired', true);
                }
                if (itemdata('resetable')) {
                    resetbtn.show();
                }
            }
            else {
                resetbtn.hide();
            }
        });
    };

    //touch converter http://ross.posterous.com/2008/08/19/iphone-touch-events-in-javascript/
    function touchHandler(event) {

        var touches = event.originalEvent.changedTouches,
                first = touches[0],
                type = "";
        switch (event.type) {
            case "touchmove": type = "mousemove"; break;
            case "touchend": type = "mouseup"; break;
            default: return;
        }

        var simulatedEvent = document.createEvent("MouseEvent");
        simulatedEvent.initMouseEvent(type, true, true, window, 1,
                              first.screenX, first.screenY,
                              first.clientX, first.clientY, false,
                              false, false, false, 0/*left*/, null);

        first.target.dispatchEvent(simulatedEvent);
        event.preventDefault();
    };

    //some default values.
    $.fn.rateit.defaults = { min: 0, max: 5, step: 0.5, starwidth: 16, starheight: 16, readonly: false, resetable: true };

    //invoke it on all div.rateit elements. This could be removed if not wanted.
    $('div.rateit').rateit();

})(jQuery);


text:
@implementation GoGameRulesTest

// -----------------------------------------------------------------------------
/// @brief Checks the initial state of GoGameRules object after a new GoGame
/// has been created.
// -----------------------------------------------------------------------------
- (void) testInitialState
{
  XCTAssertNotNil(m_game.rules);
  XCTAssertEqual(m_game.rules.koRule, GoKoRuleSimple);
  XCTAssertEqual(m_game.rules.scoringSystem, GoScoringSystemAreaScoring);
  XCTAssertEqual(m_game.rules.lifeAndDeathSettlingRule, GoLifeAndDeathSettlingRuleTwoPasses);
  XCTAssertEqual(m_game.rules.disputeResolutionRule, GoDisputeResolutionRuleAlternatingPlay);
  XCTAssertEqual(m_game.rules.fourPassesRule, GoFourPassesRuleFourPassesHaveNoSpecialMeaning);
}

// -----------------------------------------------------------------------------
/// @brief Checks that the GoGameRules object takes its rules from the settings
/// in NewGameModel.
// -----------------------------------------------------------------------------
- (void) testNonDefaultRules
{
  NewGameModel* newGameModel = [ApplicationDelegate sharedDelegate].theNewGameModel;
  newGameModel.koRule = GoKoRuleSuperkoPositional;
  newGameModel.scoringSystem = GoScoringSystemTerritoryScoring;
  newGameModel.lifeAndDeathSettlingRule = GoLifeAndDeathSettlingRuleThreePasses;
  newGameModel.disputeResolutionRule = GoDisputeResolutionRuleNonAlternatingPlay;
  newGameModel.fourPassesRule = GoFourPassesRuleFourPassesEndTheGame;
  [[[[NewGameCommand alloc] init] autorelease] submit];
  m_game = m_delegate.game;
  XCTAssertEqual(m_game.rules.koRule, GoKoRuleSuperkoPositional);
  XCTAssertEqual(m_game.rules.scoringSystem, GoScoringSystemTerritoryScoring);
  XCTAssertEqual(m_game.rules.lifeAndDeathSettlingRule, GoLifeAndDeathSettlingRuleThreePasses);
  XCTAssertEqual(m_game.rules.disputeResolutionRule, GoDisputeResolutionRuleNonAlternatingPlay);
  XCTAssertEqual(m_game.rules.fourPassesRule, GoFourPassesRuleFourPassesEndTheGame);
}

@end