text:
package com.squeezer.asr2application.fragment;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.SeekBar;

import com.squeezer.asr2application.AudioService;
import com.squeezer.asr2application.R;

import java.lang.ref.WeakReference;

public class Fragment6 extends Fragment implements View.OnClickListener, SeekBar.OnSeekBarChangeListener {

    public static final String MEDIA_PLAYER_APP_MESSENGER_KEY = "app_messenger";

    private Button mPlayButton;
    private Button mStopButton;

    private SeekBar mSeekBar;
    private boolean isSeek =false;

    private AppHandler mHandler;
    private Messenger mAppMessenger;
    private MediaPlayerServiceConnection mConnection = new MediaPlayerServiceConnection();
    private Messenger messengerToService;

    private boolean isServiceConnected = false;

    private boolean isPlaying = false;

    public static Fragment6 newInstance() {

        return new Fragment6();
    }

    public Fragment6() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_6_layout, container, false);
        mPlayButton = (Button) rootView.findViewById(R.id.play_button);
        mPlayButton.setOnClickListener(this);

        mStopButton = (Button) rootView.findViewById(R.id.stop_button);
        mStopButton.setOnClickListener(this);

        mSeekBar = (SeekBar) rootView.findViewById(R.id.seek_bar);
        mSeekBar.setOnSeekBarChangeListener(this);

        mHandler = new AppHandler(this);
        mAppMessenger = new Messenger(mHandler);

        Intent serviceIntent = new Intent(getActivity(),
                AudioService.class);
        serviceIntent.putExtra(MEDIA_PLAYER_APP_MESSENGER_KEY, mAppMessenger);
        getActivity().startService(serviceIntent);
        Log.v("iit", "service started in fragment");
        return rootView;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.play_button:
                if (!isPlaying) {
                    playAudio();
                } else {
                    pauseAudio();
                }
                break;
            case R.id.stop_button:
                stopAudio();
                break;
        }
    }

    private void playAudio() {
        if (messengerToService != null) {
            try {
                Message message = Message.obtain();
                message.what = AudioService.MEDIA_PLAYER_CONTROL_START;
                messengerToService.send(message);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }

    }

    private void pauseAudio() {
        if (messengerToService != null) {
            try {
                Message message = Message.obtain();
                message.what = AudioService.MEDIA_PLAYER_CONTROL_PAUSE;
                messengerToService.send(message);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }

    }

    private void stopAudio() {
        if (messengerToService != null) {
            try {
                Message message = Message.obtain();
                message.what = AudioService.MEDIA_PLAYER_CONTROL_STOP;
                messengerToService.send(message);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }

    }

    private void seekAudio(int progress) {
        if (messengerToService != null) {
            try {
                Message message = Message.obtain();
                message.what = AudioService.MEDIA_PLAYER_CONTROL_PROGRESS;
                message.arg1 = progress;
                messengerToService.send(message);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }

    }

    private void doBind() {
        Log.v("iit", "request service bind in fragment");
        getActivity().bindService(
                new Intent(getActivity(), AudioService.class),
                mConnection, Context.BIND_AUTO_CREATE);

    }

    private void doUnbindService() {
        if (messengerToService != null) {
            try {
                Message message = Message.obtain();
                message.what = AudioService.MEDIA_PLAYER_SERVICE_CLIENT_UNBOUND;
                messengerToService.send(message);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
        getActivity().unbindService(mConnection);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        doUnbindService();
    }

    private void updatePlayButton() {
        isPlaying = true;
        mPlayButton.setText("Pause");

    }

    private void updatePauseButton() {
        isPlaying = false;
        mPlayButton.setText("Play");
    }

    private void stopPerformed() {
        isPlaying = false;
        mPlayButton.setText("Play");
        mSeekBar.setProgress(0);
    }

    private void progressPerformed(int duration, int currentPosition) {
        int progress =  (int)((float)currentPosition/(float)duration*100);
        mSeekBar.setProgress(progress);
    }

    @Override
    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
        if (isSeek) {
            seekAudio(progress);
        }
    }

    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
        isSeek = true;
    }

    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
isSeek = false;
    }

    /***********************************************************/
    /***************** private classes *************************/
    /**
     * *******************************************************
     */

    private class MediaPlayerServiceConnection implements ServiceConnection {

        @Override
        public void onServiceConnected(ComponentName className, IBinder binder) {

            isServiceConnected = true;
            messengerToService = new Messenger(binder);

            //try {
            //Message message = Message.obtain();
            //message.what = MediaPlayerService.MEDIA_PLAYER_GET_PODCASTS;
            //messengerToService.send(message);
            //} catch (RemoteException e1) {
            //  e1.printStackTrace();
            //}
        }

        @Override
        public void onServiceDisconnected(ComponentName className) {
            messengerToService = null;
        }
    }

    private static class AppHandler extends Handler {

        private final WeakReference<Fragment6> mTarget;

        private AppHandler(Fragment6 target) {
            mTarget = new WeakReference<Fragment6>(target);
        }

        @Override
        public void handleMessage(Message message) {

            Fragment6 target = mTarget.get();
            Bundle bundle;
            switch (message.what) {
                case AudioService.MEDIA_PLAYER_SERVICE_STARTED:
                    target.doBind();
                    break;
                case AudioService.MEDIA_PLAYER_CONTROL_START:
                    target.updatePlayButton();
                    break;
                case AudioService.MEDIA_PLAYER_CONTROL_PAUSE:
                    target.updatePauseButton();
                    break;
                case AudioService.MEDIA_PLAYER_CONTROL_STOP:
                    target.stopPerformed();
                    break;
                case AudioService.MEDIA_PLAYER_CONTROL_PROGRESS:
                    Log.v("asr","progress in app with duration = "+message.arg1+" and current position = "+message.arg2);
                    target.progressPerformed(message.arg1, message.arg2);
                    break;
            }
        }
    }

}

redpajama_set_name: RedPajamaGithub


text:
/****** Object:  Stored Procedure dbo.smUpdateUserActivity    Script Date: 23/06/2005 13:35:39 ******/

/*********************************************************************************************************************
**
** Procedure Name	:	smUpdateUserActivity
** Author		:	Neil Murtagh
** Date Created		:	6/4/2005
** Version		:	1.0.1
**
**********************************************************************************************************************
**
** Description		:	This stored procedure updates a users last activity
**				1 - updated successfully
**				2 - error updating
**
**********************************************************************************************************************
**
** Change Control	:
**
**********************************************************************************************************************/

CREATE procedure dbo.smUpdateUserActivity
@applicationId int=0,
@userId int=0,
@activityUpdated int output
as
begin

declare @errorCount int
set @errorCount = 0
set @activityUpdated = 0
begin transaction

	update smApplicationUsers
	set lastActivity = getdate()
	where applicationId = @applicationId
	and userId = @userId
set @errorCount =@errorCount + @@error

	set @activityUpdated = 1

if(@errorcount != 0)
begin
set @activityUpdated = 2  -- error occured
rollback tran
select 'error, rolling back action '

end
else
begin
commit tran
end

end

GRANT EXECUTE ON smUpdateUserActivity TO b4nuser
GO
GRANT EXECUTE ON smUpdateUserActivity TO helpdesk
GO
GRANT EXECUTE ON smUpdateUserActivity TO ofsuser
GO
GRANT EXECUTE ON smUpdateUserActivity TO reportuser
GO
GRANT EXECUTE ON smUpdateUserActivity TO b4nexcel
GO
GRANT EXECUTE ON smUpdateUserActivity TO b4nloader
GO


text:
__author__ = "Mikhail Zhigun"
__copyright__ = "Copyright 2020, MeteoSwiss"

""" This code manages CLAW release installation. It is supposed to be run from corresponding Jenkins plan.
"""

import os, shutil, stat
from os.path import join as join_path
from typing import List, Optional
from build_claw_release import main as install, dir_exists, file_exists

RELEASES = ('2.0.1', '2.0.2')
COMPILERS = ('gcc', 'pgi')
MACHINES = ('daint', 'tsa', 'ubuntu20')

def link_exists(path: str) -> bool:
    return os.path.exists(path) and os.path.islink(path)

def get_c_compiler(machine: str, compiler: str) -> str:
    if machine == 'tsa':
        return '/apps/arolla/UES/jenkins/RH7.7/generic/easybuild/software/GCCcore/8.3.0/bin/gcc'
    else:
        return '/usr/bin/gcc'

def get_cxx_compiler(machine: str, compiler: str) -> str:
    if machine == 'tsa':
        return '/apps/arolla/UES/jenkins/RH7.7/generic/easybuild/software/GCCcore/8.3.0/bin/g++'
    else:
        return '/usr/bin/g++'

def get_fc_compiler(machine: str, compiler: str) -> str:
    if compiler == 'gcc':
        return '/usr/bin/gfortran'
    elif compiler == 'pgi':
        fc = {'daint' : 'ftn',
              'tsa' : 'pgfortran',
              'ubuntu20' : '/opt/pgi/linux86-64/19.10/bin/pgfortran'}.get(machine)
        assert fc is not None, 'Compiler "%s" unsupported on machine "%s"' % (compiler, machine)
        return fc
    else:
        assert False, 'Unsupported compiler'

def get_fc_compiler_modules(machine: str, compiler: str) -> List[str]:
    if compiler == 'gcc':
        return []
    elif compiler == 'pgi':
        fc_modules = {'daint' : ['PrgEnv-pgi', 'pgi/20.1.1'],
                      'tsa' : ['PrgEnv-pgi/19.9', 'pgi/19.9-gcc-8.3.0'],
                      'ubuntu20' : []}.get(machine)
        assert fc_modules is not None, 'Compiler "%s" unsupported on machine "%s"' % (compiler, machine)
        return fc_modules
    else:
        assert False, 'Unsupported compiler'

def get_cmake_modules(machine: str) -> List[str]:
    if machine == 'tsa':
        return ['cmake']
    else:
        return []

def get_env_var(name: str):
    val = os.environ.get(name)
    assert val is not None, 'Required environment var "%s" not set. Are you running the script from Jenkins?' % name
    return val

def get_top_install_dir(machine: str, release: str, compiler: str) -> str:
    if machine == 'ubuntu20':
        return join_path('/data/software/claw-release', compiler)
    elif machine in ('daint', 'tsa'):
        return join_path('/project/c14/install', machine, 'claw', compiler)
    else:
        assert False, 'Unknown machine'

def get_ant_dir(machine: str) -> Optional[str]:
    if machine == 'ubuntu20':
        return None
    elif machine == 'daint':
        return '/project/c14/install/daint/ant/apache-ant-1.10.2'
    elif machine == 'tsa':
        return '/project/c14/install/arolla/ant/apache-ant-1.10.2'
    else:
        assert False, 'Unknown machine'

def set_permissions(dir: str, symlink: str):

    def allow_read_to_other_users(path: str):
        current = stat.S_IMODE(os.lstat(path).st_mode)
        os.chmod(path, current | stat.S_IROTH)

    def allow_exec_to_other_users(path: str):
        current = stat.S_IMODE(os.lstat(path).st_mode)
        os.chmod(path, current | stat.S_IROTH | stat.S_IXOTH)

    for dir_path, dirnames, filenames in os.walk(dir):
        allow_read_to_other_users(dir_path)
        for filename in filenames:
            file_path = os.path.join(dir_path, filename)
            allow_read_to_other_users(file_path)
    for dir_path, dirnames, filenames in os.walk(join_path(dir, 'bin')):
        for filename in filenames:
            file_path = os.path.join(dir_path, filename)
            allow_exec_to_other_users(file_path)
    allow_read_to_other_users(symlink)

if __name__ == '__main__':
    RELEASE = get_env_var('release')
    COMPILER = get_env_var('compiler')
    MACHINE = get_env_var('slave')
    DISABLE_TESTS = os.environ.get('disable_tests') is not None
    assert RELEASE in RELEASES, 'Unsupported release'
    assert COMPILER in COMPILERS, 'Unsupported compiler'
    assert MACHINE in MACHINES, 'Unsupported machine'
    cmake_modules = get_cmake_modules(MACHINE)
    cc = get_c_compiler(MACHINE, COMPILER)
    cxx = get_cxx_compiler(MACHINE, COMPILER)
    fc = get_fc_compiler(MACHINE, COMPILER)
    fc_modules = get_fc_compiler_modules(MACHINE, COMPILER)
    ant_dir = get_ant_dir(MACHINE)
    top_install_dir = get_top_install_dir(MACHINE, RELEASE, COMPILER)
    install_dir = join_path(top_install_dir, '.installs', RELEASE)
    install_link = join_path(top_install_dir, RELEASE)
    std_install_dir = install_dir
    old_install_dir = None
    if link_exists(install_link):
        old_install_dir_path = os.readlink(install_link)
        if dir_exists(old_install_dir_path):
            old_install_dir = old_install_dir_path
            if install_dir == old_install_dir:
                install_dir += '.new'
        if dir_exists(install_dir):
            shutil.rmtree(install_dir)
    args = ['--install-dir=%s' % install_dir,
            '--release-tag=v%s' % RELEASE,
            '--c-compiler=%s' % cc,
            '--cxx-compiler=%s' % cxx,
            '--fc-compiler=%s' % fc]
    if fc_modules is not None and len(fc_modules) > 0:
        args += ['--fc-compiler-modules'] + fc_modules
    if cmake_modules is not None and len(cmake_modules) > 0:
        args += ['--cmake-modules'] + cmake_modules
    if ant_dir is not None:
        args += ['--ant-home-dir', ant_dir]
    if DISABLE_TESTS:
        args += ['--disable-tests']
    install(args)
    if link_exists(install_link):
        os.remove(install_link)
    os.symlink(install_dir, install_link, target_is_directory=True)
    set_permissions(install_dir, install_link)
    if old_install_dir is not None:
        backup_dir = std_install_dir + '.old'
        if dir_exists(backup_dir):
            shutil.rmtree(backup_dir)
        shutil.move(old_install_dir, backup_dir)


text:
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Writing Modes Test: Shrink-to-fit float with a child of orthogonal block</title>
<link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#orthogonal-flows" title="7.3. Orthogonal Flows">
<meta name="assert" content="Shrink-to-fit float with a child of orthogonal block">
<meta name="flags" content="ahem dom">
<link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com">
<link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">

<link rel="stylesheet" href="/resources/testharness.css">

Test passes if the X-position of the left edge of the orange box and the right edge of the blue box are the same.

If script is enabled, there should be one or more PASS and no FAIL.

9: Shrink-to-fit float with a child of orthogonal block

HH

ZZ


text:
package br.edu.ifba.wmobile.huehue.produtos.escritorio;

import java.util.ArrayList;
import java.util.List;

import br.edu.ifba.wmobile.huehue.produtos.IProdutos;

public class Escrivaninha implements IProdutos {

	@Override
	public String getCessao() {
		return "ESCRITORIO";
	}

	@Override
	public List<String> getNome() {
		List<String> itens = new ArrayList<String>();
		itens.add("ESCRIVANINHA");

		return itens;
	}

	@Override
	public double getPreco() {
		return 561.90;
	}
}


text:
@if(Session::has('success') || Session::has('error'))

            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                ×
            </button>
         	{{ Session::has('success') ? Session::get('success') : Session::get('error') }}

@endif


text:
"""
Client classes for web services.
"""

import copy
import json
import uuid

from oslo_log import log as logging
import requests
import six
from six.moves import urllib

from cinder import exception
from cinder.i18n import _, _LE
import cinder.utils as cinder_utils
from cinder.volume.drivers.netapp.eseries import utils

LOG = logging.getLogger(__name__)

class WebserviceClient(object):
    """Base client for e-series web services."""

    def __init__(self, scheme, host, port, service_path, username,
                 password, **kwargs):
        self._validate_params(scheme, host, port)
        self._create_endpoint(scheme, host, port, service_path)
        self._username = username
        self._password = password
        self._init_connection()

    def _validate_params(self, scheme, host, port):
        """Does some basic validation for web service params."""
        if host is None or port is None or scheme is None:
            msg = _("One of the required inputs from host, port"
                    " or scheme not found.")
            raise exception.InvalidInput(reason=msg)
        if scheme not in ('http', 'https'):
            raise exception.InvalidInput(reason=_("Invalid transport type."))

    def _create_endpoint(self, scheme, host, port, service_path):
        """Creates end point url for the service."""
        netloc = '%s:%s' % (host, port)
        self._endpoint = urllib.parse.urlunparse((scheme, netloc, service_path,
                                                 None, None, None))

    def _init_connection(self):
        """Do client specific set up for session and connection pooling."""
        self.conn = requests.Session()
        if self._username and self._password:
            self.conn.auth = (self._username, self._password)

    def invoke_service(self, method='GET', url=None, params=None, data=None,
                       headers=None, timeout=None, verify=False):
        url = url or self._endpoint
        try:
            response = self.conn.request(method, url, params, data,
                                         headers=headers, timeout=timeout,
                                         verify=verify)
        # Catching error conditions other than the perceived ones.
        # Helps propagating only known exceptions back to the caller.
        except Exception as e:
            LOG.exception(_LE("Unexpected error while invoking web service."
                              " Error - %s."), e)
            raise exception.NetAppDriverException(
                _("Invoking web service failed."))
        return response

class RestClient(WebserviceClient):
    """REST client specific to e-series storage service."""

    def __init__(self, scheme, host, port, service_path, username,
                 password, **kwargs):
        super(RestClient, self).__init__(scheme, host, port, service_path,
                                         username, password, **kwargs)
        kwargs = kwargs or {}
        self._system_id = kwargs.get('system_id')
        self._content_type = kwargs.get('content_type') or 'json'

    def set_system_id(self, system_id):
        """Set the storage system id."""
        self._system_id = system_id

    def get_system_id(self):
        """Get the storage system id."""
        return getattr(self, '_system_id', None)

    def _get_resource_url(self, path, use_system=True, **kwargs):
        """Creates end point url for rest service."""
        kwargs = kwargs or {}
        if use_system:
            if not self._system_id:
                raise exception.NotFound(_('Storage system id not set.'))
            kwargs['system-id'] = self._system_id
        path = path.format(**kwargs)
        if not self._endpoint.endswith('/'):
            self._endpoint = '%s/' % self._endpoint
        return urllib.parse.urljoin(self._endpoint, path.lstrip('/'))

    def _invoke(self, method, path, data=None, use_system=True,
                timeout=None, verify=False, **kwargs):
        """Invokes end point for resource on path."""
        url = self._get_resource_url(path, use_system, **kwargs)
        if self._content_type == 'json':
            headers = {'Accept': 'application/json',
                       'Content-Type': 'application/json'}
            if cinder_utils.TRACE_API:
                self._log_http_request(method, url, headers, data)
            data = json.dumps(data) if data else None
            res = self.invoke_service(method, url, data=data,
                                      headers=headers,
                                      timeout=timeout, verify=verify)
            res_dict = res.json() if res.text else None

            if cinder_utils.TRACE_API:
                self._log_http_response(res.status_code, dict(res.headers),
                                        res_dict)

            self._eval_response(res)
            return res_dict
        else:
            raise exception.NetAppDriverException(
                _("Content type not supported."))

    def _to_pretty_dict_string(self, data):
        """Convert specified dict to pretty printed string."""
        return json.dumps(data, sort_keys=True,
                          indent=2, separators=(',', ': '))

    def _log_http_request(self, verb, url, headers, body):
        scrubbed_body = copy.deepcopy(body)
        if scrubbed_body:
            if 'password' in scrubbed_body:
                scrubbed_body['password'] = "****"
            if 'storedPassword' in scrubbed_body:
                scrubbed_body['storedPassword'] = "****"

        params = {'verb': verb, 'path': url,
                  'body': self._to_pretty_dict_string(scrubbed_body) or "",
                  'headers': self._to_pretty_dict_string(headers)}
        LOG.debug("Invoking ESeries Rest API, Request:\n"
                  "HTTP Verb: %(verb)s\n"
                  "URL Path: %(path)s\n"
                  "HTTP Headers:\n"
                  "%(headers)s\n"
                  "Body:\n"
                  "%(body)s\n", (params))

    def _log_http_response(self, status, headers, body):
        params = {'status': status,
                  'body': self._to_pretty_dict_string(body) or "",
                  'headers': self._to_pretty_dict_string(headers)}
        LOG.debug("ESeries Rest API, Response:\n"
                  "HTTP Status Code: %(status)s\n"
                  "HTTP Headers:\n"
                  "%(headers)s\n"
                  "Body:\n"
                  "%(body)s\n", (params))

    def _eval_response(self, response):
        """Evaluates response before passing result to invoker."""
        status_code = int(response.status_code)
        # codes >= 300 are not ok and to be treated as errors
        if status_code >= 300:
            # Response code 422 returns error code and message
            if status_code == 422:
                msg = _("Response error - %s.") % response.text
            else:
                msg = _("Response error code - %s.") % status_code
            raise exception.NetAppDriverException(msg)

    def create_volume(self, pool, label, size, unit='gb', seg_size=0):
        """Creates volume on array."""
        path = "/storage-systems/{system-id}/volumes"
        data = {'poolId': pool, 'name': label, 'sizeUnit': unit,
                'size': int(size), 'segSize': seg_size}
        return self._invoke('POST', path, data)

    def delete_volume(self, object_id):
        """Deletes given volume from array."""
        path = "/storage-systems/{system-id}/volumes/{object-id}"
        return self._invoke('DELETE', path, **{'object-id': object_id})

    def list_volumes(self):
        """Lists all volumes in storage array."""
        path = "/storage-systems/{system-id}/volumes"
        return self._invoke('GET', path)

    def list_volume(self, object_id):
        """List given volume from array."""
        path = "/storage-systems/{system-id}/volumes/{object-id}"
        return self._invoke('GET', path, **{'object-id': object_id})

    def update_volume(self, object_id, label):
        """Renames given volume in array."""
        path = "/storage-systems/{system-id}/volumes/{object-id}"
        data = {'name': label}
        return self._invoke('POST', path, data, **{'object-id': object_id})

    def get_volume_mappings(self):
        """Creates volume mapping on array."""
        path = "/storage-systems/{system-id}/volume-mappings"
        return self._invoke('GET', path)

    def get_volume_mappings_for_volume(self, volume):
        """Gets all host mappings for given volume from array."""
        mappings = self.get_volume_mappings() or []
        host_maps = filter(lambda x: x.get('volumeRef') == volume['volumeRef'],
                           mappings)
        return host_maps

    def get_volume_mappings_for_host(self, host_ref):
        """Gets all volume mappings for given host from array."""
        mappings = self.get_volume_mappings() or []
        host_maps = filter(lambda x: x.get('mapRef') == host_ref, mappings)
        return host_maps

    def get_volume_mappings_for_host_group(self, hg_ref):
        """Gets all volume mappings for given host group from array."""
        mappings = self.get_volume_mappings() or []
        hg_maps = filter(lambda x: x.get('mapRef') == hg_ref, mappings)
        return hg_maps

    def create_volume_mapping(self, object_id, target_id, lun):
        """Creates volume mapping on array."""
        path = "/storage-systems/{system-id}/volume-mappings"
        data = {'mappableObjectId': object_id, 'targetId': target_id,
                'lun': lun}
        return self._invoke('POST', path, data)

    def delete_volume_mapping(self, map_object_id):
        """Deletes given volume mapping from array."""
        path = "/storage-systems/{system-id}/volume-mappings/{object-id}"
        return self._invoke('DELETE', path, **{'object-id': map_object_id})

    def move_volume_mapping_via_symbol(self, map_ref, to_ref, lun_id):
        """Moves a map from one host/host_group object to another."""

        path = "/storage-systems/{system-id}/symbol/moveLUNMapping"
        data = {'lunMappingRef': map_ref,
                'lun': int(lun_id),
                'mapRef': to_ref}
        return_code = self._invoke('POST', path, data)
        if return_code == 'ok':
            return {'lun': lun_id}
        msg = _("Failed to move LUN mapping.  Return code: %s") % return_code
        raise exception.NetAppDriverException(msg)

    def list_hardware_inventory(self):
        """Lists objects in the hardware inventory."""
        path = "/storage-systems/{system-id}/hardware-inventory"
        return self._invoke('GET', path)

    def list_target_wwpns(self):
        """Lists the world-wide port names of the target."""
        inventory = self.list_hardware_inventory()
        fc_ports = inventory.get("fibrePorts", [])
        wwpns = [port['portName'] for port in fc_ports]
        return wwpns

    def create_host_group(self, label):
        """Creates a host group on the array."""
        path = "/storage-systems/{system-id}/host-groups"
        data = {'name': label}
        return self._invoke('POST', path, data)

    def get_host_group(self, host_group_ref):
        """Gets a single host group from the array."""
        path = "/storage-systems/{system-id}/host-groups/{object-id}"
        try:
            return self._invoke('GET', path, **{'object-id': host_group_ref})
        except exception.NetAppDriverException:
            raise exception.NotFound(_("Host group with ref %s not found") %
                                     host_group_ref)

    def get_host_group_by_name(self, name):
        """Gets a single host group by name from the array."""
        host_groups = self.list_host_groups()
        matching = [host_group for host_group in host_groups
                    if host_group['label'] == name]
        if len(matching):
            return matching[0]
        raise exception.NotFound(_("Host group with name %s not found") % name)

    def list_host_groups(self):
        """Lists host groups on the array."""
        path = "/storage-systems/{system-id}/host-groups"
        return self._invoke('GET', path)

    def list_hosts(self):
        """Lists host objects in the system."""
        path = "/storage-systems/{system-id}/hosts"
        return self._invoke('GET', path)

    def create_host(self, label, host_type, ports=None, group_id=None):
        """Creates host on array."""
        path = "/storage-systems/{system-id}/hosts"
        data = {'name': label, 'hostType': host_type}
        data.setdefault('groupId', group_id if group_id else None)
        data.setdefault('ports', ports if ports else None)
        return self._invoke('POST', path, data)

    def create_host_with_ports(self, label, host_type, port_ids,
                               port_type='iscsi', group_id=None):
        """Creates host on array with given port information."""
        if port_type == 'fc':
            port_ids = [six.text_type(wwpn).replace(':', '')
                        for wwpn in port_ids]
        ports = []
        for port_id in port_ids:
            port_label = utils.convert_uuid_to_es_fmt(uuid.uuid4())
            port = {'type': port_type, 'port': port_id, 'label': port_label}
            ports.append(port)
        return self.create_host(label, host_type, ports, group_id)

    def update_host(self, host_ref, data):
        """Updates host type for a given host."""
        path = "/storage-systems/{system-id}/hosts/{object-id}"
        return self._invoke('POST', path, data, **{'object-id': host_ref})

    def get_host(self, host_ref):
        """Gets a single host from the array."""
        path = "/storage-systems/{system-id}/hosts/{object-id}"
        return self._invoke('GET', path, **{'object-id': host_ref})

    def update_host_type(self, host_ref, host_type):
        """Updates host type for a given host."""
        data = {'hostType': host_type}
        return self.update_host(host_ref, data)

    def set_host_group_for_host(self, host_ref, host_group_ref=utils.NULL_REF):
        """Sets or clears which host group a host is in."""
        data = {'groupId': host_group_ref}
        self.update_host(host_ref, data)

    def list_host_types(self):
        """Lists host types in storage system."""
        path = "/storage-systems/{system-id}/host-types"
        return self._invoke('GET', path)

    def list_snapshot_groups(self):
        """Lists snapshot groups."""
        path = "/storage-systems/{system-id}/snapshot-groups"
        return self._invoke('GET', path)

    def create_snapshot_group(self, label, object_id, storage_pool_id,
                              repo_percent=99, warn_thres=99, auto_del_limit=0,
                              full_policy='failbasewrites'):
        """Creates snapshot group on array."""
        path = "/storage-systems/{system-id}/snapshot-groups"
        data = {'baseMappableObjectId': object_id, 'name': label,
                'storagePoolId': storage_pool_id,
                'repositoryPercentage': repo_percent,
                'warningThreshold': warn_thres,
                'autoDeleteLimit': auto_del_limit, 'fullPolicy': full_policy}
        return self._invoke('POST', path, data)

    def delete_snapshot_group(self, object_id):
        """Deletes given snapshot group from array."""
        path = "/storage-systems/{system-id}/snapshot-groups/{object-id}"
        return self._invoke('DELETE', path, **{'object-id': object_id})

    def create_snapshot_image(self, group_id):
        """Creates snapshot image in snapshot group."""
        path = "/storage-systems/{system-id}/snapshot-images"
        data = {'groupId': group_id}
        return self._invoke('POST', path, data)

    def delete_snapshot_image(self, object_id):
        """Deletes given snapshot image in snapshot group."""
        path = "/storage-systems/{system-id}/snapshot-images/{object-id}"
        return self._invoke('DELETE', path, **{'object-id': object_id})

    def list_snapshot_images(self):
        """Lists snapshot images."""
        path = "/storage-systems/{system-id}/snapshot-images"
        return self._invoke('GET', path)

    def create_snapshot_volume(self, image_id, label, base_object_id,
                               storage_pool_id,
                               repo_percent=99, full_thres=99,
                               view_mode='readOnly'):
        """Creates snapshot volume."""
        path = "/storage-systems/{system-id}/snapshot-volumes"
        data = {'snapshotImageId': image_id, 'fullThreshold': full_thres,
                'storagePoolId': storage_pool_id,
                'name': label, 'viewMode': view_mode,
                'repositoryPercentage': repo_percent,
                'baseMappableObjectId': base_object_id,
                'repositoryPoolId': storage_pool_id}
        return self._invoke('POST', path, data)

    def delete_snapshot_volume(self, object_id):
        """Deletes given snapshot volume."""
        path = "/storage-systems/{system-id}/snapshot-volumes/{object-id}"
        return self._invoke('DELETE', path, **{'object-id': object_id})

    def list_storage_pools(self):
        """Lists storage pools in the array."""
        path = "/storage-systems/{system-id}/storage-pools"
        return self._invoke('GET', path)

    def get_storage_pool(self, volume_group_ref):
        """Get storage pool information from the array."""
        path = "/storage-systems/{system-id}/storage-pools/{object-id}"
        return self._invoke('GET', path, **{'object-id': volume_group_ref})

    def list_drives(self):
        """Lists drives in the array."""
        path = "/storage-systems/{system-id}/drives"
        return self._invoke('GET', path)

    def list_storage_systems(self):
        """Lists managed storage systems registered with web service."""
        path = "/storage-systems"
        return self._invoke('GET', path, use_system=False)

    def list_storage_system(self):
        """List current storage system registered with web service."""
        path = "/storage-systems/{system-id}"
        return self._invoke('GET', path)

    def register_storage_system(self, controller_addresses, password=None,
                                wwn=None):
        """Registers storage system with web service."""
        path = "/storage-systems"
        data = {'controllerAddresses': controller_addresses}
        data.setdefault('wwn', wwn if wwn else None)
        data.setdefault('password', password if password else None)
        return self._invoke('POST', path, data, use_system=False)

    def update_stored_system_password(self, password):
        """Update array password stored on web service."""
        path = "/storage-systems/{system-id}"
        data = {'storedPassword': password}
        return self._invoke('POST', path, data)

    def create_volume_copy_job(self, src_id, tgt_id, priority='priority4',
                               tgt_wrt_protected='true'):
        """Creates a volume copy job."""
        path = "/storage-systems/{system-id}/volume-copy-jobs"
        data = {'sourceId': src_id, 'targetId': tgt_id,
                'copyPriority': priority,
                'targetWriteProtected': tgt_wrt_protected}
        return self._invoke('POST', path, data)

    def control_volume_copy_job(self, obj_id, control='start'):
        """Controls a volume copy job."""
        path = ("/storage-systems/{system-id}/volume-copy-jobs-control"
                "/{object-id}?control={String}")
        return self._invoke('PUT', path, **{'object-id': obj_id,
                                            'String': control})

    def list_vol_copy_job(self, object_id):
        """List volume copy job."""
        path = "/storage-systems/{system-id}/volume-copy-jobs/{object-id}"
        return self._invoke('GET', path, **{'object-id': object_id})

    def delete_vol_copy_job(self, object_id):
        """Delete volume copy job."""
        path = "/storage-systems/{system-id}/volume-copy-jobs/{object-id}"
        return self._invoke('DELETE', path, **{'object-id': object_id})


text:
package com.yofc.odn.admin.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.yofc.odn.admin.dao.StaffDao;
import com.yofc.odn.admin.service.StaffService;
import com.yofc.odn.common.model.Staff;
@Component(value="adminStaffService")
public class StaffServiceImpl implements StaffService {
	private StaffDao staffDao ;

	public StaffDao getStaffDao() {
		return staffDao;
	}

	@Resource(name="adminStaffDao")
	public void setStaffDao(StaffDao staffDao) {
		this.staffDao = staffDao;
	}

	@Override
	public List<Staff> findAllStaff(String keyWords) {
		return this.staffDao.findAllStaff(keyWords);
	}

	@Override
	public int deleteStaff(String keyWords) {
		return this.staffDao.deleteStaff(keyWords);

	}

	@Override
	public Staff findStaffByNo(String keyWords) {
		return this.staffDao.findStaffByNo(keyWords);
	}

	@Override
	public void modify(Staff staff) {
		this.staffDao.modify(staff);

	}

	@Override
	public boolean add(Staff staff) {
		return this.staffDao.add(staff);

	}

	@Override
	public List<Staff> findStaffByNum(String keyWords) {
		return this.staffDao.findStaffByNum(keyWords);
	}

	@Override
	public List<Staff> findStaffByName(String keyWords) {
		return this.staffDao.findStaffByName(keyWords);
	}

	@Override
	public List<Staff> findStaffByRole(String keyWords) {
		return this.staffDao.findStaffByRole(keyWords);
	}

}


text:
%% -*- erlang -*-
%%! -pa ../_build/test/lib/sFractals/ebin ../_build/test/lib/png/ebin
%% assumes running out of _build
%% output ../examples

%%%-------------------------------------------------------------------
%%% @author Duncan Sparrell
%%% @copyright (C) 2015, sFractal Consulting LLC
%%%
%%%-------------------------------------------------------------------

-author("Duncan Sparrell").
-mode(compile).

main(_) ->

    %% example 08c
    %% note 2x deep, 2x wide, 2x high

    %% base config
    {ok, [ ConfigMap | _T ] } = file:consult("../examples/Config/example08c.ecfg"),

    %% create the data and png
    fractalHelpers:makePng(ConfigMap),

    ok.


text:
layout: none
published: true
title: Tiistain 2.11. tunnille läksyt
tags: rub5.1 läksyt
---
1. Kuuntelukoe teemalla Sociala medier (heti tunnin alsusa, 0 p. jos olet myöhässä, ovea ei avata kesken).
2. Lue ja suomenna teksti 3 ja tee siihen liittyvä t. 2 (vain a. kohdat!) kirjasta s. 59.

Jos olit pois, tee työvihkon s. 25 (apua kirjasta s. 147).


text:
package sk.tomsik68.mclauncher.impl.versions.mcdownload;

import sk.tomsik68.mclauncher.api.versions.IVersion;

public final class VersionInheritanceException extends Exception {
    private final IVersion version;

    public VersionInheritanceException(IVersion v) {
        super("This version needs to get inheritance resolved!");
        this.version = v;
    }

    public IVersion getVersion(){ return version; }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2014 iWedia S.A.

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<resources>
    <dimen name="padding_channel_change">3dp</dimen>
    <dimen name="padding_channel_list">50dp</dimen>
    <dimen name="margin_channel_change">50dp</dimen>
    <dimen name="width_channel_change">140dp</dimen>
    <dimen name="height_channel_change">100dp</dimen>
    <dimen name="text_size_channel_change_number">50dp</dimen>
    <dimen name="text_size_channel_change_name">20dp</dimen>
</resources>


text:
using LordJZ.WinAPI;

namespace LordJZ.Presentation
{
    public interface INativeWindowWrapper
    {
        NativeWindow NativeWindow { get; }
    }
}


text:
namespace ChartApp
{
    partial class Main
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
            System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
            System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
            this.sysChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
            this.btnCpu = new System.Windows.Forms.Button();
            this.btnMemory = new System.Windows.Forms.Button();
            this.btnDisk = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.sysChart)).BeginInit();
            this.SuspendLayout();
            //
            // sysChart
            //
            chartArea1.Name = "ChartArea1";
            this.sysChart.ChartAreas.Add(chartArea1);
            this.sysChart.Dock = System.Windows.Forms.DockStyle.Fill;
            legend1.Name = "Legend1";
            this.sysChart.Legends.Add(legend1);
            this.sysChart.Location = new System.Drawing.Point(0, 0);
            this.sysChart.Name = "sysChart";
            series1.ChartArea = "ChartArea1";
            series1.Legend = "Legend1";
            series1.Name = "Series1";
            this.sysChart.Series.Add(series1);
            this.sysChart.Size = new System.Drawing.Size(684, 446);
            this.sysChart.TabIndex = 0;
            this.sysChart.Text = "sysChart";
            //
            // btnCpu
            //
            this.btnCpu.Location = new System.Drawing.Point(562, 274);
            this.btnCpu.Name = "btnCpu";
            this.btnCpu.Size = new System.Drawing.Size(110, 41);
            this.btnCpu.TabIndex = 1;
            this.btnCpu.Text = "CPU (ON)";
            this.btnCpu.UseVisualStyleBackColor = true;
            this.btnCpu.Click += new System.EventHandler(this.btnCpu_Click);
            //
            // btnMemory
            //
            this.btnMemory.Location = new System.Drawing.Point(562, 321);
            this.btnMemory.Name = "btnMemory";
            this.btnMemory.Size = new System.Drawing.Size(110, 41);
            this.btnMemory.TabIndex = 2;
            this.btnMemory.Text = "MEMORY (OFF)";
            this.btnMemory.UseVisualStyleBackColor = true;
            this.btnMemory.Click += new System.EventHandler(this.btnMemory_Click);
            //
            // btnDisk
            //
            this.btnDisk.Location = new System.Drawing.Point(562, 368);
            this.btnDisk.Name = "btnDisk";
            this.btnDisk.Size = new System.Drawing.Size(110, 41);
            this.btnDisk.TabIndex = 3;
            this.btnDisk.Text = "DISK (OFF)";
            this.btnDisk.UseVisualStyleBackColor = true;
            this.btnDisk.Click += new System.EventHandler(this.btnDisk_Click);
            //
            // Main
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(684, 446);
            this.Controls.Add(this.btnDisk);
            this.Controls.Add(this.btnMemory);
            this.Controls.Add(this.btnCpu);
            this.Controls.Add(this.sysChart);
            this.Name = "Main";
            this.Text = "System Metrics";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing);
            this.Load += new System.EventHandler(this.Main_Load);
            ((System.ComponentModel.ISupportInitialize)(this.sysChart)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.DataVisualization.Charting.Chart sysChart;
        private System.Windows.Forms.Button btnCpu;
        private System.Windows.Forms.Button btnMemory;
        private System.Windows.Forms.Button btnDisk;
    }
}


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

