text:
"""
    Django to Jinja
    ~~~~~~~~~~~~~~~

    Helper module that can convert django templates into Jinja2 templates.

    This file is not intended to be used as stand alone application but to
    be used as library.  To convert templates you basically create your own
    writer, add extra conversion logic for your custom template tags,
    configure your django environment and run the `convert_templates`
    function.

    Here a simple example::

        # configure django (or use settings.configure)
        import os
        os.environ['DJANGO_SETTINGS_MODULE'] = 'yourapplication.settings'
        from yourapplication.foo.templatetags.bar import MyNode

        from django2jinja import Writer, convert_templates

        def write_my_node(writer, node):
            writer.start_variable()
            writer.write('myfunc(')
            for idx, arg in enumerate(node.args):
                if idx:
                    writer.write(', ')
                writer.node(arg)
            writer.write(')')
            writer.end_variable()

        writer = Writer()
        writer.node_handlers[MyNode] = write_my_node
        convert_templates('/path/to/output/folder', writer=writer)

    Here is an example hos to automatically translate your django
    variables to jinja2::

        import re
        # List of tuple (Match pattern, Replace pattern, Exclusion pattern)

        var_re  = ((re.compile(r"(u|user)\.is_authenticated"), r"\1.is_authenticated()", None),
                  (re.compile(r"\.non_field_errors"), r".non_field_errors()", None),
                  (re.compile(r"\.label_tag"), r".label_tag()", None),
                  (re.compile(r"\.as_dl"), r".as_dl()", None),
                  (re.compile(r"\.as_table"), r".as_table()", None),
                  (re.compile(r"\.as_widget"), r".as_widget()", None),
                  (re.compile(r"\.as_hidden"), r".as_hidden()", None),

                  (re.compile(r"\.get_([0-9_\w]+)_url"), r".get_\1_url()", None),
                  (re.compile(r"\.url"), r".url()", re.compile(r"(form|calendar).url")),
                  (re.compile(r"\.get_([0-9_\w]+)_display"), r".get_\1_display()", None),
                  (re.compile(r"loop\.counter"), r"loop.index", None),
                  (re.compile(r"loop\.revcounter"), r"loop.revindex", None),
                  (re.compile(r"request\.GET\.([0-9_\w]+)"), r"request.GET.get('\1', '')", None),
                  (re.compile(r"request\.get_host"), r"request.get_host()", None),

                  (re.compile(r"\.all(?!_)"), r".all()", None),
                  (re.compile(r"\.all\.0"), r".all()[0]", None),
                  (re.compile(r"\.([0-9])($|\s+)"), r"[\1]\2", None),
                  (re.compile(r"\.items"), r".items()", None),
        )
        writer = Writer(var_re=var_re)

    For details about the writing process have a look at the module code.

    :copyright: (c) 2009 by the Jinja Team.
    :license: BSD.
"""
import re
import os
import sys
from jinja2.defaults import *
from django.conf import settings
from django.template import defaulttags as core_tags, loader, TextNode, \
     FilterExpression, libraries, Variable, loader_tags, TOKEN_TEXT, \
     TOKEN_VAR
from django.template.debug import DebugVariableNode as VariableNode
from django.templatetags import i18n as i18n_tags
from StringIO import StringIO

_node_handlers = {}
_resolved_filters = {}
_newline_re = re.compile(r'(?:\r\n|\r|\n)')

# Django stores an itertools object on the cycle node.  Not only is this
# thread unsafe but also a problem for the converter which needs the raw
# string values passed to the constructor to create a jinja loop.cycle()
# call from it.
_old_cycle_init = core_tags.CycleNode.__init__
def _fixed_cycle_init(self, cyclevars, variable_name=None):
    self.raw_cycle_vars = map(Variable, cyclevars)
    _old_cycle_init(self, cyclevars, variable_name)
core_tags.CycleNode.__init__ = _fixed_cycle_init

def node(cls):
    def proxy(f):
        _node_handlers[cls] = f
        return f
    return proxy

def convert_templates(output_dir, extensions=('.html', '.txt'), writer=None,
                      callback=None):
    """Iterates over all templates in the template dirs configured and
    translates them and writes the new templates into the output directory.
    """
    if writer is None:
        writer = Writer()

    def filter_templates(files):
        for filename in files:
            ifilename = filename.lower()
            for extension in extensions:
                if ifilename.endswith(extension):
                    yield filename

    def translate(f, loadname):
        template = loader.get_template(loadname)
        original = writer.stream
        writer.stream = f
        writer.body(template.nodelist)
        writer.stream = original

    if callback is None:
        def callback(template):
            print template

    for directory in settings.TEMPLATE_DIRS:
        for dirname, _, files in os.walk(directory):
            dirname = dirname[len(directory) + 1:]
            for filename in filter_templates(files):
                source = os.path.normpath(os.path.join(dirname, filename))
                target = os.path.join(output_dir, dirname, filename)
                basetarget = os.path.dirname(target)
                if not os.path.exists(basetarget):
                    os.makedirs(basetarget)
                callback(source)
                f = file(target, 'w')
                try:
                    translate(f, source)
                finally:
                    f.close()

class Writer(object):
    """The core writer class."""

    def __init__(self, stream=None, error_stream=None,
                 block_start_string=BLOCK_START_STRING,
                 block_end_string=BLOCK_END_STRING,
                 variable_start_string=VARIABLE_START_STRING,
                 variable_end_string=VARIABLE_END_STRING,
                 comment_start_string=COMMENT_START_STRING,
                 comment_end_string=COMMENT_END_STRING,
                 initial_autoescape=True,
                 use_jinja_autoescape=False,
                 custom_node_handlers=None,
                 var_re=[],
                 env=None):
        if stream is None:
            stream = sys.stdout
        if error_stream is None:
            error_stream = sys.stderr
        self.stream = stream
        self.error_stream = error_stream
        self.block_start_string = block_start_string
        self.block_end_string = block_end_string
        self.variable_start_string = variable_start_string
        self.variable_end_string = variable_end_string
        self.comment_start_string = comment_start_string
        self.comment_end_string = comment_end_string
        self.autoescape = initial_autoescape
        self.spaceless = False
        self.use_jinja_autoescape = use_jinja_autoescape
        self.node_handlers = dict(_node_handlers,
                                  **(custom_node_handlers or {}))
        self._loop_depth = 0
        self._filters_warned = set()
        self.var_re = var_re
        self.env = env

    def enter_loop(self):
        """Increments the loop depth so that write functions know if they
        are in a loop.
        """
        self._loop_depth += 1

    def leave_loop(self):
        """Reverse of enter_loop."""
        self._loop_depth -= 1

    @property
    def in_loop(self):
        """True if we are in a loop."""
        return self._loop_depth > 0

    def write(self, s):
        """Writes stuff to the stream."""
        self.stream.write(s.encode(settings.FILE_CHARSET))

    def print_expr(self, expr):
        """Open a variable tag, write to the string to the stream and close."""
        self.start_variable()
        self.write(expr)
        self.end_variable()

    def _post_open(self):
        if self.spaceless:
            self.write('- ')
        else:
            self.write(' ')

    def _pre_close(self):
        if self.spaceless:
            self.write(' -')
        else:
            self.write(' ')

    def start_variable(self):
        """Start a variable."""
        self.write(self.variable_start_string)
        self._post_open()

    def end_variable(self, always_safe=False):
        """End a variable."""
        if not always_safe and self.autoescape and \
           not self.use_jinja_autoescape:
            self.write('|e')
        self._pre_close()
        self.write(self.variable_end_string)

    def start_block(self):
        """Starts a block."""
        self.write(self.block_start_string)
        self._post_open()

    def end_block(self):
        """Ends a block."""
        self._pre_close()
        self.write(self.block_end_string)

    def tag(self, name):
        """Like `print_expr` just for blocks."""
        self.start_block()
        self.write(name)
        self.end_block()

    def variable(self, name):
        """Prints a variable.  This performs variable name transformation."""
        self.write(self.translate_variable_name(name))

    def literal(self, value):
        """Writes a value as literal."""
        value = repr(value)
        if value[:2] in ('u"', "u'"):
            value = value[1:]
        self.write(value)

    def filters(self, filters, is_block=False):
        """Dumps a list of filters."""
        want_pipe = not is_block
        for filter, args in filters:
            name = self.get_filter_name(filter)
            if name is None:
                self.warn('Could not find filter %s' % name)
                continue
            if name not in DEFAULT_FILTERS and \
               name not in self._filters_warned:
                self._filters_warned.add(name)
                self.warn('Filter %s probably doesn\'t exist in Jinja' %
                            name)
            if not want_pipe:
                want_pipe = True
            else:
                self.write('|')
            self.write(name)
            if args:
                self.write('(')
                for idx, (is_var, value) in enumerate(args):
                    if idx:
                        self.write(', ')
                    if is_var:
                        self.node(value)
                    else:
                        self.literal(value)
                self.write(')')

    def get_location(self, origin, position):
        """Returns the location for an origin and position tuple as name
        and lineno.
        """
        if hasattr(origin, 'source'):
            source = origin.source
            name = '<unknown source>'
        else:
            source = origin.loader(origin.loadname, origin.dirs)[0]
            name = origin.loadname
        lineno = len(_newline_re.findall(source[:position[0]])) + 1
        return name, lineno

    def warn(self, message, node=None):
        """Prints a warning to the error stream."""
        if node is not None and hasattr(node, 'source'):
            filename, lineno = self.get_location(*node.source)
            message = '[%s:%d] %s' % (filename, lineno, message)
        print >> self.error_stream, message

    def translate_variable_name(self, var):
        """Performs variable name translation."""
        if self.in_loop and var == 'forloop' or var.startswith('forloop.'):
            var = var[3:]

        for reg, rep, unless in self.var_re:
            no_unless = unless and unless.search(var) or True
            if reg.search(var) and no_unless:
                var = reg.sub(rep, var)
                break
        return var

    def get_filter_name(self, filter):
        """Returns the filter name for a filter function or `None` if there
        is no such filter.
        """
        if filter not in _resolved_filters:
            for library in libraries.values():
                for key, value in library.filters.iteritems():
                    _resolved_filters[value] = key
        return _resolved_filters.get(filter, None)

    def node(self, node):
        """Invokes the node handler for a node."""
        for cls, handler in self.node_handlers.iteritems():
            if type(node) is cls or type(node).__name__ == cls:
                handler(self, node)
                break
        else:
            self.warn('Untranslatable node %s.%s found' % (
                node.__module__,
                node.__class__.__name__
            ), node)

    def body(self, nodes):
        """Calls node() for every node in the iterable passed."""
        for node in nodes:
            self.node(node)

@node(TextNode)
def text_node(writer, node):
    writer.write(node.s)

@node(Variable)
def variable(writer, node):
    if node.translate:
        writer.warn('i18n system used, make sure to install translations', node)
        writer.write('_(')
    if node.literal is not None:
        writer.literal(node.literal)
    else:
        writer.variable(node.var)
    if node.translate:
        writer.write(')')

@node(VariableNode)
def variable_node(writer, node):
    writer.start_variable()
    if node.filter_expression.var.var == 'block.super' \
       and not node.filter_expression.filters:
        writer.write('super()')
    else:
        writer.node(node.filter_expression)
    writer.end_variable()

