text:
<?php

class Md_customer_lead extends MX_Controller {

    var $table = "m_customer";

    public function __construct() {
        parent::__construct();
        $this->load->model(array('M_md_customer_lead' => 'm_md_customer', 'Datatable_model' => 'data_table', 'Main_model'=>'main_model'));
        $this->load->library(array('upload', 'encryption', 'Auth_log'));
        //set breadcrumb
        $this->breadcrumbs->push('Master', '/dasboard');
        $this->breadcrumbs->push('Lead Customer', '/lead-customer');
    }

    public function index() {
        $data['template_title'] = array('Lead Customer', 'List');
        $data['source_lead_customer'] = $this->db->get_where('source_lead_customer',array('source_lead_customer_status'=>'1'))->result_array();
        $data['status_lead_customer'] = $this->db->get_where('status_lead_customer',array('status_lead_customer_status'=>'1'))->result_array();
        $data['view'] = 'md_customer_lead/main';
        $this->load->view('default', $data);
    }

    public function getListTable() {
        $page = ($_POST['page']==0?1:$_POST['page']);
        $limit = $_POST['size'];

        $table = 'm_customer';

        $field = array(
            "m_customer.*",
            "source_lead_customer.source_lead_customer",
            "status_lead_customer.status_lead_customer",
            "province.province_name",
            "city.city_name",
            "district.district_name",
			"m_branch.branch_name",
            "IF(m_customer.customer_status=1,'Active','Not Active') AS status"
        );

        $offset = ($page - 1) * $limit;

        $join = array(
            array('table' => 'source_lead_customer', 'where' => 'source_lead_customer.id=m_customer.id_source_lead_customer', 'join' => 'left'),
            array('table' => 'status_lead_customer', 'where' => 'status_lead_customer.id=m_customer.id_status_lead_customer', 'join' => 'left'),
            array('table' => 'province', 'where' => 'province.province_id=m_customer.customer_province', 'join' => 'left'),
            array('table' => 'city', 'where' => 'city.city_id=m_customer.customer_city', 'join' => 'left'),
            array('table' => 'district', 'where' => 'district.district_id=m_customer.customer_district', 'join' => 'left'),
			array('table' => 'm_branch', 'where' => 'm_branch.id=m_customer.id_branch', 'join' => 'left')
        );

        $like = array(
            'm_customer.customer_code'=>isset($_POST['code'])?$_POST['code']:"",
            'm_customer.customer_name'=>isset($_POST['name'])?$_POST['name']:"",
            'm_customer.customer_clinic'=>isset($_POST['clinic'])?$_POST['clinic']:"",
            'm_customer.customer_address'=>isset($_POST['address'])?$_POST['address']:"",
            'm_customer.customer_district'=>isset($_POST['district'])?$_POST['district']:""
        );
        $array_status = array('m_customer.customer_status !=' => '3','m_customer.current_lead_customer_status'=>'L');
        $array_province = array();
        $array_city = array();
        $array_district = array();
        $array_source_lead = array();
        $array_status_lead = array();

        if(isset($_POST['province']) && $_POST['province'] != "") {
            $array_province = array('m_customer.customer_province'=>$_POST['province']);
        }
        if(isset($_POST['city']) && $_POST['city'] != "") {
            $array_city = array('m_customer.customer_city'=>$_POST['city']);
        }
        if(isset($_POST['district']) && $_POST['district'] != "") {
            $array_district = array('m_customer.customer_district'=>$_POST['district']);
        }
        /*if(isset($_POST['source_lead']) && $_POST['source_lead'] != "") {
            $array_source_lead = array('m_customer.id_source_lead_customer'=>$_POST['source_lead']);
        }
        if(isset($_POST['status_lead']) && $_POST['status_lead'] != "") {
            $array_status_lead = array('m_customer.id_status_lead_customer'=>$_POST['status_lead']);
        }*/

        $where = array_merge_recursive($array_status,$array_province,$array_city,$array_district,$array_source_lead,$array_status_lead);
        if($this->sessionGlobal['super_admin'] == "1") {
            $where['m_customer.id_branch'] = $this->sessionGlobal['id_branch'];
        }

        $sort = array(
            'sort_field' => isset($_POST['sort'])?$_POST['sort']:"m_customer.id",
            'sort_direction' => isset($_POST['sort_dir'])?$_POST['sort_dir']:"desc"
        );

        $limit_row = array(
            'offset' => $offset,
            'limit' => $limit
        );

        $list = $this->m_md_customer->getListTable($field,$table, $join, $like, $where, $sort, $limit_row);

        $total_records = count($this->m_md_customer->getListTable($field,$table, $join, $like, $where, $sort, false));
        $total_pages = ceil($total_records / $limit);
        $output = array(
            "last_page" => ($total_pages==0?1:$total_pages),
            "recordsTotal" => $total_records,
            "data" => $list,
        );
        //output to json format
        echo json_encode($output);
    }

    public function add() {
        $this->breadcrumbs->push('Add', '/lead-customer-add');
        $data['branch'] = $this->db->get_where('m_branch',array('branch_status'=>1))->result_array();
		$data['area'] = $this->db->get_where('m_area',array('area_status'=>1))->result_array();
        $data['code'] = $this->main_model->generate_code('m_customer', $this->config->item('customer_code').'/0','/' , $digit = 5, true,false, $where=array(),'id','id');
        $data['province'] = $this->db->get('province')->result_array();
        //$data['source_lead_customer'] = $this->db->get_where('source_lead_customer',array('source_lead_customer_status'=>1))->result_array();
        //$data['status_lead_customer'] = $this->db->get_where('status_lead_customer',array('status_lead_customer_status'=>1))->result_array();
        $data['view'] = "md_customer_lead/add";
        $this->load->view('default', $data);
    }

    public function edit($id) {
        $this->breadcrumbs->push('Edit', '/lead-customer-edit');
        $data['branch'] = $this->db->get_where('m_branch',array('branch_status'=>1))->result_array();
		$data['area'] = $this->db->get_where('m_area',array('area_status'=>1))->result_array();
        $data['province'] = $this->db->get('province')->result_array();
        //$data['source_lead_customer'] = $this->db->get_where('source_lead_customer',array('source_lead_customer_status'=>1))->result_array();
        //$data['status_lead_customer'] = $this->db->get_where('status_lead_customer',array('status_lead_customer_status'=>1))->result_array();
        $data['data'] = $this->db->get_where($this->table, array('id' => $id))->row_array();
        $data['view'] = 'md_customer_lead/edit';
        $this->load->view('default', $data);
    }

    function delete($id) {
        if ($this->db->update($this->table, array('customer_status' => 3),array('id'=>$id))) {
            $this->session->set_flashdata('success', 'Data Berhasil Di Hapus !');
        } else {
            $this->session->set_flashdata('error', 'Data Gagal Di Hapus !');
        }
        redirect("customer");
    }

    function save() {
        //var_dump(serialize($_POST['menu']));die;
        if ($_POST) {
            if ($this->m_md_customer->save()) {
                $this->session->set_flashdata('success', 'Data Berhasil Di Simpan !');
            } else {
                $this->session->set_flashdata('error', 'Data Gagal Di Simpan !');
            }
            redirect("lead-customer");
        } else {
            show_404();
        }
    }

    public function getProvinceList() {
        $q = $this->input->get('query');
        $where = array();
        $like = array('province_name'=>$q);
        $result = $this->main_model->getTypeaheadList('province',$like,$where);
        echo json_encode($result);
    }

    public function getCityList() {
        $where = array();
        if($this->input->get('id') != null){
            $where = array('province_id'=>$this->input->get('id'));
        }
        $like = array();
        if($this->input->get('query') != null){
            $like = array('city_name'=>$this->input->get('query'));
        }
        $result = $this->main_model->getTypeaheadList('city',$like,$where);
        echo json_encode($result);
    }

    public function getDistrictList() {
        $where = array();
        if($this->input->get('id') != null){
            $where = array('city_id'=>$this->input->get('id'));
        }
        $like = array();
        if($this->input->get('query') != null){
            $like = array('district_name'=>$this->input->get('query'));
        }
        $result = $this->main_model->getTypeaheadList('district',$like,$where);
        echo json_encode($result);
    }

    public function print_pdf() {
        $data['template'] = array("template" => "md_customer/" . $_GET['template'], "filename" => $_GET['name']);
        $data['list'] = $this->db->get($this->table)->result_array();
        $this->printpdf->create_pdf($data);
    }

    public function print_excel() {
		$table = 'm_customer';

        $field = array(
            "m_customer.*",
            "source_lead_customer.source_lead_customer",
            "status_lead_customer.status_lead_customer",
            "province.province_name",
            "city.city_name",
            "district.district_name",
			"m_branch.branch_name",
            "IF(m_customer.customer_status=1,'Active','Not Active') AS status"
        );
        $join = array(
            array('table' => 'source_lead_customer', 'where' => 'source_lead_customer.id=m_customer.id_source_lead_customer', 'join' => 'left'),
            array('table' => 'status_lead_customer', 'where' => 'status_lead_customer.id=m_customer.id_status_lead_customer', 'join' => 'left'),
            array('table' => 'province', 'where' => 'province.province_id=m_customer.customer_province', 'join' => 'left'),
            array('table' => 'city', 'where' => 'city.city_id=m_customer.customer_city', 'join' => 'left'),
            array('table' => 'district', 'where' => 'district.district_id=m_customer.customer_district', 'join' => 'left'),
			array('table' => 'm_branch', 'where' => 'm_branch.id=m_customer.id_branch', 'join' => 'left')
        );
        $like = array();
        $where = array('m_customer.customer_status !=' => '3','m_customer.current_lead_customer_status'=>'L');
		if($this->sessionGlobal['super_admin'] == "1") {
            $where['m_customer.id_branch'] = $this->sessionGlobal['id_branch'];
        }
		$sort = array(
            'sort_field' => isset($_POST['sort'])?$_POST['sort']:"m_customer.customer_name",
            'sort_direction' => isset($_POST['sort_dir'])?$_POST['sort_dir']:"asc"
        );

        $data['list'] = $this->m_md_customer->getListTable($field,$table, $join, $like, $where, $sort, false);
        $data['template_excel'] = "md_customer_lead/table_excel";
        $data['file_name'] = "master_customer_lead";
        $this->load->view('template_excel', $data);
    }

    public function setPriority($id){
        $this->db->update('m_customer',array('customer_as_priority'=>'true'),array('id'=>$id));
        return true;
    }

