text:
"""
Created on Mon Mar  9 10:06:20 2015

@author: jpk

ToDo:

*automate the subsystems check. A query that checks all the subsystems in
case things change in the future should prevent issues with the pie chart
colours.

* Need to add global variables for the password.
* Need to property parse commandline options

"""
global __version__
__version__ = "1.0"
__date__ = "20 March 2015"
__author__ = "Paul Kotze"
__doc__="\nSALT Observing Summary Plots Generator, version "+__version__ +'''

This script uses queries generated by the report_queries.py script and plots
the relevant data in .png format

Usage: python weekly_summary_plots.py [OPTIONS]

OPTIONS are as follows, arguments are compulsory for both long and short forms.
Example formats are shown:

    -h   --help                  Prints this help
    -s   --startdate=20141220    Sets the start date for the query
    -e   --enddate=20150214      Sets the end date for the qeury
    -d   --date=20150215         Sets the date for the query, if this option
                                 is used a start date is not required, but an
                                 interval is required
    -i   --interval=7            Set the interval, in days, to go back in
                                 history for the query
'''
__usage__='''Usage: python weekly_summary_plots.py [OPTIONS]

OPTIONS are as follows, arguments are compulsory for both long and short forms.
Example formats are shown:

    -h   --help                  Prints this help

Specifying a date range:
    -s   --startdate=20141220    Sets the start date for the query
    -e   --enddate=20150214      Sets the end date for the qeury

Specifying a date and a range in days to query in the past:
    -d   --date=20150215         Sets the date for the query, if this option
                                 is used a start date is not required, but an
                                 interval is required
    -i   --interval=7            Set the interval, in days, to go back in
                                 history for the query
'''

import sys
import os
import getopt
import pandas as pd
import pandas.io.sql as psql
import MySQLdb
import matplotlib.pyplot as pl
import report_queries as rq
import numpy as np
import matplotlib.dates as mdates
from datetime import datetime

def usage():
    print __usage__
    raise SystemExit(2)

def validate_date(date_text):
    '''
    this function validate the dates provided
    '''

    try:
        date = datetime.strptime(date_text, '%Y%m%d')
    except ValueError:
        raise ValueError("Incorrect data format, date should be YYYYMMDD")

    return date

def validate_int(number):

    try:
        num = int(number)
    except ValueError:
        raise ValueError('The interval should be an integer')

    return num

def parse_commandline(argv):
    # executes if module is run from the command line

    # check whether a commandline has been specified
    if len(argv)==0:
        usage()
        sys.exit(2)
    else:
        pass

    # read command line options
    try:
        opts,args = getopt.getopt(argv,"hs:e:d:i:",
                ["help","startdate=","enddate=", "date=","interval="])
    except getopt.GetoptError, inst:
        print inst
        print 'Use --help to get a list of options'
        sys.exit(2)

    # initiate the val_flags
    s_val = False
    e_val = False
    d_val = False
    i_val = False

    # parse them to the relevant variables
    for opt, arg in opts:
        if opt in ('--help'):
            usage()
        elif opt in ('-s','--startdate'):
            s_date = validate_date(arg)
            s_val = True
        elif opt in ('-e','--enddate'):
            e_date = validate_date(arg)
            e_val = True
        elif opt in ('-d','--date'):
            d_date = validate_date(arg)
            d_val = True
        elif opt in ('-i','--interval'):
            inter = validate_int(arg)
            i_val = True
        else:
            print 'Unknown option: ' + opt
            usage()

    # check all the flags and inform the user if there are missing values
    if s_val + e_val == 2:

        # check that the end date is after the start date
        date_diff = (e_date - s_date).days

        if date_diff < 0:
            raise ValueError('The start date cannot be later than the end date')
        else:
            date = datetime.strftime(e_date, '%Y-%m-%d')
            interval = date_diff

    # check that a start AND an end date is specified
    elif s_val + e_val == 1:
        if s_val:
            raise ValueError('You have to specify an end date')
        elif e_val:
            raise ValueError('You have to specify a start date')
        else:
            pass
    else:
        pass

    if d_val + i_val == 2:
        date = datetime.strftime(d_date, '%Y-%m-%d')
        interval = inter
    # check that a date AND an interval is specified
    elif d_val + i_val == 1:
        if d_val:
            raise ValueError('You have to specify an interval with a date')
        elif i_val:
            raise ValueError('You have to specify a date with an interval')
    else:
        pass

    return date, interval

def priority_breakdown_pie_chart(x, ds, dirname='./logs/'):
    '''
    make a pie chart from the dataframe
    '''
    temp = list(x['Priority'])
    no_blocks = map(int, list(x['No. Blocks']))
    labels = ['P'+str(temp[i])+' - ' + str(no_blocks[i]) for i in range(0,len(temp))]
    values = list(x['Tsec'])

    # set colours for the priorities
    colours = ['b','c','g','m','r']

    fig = pl.figure(facecolor='w', figsize=[6, 6])
    ax = fig.add_subplot(111)
    ax.set_aspect=1

    pie_wedge_collection = ax.pie(values,
                                  colors=colours,
                                  pctdistance=0.8,
                                  radius = 0.95,
                                  autopct='%1.1f%%',
                                  textprops = {'fontsize':10,
                                               'color':'w'},
                                  wedgeprops = {'edgecolor':'white'})

    ax.legend(labels=labels, frameon=False, loc=(-0.15,0.7), fontsize=8)
    title_txt = 'Weekly Priority Breakdown - ' + str(int(x['No. Blocks'].sum())) + ' Blocks Total' + '\n {}'.format(ds)

    ax.set_title(title_txt, fontsize=12)

    filename = dirname+'priority_breakdown_pie_chart_' +'-'.join([ds.split()[0].replace('-',''), ds.split()[2].replace('-','')])+'.png'
    pl.savefig(filename, dpi=100)
#    pl.show()

def weekly_total_time_breakdown_pie_chart(x, ds, dirname='./logs/'):

    labels = ['Science - {}'.format(x['ScienceTime'][0]),
              'Engineering - {}'.format(x['EngineeringTime'][0]),
              'Weather - {}'.format(x['TimeLostToWeather'][0]),
              'Problems - {}'.format(x['TimeLostToProblems'][0])]

    values = [int(x['Science']),
              int(x['Engineering']),
              int(x['Weather']),
              int(x['Problems'])]

    colours = ['b','c','g','r']

    fig = pl.figure(facecolor='w', figsize=[6, 6])
    ax = fig.add_subplot(111)
    ax.set_aspect=1

    pie_wedge_collection = ax.pie(values,
                                  colors=colours,
                                  pctdistance=0.8,
                                  radius = 0.95,
                                  autopct='%1.1f%%',
                                  textprops = {'fontsize':10,
                                               'color':'w'},
                                  wedgeprops = {'edgecolor':'white'})

    ax.legend(labels=labels, frameon=False, loc=(-0.15,0.8), fontsize=8)

    title_txt = 'Weekly Time Breakdown - {} Total\n{}'.format(x['NightLength'][0], ds)
    ax.set_title(title_txt, fontsize=12)

    filename = 'total_time_breakdown_pie_chart_' + '-'.join([ds.split()[0].replace('-',''), ds.split()[2].replace('-','')])+'.png'
    pl.savefig(dirname+filename, dpi=100)
#    pl.show()

def weekly_subsystem_breakdown_pie_chart(x, y, col_dict, ds, dirname='./logs/'):

    subsystem = list(x['SaltSubsystem'])
    time = list(x['TotalTime'])

    labels = [subsystem[i] + ' - ' + time[i] for i in range(0,len(subsystem))]
    values = list(x['Time'])

    colours = [col_dict[i] for i in subsystem]

    fig = pl.figure(facecolor='w', figsize=[6, 6])
    ax = fig.add_subplot(111)
    ax.set_aspect=0.8

    pie_wedge_collection = ax.pie(values,
                                  colors=colours,
                                  pctdistance=0.8,
                                  radius = 0.9,
                                  autopct='%1.1f%%',
                                  textprops = {'fontsize':10,
                                               'color':'k'},
                                  wedgeprops = {'edgecolor':'white'})

    ax.legend(labels=labels, frameon=False, loc=(-0.15,0.5), fontsize=8)

    title_txt = 'Weekly Problems Breakdown - {}\n{}'.format(y['TotalTime'][0], ds)
    ax.set_title(title_txt, fontsize=12)

    filename = 'subsystem_breakdown_pie_chart_'+'-'.join([ds.split()[0].replace('-',''), ds.split()[2].replace('-','')])+'.png'
    pl.savefig(dirname+filename, dpi=100)
#    pl.show()

def weekly_time_breakdown(x, ds, dirname='./logs/'):
    '''
    produce a bar stacked bar chart plot of the time breakdown per day for the
    past week.
    '''

    fig = pl.figure(figsize=(10,4),facecolor='w')
    ax = fig.add_subplot(111)
    width = 0.65
    ax.grid(which='major', axis='y')
    # science time per day
    s = ax.bar(x['Date'],
                x['Science'],
                width,
                color = 'b',
                edgecolor='w')

    # engineering time per day
    e = ax.bar(x['Date'],
               x['Engineering'],
                width,
                bottom = x['Science'],
                color = 'c',
                edgecolor='w')

    # weather time per day
    w = ax.bar(x['Date'],
               x['Weather'],
                width,
                bottom = x['Science'] + x['Engineering'],
                color = 'g',
                edgecolor='w')

    # problem time per day
    p = ax.bar(x['Date'],
               x['Problems'],
                width,
                bottom = x['Science'] + x['Engineering'] + x['Weather'],
                color = 'r',
                edgecolor='w')

    ax.set_ylabel('Hours', fontsize=11)
    ax.set_xlabel('Date', fontsize=11)
    fig.legend((s[0], e[0], w[0], p[0]),
                   ('Science Time',
                    'Engineering Time',
                    'Time lost to Weather',
                    'Time lost to Problems'),
                    frameon=False,
                    fontsize=10,
                    loc=(0.0,0.70))

    title_txt = 'Weekly Time Breakdown - {}'.format(ds)

    ax.set_title(title_txt, fontsize=11)
    ax.xaxis_date()
    date_formatter = mdates.DateFormatter('%a \n %Y-%m-%d')
    ax.xaxis.set_major_formatter(date_formatter)

    for tick in ax.xaxis.get_major_ticks():
                tick.label.set_fontsize(8)
    for tick in ax.yaxis.get_major_ticks():
                tick.label.set_fontsize(8)

    fig.autofmt_xdate(rotation=0, ha = 'left')
    fig.subplots_adjust(left=0.22, bottom=0.20, right=0.96, top=None,
                      wspace=None, hspace=None)
    pl.autoscale()
    filename = 'time_breakdown_'+'-'.join([ds.split()[0].replace('-',''), ds.split()[2].replace('-','')])+'.png'
    pl.savefig(dirname+filename, dpi=100)
