text:
"""
Implementation of LLVM IR instructions.
"""

from __future__ import print_function, absolute_import

from ..six import StringIO
from . import types
from .values import (Block, Function, Value, NamedValue, Constant,
                     MetaDataString, AttributeSet)

class Instruction(NamedValue):
    def __init__(self, parent, typ, opname, operands, name='', flags=()):
        super(Instruction, self).__init__(parent, typ, name=name)
        assert isinstance(parent, Block)
        assert isinstance(flags, (tuple, list))
        self.opname = opname
        self.operands = operands
        self.flags = list(flags)
        self.metadata = {}

    def _stringify_metadata(self):
        if self.metadata:
            buf = [""]
            buf += ["!{0} {1}".format(k, v.get_reference())
                    for k, v in self.metadata.items()]
            return ', '.join(buf)
        else:
            return ''

    @property
    def function(self):
        return self.parent.function

    @property
    def module(self):
        return self.parent.function.module

    def set_metadata(self, name, node):
        self.metadata[name] = node

    def descr(self, buf):
        opname = self.opname
        if self.flags:
            opname = ' '.join([opname] + self.flags)
        operands = ', '.join([op.get_reference() for op in self.operands])
        typ = self.type
        metadata = self._stringify_metadata()
        buf.append("{0} {1} {2}{3}\n"
                   .format(opname, typ, operands, metadata))

    def replace_usage(self, old, new):
        if old in self.operands:
            ops = []
            for op in self.operands:
                ops.append(new if op is old else op)
            self.operands = tuple(ops)

    def __repr__(self):
        return "<ir.%s %r of type '%s', opname %r, operands %r>" % (
            self.__class__.__name__, self.name, self.type,
            self.opname, self.operands)

class CallInstrAttributes(AttributeSet):
    _known = frozenset(['noreturn', 'nounwind', 'readonly', 'readnone'])

class CallInstr(Instruction):
    def __init__(self, parent, func, args, name='', cconv=None, tail=False):
        self.cconv = (func.calling_convention
                      if cconv is None and isinstance(func, Function)
                      else cconv)
        self.tail = tail
        self.attributes = CallInstrAttributes()
        super(CallInstr, self).__init__(parent, func.function_type.return_type,
                                        "call", [func] + list(args), name=name)
        # Validate
        for argno, (arg, exptype) in enumerate(zip(self.args,
                                               self.callee.function_type.args)):
            if arg.type != exptype:
                msg = "Type of #{0} arg mismatch: {1} != {2}"
                raise TypeError(msg.format(1 + argno, exptype, arg.type))

    @property
    def callee(self):
        return self.operands[0]

    @callee.setter
    def callee(self, newcallee):
        self.operands[0] = newcallee

    @property
    def args(self):
        return self.operands[1:]

    def replace_callee(self, newfunc):
        if newfunc.function_type != self.callee.function_type:
            raise TypeError("New function has incompatible type")
        self.callee = newfunc

    @property
    def called_function(self):
        """Alias for llvmpy"""
        return self.callee

    def _descr(self, buf, add_metadata):
        args = ', '.join(['{0} {1}'.format(a.type, a.get_reference())
                          for a in self.args])
        fnty = self.callee.type
        if isinstance(fnty, types.PointerType):
            fnty = fnty.pointee
        callee_ref = "{0} {1}".format(fnty, self.callee.get_reference())
        if self.cconv:
            callee_ref = "{0} {1}".format(self.cconv, callee_ref)
        buf.append("{0}{1} {2}({3}){4}{5}\n".format(
            'tail ' if self.tail else '',
            self.opname,
            callee_ref,
            args,
            ''.join([" " + attr for attr in self.attributes]),
            self._stringify_metadata() if add_metadata else "",
            ))

    def descr(self, buf):
        self._descr(buf, add_metadata=True)

class InvokeInstr(CallInstr):
    def __init__(self, parent, func, args, normal_to, unwind_to, name='', cconv=None):
        assert isinstance(normal_to, Block)
        assert isinstance(unwind_to, Block)
        super(InvokeInstr, self).__init__(parent, func, args, name, cconv)
        self.opname = "invoke"
        self.normal_to = normal_to
        self.unwind_to = unwind_to

    def descr(self, buf):
        super(InvokeInstr, self)._descr(buf, add_metadata=False)
        buf.append("      to label {0} unwind label {1}{metadata}\n".format(
            self.normal_to.get_reference(),
            self.unwind_to.get_reference(),
            metadata=self._stringify_metadata(),
            ))

class Terminator(Instruction):
    def __init__(self, parent, opname, operands):
        super(Terminator, self).__init__(parent, types.VoidType(), opname,
                                         operands)
        self.metadata = {}

    def descr(self, buf):
        opname = self.opname
        operands = ', '.join(["{0} {1}".format(op.type, op.get_reference())
                              for op in self.operands])
        metadata = self._stringify_metadata()
        buf.append("{0} {1}{2}".format(opname, operands, metadata))

class PredictableInstr(Instruction):

    def set_weights(self, weights):
        operands = [MetaDataString(self.module, "branch_weights")]
        for w in weights:
            if w < 0:
                raise ValueError("branch weight must be a positive integer")
            operands.append(Constant(types.IntType(32), w))
        md = self.module.add_metadata(operands)
        self.set_metadata("prof", md)

class Ret(Terminator):
    def __init__(self, parent, opname, return_value=None):
        operands = [return_value] if return_value is not None else []
        super(Ret, self).__init__(parent, opname, operands)

    @property
    def return_value(self):
        if self.operands:
            return self.operands[0]
        else:
            return None

    def descr(self, buf):
        return_value = self.return_value
        if return_value is not None:
            buf.append("{0} {1} {2}\n"
                       .format(self.opname, return_value.type,
                               return_value.get_reference()))
        else:
            buf.append("{0}\n".format(self.opname))

class Branch(Terminator):
    pass

class ConditionalBranch(PredictableInstr, Terminator):
    pass

class IndirectBranch(PredictableInstr, Terminator):
    def __init__(self, parent, opname, addr):
        super(IndirectBranch, self).__init__(parent, opname, [addr])
        self.destinations = []

    @property
    def address(self):
        return self.operands[0]

    def add_destination(self, block):
        assert isinstance(block, Block)
        self.destinations.append(block)

    def descr(self, buf):
        destinations = ["label {0}".format(blk.get_reference())
                        for blk in self.destinations]
        buf.append("indirectbr {0} {1}, [{2}]  {3}\n".format(
            self.address.type,
            self.address.get_reference(),
            ', '.join(destinations),
            self._stringify_metadata(),
            ))

class SwitchInstr(PredictableInstr, Terminator):

    def __init__(self, parent, opname, val, default):
        super(SwitchInstr, self).__init__(parent, opname, [val])
        self.default = default
        self.cases = []

    @property
    def value(self):
        return self.operands[0]

    def add_case(self, val, block):
        assert isinstance(block, Block)
        if not isinstance(val, Value):
            val = Constant(self.value.type, val)
        self.cases.append((val, block))

    def descr(self, buf):
        cases = ["{0} {1}, label {2}".format(val.type, val.get_reference(),
                                             blk.get_reference())
                 for val, blk in self.cases]
        buf.append("switch {0} {1}, label {2} [{3}]  {4}\n".format(
            self.value.type,
            self.value.get_reference(),
            self.default.get_reference(),
            ' '.join(cases),
            self._stringify_metadata(),
            ))

class Resume(Terminator):
    pass

class SelectInstr(Instruction):
    def __init__(self, parent, cond, lhs, rhs, name=''):
        assert lhs.type == rhs.type
        super(SelectInstr, self).__init__(parent, lhs.type, "select",
                                          [cond, lhs, rhs], name=name)

    @property
    def cond(self):
        return self.operands[0]

    @property
    def lhs(self):
        return self.operands[1]

    @property
    def rhs(self):
        return self.operands[2]

    def descr(self, buf):
        buf.append("select {0} {1}, {2} {3}, {4} {5} {6}\n".format(
            self.cond.type, self.cond.get_reference(),
            self.lhs.type, self.lhs.get_reference(),
            self.rhs.type, self.rhs.get_reference(),
            self._stringify_metadata(),
            ))

class CompareInstr(Instruction):
    # Define the following in subclasses
    OPNAME = 'invalid-compare'
    VALID_OP = {}

    def __init__(self, parent, op, lhs, rhs, name=''):
        if op not in self.VALID_OP:
            raise ValueError("invalid comparison %r for %s" % (op, self.OPNAME))
        super(CompareInstr, self).__init__(parent, types.IntType(1),
                                           self.OPNAME, [lhs, rhs], name=name)
        self.op = op

    def descr(self, buf):
        buf.append("{0} {1} {2} {3}, {4} {5}\n".format(
            self.OPNAME,
            self.op,
            self.operands[0].type,
            self.operands[0].get_reference(),
            self.operands[1].get_reference(),
            self._stringify_metadata(),
            ))

class ICMPInstr(CompareInstr):
    OPNAME = 'icmp'
    VALID_OP = {
        'eq': 'equal',
        'ne': 'not equal',
        'ugt': 'unsigned greater than',
        'uge': 'unsigned greater or equal',
        'ult': 'unsigned less than',
        'ule': 'unsigned less or equal',
        'sgt': 'signed greater than',
        'sge': 'signed greater or equal',
        'slt': 'signed less than',
        'sle': 'signed less or equal',
    }

class FCMPInstr(CompareInstr):
    OPNAME = 'fcmp'
    VALID_OP = {
        'false': 'no comparison, always returns false',
        'oeq': 'ordered and equal',
        'ogt': 'ordered and greater than',
        'oge': 'ordered and greater than or equal',
        'olt': 'ordered and less than',
        'ole': 'ordered and less than or equal',
        'one': 'ordered and not equal',
        'ord': 'ordered (no nans)',
        'ueq': 'unordered or equal',
        'ugt': 'unordered or greater than',
        'uge': 'unordered or greater than or equal',
        'ult': 'unordered or less than',
        'ule': 'unordered or less than or equal',
        'une': 'unordered or not equal',
        'uno': 'unordered (either nans)',
        'true': 'no comparison, always returns true',
    }