@node(FilterExpression)
def filter_expression(writer, node):
    writer.node(node.var)
    writer.filters(node.filters)

@node(core_tags.CommentNode)
def comment_tag(writer, node):
    pass

@node(core_tags.DebugNode)
def comment_tag(writer, node):
    writer.warn('Debug tag detected.  Make sure to add a global function '
                'called debug to the namespace.', node=node)
    writer.print_expr('debug()')

@node(core_tags.ForNode)
def for_loop(writer, node):
    writer.start_block()
    writer.write('for ')
    for idx, var in enumerate(node.loopvars):
        if idx:
            writer.write(', ')
        writer.variable(var)
    writer.write(' in ')
    if node.is_reversed:
        writer.write('(')
    writer.node(node.sequence)
    if node.is_reversed:
        writer.write(')|reverse')
    writer.end_block()
    writer.enter_loop()
    writer.body(node.nodelist_loop)
    writer.leave_loop()
    writer.tag('endfor')

@node(core_tags.IfNode)
def if_condition(writer, node):
    writer.start_block()
    writer.write('if ')
    join_with = 'and'
    if node.link_type == core_tags.IfNode.LinkTypes.or_:
        join_with = 'or'

    for idx, (ifnot, expr) in enumerate(node.bool_exprs):
        if idx:
            writer.write(' %s ' % join_with)
        if ifnot:
            writer.write('not ')
        writer.node(expr)
    writer.end_block()
    writer.body(node.nodelist_true)
    if node.nodelist_false:
        writer.tag('else')
        writer.body(node.nodelist_false)
    writer.tag('endif')

@node(core_tags.IfEqualNode)
def if_equal(writer, node):
    writer.start_block()
    writer.write('if ')
    writer.node(node.var1)
    if node.negate:
        writer.write(' != ')
    else:
        writer.write(' == ')
    writer.node(node.var2)
    writer.end_block()
    writer.body(node.nodelist_true)
    if node.nodelist_false:
        writer.tag('else')
        writer.body(node.nodelist_false)
    writer.tag('endif')

@node(loader_tags.BlockNode)
def block(writer, node):
    writer.tag('block ' + node.name.replace('-', '_').rstrip('_'))
    node = node
    while node.parent is not None:
        node = node.parent
    writer.body(node.nodelist)
    writer.tag('endblock')

@node(loader_tags.ExtendsNode)
def extends(writer, node):
    writer.start_block()
    writer.write('extends ')
    if node.parent_name_expr:
        writer.node(node.parent_name_expr)
    else:
        writer.literal(node.parent_name)
    writer.end_block()
    writer.body(node.nodelist)

@node(loader_tags.ConstantIncludeNode)
@node(loader_tags.IncludeNode)
def include(writer, node):
    writer.start_block()
    writer.write('include ')
    if hasattr(node, 'template'):
        writer.literal(node.template.name)
    else:
        writer.node(node.template_name)
    writer.end_block()

@node(core_tags.CycleNode)
def cycle(writer, node):
    if not writer.in_loop:
        writer.warn('Untranslatable free cycle (cycle outside loop)', node=node)
        return
    if node.variable_name is not None:
        writer.start_block()
        writer.write('set %s = ' % node.variable_name)
    else:
        writer.start_variable()
    writer.write('loop.cycle(')
    for idx, var in enumerate(node.raw_cycle_vars):
        if idx:
            writer.write(', ')
        writer.node(var)
    writer.write(')')
    if node.variable_name is not None:
        writer.end_block()
    else:
        writer.end_variable()

@node(core_tags.FilterNode)
def filter(writer, node):
    writer.start_block()
    writer.write('filter ')
    writer.filters(node.filter_expr.filters, True)
    writer.end_block()
    writer.body(node.nodelist)
    writer.tag('endfilter')

@node(core_tags.AutoEscapeControlNode)
def autoescape_control(writer, node):
    original = writer.autoescape
    writer.autoescape = node.setting
    writer.body(node.nodelist)
    writer.autoescape = original

@node(core_tags.SpacelessNode)
def spaceless(writer, node):
    original = writer.spaceless
    writer.spaceless = True
    writer.warn('entering spaceless mode with different semantics', node)
    # do the initial stripping
    nodelist = list(node.nodelist)
    if nodelist:
        if isinstance(nodelist[0], TextNode):
            nodelist[0] = TextNode(nodelist[0].s.lstrip())
        if isinstance(nodelist[-1], TextNode):
            nodelist[-1] = TextNode(nodelist[-1].s.rstrip())
    writer.body(nodelist)
    writer.spaceless = original

@node(core_tags.TemplateTagNode)
def template_tag(writer, node):
    tag = {
        'openblock':            writer.block_start_string,
        'closeblock':           writer.block_end_string,
        'openvariable':         writer.variable_start_string,
        'closevariable':        writer.variable_end_string,
        'opencomment':          writer.comment_start_string,
        'closecomment':         writer.comment_end_string,
        'openbrace':            '{',
        'closebrace':           '}'
    }.get(node.tagtype)
    if tag:
        writer.start_variable()
        writer.literal(tag)
        writer.end_variable()

@node(core_tags.URLNode)
def url_tag(writer, node):
    writer.warn('url node used.  make sure to provide a proper url() '
                'function', node)
    if node.asvar:
        writer.start_block()
        writer.write('set %s = ' % node.asvar)
    else:
        writer.start_variable()
    autoescape = writer.autoescape
    writer.write('url(')
    writer.literal(node.view_name)
    for arg in node.args:
        writer.write(', ')
        writer.node(arg)
    for key, arg in node.kwargs.items():
        writer.write(', %s=' % key)
        writer.node(arg)
    writer.write(')')
    if node.asvar:
        writer.end_block()
    else:
        writer.end_variable()

@node(core_tags.WidthRatioNode)
def width_ratio(writer, node):
    writer.warn('widthratio expanded into formula.  You may want to provide '
                'a helper function for this calculation', node)
    writer.start_variable()
    writer.write('(')
    writer.node(node.val_expr)
    writer.write(' / ')
    writer.node(node.max_expr)
    writer.write(' * ')
    writer.write(str(int(node.max_width)))
    writer.write(')|round|int')
    writer.end_variable(always_safe=True)

@node(core_tags.WithNode)
def with_block(writer, node):
    writer.warn('with block expanded into set statement.  This could cause '
                'variables following that block to be overridden.', node)
    writer.start_block()
    writer.write('set %s = ' % node.name)
    writer.node(node.var)
    writer.end_block()
    writer.body(node.nodelist)

@node(core_tags.RegroupNode)
def regroup(writer, node):
    if node.expression.var.literal:
        writer.warn('literal in groupby filter used.   Behavior in that '
                    'situation is undefined and translation is skipped.', node)
        return
    elif node.expression.filters:
        writer.warn('filters in groupby filter used.   Behavior in that '
                    'situation is undefined which is most likely a bug '
                    'in your code.  Filters were ignored.', node)
    writer.start_block()
    writer.write('set %s = ' % node.var_name)
    writer.node(node.target)
    writer.write('|groupby(')
    writer.literal(node.expression.var.var)
    writer.write(')')
    writer.end_block()

@node(core_tags.LoadNode)
def warn_load(writer, node):
    writer.warn('load statement used which was ignored on conversion', node)

@node(i18n_tags.GetAvailableLanguagesNode)
def get_available_languages(writer, node):
    writer.warn('make sure to provide a get_available_languages function', node)
    writer.tag('set %s = get_available_languages()' %
               writer.translate_variable_name(node.variable))

@node(i18n_tags.GetCurrentLanguageNode)
def get_current_language(writer, node):
    writer.warn('make sure to provide a get_current_language function', node)
    writer.tag('set %s = get_current_language()' %
               writer.translate_variable_name(node.variable))

@node(i18n_tags.GetCurrentLanguageBidiNode)
def get_current_language_bidi(writer, node):
    writer.warn('make sure to provide a get_current_language_bidi function', node)
    writer.tag('set %s = get_current_language_bidi()' %
               writer.translate_variable_name(node.variable))

@node(i18n_tags.TranslateNode)
def simple_gettext(writer, node):
    writer.warn('i18n system used, make sure to install translations', node)
    writer.start_variable()
    writer.write('_(')
    writer.node(node.value)
    writer.write(')')
    writer.end_variable()

@node(i18n_tags.BlockTranslateNode)
def translate_block(writer, node):
    first_var = []
    variables = set()

    def touch_var(name):
        variables.add(name)
        if not first_var:
            first_var.append(name)

    def dump_token_list(tokens):
        for token in tokens:
            if token.token_type == TOKEN_TEXT:
                writer.write(token.contents)
            elif token.token_type == TOKEN_VAR:
                writer.print_expr(token.contents)
                touch_var(token.contents)

    writer.warn('i18n system used, make sure to install translations', node)
    writer.start_block()
    writer.write('trans')
    idx = -1
    for idx, (key, var) in enumerate(node.extra_context.items()):
        if idx:
            writer.write(',')
        writer.write(' %s=' % key)
        touch_var(key)
        writer.node(var.filter_expression)

    have_plural = False
    plural_var = None
    if node.plural and node.countervar and node.counter:
        have_plural = True
        plural_var = node.countervar
        if plural_var not in variables:
            if idx > -1:
                writer.write(',')
            touch_var(plural_var)
            writer.write(' %s=' % plural_var)
            writer.node(node.counter)

    writer.end_block()
    dump_token_list(node.singular)
    if node.plural and node.countervar and node.counter:
        writer.start_block()
        writer.write('pluralize')
        if node.countervar != first_var[0]:
            writer.write(' ' + node.countervar)
        writer.end_block()
        dump_token_list(node.plural)
    writer.tag('endtrans')

@node("SimpleNode")
def simple_tag(writer, node):
    """Check if the simple tag exist as a filter in """
    name = node.tag_name
    if writer.env and \
       name not in writer.env.filters and \
       name not in writer._filters_warned:
        writer._filters_warned.add(name)
        writer.warn('Filter %s probably doesn\'t exist in Jinja' %
                    name)

    if not node.vars_to_resolve:
        # No argument, pass the request
        writer.start_variable()
        writer.write('request|')
        writer.write(name)
        writer.end_variable()
        return

    first_var =  node.vars_to_resolve[0]
    args = node.vars_to_resolve[1:]
    writer.start_variable()

    # Copied from Writer.filters()
    writer.node(first_var)

    writer.write('|')
    writer.write(name)
    if args:
        writer.write('(')
        for idx, var in enumerate(args):
            if idx:
                writer.write(', ')
            if var.var:
                writer.node(var)
            else:
                writer.literal(var.literal)
        writer.write(')')
    writer.end_variable()

# get rid of node now, it shouldn't be used normally
del node


text:
package com.johnscottwagner.bus;

import com.johnscottwagner.bus.components.Message;
import com.johnscottwagner.bus.components.MessageHandler;
import com.johnscottwagner.bus.components.Request;
import com.johnscottwagner.bus.components.RequestHandler;
import com.johnscottwagner.bus.components.Response;

import java.util.List;

public interface Bus {

    void sendMessage(final Message message);
    Response sendRequest(final Request request);
    void registerMessageHandlers(final List<MessageHandler> messageHandlers);
    void registerRequestHandlers(final List<RequestHandler> requestHandlers);
}

redpajama_set_name: RedPajamaGithub