#    pl.show()

if __name__=='__main__':

    # set the colours for all the subsystems:
    subsystems_list = ['BMS', 'DOME', 'TC', 'PMAS', 'SCAM', 'TCS', 'STRUCT',
                       'TPC', 'HRS', 'PFIS','Proposal', 'Operations',
                       'ELS', 'ESKOM']
    cmap = pl.cm.jet
    colour_map = cmap(np.linspace(0.0, 1.0, len(subsystems_list)))
    col_dict = {}

    for i in range(0, len(subsystems_list)):
        col_dict[subsystems_list[i]] = colour_map[i]

    # open mysql connection to the sdb
    mysql_con = MySQLdb.connect(host='sdb.cape.saao.ac.za',
                port=3306,user=os.environ['SDBUSER'],
                passwd=os.environ['SDBPASS'], db='sdb')

#    obsdate = sys.argv[1]
#    date = '{}-{}-{}'.format(obsdate[0:4], obsdate[4:6], obsdate[6:8])
#    interval = sys.argv[2]

    date, interval = parse_commandline(sys.argv[1:])

    # use the connection to get the required data: _d
    dr_d = rq.date_range(mysql_con, date, interval=interval)
    wpb_d = rq.weekly_priority_breakdown(mysql_con, date, interval=interval)
    wtb_d = rq.weekly_time_breakdown(mysql_con, date, interval=interval)
    wttb_d = rq.weekly_total_time_breakdown(mysql_con, date, interval=interval)
    wsb_d = rq.weekly_subsystem_breakdown(mysql_con, date, interval=interval)
    wsbt_d = rq.weekly_subsystem_breakdown_total(mysql_con, date, interval=interval)
    wtb_d = rq.weekly_time_breakdown(mysql_con, date, interval=interval)

    date_string = '{} - {}'.format(dr_d['StartDate'][0], dr_d['EndDate'][0])

    # testing the pie_chart method
    priority_breakdown_pie_chart(wpb_d, date_string,'')
    weekly_total_time_breakdown_pie_chart(wttb_d, date_string,'')
    weekly_subsystem_breakdown_pie_chart(wsb_d, wsbt_d, col_dict, date_string,'')
    weekly_time_breakdown(wtb_d, date_string,'')

    mysql_con.close()


text:
from django.core.urlresolvers import reverse
from testbase.browser import BrowserTestCase
from testbase.browser import PageObject

class HomePage(PageObject):
    _urlPattern = 'home'

class FieldsPage(PageObject):
    _urlPattern = 'withUrlFields'

class TestBrowserTestCase(BrowserTestCase):
    _pageClass = FieldsPage
    _windowWidth = 500
    _windowHeight = 400

    def setUp(self):
        self.value = self.randStr()
        self._urlFields['value'] = self.value
        super().setUp()

    def test_opensBrowserToCorrectPage(self):
        expectedUrl = self.live_server_url + reverse('withUrlFields', kwargs={'value': self.value})
        self.assertEqual(expectedUrl, self.browser.current_url)

    def test_browsingToNewPageFetchesPageForPageObject(self):
        self.browseToPage(HomePage)
        expectedUrl = self.live_server_url + reverse('home')
        self.assertEqual(expectedUrl, self.browser.current_url)

    def test_browsingToPageUnderTestRetunsToTestCasePage(self):
        self.browseToPage(HomePage)
        self.browseToPageUnderTest()

        expectedUrl = self.live_server_url + reverse('withUrlFields', kwargs={'value': self.value})
        self.assertEqual(expectedUrl, self.browser.current_url)

    def test_browserDimensionsMatchThoseGivenOnTestCase(self):
        size = self.browser.get_window_size()
        self.assertEqual(self._windowWidth, size['width'])
        self.assertEqual(self._windowHeight, size['height'])

redpajama_set_name: RedPajamaGithub


text:
package libstring

import (
	"crypto/rand"
)

func RandString(n int) string {
	const letters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-"

	var randBytes = make([]byte, n)
	rand.Read(randBytes)

	for i, b := range randBytes {
		randBytes[i] = letters[b%byte(len(letters))]
	}

	return string(randBytes)
}


text:
Oskari.clazz.category('Oskari.mapframework.bundle.publishedstatehandler.PublishedStateHandlerBundleInstance', 'state-methods', {

    /**
     * @method useState
     * @param {Object} savedState
     *      JSON presentation of application state, created with #getCurrentState()
     * method.
     *
     * Sends out Oskari.mapframework.request.common.RemoveMapLayerRequest,
     * Oskari.mapframework.request.common.AddMapLayerRequest,
     * Oskari.mapframework.request.common.ChangeMapLayerOpacityRequest and
     * Oskari.mapframework.request.common.MapMoveRequest to control the
     * application state
     */
    useState: function (state) {
        if (!state) {
            // dont do anything if we dont have a saved state
            return [];
        }
        var components = this.sandbox.getStatefulComponents(),
            loopedComponents = [],
            id;
        for (id in state) {
            if (state.hasOwnProperty(id)) {
                if (components[id] && components[id].setState) {
                    // safety check that we have the component in current config
                    components[id].setState(state[id].state);
                }
                loopedComponents.push(id);
            }
        }
        return loopedComponents;
    },

    /**
     * @method resetState
     * Used to return the application to its original state.
     * Calls resetState-methods for all plugins and returns the application state
     * by
     * calling #useState with config gathered/saved on bundle start.
     *
     * All plugins should handle themselves what this means in the plugins
     * implementation.
     */
    resetState: function () {
        var me = this,
            pluginName;
        me._historyEnabled = false;
        me._historyPrevious = [];
        me._historyNext = [];
        me.sandbox.resetState();
        me._historyEnabled = true;
    }
});


text:
#import "NSObject.h"

#import "UIAInstrumentAuthorizedAPI.h"

@class DTXChannel, DVTDevice, IDELaunchSession, NSString;

@interface IDEUIATestScriptAgentCommunicator : NSObject <UIAInstrumentAuthorizedAPI>
{
    DTXChannel *_deviceChannel;
    BOOL _isAgentReady;
    BOOL _shouldRunAsInternal;
    IDELaunchSession *_appLaunchSession;
    NSString *_testManagerSessionUUID;
    DVTDevice *_targetDevice;
    NSString *_targetBundleID;
    NSString *_agentReadableStatus;
    unsigned long long _agentStatus;
}

+ (void)initialize;
- (void).cxx_destruct;
- (void)_handleDataMessage:(id)arg1;
- (void)_mainThreadAddSample:(id)arg1;
- (void)_stopAndReportExceptionOnMainThread:(id)arg1;
- (void)_stopPlayingWithException:(id)arg1 causeTrackError:(BOOL)arg2;
- (void)_stopTestingWithReason:(int)arg1;
- (void)_updateBundleStatusOnMainThread:(id)arg1;
- (void)_updateScriptStatusOnMainThread:(id)arg1;
- (void)agentIsGone:(id)arg1;
- (void)agentIsReady;
@property(retain) NSString *agentReadableStatus; // @synthesize agentReadableStatus=_agentReadableStatus;
@property unsigned long long agentStatus; // @synthesize agentStatus=_agentStatus;
@property(retain) IDELaunchSession *appLaunchSession; // @synthesize appLaunchSession=_appLaunchSession;
- (id)deviceChannel;
- (id)init;
- (id)initWithDevice:(id)arg1 andAppTargetBundleID:(id)arg2;
@property BOOL isAgentReady; // @synthesize isAgentReady=_isAgentReady;
- (void)notifyMonitoredPidIsDead:(id)arg1;
- (id)performTaskOnHost:(id)arg1 withArguments:(id)arg2 timeout:(id)arg3;
- (void)readyScriptAgentForAppWithPID:(id)arg1;
- (void)runTestBundleAtPath:(id)arg1 withRunDictionary:(id)arg2 andArgumentsDictionary:(id)arg3;
- (void)scriptDidThrowException:(id)arg1;
@property BOOL shouldRunAsInternal; // @synthesize shouldRunAsInternal=_shouldRunAsInternal;
@property(retain) NSString *targetBundleID; // @synthesize targetBundleID=_targetBundleID;
@property(retain) DVTDevice *targetDevice; // @synthesize targetDevice=_targetDevice;
@property(retain) NSString *testManagerSessionUUID; // @synthesize testManagerSessionUUID=_testManagerSessionUUID;
- (void)stopPlayingWithException:(id)arg1;
- (void)updateBundleStatus:(id)arg1;
- (void)updateScriptStatus:(id)arg1;

// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;

@end