angular.module('flowableModeler').controller('FlowableHttpRequestMethodCtrl', [ '$scope', function($scope) {

    if ($scope.property.value == undefined && $scope.property.value == null)
    {
    	   $scope.property.value = 'GET';
    }

    $scope.httpRequestMethodChanged = function() {
        	$scope.updatePropertyInModel($scope.property);
    };
}]);


text:
@interface AdministrationController : BaseViewController

@end


text:
package com.naughtyzombie.dataanalysis.csv;

import com.naughtyzombie.dataanalysis.utils.TextArrayWritable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.hadoop.io.compress.GzipCodec;
import org.apache.hadoop.mapreduce.RecordWriter;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
import org.apache.hadoop.util.ReflectionUtils;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;

public class CSVOutputFormat extends
        TextOutputFormat<TextArrayWritable, NullWritable> {

    public static String CSV_TOKEN_SEPARATOR_CONFIG =
            "csvoutputformat.token.delimiter";

    @Override
    public RecordWriter getRecordWriter(TaskAttemptContext job)
            throws IOException, InterruptedException {
        Configuration conf = job.getConfiguration();
        boolean isCompressed = getCompressOutput(job);
        String
                keyValueSeparator =
                conf.get(CSV_TOKEN_SEPARATOR_CONFIG, ",");
        CompressionCodec codec = null;
        String extension = "";
        if (isCompressed) {
            Class<? extends CompressionCodec> codecClass =
                    getOutputCompressorClass(job, GzipCodec.class);
            codec = ReflectionUtils.newInstance(codecClass, conf);
            extension = codec.getDefaultExtension();
        }
        Path file = getDefaultWorkFile(job, extension);
        FileSystem fs = file.getFileSystem(conf);
        if (!isCompressed) {
            FSDataOutputStream fileOut = fs.create(file, false);
            return new CSVRecordWriter(fileOut,
                    keyValueSeparator);
        } else {
            FSDataOutputStream fileOut = fs.create(file, false);
            return new CSVRecordWriter(
                    new DataOutputStream(codec.createOutputStream(fileOut)),
                    keyValueSeparator);
        }
    }

    protected static class CSVRecordWriter
            extends RecordWriter<TextArrayWritable, NullWritable> {
        private static final String utf8 = "UTF-8";
        private static final byte[] newline;

        static {
            try {
                newline = "\n".getBytes(utf8);
            } catch (UnsupportedEncodingException uee) {
                throw new IllegalArgumentException("can't find " +
                        utf8 +
                        " encoding");
            }
        }

        protected DataOutputStream out;
        private final String csvSeparator;

        public CSVRecordWriter(DataOutputStream
                                       out, String csvSeparator) {
            this.out = out;
            this.csvSeparator = csvSeparator;
        }

        @Override
        public void write(TextArrayWritable key, NullWritable value)
                throws IOException, InterruptedException {
            if (key == null) {
                return;
            }
            boolean first = true;
            for (Writable field : key.get()) {
                writeObject(first, field);
                first = false;
            }
            out.write(newline);
        }

        /**
         * Write the object to the byte stream, handling Text as a special
         * case.
         *
         * @param o the object to print
         * @throws IOException if the write throws, we pass it on
         */
        private void writeObject(boolean first, Writable o) throws IOException {

            if (!first) {
                out.write(csvSeparator.getBytes(utf8));
            }

            boolean encloseQuotes = false;
            if (o.toString().contains(csvSeparator)) {
                encloseQuotes = true;
            }

            if (encloseQuotes) {
                out.write("\"".getBytes(utf8));
            }
            if (o instanceof Text) {
                Text to = (Text) o;
                out.write(to.getBytes(), 0, to.getLength());
            } else {
                out.write(o.toString().getBytes(utf8));
            }
            if (encloseQuotes) {
                out.write("\"".getBytes(utf8));
            }
        }

        public synchronized void close(TaskAttemptContext context)
                throws IOException {
            out.close();
        }
    }

}