text:
namespace Owin.Scim.v1.Endpoints
{
    using System.Net.Http;
    using System.Threading.Tasks;
    using System.Web.Http;

    using Configuration;

    using Extensions;

    using Scim.Endpoints;
    using Scim.Services;

    [AllowAnonymous]
    [RoutePrefix(ScimConstantsV1.Endpoints.Schemas)]
    public class SchemasController : ScimControllerBase
    {
        public const string GetSchemasRouteName = @"GetSchemas1";

        private readonly ISchemaService _SchemaService;

        public SchemasController(
            ScimServerConfiguration serverConfiguration,
            ISchemaService schemaService)
            : base(serverConfiguration)
        {
            _SchemaService = schemaService;
        }

        [Route("{schemaId?}", Name = GetSchemasRouteName)]
        public async Task<HttpResponseMessage> GetSchemas(string schemaId = null)
        {
            if (string.IsNullOrWhiteSpace(schemaId))
                return (await _SchemaService.GetSchemas())
                    .Let(schemata => SetMetaLocations(schemata, GetSchemasRouteName, schema => new { schemaId = schema.Id }))
                    .ToHttpResponseMessage(Request);

            return (await _SchemaService.GetSchema(schemaId))
                .Let(schema => SetMetaLocation(schema, GetSchemasRouteName, new { schemaId = schema.Id }))
                .ToHttpResponseMessage(Request, (schema, response) => SetContentLocationHeader(response, GetSchemasRouteName, new { schemaId = schema.Id }));
        }
    }
}


text:
<title>About $pref['brandname']</title>
<META http-equiv=Content-Type content="text/html; charset=utf-8">

$var['atmailstyle']

Version: $pref['version']

Build-Date: $pref['builddate']

Operating System: $var['os']

Admin Email: $pref['admin_email']

Copyright  Atmail : All Rights Reserved


text:
package ro.pub.cs.systems.pdsd.lab05.sample09baseadapter.view;

import java.io.InputStream;
import java.util.ArrayList;

import ro.pub.cs.systems.pdsd.lab05.sample09baseadapter.R;
import ro.pub.cs.systems.pdsd.lab05.sample09baseadapter.controller.CartoonAdapter;
import ro.pub.cs.systems.pdsd.lab05.sample09baseadapter.model.Cartoon;
import ro.pub.cs.systems.pdsd.lab05.sample09baseadapter.utils.CartoonsXmlParser;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.widget.ListView;

public class CartoonActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		try {
			ListView listView1 = (ListView)findViewById(R.id.listView1);
			CartoonsXmlParser cartoonXmlParser = new CartoonsXmlParser();
			InputStream inputstream = getAssets().open("cartoons.xml");
		    ArrayList<Cartoon> cartoons = cartoonXmlParser.parse(inputstream);
		    for (int count=0; count<cartoons.size(); count++)
		    	Log.println(Log.DEBUG, "tag", cartoons.get(count).toString());
		    CartoonAdapter cartoonAdapter = new CartoonAdapter(this, cartoons);
		    listView1.setAdapter(cartoonAdapter);
		}
	    catch (Exception exception) {
	    	Log.println(Log.ERROR, "error", exception.getMessage());
	    }
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}


text:
/* Commentary:
 *
 */

/* Change log:
 *
 */

#include "dtkComposerNodeStringOperator.h"
#include "dtkComposerTransmitterEmitter.h"
#include "dtkComposerTransmitterReceiver.h"

#include <dtkMeta>
#include <dtkLog>

// /////////////////////////////////////////////////////////////////
// dtkComposerNodeStringOperatorUnary
// /////////////////////////////////////////////////////////////////

class dtkComposerNodeStringOperatorUnaryPrivate
{
public:
    dtkComposerTransmitterReceiver<QString> receiver;

public:
    dtkComposerTransmitterEmitter<QString> emitter;

public:
    QString value;
};

dtkComposerNodeStringOperatorUnary::dtkComposerNodeStringOperatorUnary(void) : dtkComposerNodeLeaf(), d(new dtkComposerNodeStringOperatorUnaryPrivate)
{
    this->appendReceiver(&(d->receiver));

    this->appendEmitter(&(d->emitter));
}

dtkComposerNodeStringOperatorUnary::~dtkComposerNodeStringOperatorUnary(void)
{
    delete d;

    d = NULL;
}

// /////////////////////////////////////////////////////////////////
// dtkComposerNodeStringOperatorBinary
// /////////////////////////////////////////////////////////////////

class dtkComposerNodeStringOperatorBinaryPrivate
{
public:
    dtkComposerTransmitterReceiver<QString> receiver_lhs;
    dtkComposerTransmitterReceiver<QString> receiver_rhs;

public:
    dtkComposerTransmitterEmitter<QString> emitter;

public:
    QString value;
};

dtkComposerNodeStringOperatorBinary::dtkComposerNodeStringOperatorBinary(void) : dtkComposerNodeLeaf(), d(new dtkComposerNodeStringOperatorBinaryPrivate)
{
    this->appendReceiver(&(d->receiver_lhs));
    this->appendReceiver(&(d->receiver_rhs));

    this->appendEmitter(&(d->emitter));
}

dtkComposerNodeStringOperatorBinary::~dtkComposerNodeStringOperatorBinary(void)
{
    delete d;

    d = NULL;
}

// /////////////////////////////////////////////////////////////////
// dtkComposerNodeStringOperatorBinaryLogic
// /////////////////////////////////////////////////////////////////

class dtkComposerNodeStringOperatorBinaryLogicPrivate
{
public:
    dtkComposerTransmitterReceiver<QString> receiver_lhs;
    dtkComposerTransmitterReceiver<QString> receiver_rhs;

public:
    dtkComposerTransmitterEmitter<bool> emitter;

public:
    bool value;
};

dtkComposerNodeStringOperatorBinaryLogic::dtkComposerNodeStringOperatorBinaryLogic(void) : dtkComposerNodeLeaf(), d(new dtkComposerNodeStringOperatorBinaryLogicPrivate)
{
    this->appendReceiver(&(d->receiver_lhs));
    this->appendReceiver(&(d->receiver_rhs));

    this->appendEmitter(&(d->emitter));
}

dtkComposerNodeStringOperatorBinaryLogic::~dtkComposerNodeStringOperatorBinaryLogic(void)
{
    delete d;

    d = NULL;
}

// /////////////////////////////////////////////////////////////////
// dtkComposerNodeStringOperatorBinary - Append
// /////////////////////////////////////////////////////////////////

void dtkComposerNodeStringOperatorBinaryAppend::run(void)
{
    d->emitter.setData( d->receiver_lhs.data() + d->receiver_rhs.data() );
}

// /////////////////////////////////////////////////////////////////
// dtkComposerNodeStringOperatorBinaryLogic - Equality
// /////////////////////////////////////////////////////////////////

void dtkComposerNodeStringOperatorBinaryLogicEquality::run(void)
{
    d->emitter.setData( d->receiver_lhs.data() == d->receiver_rhs.data() );
}

// /////////////////////////////////////////////////////////////////
// dtkComposerNodeStringReplace
// /////////////////////////////////////////////////////////////////

class dtkComposerNodeStringReplacePrivate
{
public:
    dtkComposerTransmitterReceiver<QString> receiver_string;
    dtkComposerTransmitterReceiver<QString> receiver_regexp;
    dtkComposerTransmitterReceiver<QString> receiver_after;

public:
    dtkComposerTransmitterEmitter<QString> emitter;

public:
    QString value;
};

dtkComposerNodeStringReplace::dtkComposerNodeStringReplace(void) : dtkComposerNodeLeaf(), d(new dtkComposerNodeStringReplacePrivate)
{
    this->appendReceiver(&(d->receiver_string));
    this->appendReceiver(&(d->receiver_regexp));
    this->appendReceiver(&(d->receiver_after));

    this->appendEmitter(&(d->emitter));
}

dtkComposerNodeStringReplace::~dtkComposerNodeStringReplace(void)
{
    delete d;

    d = NULL;
}

void dtkComposerNodeStringReplace::run(void)
{
    QString from   = d->receiver_string.data();
    QRegExp regexp = QRegExp(d->receiver_regexp.data());
    QString after  = d->receiver_after.data();
    d->value = from.replace(regexp,after);
    d->emitter.setData(d->value);
}

// /////////////////////////////////////////////////////////////////
// dtkComposerNodeStringListAppend
// /////////////////////////////////////////////////////////////////

class dtkComposerNodeStringListAppendPrivate
{
public:
    dtkComposerTransmitterReceiver<QStringList *> receiver_list;
    dtkComposerTransmitterReceiver<QString> receiver_string;

public:
    dtkComposerTransmitterEmitter<QStringList *> emitter;

public:
    QStringList list;
};

dtkComposerNodeStringListAppend::dtkComposerNodeStringListAppend(void) : dtkComposerNodeLeaf(), d(new dtkComposerNodeStringListAppendPrivate)
{
    this->appendReceiver(&(d->receiver_list));
    this->appendReceiver(&(d->receiver_string));

    d->emitter.setData(&d->list);
    this->appendEmitter(&(d->emitter));
}

dtkComposerNodeStringListAppend::~dtkComposerNodeStringListAppend(void)
{
    delete d;

    d = NULL;
}

void dtkComposerNodeStringListAppend::run(void)
{
    if (!d->receiver_list.isEmpty() && !d->receiver_string.isEmpty() ) {
        d->list = *(d->receiver_list.data());
        d->list.append(d->receiver_string.data());
    } else if (d->receiver_list.isEmpty() && !d->receiver_string.isEmpty() ) {
        d->list.clear();
        d->list.append(d->receiver_string.data());
    } else {
        dtkWarn() << "Inputs not specified. Nothing is done";
        d->emitter.clearData();
    }
}

// /////////////////////////////////////////////////////////////////
// dtkComposerNodeStringListExtract
// /////////////////////////////////////////////////////////////////

class dtkComposerNodeStringListExtractPrivate
{
public:
    dtkComposerTransmitterReceiver<QStringList *> receiver_list;
    dtkComposerTransmitterReceiver<qlonglong> receiver_index;

public:
    dtkComposerTransmitterEmitter<QString> emitter;

public:
    QString value;
};

dtkComposerNodeStringListExtract::dtkComposerNodeStringListExtract(void) : dtkComposerNodeLeaf(), d(new dtkComposerNodeStringListExtractPrivate)
{
    this->appendReceiver(&(d->receiver_list));
    this->appendReceiver(&(d->receiver_index));

    this->appendEmitter(&(d->emitter));
}

dtkComposerNodeStringListExtract::~dtkComposerNodeStringListExtract(void)
{
    delete d;

    d = NULL;
}

void dtkComposerNodeStringListExtract::run(void)
{
    if (!d->receiver_list.isEmpty() && !d->receiver_index.isEmpty() ) {
        QStringList *list = d->receiver_list.data();
        d->value = list->at(d->receiver_index.data());
        d->emitter.setData(d->value);
    } else {
        dtkWarn() << "Inputs not specified. Nothing is done";
        d->emitter.clearData();
    }
}

// /////////////////////////////////////////////////////////////////
// dtkComposerNodeStringListSet
// /////////////////////////////////////////////////////////////////