text:
namespace zuki::tools::llvm::clang {

//---------------------------------------------------------------------------
// TranslationUnitSaveErrorCode Constructor (internal)
//
// Arguments:
//
//	code		- CXSaveError value to be represented by this class

TranslationUnitSaveErrorCode::TranslationUnitSaveErrorCode(CXSaveError code) : m_code(code)
{
}

//---------------------------------------------------------------------------
// TranslationUnitSaveErrorCode::operator == (static)

bool TranslationUnitSaveErrorCode::operator==(TranslationUnitSaveErrorCode lhs, TranslationUnitSaveErrorCode rhs)
{
	return lhs.m_code == rhs.m_code;
}

//---------------------------------------------------------------------------
// TranslationUnitSaveErrorCode::operator != (static)

bool TranslationUnitSaveErrorCode::operator!=(TranslationUnitSaveErrorCode lhs, TranslationUnitSaveErrorCode rhs)
{
	return lhs.m_code != rhs.m_code;
}

//---------------------------------------------------------------------------
// TranslationUnitSaveErrorCode::operator CXSaveError (static)

TranslationUnitSaveErrorCode::operator CXSaveError(TranslationUnitSaveErrorCode rhs)
{
	return rhs.m_code;
}

//---------------------------------------------------------------------------
// TranslationUnitSaveErrorCode::Equals
//
// Compares this TranslationUnitSaveErrorCode to another TranslationUnitSaveErrorCode
//
// Arguments:
//
//	rhs		- Right-hand TranslationUnitSaveErrorCode to compare against

bool TranslationUnitSaveErrorCode::Equals(TranslationUnitSaveErrorCode rhs)
{
	return (*this == rhs);
}

//---------------------------------------------------------------------------
// TranslationUnitSaveErrorCode::Equals
//
// Overrides Object::Equals()
//
// Arguments:
//
//	rhs		- Right-hand object instance to compare against

bool TranslationUnitSaveErrorCode::Equals(Object^ rhs)
{
	if(Object::ReferenceEquals(rhs, nullptr)) return false;

	// Convert the provided object into a TranslationUnitSaveErrorCode instance
	TranslationUnitSaveErrorCode^ rhsref = dynamic_cast<TranslationUnitSaveErrorCode^>(rhs);
	if(rhsref == nullptr) return false;

	return (*this == *rhsref);
}

//---------------------------------------------------------------------------
// TranslationUnitSaveErrorCode::GetHashCode
//
// Overrides Object::GetHashCode()
//
// Arguments:
//
//	NONE

int TranslationUnitSaveErrorCode::GetHashCode(void)
{
	return static_cast<int>(m_code).GetHashCode();
}

//---------------------------------------------------------------------------
// TranslationUnitSaveErrorCode::ToString
//
// Overrides Object::ToString()
//
// Arguments:
//
//	NONE

String^ TranslationUnitSaveErrorCode::ToString(void)
{
	// There are only a few generic error codes to deal with, use static text based
	// on the documentation in the libclang header file, can always be adjusted later
	switch(m_code) {

		case CXSaveError::CXSaveError_None:
			return gcnew String("No error");

		case CXSaveError::CXSaveError_Unknown:
			return gcnew String("An unknown error occurred while attempting to save the file");

		case CXSaveError::CXSaveError_TranslationErrors:
			return gcnew String("Errors during translation prevented this attempt to save the translation unit");

		case CXSaveError::CXSaveError_InvalidTU:
			return gcnew String("The translation unit is invalid");
	}

	return gcnew String("Unknown translation unit save error");
}

//---------------------------------------------------------------------------

} // zuki::tools::llvm::clang

#pragma warning(pop)


text:
import html
import pickle
from abc import ABC
from abc import abstractmethod
from functools import partial
from itertools import chain
from typing import TYPE_CHECKING
from typing import Dict
from typing import List
from typing import Tuple
from typing import Type
from urllib.parse import quote

from django.conf import settings
from django.shortcuts import resolve_url
from django.template.defaultfilters import truncatechars
from django.utils.safestring import mark_safe
from django.utils.translation import gettext
from redis import StrictRedis

from redisboard.structs import KeyInfo
from redisboard.structs import ScanResult
from redisboard.structs import ascii_if_not_none
from redisboard.structs import dash_if_none

if TYPE_CHECKING:
    from redisboard.models import RedisServer

REDISBOARD_SCAN_COUNT: int = getattr(settings, 'REDISBOARD_SCAN_COUNT', 1000)
REDISBOARD_STRING_PAGINATION: int = getattr(settings, 'REDISBOARD_STRING_PAGINATION', 10000)

def bytes_to_human(n):
    try:
        n = int(n)
    except ValueError:
        return n

    if n < 1024:
        return f'{n}B'
    elif n < 1048576:
        return f'{n/1024:.2f}K'
    elif n < 1073741824:
        return f'{n/1048576:.2f}M'
    elif n < 1099511627776:
        return f'{n/1073741824:.2f}G'

class BaseDecoder(ABC):
    def __init__(self, server):
        pass

    def key(self, key: bytes):
        return key.decode()

    def bytes(self, key: str, value: bytes):
        return value

    def string(self, key: str, value: bytes, **kwargs):
        return [(len(value), self.bytes(key, value))]

    def hash(self, key: str, hash_value: Dict[bytes, bytes], **kwargs):
        return sorted((self.hash_field(key, k), self.bytes(key, v)) for k, v in hash_value.items())

    def hash_field(self, key: str, field: bytes):
        return self.key(field)

    def list(self, key: str, value: List[bytes], count=int, **kwargs):
        return list(enumerate((self.bytes(key, v) for v in value), start=count))

    def set(self, key: str, value: List[bytes], count: int, **kwargs):
        return list(enumerate(sorted(self.bytes(key, v) for v in value), start=count))

    def zset(self, key: str, value: bytes, **kwargs):
        return sorted((s, self.bytes(key, v)) for v, s in value)

    def unsupported(self, key: str, value, type_: str, **kwargs):
        return [('ERROR', f'Missing decoder; {value}')]

    def __getattr__(self, type_: str):
        return partial(self.unsupported, type_=type_)

class UTF8BackslashReplaceDecoder(BaseDecoder):
    def bytes(self, key: str, value: bytes):
        return value.decode(errors='backslashreplace')

    def key(self, key: bytes):
        return key.decode(errors='backslashreplace')

class PickleDecoder(BaseDecoder):
    def bytes(self, key: str, value: bytes):
        return pickle.loads(value)

class ValueQuery:
    connection: StrictRedis

    def __init__(self, connection: StrictRedis):
        self.connection = connection

    def hash(self, key, *, cursor=0, **kwargs) -> Tuple[int, list]:
        return self.connection.hscan(key, cursor=cursor, count=REDISBOARD_SCAN_COUNT)

    def list(self, key, *, cursor=0, **kwargs) -> Tuple[int, list]:
        end = cursor + REDISBOARD_SCAN_COUNT
        value = self.connection.lrange(key, cursor, end - 1)
        if len(value) < end:
            return 0, value
        else:
            return end, value

    def set(self, key, *, cursor=0, **kwargs) -> Tuple[int, list]:
        return self.connection.sscan(key, cursor=cursor, count=REDISBOARD_SCAN_COUNT)

    def string(self, key, *, cursor=0, count=0, **kwargs) -> Tuple[int, list]:
        start = cursor
        end = count + REDISBOARD_STRING_PAGINATION
        value = self.connection.getrange(key, start, end - 1)
        if value:
            return end, value
        else:
            return 0, value

    def zset(self, key, *, cursor=0, **kwargs) -> Tuple[int, list]:
        return self.connection.zscan(key, cursor=cursor, count=REDISBOARD_SCAN_COUNT)

    def unsupported(self, key, *, cursor=0, type_, **kwargs):
        return cursor, f'Unsupported type {type_!r} for key: {key}'

    def __getattr__(self, type_):
        return partial(self.unsupported, type_=type_)

class LengthQuery:
    connection: StrictRedis

    def __init__(self, connection):
        self.connection = connection

    def string(self, key):
        return self.connection.strlen(key)

    def hash(self, key):
        return self.connection.hlen(key)

    def list(self, key):
        return self.connection.llen(key)

    def set(self, key):
        return self.connection.scard(key)

    def zset(self, key):
        return self.connection.zcount(key, '-inf', '+inf')

    def unsupported(self, key):
        return self.connection.echo('-1')

    def __getattr__(self, type_):
        return self.unsupported

class BaseDisplay(ABC):
    decoder: BaseDecoder
    value_query_class: Type[ValueQuery]
    length_query_class: Type[LengthQuery]
    server: 'RedisServer'

    def __init__(
        self,
        decoder_class: Type[BaseDecoder],
        value_query_class: Type[ValueQuery],
        length_query_class: Type[LengthQuery],
        server: 'RedisServer',
    ):
        self.decoder = decoder_class(server)
        self.value_query_class = value_query_class
        self.length_query_class = length_query_class
        self.server = server

    @abstractmethod
    def slowlog(self):
        pass

    @abstractmethod
    def details(self):
        pass

    @abstractmethod
    def cpu(self):
        pass

    def keys(self, db, keys):
        conn = self.server.connection
        conn.select(db)

        if self.server.has_frequency:
            usage_field, usage_command = 'frequency', 'FREQ'
        else:
            usage_field, usage_command = 'idletime', 'IDLETIME'

        pipe = conn.pipeline(transaction=False)
        pipe.select(db)
        pipe.execute()

        with pipe:
            for key in keys:
                pipe.type(key)
                pipe.object('ENCODING', key)
            result = iter(map(ascii_if_not_none, pipe.execute()))
            values = list(zip(keys, result, result))

        with pipe:
            query = self.length_query_class(pipe)
            for key, type_, *_ in values:
                pipe.ttl(key)
                pipe.object(usage_command, key)
                getattr(query, type_)(key)
            result = iter(pipe.execute())

        fields = ['name', 'type', 'encoding', 'ttl', usage_field, 'length']
        values = list(map(list, map(chain.from_iterable, zip(values, zip(result, result, result)))))

        return [KeyInfo(**dict(zip(fields, v))) for v in values]

    def scan(self, db, cursor=0, match=None, type=None) -> ScanResult:
        conn = self.server.connection
        conn.select(db)

        total = conn.dbsize()
        cursor, keys = conn.scan(cursor=cursor, count=REDISBOARD_SCAN_COUNT, match=match, _type=type)
        return ScanResult(cursor, len(keys), total, self.keys(db, keys))

    def value(self, db, key, **kwargs):
        conn = self.server.connection
        conn.select(db)
        if conn.exists(key):
            type_ = conn.type(key).decode()
            total = getattr(self.length_query_class(conn), type_)(key)
            cursor, value = getattr(self.value_query_class(conn), type_)(key, **kwargs)
            decoded_value = getattr(self.decoder, type_)(key, value, **kwargs)
            return ScanResult(cursor, len(value), total, decoded_value)
        else:
            return ScanResult(0, 0, 0, [(gettext('ERROR'), gettext('key not found'))])