    public function undoPriority($id){
        $this->db->update('m_customer',array('customer_as_priority'=>'false'),array('id'=>$id));
        return true;
    }

    public function setAsPriority($id){
        $data = $this->db->get_where('m_customer',array('id'=>$id))->row_array();
        $this->db->update('m_customer',array('current_lead_customer_status'=>'C', 'id_group_customer_product' => 1, 'id_status_list_customer' => 1,'customer_code'=>  str_replace('CST/0/', 'CST/1/', $data['customer_code'])),array('id'=>$id));
        return true;
    }
}


text:
var fs   = require('fs');
var path = require('path');

var Busboy   = require('busboy');

var config = require('../config/config');
var User = require('../models/user');

var controllers = {
    // controller for client
    index: function(req, res, next) {
        'use strict';

        User.count({}, function(err, count) {
            if (err) {
                return next(err);
            }

            res.render('index', {
                adminPath: config.adminPath,
                apiPath: config.apiPath,
                installed: !!count
            });
        });
    },

    // Upload route
    // URL:    /admin/upload
    // Method: POST
    upload: function(req, res) {
        'use strict';

        var busboy = new Busboy({headers: req.headers});
        var fileName;

        busboy.on('file', function(fieldname, file, filename) {
            var newName = (new Date()).getTime() + '-' + filename;
            fileName = path.join('/img', newName);
            var dir = path.join(__dirname, '../../..', 'content/images', newName);
            file.pipe(fs.createWriteStream(dir));
        });

        busboy.on('finish', function() {
            res.send(fileName);
        });

        return req.pipe(busboy);
    }
};

module.exports = controllers;

redpajama_set_name: RedPajamaGithub


text:
<?php

declare(strict_types=1);

namespace Rxnet\EventStore\Communication\Type;

use Rxnet\EventStore\Communication\Communicable;
use Rxnet\EventStore\Data\NotHandled;
use Rxnet\EventStore\Data\NotHandled\MasterInfo;
use Rxnet\EventStore\Message\MessageType;
use Rxnet\EventStore\Message\SocketMessage;

final class NotHandledHandler implements Communicable
{
    public function handle(
        MessageType $messageType,
        string $correlationID,
        string $data
    ): SocketMessage {
        $dataObject = new NotHandled();
        $dataObject->mergeFromString($data);

        if ($dataObject->getReason() == 2) {
            $additional_info = $dataObject->getAdditionalInfo();
            $dataObject = new MasterInfo();
            $dataObject->mergeFromString($additional_info);
        }

        return new SocketMessage($messageType, $correlationID, $dataObject);
    }
}


text:
package com.bueno.controller;

import static com.fastsql.sql.expression.LogicalComparisonExpression.attribute;

import java.util.List;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletRequest;

import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.Result;
import br.com.caelum.vraptor.ioc.RequestScoped;

import com.bueno.component.pagina.model.Pagina;
import com.bueno.component.pagina.model.PaginaTipoEnum;
import com.bueno.component.pagina.model.Paginacao;
import com.bueno.component.pagina.model.PaginacaoUtil;
import com.fastsql.sql.builder.SqlTool;

@Resource
@RequestScoped
@Path("/artigo")
public class ArtigoController extends GenericController<Pagina>{

	private final Result result;
	private final HttpServletRequest request;

	public ArtigoController(Result result, HttpServletRequest request) {
		super(result);
		this.result = result;
		this.request = request;
	}