class dtkComposerNodeStringListSetPrivate
{
public:
    dtkComposerTransmitterReceiver<QStringList *> receiver_list;
    dtkComposerTransmitterReceiver<qlonglong> receiver_index;
    dtkComposerTransmitterReceiver<QString> receiver_value;

public:
    dtkComposerTransmitterEmitter<QStringList *> emitter;

public:
    QStringList list;
};

dtkComposerNodeStringListSet::dtkComposerNodeStringListSet(void) : dtkComposerNodeLeaf(), d(new dtkComposerNodeStringListSetPrivate)
{
    this->appendReceiver(&(d->receiver_list));
    this->appendReceiver(&(d->receiver_index));
    this->appendReceiver(&(d->receiver_value));

    d->emitter.setData(&d->list);
    this->appendEmitter(&(d->emitter));
}

dtkComposerNodeStringListSet::~dtkComposerNodeStringListSet(void)
{
    delete d;

    d = NULL;
}

void dtkComposerNodeStringListSet::run(void)
{
    if (!d->receiver_list.isEmpty() && !d->receiver_value.isEmpty()&& !d->receiver_index.isEmpty()  ) {
        d->list = *(d->receiver_list.data());
        qlonglong index = d->receiver_index.data();
         if (index >= 0 && index < d->list.size())
             d->list.replace(index, d->receiver_value.data());
         else
             dtkWarn() << "bad index value in set string list" << index;
    } else {
        dtkWarn() << "Inputs not specified. Nothing is done";
        d->emitter.clearData();
    }

}


text:
'use strict';

var adapters = ['local', 'http'];
var repl_adapters = [
  ['local', 'http'],
  ['http', 'http'],
  ['http', 'local'],
  ['local', 'local']
];

adapters.forEach(function (adapter) {
  describe('test.attachments.js-' + adapter, function () {

    var dbs = {};

    beforeEach(function (done) {
      dbs.name = testUtils.adapterUrl(adapter, 'test_attach');
      testUtils.cleanup([dbs.name], done);
    });

    after(function (done) {
      testUtils.cleanup([dbs.name], done);
    });

    var binAttDoc = {
      _id: 'bin_doc',
      _attachments: {
        'foo.txt': {
          content_type: 'text/plain',
          data: 'VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ='
        }
      }
    };
    // empty attachment
    var binAttDoc2 = {
      _id: 'bin_doc2',
      _attachments: {
        'foo.txt': {
          content_type: 'text/plain',
          data: ''
        }
      }
    };
    // json string doc
    var jsonDoc = {
      _id: 'json_doc',
      _attachments: {
        'foo.json': {
          content_type: 'application/json',
          data: 'eyJIZWxsbyI6IndvcmxkIn0='
        }
      }
    };
    var pngAttDoc = {
      _id: 'png_doc',
      _attachments: {
        'foo.png': {
          content_type: 'image/png',
          data: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAMFBMVEX+9+' +
                'j+9OD+7tL95rr93qT80YD7x2L6vkn6syz5qRT4ogT4nwD4ngD4nQD4nQD4' +
                'nQDT2nT/AAAAcElEQVQY002OUQLEQARDw1D14f7X3TCdbfPnhQTqI5UqvG' +
                'OWIz8gAIXFH9zmC63XRyTsOsCWk2A9Ga7wCXlA9m2S6G4JlVwQkpw/Ymxr' +
                'UgNoMoyxBwSMH/WnAzy5cnfLFu+dK2l5gMvuPGLGJd1/9AOiBQiEgkzOpg' +
                'AAAABJRU5ErkJggg=='
        }
      }
    };

    it('Test some attachments', function (done) {
      var db = new PouchDB(dbs.name);
      db.put(binAttDoc, function (err, write) {
        should.not.exist(err, 'saved doc with attachment');
        db.get('bin_doc', function (err, doc) {
          should.exist(doc._attachments, 'doc has attachments field');
          should.exist(doc._attachments['foo.txt'], 'doc has attachment');
          doc._attachments['foo.txt'].content_type.should.equal('text/plain');
          db.getAttachment('bin_doc', 'foo.txt', function (err, res) {
            testUtils.readBlob(res, function (data) {
              data.should.equal('This is a base64 encoded text');
              db.put(binAttDoc2, function (err, rev) {
                db.getAttachment('bin_doc2', 'foo.txt',
                  function (err, res, xhr) {
                  testUtils.readBlob(res, function (data) {
                    data.should.equal('', 'Correct data returned');
                    moreTests(rev.rev);
                  });
                });
              });
            });
          });
        });
      });

      function moreTests(rev) {
        var blob = testUtils.makeBlob('This is no base64 encoded text');
        db.putAttachment('bin_doc2', 'foo2.txt', rev, blob, 'text/plain',
                         function (err, wtf) {
          db.getAttachment('bin_doc2', 'foo2.txt', function (err, res, xhr) {
            testUtils.readBlob(res, function (data) {
              should.exist(data);
              db.get('bin_doc2', { attachments: true },
                function (err, res, xhr) {
                should.exist(res._attachments, 'Result has attachments field');
                should.not
                  .exist(res._attachments['foo2.txt'].stub, 'stub is false');
                res._attachments['foo2.txt'].data.should
                  .equal('VGhpcyBpcyBubyBiYXNlNjQgZW5jb2RlZCB0ZXh0');
                res._attachments['foo2.txt'].content_type.should
                  .equal('text/plain');
                res._attachments['foo.txt'].data.should.equal('');
                done();
              });
            });
          });
        });
      }
    });

    it('Test getAttachment', function (done) {
      var db = new PouchDB(dbs.name);
      db.put(binAttDoc, function (err, res) {
        db.getAttachment('bin_doc', 'foo.txt', function (err, res) {
          if (err) {
            return done(err);
          }
          testUtils.readBlob(res, function (data) {
            data.should.equal('This is a base64 encoded text', 'correct data');
            done();
          });
        });
      });
    });

    it('Test attachments in allDocs/changes', function (done) {
      var db = new PouchDB(dbs.name);
      var docs = [
        { _id: 'doc0' },
        {
          _id: 'doc1',
          _attachments: {
            'att0': {
              data: 'YXR0YWNobWVudDA=',
              content_type: 'text/plain'
            }
          }
        },
        {
          _id: 'doc2',
          _attachments: {
            'att0': {
              data: 'YXR0YWNobWVudDA=',
              content_type: 'text/plain'
            },
            'att1': {
              data: 'YXR0YWNobWVudDE=',
              content_type: 'text/plain'
            }
          }
        },
        {
          _id: 'doc3',
          _attachments: {
            'att0': {
              data: 'YXR0YWNobWVudDA=',
              content_type: 'text/plain'
            }
          }
        }
      ];
      function sort(a, b) {
        return a.id.localeCompare(b.id);
      }
      db.bulkDocs({ docs: docs }, function (err, res) {
        db.allDocs({ include_docs: true }, function (err, res) {
          for (var i = 0; i < docs.length; i++) {
            var attachmentsNb = typeof docs[i]._attachments !== 'undefined' ?
              Object.keys(docs[i]._attachments).length : 0;
            for (var j = 0; j < attachmentsNb; j++) {
              res.rows[i].doc._attachments['att' + j].stub.should
                .equal(true, '(allDocs) doc' + i + ' contains att' + j +
                       ' stub');
            }
          }
          should.not.exist(res.rows[0].doc._attachments,
                           '(allDocs) doc0 contains no attachments');
          db.changes({
            include_docs: true,
            onChange: function (change) {
              var i = +change.id.substr(3);
              if (i === 0) {
                should.not.exist(res.rows[0].doc._attachments,
                                 '(onChange) doc0 contains no attachments');
              } else {
                var attachmentsNb =
                  typeof docs[i]._attachments !== 'undefined' ?
                  Object.keys(docs[i]._attachments).length : 0;
                for (var j = 0; j < attachmentsNb; j++) {
                  res.rows[i].doc._attachments['att' + j].stub.should
                    .equal(true, '(onChange) doc' + i + ' contains att' + j +
                           ' stub');
                }
              }
            },
            complete: function (err, res) {
              var attachmentsNb = 0;
              res.results.sort(sort);
              for (var i = 0; i < 3; i++) {
                attachmentsNb = typeof docs[i]._attachments !== 'undefined' ?
                  Object.keys(docs[i]._attachments).length : 0;
                for (var j = 0; j < attachmentsNb; j++) {
                  res.results[i].doc._attachments['att' + j].stub.should
                    .equal(true, '(complete) doc' + i + ' contains att' + j +
                           ' stub');
                }
              }
              should.not.exist(res.results[0].doc._attachments,
                               '(complete) doc0 contains no attachments');
              done();
            }
          });
        });
      });
    });

    it('Test getAttachment with PNG', function (done) {
      var db = new PouchDB(dbs.name);
      db.put(pngAttDoc, function (err, res) {
        if (err) { return done(err); }
        db.getAttachment('png_doc', 'foo.png', function (err, res) {
          if (err) { return done(err); }
          testUtils.base64Blob(res, function (data) {
            data.should
              .equal(pngAttDoc._attachments['foo.png'].data, 'correct data');
            done();
          });
        });
      });
    });

    it('Testing with invalid docs', function (done) {
      var db = new PouchDB(dbs.name);
      var invalidDoc = {
        '_id': '_invalid',
        foo: 'bar'
      };
      db.bulkDocs({
        docs: [
          invalidDoc,
          binAttDoc
        ]
      }, function (err, info) {
        should.exist(err, 'bad request');
        done();
      });
    });

    it('Test create attachment and doc in one go', function (done) {
      var db = new PouchDB(dbs.name);
      var blob = testUtils.makeBlob('Mytext');
      db.putAttachment('anotherdoc', 'mytext', blob, 'text/plain',
        function (err, res) {
        should.exist(res.ok);
        done();
      });
    });

    it('Test create attachment and doc in one go without callback',
      function (done) {
      var db = new PouchDB(dbs.name);
      var changes = db.changes({
        complete: function (err, result) {
          result.status.should.equal('cancelled');
          done();
        },
        live: true,
        onChange: function (change) {
          if (change.seq === 1) {
            change.id.should.equal('anotherdoc2', 'Doc has been created');
            db.get(change.id, { attachments: true }, function (err, doc) {
              doc._attachments.should.be
                .an('object', 'doc has attachments object');
              should.exist(doc._attachments.mytext,
                           'doc has attachments attachment');
              doc._attachments.mytext.data.should
                .equal('TXl0ZXh0', 'doc has attachments attachment');
              changes.cancel();
            });
          }
        }
      });
      var blob = testUtils.makeBlob('Mytext');
      db.putAttachment('anotherdoc2', 'mytext', blob, 'text/plain');
    });

    it('Test create attachment without callback', function (done) {
      var db = new PouchDB(dbs.name);
      db.put({ _id: 'anotherdoc3' }, function (err, resp) {
        should.not.exist(err, 'doc was saved');
        var changes = db.changes({
          complete: function (err, result) {
            result.status.should.equal('cancelled');
            done();
          },
          live: true,
          include_docs: true,
          onChange: function (change) {
            if (change.seq === 2) {
              change.id.should.equal('anotherdoc3', 'Doc has been created');
              db.get(change.id, { attachments: true }, function (err, doc) {
                doc._attachments.should.be.an('object',
                                              'doc has attachments object');
                should.exist(doc._attachments.mytext);
                doc._attachments.mytext.data.should.equal('TXl0ZXh0');
                changes.cancel();
              });
            }
          }
        });
        var blob = testUtils.makeBlob('Mytext');
        db.putAttachment('anotherdoc3', 'mytext', resp.rev, blob, 'text/plain');
      });
    });

    it('Test put attachment on a doc without attachments', function (done) {
      var db = new PouchDB(dbs.name);
      db.put({ _id: 'mydoc' }, function (err, resp) {
        var blob = testUtils.makeBlob('Mytext');
        db.putAttachment('mydoc', 'mytext', resp.rev, blob, 'text/plain',
                         function (err, res) {
          should.exist(res.ok);
          done();
        });
      });
    });

    it('Testing with invalid rev', function (done) {
      var db = new PouchDB(dbs.name);
      var doc = { _id: 'adoc' };
      db.put(doc, function (err, resp) {
        should.not.exist(err, 'Doc has been saved');
        doc._rev = resp.rev;
        doc.foo = 'bar';
        db.put(doc, function (err, resp) {
          should.not.exist(err, 'Doc has been updated');
          var blob = testUtils.makeBlob('bar');
          db.putAttachment('adoc', 'foo.txt', doc._rev, blob, 'text/plain',
                           function (err) {
            should.exist(err, 'Attachment has not been saved');
            err.name.should.equal('conflict', 'error is a conflict');
            done();
          });
        });
      });
    });

    it('Test put another attachment on a doc with attachments',
      function (done) {
      var db = new PouchDB(dbs.name);
      db.put({ _id: 'mydoc' }, function (err, res1) {
        var blob = testUtils.makeBlob('Mytext');
        db.putAttachment('mydoc', 'mytext', res1.rev, blob, 'text/plain',
                         function (err, res2) {
          db.putAttachment('mydoc', 'mytext2', res2.rev, blob, 'text/plain',
                           function (err, res3) {
            should.exist(res3.ok);
            done();
          });
        });
      });
    });

    it('Test get with attachments: true if empty attachments', function (done) {
      var db = new PouchDB(dbs.name);
      db.put({
        _id: 'foo',
        _attachments: {}
      }, function (err, resp) {
        db.get('foo', { attachments: true }, function (err, res) {
          res._id.should.equal('foo');
          done();
        });
      });
    });

    it('Test delete attachment from a doc', function (done) {
      var db = new PouchDB(dbs.name);
      db.put({
        _id: 'mydoc',
        _attachments: {
          'mytext1': {
            content_type: 'text/plain',
            data: 'TXl0ZXh0MQ=='
          },
          'mytext2': {
            content_type: 'text/plain',
            data: 'TXl0ZXh0Mg=='
          }
        }
      }, function (err, res) {
        var rev = res.rev;
        db.get('mydoc', { attachments: true }, function (err, res) {
          res._attachments.should.include.keys('mytext1', 'mytext2');
          db.removeAttachment('mydoc', 'mytext1', 0, function (err, res) {
            should.exist(err, 'removal should fail due to broken rev');
            db.removeAttachment('mydoc', 'mytext1', rev, function (err, res) {
              db.get('mydoc', { attachments: true }, function (err, res) {
                res._attachments.should.not.include.keys('mytext1');
                res._attachments.should.include.keys('mytext2');
                db.removeAttachment('mydoc', 'mytext2', res._rev,
                  function (err, res) {
                  should.not.exist(res._attachments);
                  done();
                });
              });
            });
          });
        });
      });
    });

    it('Test a document with a json string attachment', function (done) {
      var db = new PouchDB(dbs.name);
      db.put(jsonDoc, function (err, results) {
        should.not.exist(err, 'saved doc with attachment');
        db.get(results.id, function (err, doc) {
          should.not.exist(err, 'fetched doc');
          should.exist(doc._attachments, 'doc has attachments field');
          doc._attachments.should.include.keys('foo.json');
          doc._attachments['foo.json'].content_type.should
            .equal('application/json', 'doc has correct content type');
          db.getAttachment(results.id, 'foo.json', function (err, attachment) {
            testUtils.readBlob(attachment, function (data) {
              jsonDoc._attachments['foo.json'].data.should
                .equal('eyJIZWxsbyI6IndvcmxkIn0=', 'correct data');
              done();
            });
          });
        });
      });
    });

    it('Test remove doc with attachment', function (done) {
      var db = new PouchDB(dbs.name);
      db.put({ _id: 'mydoc' }, function (err, resp) {
        var blob = testUtils.makeBlob('Mytext');
        db.putAttachment('mydoc', 'mytext', resp.rev, blob, 'text/plain',
                         function (err, res) {
          db.get('mydoc', { attachments: false }, function (err, doc) {
            db.remove(doc, function (err, resp) {
              should.exist(res.ok);
              done();
            });
          });
        });
      });
    });

    it('Try to insert a doc with unencoded attachment', function (done) {
      var db = new PouchDB(dbs.name);
      var doc = {
        _id: 'foo',
        _attachments: {
          'foo.txt': {
            content_type: 'text/plain',
            data: 'this should have been encoded!'
          }
        }
      };
      db.put(doc, function (err, res) {
        should.exist(err);
        err.status.should.equal(500, 'correct error');
        err.name.should.equal('badarg', 'correct error');
        done();
      });
    });

    it('Try to get attachment of unexistent doc', function (done) {
      var db = new PouchDB(dbs.name);
      db.getAttachment('unexistent', 'attachment', function (err, res) {
        should.exist(err, 'Correctly returned error');
        done();
      });
    });

    it('Test synchronous getAttachment', function (done) {
      var db = new PouchDB(dbs.name);
      db.getAttachment('unexistent', 'attachment', function (err, res) {
        should.exist(err, 'Correctly returned error');
        done();
      });
    });

    it('Test synchronous putAttachment with text data', function (done) {
      var db = new PouchDB(dbs.name);
      var blob = testUtils.makeBlob('foobaz', 'text/plain');
      db.putAttachment('a', 'foo2.txt', '', blob, 'text/plain', function (err) {
        should.not.exist(err, 'Correctly wrote attachment');
        db.get('a', { attachments: true }, function (err, doc) {
          should.not.exist(err, 'Correctly got attachment');
          doc._attachments['foo2.txt'].data.should.equal('Zm9vYmF6');
          doc._attachments['foo2.txt'].content_type.should.equal('text/plain');
          done();
        });
      });
    });

    it('Test synchronous putAttachment with no text data', function (done) {
      var db = new PouchDB(dbs.name);
      db.putAttachment('a', 'foo2.txt', '', '', 'text/plain', function (err) {
        should.not.exist(err, 'Correctly wrote attachment');
        db.get('a', { attachments: true }, function (err, doc) {
          should.not.exist(err, 'Correctly got attachment');
          doc._attachments['foo2.txt'].data.should.equal('');
          // firefox 3 appends charset=utf8
          // see http://forums.mozillazine.org/viewtopic.php?p=6318215#p6318215
          doc._attachments['foo2.txt'].content_type.indexOf('text/plain')
            .should.equal(0, 'expected content-type to start with text/plain');
          done();
        });
      });
    });

    it('Test stubs', function (done) {
      var db = new PouchDB(dbs.name);
      db.putAttachment('a', 'foo2.txt', '', '', 'text/plain', function (err) {
        db.allDocs({ include_docs: true }, function (err, docs) {
          should.not.exist(docs.rows[0].stub, 'no stub');
          done();
        });
      });
    });

    it('Try to get unexistent attachment of some doc', function (done) {
      var db = new PouchDB(dbs.name);
      db.put({ _id: 'foo' }, function (err, res) {
        should.not.exist(err, 'doc inserted');
        db.getAttachment('foo', 'unexistentAttachment', function (err, res) {
          should.exist(err, 'Correctly returned error');
          done();
        });
      });
    });

    it('putAttachment and getAttachment with png data', function (done) {
      var db = new PouchDB(dbs.name);
      db.put({ _id: 'foo' }, function (err, res) {
        db.get('foo', function (err, doc) {
          var data = pngAttDoc._attachments['foo.png'].data;
          var blob = testUtils
            .makeBlob(PouchDB.utils.fixBinary(PouchDB.utils.atob(data)),
                                              'image/png');
          db.putAttachment('foo', 'foo.png', doc._rev, blob, 'image/png',
                           function (err, info) {
            should.not.exist(err, 'attachment inserted');
            db.getAttachment('foo', 'foo.png', function (err, blob) {
              should.not.exist(err, 'attachment gotten');
              testUtils.readBlob(blob, function (returnedData) {
                PouchDB.utils.btoa(returnedData).should.equal(data);
                done();
              });
            });
          });
        });
      });
    });

  });
});