class TabularDisplay(BaseDisplay):
    def slowlog(self):
        commands = []
        slowlog = self.server.stats.slowlog
        for log in slowlog:
            command = log['command']
            if isinstance(command, bytes):
                command = command.decode(errors='backslashreplace')

            if len(command) > 255:
                command = f'{command:252}...'

            commands.append((log['duration'], command))
        commands.sort(reverse=True)
        if commands:
            output = ''.join(f'
{duration / 1000.0:.1f}ms	{command}
' for duration, command in commands)
            return mark_safe(f'

Total: {len(slowlog)} items
{output}
')
        else:
            return 'n/a'

    def details(self):
        stats = self.server.stats
        info = stats.info
        output = [f'
{k.replace("_", " ")}	{v}
' for k, v in stats.details.items()]
        details = {
            'keys': {
                'expired': info.get('expired_keys', '?'),
                'evicted': info.get('evicted_keys', '?'),
                'hits': info.get('keyspace_hits', '?'),
                'misses': info.get('keyspace_misses', '?'),
            },
            'memory': {
                'lua': info.get('used_memory_lua_human', '?'),
                'vm': info.get('used_memory_vm_total_human', '?'),
                'scripts': info.get('used_memory_scripts_human', '?'),
                'used': info.get('used_memory_human', '?'),
                'peak': info.get('used_memory_peak_human', '?'),
                'max': info.get('maxmemory_human', '?'),
                'rss': info.get('used_memory_rss_human', '?'),
                'system': info.get('total_system_memory_human', '?'),
            },
            'commands': {
                'per
second': info.get('instantaneous_ops_per_sec', '?'),
                'errors': info.get('total_error_replies', '?'),
                'denied
cmd/key/chan': (
                    f'{info.get("acl_access_denied_cmd", "?")}/'
                    f'{info.get("acl_access_denied_key", "?")}/'
                    f'{info.get("acl_access_denied_channel", "?")}'
                ),
                'total': info.get('total_commands_processed', '?'),
            },
            'input': {
                'current': bytes_to_human(info.get('instantaneous_input_kbps', '?')),
                'total': bytes_to_human(info.get('total_net_input_bytes', '?')),
                'repl': bytes_to_human(info.get('instantaneous_input_repl_kbps', '?')),
                'repl total': bytes_to_human(info.get('total_net_repl_input_bytes', '?')),
            },
            'output': {
                'current': bytes_to_human(info.get('instantaneous_output_kbps', '?')),
                'total': bytes_to_human(info.get('total_net_output_bytes', '?')),
                'repl': bytes_to_human(info.get('total_net_repl_output_bytes', '?')),
                'repl total': bytes_to_human(info.get('instantaneous_output_repl_kbps', '?')),
            },
            'clients': {
                'current': info.get('connected_clients', '?'),
                'rejected': info.get('rejected_connections', '?'),
                'evicted': info.get('rejected_connections', '?'),
                'timeout': info.get('clients_in_timeout_table', '?'),
                'blocked': info.get('blocked_clients', '?'),
                'tracked': info.get('tracking_clients', '?'),
                'max': info.get('maxclients', '?'),
                'total': info.get('total_connections_received', '?'),
            },
        }
        for db, db_details in stats.databases.items():
            details[f'db{db}'] = db_details

        for db, details in details.items():
            keys = details.keys()
            output.append(f'

{db}	')
            output.extend(f'{k}	' for k in keys)
            output.append('

	')
            output.extend(f'{details[k]}	' for k in keys)
            output.append('

')
        if output:
            return mark_safe(f'
{"".join(output)}
')
        return 'n/a'

    def cpu(self):
        stats = self.server.stats
        if stats.status != 'UP':
            return 'n/a'

        data = (
            'used_cpu_sys',
            'used_cpu_sys_children',
            'used_cpu_user',
            'used_cpu_user_children',
        )
        data = dict((k[9:], stats.info[k]) for k in data)
        total_cpu = sum(data.values())
        uptime = stats.info['uptime_in_seconds']
        data['utilization'] = f'{total_cpu / uptime if uptime else 0:.3f}%'

        data = sorted(data.items())

        output = []
        for k, v in data:
            k = k.replace('_', ' ')
            output.append(f'
{k}	{v}
')

        if output:
            return mark_safe(f'
{"".join(output)}
')
        return 'n/a'

    def keys(self, db, *args):
        keys = super().keys(db, *args)
        has_frequency = self.server.has_frequency
        output = [
            '

',
            gettext('Keys'),
            f' ({len(keys)})	',
            gettext('Details'),
            '

',
            gettext('Type'),
            '	',
            gettext('TTL'),
            '	',
            gettext('Encoding'),
            '	',
            gettext('Length'),
            '	',
            gettext('Frequency') if self.server.has_frequency else gettext('Idletime'),
            '

',
        ]

        output.extend(
            f'
'
            f'{html.escape(truncatechars(self.decoder.key(key.name), 200))}	'
            f'{key.type}	'
            f'{dash_if_none(key.ttl)}	'
            f'{dash_if_none(key.encoding)}	'
            f'{dash_if_none(key.length)}	'
            f'{key.frequency if has_frequency else key.idletime}	'
            '
'
            for key in keys
        )
        output.append('
')
        return mark_safe(''.join(output))

    def value(self, db, key, **kwargs):
        cursor, count, total, data = super().value(db, key, **kwargs)
        return ScanResult(
            cursor,
            count,
            total,
            mark_safe(
                ''.join(
                    chain(
                        ('
',),
                        (f'
{html.escape(str(k))}	{html.escape(str(v))}' for k, v in data),
                        ('
',),
                    )
                )
            ),
        )


text:
define("p3/widget/PublicationGrid", [
	"dojo/_base/declare", "dijit/layout/BorderContainer", "dojo/on",
	"dojo/dom-class", "dijit/layout/ContentPane", "dojo/dom-construct",
	"./PageGrid", "./formatter"
], function(declare, BorderContainer, on,
			domClass, ContentPane, domConstruct,
			Grid, formatter){
	return declare([Grid], {
		region: "center",
		query: (this.query || ""),
		apiToken: window.App.authorizationToken,
		apiServer: window.App.dataAPI,
		dataModel: "publications",
		primaryKey: "id",
		deselectOnRefresh: true,
		columns: {
			publication: {label: "Publication", field: "publication", hidden: false}
		},
		startup: function(){
			var _self = this;
			this.on(".dgrid-content .dgrid-row:dblclick", function(evt){
				var row = _self.row(evt);
				console.log("dblclick row:", row);
				on.emit(_self.domNode, "ItemDblClick", {
					item_path: row.data.path,
					item: row.data,
					bubbles: true,
					cancelable: true
				});
				console.log('after emit');
				//if (row.data.type == "folder"){
				//	Topic.publish("/select", []);

				//	Topic.publish("/navigate", {href:"/workspace" + row.data.path })
				//	_selection={};
				//}
			});
			//_selection={};
			//Topic.publish("/select", []);

			this.on("dgrid-select", function(evt){
				console.log('dgrid-select: ', evt);
				var newEvt = {
					rows: evt.rows,
					selected: evt.grid.selection,
					grid: _self,
					bubbles: true,
					cancelable: true
				};
				on.emit(_self.domNode, "select", newEvt);
				//console.log("dgrid-select");
				//var rows = evt.rows;
				//Object.keys(rows).forEach(function(key){ _selection[rows[key].data.id]=rows[key].data; });
				//var sel = Object.keys(_selection).map(function(s) { return _selection[s]; });
				//Topic.publish("/select", sel);
			});
			this.on("dgrid-deselect", function(evt){
				console.log("dgrid-select");
				var newEvt = {
					rows: evt.rows,
					selected: evt.grid.selection,
					grid: _self,
					bubbles: true,
					cancelable: true
				};
				on.emit(_self.domNode, "deselect", newEvt);
				return;
			});
			this.inherited(arguments);
			this.refresh();
		}
	});
});


text:
layout: page
title: Serenity Software Show
date: 2016-05-24
author: Bryan Yoder
tags: weekly links, java
status: published
summary: Vestibulum pretium massa eget urna eleifend malesuada. Vivamus accumsan malesuada.
banner: images/banner/leisure-04.jpg
booking:
  startDate: 09/23/2016
  endDate: 09/27/2016
  ctyhocn: HSVHXHX
  groupCode: SSS
published: true
---
Aenean et pulvinar nulla. Phasellus a vehicula metus. Vestibulum accumsan, odio ut sodales aliquam, dui quam tempus felis, nec convallis nulla ligula at nunc. Morbi ut venenatis libero. Quisque consequat vel nunc eu eleifend. Sed sit amet sodales justo. Nunc rhoncus eu massa a laoreet. Phasellus ultricies dictum metus ac laoreet. Maecenas at est urna.

* Quisque a tellus eget velit blandit ullamcorper et non libero
* Quisque pellentesque nunc sed leo placerat, ac volutpat lorem pharetra
* Nam sollicitudin enim dapibus purus mattis ultrices
* Fusce posuere felis nec leo iaculis vulputate
* Suspendisse vel nisi sed orci cursus sodales non quis nunc.

Proin vulputate metus mauris, sed tristique leo dictum eu. In ut ligula luctus, lobortis dolor et, imperdiet arcu. Aliquam fringilla ullamcorper consectetur. Cras risus mi, vestibulum a pretium ac, laoreet sit amet justo. Nulla non tortor ac sem pharetra euismod. Donec vulputate ipsum in mi maximus, a posuere nunc maximus. Proin elementum nulla sed lacus egestas gravida. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque nec finibus mauris, eget commodo metus. Donec tempor ut erat sed porttitor. Sed tincidunt in neque at finibus. Quisque vel nisi et est aliquam ultrices. Nam vel molestie metus. Curabitur pretium vehicula fermentum. Nulla sit amet tellus quam.


text:
package com.reding.qrcard;

import java.util.ArrayList;

import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;

/**
 * @author yangyu
 *	¹¦ÄÜÃèÊö£ºViewPagerÊÊÅäÆ÷£¬ÓÃÀ´°ó¶¨Êý¾ÝºÍview
 */
public class ViewPagerAdapter extends PagerAdapter {

	//½çÃæÁбí
    private ArrayList<View> views;

    public ViewPagerAdapter (ArrayList<View> views){
        this.views = views;
    }

	/**
	 * »ñµÃµ±Ç°½çÃæÊý
	 */
	@Override
	public int getCount() {
		 if (views != null) {
             return views.size();
         }
         return 0;
	}

	/**
	 * ³õ'»¯positionλÖõĽçÃæ
	 */
    @Override
    public Object instantiateItem(View view, int position) {

        ((ViewPager) view).addView(views.get(position), 0);

        return views.get(position);
    }

    /**
	 * ÅжÏÊÇ·ñÓɶÔÏóÉú³É½çÃæ
	 */
	@Override
	public boolean isViewFromObject(View view, Object arg1) {
		return (view == arg1);
	}

	/**
	 * Ïú»ÙpositionλÖõĽçÃæ
	 */
    @Override
    public void destroyItem(View view, int position, Object arg2) {
        ((ViewPager) view).removeView(views.get(position));
    }
}


text:
Pushpop plugin for the [Twitter API](https://dev.twitter.com).

### Installation

Add the `pushpop-twitter` gem to your Gemfile:

``` ruby
gem 'pushpop-twitter'
```

or install it directly:

``` shell
$ gem install pushpop-twitter
```

### Usage

Create a new Twitter [developer app](https://dev.twitter.com) and generate OAuth credentials for the Twitter account that you want to make API calls under. Add the app's API keys and OAuth credentials to the process environment. A sample .env file would look like this:

```
TWITTER_CONSUMER_KEY=XXXXXXXXXXXXXXXXX
TWITTER_CONSUMER_SECRET=XXXXXXXXXXX
TWITTER_OAUTH_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXX
TWITTER_OAUTH_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXX
```

Substitute your values for the X's.

### Examples

Here's a few examples of what you can do:

``` ruby
require 'pushpop'
require 'pushpop-twitter'

job do

  twitter do
    follow 'dzello'
  end

end

job do

  twitter do
    user 'dzello'
  end

end

job do

  twitter do
    favorites
  end

end

job do

  twitter do
    favorite(Twitter::Tweet.new(:id => 484793990345023489))
  end

  twitter do
    unfavorite(Twitter::Tweet.new(:id => 484793990345023489))
  end

end
```

### Contributing

Code and documentation issues and pull requests are welcome. Help us make this template as
useful as possible!


text:
.class Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;
.super Landroid/content/CursorEntityIterator;
.source "CalendarContract.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/provider/CalendarContract$EventsEntity;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "EntityIteratorImpl"
.end annotation

# static fields
.field private static final ATTENDEES_PROJECTION:[Ljava/lang/String; = null

.field private static final COLUMN_ATTENDEE_EMAIL:I = 0x1

.field private static final COLUMN_ATTENDEE_IDENTITY:I = 0x5

.field private static final COLUMN_ATTENDEE_ID_NAMESPACE:I = 0x6

.field private static final COLUMN_ATTENDEE_NAME:I = 0x0

.field private static final COLUMN_ATTENDEE_RELATIONSHIP:I = 0x2

.field private static final COLUMN_ATTENDEE_STATUS:I = 0x4

.field private static final COLUMN_ATTENDEE_TYPE:I = 0x3

.field private static final COLUMN_ID:I = 0x0

.field private static final COLUMN_METHOD:I = 0x1

.field private static final COLUMN_MINUTES:I = 0x0

.field private static final COLUMN_NAME:I = 0x1

.field private static final COLUMN_VALUE:I = 0x2

.field private static final EXTENDED_PROJECTION:[Ljava/lang/String; = null

.field private static final REMINDERS_PROJECTION:[Ljava/lang/String; = null

.field private static final WHERE_EVENT_ID:Ljava/lang/String; = "event_id=?"

# instance fields
.field private final mProvider:Landroid/content/ContentProviderClient;

.field private final mResolver:Landroid/content/ContentResolver;

# direct methods
.method static constructor <clinit>()V
    .locals 7

    .prologue
    const/4 v6, 0x3

    const/4 v5, 0x2

    const/4 v4, 0x1

    const/4 v3, 0x0

    .line 1313
    new-array v0, v5, [Ljava/lang/String;

    const-string/jumbo v1, "minutes"

    aput-object v1, v0, v3

    const-string/jumbo v1, "method"

    aput-object v1, v0, v4

    sput-object v0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->REMINDERS_PROJECTION:[Ljava/lang/String;

    .line 1320
    const/4 v0, 0x7

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

    const-string v1, "attendeeName"

    aput-object v1, v0, v3

    const-string v1, "attendeeEmail"

    aput-object v1, v0, v4

    const-string v1, "attendeeRelationship"

    aput-object v1, v0, v5

    const-string v1, "attendeeType"

    aput-object v1, v0, v6

    const/4 v1, 0x4

    const-string v2, "attendeeStatus"

    aput-object v2, v0, v1

    const/4 v1, 0x5

    const-string v2, "attendeeIdentity"

    aput-object v2, v0, v1

    const/4 v1, 0x6

    const-string v2, "attendeeIdNamespace"

    aput-object v2, v0, v1

    sput-object v0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->ATTENDEES_PROJECTION:[Ljava/lang/String;

    .line 1337
    new-array v0, v6, [Ljava/lang/String;

    const-string v1, "_id"

    aput-object v1, v0, v3

    const-string/jumbo v1, "name"

    aput-object v1, v0, v4

    const-string/jumbo v1, "value"

    aput-object v1, v0, v5

    sput-object v0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->EXTENDED_PROJECTION:[Ljava/lang/String;

    return-void
.end method

.method public constructor <init>(Landroid/database/Cursor;Landroid/content/ContentProviderClient;)V
    .locals 1
    .parameter "cursor"
    .parameter "provider"

    .prologue
    .line 1355
    invoke-direct {p0, p1}, Landroid/content/CursorEntityIterator;-><init>(Landroid/database/Cursor;)V

    .line 1356
    const/4 v0, 0x0

    iput-object v0, p0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->mResolver:Landroid/content/ContentResolver;

    .line 1357
    iput-object p2, p0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->mProvider:Landroid/content/ContentProviderClient;

    .line 1358
    return-void
.end method

.method public constructor <init>(Landroid/database/Cursor;Landroid/content/ContentResolver;)V
    .locals 1
    .parameter "cursor"
    .parameter "resolver"

    .prologue
    .line 1349
    invoke-direct {p0, p1}, Landroid/content/CursorEntityIterator;-><init>(Landroid/database/Cursor;)V

    .line 1350
    iput-object p2, p0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->mResolver:Landroid/content/ContentResolver;

    .line 1351
    const/4 v0, 0x0

    iput-object v0, p0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->mProvider:Landroid/content/ContentProviderClient;

    .line 1352
    return-void
.end method

# virtual methods
.method public getEntityAndIncrementCursor(Landroid/database/Cursor;)Landroid/content/Entity;
    .locals 16
    .parameter "cursor"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    .line 1363
    const-string v1, "_id"

    move-object/from16 v0, p1

    invoke-interface {v0, v1}, Landroid/database/Cursor;->getColumnIndexOrThrow(Ljava/lang/String;)I

    move-result v1

    move-object/from16 v0, p1

    invoke-interface {v0, v1}, Landroid/database/Cursor;->getLong(I)J

    move-result-wide v10

    .line 1364
    .local v10, eventId:J
    new-instance v8, Landroid/content/ContentValues;

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

    .line 1365
    .local v8, cv:Landroid/content/ContentValues;
    const-string v1, "_id"

    invoke-static {v10, v11}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    invoke-virtual {v8, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Long;)V

    .line 1366
    const-string v1, "calendar_id"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorIntToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1367
    const-string/jumbo v1, "title"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1368
    const-string v1, "description"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1369
    const-string v1, "eventLocation"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1370
    const-string v1, "eventStatus"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorIntToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1371
    const-string/jumbo v1, "selfAttendeeStatus"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorIntToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1372
    const-string v1, "dtstart"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorLongToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1373
    const-string v1, "dtend"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorLongToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1374
    const-string v1, "duration"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1375
    const-string v1, "eventTimezone"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1376
    const-string v1, "eventEndTimezone"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1377
    const-string v1, "allDay"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1378
    const-string v1, "accessLevel"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorIntToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1379
    const-string v1, "availability"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorIntToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1380
    const-string v1, "eventColor"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorIntToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1381
    const-string v1, "eventColor_index"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1382
    const-string v1, "hasAlarm"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1383
    const-string v1, "hasExtendedProperties"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1385
    const-string/jumbo v1, "rrule"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1386
    const-string/jumbo v1, "rdate"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1387
    const-string v1, "exrule"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1388
    const-string v1, "exdate"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1389
    const-string/jumbo v1, "original_sync_id"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1390
    const-string/jumbo v1, "original_id"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1391
    const-string/jumbo v1, "originalInstanceTime"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorLongToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1393
    const-string/jumbo v1, "originalAllDay"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorIntToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1394
    const-string v1, "lastDate"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorLongToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1395
    const-string v1, "hasAttendeeData"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorIntToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1396
    const-string v1, "guestsCanInviteOthers"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorIntToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1398
    const-string v1, "guestsCanModify"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorIntToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1399
    const-string v1, "guestsCanSeeGuests"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorIntToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1400
    const-string v1, "customAppPackage"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1401
    const-string v1, "customAppUri"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1402
    const-string/jumbo v1, "uid2445"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1403
    const-string/jumbo v1, "organizer"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1404
    const-string v1, "isOrganizer"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1405
    const-string v1, "_sync_id"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1406
    const-string v1, "dirty"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorLongToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1407
    const-string/jumbo v1, "mutators"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1408
    const-string v1, "lastSynced"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorLongToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1409
    const-string v1, "deleted"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorIntToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1410
    const-string/jumbo v1, "sync_data1"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1411
    const-string/jumbo v1, "sync_data2"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1412
    const-string/jumbo v1, "sync_data3"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1413
    const-string/jumbo v1, "sync_data4"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1414
    const-string/jumbo v1, "sync_data5"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1415
    const-string/jumbo v1, "sync_data6"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1416
    const-string/jumbo v1, "sync_data7"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1417
    const-string/jumbo v1, "sync_data8"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1418
    const-string/jumbo v1, "sync_data9"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1419
    const-string/jumbo v1, "sync_data10"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1420
    const-string v1, "cal_sync1"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1421
    const-string v1, "cal_sync2"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1422
    const-string v1, "cal_sync3"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1423
    const-string v1, "cal_sync4"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1424
    const-string v1, "cal_sync5"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1425
    const-string v1, "cal_sync6"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1426
    const-string v1, "cal_sync7"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1427
    const-string v1, "cal_sync8"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1428
    const-string v1, "cal_sync9"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1429
    const-string v1, "cal_sync10"

    move-object/from16 v0, p1

    invoke-static {v0, v8, v1}, Landroid/database/DatabaseUtils;->cursorStringToContentValuesIfPresent(Landroid/database/Cursor;Landroid/content/ContentValues;Ljava/lang/String;)V

    .line 1431
    new-instance v9, Landroid/content/Entity;

    invoke-direct {v9, v8}, Landroid/content/Entity;-><init>(Landroid/content/ContentValues;)V

    .line 1433
    .local v9, entity:Landroid/content/Entity;
    move-object/from16 v0, p0

    iget-object v1, v0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->mResolver:Landroid/content/ContentResolver;

    if-eqz v1, :cond_0

    .line 1434
    move-object/from16 v0, p0

    iget-object v1, v0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->mResolver:Landroid/content/ContentResolver;

    sget-object v2, Landroid/provider/CalendarContract$Reminders;->CONTENT_URI:Landroid/net/Uri;

    sget-object v3, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->REMINDERS_PROJECTION:[Ljava/lang/String;

    const-string v4, "event_id=?"

    const/4 v5, 0x1

    new-array v5, v5, [Ljava/lang/String;

    const/4 v6, 0x0

    invoke-static {v10, v11}, Ljava/lang/Long;->toString(J)Ljava/lang/String;

    move-result-object v15

    aput-object v15, v5, v6

    const/4 v6, 0x0

    invoke-virtual/range {v1 .. v6}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v14

    .line 1445
    .local v14, subCursor:Landroid/database/Cursor;
    :goto_0
    :try_start_0
    invoke-interface {v14}, Landroid/database/Cursor;->moveToNext()Z

    move-result v1

    if-eqz v1, :cond_1

    .line 1446
    new-instance v13, Landroid/content/ContentValues;

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

    .line 1447
    .local v13, reminderValues:Landroid/content/ContentValues;
    const-string/jumbo v1, "minutes"

    const/4 v2, 0x0

    invoke-interface {v14, v2}, Landroid/database/Cursor;->getInt(I)I

    move-result v2

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v13, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 1448
    const-string/jumbo v1, "method"

    const/4 v2, 0x1

    invoke-interface {v14, v2}, Landroid/database/Cursor;->getInt(I)I

    move-result v2

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v13, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 1449
    sget-object v1, Landroid/provider/CalendarContract$Reminders;->CONTENT_URI:Landroid/net/Uri;

    invoke-virtual {v9, v1, v13}, Landroid/content/Entity;->addSubValue(Landroid/net/Uri;Landroid/content/ContentValues;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    goto :goto_0

    .line 1452
    .end local v13           #reminderValues:Landroid/content/ContentValues;
    :catchall_0
    move-exception v1

    invoke-interface {v14}, Landroid/database/Cursor;->close()V

    throw v1

    .line 1439
    .end local v14           #subCursor:Landroid/database/Cursor;
    :cond_0
    move-object/from16 v0, p0

    iget-object v1, v0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->mProvider:Landroid/content/ContentProviderClient;

    sget-object v2, Landroid/provider/CalendarContract$Reminders;->CONTENT_URI:Landroid/net/Uri;

    sget-object v3, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->REMINDERS_PROJECTION:[Ljava/lang/String;

    const-string v4, "event_id=?"

    const/4 v5, 0x1

    new-array v5, v5, [Ljava/lang/String;

    const/4 v6, 0x0

    invoke-static {v10, v11}, Ljava/lang/Long;->toString(J)Ljava/lang/String;

    move-result-object v15

    aput-object v15, v5, v6

    const/4 v6, 0x0

    invoke-virtual/range {v1 .. v6}, Landroid/content/ContentProviderClient;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v14

    .restart local v14       #subCursor:Landroid/database/Cursor;
    goto :goto_0

    .line 1452
    :cond_1
    invoke-interface {v14}, Landroid/database/Cursor;->close()V

    .line 1455
    move-object/from16 v0, p0

    iget-object v1, v0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->mResolver:Landroid/content/ContentResolver;

    if-eqz v1, :cond_2

    .line 1456
    move-object/from16 v0, p0

    iget-object v1, v0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->mResolver:Landroid/content/ContentResolver;

    sget-object v2, Landroid/provider/CalendarContract$Attendees;->CONTENT_URI:Landroid/net/Uri;

    sget-object v3, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->ATTENDEES_PROJECTION:[Ljava/lang/String;

    const-string v4, "event_id=?"

    const/4 v5, 0x1

    new-array v5, v5, [Ljava/lang/String;

    const/4 v6, 0x0

    invoke-static {v10, v11}, Ljava/lang/Long;->toString(J)Ljava/lang/String;

    move-result-object v15

    aput-object v15, v5, v6

    const/4 v6, 0x0

    invoke-virtual/range {v1 .. v6}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v14

    .line 1467
    :goto_1
    :try_start_1
    invoke-interface {v14}, Landroid/database/Cursor;->moveToNext()Z

    move-result v1

    if-eqz v1, :cond_3

    .line 1468
    new-instance v7, Landroid/content/ContentValues;

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

    .line 1469
    .local v7, attendeeValues:Landroid/content/ContentValues;
    const-string v1, "attendeeName"

    const/4 v2, 0x0

    invoke-interface {v14, v2}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v7, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 1471
    const-string v1, "attendeeEmail"

    const/4 v2, 0x1

    invoke-interface {v14, v2}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v7, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 1473
    const-string v1, "attendeeRelationship"

    const/4 v2, 0x2

    invoke-interface {v14, v2}, Landroid/database/Cursor;->getInt(I)I

    move-result v2

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v7, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 1475
    const-string v1, "attendeeType"

    const/4 v2, 0x3

    invoke-interface {v14, v2}, Landroid/database/Cursor;->getInt(I)I

    move-result v2

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v7, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 1477
    const-string v1, "attendeeStatus"

    const/4 v2, 0x4

    invoke-interface {v14, v2}, Landroid/database/Cursor;->getInt(I)I

    move-result v2

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v7, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 1479
    const-string v1, "attendeeIdentity"

    const/4 v2, 0x5

    invoke-interface {v14, v2}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v7, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 1481
    const-string v1, "attendeeIdNamespace"

    const/4 v2, 0x6

    invoke-interface {v14, v2}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v7, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 1483
    sget-object v1, Landroid/provider/CalendarContract$Attendees;->CONTENT_URI:Landroid/net/Uri;

    invoke-virtual {v9, v1, v7}, Landroid/content/Entity;->addSubValue(Landroid/net/Uri;Landroid/content/ContentValues;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    goto :goto_1

    .line 1486
    .end local v7           #attendeeValues:Landroid/content/ContentValues;
    :catchall_1
    move-exception v1

    invoke-interface {v14}, Landroid/database/Cursor;->close()V

    throw v1

    .line 1461
    :cond_2
    move-object/from16 v0, p0

    iget-object v1, v0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->mProvider:Landroid/content/ContentProviderClient;

    sget-object v2, Landroid/provider/CalendarContract$Attendees;->CONTENT_URI:Landroid/net/Uri;

    sget-object v3, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->ATTENDEES_PROJECTION:[Ljava/lang/String;

    const-string v4, "event_id=?"

    const/4 v5, 0x1

    new-array v5, v5, [Ljava/lang/String;

    const/4 v6, 0x0

    invoke-static {v10, v11}, Ljava/lang/Long;->toString(J)Ljava/lang/String;

    move-result-object v15

    aput-object v15, v5, v6

    const/4 v6, 0x0

    invoke-virtual/range {v1 .. v6}, Landroid/content/ContentProviderClient;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v14

    goto/16 :goto_1

    .line 1486
    :cond_3
    invoke-interface {v14}, Landroid/database/Cursor;->close()V

    .line 1489
    move-object/from16 v0, p0

    iget-object v1, v0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->mResolver:Landroid/content/ContentResolver;

    if-eqz v1, :cond_4

    .line 1490
    move-object/from16 v0, p0

    iget-object v1, v0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->mResolver:Landroid/content/ContentResolver;

    sget-object v2, Landroid/provider/CalendarContract$ExtendedProperties;->CONTENT_URI:Landroid/net/Uri;

    sget-object v3, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->EXTENDED_PROJECTION:[Ljava/lang/String;

    const-string v4, "event_id=?"

    const/4 v5, 0x1

    new-array v5, v5, [Ljava/lang/String;

    const/4 v6, 0x0

    invoke-static {v10, v11}, Ljava/lang/Long;->toString(J)Ljava/lang/String;

    move-result-object v15

    aput-object v15, v5, v6

    const/4 v6, 0x0

    invoke-virtual/range {v1 .. v6}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v14

    .line 1501
    :goto_2
    :try_start_2
    invoke-interface {v14}, Landroid/database/Cursor;->moveToNext()Z

    move-result v1

    if-eqz v1, :cond_5

    .line 1502
    new-instance v12, Landroid/content/ContentValues;

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

    .line 1503
    .local v12, extendedValues:Landroid/content/ContentValues;
    const-string v1, "_id"

    const/4 v2, 0x0

    invoke-interface {v14, v2}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v12, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 1505
    const-string/jumbo v1, "name"

    const/4 v2, 0x1

    invoke-interface {v14, v2}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v12, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 1507
    const-string/jumbo v1, "value"

    const/4 v2, 0x2

    invoke-interface {v14, v2}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v12, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 1509
    sget-object v1, Landroid/provider/CalendarContract$ExtendedProperties;->CONTENT_URI:Landroid/net/Uri;

    invoke-virtual {v9, v1, v12}, Landroid/content/Entity;->addSubValue(Landroid/net/Uri;Landroid/content/ContentValues;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_2

    goto :goto_2

    .line 1512
    .end local v12           #extendedValues:Landroid/content/ContentValues;
    :catchall_2
    move-exception v1

    invoke-interface {v14}, Landroid/database/Cursor;->close()V

    throw v1

    .line 1495
    :cond_4
    move-object/from16 v0, p0

    iget-object v1, v0, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->mProvider:Landroid/content/ContentProviderClient;

    sget-object v2, Landroid/provider/CalendarContract$ExtendedProperties;->CONTENT_URI:Landroid/net/Uri;

    sget-object v3, Landroid/provider/CalendarContract$EventsEntity$EntityIteratorImpl;->EXTENDED_PROJECTION:[Ljava/lang/String;

    const-string v4, "event_id=?"

    const/4 v5, 0x1

    new-array v5, v5, [Ljava/lang/String;

    const/4 v6, 0x0

    invoke-static {v10, v11}, Ljava/lang/Long;->toString(J)Ljava/lang/String;

    move-result-object v15

    aput-object v15, v5, v6

    const/4 v6, 0x0

    invoke-virtual/range {v1 .. v6}, Landroid/content/ContentProviderClient;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v14

    goto :goto_2

    .line 1512
    :cond_5
    invoke-interface {v14}, Landroid/database/Cursor;->close()V

    .line 1515
    invoke-interface/range {p1 .. p1}, Landroid/database/Cursor;->moveToNext()Z

    .line 1516
    return-object v9
.end method


text:
FROM confluent/platform

MAINTAINER contact@confluent.io

ENV LOG_DIR "/var/log/zookeeper"
ENV ZK_DATA_DIR "/var/log/zookeeper"
ENV KAFKA_LOG4J_OPTS -Dlog4j.configuration=file:/etc/kafka/log4j.properties

ADD zk-docker.sh /usr/local/bin/
ADD log4j.properties /etc/kafka/log4j.properties

RUN ["mkdir", "-p", "/var/log/zookeeper", "/var/lib/zookeeper"]
RUN ["chown", "-R", "confluent", "/var/log/zookeeper", "/var/lib/zookeeper", "/etc/kafka/zookeeper.properties"]
RUN ["chmod", "+x", "/usr/local/bin/zk-docker.sh"]

RUN ["chmod", "-R", "a=u", "/var/log/zookeeper", "/var/lib/zookeeper", "/etc/kafka/zookeeper.properties"]

RUN curl -Lo /usr/share/java/kafka/jolokia.jar http://search.maven.org/remotecontent?filepath=org/jolokia/jolokia-jvm/1.3.6/jolokia-jvm-1.3.6-agent.jar

VOLUME ["/var/log/zookeeper", "/var/lib/zookeeper"]

#TODO Expose JMX
# Expose client port (2188/tcp), peer connection port (2888/tcp), leader election port (3888/tcp)
EXPOSE 2181 2888 3888

USER confluent
ENTRYPOINT ["/usr/local/bin/zk-docker.sh"]


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

<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>
类 java.util.regex.Matcher 的使用 (Java Platform SE 6)
</TITLE>

<META NAME="date" CONTENT="2007-03-19">

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

      概述
      软件包
      类
    使用
      树
      已过时
      索引
      帮助

JavaTM Platform
Standard Ed. 6

 上一个
 下一个

  框架
 无框架

  所有类

类 java.util.regex.Matcher
的使用

使用 Matcher 的软件包

java.util.regex
用于匹配字符序列与正则表达式指定模式的类。

java.util.regex 中 Matcher 的使用

返回 Matcher 的 java.util.regex 中的方法

 Matcher
Matcher.appendReplacement(StringBuffer sb,
                  String replacement)

          实现非终端添加和替换步骤。

 Matcher
Pattern.matcher(CharSequence input)

          创建匹配给定输入与此模式的匹配器。

 Matcher
Matcher.region(int start,
       int end)

          设置此匹配器的区域限制。

 Matcher
Matcher.reset()

          重置匹配器。

 Matcher
Matcher.reset(CharSequence input)

          重置此具有新输入序列的匹配器。

 Matcher
Matcher.useAnchoringBounds(boolean b)

          设置匹配器区域界限的定位。

 Matcher
Matcher.usePattern(Pattern newPattern)

          更改此 <tt>Matcher</tt> 用于查找匹配项的 <tt>Pattern</tt>。

 Matcher
Matcher.useTransparentBounds(boolean b)

          设置此匹配器区域边界的透明度。

      概述
      软件包
      类
    使用
      树
      已过时
      索引
      帮助

JavaTM Platform
Standard Ed. 6

 上一个
 下一个

  框架
 无框架

  所有类

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。


text:
<!DOCTYPE HTML>

  <meta charset="utf-8">

  <title>JSONEditor | Advanced Auto Complete</title>

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

  This example demonstrates how to autocomplete works with an ActivationChar option, press "*" in any value and continue with autocompletion.
  The autocomplete returns the posible jsonpaths of the existing json document, for example *object.a.


text:
namespace reporting {

namespace {

StatusOr<std::string> ValueToJson(base::Value::Dict record) {
  std::string json_record;
  if (!base::JSONWriter::Write(record, &json_record)) {
    return Status(error::INVALID_ARGUMENT,
                  "Provided record was not convertable to a std::string");
  }
  return json_record;
}

StatusOr<std::string> ProtoToString(
    std::unique_ptr<const google::protobuf::MessageLite> record) {
  std::string protobuf_record;
  if (!record->SerializeToString(&protobuf_record)) {
    return Status(error::INVALID_ARGUMENT,
                  "Unabled to serialize record to string. Most likely due to "
                  "unset required fields.");
  }
  return protobuf_record;
}

void EnqueueResponded(ReportQueue::EnqueueCallback callback, Status status) {
  base::UmaHistogramEnumeration(ReportQueue::kEnqueueMetricsName, status.code(),
                                error::Code::MAX_VALUE);
  std::move(callback).Run(status);
}
}  // namespace

ReportQueue::~ReportQueue() = default;

void ReportQueue::Enqueue(std::string record,
                          Priority priority,
                          ReportQueue::EnqueueCallback callback) const {
  AddProducedRecord(base::BindOnce(
                        [](std::string record) -> StatusOr<std::string> {
                          return std::move(record);
                        },
                        std::move(record)),
                    priority,
                    base::BindOnce(&EnqueueResponded, std::move(callback)));
}

void ReportQueue::Enqueue(base::Value::Dict record,
                          Priority priority,
                          ReportQueue::EnqueueCallback callback) const {
  AddProducedRecord(base::BindOnce(&ValueToJson, std::move(record)), priority,
                    base::BindOnce(&EnqueueResponded, std::move(callback)));
}

void ReportQueue::Enqueue(
    std::unique_ptr<const google::protobuf::MessageLite> record,
    Priority priority,
    ReportQueue::EnqueueCallback callback) const {
  AddProducedRecord(base::BindOnce(&ProtoToString, std::move(record)), priority,
                    base::BindOnce(&EnqueueResponded, std::move(callback)));
}

}  // namespace reporting


text:
![Cunningham C-4R Racer](http://upload.wikimedia.org/wikipedia/commons/thumb/d/d5/Cunningham_C4R.JPG/626px-Cunningham_C4R.JPG)

Tired of your applications calls to Stripe API taking forever? Don't want to
store the data Stripe already so elegantly manages for you? Put some racing
stripes on your app with Cunningham!

## Installation

You'll need a running instance of Redis on your local machine, or something in
the `REDIS_URL` environment variable that will direct Cunningham to a Redis
instance, or we'll go all vintage NASCAR on you and crash.

Add this line to your application's Gemfile:

    gem 'cunningham'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install cunningham

## Usage

Use Stripe!

Cunningham automatically injects itself in front of the Stripe gem
and checks its Redis cache for the entity you're looking for before it calls out
to the web service. If it can't find anything, it will allow the call to follow
its normal path up the call chain out to the API. Once it's got an object back,
it will store it FOREVER because nothing invalidates the cache yet! SOUNDS
AWESOME, EH?

Soon, Cunningham will include a mountable Rails engine that you can set up
quickly to receive Stripe webhooks which will invalidate the cache based on the
events Stripe sends to your application, making the cache mostly super accurate!

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
require 'rails_helper'

RSpec.describe Answer, type: :model do
  describe '#correct?' do
    before do
      @challenge = build(:challenge, flags: [])
      @flags = [
        create(:flag, flag: 'FLAG_01234',  point: 100),
        create(:flag, flag: 'FLAG_56789',  point: 200),
        create(:flag, flag: '(?i)flAg_kogaSA', point: 300)
      ]
      @flags.each {|f| @challenge.flags << f}
      @challenge.save!
      @player = create(:player)
      @player.confirm
    end
    context 'when it is the correct answer' do
      it 'returns true' do
        answer = create(:answer, player: @player, challenge: @challenge, answer: @flags[0].flag)
        expect(answer.flag).to be_truthy
        answer = create(:answer, player: @player, challenge: @challenge, answer: @flags[1].flag)
        expect(answer.flag).to be_truthy
        answer = create(:answer, player: @player, challenge: @challenge, answer: 'FLAG_KOGASA')
        expect(answer.flag).to be_truthy
      end
    end
    context 'when it is the incorrect answer' do
      it 'returns false' do
        answer = create(:answer, player: @player, challenge: @challenge, answer: 'FLAG_mofmof')
        expect(answer.flag).to be_falsey
      end
    end
  end

  describe '#flag' do
    before do
      @challenge = build(:challenge, flags: [])
      @flags = [
        create(:flag, flag: 'FLAG_01234',  point: 100),
        create(:flag, flag: 'FLAG_56789',  point: 200),
        create(:flag, flag: '(?i)flAg_kogaSA', point: 300)
      ]
      @flags.each {|f| @challenge.flags << f}
      @challenge.save!
      @player = create(:player)
    end
    context 'when it is the correct answer' do
      it 'returns the flag' do
        answer = create(:answer, player: @player, challenge: @challenge, answer: @flags[0].flag)
        expect(answer.flag).to eq @flags[0]
        answer = create(:answer, player: @player, challenge: @challenge, answer: @flags[1].flag)
        expect(answer.flag).to eq @flags[1]
        answer = create(:answer, player: @player, challenge: @challenge, answer: 'FLAG_KOGASA')
        expect(answer.flag).to eq @flags[2]
      end
    end
    context 'when it is the incorrect answer' do
      it 'returns nil' do
        wrong_flags =
        [
          'FLAG_mofmof',   # No such flag!
          "flAg_kogaSA\n", # No trailing line-breaks!
          'FlaG_01234'     # That flag is case-sensitive!
        ]
        wrong_flags.each do |answer|
          answer = create(
            :answer,
            player: @player, challenge: @challenge, answer: answer
          )
          expect(answer.flag).to be_nil
        end
      end
    end
  end

  describe '#valid_answer?' do
    before do
      @challenge = build(:challenge, flags: [])
      @flags = [
        create(:flag, flag: 'FLAG_01234',  point: 100),
        create(:flag, flag: 'FLAG_56789',  point: 200),
        create(:flag, flag: '(?i)flAg_kogaSA', point: 300)
      ]
      @flags.each { |f| @challenge.flags << f }
      @challenge.save!
      @player = create(:player)
      @player.confirm
      @player2 = create(:player, team: @player.team)
      @player2.confirm
    end

    context 'when it is the correct answer' do
      context 'and the player does not answer for it' do
        it 'returns true' do
          answer = create(:answer, player: @player, challenge: @challenge, answer: @flags[0].flag)
          expect(answer.flag).to be_truthy
          answer = create(:answer, player: @player, challenge: @challenge, answer: @flags[1].flag)
          expect(answer.flag).to be_truthy
          answer = create(:answer, player: @player, challenge: @challenge, answer: 'FLAG_KOGASA')
          expect(answer.flag).to be_truthy
        end
      end

      context 'but the player already answered for it' do
        before do
          create(:answer, player: @player, challenge: @challenge, answer: @flags[0].flag)
          create(:answer, player: @player, challenge: @challenge, answer: @flags[1].flag)
          create(:answer, player: @player, challenge: @challenge, answer: 'FLAG_KOGASA')
        end

        it 'returns false' do
          answer = create(:answer, player: @player, challenge: @challenge, answer: @flags[0].flag)
          expect(answer.valid_answer?).to be false
          answer = create(:answer, player: @player, challenge: @challenge, answer: @flags[1].flag)
          expect(answer.valid_answer?).to be false
          answer = create(:answer, player: @player, challenge: @challenge, answer: 'FLAG_KOGASA')
          expect(answer.valid_answer?).to be false
        end
      end

      context 'but the team-mate already answered for it' do
        before do
          create(:answer, player: @player, challenge: @challenge, answer: @flags[0].flag)
          create(:answer, player: @player, challenge: @challenge, answer: @flags[1].flag)
          create(:answer, player: @player, challenge: @challenge, answer: 'FLAG_KOGASA')
        end

        it 'returns false' do
          answer = create(:answer, player: @player2, challenge: @challenge, answer: @flags[0].flag)
          expect(answer.valid_answer?).to be false
          answer = create(:answer, player: @player2, challenge: @challenge, answer: @flags[1].flag)
          expect(answer.valid_answer?).to be false
          answer = create(:answer, player: @player2, challenge: @challenge, answer: 'FLAG_KOGASA')
          expect(answer.valid_answer?).to be false
        end
      end
    end

    context 'when it is the wrong answer' do
      context 'and the player does not answer for it' do
        it 'returns false' do
          answer = create(:answer, player: @player, challenge: @challenge, answer: 'WRONG_FLAG!')
          expect(answer.valid_answer?).to be false
          answer = create(:answer, player: @player, challenge: @challenge, answer: 'WRONG_FLAG?')
          expect(answer.valid_answer?).to be false
          answer = create(:answer, player: @player, challenge: @challenge, answer: 'FLAG_MARISA')
          expect(answer.valid_answer?).to be false
        end
      end

      context 'and the player already answered for it' do
        before do
          create(:answer, player: @player, challenge: @challenge, answer: @flags[0].flag)
          create(:answer, player: @player, challenge: @challenge, answer: @flags[1].flag)
          create(:answer, player: @player, challenge: @challenge, answer: 'FLAG_KOGASA')
        end

        it 'returns false' do
          answer = create(:answer, player: @player, challenge: @challenge, answer: 'WRONG_FLAG!')
          expect(answer.valid_answer?).to be false
          answer = create(:answer, player: @player, challenge: @challenge, answer: 'WRONG_FLAG?')
          expect(answer.valid_answer?).to be false
          answer = create(:answer, player: @player, challenge: @challenge, answer: 'FLAG_MARISA')
          expect(answer.valid_answer?).to be false
        end
      end
    end

  end
end


text:
package com.mongodb.operation;

import com.mongodb.MongoNamespace;
import com.mongodb.WriteConcern;
import com.mongodb.WriteConcernResult;
import com.mongodb.async.SingleResultCallback;
import com.mongodb.bulk.BulkWriteResult;
import com.mongodb.bulk.UpdateRequest;
import com.mongodb.bulk.WriteRequest;
import com.mongodb.connection.AsyncConnection;
import com.mongodb.connection.Connection;

import java.util.List;

import static com.mongodb.assertions.Assertions.notNull;

/**
 * An operation that updates a document in a collection.
 *
 * @since 3.0
 */
public class UpdateOperation extends BaseWriteOperation {
    private final List<UpdateRequest> updates;

    /**
     * Construct an instance.
     *
     * @param namespace the database and collection namespace for the operation.
     * @param ordered whether the updates are ordered.
     * @param writeConcern the write concern for the operation.
     * @param updates the update requests.
     */
    public UpdateOperation(final MongoNamespace namespace, final boolean ordered, final WriteConcern writeConcern,
                           final List<UpdateRequest> updates) {
        super(namespace, ordered, writeConcern);
        this.updates = notNull("update", updates);
    }

    /**
     * Gets the list of update requests.
     *
     * @return the update requests
     */
    public List<UpdateRequest> getUpdateRequests() {
        return updates;
    }

    @Override
    protected WriteConcernResult executeProtocol(final Connection connection) {
        return connection.update(getNamespace(), isOrdered(), getWriteConcern(), updates);
    }

    @Override
    protected void executeProtocolAsync(final AsyncConnection connection, final SingleResultCallback<WriteConcernResult> callback) {
        connection.updateAsync(getNamespace(), isOrdered(), getWriteConcern(), updates, callback);
    }

    @Override
    protected BulkWriteResult executeCommandProtocol(final Connection connection) {
        return connection.updateCommand(getNamespace(), isOrdered(), getWriteConcern(), updates);
    }

    @Override
    protected void executeCommandProtocolAsync(final AsyncConnection connection, final SingleResultCallback<BulkWriteResult> callback) {
        connection.updateCommandAsync(getNamespace(), isOrdered(), getWriteConcern(), updates, callback);
    }

    @Override
    protected WriteRequest.Type getType() {
        return WriteRequest.Type.UPDATE;
    }

    @Override
    protected int getCount(final BulkWriteResult bulkWriteResult) {
        return bulkWriteResult.getMatchedCount() + bulkWriteResult.getUpserts().size();
    }

    @Override
    protected boolean getUpdatedExisting(final BulkWriteResult bulkWriteResult) {
        return bulkWriteResult.getMatchedCount() > 0;
    }
}