class CastInstr(Instruction):
    def __init__(self, parent, op, val, typ, name=''):
        super(CastInstr, self).__init__(parent, typ, op, [val], name=name)

    def descr(self, buf):
        buf.append("{0} {1} {2} to {3} {4}\n".format(
            self.opname,
            self.operands[0].type,
            self.operands[0].get_reference(),
            self.type,
            self._stringify_metadata(),
            ))

class LoadInstr(Instruction):

    def __init__(self, parent, ptr, name=''):
        super(LoadInstr, self).__init__(parent, ptr.type.pointee, "load",
                                        [ptr], name=name)
        self.align = None

    def descr(self, buf):
        [val] = self.operands
        if self.align is not None:
            align = ', align %d' % (self.align)
        else:
            align = ''
        buf.append("load {0}, {1} {2}{3}{4}\n".format(
            val.type.pointee,
            val.type,
            val.get_reference(),
            align,
            self._stringify_metadata(),
            ))

class StoreInstr(Instruction):
    def __init__(self, parent, val, ptr):
        super(StoreInstr, self).__init__(parent, types.VoidType(), "store",
                                         [val, ptr])

    def descr(self, buf):
        val, ptr = self.operands
        if self.align is not None:
            align = ', align %d' % (self.align)
        else:
            align = ''
        buf.append("store {0} {1}, {2} {3}{4}{5}\n".format(
            val.type,
            val.get_reference(),
            ptr.type,
            ptr.get_reference(),
            align,
            self._stringify_metadata(),
            ))

class AllocaInstr(Instruction):
    def __init__(self, parent, typ, count, name):
        operands = [count] if count else ()
        super(AllocaInstr, self).__init__(parent, typ.as_pointer(), "alloca",
                                          operands, name)

    def descr(self, buf):
        buf.append("{0} {1}".format(self.opname, self.type.pointee))
        if self.operands:
            op, = self.operands
            buf.append(", {0} {1}".format(op.type, op.get_reference()))
        if self.metadata:
            buf.append(self._stringify_metadata())

class GEPInstr(Instruction):
    def __init__(self, parent, ptr, indices, inbounds, name):
        typ = ptr.type
        lasttyp = None
        for i in indices:
            lasttyp, typ = typ, typ.gep(i)

        if (not isinstance(typ, types.PointerType) and
                isinstance(lasttyp, types.PointerType)):
            typ = lasttyp
        else:
            typ = typ.as_pointer()

        super(GEPInstr, self).__init__(parent, typ, "getelementptr",
                                       [ptr] + list(indices), name=name)
        self.pointer = ptr
        self.indices = indices
        self.inbounds = inbounds

    def descr(self, buf):
        indices = ['{0} {1}'.format(i.type, i.get_reference())
                   for i in self.indices]
        op = "getelementptr inbounds" if self.inbounds else "getelementptr"
        buf.append("{0} {1}, {2} {3}, {4} {5}\n".format(
                   op,
                   self.pointer.type.pointee,
                   self.pointer.type,
                   self.pointer.get_reference(),
                   ', '.join(indices),
                   self._stringify_metadata(),
                   ))

class PhiInstr(Instruction):
    def __init__(self, parent, typ, name):
        super(PhiInstr, self).__init__(parent, typ, "phi", (), name=name)
        self.incomings = []

    def descr(self, buf):
        incs = ', '.join('[{0}, {1}]'.format(v.get_reference(),
                                             b.get_reference())
                         for v, b in self.incomings)
        buf.append("phi {0} {1} {2}\n".format(
                   self.type,
                   incs,
                   self._stringify_metadata(),
                   ))

    def add_incoming(self, value, block):
        assert isinstance(block, Block)
        self.incomings.append((value, block))

    def replace_usage(self, old, new):
        self.incomings = [((new if val is old else val), blk)
                          for (val, blk) in self.incomings]

class ExtractValue(Instruction):
    def __init__(self, parent, agg, indices, name=''):
        typ = agg.type
        try:
            for i in indices:
                typ = typ.elements[i]
        except (AttributeError, IndexError):
            raise TypeError("Can't index at %r in %s"
                            % (list(indices), agg.type))

        super(ExtractValue, self).__init__(parent, typ, "extractvalue",
                                           [agg], name=name)

        self.aggregate = agg
        self.indices = indices

    def descr(self, buf):
        indices = [str(i) for i in self.indices]

        buf.append("extractvalue {0} {1}, {2} {3}\n".format(
                   self.aggregate.type,
                   self.aggregate.get_reference(),
                   ', '.join(indices),
                   self._stringify_metadata(),
                   ))

class InsertValue(Instruction):
    def __init__(self, parent, agg, elem, indices, name=''):
        typ = agg.type
        try:
            for i in indices:
                typ = typ.elements[i]
        except (AttributeError, IndexError):
            raise TypeError("Can't index at %r in %s"
                            % (list(indices), agg.type))
        if elem.type != typ:
            raise TypeError("Can only insert %s at %r in %s: got %s"
                            % (typ, list(indices), agg.type, elem.type))
        super(InsertValue, self).__init__(parent, agg.type, "insertvalue",
                                          [agg, elem], name=name)

        self.aggregate = agg
        self.value = elem
        self.indices = indices

    def descr(self, buf):
        indices = [str(i) for i in self.indices]

        buf.append("insertvalue {0} {1}, {2} {3}, {4} {5}\n".format(
                   self.aggregate.type, self.aggregate.get_reference(),
                   self.value.type, self.value.get_reference(),
                   ', '.join(indices),
                   self._stringify_metadata(),
                   ))

class Unreachable(Instruction):
    def __init__(self, parent):
        super(Unreachable, self).__init__(parent, types.VoidType(),
                                          "unreachable", (), name='')

    def descr(self, buf):
        buf += (self.opname, "\n")

class InlineAsm(object):
    def __init__(self, ftype, asm, constraint, side_effect=False):
        self.type = ftype.return_type
        self.function_type = ftype
        self.asm = asm
        self.constraint = constraint
        self.side_effect = side_effect

    def descr(self, buf):
        sideeffect = 'sideeffect' if self.side_effect else ''
        fmt = 'asm {sideeffect} "{asm}", "{constraint}"\n'
        buf.append(fmt.format(sideeffect=sideeffect, asm=self.asm,
                              constraint=self.constraint))

    def get_reference(self):
        buf = []
        self.descr(buf)
        return "".join(buf)

    def __str__(self):
        return "{0} {1}".format(self.type, self.get_reference())

class AtomicRMW(Instruction):
    def __init__(self, parent, op, ptr, val, ordering, name):
        super(AtomicRMW, self).__init__(parent, val.type, "atomicrmw",
                                        (ptr, val), name=name)
        self.operation = op
        self.ordering = ordering

    def descr(self, buf):
        ptr, val = self.operands
        fmt = "atomicrmw {op} {ptrty} {ptr}, {valty} {val} {ordering} {metadata}\n"
        buf.append(fmt.format(op=self.operation,
                              ptrty=ptr.type,
                              ptr=ptr.get_reference(),
                              valty=val.type,
                              val=val.get_reference(),
                              ordering=self.ordering,
                              metadata=self._stringify_metadata(),
                              ))

class CmpXchg(Instruction):
    """This instruction has changed since llvm3.5.  It is not compatible with
    older llvm versions.
    """
    def __init__(self, parent, ptr, cmp, val, ordering, failordering, name):
        outtype = types.LiteralStructType([val.type, types.IntType(1)])
        super(CmpXchg, self).__init__(parent, outtype, "cmpxchg",
                                      (ptr, cmp, val), name=name)
        self.ordering = ordering
        self.failordering = failordering

    def descr(self, buf):
        ptr, cmpval, val = self.operands
        fmt = "cmpxchg {ptrty} {ptr}, {ty} {cmp}, {ty} {val} {ordering} " \
              "{failordering} {metadata}\n"
        buf.append(fmt.format(ptrty=ptr.type,
                              ptr=ptr.get_reference(),
                              ty=cmpval.type,
                              cmp=cmpval.get_reference(),
                              val=val.get_reference(),
                              ordering=self.ordering,
                              failordering=self.failordering,
                              metadata=self._stringify_metadata(),
                              ))

class _LandingPadClause(object):
    def __init__(self, value):
        self.value = value

    def __str__(self):
        return "{kind} {type} {value}".format(
            kind=self.kind,
            type=self.value.type,
            value=self.value.get_reference())

class CatchClause(_LandingPadClause):
    kind = 'catch'

class FilterClause(_LandingPadClause):
    kind = 'filter'

    def __init__(self, value):
        assert isinstance(value, Constant)
        assert isinstance(value.type, types.ArrayType)
        super(FilterClause, self).__init__(value)

class LandingPadInstr(Instruction):
    def __init__(self, parent, typ, personality, name='', cleanup=False):
        super(LandingPadInstr, self).__init__(parent, typ, "landingpad", [], name=name)
        self.personality = personality
        self.cleanup = cleanup
        self.clauses = []

    def add_clause(self, clause):
        assert isinstance(clause, _LandingPadClause)
        self.clauses.append(clause)

    def descr(self, buf):
        pers = self.personality
        fmt = "landingpad {type} personality {persty} {persfn}{cleanup}{clauses}\n"
        buf.append(fmt.format(type=self.type,
                              persty=pers.type,
                              persfn=pers.get_reference(),
                              cleanup=' cleanup' if self.cleanup else '',
                              clauses=''.join(["\n      {0}".format(clause)
                                               for clause in self.clauses]),
                              ))


text:
package co.huitaca.j4log.jmx;

import java.util.Map;

public interface J4LogMBean {

    public int countLoggers();

    public Map<String, String> getLoggers();

    public Map<String, String> getLoggers(int offset, int size);

    public int countLoggersLike(String like);

    public Map<String, String> getLoggersLike(String like);