repl_adapters.forEach(function (adapters) {
  describe('test.attachments.js- ' + adapters[0] + ':' + adapters[1],
    function () {

    var dbs = {};

    beforeEach(function (done) {
      dbs.name = testUtils.adapterUrl(adapters[0], 'test_attach');
      dbs.remote = testUtils.adapterUrl(adapters[1], 'test_attach_remote');
      testUtils.cleanup([dbs.name, dbs.remote], done);
    });

    afterEach(function (done) {
      testUtils.cleanup([dbs.name, dbs.remote], done);
    });

    it('Attachments replicate', function (done) {
      var binAttDoc = {
        _id: 'bin_doc',
        _attachments: {
          'foo.txt': {
            content_type: 'text/plain',
            data: 'VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ='
          }
        }
      };
      var docs1 = [
        binAttDoc,
        {_id: '0', integer: 0},
        {_id: '1', integer: 1},
        {_id: '2', integer: 2},
        {_id: '3', integer: 3}
      ];

      var db = new PouchDB(dbs.name);
      var remote = new PouchDB(dbs.remote);

      remote.bulkDocs({ docs: docs1 }, function (err, info) {
        db.replicate.from(remote, function () {
          db.get('bin_doc', { attachments: true }, function (err, doc) {
            binAttDoc._attachments['foo.txt'].data.should
              .equal(doc._attachments['foo.txt'].data);
            done();
          });
        });
      });
    });

  });
});


text:
package Paws::SES::ReorderReceiptRuleSetResponse;
  use Moose;

  has _request_id => (is => 'ro', isa => 'Str');
1;

### main pod documentation begin ###

=head1 NAME

Paws::SES::ReorderReceiptRuleSetResponse

=head1 ATTRIBUTES

=head2 _request_id => Str

=cut


text:
require 'jekyll'
require 'jekyll/post'

class Jekyll::Post
  alias_method :original_to_liquid, :to_liquid

  def to_liquid
    original_to_liquid.deep_merge({
      'filename' => @name
    })
  end
end


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>Alterosa</logradouro><bairro>COHAB</bairro><cidade>Passos</cidade><uf>MG</uf><cep>37903056</cep></feed>


text:
layout: post
title:  Pareri implanturi dentare Mis
description: Pareri implanturi dentare MIS. Cine le foloseste in Bucuresti?
categories : [blog]
contact: one
---