text:
class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|
      t.string :name
      t.string :number

      t.timestamps
    end
  end
end


text:
A JavaScript library for popups. (Requires JQuery)

Pictures of the standard popups:


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:ignore="MergeRootFrame">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_gravity="top|center_horizontal"
        android:background="@color/colorPrimary"
        android:gravity="center_vertical"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/iv_back"
            android:layout_width="34dp"
            android:layout_height="34dp"
            android:layout_marginLeft="5dp"
            android:background="@drawable/selector_iv_back" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="学部对比"
            android:textColor="#ffffff"
            android:textSize="20sp" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:padding="8dp">

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center">

            <View
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:background="#9BCC02" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:text="已报到" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center">

            <View
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:background="#FF4445" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:text="未报到" />
        </LinearLayout>

    </LinearLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:text="网上报道"
        android:textSize="16sp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal"
        android:padding="5dp">

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:text="报道率:"
            android:textSize="11sp" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_online_text1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="人文"
                android:textSize="12sp" />

            <TextView
                android:id="@+id/tv_online_percentage1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0%"
                android:textSize="12sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_online_text2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="信息"
                android:textSize="12sp" />

            <TextView
                android:id="@+id/tv_online_percentage2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0%"
                android:textSize="12sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_online_text3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="经济"
                android:textSize="12sp" />

            <TextView
                android:id="@+id/tv_online_percentage3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0%"
                android:textSize="12sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_online_text4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="国交"
                android:textSize="12sp" />

            <TextView
                android:id="@+id/tv_online_percentage4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0%"
                android:textSize="12sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_online_text5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="管理"
                android:textSize="12sp" />

            <TextView
                android:id="@+id/tv_online_percentage5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0%"
                android:textSize="12sp" />
        </LinearLayout>

    </LinearLayout>

    <FrameLayout
        android:id="@+id/container_online"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"></FrameLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:text="现场报道"
        android:textSize="16sp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal"
        android:padding="5dp">

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:text="报道率:"
            android:textSize="11sp" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_live_text1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="人文"
                android:textSize="12sp" />

            <TextView
                android:id="@+id/tv_live_percentage1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0%"
                android:textSize="12sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_live_text2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="信息"
                android:textSize="12sp" />

            <TextView
                android:id="@+id/tv_live_percentage2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0%"
                android:textSize="12sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_live_text3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="经济"
                android:textSize="12sp" />

            <TextView
                android:id="@+id/tv_live_percentage3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0%"
                android:textSize="12sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_live_text4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="国交"
                android:textSize="12sp" />

            <TextView
                android:id="@+id/tv_live_percentage4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0%"
                android:textSize="12sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_live_text5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="管理"
                android:textSize="12sp" />

            <TextView
                android:id="@+id/tv_live_percentage5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0%"
                android:textSize="12sp" />
        </LinearLayout>

    </LinearLayout>

    <FrameLayout
        android:id="@+id/container_live"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"></FrameLayout>