    public Map<String, String> getLoggersLike(String like, int offset, int page);

    public void setLevel(String logger, String level);

    public String getLevel(String logger);

}

redpajama_set_name: RedPajamaGithub


text:
using Aspose.Email.Clients.Smtp;
using Aspose.Email.Mime;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

/*
This project uses Automatic Package Restore feature of NuGet to resolve Aspose.Email for .NET API reference
when the project is build. Please check https://Docs.nuget.org/consume/nuget-faq for more information.
If you do not wish to use NuGet, you can manually download Aspose.Email for .NET API from https://www.nuget.org/packages/Aspose.Email/,
install it and then add its reference to this project. For any issues, questions or suggestions
please feel free to contact us using https://forum.aspose.com/c/email
*/

namespace Aspose.Email.Examples.CSharp.Email.SMTP
{
    class SendingEmailWithAlternateText
    {
        public static void Run()
        {
            // ExStart:SendingEmailWithAlternateText
            // Create an instance of MailMessage class
            MailMessage message = new MailMessage();

            // From and To field
            message.From = "sender@sender.com";
            message.To.Add("receiver@receiver.com");

            AlternateView alternate;

            // Create an instance of AlternateView to view an email message using the content specified in the string
            alternate = AlternateView.CreateAlternateViewFromString("This is the alternate Text");

            // Add alternate text
            message.AlternateViews.Add(alternate);

            // Create an instance of SmtpClient Class
            SmtpClient client = new SmtpClient();

            // Specify your mailing host server, user name, mail password and Port #
            client.Host = "smtp.server.com";
            client.Username = "Username";
            client.Password = "Password";
            client.Port = 25;
            try
            {
                // Client.Send will send this message
                client.Send(message);
            }

            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.ToString());
            }
            // ExEnd:SendingEmailWithAlternateText

        }
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>Crap Engine 2: /mnt/windows/data/programming/crapengine2/source/testprojects/testgame/source/main.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

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

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

Crap Engine 2

Main Page

Namespaces

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

File Members

source

testprojects

testgame

source

Functions |
Variables

main.cpp File Reference

#include <iostream>

#include "system.h"

#include "logger.h"

#include "configuration.h"

#include "resourcemanager.h"

#include "audiomanager.h"

#include "pluginmanager.h"

#include "directorylistener.h"

#include "resourcefilter.h"

#include "componentsystem.h"

#include "component.h"

#include "taskmanager.h"

#include "inputmanager.h"

#include "keyboardinput.h"

#include "mouseinput.h"

#include "controllerinput.h"

#include "renderwindow.h"

Go to the source code of this file.

Functions

void 	exitFunc (uint32_t state)

void 	clickFunc (uint32_t state)

void 	posFunc (float64_t x, float64_t y)

void 	scrollFunc (float64_t x, float64_t y)

void 	enterFunc (bool var)

void 	joyAxis (const float32_t *data, int32_t data_size)

void 	joyButton (const uint8_t *data, int32_t data_size)

int 	main (void)

Variables

bool 	running = true

uint32_t 	thekey = 256

Function Documentation

          void clickFunc
          (
          uint32_t
          state	)

Definition at line 28 of file main.cpp.

          void enterFunc
          (
          bool
          var	)

Definition at line 43 of file main.cpp.

          void exitFunc
          (
          uint32_t
          state	)

Definition at line 22 of file main.cpp.

          void joyAxis
          (
          const float32_t *
          data,

          int32_t
          data_size

          )

Definition at line 48 of file main.cpp.

          void joyButton
          (
          const uint8_t *
          data,

          int32_t
          data_size

          )

Definition at line 60 of file main.cpp.

          int main
          (
          void
          	)

Definition at line 72 of file main.cpp.

          void posFunc
          (
          float64_t
          x,

          float64_t
          y

          )

Definition at line 33 of file main.cpp.

          void scrollFunc
          (
          float64_t
          x,

          float64_t
          y

          )

Definition at line 38 of file main.cpp.

Variable Documentation

          bool running = true

Definition at line 20 of file main.cpp.

          uint32_t thekey = 256

Definition at line 21 of file main.cpp.

<address class="footer">
Generated on Wed Jan 7 2015 21:59:08 for Crap Engine 2 by

 1.8.9.1
</address>


text:
"""Test the models."""

import pytest

@pytest.fixture
def klass():
    """Return CUT."""
    from agile_analytics.models import AgileTicket
    return AgileTicket

@pytest.fixture
def make_one(klass):
    """Function to make an AgileTicket."""
    def _make_one(*args, **kwargs):
        kwargs['key'] = kwargs.get('key', "TEST-1")
        return klass(*args, **kwargs)
    return _make_one

def test_construction(make_one):
    """Ensure make_one works."""
    t = make_one()
    assert t

def test_flow_log_append_happy(make_one, datetime):
    """Ensure FlowLogs require entered_at and state."""
    t = make_one()
    t.flow_log.append(
        dict(
            entered_at=datetime.now(),
            state="Missouri"
        )
    )
    assert t.flow_log[0]

def test_flow_log_append_unicode(make_one, datetime):
    """Ensure flow log strings are unicode."""
    t = make_one()
    t.flow_log.append(
        dict(
            entered_at=datetime.now(),
            state="LA",
        )
    )
    assert t.flow_log[0][u'state'] == str("LA")

def test_flow_log_append_datetime(make_one, datetime):
    """Ensure flow log datetimes are honored."""
    test_dt = datetime.now()
    t = make_one()
    t.flow_log.append(
        dict(
            entered_at=test_dt,
            state="OK"
        )
    )
    assert t.flow_log[0][u'entered_at'] == test_dt

def test_flow_log_append_unhappy(make_one, datetime):
    """Ensure we only accept datetime-ish objects."""
    t = make_one()
    with pytest.raises(TypeError):
        t.flow_log.append(
            dict(
                state="SD",
                entered_at=str(datetime.now()),
            )
        )

def test_flow_log_append_unhappy_no_dict(make_one):
    """Ensure we only accept dict-ish objects."""
    t = make_one()
    with pytest.raises(TypeError):
        t.flow_log.append(['VT', '278461911'])

def test_flow_log_ordered_ascending(make_one, days_ago):
    """Ensure flow log items are oldest > newest."""
    t = make_one()
    items = [
        dict(state="SC", entered_at=days_ago(2)),
        dict(state="KNAP", entered_at=days_ago(8)),
        dict(state="Junohaki", entered_at=days_ago(9)),
        dict(state="MA", entered_at=days_ago(10))
    ]
    for i in items:
        t.flow_log.append(i)

    actual = [fl['state'] for fl in t.flow_log]
    expected = [
        "MA",
        "Junohaki",
        "KNAP",
        "SC"
    ]
    assert actual == expected


text:
<title>iscntrl - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Ctype.html#Ctype" title="Ctype">
<link rel="prev" href="isblank.html#isblank" title="isblank">
<link rel="next" href="isdigit.html#isdigit" title="isdigit">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">

Next: isdigit,
Previous: isblank,
Up: Ctype

3.5 iscntrl—control character predicate

Synopsis

     #include <ctype.h>
     int iscntrl(int <var>c</var>);

Description

iscntrl is a macro which classifies ASCII integer values by table
lookup.  It is a predicate returning non-zero for control characters, and 0
for other characters.  It is defined only if <var>c</var> is representable as an
unsigned char or if <var>c</var> is EOF.

You can use a compiled subroutine instead of the macro definition by
undefining the macro using `#undef iscntrl'.

Returns

iscntrl returns non-zero if <var>c</var> is a delete character or ordinary
control character (0x7F or 0x00–0x1F).

Portability

iscntrl is ANSI C.

No supporting OS subroutines are required.


text:
package form

import (
//"golang.org/x/net/html"
//"golang.org/x/net/html/atom"
)

// Password provides a field for obscured text.
type Password Input

// Text provides a single text entry line.
// See TextArea for multi-line input.
type Text Input

// Submit provides a button pre-wired for submission.
type Submit Input

// Tel provides a telephone number field.
type Tel Input

// URL provides a URL field.
type URL Input

// Email provides an Email address field.
type Email Input

// Date provides a date form entry field.
type Date Input

// Time provides a time form entry field.
type Time Input

// Number provides a numeric field.
type Number Input

// Range provides a number range field.
type Range Input

// Color provides a color picker.
type Color Input

// Checkbox provides a single checkbox.
type Checkbox Input

// Radio provides a single radio button.
type Radio Input

// File provides a file upload field.
type File Input

// Image provides a button that is painted with an image.
type Image Input

// Reset provides a button that is pre-wired to reset the form.
type Reset Input

// Button provides a generic button.
// This is deprecated in favor of the Button type.
type ButtonInput Input

// Hidden provides a field that will not be displayed.
type Hidden Input

// Input defines a generic untyped form field.
//
// It should not generally be used directly.
type Input struct {
	HTML
	Accept, Alt, Autocomplete, Dirname, Form, List, InputMode, Max, Min, MaxLength string
	Name, Pattern, Placeholder, Src, Step, Value                                   string
	Autofocus, Checked, Disabled, Multiple, ReadOnly, Required                     bool
	Height, Width, Size                                                            uint64

	// Technically, this is not an attribute of an Input field, but we put it here
	// to simplify the process of labeling fields.
	Label string
}

// Field describes any form element.
type Field interface{}


text:
layout: post
title: "Testing Singleton classes in C#"
subtitle: "Useful for testing with test data"
categories: ["Programming"]
tags:
  - .NET
  - C#
  - TDD
---

Singleton object is a design pattern solves the need as stated below in [GOF design patterns](https://en.wikipedia.org/wiki/Singleton_pattern)

> 'Ensure a class has one instance, and provide a global point of access to it.'

Like many others, I too feel that this an anti-pattern. However there are situations where we might need to design a singleton. Something like below:

```csharp
public class Logger
    {

        private static Logger _instance;
        private static Object _mutex = new Object();

        private Logger(ISomeDependency dep)
        {
           // ...
        }

        public static Logger CreateInstance(ISomeDependency dep)
        {
            if (_instance != null)
                throw new InvalidOperationException("Instance already created");
            lock (_mutex)
            {
                _instance = new Logger(dep);
            }
            return _instance;
        }

        public static Logger Instance
        {
            get
            {
                if (_instance == null)
                    throw new InvalidOperationException("Instance not created");
                return _instance;
            }
        }
        // More methods.... as per the design.
        public void SomeMethod()
        {
        }
}
```

While this is basic implementation it does solve the design pattern problems that was mentioned above. There can be more that needs to be added depending on the context it is used.

This however has a problem for writing unit tests. If you want to test against different test data, it won't work because of the single instance. It would be the same instance for all test methods, which defeats the purpose of unit testing with different test data.

While there can be different approaches to solve the problem, here is one approach using .NET Reflection. The idea is to set the instance to null at the beginning of each test method execution/run, so that every time a test method is executed it would create a new instance.

```csharp