Implanturile dentare MIS sunt niste implanturi dentare fabricate in Israel. Compania MIS Implants este o companie din Israel infiintata in 1995, specializata în proiectarea și fabricarea de implanturi dentare. In cabinetele stomatologice din Bucuresti Preturile implanturilor MIS variaza  in intervalul 350-700 de euro.

    Compania MIS Implants a fost achizitionata acum cativa ani de catre Dentsply Sirona. Dentsply Sirona este una dintre cele mai mari companii producatoare de echipamente dentare; aceasta achizitie garanteaza calitatea si inovatia care este depusa in dezvoltarea acestor implanturi.

    O scurta lista cu cabinetele si preturile pe care le practica pentru acest implant o gasiti mai jos (daca doriti sa adaugam sau sa eliminam un cabinet de pe lista va rog sa ne contactati). Mai multe comentarii din partea medicilor dentisti puteti gasi si pe forumul Eugenol.

    Cam in acelasi palier de pret in clinica {{site.newname}} va putem oferi implantul Bredent, made in Germany la pretul de 400 de euro.

CLINICA	PRET IMPLANT DENTAR MIS

Dental Med	700 eur

Clinica Trident	700 eur

Smile Implants	350-550 eur

Smile Dental Spa	290 eur

Clinica 32	400 eur


text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	version="3.0"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

	<welcome-file-list>
		<welcome-file>index.xhtml</welcome-file>
	</welcome-file-list>

	<context-param>
		<param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
		<param-value>true</param-value>
	</context-param>

	<context-param>
		<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
		<param-value>true</param-value>
	</context-param>

	<context-param>
		<param-name>com.sun.faces.enableMissingResourceLibraryDetection</param-name>
		<param-value>true</param-value>
	</context-param>
	<context-param>
		<param-name>javax.faces.PROJECT_STAGE</param-name>
		<param-value>Development</param-value>
	</context-param>

	<context-param>
		<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
		<param-value>0</param-value>
	</context-param>
	<context-param>
		<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
		<param-value>true</param-value>
	</context-param>

	<context-param>
		<param-name>primefaces.THEME</param-name>
		<param-value>redmond</param-value>
	</context-param>

	<servlet>
		<servlet-name>Faces Servlet</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>*.xhtml</url-pattern>
	</servlet-mapping>

	<session-config>
		<session-timeout>0</session-timeout>
	</session-config>

	<error-page>
		<exception-type>javax.faces.application.ViewExpiredException</exception-type>
		<location>/statics/error-403.xhtml</location>
	</error-page>

	<error-page>
		<error-code>403</error-code>
		<location>/statics/error-403.xhtml</location>
	</error-page>

	<!-- -->

	<security-constraint>
		<web-resource-collection>
			<web-resource-name>Funcionalidad para Prestador</web-resource-name>
			<url-pattern>/pages/crear_consulta.xhtml</url-pattern>
			<url-pattern>/pages/personas.xhtml</url-pattern>
			<url-pattern>/pages/ver_consultas.xhtml</url-pattern>
		</web-resource-collection>
		<auth-constraint>
			<role-name>ADMINISTRADOR</role-name>
			<role-name>PRESTADOR</role-name>
		</auth-constraint>
	</security-constraint>

	<security-constraint>
		<web-resource-collection>
			<web-resource-name>Funcionalidad Reportería</web-resource-name>
			<url-pattern>/reporte/consultas_diarias.xhtml</url-pattern>
		</web-resource-collection>
		<auth-constraint>
			<role-name>REPORTES</role-name>
		</auth-constraint>
	</security-constraint>

	<security-constraint>
		<web-resource-collection>
			<web-resource-name>Funcionalidad para Administrador</web-resource-name>
			<url-pattern>/pages/usuarios.xhtml</url-pattern>
			<url-pattern>/pages/mant_rol.xhtml</url-pattern>
		</web-resource-collection>
		<auth-constraint>
			<role-name>ADMINISTRADOR</role-name>
		</auth-constraint>
	</security-constraint>

	<security-constraint>
		<web-resource-collection>
			<web-resource-name>Funcionalidad para Super-Administrador</web-resource-name>
			<url-pattern>/pages/root_parametros.xhtml</url-pattern>
		</web-resource-collection>
		<auth-constraint>
			<role-name>ROOT</role-name>
		</auth-constraint>
	</security-constraint>

	<security-constraint>
		<web-resource-collection>
			<web-resource-name>No Funcionales en Comun</web-resource-name>
			<url-pattern>/pages/cambiar_contrasena.xhtml</url-pattern>
		</web-resource-collection>
		<auth-constraint>
			<role-name>ADMINISTRADOR</role-name>
			<role-name>PRESTADOR</role-name>
			<role-name>CONSULTA</role-name>
		</auth-constraint>
	</security-constraint>

	<login-config>
		<auth-method>FORM</auth-method>
		<realm-name>ModuloBaseRealm</realm-name>
		<form-login-config>
			<form-login-page>/public/login.xhtml</form-login-page>
			<form-error-page>/statics/error-403.xhtml</form-error-page>
		</form-login-config>
	</login-config>

	<security-role>
		<description>ADMINISTRADOR</description>
		<role-name>ADMINISTRADOR</role-name>
	</security-role>
	<security-role>
		<description>CONSULTA</description>
		<role-name>CONSULTA</role-name>
	</security-role>
	<security-role>
		<description>INVITADO</description>
		<role-name>INVITADO</role-name>
	</security-role>
	<security-role>
		<description>PRESTADOR</description>
		<role-name>PRESTADOR</role-name>
	</security-role>

	<security-role>
		<description>REPORTES</description>
		<role-name>REPORTES</role-name>
	</security-role>

	<security-role>
		<description>ROOT</description>
		<role-name>ROOT</role-name>
	</security-role>

	<!-- -->

</web-app>


text:
package org.apache.sling.launchpad.webapp.integrationtest;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.apache.sling.commons.json.JSONArray;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;
import org.apache.sling.launchpad.webapp.integrationtest.RenderingTestBase;
import org.apache.sling.servlets.post.SlingPostConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class JSONGroovyBuilderTest extends RenderingTestBase {

    /** Logger instance */
    private static final Logger log =
            LoggerFactory.getLogger(JSONGroovyBuilderTest.class);

    private String slingResourceType;

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        // set test values
        slingResourceType = "integration-test/srt." + System.currentTimeMillis();
        testText = "This is a test " + System.currentTimeMillis();

        // create the test node, under a path that's specific to this class to allow collisions
        final String url = HTTP_BASE_URL + "/" + getClass().getSimpleName() + "/" + System.currentTimeMillis() + SlingPostConstants.DEFAULT_CREATE_SUFFIX;
        final Map<String,String> props = new HashMap<String,String>();
        props.put("sling:resourceType", slingResourceType);
        props.put("text", testText);
        displayUrl = testClient.createNode(url, props);

        // the rendering script goes under /apps in the repository
        scriptPath = "/apps/" + slingResourceType;
        testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
    }

    public void testObject() throws IOException, JSONException {
        final String toDelete = uploadTestScript("builder_object.groovy","json.groovy");
        try {
            final String content = getContent(displayUrl + ".json", CONTENT_TYPE_JSON);
            JSONObject jo = new JSONObject(content);
            assertEquals("Content contained wrong number of items", 1, jo.length());
            assertEquals("Content contained wrong key", "text", jo.keys().next());
            assertEquals("Content contained wrong data", testText, jo.get("text"));
        } finally {
            testClient.delete(toDelete);
        }
    }

    public void testRichObject() throws IOException, JSONException {
        final String toDelete = uploadTestScript("builder_rich_object.groovy","json.groovy");
        try {
            final String content = getContent(displayUrl + ".json", CONTENT_TYPE_JSON);
            log.debug("{} content: {}", displayUrl, content);
            JSONObject jo = new JSONObject(content);
            assertEquals("Content contained wrong number of items", 2, jo.length());
            assertEquals("Content contained wrong data", testText, jo.get("text"));
            assertEquals("Content contained wrong data", "bar", ((JSONObject) jo.get("obj")).get("foo"));
        } finally {
            testClient.delete(toDelete);
        }
    }

    public void testArray() throws IOException, JSONException {
        final String toDelete = uploadTestScript("builder_array.groovy","json.groovy");
        try {
            final String content = getContent(displayUrl + ".json", CONTENT_TYPE_JSON);
            JSONArray jo = new JSONArray(content);
            assertEquals("Content contained wrong number of items", 1, jo.length());
            assertEquals("Content contained wrong data", testText, jo.get(0));
        } finally {
            testClient.delete(toDelete);
        }
    }
}


text:
import sys
import unittest

from libcloud.test import MockHttp
from libcloud.dns.types import RecordType, ZoneDoesNotExistError, RecordDoesNotExistError
from libcloud.utils.py3 import httplib
from libcloud.test.secrets import DNS_PARAMS_LINODE, DNS_KEYWORD_PARAMS_LINODE
from libcloud.common.linode import LinodeException
from libcloud.dns.drivers.linode import LinodeDNSDriver, LinodeDNSDriverV3
from libcloud.test.file_fixtures import DNSFileFixtures