	@Override
	@Path("{id}/view")
	public void view(String id) {
		try {
			Pagina entidade = new Pagina();
			entidade = SqlTool.getInstance().select(Pagina.class)
							.where(attribute("tituloResumido").equals(id))
							.execute(entidade)
							.getUniqueResult();
			System.out.println("Buscando Paginas associadas");
			initPaginacao(entidade, 1);
			this.result.include("item", entidade);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Path("{id}/view/page/{page}")
	public void view(String id, int page) {
		try {
			Pagina entidade = new Pagina();
			entidade = SqlTool.getInstance().select(Pagina.class)
							.where(attribute("tituloResumido").equals(id))
							.execute(entidade)
							.getUniqueResult();
			initPaginacao(entidade, page);
			this.result.include("item", entidade);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private void initPaginacao(Pagina entidade, int page) throws Exception{
		HttpSession session = this.request.getSession();
		if(PaginaTipoEnum.SUBPAGINA.equals(entidade.getTipo())){
			List<Paginacao> paginacao = (List<Paginacao>) session.getAttribute("paginacao");
			PaginacaoUtil.active(paginacao, page);
			session.setAttribute("paginacaoPrev", PaginacaoUtil.getPrev(paginacao));
			session.setAttribute("paginacaoNext", PaginacaoUtil.getNext(paginacao));
			return;
		}

		List<Pagina> paginasAssociadas = SqlTool.getInstance().select(Pagina.class).where(attribute("pai").equals(entidade.getIdPagina())).execute(entidade).getResult();
		List<Paginacao> paginacao = Paginacao.factory(entidade, paginasAssociadas);
		PaginacaoUtil.order(paginacao);
		PaginacaoUtil.active(paginacao, page);
		if(paginacao.size()<=0){
			paginacao = null;
		}

		session.setAttribute("paginacaoPrev", PaginacaoUtil.getPrev(paginacao));
		session.setAttribute("paginacaoNext", PaginacaoUtil.getNext(paginacao));
		session.setAttribute("paginacao", paginacao);
	}

}


text:
namespace T3000.Utilities
{
    using System;
    using System.Drawing;
    using System.Windows.Forms;
    using System.Globalization;
    using System.Threading;
    using System.ComponentModel;

    public static class RuntimeLocalizer
    {
        public static void ChangeCulture(Form form, string cultureCode)
        {
            var culture = CultureInfo.GetCultureInfo(cultureCode);

            Thread.CurrentThread.CurrentUICulture = culture;

            var resources = new ComponentResourceManager(form.GetType());

            ApplyResourceToControl(resources, form, culture);
            resources.ApplyResources(form, "$this", culture);

            //Show font dialog for Unix + Chinese language
            if (Environment.OSVersion.Platform != PlatformID.Win32NT &&
                cultureCode.StartsWith("zh"))
            {
                var font = SystemFonts.GetFontByName("AR PL UMing CN");
                if (font == null)
                {
                    var dialog = new FontDialog();
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        form.Font = dialog.Font;
                    }
                }
                else
                {
                    form.Font = font;
                }
                foreach (Control control in form.Controls)
                {
                    control.Font = form.Font;
                }
            }
        }

        private static void ApplyResourceToControl(ComponentResourceManager manager, Control control, CultureInfo info)
        {
            var type = control.GetType();
            // See if this is a MenuStrip
            if (type == typeof(MenuStrip))
            {
                var strip = (MenuStrip)control;
                ApplyResourceToToolStripItemCollection(strip.Items, manager, info);
            }

            // See if this is a ToolStrip
            if (type == typeof(ToolStrip))
            {
                var strip = (ToolStrip)control;
                ApplyResourceToToolStripItemCollection(strip.Items, manager, info);
            }

            // See if this is a DataGridViewColumn
            if (type == typeof(DataGridView))
            {
                var view = (DataGridView)control;
                foreach (DataGridViewColumn item in view.Columns)
                {
                    manager.ApplyResources(item, item.Name, info);
                }
            }

            // Apply to all sub-controls
            foreach (Control subControl in control.Controls)
            {
                ApplyResourceToControl(manager, subControl, info);
                manager.ApplyResources(subControl, subControl.Name, info);
            }

            // Apply to self
            var enabled = control.Enabled;
            manager.ApplyResources(control, control.Name, info);
            control.Enabled = enabled;
        }

        private static void ApplyResourceToToolStripItemCollection(ToolStripItemCollection collection, ComponentResourceManager manager, CultureInfo info)
        {
            // Apply to all sub items
            foreach (ToolStripItem item in collection)
            {
                var type = item.GetType();
                if (type == typeof(ToolStripMenuItem))
                {
                    var menuItem = (ToolStripMenuItem)item;
                    ApplyResourceToToolStripItemCollection(menuItem.DropDownItems, manager, info);
                }

                var enabled = item.Enabled;
                manager.ApplyResources(item, item.Name, info);
                item.Enabled = enabled;
            }
        }
    }
}


text:
package example18;

public class Customer {
    public Person person;
    public String street;
    public String city;
    public String state;
    public Integer zip;
    public String phone;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <!-- The PullToRefreshExpandableListView replaces a standard ExpandableListView widget. -->

    <com.handmark.pulltorefresh.library.PullToRefreshExpandableListView
        xmlns:ptr="http://schemas.android.com/apk/res-auto"
        android:id="@+id/pull_refresh_expandable_list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        ptr:ptrHeaderBackground="@android:color/darker_gray"
        ptr:ptrHeaderTextColor="@android:color/white"
        ptr:ptrMode="pullDownFromTop" />

</LinearLayout>


text:
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

/* UniforColon.cs --
 * Ars Magna project, http://arsmagna.ru
 * -------------------------------------------------------
 * Status: poor
 */

#region Using directives

using AM.Text;

using JetBrains.Annotations;

#endregion

namespace ManagedIrbis.Pft.Infrastructure.Unifors
{
    //
    // Неописанный UNIFOR, используемый при выводе полных текстов
    // в right_ft.pft

    static class UniforColon
    {
        #region Public methods

        public static void CheckRights
            (
                [NotNull] PftContext context,
                [CanBeNull] PftNode node,
                [CanBeNull] string expression
            )
        {
            if (string.IsNullOrEmpty(expression))
            {
                return;
            }

            string output = "0";
            context.WriteAndSetFlag(node, output);
        }

        #endregion
    }
}


text:
(function() {
    'use strict';

    function maxValidator(ctrl, value, limit) {
        var max = parseFloat(limit);
        var validity = ctrl.$isEmpty(value) || isNaN(max)|| value <= max;
        ctrl.$setValidity('max', validity);
        return value;
    }

    function minValidator(ctrl, value, limit) {
        var min = parseFloat(limit);
        var validity = ctrl.$isEmpty(value) || isNaN(min) || value >= min;
        ctrl.$setValidity('min', validity);
        return value;
    }

    var cnpjPattern = new StringMask('00.000.000\/0000-00');
    var cpfPattern = new StringMask('000.000.000-00');

    function numberViewMask (decimals, decimalDelimiter, thousandsDelimiter) {
        var mask = '#' + thousandsDelimiter + '##0';

        if(decimals > 0) {
            mask += decimalDelimiter;
            for (var i = 0; i < decimals; i++) {
                mask += '0';
            }
        }

        return new StringMask(mask, {
            reverse:true
        });
    }

    function numberModelMask (decimals) {
        var mask = '###0';

        if(decimals > 0) {
            mask += '.';
            for (var i = 0; i < decimals; i++) {
                mask += '0';
            }
        }

        return new StringMask(mask, {
            reverse:true
        });
    }

    function clearDelimitersAndLeadingZeros (value) {
        var cleanValue = value.replace(/^0*/, '');
        cleanValue = cleanValue.replace(/[^0-9]/g, '');
        return cleanValue;
    }

    function preparePercentageToFormatter (value, decimals) {
        return clearDelimitersAndLeadingZeros((parseFloat(value)*100).toFixed(decimals));
    }

    function prepareNumberToFormatter (value, decimals) {
        return clearDelimitersAndLeadingZeros((parseFloat(value)).toFixed(decimals));
    }

    function uiBrCpfMask() {
        function applyCpfMask (value) {
            if(!value) {
                return value;
            }
            var formatedValue = cpfPattern.apply(value);
            return formatedValue.trim().replace(/[^0-9]$/, '');
        }

        return {
            restrict: 'A',
            require: '?ngModel',
            link: function (scope, element, attrs, ctrl) {
                if (!ctrl) {
                    return;
                }

                ctrl.$formatters.push(function(value) {
                    return applyCpfMask(value);
                });

                ctrl.$parsers.push(function(value) {
                    if(!value) {
                        return value;
                    }

                    var actualNumber = value.replace(/[^\d]/g,'');
                    var formatedValue = applyCpfMask(actualNumber);
                    ctrl.$setValidity('cpf', BrV.cpf.validate(formatedValue));

                    if (ctrl.$viewValue !== formatedValue) {
                        ctrl.$setViewValue(formatedValue);
                        ctrl.$render();
                    }

                    return formatedValue.replace(/[^\d]+/g,'');
                });
            }
        };
    }

    function uiBrCnpjMask() {
        function applyCnpjMask (value) {
            if(!value) {
                return value;
            }
            var formatedValue = cnpjPattern.apply(value);
            return formatedValue.trim().replace(/[^0-9]$/, '');
        }
        return {
            restrict: 'A',
            require: '?ngModel',
            link: function (scope, element, attrs, ctrl) {
                if (!ctrl) {
                    return;
                }

                ctrl.$formatters.push(function(value) {
                    return applyCnpjMask(value);
                });

                ctrl.$parsers.push(function(value) {
                    if(!value) {
                        return value;
                    }

                    var actualNumber = value.replace(/[^\d]+/g,'');
                    var formatedValue = applyCnpjMask(actualNumber);
                    ctrl.$setValidity('cnpj', BrV.cnpj.validate(formatedValue));

                    if (ctrl.$viewValue !== formatedValue) {
                        ctrl.$setViewValue(formatedValue);
                        ctrl.$render();
                    }

                    return formatedValue.replace(/[^\d]+/g,'');
                });
            }
        };
    }

    function uiBrCpfCnpjMask() {
        function applyCpfCnpjMask (value) {
            if(!value) {
                return value;
            }
            var formatedValue;
            if (value.length > 11) {
                formatedValue = cnpjPattern.apply(value);
            } else {
                formatedValue = cpfPattern.apply(value);
            }
            return formatedValue.trim().replace(/[^0-9]$/, '');
        }
        return {
            restrict: 'A',
            require: '?ngModel',
            link: function (scope, element, attrs, ctrl) {
                if (!ctrl) {
                    return;
                }

                ctrl.$formatters.push(function(value) {
                    return applyCpfCnpjMask(value);
                });

                ctrl.$parsers.push(function(value) {
                    if(!value) {
                        return value;
                    }
                    var actualNumber = value.replace(/[^\d]+/g,'');

                    var formatedValue = applyCpfCnpjMask(actualNumber);
                    if (actualNumber.length > 11) {
                        ctrl.$setValidity('cnpj', BrV.cnpj.validate(formatedValue));
                        ctrl.$setValidity('cpf', true);
                    } else {
                        ctrl.$setValidity('cpf', BrV.cpf.validate(formatedValue));
                        ctrl.$setValidity('cnpj', true);
                    }

                    if (ctrl.$viewValue !== formatedValue) {
                        ctrl.$setViewValue(formatedValue);
                        ctrl.$render();
                    }

                    return formatedValue.replace(/[^\d]+/g,'');
                });
            }
        };
    }

    angular.module('ui.utils.masks', [])
        .directive('uiPercentageMask', ['$locale', function ($locale) {
            var decimalDelimiter = $locale.NUMBER_FORMATS.DECIMAL_SEP,
                thousandsDelimiter = $locale.NUMBER_FORMATS.GROUP_SEP;

            return {
                restrict: 'A',
                require: '?ngModel',
                scope: {
                    min: '=?min',
                    max: '=?max'
                },
                link: function (scope, element, attrs, ctrl) {
                    if (!ctrl) {
                        return;
                    }

                    var decimals = parseInt(attrs.uiPercentageMask);
                    if(isNaN(decimals)) {
                        decimals = 2;
                    }
                    var numberDecimals = decimals + 2;
                    var viewMask = numberViewMask(decimals, decimalDelimiter, thousandsDelimiter),
                        modelMask = numberModelMask(numberDecimals);

                    ctrl.$formatters.push(function(value) {
                        if(!value) {
                            return ' %';
                        }

                        var valueToFormat = preparePercentageToFormatter(value, decimals);
                        return viewMask.apply(valueToFormat) + ' %';
                    });

                    ctrl.$parsers.push(function(value) {
                        function renderValue(formatedValue) {
                            if (ctrl.$viewValue !== formatedValue) {
                                ctrl.$setViewValue(formatedValue);
                                ctrl.$render();
                            }
                        }
                        if(!value) {
                            renderValue(' %');
                            return value;
                        }

                        var valueToFormat = clearDelimitersAndLeadingZeros(value);
                        if(value && value.indexOf('%') < 0 && valueToFormat.length >= 1) {
                            valueToFormat = valueToFormat.substr(0,valueToFormat.length-1);
                        }
                        var formatedValue = ' %';
                        var actualNumber;
                        if (valueToFormat) {
                            formatedValue = viewMask.apply(valueToFormat) + ' %';
                            actualNumber = parseFloat(modelMask.apply(valueToFormat));
                        }
                        renderValue(formatedValue);

                        return actualNumber;
                    });

                    if(attrs.min){
                        ctrl.$parsers.push(function(value) {
                            return minValidator(ctrl, value, scope.min);
                        });

                        scope.$watch('min', function() {
                            minValidator(ctrl, ctrl.$modelValue, scope.min);
                        });
                    }

                    if(attrs.max) {
                        ctrl.$parsers.push(function(value) {
                            return maxValidator(ctrl, value, scope.max);
                        });

                        scope.$watch('max', function() {
                            maxValidator(ctrl, ctrl.$modelValue, scope.max);
                        });
                    }
                }
            };
        }])
        .directive('uiNumberMask', ['$locale', function ($locale) {
            var decimalDelimiter = $locale.NUMBER_FORMATS.DECIMAL_SEP,
                thousandsDelimiter = $locale.NUMBER_FORMATS.GROUP_SEP;

            return {
                restrict: 'A',
                require: '?ngModel',
                scope: {
                    min: '=?min',
                    max: '=?max'
                },
                link: function (scope, element, attrs, ctrl) {
                    if (!ctrl) {
                        return;
                    }

                    var decimals = parseInt(attrs.uiNumberMask);
                    if(isNaN(decimals)) {
                        decimals = 2;
                    }
                    var viewMask = numberViewMask(decimals, decimalDelimiter, thousandsDelimiter),
                        modelMask = numberModelMask(decimals);

                    ctrl.$formatters.push(function(value) {
                        if(!value) {
                            return value;
                        }

                        var valueToFormat = prepareNumberToFormatter(value, decimals);
                        return viewMask.apply(valueToFormat);
                    });

                    ctrl.$parsers.push(function(value) {
                        if(!value) {
                            return value;
                        }

                        var valueToFormat = clearDelimitersAndLeadingZeros(value);
                        var formatedValue = viewMask.apply(valueToFormat);
                        var actualNumber = parseFloat(modelMask.apply(valueToFormat));

                        if(angular.isDefined(attrs.uiNegativeNumber)){
                            var isNegative = (value[0] === '-'),
                                needsToInvertSign = (value.slice(-1) === '-');

                            //only apply the minus sign if is negative or(exclusive) needs to be negative
                            if(needsToInvertSign ^ isNegative) {
                                actualNumber *= -1;
                                formatedValue = '-' + formatedValue;
                            }
                        }

                        if (ctrl.$viewValue !== formatedValue) {
                            ctrl.$setViewValue(formatedValue);
                            ctrl.$render();
                        }

                        return actualNumber;
                    });

                    if(attrs.min){
                        ctrl.$parsers.push(function(value) {
                            return minValidator(ctrl, value, scope.min);
                        });

                        scope.$watch('min', function() {
                            minValidator(ctrl, ctrl.$modelValue, scope.min);
                        });
                    }

                    if(attrs.max) {
                        ctrl.$parsers.push(function(value) {
                            return maxValidator(ctrl, value, scope.max);
                        });

                        scope.$watch('max', function() {
                            maxValidator(ctrl, ctrl.$modelValue, scope.max);
                        });
                    }
                }
            };
        }])
        .directive('uiBrCpfMask', [uiBrCpfMask])
        .directive('uiBrCnpjMask', [uiBrCnpjMask])
        .directive('uiBrCpfcnpjMask', [uiBrCpfCnpjMask])
        // deprecated: will be removed in the next major version
        .directive('uiCpfMask', [uiBrCpfMask])
        // deprecated: will be removed in the next major version
        .directive('uiCnpjMask', [uiBrCnpjMask])
        // deprecated: will be removed in the next major version
        .directive('uiCpfcnpjMask', [uiBrCpfCnpjMask])
        .directive('uiMoneyMask', ['$locale', function ($locale) {
            var decimalDelimiter = $locale.NUMBER_FORMATS.DECIMAL_SEP;
            var thousandsDelimiter = $locale.NUMBER_FORMATS.GROUP_SEP;
            var currencySym = $locale.NUMBER_FORMATS.CURRENCY_SYM;
            return {
                restrict: 'A',
                require: '?ngModel',
                link: function (scope, element, attrs, ctrl) {
                    if (!ctrl) {
                        return;
                    }

                    var decimals = parseInt(attrs.uiMoneyMask);
                    if(isNaN(decimals)) {
                        decimals = 2;
                    }
                    var decimalsPattern = decimals > 0 ? decimalDelimiter + new Array(decimals + 1).join('0') : '';
                    var maskPattern = currencySym+' #'+thousandsDelimiter+'##0'+decimalsPattern;
                    var moneyMask = new StringMask(maskPattern, {reverse: true});

                    ctrl.$formatters.push(function(value) {
                        if(!value) {
                            return value;
                        }

                        return moneyMask.apply(value.toFixed(decimals).replace(/[^\d]+/g,''));
                    });

                    ctrl.$parsers.push(function(value) {
                        if (!value) {
                            return value;
                        }

                        var actualNumber = value.replace(/[^\d]+/g,'');
                        actualNumber = actualNumber.replace(/^[0]+([1-9])/,'$1');
                        var formatedValue = moneyMask.apply(actualNumber);

                        if (value !== formatedValue) {
                            ctrl.$setViewValue(formatedValue);
                            ctrl.$render();
                        }

                        return parseInt(formatedValue.replace(/[^\d]+/g,''))/Math.pow(10,decimals);
                    });
                }
            };
        }])
        .directive('uiBrPhoneNumber',function() {
            /**
             * FIXME: all numbers will have 9 digits after 2016.
             * see http://portal.embratel.com.br/embratel/9-digito/
             */
            var phoneMask8D = new StringMask('(00) 0000-0000'),
                phoneMask9D = new StringMask('(00) 00000-0000');

            function clearValue (value) {
                if(!value) {
                    return value;
                }

                return value.replace(/[^0-9]/g, '');
            }

            function applyPhoneMask (value) {
                if(!value) {
                    return value;
                }

                var formatedValue;
                if(value.length < 11){
                    formatedValue = phoneMask8D.apply(value);
                }else{
                    formatedValue = phoneMask9D.apply(value);
                }

                return formatedValue.trim().replace(/[^0-9]$/, '');
            }

            return {
                restrict: 'A',
                require: '?ngModel',
                link: function(scope, element, attrs, ctrl) {
                    if (!ctrl) {
                        return;
                    }

                    ctrl.$formatters.push(function(value) {
                        return applyPhoneMask(value);
                    });

                    ctrl.$parsers.push(function(value) {
                        if (!value) {
                            return value;
                        }

                        var cleanValue = clearValue(value);
                        var formatedValue = applyPhoneMask(cleanValue);

                        if (ctrl.$viewValue !== formatedValue) {
                            ctrl.$setViewValue(formatedValue);
                            ctrl.$render();
                        }

                        return clearValue(formatedValue);
                    });
                }
            };
        })
        .directive('uiBrCepMask',function() {
            var cepMask = new StringMask('00000-000');

            function clearValue (value) {
                if(!value) {
                    return value;
                }

                return value.replace(/[^0-9]/g, '');
            }

            function applyCepMask (value, ctrl) {
                if(!value) {
                    return value;
                }
                var processed = cepMask.process(value);
                ctrl.$setValidity('cep', processed.valid);
                var formatedValue = processed.result;
                return formatedValue.trim().replace(/[^0-9]$/, '');
            }

            return {
                restrict: 'A',
                require: '?ngModel',
                link: function(scope, element, attrs, ctrl) {
                    if (!ctrl) {
                        return;
                    }

                    ctrl.$formatters.push(function(value) {
                        return applyCepMask(value, ctrl);
                    });

                    ctrl.$parsers.push(function(value) {
                        if (!value) {
                            return value;
                        }

                        var cleanValue = clearValue(value);
                        var formatedValue = applyCepMask(cleanValue, ctrl);

                        if (ctrl.$viewValue !== formatedValue) {
                            ctrl.$setViewValue(formatedValue);
                            ctrl.$render();
                        }

                        return clearValue(formatedValue);
                    });
                }
            };
        })
        .directive('uiBrIeMask',function() {

            var ieMasks = {
                'AC': [{mask: new StringMask('00.000.000/000-00')}],
                'AL': [{mask: new StringMask('000000000')}],
                'AM': [{mask: new StringMask('00.000.000-0')}],
                'AP': [{mask: new StringMask('000000000')}],
                'BA': [{chars: 8, mask: new StringMask('000000-00')},
                    {mask: new StringMask('0000000-00')}],
                'CE': [{mask: new StringMask('00000000-0')}],
                'DF': [{mask: new StringMask('00000000000-00')}],
                'ES': [{mask: new StringMask('00000000-0')}],
                'GO': [{mask: new StringMask('00.000.000-0')}],
                'MA': [{mask: new StringMask('000000000')}],
                'MG': [{mask: new StringMask('000.000.000/0000')}],
                'MS': [{mask: new StringMask('000000000')}],
                'MT': [{mask: new StringMask('0000000000-0')}],
                'PA': [{mask: new StringMask('00-000000-0')}],
                'PB': [{mask: new StringMask('00000000-0')}],
                'PE': [{chars: 9, mask: new StringMask('0000000-00')},
                    {mask: new StringMask('00.0.000.0000000-0')}],
                'PI': [{mask: new StringMask('000000000')}],
                'PR': [{mask: new StringMask('000.00000-00')}],
                'RJ': [{mask: new StringMask('00.000.00-0')}],
                'RN': [{chars: 9, mask: new StringMask('00.000.000-0')},
                    {mask: new StringMask('00.0.000.000-0')}],
                'RO': [{mask: new StringMask('0000000000000-0')}],
                'RR': [{mask: new StringMask('00000000-0')}],
                'RS': [{mask: new StringMask('000/0000000')}],
                'SC': [{mask: new StringMask('000.000.000')}],
                'SE': [{mask: new StringMask('00000000-0')}],
                'SP': [{mask: new StringMask('000.000.000.000')},
                    {mask: new StringMask('-00000000.0/000')}],
                'TO': [{mask: new StringMask('00000000000')}]
            };

            function clearValue (value) {
                if(!value) {
                    return value;
                }
                return value.replace(/[^0-9]/g, '');
            }

            function getMask(uf, value) {
                if(!uf || !ieMasks[uf]) {
                    return undefined;
                }
                var _uf = uf.toUpperCase();
                if (_uf === 'SP' && /^P/i.test(value)) {
                    return ieMasks.SP[1].mask;
                }
                var masks = ieMasks[uf];
                var i = 0;
                while(masks[i].chars && masks[i].chars < clearValue(value).length && i < masks.length - 1) {
                    i++;
                }
                return masks[i].mask;
            }

            function applyIEMask (value, uf, ctrl) {
                var mask = getMask(uf, value);
                if(!value || !mask) {
                    return value;
                }
                var processed = mask.process(clearValue(value));
                ctrl.$setValidity('ie', BrV.ie(uf).validate(value));
                var formatedValue = processed.result;
                if (uf && uf.toUpperCase() === 'SP' && /^p/i.test(value)) {
                    return 'P'+(formatedValue ? formatedValue.trim().replace(/[^0-9]$/, '') : '');
                }
                return formatedValue.trim().replace(/[^0-9]$/, '');
            }

            return {
                restrict: 'A',
                require: '?ngModel',
                scope: {
                    state: '=uiBrIeMask'
                },
                link: function(scope, element, attrs, ctrl) {
                    if (!ctrl) {
                        return;
                    }

                    scope.$watch('state', function(state) {
                        applyIEMask(ctrl.$viewValue, state, ctrl);
                    });

                    ctrl.$formatters.push(function(value) {
                        return applyIEMask(value, scope.state, ctrl);
                    });

                    ctrl.$parsers.push(function(value) {
                        if (!value) {
                            return value;
                        }

                        var formatedValue = applyIEMask(value, scope.state, ctrl);

                        if (ctrl.$viewValue !== formatedValue) {
                            ctrl.$setViewValue(formatedValue);
                            ctrl.$render();
                        }

                        if (scope.state && scope.state.toUpperCase() === 'SP' && /^p/i.test(value)) {
                            return 'P'+clearValue(formatedValue);
                        }
                        return clearValue(formatedValue);
                    });
                }
            };
        });
})();


text: apache_module 'version'


text:
define([],
    function() {
        'use strict';

        return {
            // Null command
            NULL_COMMAND: 'nullCommand',

            // Snake control commands
            DIRECT_SNAKE_DOWN: 'turnSnakeDown',
            DIRECT_SNAKE_LEFT: 'turnSnakeLeft',
            DIRECT_SNAKE_RIGHT: 'turnSnakeRight',
            DIRECT_SNAKE_UP: 'turnSnakeUp',

            // Game management commands
            TOGGLE_PAUSE: 'togglePause',

            // Menu navigation commands
            NEXT_MENU_ITEM: 'nextMenuItem',
            PREVIOUS_MENU_ITEM: 'previousMenuItem',
            SELECT_MENU_ITEM: 'selectMenuItem',

            // Menu actions commands
            CONTINUE_GAME: 'continueGame',
            NEW_GAME: 'newGame'
        };
    });


text:
<!DOCTYPE html>

<meta charset="UTF-8">
<link href="style.css" type="text/css" rel="stylesheet">
<title>CVTSI2SD—Convert Doubleword Integer to Scalar Double-Precision Floating-Point Value </title>

CVTSI2SD—Convert Doubleword Integer to Scalar Double-Precision Floating-Point Value

Opcode/Instruction
Op /En
64/32 bit Mode Support
CPUID Feature Flag
Description

F2 0F 2A /r CVTSI2SD xmm1, r32/m32
RM
V/V
SSE2
Convert one signed doubleword integer from r32/m32 to one double-precision floating-point value in xmm1.

F2 REX.W 0F 2A /r CVTSI2SD xmm1, r/m64
RM
V/N.E.
SSE2
Convert one signed quadword integer from r/m64 to one double-precision floating-point value in xmm1.

VEX.NDS.128.F2.0F.W0 2A /r VCVTSI2SD xmm1, xmm2, r/m32
RVM
V/V
AVX
Convert one signed doubleword integer from r/m32 to one double-precision floating-point value in xmm1.

VEX.NDS.128.F2.0F.W1 2A /r VCVTSI2SD xmm1, xmm2, r/m64
RVM
V/N.E.1
AVX
Convert one signed quadword integer from r/m64 to one double-precision floating-point value in xmm1.

EVEX.NDS.LIG.F2.0F.W0 2A /r VCVTSI2SD xmm1, xmm2, r/m32
T1S
V/V
AVX512F
Convert one signed doubleword integer from r/m32 to one double-precision floating-point value in xmm1.

EVEX.NDS.LIG.F2.0F.W1 2A /r VCVTSI2SD xmm1, xmm2, r/m64{er}
T1S
V/N.E.1
AVX512F
Convert one signed quadword integer from r/m64 to one double-precision floating-point value in xmm1.

NOTES: 1. VEX.W1/EVEX.W1 in non-64 bit is ignored; the instructions behaves as if the W0 version is used.

Instruction Operand Encoding

Op/En
Operand 1
Operand 2
Operand 3
Operand 4

RM
ModRM:reg (w)
ModRM:r/m (r)
NA
NA

RVM
ModRM:reg (w)
VEX.vvvv
ModRM:r/m (r)
NA

T1S
ModRM:reg (w)
EVEX.vvvv
ModRM:r/m (r)
NA

Description

Converts a signed doubleword integer (or signed quadword integer if operand size is 64 bits) in the "convert-from" source operand to a double-precision floating-point value in the destination operand. The result is stored in the low quadword of the destination operand, and the high quadword left unchanged. When conversion is inexact, the value returned is rounded according to the rounding control bits in the MXCSR register.

The second source operand can be a general-purpose register or a 32/64-bit memory location. The first source and destination operands are XMM registers.

128-bit Legacy SSE version: Use of the REX.W prefix promotes the instruction to 64-bit operands. The "convert-from" source operand (the second operand) is a general-purpose register or memory location. The destination is an XMM register Bits (MAX_VL-1:64) of the corresponding destination register remain unchanged.

VEX.128 and EVEX encoded versions: The "convert-from" source operand (the third operand) can be a general-purpose register or a memory location. The first source and destination operands are XMM registers. Bits (127:64) of the XMM register destination are copied from the corresponding bits in the first source operand. Bits (MAX_VL-1:128) of the destination register are zeroed.

EVEX.W0 version: attempt to encode this instruction with EVEX embedded rounding is ignored.

VEX.W1 and EVEX.W1 versions: promotes the instruction to use 64-bit input value in 64-bit mode.

Software should ensure VCVTSI2SD is encoded with VEX.L=0. Encoding VCVTSI2SD with VEX.L=1 may encounter unpredictable behavior across different processor generations.

Operation

VCVTSI2SD (EVEX encoded version)

IF (SRC2 *is register*) AND (EVEX.b = 1)
    THEN
         SET_RM(EVEX.RC);
    ELSE
         SET_RM(MXCSR.RM);
FI;
IF 64-Bit Mode And OperandSize = 64
THEN
    DEST[63:0] (cid:197) Convert_Integer_To_Double_Precision_Floating_Point(SRC2[63:0]);
ELSE
    DEST[63:0] (cid:197) Convert_Integer_To_Double_Precision_Floating_Point(SRC2[31:0]);
FI;
DEST[127:64] (cid:197) SRC1[127:64]
DEST[MAX_VL-1:128] (cid:197) 0

VCVTSI2SD (VEX.128 encoded version)

IF 64-Bit Mode And OperandSize = 64
THEN
    DEST[63:0] (cid:197)Convert_Integer_To_Double_Precision_Floating_Point(SRC2[63:0]);
ELSE
    DEST[63:0] (cid:197)Convert_Integer_To_Double_Precision_Floating_Point(SRC2[31:0]);
FI;
DEST[127:64] (cid:197)SRC1[127:64]
DEST[MAX_VL-1:128] (cid:197)0

CVTSI2SD

IF 64-Bit Mode And OperandSize = 64
THEN
    DEST[63:0] (cid:197)Convert_Integer_To_Double_Precision_Floating_Point(SRC[63:0]);
ELSE
    DEST[63:0] (cid:197)Convert_Integer_To_Double_Precision_Floating_Point(SRC[31:0]);
FI;
DEST[MAX_VL-1:64] (Unmodified)

Intel C/C++ Compiler Intrinsic Equivalent

VCVTSI2SD __m128d _mm_cvti32_sd(__m128d s, int a);

VCVTSI2SD __m128d _mm_cvt_roundi32_sd(__m128d s, int a, int r);

VCVTSI2SD __m128d _mm_cvti64_sd(__m128d s, __int64 a);

VCVTSI2SD __m128d _mm_cvt_roundi64_sd(__m128d s, __int64 a, int r);

CVTSI2SD __m128d _mm_cvtsi64_sd(__m128d s, __int64 a);

CVTSI2SD __m128d_mm_cvtsi32_sd(__m128d a, int b)

SIMD Floating-Point Exceptions

Precision

Other Exceptions

VEX-encoded instructions, see Exceptions Type 3 if W1, else Type 5.

EVEX-encoded instructions, see Exceptions Type E3NF if W1, else Type E10NF.


text:
package org.jutility.io.database.mysql;

import org.jutility.io.database.ISQLPrivileges;

/**
 * @author Peter J. Radics
 * @version 0.1
 *
 */
public enum MySQLPrivileges
        implements ISQLPrivileges {
    /**
     * SELECT
     */
    SELECT("SELECT"),
    /**
     * INSERT
     */
    INSERT("INSERT"),
    /**
     * UPDATE
     */
    UPDATE("UPDATE"),
    /**
     * DELETE
     */
    DELETE("DELETE"),
    /**
     * EXECUTE
     */
    EXECUTE("EXECUTE"),
    /**
     * SHOW VIEW
     */
    SHOW_VIEW("SHOW VIEW"),
    /**
     * CREATE
     */
    CREATE("CREATE"),
    /**
     * ALTER
     */
    ALTER("ALTER"),
    /**
     * REFERENCES
     */
    REFERENCES("REFERENCES"),
    /**
     * INDEX
     */
    INDEX("INDEX"),
    /**
     * CREATE VIEW
     */
    CREATE_VIEW("CREATE VIEW"),
    /**
     * CREATE ROUTINE
     */
    CREATE_ROUTINE("CREATE ROUTINE"),
    /**
     * ALTER ROUTINE
     */
    ALTER_ROUTINE("ALTER ROUTINE"),
    /**
     * DROP
     */
    DROP("DROP"),
    /**
     * TRIGGER
     */
    TRIGGER("TRIGGER"),
    /**
     * GRANT_OPTION
     */
    GRANT_OPTION("GRANT_OPTION"),
    /**
     * CREATE TEMPORARY TABLES
     */
    CREATE_TEMPORARY_TABLES("CREATE TEMPORARY TABLES"),
    /**
     * LOCK TABLES
     */
    LOCK_TABLES("LOCK TABLES"),
    /**
     * SELECT,INSERT,UPDATE,DELETE,EXECUTE,SHOW VIEW
     */
    ALL_OBJECT_RIGHTS("SELECT,INSERT,UPDATE,DELETE,EXECUTE,SHOW VIEW"),
    /**
     * CREATE,ALTER,REFERENCES,INDEX,CREATE VIEW,CREATE ROUTINE, ALTER
     * ROUTINE,DROP,TRIGGER
     */
    ALL_DDL_RIGHTS("CREATE,ALTER,REFERENCES,INDEX,CREATE VIEW,CREATE ROUTINE,"
            + "ALTER ROUTINE,DROP,TRIGGER"),
    /**
     * GRANT_OPTION,CREATE TEMPORARY TABLES,LOCK TABLES
     */
    ALL_OTHER_RIGHTS("GRANT_OPTION,CREATE TEMPORARY TABLES,LOCK TABLES"),
    /**
     * SELECT,INSERT,UPDATE,DELETE,EXECUTE,SHOW VIEW,CREATE,ALTER,"
     * REFERENCES,INDEX,CREATE VIEW,CREATE ROUTINE,ALTER ROUTINE,DROP,
     * TRIGGER,GRANT_OPTION,CREATE TEMPORARY TABLES,LOCK TABLES
     */
    ALL("SELECT,INSERT,UPDATE,DELETE,EXECUTE,SHOW VIEW,CREATE,ALTER,"
            + "REFERENCES,INDEX,CREATE VIEW,CREATE ROUTINE,ALTER ROUTINE,DROP,"
            + "TRIGGER,GRANT_OPTION,CREATE TEMPORARY TABLES,LOCK TABLES");

    private final String name;

    MySQLPrivileges(String name) {

        this.name = name;
    }

    @Override
    public String toString() {

        return this.name;
    }
}


text:
<title>D - Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Invoking.html#Invoking" title="Invoking">
<link rel="prev" href="alternate.html#alternate" title="alternate">
<link rel="next" href="f.html#f" title="f">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: f,
Previous: alternate,
Up: Invoking

2.3 <samp>-D</samp>

This option has no effect whatsoever, but it is accepted to make it more
likely that scripts written for other assemblers also work with
<samp>as</samp>.


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project

     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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.sunshine.app" >

    <uses-sdk android:minSdkVersion="21"
        android:targetSdkVersion="21" />

    <uses-feature android:name="android.hardware.type.watch" />

    <!-- Required to act as a custom watch face. -->
    <uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name" >

        <service
            android:name=".DigitalWatchFaceService"
            android:label="@string/digital_name"
            android:permission="android.permission.BIND_WALLPAPER" >
            <meta-data
                android:name="android.service.wallpaper"
                android:resource="@xml/watch_face" />
            <meta-data
                android:name="com.google.android.wearable.watchface.preview"
                android:resource="@drawable/preview_digital" />
            <meta-data
                android:name="com.google.android.wearable.watchface.preview_circular"
                android:resource="@drawable/preview_digital_circular" />
            <intent-filter>
                <action android:name="android.service.wallpaper.WallpaperService" />
                <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
            </intent-filter>
        </service>

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

    </application>

</manifest>


text:
title: Have a Single Source of Truth
category: principles
layout: principle
published: true
---

# Description

# External Links
- [Wikipedia Article](http://en.wikipedia.org/wiki/Single_Source_of_Truth)
- [Ted Dziuba's Archived Article](https://web.archive.org/web/20120204171533/http://teddziuba.com/2011/06/most-important-concept-systems-design.html)
- [Art of Unix Programming: SPOT Rule](http://www.catb.org/~esr/writings/taoup/html/ch04s02.html#spot_rule)


text:
#ifdef MYDLL_RELEASE_BUILD
#define TAXI_WINDOW_TITLE "Taksi"
#else
#define TAXI_WINDOW_TITLE "Taksi (debug build)"
#endif
#define CREDITS "About Taksi: Version 0.5 (11/2004) by Juce."
#define MAINLOGFILE "taksi-main.log"

#define LOG(f,x) if (f != NULL) fprintf x

#endif


text:
function QuaternionCurve() {
	if(arguments[0] != "__skip_ptr__") {
		this.__ptr = Polycode.QuaternionCurve()
	}
}

Duktape.fin(QuaternionCurve.prototype, function (x) {
	if (x === QuaternionCurve.prototype) {
		return;
	}
	Polycode.QuaternionCurve__delete(x.__ptr)
})

QuaternionCurve.prototype.interpolate = function(t,useShortestPath) {
	var retVal = new Quaternion("__skip_ptr__")
	retVal.__ptr = Polycode.QuaternionCurve_interpolate(this.__ptr, t, useShortestPath)
	return retVal
}


text:
package com.imooc.dubbo.m1.api.response;

import com.imooc.dubbo.m1.api.enums.StatusCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class BaseResponse<T> implements Serializable {

    private Integer code;
    private String msg;
    private T data;

    public BaseResponse(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public BaseResponse(StatusCode statusCode) {
        this.code = statusCode.getCode();
        this.msg = statusCode.getMsg();
    }
}


text:
"""This script compresses a part of shared library without breaking it.

It compresses the specified file range which will be used by a library's
decompression hook that uses userfaultfd to intercept access attempts to the
range and decompress its data on demand.

Technically this script does the following steps:
  1) Makes a copy of specified range, compresses it and adds it to the binary
    as a new section using objcopy.
  2) Moves the Phdr section to the end of the file to ease next manipulations on
    it.
  3) Creates a LOAD segment for the compressed section created at step 1.
  4) Splits the LOAD segments so the range lives in its own
    LOAD segment.
  5) Cuts the range out of the binary, correcting offsets, broken in the
    process.
  6) Changes cut range LOAD segment by zeroing the file_sz and setting
    mem_sz to the original range size, essentially lazily zeroing the space.
  7) Changes magic bytes provided by the decompression hook to contain
   addresses of cut range and compressed range.
"""

import argparse
import logging
import os
import pathlib
import subprocess
import sys
import tempfile

import compression
import elf_headers

COMPRESSED_SECTION_NAME = '.compressed_library_data'
ADDRESS_ALIGN = 0x1000

CUT_RANGE_BEGIN_MAGIC = bytearray(
    [0x2e, 0x2a, 0xee, 0xf6, 0x45, 0x03, 0xd2, 0x50])
CUT_RANGE_END_MAGIC = bytearray(
    [0x52, 0x40, 0xeb, 0x9d, 0xdb, 0x11, 0xed, 0x1a])
COMPRESSED_RANGE_BEGIN_MAGIC = bytearray(
    [0x5e, 0x49, 0x4a, 0x4c, 0xae, 0x28, 0xc8, 0xbb])
COMPRESSED_RANGE_END_MAGIC = bytearray(
    [0xdd, 0x60, 0xed, 0xcf, 0xc3, 0x29, 0xa6, 0xd6])

# src/third_party/llvm-build/Release+Asserts/bin/llvm-objcopy
OBJCOPY_PATH = pathlib.Path(__file__).resolve().parents[3].joinpath(
    'third_party/llvm-build/Release+Asserts/bin/llvm-objcopy')

def SegmentContains(main_l, main_r, l, r):
  """Returns true if [l, r) is contained inside [main_l, main_r).

  Args:
    main_l: int. Left border of the first segment.
    main_r: int. Right border (exclusive) of the second segment.
    l: int. Left border of the second segment.
    r: int. Right border (exclusive) of the second segment.
  """
  return main_l <= l and main_r >= r

def SegmentsIntersect(l1, r1, l2, r2):
  """Returns true if [l1, r1) intersects with [l2, r2).

  Args:
    l1: int. Left border of the first segment.
    r1: int. Right border (exclusive) of the second segment.
    l2: int. Left border of the second segment.
    r2: int. Right border (exclusive) of the second segment.
  """
  return l2 < r1 and r2 > l1

def AlignUp(addr, page_size=ADDRESS_ALIGN):
  """Rounds up given address to be aligned to page_size.

  Args:
    addr: int. Virtual address to be aligned.
    page_size: int. Page size to be used for the alignment.
  """
  if addr % page_size != 0:
    addr += page_size - (addr % page_size)
  return addr

def AlignDown(addr, page_size=ADDRESS_ALIGN):
  """Round down given address to be aligned to page_size.

  Args:
    addr: int. Virtual address to be aligned.
    page_size: int. Page size to be used for the alignment.
  """
  return addr - addr % page_size

def MatchVaddrAlignment(vaddr, offset, align=ADDRESS_ALIGN):
  """Align vaddr to comply with ELF standard binary alignment.

  Increases vaddr until the following is true:
    vaddr % align == offset % align

  Args:
    vaddr: virtual address to be aligned.
    offset: file offset to be aligned.
    align: alignment value.

  Returns:
    Aligned virtual address, bigger or equal than the vaddr.
  """
  delta = offset % align - vaddr % align
  if delta < 0:
    delta += align
  return vaddr + delta

def _SetupLogging():
  logging.basicConfig(
      format='%(asctime)s %(filename)s:%(lineno)s %(levelname)s] %(message)s',
      datefmt='%H:%M:%S',
      level=logging.ERROR)

def _ParseArguments():
  parser = argparse.ArgumentParser()
  parser.add_argument(
      '-i', '--input', help='Shared library to parse', required=True)
  parser.add_argument(
      '-o', '--output', help='Name of the output file', required=True)
  parser.add_argument(
      '-l',
      '--left_range',
      help='Beginning of the target part of the library',
      type=int,
      required=True)
  parser.add_argument(
      '-r',
      '--right_range',
      help='End (exclusive) of the target part of the library',
      type=int,
      required=True)
  return parser.parse_args()

def _FileRangeToVirtualAddressRange(data, l, r):
  """Returns virtual address range corresponding to given file range.

  Since we have to resolve them by their virtual address, parsing of LOAD
  segments is required here.
  """
  elf = elf_headers.ElfHeader(data)
  for phdr in elf.GetProgramHeadersByType(
      elf_headers.ProgramHeader.Type.PT_LOAD):
    # Current version of the prototype only supports ranges which are fully
    # contained inside one LOAD segment. It should cover most of the common
    # cases.
    if not SegmentsIntersect(phdr.p_offset, phdr.FilePositionEnd(), l, r):
      continue
    if not SegmentContains(phdr.p_offset, phdr.FilePositionEnd(), l, r):
      raise RuntimeError('Range is not contained within one LOAD segment')
    l_virt = phdr.p_vaddr + (l - phdr.p_offset)
    r_virt = phdr.p_vaddr + (r - phdr.p_offset)
    return l_virt, r_virt
  raise RuntimeError('Specified range is outside of all LOAD segments.')

def _CopyRangeIntoCompressedSection(data, l, r):
  """Adds a new section containing compressed version of provided range."""
  compressed_range = compression.CompressData(data[l:r])

  with tempfile.TemporaryDirectory() as tmpdir:
    # The easiest way to add a new section is to use objcopy, but it requires
    # for all of the data to be stored in files.
    objcopy_input_file = os.path.join(tmpdir, 'input')
    objcopy_data_file = os.path.join(tmpdir, 'data')
    objcopy_output_file = os.path.join(tmpdir, 'output')

    with open(objcopy_input_file, 'wb') as f:
      f.write(data)
    with open(objcopy_data_file, 'wb') as f:
      f.write(compressed_range)

    objcopy_args = [
        OBJCOPY_PATH, objcopy_input_file, objcopy_output_file, '--add-section',
        '{}={}'.format(COMPRESSED_SECTION_NAME, objcopy_data_file)
    ]
    run_result = subprocess.run(
        objcopy_args, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
    if run_result.returncode != 0:
      raise RuntimeError('objcopy failed with status code {}: {}'.format(
          run_result.returncode, run_result.stderr))

    with open(objcopy_output_file, 'rb') as f:
      data[:] = bytearray(f.read())

def _FindNewVaddr(phdrs):
  """Returns the virt address that is safe to use for insertion of new data."""
  max_vaddr = 0
  # Strictly speaking it should be sufficient to look through only LOAD
  # segments, but better be safe than sorry.
  for phdr in phdrs:
    max_vaddr = max(max_vaddr, phdr.p_vaddr + phdr.p_memsz)
  # When the mapping occurs end address is increased to be a multiple
  # of page size. To ensure compatibility with anything relying on this
  # behaviour we take this increase into account.
  max_vaddr = AlignUp(max_vaddr)
  return max_vaddr

def _MovePhdrToTheEnd(data):
  """Moves Phdrs to the end of the file and adjusts all references to it."""
  elf_hdr = elf_headers.ElfHeader(data)

  # If program headers are already in the end of the file, nothing to do.
  if elf_hdr.e_phoff + elf_hdr.e_phnum * elf_hdr.e_phentsize == len(data):
    return

  old_phoff = elf_hdr.e_phoff
  new_phoff = elf_hdr.e_phoff = len(data)

  unaligned_new_vaddr = _FindNewVaddr(elf_hdr.GetProgramHeaders())
  new_vaddr = MatchVaddrAlignment(unaligned_new_vaddr, new_phoff)
  # Since we moved the PHDR section to the end of the file, we need to create a
  # new LOAD segment to load it in.
  current_filesize = elf_hdr.e_phnum * elf_hdr.e_phentsize
  # We are using current_filesize while adding new program header due to
  # AddProgramHeader handling the increase of size due to addition of new
  # header.
  elf_hdr.AddProgramHeader(
      elf_headers.ProgramHeader.Create(
          elf_hdr.byte_order,
          p_type=elf_headers.ProgramHeader.Type.PT_LOAD,
          p_flags=elf_headers.ProgramHeader.Flags.PF_R,
          p_offset=new_phoff,
          p_vaddr=new_vaddr,
          p_paddr=new_vaddr,
          p_filesz=current_filesize,
          p_memsz=current_filesize,
          p_align=ADDRESS_ALIGN,
      ))

  # PHDR segment if it exists should point to the new location.
  for phdr in elf_hdr.GetProgramHeadersByType(
      elf_headers.ProgramHeader.Type.PT_PHDR):
    phdr.p_offset = new_phoff
    phdr.p_vaddr = new_vaddr
    phdr.p_paddr = new_vaddr
    phdr.p_align = ADDRESS_ALIGN

  # We need to replace the previous phdr placement with zero bytes to fail
  # fast if dynamic linker doesn't like the new program header.
  previous_phdr_size = (elf_hdr.e_phnum - 1) * elf_hdr.e_phentsize
  data[old_phoff:old_phoff + previous_phdr_size] = [0] * previous_phdr_size

  # Updating ELF header to point to the new location.
  elf_hdr.PatchData(data)

def _CreateLoadForCompressedSection(data):
  """Creates a LOAD segment to previously created COMPRESSED_SECTION_NAME.

  Returns the virtual address range corresponding to created segment."""
  elf_hdr = elf_headers.ElfHeader(data)

  section_offset = None
  section_size = None
  for shdr in elf_hdr.GetSectionHeaders():
    if shdr.GetStrName() == COMPRESSED_SECTION_NAME:
      section_offset = shdr.sh_offset
      section_size = shdr.sh_size
      break
  if section_offset is None:
    raise RuntimeError(
        'Failed to locate {} section in file'.format(COMPRESSED_SECTION_NAME))

  unaligned_new_vaddr = _FindNewVaddr(elf_hdr.GetProgramHeaders())
  new_vaddr = MatchVaddrAlignment(unaligned_new_vaddr, section_offset)
  elf_hdr.AddProgramHeader(
      elf_headers.ProgramHeader.Create(
          elf_hdr.byte_order,
          p_type=elf_headers.ProgramHeader.Type.PT_LOAD,
          p_flags=elf_headers.ProgramHeader.Flags.PF_R,
          p_offset=section_offset,
          p_vaddr=new_vaddr,
          p_paddr=new_vaddr,
          p_filesz=section_size,
          p_memsz=section_size,
          p_align=ADDRESS_ALIGN,
      ))
  elf_hdr.PatchData(data)
  return new_vaddr, new_vaddr + section_size

def _SplitLoadSegmentAndNullifyRange(data, l, r):
  """Find LOAD segment covering [l, r) and splits it into three segments.

  Split is done so one of the LOAD segments contains only [l, r) and nothing
  else. If the range is located at the start or at the end of the segment less
  than three segments may be created.

  The resulting LOAD segment containing [l, r) is edited so it sets the
  corresponding virtual address range to zeroes, ignoring file content.

  Returns virtual address range corresponding to [l, r).
  """
  elf_hdr = elf_headers.ElfHeader(data)

  range_phdr = None
  for phdr in elf_hdr.GetProgramHeadersByType(
      elf_headers.ProgramHeader.Type.PT_LOAD):
    if SegmentContains(phdr.p_offset, phdr.FilePositionEnd(), l, r):
      range_phdr = phdr
      break
  if range_phdr is None:
    raise RuntimeError('No LOAD segment covering the range found')

  # The range_phdr will become the LOAD segment containing the [l, r) range
  # but we need to create the additional two segments.
  left_segment_size = l - range_phdr.p_offset
  if left_segment_size > 0:
    # Creating LOAD segment containing the [phdr.p_offset, l) part.
    elf_hdr.AddProgramHeader(
        elf_headers.ProgramHeader.Create(
            elf_hdr.byte_order,
            p_type=range_phdr.p_type,
            p_flags=range_phdr.p_flags,
            p_offset=range_phdr.p_offset,
            p_vaddr=range_phdr.p_vaddr,
            p_paddr=range_phdr.p_paddr,
            p_filesz=left_segment_size,
            p_memsz=left_segment_size,
            p_align=range_phdr.p_align,
        ))
  if range_phdr.p_offset + range_phdr.p_memsz > r:
    # Creating LOAD segment containing the [r, phdr.p_offset + phdr.p_memsz).
    right_segment_delta = r - range_phdr.p_offset
    right_segment_address = range_phdr.p_vaddr + right_segment_delta
    right_segment_filesize = max(range_phdr.p_filesz - right_segment_delta, 0)
    right_segment_memsize = range_phdr.p_memsz - right_segment_delta
    elf_hdr.AddProgramHeader(
        elf_headers.ProgramHeader.Create(
            elf_hdr.byte_order,
            p_type=range_phdr.p_type,
            p_flags=range_phdr.p_flags,
            p_offset=r,
            p_vaddr=right_segment_address,
            p_paddr=right_segment_address,
            p_filesz=right_segment_filesize,
            p_memsz=right_segment_memsize,
            p_align=range_phdr.p_align,
        ))
  # Modifying the range_phdr
  central_segment_address = range_phdr.p_vaddr + left_segment_size
  range_phdr.p_offset = l
  range_phdr.p_vaddr = central_segment_address
  range_phdr.p_paddr = central_segment_address
  range_phdr.p_filesz = 0
  range_phdr.p_memsz = r - l

  elf_hdr.PatchData(data)
  return central_segment_address, central_segment_address + (r - l)

def _CutRangeAndCorrectFile(data, l, r):
  """Removes [l, r) from the data and fixes offsets to stabilize the ELF."""
  elf = elf_headers.ElfHeader(data)
  # Removing the range from the file:
  del data[l:r]

  range_length = r - l
  for phdr in elf.GetProgramHeaders():
    # Any other program header intersecting the [l, r) range poses serious
    # problem as this header needs to be split if possible. However since we are
    # compressing part of program's code this is highly unlikely, albeit
    # possible in worst case scenario.
    # With that in mind we assert that such thing doesn't happen in our case.
    if SegmentsIntersect(phdr.p_offset, phdr.FilePositionEnd(), l, r):
      raise RuntimeError('Segment intersects with provided range')
    if phdr.p_offset >= r:
      phdr.p_offset -= range_length
    # Per ELF standard: p_offset % p_align == p_vaddr % p_align.
    # Since we moved the p_offset we could have broken this rule.
    # To mitigate this issue we notice the following two facts:
    # 1) range_length % ADDRESS_ALIGN == 0.
    # 2) We can reduce the p_align without breaking the alignment.
    # We reduce all p_align to be less or equal than ADDRESS_ALIGN and now
    # range_length % p_align == 0, so the alignment remains valid.
    # Our changes of p_align are perfectly legal per standard
    # as long as p_align % PAGE_SIZE == 0.
    if phdr.p_align > ADDRESS_ALIGN:
      phdr.p_align = ADDRESS_ALIGN

  for shdr in elf.GetSectionHeaders():
    # Note that if the section overlaps with the cut range we are unable
    # to adjust its size to match both file and virtual size of it. In such
    # case we treat sh_size as memory size and don't adjust it, which may
    # cause some tools treating sh_size as file size to stop working.
    if shdr.sh_offset >= l:
      if shdr.sh_offset < r:
        raise RuntimeError('Section starts within the provided range')
      else:
        shdr.sh_offset -= range_length
  if elf.e_phoff > l:
    elf.e_phoff -= range_length
  if elf.e_shoff > l:
    elf.e_shoff -= range_length
  elf.PatchData(data)

def _PatchConstructorBytes(data, cut_range_virt_l, cut_range_virt_r,
                           compressed_range_virt_l, compressed_range_virt_r):
  """Sets magic bytes given by constructor to the given ranges."""
  elf = elf_headers.ElfHeader(data)

  to_patch = [
      (CUT_RANGE_BEGIN_MAGIC, cut_range_virt_l, 'cut range begin'),
      (CUT_RANGE_END_MAGIC, cut_range_virt_r, 'cut range end'),
      (COMPRESSED_RANGE_BEGIN_MAGIC, compressed_range_virt_l,
       'compressed range begin'),
      (COMPRESSED_RANGE_END_MAGIC, compressed_range_virt_r,
       'compressed range end'),
  ]

  for magic_bytes, new_value, name in to_patch:
    magic_idx = data.find(magic_bytes)
    if magic_idx == -1:
      raise RuntimeError('failed to find %s magic bytes' % name)
    if data.rfind(magic_bytes) != magic_idx:
      raise RuntimeError('%s magic bytes occures more then once' % name)
    new_value_bytes = new_value.to_bytes(length=8, byteorder=elf.byte_order)
    data[magic_idx:magic_idx + 8] = new_value_bytes

def _ShrinkRangeToAlignVirtualAddress(data, l, r):
  virtual_l, virtual_r = _FileRangeToVirtualAddressRange(data, l, r)
  # LOAD segments borders are being rounded to the page size so we have to
  # shrink [l, r) so corresponding virtual addresses are aligned.
  l += AlignUp(virtual_l) - virtual_l
  r -= virtual_r - AlignDown(virtual_r)
  return l, r

def main():
  _SetupLogging()
  args = _ParseArguments()

  with open(args.input, 'rb') as f:
    data = f.read()
    data = bytearray(data)

  left_range, right_range = _ShrinkRangeToAlignVirtualAddress(
      data, args.left_range, args.right_range)
  if left_range >= right_range:
    raise RuntimeError('Range collapsed after aligning by page size')

  _CopyRangeIntoCompressedSection(data, left_range, right_range)
  _MovePhdrToTheEnd(data)

  compressed_virt_l, compressed_virt_r = _CreateLoadForCompressedSection(data)
  virt_l, virt_r = _SplitLoadSegmentAndNullifyRange(data, left_range,
                                                    right_range)
  _CutRangeAndCorrectFile(data, left_range, right_range)
  _PatchConstructorBytes(data, virt_l, virt_r, compressed_virt_l,
                         compressed_virt_r)

  with open(args.output, 'wb') as f:
    f.write(data)
  return 0

if __name__ == '__main__':
  sys.exit(main())


text:
using System;
using ExpenseManager.BusinessLogic.TransactionServices;
using ExpenseManager.BusinessLogic.TransactionServices.Models;
using ExpenseManager.Entity.Enums;
using ExpenseManager.Entity.Providers.Factory;
using NUnit.Framework;

namespace ExpenseManager.BusinessLogic.Test.TransactionTests
{
    [TestFixture]
    internal class TransactionServiceTest
    {
        private readonly TransactionService _transactionService =
            new TransactionService(ProvidersFactory.GetNewBudgetsProviders(),
                ProvidersFactory.GetNewTransactionsProviders(), ProvidersFactory.GetNewWalletsProviders());

        private TransactionServiceModel _model;
        private TransactionServiceModel _repeatableModel;

        [TestFixtureSetUp]
        public void Init()
        {
            this._model = new TransactionServiceModel
            {
                Amount = 50,
                Date = DateTime.Now,
                WalletId = Guid.NewGuid(),
                CurrencyId = Guid.NewGuid(),
                CategoryId = Guid.NewGuid(),
                IsRepeatable = false
            };

            this._repeatableModel = new TransactionServiceModel
            {
                Amount = 50,
                Date = DateTime.Now,
                WalletId = Guid.NewGuid(),
                CurrencyId = Guid.NewGuid(),
                CategoryId = Guid.NewGuid(),
                IsRepeatable = true,
                NextRepeat = 2,
                FrequencyType = FrequencyType.Week,
                LastOccurrence = DateTime.Now.AddDays(30)
            };
        }

        [Test]
        [ExpectedException(typeof (ServiceValidationException))]
        public void Create_Empty_Transaction()
        {
            this._transactionService.Validate(new TransactionServiceModel());
        }

        [Test]
        public void Validate_Good_RepeatableTransaction()
        {
            this._transactionService.Validate(this._repeatableModel);
        }

        [Test]
        public void Validate_Good_Transaction()
        {
            this._transactionService.Validate(this._model);
        }

        [Test]
        [ExpectedException(typeof (ServiceValidationException))]
        public void Validate_NegativeNextRepeat_RepeatableTransaction()
        {
            this._repeatableModel.NextRepeat = -1;
            this._transactionService.Validate(this._repeatableModel);
        }

        [Test]
        public void Validate_NoBudgetId_Transaction()
        {
            this._model.BudgetId = Guid.Empty;
            this._transactionService.Validate(this._model);
        }

        [Test]
        [ExpectedException(typeof (ServiceValidationException))]
        public void Validate_NoCategoryId_Transaction()
        {
            this._model.CategoryId = Guid.Empty;
            this._transactionService.Validate(this._model);
        }

        [Test]
        [ExpectedException(typeof (ServiceValidationException))]
        public void Validate_NoCurrencyId_Transaction()
        {
            this._model.CurrencyId = Guid.Empty;
            this._transactionService.Validate(this._model);
        }

        [Test]
        [ExpectedException(typeof (ServiceValidationException))]
        public void Validate_NoWalletId_Transaction()
        {
            this._model.WalletId = Guid.Empty;
            this._transactionService.Validate(this._model);
        }

        [Test]
        [TestCase(null)]
        [ExpectedException(typeof (ServiceValidationException))]
        public void Validate_NullLastOccurrence_RepeatableTransaction(DateTime? lastOccurrence)
        {
            this._repeatableModel.LastOccurrence = lastOccurrence;
            this._transactionService.Validate(this._repeatableModel);
        }

        [Test]
        [TestCase(null)]
        [ExpectedException(typeof (ServiceValidationException))]
        public void Validate_NullNextRepeat_RepeatableTransaction(int? nextRepeat)
        {
            this._repeatableModel.NextRepeat = nextRepeat;
            this._transactionService.Validate(this._repeatableModel);
        }

        [Test]
        [ExpectedException(typeof (ServiceValidationException))]
        public void Validate_SameLastOccurenceAsDate_RepeatableTransaction()
        {
            this._repeatableModel.LastOccurrence = DateTime.Now;
            this._transactionService.Validate(this._repeatableModel);
        }

        [Test]
        [ExpectedException(typeof (ServiceValidationException))]
        public void Validate_WrongLastOccurence_RepeatableTransaction()
        {
            this._repeatableModel.LastOccurrence = DateTime.Now.AddDays(-3);
            this._transactionService.Validate(this._repeatableModel);
        }

        [Test]
        [ExpectedException(typeof (ServiceValidationException))]
        public void Validate_ZeroNextRepeat_RepeatableTransaction()
        {
            this._repeatableModel.NextRepeat = 0;
            this._transactionService.Validate(this._repeatableModel);
        }

        [Test]
        [TestCase(null)]
        [ExpectedException(typeof (ArgumentNullException))]
        public void ValidateTransaction_Null(TransactionServiceModel serviceModel)
        {
            this._transactionService.Validate(serviceModel);
        }
    }
}


text:
<?php

/**
 * umatic actions.
 *
 * @package    mediaSCORE
 * @subpackage umatic
 * @author     Nouman Tayyab
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class umaticActions extends sfActions {

    /**
     * List all Umatic
     *
     * @param sfWebRequest $request
     */
    public function executeIndex(sfWebRequest $request) {
        $this->umatics = Doctrine_Core::getTable('Umatic')
                ->createQuery('a')
                ->execute();
    }

    /**
     * Umatic detail of specific record
     *
     * @param sfWebRequest $request
     */
    public function executeShow(sfWebRequest $request) {
        $this->umatic = Doctrine_Core::getTable('Umatic')->find(array($request->getParameter('id')));
        $this->forward404Unless($this->umatic);
    }

    /**
     * Umatic form
     *
     * @param sfWebRequest $request
     */
    public function executeNew(sfWebRequest $request) {
        $this->form = new UmaticForm();
    }

    /**
     * Umatic Post form process
     *
     * @param sfWebRequest $request
     */
    public function executeCreate(sfWebRequest $request) {
        $this->forward404Unless($request->isMethod(sfRequest::POST));

        $this->form = new UmaticForm();

        $this->processForm($request, $this->form);

        $this->setTemplate('new');
    }

    /**
     * Umatic edit form
     *
     * @param sfWebRequest $request
     */
    public function executeEdit(sfWebRequest $request) {
        $this->forward404Unless($umatic = Doctrine_Core::getTable('Umatic')->find(array($request->getParameter('id'))), sprintf('Object umatic does not exist (%s).', $request->getParameter('id')));
        $this->form = new UmaticForm($umatic);
    }

    /**
     * Umatic Post edit form process
     *
     * @param sfWebRequest $request
     */
    public function executeUpdate(sfWebRequest $request) {
        $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
        $this->forward404Unless($umatic = Doctrine_Core::getTable('FormatType')->find(array($request->getParameter('id'))), sprintf('Object umatic does not exist (%s).', $request->getParameter('id')));

        $umatic->setType(44);
        $umatic->save();
        $umatic = Doctrine_Core::getTable('Umatic')->find(array($request->getParameter('id')));
        $this->form = new UmaticForm($umatic);

        $validateForm = $this->processForm($request, $this->form);

        if ($validateForm && isset($validateForm['form']) && $validateForm['form'] == true) {
            echo $validateForm['id'];
            exit;
        } else {
            $this->setTemplate('edit');
        }
    }

    /**
     * Umatic Delete form
     *
     * @param sfWebRequest $request
     */
    public function executeDelete(sfWebRequest $request) {
        $request->checkCSRFProtection();

        $this->forward404Unless($umatic = Doctrine_Core::getTable('Umatic')->find(array($request->getParameter('id'))), sprintf('Object umatic does not exist (%s).', $request->getParameter('id')));
        $umatic->delete();

        $this->redirect('umatic/index');
    }

    /**
     * Process and validate form
     *
     * @param sfWebRequest $request
     * @param sfForm $form
     * @return boolean if form is not validated
     * @return integer if form is validated then return id
     */
    protected function processForm(sfWebRequest $request, sfForm $form) {
        $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
        if ($form->isValid()) {
            $umatic = $form->save();
            $saveReturnId = array('form' => true, 'id' => $umatic->getId());
            return $saveReturnId;
        }
        return false;
    }

}


text:
package brownshome.scriptwars.connection;

public class ConnectionException extends Exception {
	ConnectionStatus connectionStatus;

	public ConnectionException(ConnectionStatus connectionStatus, Throwable t) {
		super(t);

		this.connectionStatus = connectionStatus;
	}

	public ConnectionException(ConnectionStatus connectionStatus) {
		this.connectionStatus = connectionStatus;
	}

	public ConnectionStatus getConnectionStatus() {
		return connectionStatus;
	}
}


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Series extends CI_Controller {
	protected $__ISSERVICE__ = false;
	protected $__IS_AUTH__ = false;
	protected $__RULES__ = [
		'index' => [
			'method' => 'GET',
			'security' => false,
			'authorize' => [
            ],
			'data' => [

			]
		]
	];

	public function __construct() {
		parent::__construct();

		$layout_data = [
			'title' => 'Series',
			'categories' => $this->MCategories->getActiveCategories(),
			'populars' => $this->MPublicArticles->getPopular(),
			'javascript' => array(
                // 1 => '/assets/js/vienvong/articles.js'
            )
		];

		// set layout
		$this->load->set_layout('publish_layout.php');
		$this->load->layout($layout_data);

		$template_data = [
			'series' => $this->MSeries->getNewestSeries()
		];

		$this->load->set_template('content_template');
		$this->load->template($template_data);
	}

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see https://codeigniter.com/user_guide/general/urls.html
	 */
	public function index($code, $name, $page = 1)
	{
		$filter = [
			'status' => 1,
			'privacy' => 1,
			'result' => 1,
			'deleted' => 0,
			'series_code' => $code
		];

		$settings = array(
			// 'categories' => $this->MCategories->getDictionaryCategories(),
			'articles' => $this->MPublicArticles->getArticles($filter, $page),
			'pages' => $this->MPublicArticles->countPage($filter),
			'name' => urldecode($name),
		);

		$this->load->render('series/series', $settings);
	}
}


text:
EPHESIANS 4:3

 Morning
9:30 Music

9:40 Song No. 85 and Prayer

9:50 Cherish Your Place in Jehovah's Family

10:05 Symposium: They Made Others Feel Welcome

• Elihu

• Lydia

• Jesus

11:05 Song No. 100 and Announcements

11:15 Keep Helping Others to Become Part of Jehovah's Family

11:30 Dedication and Baptism

12:00 Song No. 135

 Afternoon
1:10 Music

1:20 Song No. 132 and Prayer

1:30 Public Bible Discourse: Is Your Home a Place of Rest and Peace?

2:00 Summary of The Watchtower

2:30 Song No. 136 and Announcements

2:40 Symposium: Be a Force for Peace—How?

• Speak "What Is Good for Building Up"

• 'Walk in Love'

• Resist Our Enemies

3:40 "Never Stop Giving Thanks" for Your Spiritual Family

4:15 Song No. 107 and Prayer


text:
class MyFilesController < ApplicationController

  customer_tab :all
  before_action { @active_tab = "my_files" }
  before_action :authenticate_user!
  # Prevent access while acting as, otherwise the facility staff could get
  # access to other facilities' files.
  before_action :check_acting_as

  def index
    @files = current_user.stored_files
                         .merge(Order.purchased)
                         .order(id: :desc).paginate(page: params[:page])
  end

end