</LinearLayout>


text:
using System.Text.Json;
using Azure.Core;

namespace Azure.ResourceManager.CosmosDB.Models
{
    public partial class SqlDatabaseGetPropertiesOptions
    {
        internal static SqlDatabaseGetPropertiesOptions DeserializeSqlDatabaseGetPropertiesOptions(JsonElement element)
        {
            Optional<int> throughput = default;
            Optional<AutoscaleSettings> autoscaleSettings = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("throughput"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    throughput = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("autoscaleSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value);
                    continue;
                }
            }
            return new SqlDatabaseGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value);
        }
    }
}


text:
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>Cosmos.Logging.Extensions.FreeSql</name>
    </assembly>
    <members>
        <member name="T:Cosmos.Logging.Extensions.FreeSql.Core.DbParam">
            <summary>
            Database Parameter
            </summary>
        </member>
        <member name="M:Cosmos.Logging.Extensions.FreeSql.Core.DbParam.#ctor(System.String,System.Object,System.Data.DbType)">
            <summary>
            Create a new instance of Database parameter
            </summary>
            <param name="name"></param>
            <param name="value"></param>
            <param name="type"></param>
        </member>
        <member name="P:Cosmos.Logging.Extensions.FreeSql.Core.DbParam.ParameterName">
            <summary>
            Parameter name
            </summary>
        </member>
        <member name="P:Cosmos.Logging.Extensions.FreeSql.Core.DbParam.Value">
            <summary>
            Value
            </summary>
        </member>
        <member name="P:Cosmos.Logging.Extensions.FreeSql.Core.DbParam.DbType">
            <summary>
            DbType
            </summary>
        </member>
        <member name="T:Cosmos.Logging.Extensions.FreeSql.Core.EventIdKeys">
            <summary>
            Event Id Keys
            </summary>
        </member>
        <member name="F:Cosmos.Logging.Extensions.FreeSql.Core.EventIdKeys.Executed">
            <summary>
            Executed
            </summary>
        </member>
        <member name="F:Cosmos.Logging.Extensions.FreeSql.Core.EventIdKeys.LongTimeExecuted">
            <summary>
            Long time executed
            </summary>
        </member>
        <member name="F:Cosmos.Logging.Extensions.FreeSql.Core.EventIdKeys.Error">
            <summary>
            Error
            </summary>
        </member>
        <member name="T:Cosmos.Logging.Extensions.FreeSql.Core.FreeSqlInterceptorDescriptor">
            <summary>
            FreeSql interceptor descriptor
            </summary>
        </member>
        <member name="M:Cosmos.Logging.Extensions.FreeSql.Core.FreeSqlInterceptorDescriptor.#ctor(Cosmos.Logging.ILoggingServiceProvider,Microsoft.Extensions.Options.IOptions{Cosmos.Logging.FreeSqlEnricherOptions})">
            <inheritdoc />
        </member>
        <member name="T:Cosmos.Logging.FreeSqlEnricherConfiguration">
            <summary>
            FreeSql enricher configuration
            </summary>
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherConfiguration.#ctor">
            <inheritdoc />
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherConfiguration.BeforeProcessing(Cosmos.Logging.Configurations.ILoggingSinkOptions)">
            <inheritdoc />
        </member>
        <member name="T:Cosmos.Logging.FreeSqlEnricherExtensions">
            <summary>
            Extensions FreeSql enricher
            </summary>
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherExtensions.UseFreeSql(Cosmos.Logging.DatabaseIntegration,System.Action{Cosmos.Logging.FreeSqlEnricherOptions},System.Action{Microsoft.Extensions.Configuration.IConfiguration,Cosmos.Logging.FreeSqlEnricherConfiguration})">
            <summary>
            Use FreeSql for Cosmos Logging
            </summary>
            <param name="integration"></param>
            <param name="settingAct"></param>
            <param name="configAction"></param>
            <returns></returns>
        </member>
        <member name="T:Cosmos.Logging.FreeSqlEnricherOptions">
            <summary>
            FreeSql enricher options
            </summary>
        </member>
        <member name="P:Cosmos.Logging.FreeSqlEnricherOptions.Key">
            <inheritdoc />
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.UseMinimumLevelForType``1(Cosmos.Logging.Events.LogEventLevel)">
            <inheritdoc />
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.UseMinimumLevelForType(System.Type,Cosmos.Logging.Events.LogEventLevel)">
            <inheritdoc />
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.UseMinimumLevelForCategoryName``1(Cosmos.Logging.Events.LogEventLevel)">
            <inheritdoc />
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.UseMinimumLevelForCategoryName(System.Type,Cosmos.Logging.Events.LogEventLevel)">
            <inheritdoc />
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.UseMinimumLevelForCategoryName(System.String,Cosmos.Logging.Events.LogEventLevel)">
            <inheritdoc />
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.UseMinimumLevel(System.Nullable{Cosmos.Logging.Events.LogEventLevel})">
            <inheritdoc />
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.UseAlias(System.String,Cosmos.Logging.Events.LogEventLevel)">
            <inheritdoc />
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.AddExecutingInterceptor(System.Action{FreeSql.Aop.CurdBeforeEventArgs})">
            <summary>
            Add executing interceptor
            </summary>
            <param name="executingInterceptor"></param>
            <returns></returns>
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.AddExecutedInterceptor(System.Action{FreeSql.Aop.CurdAfterEventArgs})">
            <summary>
            Add executed interceptor
            </summary>
            <param name="executedInterceptor"></param>
            <returns></returns>
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.AddErrorInterceptor(System.Action{System.Exception,FreeSql.Aop.CurdAfterEventArgs})">
            <summary>
            Add error interceptor
            </summary>
            <param name="errorInterceptor"></param>
            <returns></returns>
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.UseFilter(System.Func{System.String,Cosmos.Logging.Events.LogEventLevel,System.Boolean})">
            <summary>
            Add filter
            </summary>
            <param name="filter"></param>
            <returns></returns>
            <exception cref="T:System.ArgumentNullException"></exception>
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.EnableDisplayCallerInfo(System.Nullable{System.Boolean})">
            <inheritdoc />
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.EnableDisplayEventIdInfo(System.Nullable{System.Boolean})">
            <inheritdoc />
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.EnableDisplayNewLineEom(System.Nullable{System.Boolean})">
            <inheritdoc />
        </member>
        <member name="M:Cosmos.Logging.FreeSqlEnricherOptions.GetRenderingOptions">
            <inheritdoc />
        </member>
        <member name="T:Cosmos.Logging.FreeSqlExtensions">
            <summary>
            Extensions for FreeSql
            </summary>
        </member>
        <member name="M:Cosmos.Logging.FreeSqlExtensions.UseCosmosLogging``1(``0,Cosmos.Logging.Extensions.FreeSql.Core.FreeSqlInterceptorDescriptor,System.Action{FreeSql.Aop.CurdBeforeEventArgs},System.Func{FreeSql.Aop.CurdAfterEventArgs,System.Object},System.Func{System.Exception,FreeSql.Aop.CurdAfterEventArgs,System.Object},System.Func{System.String,Cosmos.Logging.Events.LogEventLevel,System.Boolean})">
            <summary>
            Use Cosmos Logging for FreeSql
            </summary>
            <param name="freeSql"></param>
            <param name="descriptor"></param>
            <param name="executingAct"></param>
            <param name="executedAct"></param>
            <param name="errorAct"></param>
            <param name="filter"></param>
            <typeparam name="TFreeSql"></typeparam>
            <returns></returns>
        </member>
    </members>