class LinodeTests(unittest.TestCase):
    def setUp(self):
        LinodeDNSDriverV3.connectionCls.conn_class = LinodeMockHttp
        LinodeMockHttp.use_param = "api_action"
        LinodeMockHttp.type = None
        self.driver = LinodeDNSDriver(*DNS_PARAMS_LINODE, **DNS_KEYWORD_PARAMS_LINODE)

    def assertHasKeys(self, dictionary, keys):
        for key in keys:
            self.assertTrue(key in dictionary, 'key "%s" not in dictionary' % (key))

    def test_list_record_types(self):
        record_types = self.driver.list_record_types()
        self.assertEqual(len(record_types), 7)
        self.assertTrue(RecordType.A in record_types)

    def test_list_zones_success(self):
        zones = self.driver.list_zones()
        self.assertEqual(len(zones), 2)

        zone = zones[0]
        self.assertEqual(zone.id, "5093")
        self.assertEqual(zone.type, "master")
        self.assertEqual(zone.domain, "linode.com")
        self.assertIsNone(zone.ttl)
        self.assertHasKeys(zone.extra, ["description", "SOA_Email", "status"])

    def test_list_records_success(self):
        zone = self.driver.list_zones()[0]
        records = self.driver.list_records(zone=zone)
        self.assertEqual(len(records), 2)

        arecord = records[0]
        self.assertEqual(arecord.id, "3585100")
        self.assertEqual(arecord.name, "mc")
        self.assertEqual(arecord.type, RecordType.A)
        self.assertEqual(arecord.data, "127.0.0.1")
        self.assertHasKeys(arecord.extra, ["protocol", "ttl_sec", "port", "weight"])

        srvrecord = records[1]
        self.assertEqual(srvrecord.id, "3585141")
        self.assertEqual(srvrecord.name, "_minecraft._udp")
        self.assertEqual(srvrecord.type, RecordType.SRV)
        self.assertEqual(srvrecord.data, "mc.linode.com")
        self.assertHasKeys(srvrecord.extra, ["protocol", "ttl_sec", "port", "priority", "weight"])

    def test_list_records_zone_does_not_exist(self):
        zone = self.driver.list_zones()[0]

        LinodeMockHttp.type = "ZONE_DOES_NOT_EXIST"
        try:
            self.driver.list_records(zone=zone)
        except ZoneDoesNotExistError as e:
            self.assertEqual(e.zone_id, zone.id)
        else:
            self.fail("Exception was not thrown")

    def test_get_zone_success(self):
        LinodeMockHttp.type = "GET_ZONE"

        zone = self.driver.get_zone(zone_id="5093")
        self.assertEqual(zone.id, "5093")
        self.assertEqual(zone.type, "master")
        self.assertEqual(zone.domain, "linode.com")
        self.assertIsNone(zone.ttl)
        self.assertHasKeys(zone.extra, ["description", "SOA_Email", "status"])

    def test_get_zone_does_not_exist(self):
        LinodeMockHttp.type = "GET_ZONE_DOES_NOT_EXIST"

        try:
            self.driver.get_zone(zone_id="4444")
        except ZoneDoesNotExistError as e:
            self.assertEqual(e.zone_id, "4444")
        else:
            self.fail("Exception was not thrown")

    def test_get_record_success(self):
        LinodeMockHttp.type = "GET_RECORD"
        record = self.driver.get_record(zone_id="1234", record_id="3585100")
        self.assertEqual(record.id, "3585100")
        self.assertEqual(record.name, "www")
        self.assertEqual(record.type, RecordType.A)
        self.assertEqual(record.data, "127.0.0.1")
        self.assertHasKeys(record.extra, ["protocol", "ttl_sec", "port", "weight"])

    def test_get_record_zone_does_not_exist(self):
        LinodeMockHttp.type = "GET_RECORD_ZONE_DOES_NOT_EXIST"

        try:
            self.driver.get_record(zone_id="444", record_id="3585100")
        except ZoneDoesNotExistError:
            pass
        else:
            self.fail("Exception was not thrown")

    def test_get_record_record_does_not_exist(self):
        LinodeMockHttp.type = "GET_RECORD_RECORD_DOES_NOT_EXIST"

        try:
            self.driver.get_record(zone_id="4441", record_id="3585100")
        except RecordDoesNotExistError:
            pass
        else:
            self.fail("Exception was not thrown")

    def test_create_zone_success(self):
        zone = self.driver.create_zone(domain="foo.bar.com", type="master", ttl=None, extra=None)
        self.assertEqual(zone.id, "5094")
        self.assertEqual(zone.domain, "foo.bar.com")

    def test_create_zone_validaton_error(self):
        LinodeMockHttp.type = "VALIDATION_ERROR"

        try:
            self.driver.create_zone(domain="foo.bar.com", type="master", ttl=None, extra=None)
        except LinodeException:
            pass
        else:
            self.fail("Exception was not thrown")

    def test_update_zone_success(self):
        zone = self.driver.list_zones()[0]
        updated_zone = self.driver.update_zone(
            zone=zone,
            domain="libcloud.org",
            ttl=10,
            extra={"SOA_Email": "bar@libcloud.org"},
        )

        self.assertEqual(zone.extra["SOA_Email"], "dns@example.com")

        self.assertEqual(updated_zone.id, zone.id)
        self.assertEqual(updated_zone.domain, "libcloud.org")
        self.assertEqual(updated_zone.type, zone.type)
        self.assertEqual(updated_zone.ttl, 10)
        self.assertEqual(updated_zone.extra["SOA_Email"], "bar@libcloud.org")
        self.assertEqual(updated_zone.extra["status"], zone.extra["status"])
        self.assertEqual(updated_zone.extra["description"], zone.extra["description"])

    def test_create_record_success(self):
        zone = self.driver.list_zones()[0]
        record = self.driver.create_record(
            name="www", zone=zone, type=RecordType.A, data="127.0.0.1"
        )

        self.assertEqual(record.id, "3585100")
        self.assertEqual(record.name, "www")
        self.assertEqual(record.zone, zone)
        self.assertEqual(record.type, RecordType.A)
        self.assertEqual(record.data, "127.0.0.1")

    def test_update_record_success(self):
        zone = self.driver.list_zones()[0]
        record = self.driver.list_records(zone=zone)[0]
        updated_record = self.driver.update_record(
            record=record, name="www", type=RecordType.AAAA, data="::1"
        )

        self.assertEqual(record.data, "127.0.0.1")

        self.assertEqual(updated_record.id, record.id)
        self.assertEqual(updated_record.name, "www")
        self.assertEqual(updated_record.zone, record.zone)
        self.assertEqual(updated_record.type, RecordType.AAAA)
        self.assertEqual(updated_record.data, "::1")

    def test_delete_zone_success(self):
        zone = self.driver.list_zones()[0]
        status = self.driver.delete_zone(zone=zone)
        self.assertTrue(status)

    def test_delete_zone_does_not_exist(self):
        zone = self.driver.list_zones()[0]

        LinodeMockHttp.type = "ZONE_DOES_NOT_EXIST"

        try:
            self.driver.delete_zone(zone=zone)
        except ZoneDoesNotExistError as e:
            self.assertEqual(e.zone_id, zone.id)
        else:
            self.fail("Exception was not thrown")

    def test_delete_record_success(self):
        zone = self.driver.list_zones()[0]
        record = self.driver.list_records(zone=zone)[0]
        status = self.driver.delete_record(record=record)
        self.assertTrue(status)

    def test_delete_record_does_not_exist(self):
        zone = self.driver.list_zones()[0]
        record = self.driver.list_records(zone=zone)[0]

        LinodeMockHttp.type = "RECORD_DOES_NOT_EXIST"

        try:
            self.driver.delete_record(record=record)
        except RecordDoesNotExistError as e:
            self.assertEqual(e.record_id, record.id)
        else:
            self.fail("Exception was not thrown")