[TestClass]
public class LoggerTests
{
    [TestInitialize]
    public void TestInit()
    {
        new PrivateType(typeof(Logger)).SetStaticField("_instance", null);
    }

    [TestMethod]
    public void TestSomething1()
    {
        var concretDependency = GetTestData(1)
        Logger.CreateInstance(concretDependency);
        Logger.Instance.SomeMethod();
    }

    [TestMethod]
    public void TestSomething2()
    {
        var concretDependency = GetTestData(2)
        Logger.CreateInstance(concretDependency);
        Logger.Instance.SomeMethod();
    }
}

```


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: tensorflow/compiler/aot/tfcompile.proto

package org.tensorflow.tfcompile;

/**
 *

 * Feed represents a single feed tensor in the graph, which corresponds to an
 * input argument for the generated function.
 *

 *
 * Protobuf type {@code tensorflow.tfcompile.Feed}
 */
public  final class Feed extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:tensorflow.tfcompile.Feed)
    FeedOrBuilder {
  // Use Feed.newBuilder() to construct.
  private Feed(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private Feed() {
    name_ = "";
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
  }
  private Feed(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    int mutable_bitField0_ = 0;
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          default: {
            if (!input.skipField(tag)) {
              done = true;
            }
            break;
          }
          case 10: {
            org.tensorflow.tfcompile.TensorId.Builder subBuilder = null;
            if (id_ != null) {
              subBuilder = id_.toBuilder();
            }
            id_ = input.readMessage(org.tensorflow.tfcompile.TensorId.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(id_);
              id_ = subBuilder.buildPartial();
            }

            break;
          }
          case 18: {
            org.tensorflow.framework.TensorShapeProto.Builder subBuilder = null;
            if (shape_ != null) {
              subBuilder = shape_.toBuilder();
            }
            shape_ = input.readMessage(org.tensorflow.framework.TensorShapeProto.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(shape_);
              shape_ = subBuilder.buildPartial();
            }

            break;
          }
          case 26: {
            java.lang.String s = input.readStringRequireUtf8();

            name_ = s;
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return org.tensorflow.tfcompile.CompileProtos.internal_static_tensorflow_tfcompile_Feed_descriptor;
  }

  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return org.tensorflow.tfcompile.CompileProtos.internal_static_tensorflow_tfcompile_Feed_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            org.tensorflow.tfcompile.Feed.class, org.tensorflow.tfcompile.Feed.Builder.class);
  }

  public static final int ID_FIELD_NUMBER = 1;
  private org.tensorflow.tfcompile.TensorId id_;
  /**
   * .tensorflow.tfcompile.TensorId id = 1;
   */
  public boolean hasId() {
    return id_ != null;
  }
  /**
   * .tensorflow.tfcompile.TensorId id = 1;
   */
  public org.tensorflow.tfcompile.TensorId getId() {
    return id_ == null ? org.tensorflow.tfcompile.TensorId.getDefaultInstance() : id_;
  }
  /**
   * .tensorflow.tfcompile.TensorId id = 1;
   */
  public org.tensorflow.tfcompile.TensorIdOrBuilder getIdOrBuilder() {
    return getId();
  }

  public static final int SHAPE_FIELD_NUMBER = 2;
  private org.tensorflow.framework.TensorShapeProto shape_;
  /**
   * .tensorflow.TensorShapeProto shape = 2;
   */
  public boolean hasShape() {
    return shape_ != null;
  }
  /**
   * .tensorflow.TensorShapeProto shape = 2;
   */
  public org.tensorflow.framework.TensorShapeProto getShape() {
    return shape_ == null ? org.tensorflow.framework.TensorShapeProto.getDefaultInstance() : shape_;
  }
  /**
   * .tensorflow.TensorShapeProto shape = 2;
   */
  public org.tensorflow.framework.TensorShapeProtoOrBuilder getShapeOrBuilder() {
    return getShape();
  }

  public static final int NAME_FIELD_NUMBER = 3;
  private volatile java.lang.Object name_;
  /**
   *

   * Optional name for generated code.
   *

   *
   * string name = 3;
   */
  public java.lang.String getName() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs =
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      name_ = s;
      return s;
    }
  }
  /**
   *

   * Optional name for generated code.
   *

   *
   * string name = 3;
   */
  public com.google.protobuf.ByteString
      getNameBytes() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      name_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  private byte memoizedIsInitialized = -1;
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (id_ != null) {
      output.writeMessage(1, getId());
    }
    if (shape_ != null) {
      output.writeMessage(2, getShape());
    }
    if (!getNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, name_);
    }
  }

  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (id_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(1, getId());
    }
    if (shape_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(2, getShape());
    }
    if (!getNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, name_);
    }
    memoizedSize = size;
    return size;
  }

  private static final long serialVersionUID = 0L;
  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof org.tensorflow.tfcompile.Feed)) {
      return super.equals(obj);
    }
    org.tensorflow.tfcompile.Feed other = (org.tensorflow.tfcompile.Feed) obj;

    boolean result = true;
    result = result && (hasId() == other.hasId());
    if (hasId()) {
      result = result && getId()
          .equals(other.getId());
    }
    result = result && (hasShape() == other.hasShape());
    if (hasShape()) {
      result = result && getShape()
          .equals(other.getShape());
    }
    result = result && getName()
        .equals(other.getName());
    return result;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (hasId()) {
      hash = (37 * hash) + ID_FIELD_NUMBER;
      hash = (53 * hash) + getId().hashCode();
    }
    if (hasShape()) {
      hash = (37 * hash) + SHAPE_FIELD_NUMBER;
      hash = (53 * hash) + getShape().hashCode();
    }
    hash = (37 * hash) + NAME_FIELD_NUMBER;
    hash = (53 * hash) + getName().hashCode();
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static org.tensorflow.tfcompile.Feed parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.tfcompile.Feed parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static org.tensorflow.tfcompile.Feed parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static org.tensorflow.tfcompile.Feed parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static org.tensorflow.tfcompile.Feed parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.tfcompile.Feed parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }
  public static org.tensorflow.tfcompile.Feed parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static org.tensorflow.tfcompile.Feed parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static org.tensorflow.tfcompile.Feed parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static org.tensorflow.tfcompile.Feed parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(org.tensorflow.tfcompile.Feed prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *

   * Feed represents a single feed tensor in the graph, which corresponds to an
   * input argument for the generated function.
   *

   *
   * Protobuf type {@code tensorflow.tfcompile.Feed}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:tensorflow.tfcompile.Feed)
      org.tensorflow.tfcompile.FeedOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.tensorflow.tfcompile.CompileProtos.internal_static_tensorflow_tfcompile_Feed_descriptor;
    }

    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return org.tensorflow.tfcompile.CompileProtos.internal_static_tensorflow_tfcompile_Feed_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.tensorflow.tfcompile.Feed.class, org.tensorflow.tfcompile.Feed.Builder.class);
    }

    // Construct using org.tensorflow.tfcompile.Feed.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
      }
    }
    public Builder clear() {
      super.clear();
      if (idBuilder_ == null) {
        id_ = null;
      } else {
        id_ = null;
        idBuilder_ = null;
      }
      if (shapeBuilder_ == null) {
        shape_ = null;
      } else {
        shape_ = null;
        shapeBuilder_ = null;
      }
      name_ = "";

      return this;
    }

    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return org.tensorflow.tfcompile.CompileProtos.internal_static_tensorflow_tfcompile_Feed_descriptor;
    }

    public org.tensorflow.tfcompile.Feed getDefaultInstanceForType() {
      return org.tensorflow.tfcompile.Feed.getDefaultInstance();
    }

    public org.tensorflow.tfcompile.Feed build() {
      org.tensorflow.tfcompile.Feed result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    public org.tensorflow.tfcompile.Feed buildPartial() {
      org.tensorflow.tfcompile.Feed result = new org.tensorflow.tfcompile.Feed(this);
      if (idBuilder_ == null) {
        result.id_ = id_;
      } else {
        result.id_ = idBuilder_.build();
      }
      if (shapeBuilder_ == null) {
        result.shape_ = shape_;
      } else {
        result.shape_ = shapeBuilder_.build();
      }
      result.name_ = name_;
      onBuilt();
      return result;
    }

    public Builder clone() {
      return (Builder) super.clone();
    }
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        Object value) {
      return (Builder) super.setField(field, value);
    }
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return (Builder) super.clearField(field);
    }
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return (Builder) super.clearOneof(oneof);
    }
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, Object value) {
      return (Builder) super.setRepeatedField(field, index, value);
    }
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        Object value) {
      return (Builder) super.addRepeatedField(field, value);
    }
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof org.tensorflow.tfcompile.Feed) {
        return mergeFrom((org.tensorflow.tfcompile.Feed)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(org.tensorflow.tfcompile.Feed other) {
      if (other == org.tensorflow.tfcompile.Feed.getDefaultInstance()) return this;
      if (other.hasId()) {
        mergeId(other.getId());
      }
      if (other.hasShape()) {
        mergeShape(other.getShape());
      }
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        onChanged();
      }
      onChanged();
      return this;
    }

    public final boolean isInitialized() {
      return true;
    }

    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      org.tensorflow.tfcompile.Feed parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (org.tensorflow.tfcompile.Feed) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private org.tensorflow.tfcompile.TensorId id_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        org.tensorflow.tfcompile.TensorId, org.tensorflow.tfcompile.TensorId.Builder, org.tensorflow.tfcompile.TensorIdOrBuilder> idBuilder_;
    /**
     * .tensorflow.tfcompile.TensorId id = 1;
     */
    public boolean hasId() {
      return idBuilder_ != null || id_ != null;
    }
    /**
     * .tensorflow.tfcompile.TensorId id = 1;
     */
    public org.tensorflow.tfcompile.TensorId getId() {
      if (idBuilder_ == null) {
        return id_ == null ? org.tensorflow.tfcompile.TensorId.getDefaultInstance() : id_;
      } else {
        return idBuilder_.getMessage();
      }
    }
    /**
     * .tensorflow.tfcompile.TensorId id = 1;
     */
    public Builder setId(org.tensorflow.tfcompile.TensorId value) {
      if (idBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        id_ = value;
        onChanged();
      } else {
        idBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * .tensorflow.tfcompile.TensorId id = 1;
     */
    public Builder setId(
        org.tensorflow.tfcompile.TensorId.Builder builderForValue) {
      if (idBuilder_ == null) {
        id_ = builderForValue.build();
        onChanged();
      } else {
        idBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * .tensorflow.tfcompile.TensorId id = 1;
     */
    public Builder mergeId(org.tensorflow.tfcompile.TensorId value) {
      if (idBuilder_ == null) {
        if (id_ != null) {
          id_ =
            org.tensorflow.tfcompile.TensorId.newBuilder(id_).mergeFrom(value).buildPartial();
        } else {
          id_ = value;
        }
        onChanged();
      } else {
        idBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * .tensorflow.tfcompile.TensorId id = 1;
     */
    public Builder clearId() {
      if (idBuilder_ == null) {
        id_ = null;
        onChanged();
      } else {
        id_ = null;
        idBuilder_ = null;
      }

      return this;
    }
    /**
     * .tensorflow.tfcompile.TensorId id = 1;
     */
    public org.tensorflow.tfcompile.TensorId.Builder getIdBuilder() {

      onChanged();
      return getIdFieldBuilder().getBuilder();
    }
    /**
     * .tensorflow.tfcompile.TensorId id = 1;
     */
    public org.tensorflow.tfcompile.TensorIdOrBuilder getIdOrBuilder() {
      if (idBuilder_ != null) {
        return idBuilder_.getMessageOrBuilder();
      } else {
        return id_ == null ?
            org.tensorflow.tfcompile.TensorId.getDefaultInstance() : id_;
      }
    }
    /**
     * .tensorflow.tfcompile.TensorId id = 1;
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        org.tensorflow.tfcompile.TensorId, org.tensorflow.tfcompile.TensorId.Builder, org.tensorflow.tfcompile.TensorIdOrBuilder>
        getIdFieldBuilder() {
      if (idBuilder_ == null) {
        idBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            org.tensorflow.tfcompile.TensorId, org.tensorflow.tfcompile.TensorId.Builder, org.tensorflow.tfcompile.TensorIdOrBuilder>(
                getId(),
                getParentForChildren(),
                isClean());
        id_ = null;
      }
      return idBuilder_;
    }

    private org.tensorflow.framework.TensorShapeProto shape_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        org.tensorflow.framework.TensorShapeProto, org.tensorflow.framework.TensorShapeProto.Builder, org.tensorflow.framework.TensorShapeProtoOrBuilder> shapeBuilder_;
    /**
     * .tensorflow.TensorShapeProto shape = 2;
     */
    public boolean hasShape() {
      return shapeBuilder_ != null || shape_ != null;
    }
    /**
     * .tensorflow.TensorShapeProto shape = 2;
     */
    public org.tensorflow.framework.TensorShapeProto getShape() {
      if (shapeBuilder_ == null) {
        return shape_ == null ? org.tensorflow.framework.TensorShapeProto.getDefaultInstance() : shape_;
      } else {
        return shapeBuilder_.getMessage();
      }
    }
    /**
     * .tensorflow.TensorShapeProto shape = 2;
     */
    public Builder setShape(org.tensorflow.framework.TensorShapeProto value) {
      if (shapeBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        shape_ = value;
        onChanged();
      } else {
        shapeBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * .tensorflow.TensorShapeProto shape = 2;
     */
    public Builder setShape(
        org.tensorflow.framework.TensorShapeProto.Builder builderForValue) {
      if (shapeBuilder_ == null) {
        shape_ = builderForValue.build();
        onChanged();
      } else {
        shapeBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * .tensorflow.TensorShapeProto shape = 2;
     */
    public Builder mergeShape(org.tensorflow.framework.TensorShapeProto value) {
      if (shapeBuilder_ == null) {
        if (shape_ != null) {
          shape_ =
            org.tensorflow.framework.TensorShapeProto.newBuilder(shape_).mergeFrom(value).buildPartial();
        } else {
          shape_ = value;
        }
        onChanged();
      } else {
        shapeBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * .tensorflow.TensorShapeProto shape = 2;
     */
    public Builder clearShape() {
      if (shapeBuilder_ == null) {
        shape_ = null;
        onChanged();
      } else {
        shape_ = null;
        shapeBuilder_ = null;
      }

      return this;
    }
    /**
     * .tensorflow.TensorShapeProto shape = 2;
     */
    public org.tensorflow.framework.TensorShapeProto.Builder getShapeBuilder() {

      onChanged();
      return getShapeFieldBuilder().getBuilder();
    }
    /**
     * .tensorflow.TensorShapeProto shape = 2;
     */
    public org.tensorflow.framework.TensorShapeProtoOrBuilder getShapeOrBuilder() {
      if (shapeBuilder_ != null) {
        return shapeBuilder_.getMessageOrBuilder();
      } else {
        return shape_ == null ?
            org.tensorflow.framework.TensorShapeProto.getDefaultInstance() : shape_;
      }
    }
    /**
     * .tensorflow.TensorShapeProto shape = 2;
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        org.tensorflow.framework.TensorShapeProto, org.tensorflow.framework.TensorShapeProto.Builder, org.tensorflow.framework.TensorShapeProtoOrBuilder>
        getShapeFieldBuilder() {
      if (shapeBuilder_ == null) {
        shapeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            org.tensorflow.framework.TensorShapeProto, org.tensorflow.framework.TensorShapeProto.Builder, org.tensorflow.framework.TensorShapeProtoOrBuilder>(
                getShape(),
                getParentForChildren(),
                isClean());
        shape_ = null;
      }
      return shapeBuilder_;
    }

    private java.lang.Object name_ = "";
    /**
     *

     * Optional name for generated code.
     *

     *
     * string name = 3;
     */
    public java.lang.String getName() {
      java.lang.Object ref = name_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        name_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *

     * Optional name for generated code.
     *

     *
     * string name = 3;
     */
    public com.google.protobuf.ByteString
        getNameBytes() {
      java.lang.Object ref = name_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        name_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *

     * Optional name for generated code.
     *

     *
     * string name = 3;
     */
    public Builder setName(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }

      name_ = value;
      onChanged();
      return this;
    }
    /**
     *

     * Optional name for generated code.
     *

     *
     * string name = 3;
     */
    public Builder clearName() {

      name_ = getDefaultInstance().getName();
      onChanged();
      return this;
    }
    /**
     *

     * Optional name for generated code.
     *

     *
     * string name = 3;
     */
    public Builder setNameBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);

      name_ = value;
      onChanged();
      return this;
    }
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return this;
    }

    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return this;
    }

    // @@protoc_insertion_point(builder_scope:tensorflow.tfcompile.Feed)
  }

  // @@protoc_insertion_point(class_scope:tensorflow.tfcompile.Feed)
  private static final org.tensorflow.tfcompile.Feed DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new org.tensorflow.tfcompile.Feed();
  }

  public static org.tensorflow.tfcompile.Feed getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<Feed>
      PARSER = new com.google.protobuf.AbstractParser<Feed>() {
    public Feed parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
        return new Feed(input, extensionRegistry);
    }
  };

  public static com.google.protobuf.Parser<Feed> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<Feed> getParserForType() {
    return PARSER;
  }

  public org.tensorflow.tfcompile.Feed getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}


text:
package org.sakaiproject.kernel.api.messaging;

/**
 * Base interface for all email objects.
 */
public interface EmailMessage extends Message {

  public static final String TYPE = "EmailMessage";

  public static enum Field {

    CC("Cc"), BCC("Bcc"), REPLY_TO("Reply-To"), DATE("Date");
    /**
     * the name of the header associated to the field.
     */
    private final String header;

    /**
     * Create a field based on a header name.
     *
     * @param jsonString
     *          the name of the field
     */
    private Field(String header) {
      this.header = header;
    }

    /**
     * @return a string representation of the enum.
     */
    @Override
    public String toString() {
      return this.header;
    }
  }

  /**
   * Adds a carbon copy recipient to the message.
   *
   * @param cc
   */
  void addCC(String cc);

  /**
   * Gets the carbon copy recipients of the message.
   *
   * @return Comma delimited String of CC recipients. null if not set.
   */
  String getCC();

  /**
   * Adds a blind carbon copy recipient to the message.
   *
   * @param cc
   */
  void addBcc(String bcc);

  /**
   * Gets the blind carbon copy recipients of the message.
   *
   * @return Comma delimited String of CC recipients. null if not set.
   */
  String getBcc();

  /**
   * Add recipient for replies.
   *
   * @param email
   *          Email string of reply to recipient.
   */
  void addReplyTo(String email);

  /**
   * Get reply recipients.
   *
   * @return {@link java.util.List} of {@link java.lang.String} of reply
   *         recipients.
   */
  String getReplyTo();
}


text:
#include <drm/drmP.h>
#include <drm/i915_drm.h>

#include "i915_drv.h"
#include "intel_drv.h"
#include "i915_trace.h"

static bool
mark_free(struct i915_vma *vma, struct list_head *unwind)
{
	if (vma->pin_count)
		return false;

	if (WARN_ON(!list_empty(&vma->exec_list)))
		return false;

	list_add(&vma->exec_list, unwind);
	return drm_mm_scan_add_block(&vma->node);
}

/**
 * i915_gem_evict_something - Evict vmas to make room for binding a new one
 * @dev: drm_device
 * @vm: address space to evict from
 * @min_size: size of the desired free space
 * @alignment: alignment constraint of the desired free space
 * @cache_level: cache_level for the desired space
 * @start: start (inclusive) of the range from which to evict objects
 * @end: end (exclusive) of the range from which to evict objects
 * @flags: additional flags to control the eviction algorithm
 *
 * This function will try to evict vmas until a free space satisfying the
 * requirements is found. Callers must check first whether any such hole exists
 * already before calling this function.
 *
 * This function is used by the object/vma binding code.
 *
 * Since this function is only used to free up virtual address space it only
 * ignores pinned vmas, and not object where the backing storage itself is
 * pinned. Hence obj->pages_pin_count does not protect against eviction.
 *
 * To clarify: This is for freeing up virtual address space, not for freeing
 * memory in e.g. the shrinker.
 */
int
i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm,
			 int min_size, unsigned alignment, unsigned cache_level,
			 unsigned long start, unsigned long end,
			 unsigned flags)
{
	struct list_head eviction_list, unwind_list;
	struct i915_vma *vma;
	int ret = 0;
	int pass = 0;

	trace_i915_gem_evict(dev, min_size, alignment, flags);

	/*
	 * The goal is to evict objects and amalgamate space in LRU order.
	 * The oldest idle objects reside on the inactive list, which is in
	 * retirement order. The next objects to retire are those on the (per
	 * ring) active list that do not have an outstanding flush. Once the
	 * hardware reports completion (the seqno is updated after the
	 * batchbuffer has been finished) the clean buffer objects would
	 * be retired to the inactive list. Any dirty objects would be added
	 * to the tail of the flushing list. So after processing the clean
	 * active objects we need to emit a MI_FLUSH to retire the flushing
	 * list, hence the retirement order of the flushing list is in
	 * advance of the dirty objects on the active lists.
	 *
	 * The retirement sequence is thus:
	 *   1. Inactive objects (already retired)
	 *   2. Clean active objects
	 *   3. Flushing list
	 *   4. Dirty active objects.
	 *
	 * On each list, the oldest objects lie at the HEAD with the freshest
	 * object on the TAIL.
	 */

	INIT_LIST_HEAD(&unwind_list);
	if (start != 0 || end != vm->total) {
		drm_mm_init_scan_with_range(&vm->mm, min_size,
					    alignment, cache_level,
					    start, end);
	} else
		drm_mm_init_scan(&vm->mm, min_size, alignment, cache_level);

search_again:
	/* First see if there is a large enough contiguous idle region... */
	list_for_each_entry(vma, &vm->inactive_list, mm_list) {
		if (mark_free(vma, &unwind_list))
			goto found;
	}

	if (flags & PIN_NONBLOCK)
		goto none;

	/* Now merge in the soon-to-be-expired objects... */
	list_for_each_entry(vma, &vm->active_list, mm_list) {
		if (mark_free(vma, &unwind_list))
			goto found;
	}

none:
	/* Nothing found, clean up and bail out! */
	while (!list_empty(&unwind_list)) {
		vma = list_first_entry(&unwind_list,
				       struct i915_vma,
				       exec_list);
		ret = drm_mm_scan_remove_block(&vma->node);
		BUG_ON(ret);

		list_del_init(&vma->exec_list);
	}

	/* Can we unpin some objects such as idle hw contents,
	 * or pending flips?
	 */
	if (flags & PIN_NONBLOCK)
		return -ENOSPC;

	/* Only idle the GPU and repeat the search once */
	if (pass++ == 0) {
		ret = i915_gpu_idle(dev);
		if (ret)
			return ret;

		i915_gem_retire_requests(dev);
		goto search_again;
	}

	/* If we still have pending pageflip completions, drop
	 * back to userspace to give our workqueues time to
	 * acquire our locks and unpin the old scanouts.
	 */
	return intel_has_pending_fb_unpin(dev) ? -EAGAIN : -ENOSPC;

found:
	/* drm_mm doesn't allow any other other operations while
	 * scanning, therefore store to be evicted objects on a
	 * temporary list. */
	INIT_LIST_HEAD(&eviction_list);
	while (!list_empty(&unwind_list)) {
		vma = list_first_entry(&unwind_list,
				       struct i915_vma,
				       exec_list);
		if (drm_mm_scan_remove_block(&vma->node)) {
			list_move(&vma->exec_list, &eviction_list);
			drm_gem_object_reference(&vma->obj->base);
			continue;
		}
		list_del_init(&vma->exec_list);
	}

	/* Unbinding will emit any required flushes */
	while (!list_empty(&eviction_list)) {
		struct drm_gem_object *obj;
		vma = list_first_entry(&eviction_list,
				       struct i915_vma,
				       exec_list);

		obj =  &vma->obj->base;
		list_del_init(&vma->exec_list);
		if (ret == 0)
			ret = i915_vma_unbind(vma);

		drm_gem_object_unreference(obj);
	}

	return ret;
}

int
i915_gem_evict_for_vma(struct i915_vma *target)
{
	struct drm_mm_node *node, *next;

	list_for_each_entry_safe(node, next,
			&target->vm->mm.head_node.node_list,
			node_list) {
		struct i915_vma *vma;
		int ret;

		if (node->start + node->size <= target->node.start)
			continue;
		if (node->start >= target->node.start + target->node.size)
			break;

		vma = container_of(node, typeof(*vma), node);

		if (vma->pin_count) {
			if (!vma->exec_entry || (vma->pin_count > 1))
				/* Object is pinned for some other use */
				return -EBUSY;

			/* We need to evict a buffer in the same batch */
			if (vma->exec_entry->flags & EXEC_OBJECT_PINNED)
				/* Overlapping fixed objects in the same batch */
				return -EINVAL;

			return -ENOSPC;
		}

		ret = i915_vma_unbind(vma);
		if (ret)
			return ret;
	}

	return 0;
}

/**
 * i915_gem_evict_vm - Evict all idle vmas from a vm
 * @vm: Address space to cleanse
 * @do_idle: Boolean directing whether to idle first.
 *
 * This function evicts all idles vmas from a vm. If all unpinned vmas should be
 * evicted the @do_idle needs to be set to true.
 *
 * This is used by the execbuf code as a last-ditch effort to defragment the
 * address space.
 *
 * To clarify: This is for freeing up virtual address space, not for freeing
 * memory in e.g. the shrinker.
 */
int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle)
{
	struct i915_vma *vma, *next;
	int ret;

	WARN_ON(!mutex_is_locked(&vm->dev->struct_mutex));
	trace_i915_gem_evict_vm(vm);

	if (do_idle) {
		ret = i915_gpu_idle(vm->dev);
		if (ret)
			return ret;

		i915_gem_retire_requests(vm->dev);

		WARN_ON(!list_empty(&vm->active_list));
	}

	list_for_each_entry_safe(vma, next, &vm->inactive_list, mm_list)
		if (vma->pin_count == 0)
			WARN_ON(i915_vma_unbind(vma));

	return 0;
}


text:
import pytest

import os

from yaml import dump as yaml_dump

from django_docker_helpers.config import exceptions
from django_docker_helpers.config.backends.redis_parser import RedisParser

pytestmark = [pytest.mark.backend, pytest.mark.redis]

REDIS_HOST = os.getenv('REDIS_HOST', '127.0.0.1')
REDIS_PORT = os.getenv('REDIS_PORT', 6379)

SAMPLE = {
    'bool_flag': '',  # flag
    'unicode': 'вася',
    'none_value': None,
    'debug': True,
    'mixed': ['ascii', 'юникод', 1, {'d': 1}, {'b': 2}],
    'nested': {
        'a': {
            'b': 2
        }
    }
}

@pytest.fixture
def redis_parser():
    return RedisParser('my/server/config.yml', host=REDIS_HOST, port=REDIS_PORT)

@pytest.fixture
def store_redis_config():
    import redis

    c = redis.Redis(host=REDIS_HOST, port=REDIS_PORT)
    data = yaml_dump(SAMPLE, allow_unicode=True).encode()
    c.set('my/server/config.yml', data)
    c.set('my/server/empty.yml', '')
    return c

# noinspection PyMethodMayBeStatic,PyShadowingNames,PyUnusedLocal
class RedisBackendTest:
    def test__redis_parser__client(self, redis_parser: RedisParser):
        assert redis_parser.client

    def test__redis_parser__inner_parser(self, store_redis_config, redis_parser: RedisParser):
        assert redis_parser.client
        assert redis_parser.inner_parser

    def test__redis_parser__inner_parser__exceptions(self, store_redis_config):
        with pytest.raises(exceptions.KVStorageValueIsEmpty):
            c = RedisParser('nothing/here', host=REDIS_HOST, port=REDIS_PORT)
            assert c.inner_parser

        with pytest.raises(exceptions.KVStorageValueIsEmpty):
            c = RedisParser('my/server/empty.yml', host=REDIS_HOST, port=REDIS_PORT)
            assert c.inner_parser

    def test__redis_parser__configs_equal(self, store_redis_config, redis_parser):
        assert redis_parser.inner_parser
        assert redis_parser.inner_parser.data == SAMPLE


text:
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>{Querek}</title>
        <meta name="viewport" content="width=device-width">
    <body>
        <div>
            Detecting your device...
        </div>
        <script>

            /**
             * @function
             * @returns {Array.<String>}
             */
            function collectSearchArguments() {
                return document.location.search
                        //removes "?" sign
                        .slice(1, document.location.search.length)
                        .split('&');
            }

            /**
             * @function
             * @returns {Object}
             */
            function collectApplicationDetails() {
                var params = document.location.href.split('/');

                return {
                    type: params[params.length - 2],
                    version: params[params.length - 1]
                };
            }

            /**
             * @function
             * @returns {Boolean}
             */
            function isAndroid() {
                return /android/.test(window.navigator.userAgent.toLowerCase());
            }

            /**
             * @function
             */
            function download() {
                var details = collectApplicationDetails();

                if (isAndroid()) {
                    downloadApk(details);
                } else {
                    downloadIpa(details);
                }
            }

            /**
             * @function
             */
            function downloadApk(requestOptions) {
                // generate by ngrok from cmd  (when 3001 is server port):
                // > ngrok http 3001
                document.location = 'https://NGROK_HTTPS_ADDRESS/install/' + requestOptions.type + '/' + requestOptions.version;
            }

            /**
             * @function
             */
            function downloadIpa(requestOptions) {
                document.location = 'itms-services://?action=download-manifest&url=https://NGROK_HTTPS_ADDRESS/manifest/' + requestOptions.type + '/' + requestOptions.version + '/manifest.plist';
            }

            download();

        </script>
    </body>
</html>


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

<plugin xmlns="com.kony.sdk/ns/1.0"
    id="com.kony.sdk"
    version="1.0.0">
    <name>KonySDK</name>
    <description>Kony SDK Sync Plugin</description>
    <license>Kony 2.0</license>
    <keywords>Kony, SDK</keywords>

    <js-module src="konylibrary.js" name="konylibrary">
        <clobbers target="konylibrary" />
    </js-module>

	<js-module src="kony-sdk.js" name="kony-sdk">
        <clobbers target="konysdk" />
    </js-module>

    <!-- ios -->
   <platform name="ios">
        <config-file target="config.xml" parent="/*">
            <feature name="KSyncDB">
                <param name="ios-package" value="KSyncDB"/>
            </feature>
        </config-file>

        <header-file src="src/ios/DatabaseHelper.h" />

        <header-file src="src/ios/KSyncDB.h" />

        <source-file src="src/ios/KSyncDB.m" />

		<source-file src="src/ios/libkonyDBCombined.a" framework="true"/>

		<source-file src="src/ios/libsqlcipherUniversal.a" framework="true"/>

    <js-module src="www/ios/KonyIphoneSyncPluginImpl.js" name="Impl">
        <clobbers target="KonyIOSImpl" />
    </js-module>

	<js-module src="www/ios/KonySyncLib.js" name="Lib">
		<clobbers target="sync" />
	</js-module>

    </platform>

	<platform name="android">
        <config-file target="config.xml" parent="/*">
            <feature name="KSyncDB">
                <param name="android-package" value="KSyncDB"/>
            </feature>
        </config-file>

		<js-module src="www/android/konysyncphonegapimpl.js" name="Impl">
		<clobbers target="KonyAndroidImpl" />
		</js-module>

		<js-module src="www/android/KonySyncLib.js" name="Lib">
		<clobbers target="sync" />
		</js-module>

		<source-file src="src/android/KonyDbImplementation.jar"
                target-dir="libs" />

    </platform>
</plugin>


text:
class CreateAdHocVariantExclusions < ActiveRecord::Migration
  def self.up
    create_table :ad_hoc_variant_exclusions do |t|
      t.integer :product_id
      t.timestamps
    end
  end

  def self.down
    drop_table :ad_hoc_variant_exclusions
  end
end


text:
/**
 * @ngdoc directive
 * @name macTime
 * @description
 * A directive for creating a time input field. Time input can use any `ng-` attributes support by text input type.
 *
 * @param {String} ng-model         Assignable angular expression to data-bind to
 * Clearing model by setting it to null or '' will set model back to default value
 * @param {String} name             Property name of the form under which the control is published
 * @param {String} required         Adds `required` validation error key if the value is not entered.
 * @param {String} ng-required      Adds `required` attribute and `required` validation constraint to
 *  the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
 *  `required` when you want to data-bind to the `required` attribute.
 * @param {String} ng-pattern      Sets `pattern` validation error key if the value does not match the
 *  RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
 *    patterns defined as scope expressions.
 * @param {String} ng-change       Angular expression to be executed when input changes due to user interaction with the input element.
 * @param {String} ng-disabled     Enable or disable time input
 *
 * @param {String} mac-time-default If model is undefined, use this as the starting value (default 12:00 PM)
 *
 * @example
<caption>Basic setup</caption>
<example>
  <mac-time id="input-start-time" ng-model="startTime" mac-time-default="11:59 PM" />
</example>
<mac-time id="input-start-time" ng-model="startTime" mac-time-default="11:59 PM" />
 */

angular.module('Mac').directive('macTime', [
  'keys',
  'util',
  'macTimeDefaults',
  'macTimeUtil',
  function (keys, util, defaults, timeUtil) {
    return {
      restrict: 'E',
      require: 'ngModel',
      replace: true,
      template: '<input class="mac-date-time" type="text" maxlength="8">',
      link: function ($scope, element, attrs, ngModelCtrl) {
        var opts, time, timeValidator, whitelistKeys;

        opts = util.extendAttributes('macTime', defaults, attrs);

        whitelistKeys = [keys.UP,
          keys.DOWN,
          keys.LEFT,
          keys.RIGHT,
          keys.A,
          keys.P
        ];

        // Set default placeholder
        if (!attrs.placeholder) {
          attrs.$set('placeholder', opts.placeholder);
        }

        // Validation
        timeValidator = function (value) {
          if (!value || util.validateTime(value)) {
            ngModelCtrl.$setValidity('time', true);
            return value;
          } else {
            ngModelCtrl.$setValidity('time', false);
            return undefined;
          }
        };

        ngModelCtrl.$formatters.push(timeValidator);
        ngModelCtrl.$parsers.push(timeValidator);

        time = timeUtil.initializeTime(opts);

        element.on('blur', function () {
          $scope.$apply(function () {
            timeUtil.updateInput(time, ngModelCtrl);
          });
        });

        /**
         * Note: The initial click into the input will not update the time because the
         * model is empty. The selection by default should be hour
         */
        element.on('click', function () {
          $scope.$apply(function() {
            var isModelSet = !!ngModelCtrl.$modelValue;

            timeUtil.updateTime(time, ngModelCtrl);
            timeUtil.updateInput(time, ngModelCtrl);

            // After the initial view update, selectionStart is set to the end.
            // This is not the desired behavior as it should select hour by default
            if (!isModelSet) {
              timeUtil.selectHours(element);
              return;
            }

            switch (timeUtil.getSelection(element)) {
              case 'hour':
                timeUtil.selectHours(element);
                break;
              case 'minute':
                timeUtil.selectMinutes(element);
                break;
              case 'meridian':
                timeUtil.selectMeridian(element);
                break;
            }
          });

          return true;
        });

        element.on('keydown', function (event) {
          var key = event.which;

          if (whitelistKeys.indexOf(key) === -1) {
            return true;
          }

          event.preventDefault();

          $scope.$apply(function () {
            var change, selection = timeUtil.getSelection(element), meridian;

            if (key === keys.UP || key === keys.DOWN) {
              change = key === keys.UP ? 1 : -1;

              switch (selection) {
                case 'hour':
                  timeUtil.incrementHour(time, change);
                  timeUtil.selectHours(element);
                  break;
                case 'minute':
                  timeUtil.incrementMinute(time, change);
                  timeUtil.selectMinutes(element);
                  break;
                case 'meridian':
                  timeUtil.toggleMeridian(time);
                  timeUtil.selectMeridian(element);
                  break;
              }

              timeUtil.updateInput(time, ngModelCtrl);

            } else if (key === keys.LEFT) {
              timeUtil.selectPreviousSection(element);
              timeUtil.updateInput(time, ngModelCtrl);

            } else if (key === keys.RIGHT) {
              timeUtil.selectNextSection(element);
              timeUtil.updateInput(time, ngModelCtrl);

            } else if ((key === keys.A || key === keys.P) && selection === 'meridian') {
              meridian = key === keys.A ? 'AM' : 'PM';
              timeUtil.setMeridian(time, meridian);

              timeUtil.updateInput(time, ngModelCtrl);
              timeUtil.selectMeridian(element);
            }
          });
        });

        element.on('keyup', function (event) {
          var key = event.which;

          if (!((keys.NUMPAD0 <= key && key <= keys.NUMPAD9) || (keys.ZERO <= key && key <= keys.NINE))) {
            event.preventDefault();
          }

          $scope.$apply(function () {
            timeUtil.updateTime(time, ngModelCtrl);
          });
        });
      }
    };
  }
]);


text:
layout: page
title: Rojas - Mccormick Wedding
date: 2016-05-24
author: Joan Lynch
tags: weekly links, java
status: published
summary: Duis non molestie lectus, ut vulputate felis. Vestibulum volutpat lorem.
banner: images/banner/leisure-01.jpg
booking:
  startDate: 04/12/2019
  endDate: 04/16/2019
  ctyhocn: CCGVAHX
  groupCode: RMW
published: true
---
In placerat, ligula ut egestas lacinia, erat urna pretium mi, eu mattis felis ex sed mauris. Nulla et auctor tellus. Aliquam sed enim eget nibh ornare ornare id non felis. Sed bibendum vel velit non ultrices. Maecenas mauris tellus, sodales sed interdum sit amet, posuere at tellus. Pellentesque nec tellus felis. Proin faucibus odio libero, eget pretium ipsum sagittis nec. Integer orci sem, condimentum at suscipit nec, tempus eget mauris. Suspendisse potenti. Cras tristique ante dignissim, dapibus mi a, feugiat nisi. Praesent scelerisque bibendum dolor at interdum. Sed tempor, ipsum ac efficitur venenatis, mauris urna ullamcorper mi, quis bibendum lacus massa nec ex. Fusce commodo diam dui, vitae aliquet nunc consequat eget.

* Etiam vitae nunc tempor, vehicula elit eget, sagittis velit
* Nam id nulla sit amet nulla dapibus accumsan
* Mauris imperdiet velit eget tincidunt aliquam.

Quisque consequat sapien a posuere posuere. Phasellus leo lorem, faucibus non orci a, vehicula fringilla nunc. Vestibulum id tincidunt libero. Suspendisse potenti. In quis ipsum sit amet nunc interdum mollis in in est. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut sed lectus tincidunt, feugiat massa eget, accumsan felis. In id nisi a arcu pellentesque venenatis. Vivamus commodo nisi at urna mattis, non sagittis nibh venenatis. Nam pellentesque tincidunt enim ac iaculis. Curabitur consequat turpis lobortis fermentum malesuada. Nulla metus ante, bibendum vel volutpat sit amet, condimentum cursus dolor. Phasellus bibendum sapien in consectetur efficitur. Ut pretium erat quis velit aliquam volutpat. Etiam vel neque massa.


text:
Editar <?php echo $documento->codigo; ?> - <?php echo $documento->nur; ?>
 Editar documento <?php echo $documento->codigo; ?>

Edición

Adjuntos

                 Guardar
                | <a href="/pdf/<?php echo $tipo->action ?>.php?id=<?php echo $documento->id; ?>" class="link pdf" target="_blank" title="Imprimir PDF" >PDF
                |
                <?php if ($documento->estado == 1): ?>
                    <a href="/seguimiento/?nur=<?php echo $documento->nur; ?>" class="link derivar" title="Ver seguimiento" >Derivado
                <?php else: ?>
                    <a href="/hojaruta/derivar/?id_doc=<?php echo $documento->id; ?>" class="link derivar" title="Derivar a partir del documento, si ya esta derivado muestra el seguimiento" >Derivar
                <?php endif; ?>
                <?php
                $session = Session::instance();
                if ($session->get('super') == 1):
                    ?>
                    |  <a href="/word/print.php?id=<?php echo $documento->id; ?>" class="link word" target="_blank" title="Editar este documento en word" >Editar en Word
<?php endif; ?>

            <form action="/documento/editar/<?php echo $documento->id; ?>" method="post" id="frmEditar" >
<?php if (sizeof($mensajes) > 0): ?>

                        <?php foreach ($mensajes as $k => $v): ?>
                                <?= $k ?>:  <?php echo $v; ?>

                    <?php endforeach; ?>

                <?php endif; ?>

                <?php
                if ($documento->id_tipo == 5):
                    echo Form::hidden('proceso', 1);
                else:
                    ?>
                    <fieldset> <legend>Proceso: <?php echo Form::select('proceso', $options, $documento->id_proceso); ?></legend>
                                <?php endif; ?>

<?php if ($documento->id_tipo == '5'): ?>

                                        Titulo:
                                        <select name="titulo" class="required">
                                            <option></option>
                                            <option <?php if ($documento->titulo == 'Señor') {
        echo 'selected';
    } ?> >Señor</option>
                                            <option <?php if ($documento->titulo == 'Señora') {
                                    echo 'selected';
                                } ?>>Señora</option>
                                            <option <?php if ($documento->titulo == 'Señores') {
                                    echo 'selected';
                                } ?>>Señores</option>
                                        </select>

<?php else: ?>
                                    <input type="hidden" name="titulo" />
                                    <?php endif; ?>

                                    <?php
                                    echo Form::hidden('id_doc', $documento->id);
                                    echo Form::label('destinatario', 'Nombre del destinatario:', array('class' => 'form'));
                                    echo Form::input('destinatario', $documento->nombre_destinatario, array('id' => 'destinatario', 'size' => 45, 'class' => 'required'));
                                    ?>

<?php
echo Form::label('destinatario', 'Cargo Destinatario:', array('class' => 'form'));
echo Form::input('cargo_des', $documento->cargo_destinatario, array('id' => 'cargo_des', 'size' => 45, 'class' => 'required'));
?>

<?php if ($documento->id_tipo == 5): ?>

                                        Institución Destinatario
                                        <input type="text" size="40" value="<?php echo $documento->institucion_destinatario; ?>" name="institucion_des" />

                                    <input type="hidden" size="40" value="" name="via" />
                                    <input type="hidden" size="40" value="" name="cargovia" />
                                    <?php else: ?>
                                    <input type="hidden" size="40" value="" name="institucion_des" />

    <?php
    echo Form::label('via', 'Via:', array('class' => 'form'));
    echo Form::input('via', $documento->nombre_via, array('id' => 'via', 'size' => 45/* ,'class'=>'required' */));
    ?>
                                        <?php
                                        echo Form::label('cargovia', 'Cargo Via:', array('class' => 'form'));
                                        echo Form::input('cargovia', $documento->cargo_via, array('id' => 'cargovia', 'size' => 45/* ,'class'=>'required' */));
                                        ?>
                                    <?php endif; ?>

                                    <?php
                                    echo Form::label('remitente', 'Nombre del remitente:                                 Mosca', array('class' => 'form'));
                                    echo Form::input('remitente', $documento->nombre_remitente, array('id' => 'remitente', 'size' => 32, 'class' => 'required'));
                                    ?>
                                    <?php
                                    //  echo Form::label('mosca','Mosca:');
                                    echo Form::input('mosca', $documento->mosca_remitente, array('id' => 'mosca', 'size' => 4));
                                    ?>
                                    <?php
                                    echo Form::label('cargo', 'Cargo Remitente:', array('class' => 'form'));
                                    echo Form::input('cargo_rem', $documento->cargo_remitente, array('id' => 'cargo_rem', 'size' => 45, 'class' => 'required'));
                                    ?>
<?php
echo Form::label('adjuntos', 'Adjunto:', array('class' => 'form'));
echo Form::input('adjuntos', $documento->adjuntos, array('id' => 'adjuntos', 'size' => 45/* ,'class'=>'required','title'=>'Ejemplo: Lo citado' */));
?>
<?php
echo Form::label('copias', 'Con copia a:', array('class' => 'form'));
echo Form::input('copias', $documento->copias, array('id' => 'adjuntos', 'size' => 45/* ,'class'=>'required' */));
?>

                                        <?php echo Form::label('dest', 'Mis destinatarios:'); ?>

                                        <?php foreach ($vias as $v): ?>
                                            <li class="<?php echo $v['genero'] ?>"><?php echo HTML::anchor('#', $v['nombre'], array('class' => 'destino', 'nombre' => $v['nombre'], 'title' => $v['cargo'], 'cargo' => $v['cargo'], 'via' => $v['via'], 'cargo_via' => $v['cargo_via'])); ?>

                                        <?php endforeach; ?>

<?php //foreach($superior  as $v){  ?>
                                        <li class="<?php //echo $v['genero'] ?>"><?php //echo HTML::anchor('#',$v['nombre'],array('class'=>'destino','nombre'=>$v['nombre'],'title'=>$v['cargo'],'cargo'=>$v['cargo'],'via'=>'','cargo_via'=>'')); ?>

<?php //}  ?>

<?php // foreach($dependientes  as $v){  ?>
                                        <li class="<?php // echo $v['genero'] ?>"><?php //echo HTML::anchor('#',$v['nombre'],array('class'=>'destino','nombre'=>$v['nombre'],'title'=>$v['cargo'],'cargo'=>$v['cargo'],'via'=>'','cargo_via'=>'')); ?>

<?php //}  ?>

<?php
echo Form::label('referencia', 'Referencia:', array('class' => 'form'));
?>
                                <textarea name="referencia" id="referencia" style="width: 510px;" class="required"><?php echo $documento->referencia ?></textarea>

                                <input type="hidden" id="word" value="0" name="word"  />

<?php
echo Form::textarea('descripcion', $documento->contenido, array('id' => 'descripcion', 'cols' => 50, 'rows' => 20));
?>

                    <input type="hidden" id="con" value="<?php echo strlen($documento->contenido . $documento->referencia); ?> "/>

                    <input type="submit" name="documento" value="Modificar documento" class="uibutton" />

                </fieldset>

            </form>

            <form method="post" enctype="multipart/form-data" action="" >
                Selecione un archivo para subir...
                <input type="file" class="file" name="archivo"/>
                <input type="hidden" name="id_doc" value="<?php echo $documento->id; ?>"/>
                <input type="submit" name="adjuntar" value="subir"/>
            </form>

Archivos Adjuntos

                        NOMBRE ARCHIVO
                        TAMAÑO
                        FECHA DE SUBIDA
                        ACCION

<?php foreach ($archivos as $a): ?>

                            <a href="/descargar.php/?id=<?php echo $a->id; ?>"><?php echo substr($a->nombre_archivo, 13) ?>
                            <?php echo number_format(($a->tamanio / 1024) / 1024, 2) . ' MB'; ?>
                            <?php echo $a->fecha ?>
                            <a href="/archivo/eliminar/<?php echo $a->id; ?>" class="link delete">Eliminar

<?php endforeach; ?>


text:
#import "NSObject.h"

@class NSAttributedString, NSFont, NSString;

@interface _MCMimeEnrichedWriter : NSObject
{
    NSAttributedString *_attributedString;
    NSString *_string;
    CDStruct_2ada2998 _stringBuffer;
    NSFont *_defaultFont;
    NSFont *_defaultFixedPitchFont;
    double _defaultPointSize;
    struct _MCMimeEnrichedWriterCommandStackEntry *_commandStack;
    struct _MCMimeEnrichedWriterCommandStackEntry *_topOfStack;
    struct MCMimeEnrichedState _currentState;
    unsigned long long _currentLineStart;
    unsigned long long _lastSpace;
}

- (id)debugDescription;
- (void)appendTextFromRange:(struct _NSRange)arg1 toString:(id)arg2;
- (void)updateOutput:(id)arg1 forAttributes:(id)arg2 range:(struct _NSRange)arg3;
- (id)convertAttributedString:(id)arg1;
- (void)dealloc;
- (void)setState:(struct MCMimeEnrichedState *)arg1 fromStackEntry:(struct _MCMimeEnrichedWriterCommandStackEntry *)arg2;
- (void)setState:(struct MCMimeEnrichedState *)arg1 fromAttributes:(id)arg2;

@end