</doc>


text:
<?xml version="1.0" encoding="utf-8"?>

<!-- COMPLETED (1) Create the version of dimens that will be used in landscape mode -->
<resources>
    <dimen name="forecast_detail_horizontal_padding">16dp</dimen>
    <dimen name="forecast_detail_vertical_padding">44dp</dimen>
</resources>


text:
package main

import (
	"bytes"
	"context"
	"crypto/aes"
	"crypto/cipher"
	"database/sql"
	"encoding/base64"
	"encoding/json"
	"errors"
	"io"
	"io/ioutil"
	"net/http"

	"github.com/nicolai86/dash-annotations/dash"
)

var (
	encryptionKey = "1234567812345678"
	// ErrAuthenticationRequired is returned from Authenticated middleware if the session can not be matched to an existing user
	ErrAuthenticationRequired = errors.New("Authentication required")
	// ErrTeamUnknown is returned when a name cannot be matched to the requested team name
	ErrTeamUnknown = errors.New("Unknown team")
	// ErrEntryUnknown is returned if the entry_id cannot be matched to the requested entry_id
	ErrEntryUnknown = errors.New("Unknown entry")
	// ErrMissingEntryID is returned if the entry_id parameter is empty or not present
	ErrMissingEntryID = errors.New("Missing parameter: entry_id")
)