class LinodeMockHttp(MockHttp):
    fixtures = DNSFileFixtures("linode")

    def _domain_list(self, method, url, body, headers):
        body = self.fixtures.load("domain_list.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _domain_resource_list(self, method, url, body, headers):
        body = self.fixtures.load("resource_list.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _ZONE_DOES_NOT_EXIST_domain_resource_list(self, method, url, body, headers):
        body = self.fixtures.load("resource_list_does_not_exist.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _GET_ZONE_domain_list(self, method, url, body, headers):
        body = self.fixtures.load("get_zone.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _GET_ZONE_DOES_NOT_EXIST_domain_list(self, method, url, body, headers):
        body = self.fixtures.load("get_zone_does_not_exist.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _GET_RECORD_domain_list(self, method, url, body, headers):
        body = self.fixtures.load("get_zone.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _GET_RECORD_domain_resource_list(self, method, url, body, headers):
        body = self.fixtures.load("get_record.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _GET_RECORD_ZONE_DOES_NOT_EXIST_domain_list(self, method, url, body, headers):
        body = self.fixtures.load("get_zone_does_not_exist.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _GET_RECORD_ZONE_DOES_NOT_EXIST_domain_resource_list(self, method, url, body, headers):
        body = self.fixtures.load("get_record_does_not_exist.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _GET_RECORD_RECORD_DOES_NOT_EXIST_domain_list(self, method, url, body, headers):
        body = self.fixtures.load("get_zone.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _GET_RECORD_RECORD_DOES_NOT_EXIST_domain_resource_list(self, method, url, body, headers):
        body = self.fixtures.load("get_record_does_not_exist.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _domain_create(self, method, url, body, headers):
        body = self.fixtures.load("create_domain.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _VALIDATION_ERROR_domain_create(self, method, url, body, headers):
        body = self.fixtures.load("create_domain_validation_error.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _domain_update(self, method, url, body, headers):
        body = self.fixtures.load("update_domain.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _domain_resource_create(self, method, url, body, headers):
        body = self.fixtures.load("create_resource.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _domain_resource_update(self, method, url, body, headers):
        body = self.fixtures.load("update_resource.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _domain_delete(self, method, url, body, headers):
        body = self.fixtures.load("delete_domain.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _ZONE_DOES_NOT_EXIST_domain_delete(self, method, url, body, headers):
        body = self.fixtures.load("delete_domain_does_not_exist.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _domain_resource_delete(self, method, url, body, headers):
        body = self.fixtures.load("delete_resource.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

    def _RECORD_DOES_NOT_EXIST_domain_resource_delete(self, method, url, body, headers):
        body = self.fixtures.load("delete_resource_does_not_exist.json")
        return (httplib.OK, body, {}, httplib.responses[httplib.OK])

if __name__ == "__main__":
    sys.exit(unittest.main())


text:
/*******************************************************************************
 * NOTICE
 * The hal is not public api, don't use in application code.
 * See readme.md in hal/include/hal/readme.md
 ******************************************************************************/

// The HAL layer for sigma delta modulator.
// There is no parameter check in the hal layer, so the caller must ensure the correctness of the parameters.

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

typedef struct gpio_sd_dev_t *sdm_soc_handle_t; // Sigma-Delta SOC layer handle

/**
 * HAL context type of Sigma-Delta driver
 */
typedef struct {
    sdm_soc_handle_t dev;
} sdm_hal_context_t;

/**
 * @brief Initialize Sigma-Delta hal driver
 *
 * @param hal Context of the HAL layer
 * @param group_id Sigma-Delta group number
 */
void sdm_hal_init(sdm_hal_context_t *hal, int group_id);

#ifdef __cplusplus
}
#endif


text:
- The Object-Oriented Thought Process (4th Edition), Matt Weisfeld, [978-0321861276](http://www.amazon.com/dp/0321861272)

## Ruby

Official documentation can be found on [ruby-doc.org](http://ruby-doc.org/).

### Books

  - Eloquent Ruby, Russ Olsen, [978-0321584106](http://www.amazon.com/dp/0321584104)

### Local Resources

  - Philly.rb: http://phillyrb.org/

## PHP

Official documentation can be found on [php.net](http://www.php.net/manual/en/).

### Books

- Professional PHP5, Ed Lecky-Thompson, Heow Eide-Goodman, Steven D. Nowicki, Alec Cove, [978-0764572821](http://www.amazon.com/dp/0764572822)
- Real-World Solutions for Developing High-Quality PHP Frameworks and Applications, Sebastian Bergmann, Stefan Priebsch, [978-0470872499](http://www.amazon.com/dp/0470872497)

## MySQL

Official documentation can be found on [mysql.com](http://dev.mysql.com/doc/).

### Books

- MySQL (5th Edition), Paul DuBois, [978-0321833877](http://www.amazon.com/dp/0321833872)

## Git

Official documentation can be found on [git-scm.com](http://git-scm.com/docs).

### Books

-  Pro Git, Scott Chacon, [978-1430218333](http://www.amazon.com/dp/1430218339), Available free in its entirety @ [git-scm.com/book](http://git-scm.com/book)


text:
@lombok.Value
public class ValueExample {

  String name<caret>;
}


text:
using System.Collections.Generic;
using System.Linq;
using System.Xml;

namespace SatelliteService.Helpers
{
    public class XmlMerger
    {
        public IDictionary<string, object> MacroCollection { get; set; }
        private readonly XmlDocument xmlDocument;

        public XmlMerger(XmlDocument xmlDocument, IDictionary<string, object> macroCollection)
        {
            this.MacroCollection = macroCollection;
            this.xmlDocument = xmlDocument;
        }

        public XmlMerger(XmlDocument xmlDocument) : this(xmlDocument, new Dictionary<string, object>())
        {
        }

        public void ApplyChanges(XmlNode xmlNode)
        {
            this.MergeNodes(this.xmlDocument, xmlNode);
        }

        private void MergeNodes(XmlNode initialNode, XmlNode changesNode)
        {
            this.MergeNodeAttributes(initialNode, changesNode);

            string childKey = changesNode.Attributes != null && changesNode.Attributes["childNodesKeyName"] != null
                                  ? changesNode.Attributes["childNodesKeyName"].Value
                                  : null;

            string collectionKey = changesNode.Attributes != null && changesNode.Attributes["collectionKeyName"] != null
                                  ? changesNode.Attributes["collectionKeyName"].Value
                                  : string.Empty;

            IDictionary<string, bool> collectionMarkers = this.GetCollectionMarkers(initialNode, changesNode, collectionKey);

            foreach (XmlElement changesChildNode in changesNode.ChildNodes.OfType<XmlElement>())
            {
                this.MergeNode(initialNode, childKey, changesChildNode, collectionMarkers);
            }
        }

        private void MergeNode(XmlNode initialParentNode, string childKey, XmlElement changesChildNode, IDictionary<string, bool> collectionMarkers)
        {
            string nodeName = changesChildNode.Name;
            bool emptyKey = string.IsNullOrEmpty(childKey) || changesChildNode.Attributes[childKey] == null || string.IsNullOrEmpty(changesChildNode.Attributes[childKey].Value);
            bool isCollection = collectionMarkers.ContainsKey(nodeName) && collectionMarkers[nodeName];

            if (emptyKey)
            {
                if (isCollection)
                {
                    this.AppendNewNode(initialParentNode, changesChildNode);
                    return;
                }

                XmlNode firstChild = GetFirstChild(initialParentNode, nodeName);

                if (firstChild == null)
                {
                    this.AppendNewNode(initialParentNode, changesChildNode);
                }
                else
                {
                    this.MergeNodes(firstChild, changesChildNode);
                }

                return;
            }
            else
            {
                string value = changesChildNode.Attributes[childKey].Value;
                XmlNode firstChild = GetFirstChild(initialParentNode, nodeName, childKey, value);

                if (firstChild != null)
                {
                    this.MergeNodes(firstChild, changesChildNode);
                    return;
                }

                this.AppendNewNode(initialParentNode, changesChildNode);
            }
        }

        private IDictionary<string, bool> GetCollectionMarkers(XmlNode initialParentNode, XmlNode changesChildNode, string collectionKey)
        {
            IDictionary<string, bool> initialNodeData = initialParentNode.ChildNodes
                .OfType<XmlNode>()
                .GroupBy(node => node.Name)
                .Select(
                    nodeGroup => new
                    {
                        name = nodeGroup.Key,
                        count = nodeGroup.Count()
                    })
                .ToDictionary(item => item.name, item => item.count > 1 || collectionKey.Contains(item.name));

            IDictionary<string, bool> changesNodeData = changesChildNode.ChildNodes
                .OfType<XmlNode>()
                .GroupBy(node => node.Name)
                .Select(
                    nodeGroup => new
                    {
                        name = nodeGroup.Key,
                        count = nodeGroup.Count()
                    })
                .ToDictionary(item => item.name, item => item.count > 1 || collectionKey.Contains(item.name));

            IDictionary<string, bool> result = new Dictionary<string, bool>();

            foreach (string key in initialNodeData.Keys)
            {
                if (!result.ContainsKey(key))
                {
                    result.Add(key, initialNodeData[key]);
                }
                else
                {
                    result[key] |= initialNodeData[key];
                }
            }

            foreach (string key in changesNodeData.Keys)
            {
                if (!result.ContainsKey(key))
                {
                    result.Add(key, changesNodeData[key]);
                }
                else
                {
                    result[key] |= changesNodeData[key];
                }
            }

            return result;
        }

        private XmlNode GetFirstChild(XmlNode parentElement, string name)
        {
            XmlNodeList xmlNodeList = parentElement.SelectNodes(name + "[1]");
            return xmlNodeList == null || xmlNodeList.Count == 0 ? null : xmlNodeList[0];
        }

        private XmlNode GetFirstChild(XmlNode parentElement, string name, string key, string value)
        {
            XmlNodeList xmlNodeList = parentElement.SelectNodes(string.Format("{0}[@{1}='{2}'][1]", name, key, value));
            return xmlNodeList == null || xmlNodeList.Count == 0 ? null : xmlNodeList[0];
        }

        private void MergeToFirst(XmlElement changesChildNode, XmlNodeList initialChildNodes)
        {
            this.MergeNodes(initialChildNodes[0], changesChildNode);
        }

        private void AppendNewNode(XmlNode initialNode, XmlElement changesChildNode)
        {
            XmlElement initialChildNode;

            if (initialNode.OwnerDocument == null)
            {
                initialChildNode = ((XmlDocument)initialNode).CreateElement(changesChildNode.Name);
            }
            else
            {
                initialChildNode = initialNode.OwnerDocument.CreateElement(changesChildNode.Name);
            }

            initialNode.AppendChild(initialChildNode);

            this.MergeNodes(initialChildNode, changesChildNode);
        }

        private void MergeNodeAttributes(XmlNode initialNode, XmlNode changesNode)
        {
            if (changesNode.Attributes == null)
            {
                return;
            }

            foreach (XmlAttribute changeAttribute in changesNode.Attributes)
            {
                if (changeAttribute.Name.ToLower() == "childnodeskeyname")
                {
                    continue;
                }
                if (changeAttribute.Name.ToLower() == "collectionkeyname")
                {
                    continue;
                }

                if (initialNode.Attributes != null)
                {
                    if (initialNode.Attributes[changeAttribute.Name] == null)
                    {
                        XmlAttribute xmlAttribute = initialNode.OwnerDocument.CreateAttribute(changeAttribute.Name);
                        xmlAttribute.Value = ApplyMacro(changeAttribute.Value);
                        initialNode.Attributes.Append(xmlAttribute);
                    }
                    else
                    {
                        initialNode.Attributes[changeAttribute.Name].Value = ApplyMacro(changeAttribute.Value);
                    }
                }
            }
        }

        private string ApplyMacro(string value)
        {
            value = value ?? string.Empty;

            foreach (KeyValuePair<string, object> macros in this.MacroCollection)
            {
                value = value.Replace("{var:" + macros.Key + "}", macros.Value == null ? string.Empty : macros.Value.ToString());
            }

            return value;
        }
    }
}


text:
package com.springtrail.etilqs;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import com.springtrail.etilqs.Builder.Column;
import com.springtrail.etilqs.Builder.DataSourceBuilder;
import com.springtrail.etilqs.Builder.TableBuilder;
import com.springtrail.etilqs.Builder.TableModel;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.Date;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

/**
 * Created by kirk on 9/28/15.
 */
@RunWith(AndroidJUnit4.class)
public class TableBuilderTest {

    String dbName = "test_" + Long.toString((new Date()).getTime()) + ".db";

    Integer dbVersion = 1;

    DataSourceBuilder dataSource;

    @Before
    public void setUp() throws Exception {
        Util.PurgeDatabases();
    }

    @Test
    public void TableBuilder() {

        Context context = InstrumentationRegistry.getContext();
        dataSource = new DataSourceBuilder(context, dbName, dbVersion);

        test();

    }

    private void test(){

        //copied and pasted from
        String expected_table = "CREATE TABLE DataTypeTable(\n" +
                "_id INTEGER ,\n" +
                "f_boolean NUMERIC ,\n" +
                "f_integer_1 INTEGER ,\n" +
                "f_integer_2 INTEGER DEFAULT (5) ,\n" +
                "f_integer_3 INTEGER ,\n" +
                "f_integer_4 INTEGER ,\n" +
                "f_integer_5 INTEGER ,\n" +
                "f_integer_check INTEGER ,\n" +
                "f_integer_primary INTEGER ,\n" +
                "f_integer_unique INTEGER NOT NULL,\n" +
                "f_long_1 NUMERIC ,\n" +
                "f_long_2 NUMERIC DEFAULT (5) ,\n" +
                "f_long_3 NUMERIC ,\n" +
                "f_long_4 NUMERIC ,\n" +
                "f_string_1 TEXT ,\n" +
                "f_string_2 TEXT DEFAULT ('test') ,\n" +
                "f_string_3 TEXT ,\n" +
                "f_string_4 TEXT \n" +
                ",CONSTRAINT PK_primary PRIMARY KEY (_id) \n" +
                ",CONSTRAINT CK_f_integer_5 CHECK (f_integer_5 > 0)\n" +
                ",CONSTRAINT CK_f_integer_check CHECK (f_integer_check > 0)\n" +
                ",CONSTRAINT UN_f_integer_unique UNIQUE (f_integer_unique) \n" +
                ")";

        class DataTypeTable extends TableModel {

            @Column(name="f_integer_primary", type = Column.columnTypeEnum.INTEGER)
            public Integer f_integer_primary;

            @Column(name="f_integer_unique", type = Column.columnTypeEnum.INTEGER)
            public Integer f_integer_unique;

            @Column(name="f_integer_check", type = Column.columnTypeEnum.INTEGER)
            public Integer f_integer_check;

            @Column(name="f_integer_1", type = Column.columnTypeEnum.INTEGER)
            public Integer f_integer_1;

            @Column(name="f_integer_2", type = Column.columnTypeEnum.INTEGER, defaultValue = "5")
            public Integer f_integer_2;

            @Column(name="f_integer_3", type = Column.columnTypeEnum.INTEGER, nullable = false)
            public Integer f_integer_3;

            @Column(name="f_integer_4", type = Column.columnTypeEnum.INTEGER, nullable = true)
            public Integer f_integer_4;

            @Column(name="f_integer_5", type = Column.columnTypeEnum.INTEGER, check = "f_integer_5 > 0")
            public Integer f_integer_5;

            @Column(name="f_string_1", type = Column.columnTypeEnum.TEXT)
            public String f_string_1;

            @Column(name="f_string_2", type = Column.columnTypeEnum.TEXT, defaultValue = "test")
            public String f_string_2;

            @Column(name="f_string_3", type = Column.columnTypeEnum.TEXT, nullable = false)
            public String f_string_3;

            @Column(name="f_string_4", type = Column.columnTypeEnum.TEXT, nullable = true)
            public String f_string_4;

            @Column(name="f_long_1", type = Column.columnTypeEnum.NUMERIC)
            public Long f_long_1;

            @Column(name="f_long_2", type = Column.columnTypeEnum.NUMERIC, defaultValue = "5")
            public Long f_long_2;

            @Column(name="f_long_3", type = Column.columnTypeEnum.NUMERIC, nullable = false)
            public Long f_long_3;

            @Column(name="f_long_4", type = Column.columnTypeEnum.NUMERIC, nullable = true)
            public Long f_long_4;

            @Column(name="f_boolean", type = Column.columnTypeEnum.NUMERIC)
            public Boolean f_boolean;

            @Override
            public void configureTableModel(TableBuilder builder) {
                super.configureTableModel(builder);

                builder.getTableColumn("f_integer_unique").setUnique();

                builder.getTableColumn("f_integer_check").setCheckConstraint("f_integer_check > 0");

            }
        }

        dataSource.addBuilder(new DataTypeTable());

        dataSource.open();

        SQLiteDatabase sqLiteDatabase = dataSource.getSqLiteDatabase(DataSource.OpenMode.WRITE);

        String new_table = Util.getTableInfo(sqLiteDatabase, DataTypeTable.class.getSimpleName());

        assertThat(expected_table.compareTo(new_table), is(0));

        Util.finish(dataSource, sqLiteDatabase);
    }

}


text:
NS_ASSUME_NONNULL_BEGIN

@interface ABI42_0_0EXUpdatesDatabaseMigration4To5 : NSObject <ABI42_0_0EXUpdatesDatabaseMigration>

@end

NS_ASSUME_NONNULL_END