func encrypt(b []byte) ([]byte, error) {
	var block, err = aes.NewCipher([]byte(encryptionKey))

	if err != nil {
		return nil, err
	}

	encrypted := make([]byte, aes.BlockSize+len(b))
	iv := encrypted[:aes.BlockSize]

	encrypter := cipher.NewCFBEncrypter(block, iv)
	encrypter.XORKeyStream(encrypted[aes.BlockSize:], b)

	var encoded = make([]byte, base64.URLEncoding.EncodedLen(len(encrypted)))
	base64.URLEncoding.Encode(encoded, encrypted)

	return encoded, nil
}

func decrypt(encrypted []byte) ([]byte, error) {
	var decoded = make([]byte, base64.URLEncoding.DecodedLen(len(encrypted)))
	var n, _ = base64.URLEncoding.Decode(decoded, encrypted)
	encrypted = decoded[:n]

	var block, err = aes.NewCipher([]byte(encryptionKey))

	if err != nil {
		return nil, err
	}

	iv := encrypted[:aes.BlockSize]

	encrypted = encrypted[aes.BlockSize:]

	decrypter := cipher.NewCFBDecrypter(block, iv)

	decrypted := make([]byte, len(encrypted))
	decrypter.XORKeyStream(decrypted, encrypted)

	return decrypted, nil
}

// NewRootContext returns a context with the database set. This serves as the root
// context for all other contexts
func NewRootContext(db *sql.DB) context.Context {
	return context.WithValue(context.Background(), DBKey, db)
}

// ContextHandler allows http Handlers to includea context
type ContextHandler interface {
	ServeHTTPContext(context.Context, http.ResponseWriter, *http.Request) error
}

// ContextHandlerFunc defines a function that implements the ContextHandler interface
type ContextHandlerFunc func(context.Context, http.ResponseWriter, *http.Request) error

// ServeHTTPContext calls the ContextHandlerFunc with the given context, ResponseWrite and Request
func (h ContextHandlerFunc) ServeHTTPContext(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {
	return h(ctx, rw, req)
}

// The key type is unexported to prevent collisions with context keys defined in
// other packages.
type key int

// UserKey is used to fetch the current user from a context
const UserKey key = 0

// UserStoreKey is used to fetch a the user storage
const UserStoreKey key = 10

// DBKey is used to fetch the database connection from a context
const DBKey key = 1

// TeamKey is used to fetch the current team from a context
const TeamKey key = 2

// EntryKey is used to fetch the current entry from a context
const EntryKey key = 3

type withEntryPayload struct {
	EntryID int `json:"entry_id"`
}

func findEntryByID(db *sql.DB, entryID int) (dash.Entry, error) {
	var entry = dash.Entry{
		ID: entryID,
	}
	var err = db.QueryRow(`SELECT
				e.title,
				e.type,
				e.anchor,
				e.body,
				e.body_rendered,
				e.score,
				e.user_id,
				e.removed_from_public,
				e.public,
				u.username
			FROM entries AS e
			INNER JOIN users AS u ON u.id = e.user_id
			WHERE e.id = ?`, entryID,
	).Scan(
		&entry.Title,
		&entry.Type,
		&entry.Anchor,
		&entry.Body,
		&entry.BodyRendered,
		&entry.Score,
		&entry.UserID,
		&entry.RemovedFromPublic,
		&entry.Public,
		&entry.AuthorUsername)
	if err != nil {
		return entry, err
	}

	var rows *sql.Rows
	rows, err = db.Query(`select t.name FROM teams AS t inner join entry_team ON t.id = entry_team.team_id where entry_team.entry_id = ?`, entryID)
	if err != nil {
		return entry, err
	}
	defer rows.Close()
	entry.Teams = make([]string, 0)

	for rows.Next() {
		var teamName string
		if err := rows.Scan(&teamName); err != nil {
			return entry, err
		}
		entry.Teams = append(entry.Teams, teamName)
	}

	return entry, err
}

// WithEntry is a middleware that extracts an entry from the given payload and
// adds it to the request context.
// The entry is searched by id, using the entry_id parameter
// If no entry was found the request is halted
func WithEntry(h ContextHandler) ContextHandler {
	return ContextHandlerFunc(func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {
		var db = ctx.Value(DBKey).(*sql.DB)

		var body bytes.Buffer
		var dec = json.NewDecoder(io.TeeReader(req.Body, &body))
		req.Body = ioutil.NopCloser(&body)

		var payload withEntryPayload
		dec.Decode(&payload)

		if payload.EntryID == 0 {
			return ErrMissingEntryID
		}

		var entry, err = findEntryByID(db, payload.EntryID)
		if err != nil {
			return ErrEntryUnknown
		}

		ctx = context.WithValue(ctx, EntryKey, &entry)
		return h.ServeHTTPContext(ctx, rw, req)
	})
}

type withTeamPayload struct {
	TeamName string `json:"name"`
}

func findTeamByName(db *sql.DB, teamName string) (dash.Team, error) {
	var team = dash.Team{
		Name: teamName,
	}
	var err = db.QueryRow(`SELECT t.id, t.access_key, tm.user_id FROM teams AS t INNER JOIN team_user AS tm ON tm.team_id = t.id WHERE name = ? AND tm.role = ? LIMIT 1`, teamName, "owner").Scan(&team.ID, &team.EncryptedAccessKey, &team.OwnerID)
	return team, err
}

// WithTeam is a middleware that extracts the team from the given payload and
// adds it to the request context.
// The team is always searched by using the name parameter
// If no team is found the request is halted.
func WithTeam(h ContextHandler) ContextHandler {
	return ContextHandlerFunc(func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {
		var db = ctx.Value(DBKey).(*sql.DB)

		var body bytes.Buffer
		var dec = json.NewDecoder(io.TeeReader(req.Body, &body))
		req.Body = ioutil.NopCloser(&body)

		var payload withTeamPayload
		dec.Decode(&payload)

		if payload.TeamName == "" {
			return ErrMissingTeamName
		}

		var team, err = findTeamByName(db, payload.TeamName)
		if err != nil {
			return ErrTeamUnknown
		}

		ctx = context.WithValue(ctx, TeamKey, &team)
		return h.ServeHTTPContext(ctx, rw, req)
	})
}

// Authenticated is a middleware that checks for authentication in the request
// Authentication is identified using the laravel_session cookie.
// If no authentication is present the request is halted.
func Authenticated(h ContextHandler) ContextHandler {
	return ContextHandlerFunc(func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {
		var db = ctx.Value(DBKey).(*sql.DB)

		var encryptedSessionID = ""
		for _, cookie := range req.Cookies() {
			if cookie.Name == "laravel_session" {
				encryptedSessionID = cookie.Value
			}
		}
		if encryptedSessionID == "" {
			return errors.New("Missing session cookie")
		}
		sessionID, err := decrypt([]byte(encryptedSessionID))
		if err != nil {
			return err
		}

		user, err := findUserByRememberToken(db, string(sessionID))
		if err != nil {
			return ErrAuthenticationRequired
		}
		ctx = context.WithValue(ctx, UserKey, &user)
		ctx = context.WithValue(ctx, UserStoreKey, &sqlUserStorage{db: db})

		return h.ServeHTTPContext(ctx, rw, req)
	})
}

// MaybeAuthenticated is a middleware that tries to authenticate a user by the session.
// If no authentication is present the request continues and the user is not set.
func MaybeAuthenticated(h ContextHandler) ContextHandler {
	return ContextHandlerFunc(func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {
		var db = ctx.Value(DBKey).(*sql.DB)

		var encryptedSessionID = ""
		for _, cookie := range req.Cookies() {
			if cookie.Name == "laravel_session" {
				encryptedSessionID = cookie.Value
			}
		}
		if encryptedSessionID != "" {
			if sessionID, err := decrypt([]byte(encryptedSessionID)); err == nil {
				if user, err := findUserByRememberToken(db, string(sessionID)); err == nil {
					ctx = context.WithValue(ctx, UserKey, &user)
				}
			}
		}

		return h.ServeHTTPContext(ctx, rw, req)
	})
}


text:
<?php

namespace Google\Service\Contentwarehouse;

class AssistantApiNotificationOutputRestrictionsOptOutStateCategoryState extends \Google\Model
{
  /**
   * @var string
   */
  public $category;
  /**
   * @var string
   */
  public $state;

  /**
   * @param string
   */
  public function setCategory($category)
  {
    $this->category = $category;
  }
  /**
   * @return string
   */
  public function getCategory()
  {
    return $this->category;
  }
  /**
   * @param string
   */
  public function setState($state)
  {
    $this->state = $state;
  }
  /**
   * @return string
   */
  public function getState()
  {
    return $this->state;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(AssistantApiNotificationOutputRestrictionsOptOutStateCategoryState::class, 'Google_Service_Contentwarehouse_AssistantApiNotificationOutputRestrictionsOptOutStateCategoryState');


text:
package com.anttoolkit.hbase.tasks.data.util.scan.filter;

import org.apache.hadoop.hbase.filter.*;

import com.anttoolkit.general.tasks.*;

public class ValueFilterConfig extends ComparatorFilterConfig
{
	@Override
	public Filter getFilter(GenericTask task)
	{
		return new ValueFilter(getOperation(), getComparator(task));
	}
}


text:
module Quotex

  class Quote < ActiveRecord::Base

    belongs_to :rfq, :class_name => 'RfqxEmc::Rfq'
    belongs_to :last_updated_by, :class_name => 'Authentify::User'
    belongs_to :dept_head, :class_name => 'Authentify::User'
    belongs_to :corp_head, :class_name => 'Authentify::User'
    has_one :test_plan, :class_name => 'TestItemx::TestPlan'
    has_many :quote_test_items
    has_many :test_items, :through => :quote_test_items
    has_many :invoices

    attr_accessible :rfq_id, :quoted_total, :note, :face_total, :quote_date, :last_updated_by_id, :as => :role_new
    attr_accessible :approved_by_dept_head, :approve_date_dept_head, :dept_head_id,
                    :approved_by_corp_head, :approve_date_corp_head, :corp_head_id,
                    :approved_by_customer, :approve_date_customer, :customer_approver_name,
                    :reason_for_reject, :note, :cancelled, :quote_date, :last_updated_by_id,
                    :as => :role_update
    attr_accessor   :earliest_created_at, :latest_created_at, :sales_id_s, :customer_id_s,
                    :not_approved_by_corp_s, :not_approved_by_customer_s, :rfq_id_s, :cancelled_s, :time_frame,
                    :quoted_total, :face_total, :cancelled, :quote_date
    attr_accessible :earliest_created_at, :latest_created_at, :sales_id_s, :customer_id_s,
                    :not_approved_by_corp_s, :not_approved_by_customer_s, :rfq_id_s, :cancelled_s, :time_frame,
                    :as => :role_search

    validates :rfq_id, :presence => true
    validates_presence_of :customer_approver_name, :unless => "approved_by_customer.nil?", :message => '输入客户答复人姓名!'
    validates_numericality_of :quoted_total, :greater_than => 0.00
    validates :quote_date, :presence => true

    scope :approved_corp_head, lambda { |t| where('approved_by_corp_head = ?', t) }
    scope :approved_dept_head, lambda { |t| where('approved_by_dept_head = ?', t) }
    scope :approved_customer, lambda { |t| where('approved_by_customer = ?', t) }

    scope :active_quote, where(:cancelled => false)
    scope :cancelled_quote, where(:cancelled => true)

    def find_quotes
      quotes = Quotex::Quote.where("quote_date > ?", 6.years.ago) #.order(:rfq_id)

      quotes = quotes.where("rfq_id = ?", rfq_id_s) if rfq_id_s.present?
      quotes = quotes.where("quote_date >= ?", earliest_created_at) if earliest_created_at.present?
      quotes = quotes.where("quote_date <= ?", latest_created_at) if latest_created_at.present?
      quotes = quotes.where("(approved_by_dept_head = ? OR approved_by_dept_head IS NULL) OR (approved_by_corp_head = ? OR approved_by_corp_head IS NULL)", false, false) if not_approved_by_corp_s.present? && not_approved_by_corp_s == 'false'
      quotes = quotes.where("approved_by_dept_head = ? AND approved_by_corp_head = ?", true, true) if not_approved_by_corp_s.present? && not_approved_by_corp_s == 'true'
      quotes = quotes.where("approved_by_customer = ? OR approved_by_customer IS NULL", false ) if not_approved_by_customer_s.present?  && not_approved_by_customer_s == 'false'
      quotes = quotes.where("approved_by_customer = ?", true ) if not_approved_by_customer_s.present?  && not_approved_by_customer_s == 'true'
      quotes = quotes.where("quotex_quotes.cancelled = ?", true ) if cancelled_s.present?  && cancelled_s == 'true'
      uotes = quotes.where("quotex_quotes.cancelled = ?", false ) if cancelled_s.present?  && cancelled_s == 'false'
      quotes = quotes.joins(:rfq).where("rfqx_emc_rfqs.sales_id = ?", sales_id_s) if sales_id_s.present?
      quotes = quotes.joins(:rfq).where("rfqx_emc_rfqs.customer_id = ?", customer_id_s) if customer_id_s.present?

      quotes
    end

    protected

  end

end


text:
namespace wgt
{
BEGIN_EXPOSE( TestDefinitionObject, MetaNone() )
	EXPOSE( "counter", counter_ )
	EXPOSE( "text", text_ )
	EXPOSE( "functional counter", getCounter, setCounter, MetaNone() )
	EXPOSE( "functional text", getText, setText, MetaNone() )
	EXPOSE( "counter getter", getCounter )
	EXPOSE( "text getter", getText )
	EXPOSE( "raw string", raw_string_ )
	EXPOSE( "string", string_ )
	EXPOSE( "strings", strings_ )
	EXPOSE( "raw wstring", raw_wstring_ )
	EXPOSE( "wstring", wstring_ )
	EXPOSE( "wstrings", wstrings_ )
	EXPOSE( "exposed structure", exposedStruct_ )
	EXPOSE( "exposed structures", exposedStructs_ )
	EXPOSE( "exposed object", exposedObject_ )
	EXPOSE( "exposed objects", exposedObjects_ )
	EXPOSE( "boolean", boolean_ )
	EXPOSE( "booleans", booleans_ )
	EXPOSE( "uint32", uint32_ )
	EXPOSE( "uint32s", uint32s_ )
	EXPOSE( "int32", int32_ )
	EXPOSE( "int32s", int32s_ )
	EXPOSE( "uint64", uint64_ )
	EXPOSE( "uint64s", uint64s_ )
	EXPOSE( "float", float_ )
	EXPOSE( "floats", floats_ )
	EXPOSE( "vector3", vector3_ )
	EXPOSE( "vector3s", vector3s_ )
	EXPOSE( "vector4", vector4_ )
	EXPOSE( "vector4s", vector4s_ )
	EXPOSE( "binary", binary_ )
	EXPOSE( "binaries", binaries_ )
	EXPOSE( "multidimensional", multidimensional_ )
END_EXPOSE()

BEGIN_EXPOSE( TestDefinitionDerivedObject, TestDefinitionObject, MetaNone() )
	EXPOSE( "some integer", someInteger_ )
	EXPOSE( "some float", someFloat_ )
END_EXPOSE()

BEGIN_EXPOSE( TestStructure2, MetaNone() )
	EXPOSE( "name", name_ )
END_EXPOSE()

BEGIN_EXPOSE( TestPolyStruct2, MetaNone() )
	EXPOSE( "name", name_ )
END_EXPOSE()

TestDefinitionFixture::TestDefinitionFixture()
{
	IDefinitionManager & definitionManager = getDefinitionManager();
	REGISTER_DEFINITION( TestStructure2 );
	REGISTER_DEFINITION( TestDefinitionObject );
	REGISTER_DEFINITION( TestDefinitionDerivedObject );
	klass_ = definitionManager.getDefinition< TestDefinitionObject >();
	derived_klass_ = definitionManager.getDefinition< TestDefinitionDerivedObject >();
}

namespace
{
	uint32_t RandomNumber32()
	{
		RefObjectId uid( RefObjectId::generate() );
		return uid.getA() + uid.getB() + uid.getC() + uid.getD();
	}

	uint64_t RandomNumber64()
	{
		RefObjectId uid( RefObjectId::generate() );
		uint64_t a = ( uint64_t ) uid.getA();
		uint64_t b = ( uint64_t ) uid.getB();
		uint64_t c = ( uint64_t ) uid.getC();
		uint64_t d = ( uint64_t ) uid.getD();
		return (a << 32) + (b << 32) + c + d;
	}

	std::string RandomString()
	{
		std::string random( "Random Data: " );
		random += RefObjectId::generate().toString();
		random += RefObjectId::generate().toString();
		random += RefObjectId::generate().toString();
		random += RefObjectId::generate().toString();
		return random;
	}
}

//------------------------------------------------------------------------------
TestDefinitionObject::TestDefinitionObject() :
	counter_( 0 ), raw_string_( "RAW READ-0NLY STR1NG!!!" ),
	raw_wstring_( L"RAW READ-0NLY W1DE STR1NG!!!" ), boolean_( false ),
	uint32_( 0 ), int32_( 0 ), uint64_( 0L ), float_( 0.f )
{
}

//------------------------------------------------------------------------------
bool TestDefinitionObject::operator==( const TestDefinitionObject& tdo ) const
{
	if (counter_ != tdo.counter_)
		return false;

	if (text_ != tdo.text_)
		return false;

	if (std::string(raw_string_) != std::string( tdo.raw_string_ ))
		return false;

	if (string_ != tdo.string_  || strings_ != tdo.strings_)
		return false;

	if (std::wstring( raw_wstring_ ) != std::wstring( tdo.raw_wstring_ ))
		return false;

	if (wstring_ != tdo.wstring_ || wstrings_ != tdo.wstrings_)
		return false;

	if (exposedStruct_ != tdo.exposedStruct_ || exposedStructs_ != tdo.exposedStructs_)
		return false;

	if (!(exposedObject_ == tdo.exposedObject_ && exposedObjects_ == tdo.exposedObjects_))
		return false;

	if (boolean_ != tdo.boolean_ || booleans_ != tdo.booleans_)
		return false;

	if (uint32_ != tdo.uint32_ || uint32s_ != tdo.uint32s_)
		return false;

	if (int32_ != tdo.int32_ || int32s_ != tdo.int32s_)
		return false;

	if (uint64_ != tdo.uint64_ || uint64s_ != tdo.uint64s_)
		return false;

	if (float_ != tdo.float_ || floats_ != tdo.floats_)
		return false;

	if (vector3_ != tdo.vector3_ || vector3s_ != tdo.vector3s_)
		return false;

	if (vector4_ != tdo.vector4_ || vector4s_ != tdo.vector4s_)
		return false;

	if (binary_->compare( *tdo.binary_ ) != 0 || binaries_.size() != tdo.binaries_.size())
		return false;

	auto i = 0u;
	for (; i < binaries_.size() && binaries_[i]->compare( *tdo.binaries_[i] ) == 0; ++i);
	if (i != binaries_.size())
		return false;

	if (multidimensional_ != tdo.multidimensional_)
		return false;

	return true;
}

//------------------------------------------------------------------------------
bool TestDefinitionObject::operator!=( const TestDefinitionObject & tdo ) const
{
	return !operator==( tdo );
}
} // end namespace wgt


text:
""" Retrieve all the publications with authors or co-authors from a particular institute
    in a given month.

    In this example we will find all the publications authored (at least in part) by
    researchers at the Australian National University, Canberra."""

__author__ = "Andy Casey <acasey@mso.anu.edu.au>"

# Standard library
from time import localtime

# Module specific
import ads

if __name__ == "__main__":

    # Let's do it for *last* month
    current_time = localtime()

    # Just grab the last month (there are more Pythonic ways to do this)
    year = current_time.tm_year - 1 if current_time.tm_mon == 1 else current_time.tm_year
    month = current_time.tm_mon - 1 if current_time.tm_mon > 1 else 12

    # The affiliation string to search for
    my_affiliation = '"Australian National University"'

    # Get all the articles
    articles = ads.search(
        affiliation=my_affiliation,
        filter="database:astronomy AND property:refereed",
        dates="{year}/{month}".format(year=year, month=month))

    # ads.search yields a generator, so let's list-ify the articles for multiple use
    articles = list(articles)
    print("There were {0} articles found. Sorting and downloading..".format(len(articles)))

    # Let's do something interesting with the data first
    # We'll sort all the articles by first-authors with our matched affiliation first.
    sorted_articles = sorted(articles,
        key=lambda article: [(my_affiliation.strip('"').lower() in affiliation.lower()) for affiliation in article.aff].index(True))

    # Great! Now let's actually do something real with these articles
    # At Mount Stromlo Observatory (the Research School of Astronomy & Astrophysics within
    # the Australian National University), we have a "monthly papers" board that shows the
    # first page of every paper published by someone at Stromlo within the last month.

    # Let's download each paper for our papers board and save them by their bibliography code.
    [ads.retrieve_article(article, output_filename=article.bibcode + ".pdf") for article in sorted_articles]

    # If we have the pyPdf module installed, let's put together a new PDF file that just has
    # the first page from each article. Otherwise, we'll just finish this example quietly.

    try:
        from pyPdf import PdfFileReader, PdfFileWriter

    except ImportError:
        # Finished!
        _ = ''

    else:
        summary_pdf = PdfFileWriter()

        open_files = []
        for article in sorted_articles:
            filename = article.bibcode + ".pdf"

            if not os.path.exists(filename):
                print("Did not add {filename} to the summary file because it does not exist.".format(filename=filename))
                continue

            with open(filename, "rb") as fp:
                article_pdf = PdfFileReader(fp)

                # Get the first page of the article and append it to
                # our summary PDF
                summary_pdf.addPage(article_pdf.getPage(0))

        # Save the summary PDF
        with open("summary.pdf", "wb") as fp:
            fp.write(summary_pdf)

    finally:
        print("There were {num} articles published by astronomy researchers from the {my_affiliation} last month.".format(
            num=len(articles), my_affiliation=my_affiliation))


text:
package iso20022

// Choice of format for a frequency, for example, the frequency of delivery of a statement.
type Frequency25Choice struct {

	// Frequency expressed as an ISO 20022 code.
	Code *EventFrequency4Code `xml:"Cd"`

	// Frequency expressed as a proprietary code.
	Proprietary *GenericIdentification30 `xml:"Prtry"`
}

func (f *Frequency25Choice) SetCode(value string) {
	f.Code = (*EventFrequency4Code)(&value)
}

func (f *Frequency25Choice) AddProprietary() *GenericIdentification30 {
	f.Proprietary = new(GenericIdentification30)
	return f.Proprietary
}


text:
require 'time'

module RTurk
  class Assignment
    attr_reader :id, :source

    def initialize(id, source = nil)
      @id, @source = id, source
    end

    def bonus_payments
      RTurk::GetBonusPayments(:assignment_id => id).payments
    end

    def approve!(feedback = nil)
      RTurk::ApproveAssignment(:assignment_id => self.id, :feedback => feedback)
    end

    def approve_rejected!(feedback = nil)
      RTurk::ApproveRejectedAssignment(:assignment_id => self.id, :feedback => feedback)
    end

    def reject!(reason)
      RTurk::RejectAssignment(:assignment_id => self.id, :feedback => reason)
    end

    def bonus!(amount, reason)
      RTurk::GrantBonus(:assignment_id => self.id, :worker_id => self.worker_id, :amount => amount, :feedback => reason)
    end

    def worker
      RTurk::Worker.new(self.worker_id)
    end

    def submitted?
      status == 'Submitted'
    end

    def approved?
      status == 'Approved'
    end

    def rejected?
      status == 'Rejected'
    end

    def method_missing(method, *args)
      if self.source.respond_to?(method)
        self.source.send(method, *args)
      else
        super
      end
    end
  end
end


text:
Docs can be found [here](http://obaez.com/dentistsmile-docs/).

Here is a [live Demo](http://obaez.com/dentistsmile/).