text:
package org.apache.flex.forks.batik.svggen.font.table;

import java.io.IOException;
import java.io.RandomAccessFile;

/**
 *
 * @version $Id: TableFactory.java 475477 2006-11-15 22:44:28Z cam $
 * @author David Schweinsberg
 */
public class TableFactory {

    public static Table create(DirectoryEntry de, RandomAccessFile raf) throws IOException {
        Table t = null;
        switch (de.getTag()) {
        case Table.BASE:
            break;
        case Table.CFF:
            break;
        case Table.DSIG:
            break;
        case Table.EBDT:
            break;
        case Table.EBLC:
            break;
        case Table.EBSC:
            break;
        case Table.GDEF:
            break;
        case Table.GPOS:
            t = new GposTable(de, raf);
            break;
        case Table.GSUB:
            t = new GsubTable(de, raf);
            break;
        case Table.JSTF:
            break;
        case Table.LTSH:
            break;
        case Table.MMFX:
            break;
        case Table.MMSD:
            break;
        case Table.OS_2:
            t = new Os2Table(de, raf);
            break;
        case Table.PCLT:
            break;
        case Table.VDMX:
            break;
        case Table.cmap:
            t = new CmapTable(de, raf);
            break;
        case Table.cvt:
            t = new CvtTable(de, raf);
            break;
        case Table.fpgm:
            t = new FpgmTable(de, raf);
            break;
        case Table.fvar:
            break;
        case Table.gasp:
            break;
        case Table.glyf:
            t = new GlyfTable(de, raf);
            break;
        case Table.hdmx:
            break;
        case Table.head:
            t = new HeadTable(de, raf);
            break;
        case Table.hhea:
            t = new HheaTable(de, raf);
            break;
        case Table.hmtx:
            t = new HmtxTable(de, raf);
            break;
        case Table.kern:
            t = new KernTable(de, raf);
            break;
        case Table.loca:
            t = new LocaTable(de, raf);
            break;
        case Table.maxp:
            t = new MaxpTable(de, raf);
            break;
        case Table.name:
            t = new NameTable(de, raf);
            break;
        case Table.prep:
            t = new PrepTable(de, raf);
            break;
        case Table.post:
            t = new PostTable(de, raf);
            break;
        case Table.vhea:
            break;
        case Table.vmtx:
            break;
        }
        return t;
    }
}

redpajama_set_name: RedPajamaGithub


text:
The compatibility build of [lodash](https://lodash.com/) library exported as a [UMD](https://github.com/umdjs/umd) module.

## Discontinued

This package has been discontinued. No further development is expected.


text:
/****************************************************************************
 * Included Files
 ****************************************************************************/

#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <errno.h>
#include <nuttx/arch.h>
#include "os_internal.h"

/****************************************************************************
 * Definitions
 ****************************************************************************/

/****************************************************************************
 * Private Type Declarations
 ****************************************************************************/

/****************************************************************************
 * Global Variables
 ****************************************************************************/

/****************************************************************************
 * Private Variables
 ****************************************************************************/

/****************************************************************************
 * Private Function Prototypes
 ****************************************************************************/

/****************************************************************************
 * Private Functions
 ****************************************************************************/

/****************************************************************************
 * Public Functions
 ****************************************************************************/

/****************************************************************************
 * Name:  pthread_setsetprio
 *
 * Description:
 *   The pthread_setschedprio() function sets the scheduling priority for the
 *   thread whose thread ID is given by 'thread' to the value given by 'prio'.
 *   If the  thread_setschedprio() function fails, the scheduling priority
 *   of the target thread will not be changed.
 *
 * Inputs:
 *   thread - the thread ID of the task to reprioritize.
 *   prio - The new thread priority.  The range of valid priority numbers is
 *     from SCHED_PRIORITY_MIN through SCHED_PRIORITY_MAX.
 *
 * Return Value:
 *    OK if successful, otherwise an error number.  This function can
 *    fail for the following reasons:
 *
 *    EINVAL - prio is out of range.
 *    ESRCH  - thread ID does not correspond to any thread.
 *
 * Assumptions:
 *
 ****************************************************************************/

int pthread_setschedprio(pthread_t thread, int prio)
{
  struct sched_param param;
  int ret;

  /* Set the errno to some non-zero value (failsafe) */

  errno = EINVAL;

  /* Call sched_setparam() to change the priority */

  param.sched_priority = prio;
  ret = sched_setparam((pid_t)thread, &param);
  if (ret != OK)
    {
      /* If sched_setparam() fails, return the errno */

      ret = errno;
    }
  return ret;
}


text:
import { hash } from 'rsvp';
import { curriedComputed } from 'ember-macro-helpers';
import { deconstructArgs, reduceValues } from '../hash';

export default function(...args) {
  let { hashKeys, hashValues } = deconstructArgs(args);
  return curriedComputed((...newValues) => {
    let newHash = reduceValues(hashKeys, newValues);
    return hash(newHash);
  })(...hashValues);
}


text:
package au.com.breakpoint.hedron.daogen.strategy;

import java.util.List;
import au.com.breakpoint.hedron.daogen.BooleanHolder;
import au.com.breakpoint.hedron.daogen.Capability;

public interface IFilterRule
{
    boolean evaluateFilter (final String name, final BooleanHolder ok, final List<Capability> capabilities);
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>simplechat</title>
  <link rel="stylesheet" href="css/main.css">

Hi there! Pick a username

    <form ng-submit="setName()">
      <input type="text" ng-model="newAuthor" placeholder="Pick a username" id="newName">
      <input type="submit" value="Continue" class="btn">
    </form>

            Loading last 10 message...

{{message.author}}: {{message.text}} <time title="{{ message.date | amDateFormat: 'dddd, MMMM Do YYYY, h:mm a' }}">
              {{ message.date | amCalendar }}
            </time>

{{message.author}}: {{message.text}} <time title="{{ message.date | amDateFormat: 'dddd, MMMM Do YYYY, h:mm a' }}">
              {{ message.date | amCalendar }}
            </time>

    <form ng-submit="addMessage()" id="newMessage" style="display:flex">
      <input type="text" placeholder="Type a message..." ng-model="newText" style="flex:1" id="chatInput">
      <input type="submit" value="Chat" class="btn">
    </form>


text:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="persistence-with-jpa" transaction-type="RESOURCE_LOCAL">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <non-jta-data-source>java:comp/env/jdbc/DefaultDB</non-jta-data-source>
        <class>com.sap.c4c.wechat.model.Message</class>
        <properties>
            <property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
            <property name="eclipselink.logging.level" value="SEVERE" />
        </properties>
    </persistence-unit>
</persistence>


text:
id: 5dfa3589eacea3f48c6300ae
title: Step 17
challengeType: 0
dashedName: step-17
---

# --description--

Within the second `section` element, add a new `h2` element with the text `Cat Lists`.

# --hints--

Your `section` element should have an opening tag. Opening tags have this syntax: `<elementName>`.

```js
assert(
  document.querySelectorAll('section').length === 2 &&
    code.match(/<\/section>/g).length === 2
);
```

Your `h2` element should have an opening tag. Opening tags have this syntax: `<elementName>`.

```js
assert(document.querySelectorAll('h2').length === 2);
```

Your `h2` element should have a closing tag. Closing tags have a `/` just after the `<` character.

```js
assert(code.match(/<\/h2\>/g).length === 2);
```

Your second `h2` element should be right above the second `section` element's closing tag. It is not in the correct position.

```js
const secondSection = document.querySelectorAll('section')[1];
assert(secondSection.lastElementChild.nodeName === 'H2');
```

The second `h2` element should have the text `Cat Lists`. You have either omitted the text or have a typo.

```js
assert(
  document
    .querySelectorAll('main > section')[1]
    .lastElementChild.innerText.toLowerCase() === 'cat lists'
);
```

# --seed--

## --seed-contents--

```html
<html>
  <body>
    <h1>CatPhotoApp</h1>
    <main>
      <section>
        <h2>Cat Photos</h2>
        <!-- TODO: Add link to cat photos -->
        <p>Click here to view more <a target="_blank" href="https://freecatphotoapp.com">cat photos</a>.</p>
        <a href="https://freecatphotoapp.com"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>
      </section>
--fcc-editable-region--
      <section>
      </section>
--fcc-editable-region--
    </main>
  </body>
</html>
```


text:
layout: page
title: Odonnell - Williamson Wedding
date: 2016-05-24
author: Kevin Carey
tags: weekly links, java
status: published
summary: Pellentesque porttitor mattis quam sed fermentum. Sed.
banner: images/banner/office-01.jpg
booking:
  startDate: 03/20/2019
  endDate: 03/25/2019
  ctyhocn: GVLGAHX
  groupCode: OWW
published: true
---
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras nec feugiat erat. Proin ut egestas metus, ut volutpat erat. Donec ultrices lectus sed mi rhoncus pellentesque. Vestibulum nulla tellus, tincidunt ac rhoncus eu, facilisis et justo. Nam felis dolor, iaculis sed aliquet et, feugiat eu velit. Suspendisse potenti. Mauris vulputate mauris nisi, eget feugiat urna tempus sit amet. Mauris purus magna, dignissim ac ultricies malesuada, efficitur a nunc. Etiam pretium facilisis porta. Nullam nec sem ullamcorper, viverra quam et, luctus elit. Vivamus imperdiet ac ante nec facilisis. Fusce et odio molestie, volutpat turpis et, tristique erat.

* Aenean ullamcorper ante quis ante finibus iaculis.

Nullam nibh urna, dapibus id enim vitae, elementum maximus odio. Praesent viverra a ex in fermentum. Curabitur nulla tortor, convallis nec iaculis vitae, mattis id ex. In elementum odio lacus, vitae tristique tortor eleifend sed. Pellentesque aliquam tempor molestie. Fusce feugiat suscipit sem, at semper massa vulputate nec. Suspendisse ultrices quis libero ac porta.


text:
import shutil
import warnings
from tempfile import TemporaryDirectory

# TODO: move it to plenum-util repo

class SafeTemporaryDirectory(TemporaryDirectory):
    """TemporaryDirectory that works on Windows 10
    """

    @classmethod
    def _cleanup(cls, name, warn_message):
        shutil.rmtree(name, ignore_errors=True)
        warnings.warn(warn_message, ResourceWarning)

    def cleanup(self):
        if self._finalizer.detach():
            shutil.rmtree(self.name, ignore_errors=True)


text:
jT.SimpleItemWidget = function (settings) {
  a$.extend(true, this, a$.common(settings, this));
  this.target = $(settings.target);
};

jT.SimpleItemWidget.prototype = {
  template: null,
  classes: null,

  renderItem: function (info) {
    return jT.ui.getTemplate(template, info).addClass(this.classes);
  }
};


text:
package com.cardpay.pccredit.product.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.cardpay.pccredit.intopieces.model.AppManagerAuditLog;
import com.cardpay.pccredit.product.model.AccessoriesList;
import com.cardpay.pccredit.product.model.AppendixDict;
import com.wicresoft.util.annotation.Mapper;

/**
 * AppendixDictDao
 *
 * @author 王海东
 * @created on 2014-10-14
 *
 * @version $Id:$
 */
@Mapper
public interface AccessoriesListDao {
	//根据产品Id查询产品附件清单
	public List<AccessoriesList> findAppendixTypeCodeByProductId(String productId);

	//根据产品productId查询产品附件
	public List<AppendixDict> findAppendixByProductId(@Param("productId") String productId);

	//根据productId删除产品附件
	public void deleteAppendixByProductId(@Param("productId") String productId);

	public List<AppManagerAuditLog> findAppManagerAuditLog(@Param("appId") String appId,@Param("auditType") String auditType);

	public List<AppManagerAuditLog> findAppManagerAuditById(@Param("appId") String appId);

}


text:
from __future__ import unicode_literals

import os
import json

from django.test import TestCase, RequestFactory
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.template import Template, Context
from django.core.exceptions import PermissionDenied
from django.contrib.auth import get_user_model
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test.utils import override_settings
from django.utils.six import BytesIO

from ..core.tests import utils
from .models import Comment
from .forms import CommentForm, CommentMoveForm, CommentImageForm
from .tags import render_comments_form
from ..core.utils import markdown
from .views import delete as comment_delete
from ..topic.models import Topic
from ..category.models import Category
from ..user.models import UserProfile
from .history.models import CommentHistory
from .utils import comment_posted
from ..topic.notification.models import TopicNotification, MENTION
from ..topic.unread.models import TopicUnread

User = get_user_model()

class CommentViewTest(TestCase):

    def setUp(self):
        cache.clear()
        self.user = utils.create_user()
        self.category = utils.create_category()
        self.topic = utils.create_topic(category=self.category, user=self.user)

    def test_comment_publish(self):
        """
        create comment
        """
        utils.login(self)
        form_data = {'comment': 'foobar', }
        response = self.client.post(reverse('spirit:comment:publish', kwargs={'topic_id': self.topic.pk, }),
                                    form_data)
        expected_url = reverse('spirit:comment:find', kwargs={'pk': 1, })
        self.assertRedirects(response, expected_url, status_code=302, target_status_code=302)
        self.assertEqual(len(Comment.objects.all()), 1)

        # ratelimit
        response = self.client.post(reverse('spirit:comment:publish', kwargs={'topic_id': self.topic.pk, }),
                                    form_data)
        self.assertEqual(len(Comment.objects.all()), 1)

        # get
        response = self.client.get(reverse('spirit:comment:publish', kwargs={'topic_id': self.topic.pk, }))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context['topic'], self.topic)

    def test_comment_publish_on_private(self):
        """
        create comment on private topic
        """
        private = utils.create_private_topic(user=self.user)

        utils.login(self)
        form_data = {'comment': 'foobar', }
        response = self.client.post(reverse('spirit:comment:publish', kwargs={'topic_id': private.topic.pk, }),
                                    form_data)
        expected_url = reverse('spirit:comment:find', kwargs={'pk': 1, })
        self.assertRedirects(response, expected_url, status_code=302, target_status_code=302)
        self.assertEqual(len(Comment.objects.all()), 1)

    def test_comment_publish_on_closed_topic(self):
        """
        should not be able to create a comment on a closed topic
        """
        Topic.objects.filter(pk=self.topic.pk).update(is_closed=True)

        utils.login(self)
        form_data = {'comment': 'foobar', }
        response = self.client.post(reverse('spirit:comment:publish', kwargs={'topic_id': self.topic.pk, }),
                                    form_data)
        self.assertEqual(response.status_code, 404)

    def test_comment_publish_on_closed_cateory(self):
        """
        should be able to create a comment on a closed category (if topic is not closed)
        """
        Category.objects.filter(pk=self.category.pk).update(is_closed=True)

        utils.login(self)
        form_data = {'comment': 'foobar', }
        response = self.client.post(reverse('spirit:comment:publish', kwargs={'topic_id': self.topic.pk, }),
                                    form_data)
        self.assertEqual(response.status_code, 302)
        self.assertEqual(len(Comment.objects.all()), 1)

    def test_comment_publish_on_removed_topic_or_category(self):
        """
        should not be able to create a comment
        """
        # removed category
        Category.objects.all().update(is_removed=True)

        utils.login(self)
        form_data = {'comment': 'foobar', }
        response = self.client.post(reverse('spirit:comment:publish', kwargs={'topic_id': self.topic.pk, }),
                                    form_data)
        self.assertEqual(response.status_code, 404)

        # removed subcategory
        Category.objects.all().update(is_removed=False)
        subcategory = utils.create_category(parent=self.category, is_removed=True)
        topic2 = utils.create_topic(subcategory)

        utils.login(self)
        form_data = {'comment': 'foobar', }
        response = self.client.post(reverse('spirit:comment:publish', kwargs={'topic_id': topic2.pk, }),
                                    form_data)
        self.assertEqual(response.status_code, 404)

        # removed topic
        Category.objects.all().update(is_removed=False)
        Topic.objects.all().update(is_removed=True)

        utils.login(self)
        form_data = {'comment': 'foobar', }
        response = self.client.post(reverse('spirit:comment:publish', kwargs={'topic_id': self.topic.pk, }),
                                    form_data)
        self.assertEqual(response.status_code, 404)

    def test_comment_publish_no_access(self):
        """
        should not be able to create a comment on a private topic if has no access
        """
        private = utils.create_private_topic(user=self.user)
        private.delete()

        utils.login(self)
        form_data = {'comment': 'foobar', }
        response = self.client.post(reverse('spirit:comment:publish', kwargs={'topic_id': private.topic.pk, }),
                                    form_data)
        self.assertEqual(response.status_code, 404)

    def test_comment_publish_quote(self):
        """
        create comment quote
        """
        utils.login(self)
        comment = utils.create_comment(topic=self.topic)
        response = self.client.get(reverse('spirit:comment:publish', kwargs={'topic_id': self.topic.pk,
                                                                             'pk': comment.pk}))
        self.assertEqual(response.context['form'].initial['comment'],
                         markdown.quotify(comment.comment, comment.user.username))

    def test_comment_publish_next(self):
        """
        next on create comment
        """
        utils.login(self)
        form_data = {'comment': 'foobar', 'next': '/fakepath/'}
        response = self.client.post(reverse('spirit:comment:publish', kwargs={'topic_id': self.topic.pk, }),
                                    form_data)
        self.assertRedirects(response, '/fakepath/', status_code=302, target_status_code=404)

    def test_comment_update(self):
        """
        update comment
        """
        comment = utils.create_comment(user=self.user, topic=self.topic)

        utils.login(self)
        form_data = {'comment': 'barfoo', }
        response = self.client.post(reverse('spirit:comment:update', kwargs={'pk': comment.pk, }),
                                    form_data)
        expected_url = reverse('spirit:comment:find', kwargs={'pk': 1, })
        self.assertRedirects(response, expected_url, status_code=302, target_status_code=302)
        self.assertEqual(Comment.objects.get(pk=comment.pk).comment, 'barfoo')

        # next
        form_data.update({'next': '/fakepath/', })
        response = self.client.post(reverse('spirit:comment:update', kwargs={'pk': comment.pk, }),
                                    form_data)
        self.assertRedirects(response, '/fakepath/', status_code=302, target_status_code=404)

    def test_comment_update_not_moderator(self):
        """
        non moderators can not update other people comments
        """
        user = utils.create_user()
        comment = utils.create_comment(user=user, topic=self.topic)

        utils.login(self)
        form_data = {'comment': 'barfoo', }
        response = self.client.post(reverse('spirit:comment:update', kwargs={'pk': comment.pk, }),
                                    form_data)
        self.assertEqual(response.status_code, 404)

    def test_comment_update_moderator(self):
        """
        moderators can update other people comments
        """
        UserProfile.objects.filter(user__pk=self.user.pk).update(is_moderator=True)
        user = utils.create_user()
        comment = utils.create_comment(user=user, topic=self.topic)

        utils.login(self)
        form_data = {'comment': 'barfoo', }
        response = self.client.post(reverse('spirit:comment:update', kwargs={'pk': comment.pk, }),
                                    form_data)
        expected_url = reverse('spirit:comment:find', kwargs={'pk': 1, })
        self.assertRedirects(response, expected_url, status_code=302, target_status_code=302)
        self.assertEqual(Comment.objects.get(pk=comment.pk).comment, 'barfoo')

    def test_comment_update_moderator_private(self):
        """
        moderators can not update comments in private topics they has no access
        """
        UserProfile.objects.filter(user__pk=self.user.pk).update(is_moderator=True)
        user = utils.create_user()
        topic_private = utils.create_private_topic()
        comment = utils.create_comment(user=user, topic=topic_private.topic)

        utils.login(self)
        form_data = {'comment': 'barfoo', }
        response = self.client.post(reverse('spirit:comment:update', kwargs={'pk': comment.pk, }),
                                    form_data)
        self.assertEqual(response.status_code, 404)

    def test_comment_update_increase_modified_count(self):
        """
        Should increase the modified count after an update
        """
        utils.login(self)
        comment_posted = utils.create_comment(user=self.user, topic=self.topic)
        form_data = {'comment': 'my comment, oh!', }
        self.client.post(reverse('spirit:comment:update', kwargs={'pk': comment_posted.pk, }),
                         form_data)
        self.assertEqual(Comment.objects.get(pk=comment_posted.pk).modified_count, 1)

    def test_comment_update_history(self):
        """
        Should add the *first* and *modified* comments to the history
        """
        utils.login(self)
        comment_posted = utils.create_comment(user=self.user, topic=self.topic)
        form_data = {'comment': 'my comment, oh!', }
        self.client.post(reverse('spirit:comment:update', kwargs={'pk': comment_posted.pk, }),
                         form_data)
        comments_history = CommentHistory.objects.filter(comment_fk=comment_posted).order_by('pk')
        self.assertEqual(len(comments_history), 2)  # first and edited
        self.assertIn(comment_posted.comment_html, comments_history[0].comment_html)  # first
        self.assertIn('my comment, oh!', comments_history[1].comment_html)  # modified

    def test_comment_delete_permission_denied_to_non_moderator(self):
        req = RequestFactory().get('/')
        req.user = self.user
        req.user.st.is_moderator = False
        self.assertRaises(PermissionDenied, comment_delete, req)

    def test_comment_delete(self):
        """
        comment delete
        """
        self.user = utils.create_user()
        self.user.st.is_moderator = True
        self.user.st.save()
        comment = utils.create_comment(user=self.user, topic=self.topic)

        utils.login(self)
        form_data = {}
        response = self.client.post(reverse('spirit:comment:delete', kwargs={'pk': comment.pk, }),
                                    form_data)
        expected_url = comment.get_absolute_url()
        self.assertRedirects(response, expected_url, status_code=302, target_status_code=302)

        response = self.client.get(reverse('spirit:comment:delete', kwargs={'pk': comment.pk, }))
        self.assertEqual(response.status_code, 200)

    def test_comment_undelete(self):
        """
        comment undelete
        """
        self.user = utils.create_user()
        self.user.st.is_moderator = True
        self.user.st.save()
        comment = utils.create_comment(user=self.user, topic=self.topic, is_removed=True)

        utils.login(self)
        form_data = {}
        response = self.client.post(reverse('spirit:comment:undelete', kwargs={'pk': comment.pk, }),
                                    form_data)
        expected_url = comment.get_absolute_url()
        self.assertRedirects(response, expected_url, status_code=302, target_status_code=302)

        response = self.client.get(reverse('spirit:comment:undelete', kwargs={'pk': comment.pk, }))
        self.assertEqual(response.status_code, 200)

    def test_comment_move(self):
        """
        comment move to another topic
        """
        utils.login(self)
        self.user.st.is_moderator = True
        self.user.save()
        Topic.objects.filter(pk=self.topic.pk).update(comment_count=2)
        comment = utils.create_comment(user=self.user, topic=self.topic)
        comment2 = utils.create_comment(user=self.user, topic=self.topic)
        to_topic = utils.create_topic(category=self.category)
        form_data = {'topic': to_topic.pk,
                     'comments': [comment.pk, comment2.pk], }
        response = self.client.post(reverse('spirit:comment:move', kwargs={'topic_id': self.topic.pk, }),
                                    form_data)
        expected_url = self.topic.get_absolute_url()
        self.assertRedirects(response, expected_url, status_code=302)
        self.assertEqual(Comment.objects.filter(topic=to_topic.pk).count(), 2)
        self.assertEqual(Comment.objects.filter(topic=self.topic.pk).count(), 0)
        self.assertEqual(Topic.objects.get(pk=self.topic.pk).comment_count, 0)

    def test_comment_find(self):
        """
        comment absolute and lazy url
        """
        comment = utils.create_comment(user=self.user, topic=self.topic)
        response = self.client.post(reverse('spirit:comment:find', kwargs={'pk': comment.pk, }))
        expected_url = comment.topic.get_absolute_url() + "#c%d" % comment.pk
        self.assertRedirects(response, expected_url, status_code=302)

    def test_comment_image_upload(self):
        """
        comment image upload
        """
        utils.login(self)
        img = BytesIO(b'GIF87a\x01\x00\x01\x00\x80\x01\x00\x00\x00\x00ccc,\x00'
                      b'\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;')
        files = {'image': SimpleUploadedFile('image.gif', img.read(), content_type='image/gif'), }
        response = self.client.post(reverse('spirit:comment:image-upload-ajax'),
                                    HTTP_X_REQUESTED_WITH='XMLHttpRequest',
                                    data=files)
        res = json.loads(response.content.decode('utf-8'))
        self.assertEqual(res['url'], os.path.join(settings.MEDIA_URL, 'spirit', 'images', str(self.user.pk),
                                                  "bf21c3043d749d5598366c26e7e4ab44.gif").replace("\\", "/"))
        os.remove(os.path.join(settings.MEDIA_ROOT, 'spirit', 'images', str(self.user.pk),
                               "bf21c3043d749d5598366c26e7e4ab44.gif"))

    def test_comment_image_upload_invalid(self):
        """
        comment image upload, invalid image
        """
        utils.login(self)
        image = BytesIO(b'BAD\x02D\x01\x00;')
        image.name = 'image.gif'
        image.content_type = 'image/gif'
        files = {'image': SimpleUploadedFile(image.name, image.read()), }
        response = self.client.post(reverse('spirit:comment:image-upload-ajax'),
                                    HTTP_X_REQUESTED_WITH='XMLHttpRequest',
                                    data=files)
        res = json.loads(response.content.decode('utf-8'))
        self.assertIn('error', res.keys())
        self.assertIn('image', res['error'].keys())

class CommentModelsTest(TestCase):

    def setUp(self):
        cache.clear()
        self.user = utils.create_user()
        self.category = utils.create_category()
        self.topic = utils.create_topic(category=self.category, user=self.user)

    def test_comment_increase_modified_count(self):
        """
        Increase modified_count
        """
        comment = utils.create_comment(topic=self.topic)
        comment.increase_modified_count()
        self.assertEqual(Comment.objects.get(pk=comment.pk).modified_count, 1)

    def test_comment_increase_likes_count(self):
        """
        Increase like_count on comment like
        """
        comment = utils.create_comment(topic=self.topic)
        comment.increase_likes_count()
        self.assertEqual(Comment.objects.get(pk=comment.pk).likes_count, 1)

    def test_comment_decrease_likes_count(self):
        """
        Decrease like_count on remove comment like
        """
        comment = utils.create_comment(topic=self.topic, likes_count=1)
        comment.decrease_likes_count()
        self.assertEqual(Comment.objects.get(pk=comment.pk).likes_count, 0)

    def test_comment_create_moderation_action(self):
        """
        Create comment that tells what moderation action was made
        """
        Comment.create_moderation_action(user=self.user, topic=self.topic, action=1)
        self.assertEqual(Comment.objects.filter(user=self.user, topic=self.topic, action=1).count(), 1)

class CommentTemplateTagTests(TestCase):

    def setUp(self):
        cache.clear()
        self.user = utils.create_user()
        self.category = utils.create_category()
        self.topic = utils.create_topic(category=self.category, user=self.user)
        utils.create_comment(topic=self.topic)
        utils.create_comment(topic=self.topic)
        utils.create_comment(topic=self.topic)

    def test_render_comments_form(self):
        """
        should display simple comment form
        """
        Template(
            "{% load spirit_tags %}"
            "{% render_comments_form topic %}"
        ).render(Context({'topic': self.topic, }))
        context = render_comments_form(self.topic)
        self.assertEqual(context['next'], None)
        self.assertIsInstance(context['form'], CommentForm)
        self.assertEqual(context['topic_id'], self.topic.pk)

    def test_get_action_text(self):
        """
        should display action
        """
        out = Template(
            "{% load spirit_tags %}"
            "{% get_comment_action_text 1 %}"
        ).render(Context())
        self.assertNotEqual(out, "")

class CommentFormTest(TestCase):

    def setUp(self):
        cache.clear()
        self.user = utils.create_user()
        self.category = utils.create_category()
        self.topic = utils.create_topic(category=self.category)

    def test_comment_create(self):
        form_data = {'comment': 'foo', }
        form = CommentForm(data=form_data)
        self.assertEqual(form.is_valid(), True)

    def test_comment_markdown(self):
        form_data = {'comment': '**Spirit unicode: áéíóú** '
                                '', }
        form = CommentForm(data=form_data)
        self.assertEqual(form.is_valid(), True)
        form.user = self.user
        form.topic = self.topic
        comment = form.save()
        self.assertEqual(comment.comment_html, '
Spirit unicode: áéíóú '
                                               '<script>alert();</script>
')

    def test_comments_move(self):
        comment = utils.create_comment(user=self.user, topic=self.topic)
        comment2 = utils.create_comment(user=self.user, topic=self.topic)
        to_topic = utils.create_topic(category=self.category)
        form_data = {'topic': to_topic.pk,
                     'comments': [comment.pk, comment2.pk], }
        form = CommentMoveForm(topic=self.topic, data=form_data)
        self.assertEqual(form.is_valid(), True)
        self.assertEqual(form.save(), list(Comment.objects.filter(topic=to_topic)))

    def test_comment_image_upload(self):
        """
        Image upload
        """
        content = b'GIF87a\x01\x00\x01\x00\x80\x01\x00\x00\x00\x00ccc,\x00' \
                  b'\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;'
        img = BytesIO(content)
        files = {'image': SimpleUploadedFile('image.gif', img.read(), content_type='image/gif'), }

        form = CommentImageForm(user=self.user, data={}, files=files)
        self.assertTrue(form.is_valid())
        image = form.save()
        self.assertEqual(image.name, "bf21c3043d749d5598366c26e7e4ab44.gif")
        image_url = os.path.join(settings.MEDIA_URL, 'spirit', 'images', str(self.user.pk),
                                 image.name).replace("\\", "/")
        self.assertEqual(image.url, image_url)
        image_path = os.path.join(settings.MEDIA_ROOT, 'spirit', 'images', str(self.user.pk), image.name)
        self.assertTrue(os.path.isfile(image_path))

        with open(image_path, "rb") as fh:
            self.assertEqual(fh.read(), content)

        os.remove(image_path)

    def test_comment_image_upload_no_extension(self):
        """
        Image upload no extension
        """
        img = BytesIO(b'GIF87a\x01\x00\x01\x00\x80\x01\x00\x00\x00\x00ccc,\x00'
                      b'\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;')
        files = {'image': SimpleUploadedFile('image', img.read(), content_type='image/gif'), }
        form = CommentImageForm(user=self.user, data={}, files=files)
        self.assertTrue(form.is_valid())
        image = form.save()
        self.assertEqual(image.name, "bf21c3043d749d5598366c26e7e4ab44.gif")
        os.remove(os.path.join(settings.MEDIA_ROOT, 'spirit', 'images', str(self.user.pk), image.name))

    @override_settings(ST_ALLOWED_UPLOAD_IMAGE_FORMAT=['png', ])
    def test_comment_image_upload_not_allowed_format(self):
        """
        Image upload, invalid format
        """
        img = BytesIO(b'GIF87a\x01\x00\x01\x00\x80\x01\x00\x00\x00\x00ccc,\x00'
                      b'\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;')
        # fake png extension
        files = {'image': SimpleUploadedFile('image.png', img.read(), content_type='image/png'), }
        form = CommentImageForm(data={}, files=files)
        self.assertFalse(form.is_valid())

    def test_comment_image_upload_invalid(self):
        """
        Image upload, bad image
        """
        img = BytesIO(b'bad\x00;')
        files = {'image': SimpleUploadedFile('image.gif', img.read(), content_type='image/gif'), }
        form = CommentImageForm(data={}, files=files)
        self.assertFalse(form.is_valid())

class CommentUtilsTest(TestCase):

    def setUp(self):
        cache.clear()
        self.user = utils.create_user()
        self.category = utils.create_category()
        self.topic = utils.create_topic(category=self.category, user=self.user)

    def test_comment_posted(self):
        """
        * Should create subscription
        * Should notify subscribers
        * Should notify mentions
        * Should increase topic's comment counter
        * Should mark the topic as unread
        """
        # Should create subscription
        subscriber = self.user
        comment = utils.create_comment(user=subscriber, topic=self.topic)
        comment_posted(comment=comment, mentions=None)
        self.assertEqual(len(TopicNotification.objects.all()), 1)
        self.assertTrue(TopicNotification.objects.get(user=subscriber, topic=self.topic).is_read)

        # Should notify subscribers
        user = utils.create_user()
        comment = utils.create_comment(user=user, topic=self.topic)
        comment_posted(comment=comment, mentions=None)
        self.assertEqual(len(TopicNotification.objects.all()), 2)
        self.assertFalse(TopicNotification.objects.get(user=subscriber, topic=self.topic).is_read)

        # Should notify mentions
        mentioned = utils.create_user()
        mentions = {mentioned.username: mentioned, }
        comment = utils.create_comment(user=user, topic=self.topic)
        comment_posted(comment=comment, mentions=mentions)
        self.assertEqual(TopicNotification.objects.get(user=mentioned, comment=comment).action, MENTION)
        self.assertFalse(TopicNotification.objects.get(user=mentioned, comment=comment).is_read)

        # Should mark the topic as unread
        user_unread = utils.create_user()
        topic = utils.create_topic(self.category)
        topic_unread_creator = TopicUnread.objects.create(user=user, topic=topic, is_read=True)
        topic_unread_subscriber = TopicUnread.objects.create(user=user_unread, topic=topic, is_read=True)
        comment = utils.create_comment(user=user, topic=topic)
        comment_posted(comment=comment, mentions=None)
        self.assertTrue(TopicUnread.objects.get(pk=topic_unread_creator.pk).is_read)
        self.assertFalse(TopicUnread.objects.get(pk=topic_unread_subscriber.pk).is_read)

        # Should increase topic's comment counter
        topic = utils.create_topic(self.category)
        comment = utils.create_comment(user=user, topic=topic)
        comment_posted(comment=comment, mentions=None)
        self.assertEqual(Topic.objects.get(pk=topic.pk).comment_count, 1)
        comment_posted(comment=comment, mentions=None)
        self.assertEqual(Topic.objects.get(pk=topic.pk).comment_count, 2)


text:
package org.apache.camel.test.blueprint;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.equalTo;

/**
 * A test showing that Blueprint XML property placeholders work correctly with
 * augmented property names and fallback behavior.
 */
public class BlueprintAugmentedPropertiesNoFallbackTest extends CamelBlueprintTestSupport {

    @Override
    public void setUp() throws Exception {
        try {
            super.setUp();
            fail("Should fail, because Blueprint XML uses property placeholders, but we didn't resolve the placeholder");
        } catch (Exception e) {
            assertThat(e.getCause().getCause().getCause().getMessage(), equalTo("Property with key [TESTYYY.source] not found in properties from text: {{source}}"));
        }
    }

    @Override
    protected String getBlueprintDescriptor() {
        return "org/apache/camel/test/blueprint/augmented-properties-no-fallback.xml";
    }

    @Override
    protected String[] loadConfigAdminConfigurationFile() {
        return new String[] {"src/test/resources/etc/augmented.no.fallback.cfg", "augmented.no.fallback"};
    }

    @Test
    public void testFallbackToUnaugmentedProperty() throws Exception {
    }

}


text:
\begin{frame}{Future Works}
  \begin{itemize}
  \item Optimising implementation
    \begin{itemize}
    \item Lattice
    \item Fixed Point
    \end{itemize}
  \item Trigger words
  \item Support more frameworks
  \item Other analysis
  \end{itemize}
\end{frame}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

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

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <parent>
    <groupId>org.apache.excalibur</groupId>
    <artifactId>excalibur-parent</artifactId>
    <version>4-SNAPSHOT</version>
    <relativePath>../../parent/pom.xml</relativePath>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <name>Excalibur Component Manager</name>
  <artifactId>excalibur-component</artifactId>
  <groupId>org.apache.excalibur.component</groupId>
  <version>2.2.2-SNAPSHOT</version>
  <inceptionYear>1997</inceptionYear>
  <description>
    This project contains utilities for managing components. ECM is what we call an "avalon container", though it is
    somewhat different in architecture to newer developments like Phoenix and Fortress. Our intend is to someday
    completely replace ECM with Fortress. In particular, this package contains the ExcaliburComponentManager,
    usually abbreviated to ECM.
  </description>
  <dependencies>
    <dependency>
      <groupId>org.apache.avalon.framework</groupId>
      <artifactId>avalon-framework-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.avalon.framework</groupId>
      <artifactId>avalon-framework-impl</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.excalibur.containerkit</groupId>
      <artifactId>excalibur-logger</artifactId>
      <version>${version.containerkit}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.avalon.logkit</groupId>
      <artifactId>avalon-logkit</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.excalibur.components</groupId>
      <artifactId>excalibur-pool-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.excalibur.components</groupId>
      <artifactId>excalibur-pool-impl</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.excalibur.components</groupId>
      <artifactId>excalibur-pool-instrumented</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.excalibur.containerkit</groupId>
      <artifactId>excalibur-instrument-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.excalibur.containerkit</groupId>
      <artifactId>excalibur-instrument-mgr-impl</artifactId>
      <version>${version.containerkit}</version>
    </dependency>
    <dependency>
      <artifactId>servlet-api</artifactId>
      <groupId>javax.servlet</groupId>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <build/>
  <scm>
    <connection>scm:svn:http://svn.apache.org/repos/asf/excalibur/trunk/deprecated/component</connection>
    <url>http://svn.apache.org/viewcvs.cgi/excalibur/trunk/deprecated/component</url>
    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/excalibur/trunk/excalibur-deprecated-modules/excalibur-component</developerConnection>
  </scm>
</project>


text:
/*++

Module Name:

    MultiInputReadSupplier.cpp

Abstract:

    A read supplier that combines other read suppliers.  It's used when there are muliple input files to process.

Authors:

    Bill Bolosky, November, 2012

Environment:

    User mode service.

Revision History:

--*/

#include "stdafx.h"
#include "Read.h"
#include "Compat.h"
#include "MultiInputReadSupplier.h"

MultiInputReadSupplier::MultiInputReadSupplier(int i_nReadSuppliers, ReadSupplier **i_readSuppliers)
{
    readSuppliers = i_readSuppliers;    // We get to own the array
    nRemainingReadSuppliers = nReadSuppliers = i_nReadSuppliers;
    nextReadSupplier = 0;
    activeReadSuppliers = new ActiveRead[nReadSuppliers];
    for (int i = 0; i < nReadSuppliers; i++) {
        activeReadSuppliers[i].index = i;
        activeReadSuppliers[i].lastBatch = DataBatch();
        activeReadSuppliers[i].firstReadInNextBatch = NULL;
    }
}

MultiInputReadSupplier::~MultiInputReadSupplier()
{
    for (int i = 0; i < nReadSuppliers; i++) {
        delete readSuppliers[i];
        readSuppliers[i] = NULL;
    }
    delete [] readSuppliers;
    delete [] activeReadSuppliers;
}

    Read *
MultiInputReadSupplier::getNextRead()
{
    while (true) {
        if (0 == nRemainingReadSuppliers) {
            return NULL;
        }
        _ASSERT(nextReadSupplier < nRemainingReadSuppliers);

        ActiveRead* active = &activeReadSuppliers[nextReadSupplier];
        DataBatch last = active->lastBatch;
        Read *read;

        if (active->firstReadInNextBatch != NULL) {
            read = active->firstReadInNextBatch;
            active->firstReadInNextBatch = NULL;
            active->lastBatch = read->getBatch();
            return read;
        }

        read = readSuppliers[active->index]->getNextRead();
        if (read != NULL) {
            read->setBatch(DataBatch(read->getBatch().batchID,
                read->getBatch().fileID * nReadSuppliers + active->index));
            active->lastBatch = read->getBatch();
            if (read->getBatch() == last || last == DataBatch()) {
                return read;
            }
            // end of batch from current supplier, round-robin through suppliers
            active->firstReadInNextBatch = read;
            nextReadSupplier = (nextReadSupplier + 1) % nRemainingReadSuppliers;
        } else {
            //
            // This supplier is done.  Update our array to pull the
            // last live read supplier into the slot that we just vacated (this will result
            // in violating a strict round robin, but we don't promise any such thing
            // anyway). Can't delete because it might be retaining read data in use downstream.
            //
            nRemainingReadSuppliers--;
            activeReadSuppliers[nextReadSupplier] = activeReadSuppliers[nRemainingReadSuppliers];
            nextReadSupplier = 0;   // (Bluntly) handles the case where nextReadSupplier is the last one.
        }
    }
}

    void
MultiInputReadSupplier::holdBatch(
    DataBatch batch)
{
    int index = batch.fileID % nReadSuppliers;
    _ASSERT(index >= 0 && index < nReadSuppliers);
    readSuppliers[index]->holdBatch(DataBatch(batch.batchID, batch.fileID / nReadSuppliers));
}

    bool
MultiInputReadSupplier::releaseBatch(
    DataBatch batch)
{
    int index = batch.fileID % nReadSuppliers;
    _ASSERT(index >= 0 && index < nReadSuppliers);
    return readSuppliers[index]->releaseBatch(DataBatch(batch.batchID, batch.fileID / nReadSuppliers));
}

MultiInputPairedReadSupplier::MultiInputPairedReadSupplier(int i_nReadSuppliers, PairedReadSupplier **i_pairedReadSuppliers)
{
    pairedReadSuppliers = i_pairedReadSuppliers;    // We get to own the array
    nRemainingReadSuppliers = nReadSuppliers = i_nReadSuppliers;
    nextReadSupplier = 0;
    activeReadSuppliers = new ActiveRead[nReadSuppliers];
    for (int i = 0; i < nReadSuppliers; i++) {
        activeReadSuppliers[i].index = i;
        activeReadSuppliers[i].lastBatch[0] = activeReadSuppliers[i].lastBatch[1] = DataBatch();
        activeReadSuppliers[i].firstReadInNextBatch[0] = activeReadSuppliers[i].firstReadInNextBatch[1] = NULL;
    }
}

MultiInputPairedReadSupplier::~MultiInputPairedReadSupplier()
{
    for (int i = 0; i < nReadSuppliers; i++) {
        delete pairedReadSuppliers[i];
        pairedReadSuppliers[i] = NULL;
    }

    delete [] pairedReadSuppliers;
    delete [] activeReadSuppliers;
}

    bool
MultiInputPairedReadSupplier::getNextReadPair(Read **read0, Read **read1)
{
    if (0 == nRemainingReadSuppliers) {
        return NULL;
    }

    _ASSERT(nextReadSupplier < nRemainingReadSuppliers);

    ActiveRead* active = &activeReadSuppliers[nextReadSupplier];
    bool hasReads = pairedReadSuppliers[active->index]->getNextReadPair(read0, read1);
    bool nextBatch = hasReads && ((*read0)->getBatch() != active->lastBatch[0] || (*read1)->getBatch() != active->lastBatch[1]);
    if (nextBatch) {
        active->firstReadInNextBatch[0] = *read0;
        active->firstReadInNextBatch[1] = *read1;
    }
    if (nextBatch || ! hasReads) {
        while (true) {
            // end of batch from current supplier, round-robin through suppliers
            if (nextBatch) {
                nextReadSupplier = (nextReadSupplier + 1) % nRemainingReadSuppliers;
                nextBatch = false;
            }
            active = &activeReadSuppliers[nextReadSupplier];
            if (active->firstReadInNextBatch[0] != NULL) {
                _ASSERT(active->firstReadInNextBatch[1] != NULL);
                *read0 = active->firstReadInNextBatch[0];
                *read1 = active->firstReadInNextBatch[1];
                active->firstReadInNextBatch[0] = active->firstReadInNextBatch[1] = NULL;
                break;
            }
            if (pairedReadSuppliers[active->index]->getNextReadPair(read0, read1)) {
                break;
            }
            nRemainingReadSuppliers--;
            if (0 == nRemainingReadSuppliers) {
                return false;
            }
            //
            // This supplier is done.  Update our array to pull the
            // last live read supplier into the slot that we just vacated (this will result
            // in violating a strict round robin, but we don't promise any such thing
            // anyway). Can't delete because it might be retaining read data in use downstream.
            //
            activeReadSuppliers[nextReadSupplier] = activeReadSuppliers[nRemainingReadSuppliers];
            nextReadSupplier = 0;   // (Bluntly) handles the case where nextReadSupplier is the last one.
        }
    }
    active->lastBatch[0] = (*read0)->getBatch();
    (*read0)->setBatch(DataBatch(active->lastBatch[0].fileID * nReadSuppliers + active->index, active->lastBatch[0].batchID));
    active->lastBatch[1] = (*read1)->getBatch();
    (*read1)->setBatch(DataBatch(active->lastBatch[1].fileID * nReadSuppliers + active->index, active->lastBatch[1].batchID));

    return true;
}

    void
MultiInputPairedReadSupplier::holdBatch(
    DataBatch batch)
{
    int index = batch.fileID % nReadSuppliers;
    _ASSERT(index >= 0 && index < nReadSuppliers);
    pairedReadSuppliers[index]->holdBatch(DataBatch(batch.batchID, batch.fileID / nReadSuppliers));
}

    bool
MultiInputPairedReadSupplier::releaseBatch(
    DataBatch batch)
{
    int index = batch.fileID % nReadSuppliers;
    _ASSERT(index >= 0 && index < nReadSuppliers);
    return pairedReadSuppliers[index]->releaseBatch(DataBatch(batch.batchID, batch.fileID / nReadSuppliers));
}

MultiInputReadSupplierGenerator::MultiInputReadSupplierGenerator(int i_nReadSuppliers, ReadSupplierGenerator **i_readSupplierGenerators)
{
    nReadSuppliers = i_nReadSuppliers;
    readSupplierGenerators = i_readSupplierGenerators;  // We take ownership of the array
}

MultiInputReadSupplierGenerator::~MultiInputReadSupplierGenerator()
{
    for (int i = 0; i < nReadSuppliers; i++) {
        delete readSupplierGenerators[i];
    }
    delete [] readSupplierGenerators;
    readSupplierGenerators = NULL;
}

    ReadSupplier *
MultiInputReadSupplierGenerator::generateNewReadSupplier()
{
    ReadSupplier **readSuppliers = new ReadSupplier *[nReadSuppliers];
    for (int i = 0; i < nReadSuppliers; ) {
        readSuppliers[i] = readSupplierGenerators[i]->generateNewReadSupplier();
		if (NULL == readSuppliers[i]) {
			nReadSuppliers--;
		} else {
			i++;
		}
    }

	if (0 == nReadSuppliers) {
		delete [] readSuppliers;
		return NULL;
	}

    return new MultiInputReadSupplier(nReadSuppliers,readSuppliers);    // The Supplier owns the array and suppliers we created
}

    ReaderContext*
MultiInputReadSupplierGenerator::getContext()
{
    return readSupplierGenerators[0]->getContext();
}

MultiInputPairedReadSupplierGenerator::MultiInputPairedReadSupplierGenerator(int i_nReadSuppliers, PairedReadSupplierGenerator **i_readSupplierGenerators)
{
    nReadSuppliers = i_nReadSuppliers;
    readSupplierGenerators = i_readSupplierGenerators;  // We own the array and the generators.
}

MultiInputPairedReadSupplierGenerator::~MultiInputPairedReadSupplierGenerator()
{
    for (int i = 0; i < nReadSuppliers; i++) {
        delete readSupplierGenerators[i];
        readSupplierGenerators[i] = NULL;
    }
    delete [] readSupplierGenerators;
    readSupplierGenerators = NULL;
}

    PairedReadSupplier *
MultiInputPairedReadSupplierGenerator::generateNewPairedReadSupplier()
{
    PairedReadSupplier **readSuppliers = new PairedReadSupplier *[nReadSuppliers];
    for (int i = 0; i < nReadSuppliers; ) {
        readSuppliers[i] = readSupplierGenerators[i]->generateNewPairedReadSupplier();
		if (NULL == readSuppliers[i]) {
			nReadSuppliers--;
		} else {
			i++;
		}
    }
	if (0 == nReadSuppliers) {
		delete [] readSuppliers;
		return NULL;
	}
    return new MultiInputPairedReadSupplier(nReadSuppliers,readSuppliers);
}

    ReaderContext*
MultiInputPairedReadSupplierGenerator::getContext()
{
    return readSupplierGenerators[0]->getContext();
}


text:
/* Automatically generated code, don't edit ! */

package org.urish.gwtit.titanium.network.events;

import org.urish.gwtit.client.event.AbstractTitaniumEvent;

import com.google.gwt.core.client.JavaScriptObject;

/**
 *
 */
public class WriteErrorEvent extends AbstractTitaniumEvent {

	public final static String NATIVE_EVENT_NAME = "writeError";

	protected WriteErrorEvent() {
	}

	/**
	 * the BSD socket error code
	 */
	public final native JavaScriptObject getCode()
	/*-{
		return this.code;
	}-*/;

	/**
	 * a description of the error
	 */
	public final native JavaScriptObject getError()
	/*-{
		return this.error;
	}-*/;

}


text:
from Util import Pose
from Util.constant import KEEPOUT_DISTANCE_FROM_BALL
from Util.role import Role

from ai.STA.Strategy.strategy import Strategy
from ai.STA.Tactic.place_ball import PlaceBall
from ai.STA.Tactic.stay_away_from_ball import StayAwayFromBall

# noinspection PyTypeChecker
class BallPlacement(Strategy):
    def __init__(self, p_game_state):
        super().__init__(p_game_state)

        target = None
        if self.game_state.last_ref_state is None:
            self.logger.warning("The AI has not received a referee message and does not know where to place the ball.")
        else:
            target = self.game_state.last_ref_state.ball_placement_position
            if target is None:
                self.logger.warning("The last ref_state did not contains a ball_placement position\n"
                                    "The AI does not know where to place the ball")
        for r, p in self.assigned_roles.items():
            if r == Role.FIRST_ATTACK and target is not None:
                self.create_node(r, PlaceBall(self.game_state, p, target=Pose(target)))
            elif r == Role.GOALKEEPER:
                self.create_node(r, StayAwayFromBall(self.game_state,
                                                     p,
                                                     forbidden_areas=[],
                                                     keepout_radius=2*KEEPOUT_DISTANCE_FROM_BALL))
            else:
                self.create_node(r, StayAwayFromBall(self.game_state, p, keepout_radius=2*KEEPOUT_DISTANCE_FROM_BALL))

    @classmethod
    def required_roles(cls):
        return [Role.GOALKEEPER,
                Role.FIRST_ATTACK]

    @classmethod
    def optional_roles(cls):
        return [r for r in Role if r not in [Role.GOALKEEPER, Role.FIRST_ATTACK]]


text:
package seedu.task.model.task;

import seedu.task.commons.exceptions.IllegalValueException;

/**
 * Represents a Task's phone number in the task manager. Guarantees: immutable;
 * is valid as declared in {@link #isValidTime(String)}
 */

public class Time {

    // @@author A0139284X
    public static final String MESSAGE_TIME_CONSTRAINTS = "Task's time should be in 24H format HHMM";
    public static final String MESSAGE_INVALID_TIME = "Time provided is invalid";
    public static final String TIME_VALIDATION_REGEX = "(([0-1]?[0-9]|2[0-3])[0-5][0-9]$){0,1}";
    public static final String INTEGER = "(\\d{4}){0,1}";
    public static final String DELETE_TASK_OBJECT_STRING = "-";

    private final String time;

    // @@author A0142360U
    /**
     * Validates given time.
     *
     * @throws IllegalValueException
     *             if given time string is invalid.
     */
    public Time(String time) throws IllegalValueException {
        if (time == null)
            time = "";
        time = time.trim();
        if (!(time.equals(DELETE_TASK_OBJECT_STRING))) {
            if (!isValidTimeFormat(time)) {
                throw new IllegalValueException(MESSAGE_TIME_CONSTRAINTS);
            }
            if (!isValidTime(time)) {
                throw new IllegalValueException(MESSAGE_TIME_CONSTRAINTS);
            }
        }
        this.time = time;
    }

    /**
     * Returns if a given string is in a valid time format.
     */
    private boolean isValidTimeFormat(String time) {
        return time.matches(INTEGER);
    }

    /**
     * Returns if a given string is a valid Time.
     */
    public static boolean isValidTime(String time) {
        return time.matches(TIME_VALIDATION_REGEX);
    }

    @Override
    public String toString() {
        return getTime();
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Time // instanceof handles nulls
                        && this.getTime().equals(((Time) other).getTime())); // state
                                                                     // check
    }

    @Override
    public int hashCode() {
        return getTime().hashCode();
    }

    public String getTime() {
        return time;
    }

    //@@author A0139284X
    /**
     *
     * @return true if Time is null or empty
     */

    public boolean isProvided() {
        return !(this.getTime().isEmpty());
    }

}


text:
<?xml version="1.0" encoding="utf-8" ?>
<!--  This is a skeleton phpDox config file - Check http://phpDox.de for latest version and more info -->
<phpdox xmlns="http://xml.phpdox.net/config" silent="false">
    <!--  @silent: true | false to enable or disable visual output of progress -->

    <!-- Additional bootstrap files to load for additional parsers and/or engines -->
    <!-- Place as many require nodes as you feel like in this container -->
    <!-- syntax: <require file="/path/to/file.php" /> -->
    <bootstrap />

    <!-- A phpDox project to process, you can have multiple projects in one config file -->
    <project name="phpdox" source="${basedir}/src" workdir="${basedir}/build/phpdox/xml">
        <!--  @name    - The name of the project -->
        <!--  @source  - The source directory of the application to process -->
        <!--  @workdir - The directory to store the xml data files in -->

        <!--  A phpDox config file can define additional variables (properties) per project -->
        <!--  <property name="some.name" value="the.value" /> -->

        <!--  Values can make use of previously defined properties -->
        <!--  The following are defined by default:

                ${basedir}                Directory the loaded config file is in

                ${phpDox.home}            Directory of the phpDox installation
                ${phpDox.file}            The current config file
                ${phpDox.version}         phpDox' version number

                ${phpDox.project.name}    The value of project/@name if set, otherwise 'unnamed'
                ${phpDox.project.source}  The value of project/@source if set, otherwise '${basedir}/src'
                ${phpDox.project.workdir} The value of project/@workdir if set, otherwise '${basedir}/build/phpdox/xml'

                ${phpDox.php.version}     The PHP Version of the interpreter in use

         -->

        <!--  Additional configuration for the collecting process (parse of php code, generation of xml data) -->
        <collector publiconly="false" backend="parser">
            <!--  @publiconly - Flag to disable/enable processing of non public methods and members -->
            <!--  @backend    - The collector backend to use, currently only shipping with 'parser' -->

            <!--  <include / exclude filter for filelist generator, mask must follow fnmatch() requirements  -->
            <include mask="*.php" />
            <exclude mask="" />

            <!--  How to handle inheritance -->
            <inheritance resolve="true">
                <!--  @resolve - Flag to enable/disable resolving of inheritance -->

                <!--  You can define multiple (external) dependencies to be included -->
                <!--  <dependency  path="" -->
                <!--    @path  - path to a directory containing an index.xml for a dependency project -->
            </inheritance>

        </collector>

        <!--  Configuration of generation process -->
        <generator output="${basedir}/docs">
            <!-- @output - (Base-)Directory to store output data in -->

            <!-- A generation process consists of one or more build tasks and of (optional) enrich sources -->

            <enrich base="${basedir}/build">
                <!-- @base - (Base-)Directory of datafiles used for enrich process -->

                <!-- add build information - this should always be enabled -->
                <source type="build" />

                <!-- add phploc output -->
                <!-- <source type="phploc" /> -->

                <!-- add git vcs information -->
                <!--
                <source type="git">
                    <git binary="/usr/bin/git" />
                    <history enabled="true" limit="15" cache="${phpDox.project.workdir}/gitlog.xml" />
                </source>
                -->

                <!-- enrichment source -->
                <!--<source type="checkstyle">-->
                    <!-- @type - the handler for the enrichment -->
                    <!--         known types by default are: checkstyle, pmd, clover, phpunit -->

                    <!-- every enrichment source can have additional configuration nodes, most probably need a logfile -->
                    <!-- <file name="logs/checkstyle.xml" /> -->
                <!--</source> -->

                <!-- PHPMessDetector -->
                <!--
                <source type="pmd">
                    <file name="pmd.xml" />
                </source>
                -->

            </enrich>

            <!-- <build engine="..." enabled="true" output="..." /> -->
            <!--   @engine  - The name of the engine this build task uses, use ./phpDox - -engines to get a list of available engines -->
            <!--   @enabled - Flag to enable/disable this engine, default: enabled=true -->
            <!--   @output  - (optional) Output directory; if relative (no / as first char) it is interpreted as relative to generator/@output -->

            <!-- An engine and thus build node can have additional configuration child nodes, please check the documentation for the engine to find out more -->

            <!--  default engine "html" -->
            <build engine="html" enabled="true" output="html">
                <template dir="${phpDox.home}/templates/html" />
                <file extension="xhtml" />
            </build>

        </generator>
    </project>

</phpdox>


text:
//
//  RKBinding.h
//  RoundaboutKit
//
//  Created by Kevin MacWhinnie on 12/18/12.
//  Copyright (c) 2012 Roundabout Software, LLC. All rights reserved.
//

#ifndef RKBinding_h
#define RKBinding_h 1

#import <Foundation/Foundation.h>
#import "RKPromise.h"

///The different types of binding connections.
typedef enum RKBindingConnectionType {

    ///The default binding connection type.
    kRKBindingConnectionTypeOneWayBinding = 0,

} RKBindingConnectionType;

///The RKBinding object encapsulates a connection between the key path
///of a source object, and the key path of a destination object.
///
///The lifecycle of bindings is controlled by the binding mechanism.
///No external references should be kept to binding objects, as this
///can lead to dangling pointers due to RKBinding using unsafe_unretained
///variables to track connected-to objects due to technical limitations
///of the current __weak variable implementation.
///
///It is not safe to access the binding mechanism from multiple threads,
///and as with the built-in AppKit binding mechanism, it is undefined
///behaviour to emit change notifications from background threads.
///
/// \seealso(-[NSObject(RKBinding) bindingFor:])
@interface RKBinding : NSObject

#pragma mark - Connections

///Whether or not the binding is connected.
@property (readonly, RK_NONATOMIC_IOSONLY) BOOL isConnected;

///Connects this binding to a specified key path in a specified object.
///
/// \param  object  The object to bind to. Non-retained. Required.
/// \param  keyPath The key path of the object to bind to. Required.
///
/// \result self
///
///If the receiver is already connected, it will be disconnected,
///and then connected to the new object-keypath.
- (RKBinding *)connectTo:(NSObject *)object keyPath:(NSString *)keyPath;

///Disconnects this binding.
///
/// \result self
///
///This method does nothing if the receiver isn't connected.
- (RKBinding *)disconnect;

#pragma mark -

///The connection type of the binding.
@property (readonly, RK_NONATOMIC_IOSONLY) RKBindingConnectionType connectionType;

#pragma mark - Options

///The value to substitute when the key path on the connected-to-object yields nil.
@property (RK_NONATOMIC_IOSONLY) id defaultValue;

///The value transformer to use.
@property (RK_NONATOMIC_IOSONLY) NSValueTransformer *valueTransformer;

#pragma mark - Promise Support

///Whether or not promises should be realized.
///
///Default value is YES.
///
///When a promise is encountered by a binding, the default value is set
///on the target object while the promise is realized.
///
///Multi-part promises will result in the target's value-keypath being
///updated multiple times (once for each part).
@property (RK_NONATOMIC_IOSONLY) BOOL realizePromises;

///The block to invoke when realizing a promise fails.
@property (copy) RKPromiseFailureBlock promiseFailureBlock;

@end

#pragma mark -

///The methods added to the NSObject class to enable
///the RKBinding mechanism to be fully functional.
///
///Including this category in your project will change
///the default implementation of `-dealloc` to enable
///the automatic disconnection mechanism of RKBinding.
@interface NSObject (RKBinding)

///Returns a binding object for the receiver for a given key path,
///creating the binding object if it does not exist.
///
///The returned binding will be disconnected and deallocated when
///the receiver or the object eventually connected to are released.
///
///This method is not threadsafe.
- (RKBinding *)bindingFor:(NSString *)keyPath;

@end

#pragma mark -

///The methods added to the NSArray class to enable
///the RKBinding mechanism to be fully functional.
@interface NSArray (RKBinding)

///Returns an array of new binding objects for a specified key path that are owned by the objects in the array.
- (NSArray *)bindingsFor:(NSString *)keyPath;

@end

#pragma mark - One-Off Observations

///Creates and returns a one-time key-value change observer object.
///
/// \param  target      The object to observe for changes. Required.
/// \param  keyPath     The key path to observe for changes on `target`. Required.
/// \param  callback    The block to invoke when the change happens. Required.
///
/// \result An opaque object responsible for propagating changes from `target.keyPath` to `callback`.
RK_EXTERN_OVERLOADABLE id RKObserveOnce(id target, NSString *keyPath, void(^callback)(id value));

#endif /* RKBinding_h */


text:
title: Fuse box 2
layout: post
author: finn.morrisroe
permalink: /fuse-box-2/
source-id: 1icua4ftIa65Q8ZbziQHUWvLaX4ijfr0T-Lrk9D7NGcQ
published: true
---

    Title
    Fuse Box 2
    Date
    26/09/16

    Starting point:
    Today we got all of the equipment ourselves and started quickly.

    Target for this lesson?
    Get through another section.

    Did I reach my target?
(add details to "Lesson Review")
    Yes, and started the next section.

    Lesson Review

    How did I learn? What strategies were effective?

    Today I started to explain to Ben, my partner, what we had to do and he typed everything in and then we swapped half way into the lesson.

    What limited my learning? Which habits do I need to work on?

    Me and Ben spent quite a long time picking colours and adjusting the words and little things like that.

    What will I change for next time? How will I improve my learning?

    Work harder and work more quickly by concentrating.


text:
package io.permazen.core.util;

import com.google.common.base.Preconditions;

import io.permazen.core.ObjId;
import io.permazen.util.ImmutableNavigableSet;

import java.io.Serializable;
import java.util.AbstractSet;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;

import javax.annotation.concurrent.NotThreadSafe;

/**
 * A set of {@link ObjId}s.
 *
 * <p>
 * This implementation is space optimized for the 64-bits of information contained in an {@link ObjId}.
 * Instances do not accept null values and are not thread safe.
 */
@NotThreadSafe
public class ObjIdSet extends AbstractSet<ObjId> implements Cloneable, Serializable {

    private static final long serialVersionUID = -8245070561628904936L;

    private /*final*/ ObjIdMap<?> map;

// Constructors

    /**
     * Constructs an empty instance.
     */
    public ObjIdSet() {
        this(0);
    }

    /**
     * Constructs an instance with the given initial capacity.
     *
     * @param capacity initial capacity
     * @throws IllegalArgumentException if {@code capacity} is negative
     */
    public ObjIdSet(int capacity) {
        this(new ObjIdMap<Void>(capacity, false));
    }

    /**
     * Constructs an instance initialized with the given ID's.
     *
     * @param ids initial contents for this instance
     * @throws IllegalArgumentException if {@code ids} is null
     * @throws NullPointerException if any ID in {@code ids} is null
     */
    public ObjIdSet(Iterable<? extends ObjId> ids) {
        this(0);
        Preconditions.checkArgument(ids != null, "null ids");
        for (ObjId id : ids)
            this.add(id);
    }

    // Internal constructor
    ObjIdSet(ObjIdMap<?> map) {
        this.map = map;
    }

    /**
     * Remove a single, arbitrary {@link ObjId} from this instance and return it.
     *
     * @return the removed {@link ObjId}, or null if this instance is empty
     */
    public ObjId removeOne() {
        final Map.Entry<ObjId, ?> entry = this.map.removeOne();
        return entry != null ? entry.getKey() : null;
    }

// Methods

    @Override
    public Iterator<ObjId> iterator() {
        return new Iterator<ObjId>() {

            private final ObjIdMap<?>.EntrySetIterator entryIterator = ObjIdSet.this.map.new EntrySetIterator();

            @Override
            public boolean hasNext() {
                return this.entryIterator.hasNext();
            }

            @Override
            public ObjId next() {
                return this.entryIterator.next().getKey();
            }

            @Override
            public void remove() {
                this.entryIterator.remove();
            }
        };
    }

    @Override
    public int size() {
        return this.map.size();
    }

    @Override
    public boolean isEmpty() {
        return this.map.isEmpty();
    }

    @Override
    public boolean contains(Object obj) {
        return this.map.containsKey(obj);
    }

    @Override
    public boolean add(ObjId id) {
        if (this.map.containsKey(id))
            return false;
        this.map.put(id, null);
        return true;
    }

    @Override
    public boolean remove(Object obj) {
        if (!this.map.containsKey(obj))
            return false;
        this.map.remove(obj);
        return true;
    }

    @Override
    public void clear() {
        this.map.clear();
    }

    @Override
    public ObjId[] toArray() {
        return this.map.toKeysArray();
    }

    /**
     * Create a sorted, immutable snapshot of this instance.
     *
     * @return sorted, immutable snapshot
     */
    @SuppressWarnings("unchecked")
    public ImmutableNavigableSet<ObjId> sortedSnapshot() {
        final ObjId[] array = this.toArray();
        Arrays.sort(array);
        return new ImmutableNavigableSet<>(array, ObjId::compareTo);
    }

    /**
     * Produce a debug dump of this instance.
     */
    String debugDump() {
        return this.map.debugDump();
    }

// Object

    // This works because ObjId.hashCode() == ObjId.asLong().hashCode()
    @Override
    public int hashCode() {
        final long[] keyArray = this.map.getKeys();
        int hash = 0;
        for (final long key : keyArray) {
            if (key != 0)
                hash += Long.hashCode(key);
        }
        return hash;
    }

// Cloneable

    @Override
    public ObjIdSet clone() {
        final ObjIdSet clone;
        try {
            clone = (ObjIdSet)super.clone();
        } catch (CloneNotSupportedException e) {
            throw new RuntimeException(e);
        }
        clone.map = clone.map.clone();
        return clone;
    }
}


text:
#pragma once
#include <aws/iot/IoT_EXPORTS.h>
#include <aws/iot/IoTRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace IoT
{
namespace Model
{

  /**
   *
The input for the DisableTopicRuleRequest operation.

See Also:

   * AWS
   * API Reference

   */
  class AWS_IOT_API DisableTopicRuleRequest : public IoTRequest
  {
  public:
    DisableTopicRuleRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "DisableTopicRule"; }

    Aws::String SerializePayload() const override;

    /**
     *
The name of the rule to disable.

     */
    inline const Aws::String& GetRuleName() const{ return m_ruleName; }

    /**
     *
The name of the rule to disable.

     */
    inline bool RuleNameHasBeenSet() const { return m_ruleNameHasBeenSet; }

    /**
     *
The name of the rule to disable.

     */
    inline void SetRuleName(const Aws::String& value) { m_ruleNameHasBeenSet = true; m_ruleName = value; }

    /**
     *
The name of the rule to disable.

     */
    inline void SetRuleName(Aws::String&& value) { m_ruleNameHasBeenSet = true; m_ruleName = std::move(value); }

    /**
     *
The name of the rule to disable.

     */
    inline void SetRuleName(const char* value) { m_ruleNameHasBeenSet = true; m_ruleName.assign(value); }

    /**
     *
The name of the rule to disable.

     */
    inline DisableTopicRuleRequest& WithRuleName(const Aws::String& value) { SetRuleName(value); return *this;}

    /**
     *
The name of the rule to disable.

     */
    inline DisableTopicRuleRequest& WithRuleName(Aws::String&& value) { SetRuleName(std::move(value)); return *this;}

    /**
     *
The name of the rule to disable.

     */
    inline DisableTopicRuleRequest& WithRuleName(const char* value) { SetRuleName(value); return *this;}

  private:

    Aws::String m_ruleName;
    bool m_ruleNameHasBeenSet = false;
  };

} // namespace Model
} // namespace IoT
} // namespace Aws


text:
var Figure = require( './../lib' );

// Data:

var data = require( './line.data.json' );

// FIGURE //

var figure = new Figure();

figure
	.config( {} )
	.data( data );

console.log( figure.create() );


text:
package io.netty.handler.ssl;

import javax.net.ssl.SSLException;
import java.io.File;

public class JdkSslServerContextTest extends SslContextTest {

    @Override
    protected SslContext newServerContext(File crtFile, File keyFile, String pass) throws SSLException {
        return SslContextBuilder.forServer(crtFile, keyFile, pass).sslProvider(SslProvider.JDK).build();
    }
}


text:
.class public Lcom/tencent/connect/auth/QQAuth;
.super Ljava/lang/Object;

# static fields
.field private static c:Ljava/util/HashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/String;",
            "Lcom/tencent/connect/auth/QQAuth;",
            ">;"
        }
    .end annotation
.end field

# instance fields
.field private a:Lcom/tencent/connect/auth/AuthAgent;

.field private b:Lcom/tencent/connect/auth/QQToken;

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

    const/4 v0, 0x0

    sput-object v0, Lcom/tencent/connect/auth/QQAuth;->c:Ljava/util/HashMap;

    return-void
.end method

.method private constructor <init>(Ljava/lang/String;Landroid/content/Context;)V
    .locals 2

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const-string v0, "openSDK_LOG"

    const-string v1, "new Tencent() --start"

    invoke-static {v0, v1}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;)V

    new-instance v0, Lcom/tencent/connect/auth/QQToken;

    invoke-direct {v0, p1}, Lcom/tencent/connect/auth/QQToken;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lcom/tencent/connect/auth/QQAuth;->b:Lcom/tencent/connect/auth/QQToken;

    new-instance v0, Lcom/tencent/connect/auth/AuthAgent;

    iget-object v1, p0, Lcom/tencent/connect/auth/QQAuth;->b:Lcom/tencent/connect/auth/QQToken;

    invoke-direct {v0, p2, v1}, Lcom/tencent/connect/auth/AuthAgent;-><init>(Landroid/content/Context;Lcom/tencent/connect/auth/QQToken;)V

    iput-object v0, p0, Lcom/tencent/connect/auth/QQAuth;->a:Lcom/tencent/connect/auth/AuthAgent;

    iget-object v0, p0, Lcom/tencent/connect/auth/QQAuth;->b:Lcom/tencent/connect/auth/QQToken;

    invoke-static {p2, v0}, Lcom/tencent/connect/a/a;->c(Landroid/content/Context;Lcom/tencent/connect/auth/QQToken;)V

    const-string v0, "openSDK_LOG"

    const-string v1, "new Tencent() --end"

    invoke-static {v0, v1}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method

.method public static createInstance(Ljava/lang/String;Landroid/content/Context;)Lcom/tencent/connect/auth/QQAuth;
    .locals 4

    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    invoke-static {v0}, Lcom/tencent/a/b/a;->a(Landroid/content/Context;)V

    const-string v0, "openSDK_LOG"

    const-string v1, "createInstance() --start"

    invoke-static {v0, v1}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;)V

    sget-object v0, Lcom/tencent/connect/auth/QQAuth;->c:Ljava/util/HashMap;

    if-nez v0, :cond_1

    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    sput-object v0, Lcom/tencent/connect/auth/QQAuth;->c:Ljava/util/HashMap;

    :cond_0
    :try_start_0
    invoke-virtual {p1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v0

    new-instance v1, Landroid/content/ComponentName;

    invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v2

    const-string v3, "com.tencent.tauth.AuthActivity"

    invoke-direct {v1, v2, v3}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Landroid/content/pm/PackageManager;->getActivityInfo(Landroid/content/ComponentName;I)Landroid/content/pm/ActivityInfo;

    new-instance v1, Landroid/content/ComponentName;

    invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v2

    const-string v3, "com.tencent.connect.common.AssistActivity"

    invoke-direct {v1, v2, v3}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Landroid/content/pm/PackageManager;->getActivityInfo(Landroid/content/ComponentName;I)Landroid/content/pm/ActivityInfo;
    :try_end_0
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    new-instance v0, Lcom/tencent/connect/auth/QQAuth;

    invoke-direct {v0, p0, p1}, Lcom/tencent/connect/auth/QQAuth;-><init>(Ljava/lang/String;Landroid/content/Context;)V

    sget-object v1, Lcom/tencent/connect/auth/QQAuth;->c:Ljava/util/HashMap;

    invoke-virtual {v1, p0, v0}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    const-string v1, "openSDK_LOG"

    const-string v2, "createInstance()  --end"

    invoke-static {v1, v2}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;)V

    :goto_0
    return-object v0

    :cond_1
    sget-object v0, Lcom/tencent/connect/auth/QQAuth;->c:Ljava/util/HashMap;

    invoke-virtual {v0, p0}, Ljava/util/HashMap;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    const-string v0, "openSDK_LOG"

    const-string v1, "createInstance() ,sessionMap.containsKey --end"

    invoke-static {v0, v1}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;)V

    sget-object v0, Lcom/tencent/connect/auth/QQAuth;->c:Ljava/util/HashMap;

    invoke-virtual {v0, p0}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/tencent/connect/auth/QQAuth;

    goto :goto_0

    :catch_0
    move-exception v0

    const-string v1, "openSDK_LOG"

    const-string v2, "createInstance() error --end"

    invoke-static {v1, v2, v0}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    const-string v1, "\u8bf7\u53c2\u7167\u6587\u6863\u5728Androidmanifest.xml\u52a0\u4e0aAuthActivity\u548cAssitActivity\u7684\u5b9a\u4e49 "

    const/4 v2, 0x1

    invoke-static {v0, v1, v2}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

    move-result-object v0

    invoke-virtual {v0}, Landroid/widget/Toast;->show()V

    const/4 v0, 0x0

    goto :goto_0
.end method

# virtual methods
.method public getQQToken()Lcom/tencent/connect/auth/QQToken;
    .locals 1

    iget-object v0, p0, Lcom/tencent/connect/auth/QQAuth;->b:Lcom/tencent/connect/auth/QQToken;

    return-object v0
.end method

.method public isSessionValid()Z
    .locals 3

    const-string v1, "openSDK_LOG"

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "isSessionValid(), result = "

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-object v0, p0, Lcom/tencent/connect/auth/QQAuth;->b:Lcom/tencent/connect/auth/QQToken;

    invoke-virtual {v0}, Lcom/tencent/connect/auth/QQToken;->isSessionValid()Z

    move-result v0

    if-eqz v0, :cond_0

    const-string v0, "true"

    :goto_0
    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v2, ""

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v1, v0}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v0, p0, Lcom/tencent/connect/auth/QQAuth;->b:Lcom/tencent/connect/auth/QQToken;

    invoke-virtual {v0}, Lcom/tencent/connect/auth/QQToken;->isSessionValid()Z

    move-result v0

    return v0

    :cond_0
    const-string v0, "false"

    goto :goto_0
.end method

.method public login(Landroid/app/Activity;Ljava/lang/String;Lcom/tencent/tauth/IUiListener;)I
    .locals 2

    const-string v0, "openSDK_LOG"

    const-string v1, "login()"

    invoke-static {v0, v1}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;)V

    const/4 v0, 0x0

    sput-boolean v0, Lcom/tencent/connect/common/BaseApi;->isOEM:Z

    iget-object v0, p0, Lcom/tencent/connect/auth/QQAuth;->a:Lcom/tencent/connect/auth/AuthAgent;

    invoke-virtual {v0, p1, p2, p3}, Lcom/tencent/connect/auth/AuthAgent;->doLogin(Landroid/app/Activity;Ljava/lang/String;Lcom/tencent/tauth/IUiListener;)I

    move-result v0

    return v0
.end method

.method public loginWithOEM(Landroid/app/Activity;Ljava/lang/String;Lcom/tencent/tauth/IUiListener;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
    .locals 2

    const-string v0, "openSDK_LOG"

    const-string v1, "loginWithOEM"

    invoke-static {v0, v1}, Lcom/tencent/a/a/c;->b(Ljava/lang/String;Ljava/lang/String;)V

    const/4 v0, 0x1

    sput-boolean v0, Lcom/tencent/connect/common/BaseApi;->isOEM:Z

    const-string v0, ""

    invoke-virtual {p4, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    const-string p4, "null"

    :cond_0
    const-string v0, ""

    invoke-virtual {p5, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1

    const-string p5, "null"

    :cond_1
    const-string v0, ""

    invoke-virtual {p6, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_2

    const-string p6, "null"

    :cond_2
    sput-object p5, Lcom/tencent/connect/common/BaseApi;->installChannel:Ljava/lang/String;

    sput-object p4, Lcom/tencent/connect/common/BaseApi;->registerChannel:Ljava/lang/String;

    sput-object p6, Lcom/tencent/connect/common/BaseApi;->businessId:Ljava/lang/String;

    iget-object v0, p0, Lcom/tencent/connect/auth/QQAuth;->a:Lcom/tencent/connect/auth/AuthAgent;

    invoke-virtual {v0, p1, p2, p3}, Lcom/tencent/connect/auth/AuthAgent;->doLogin(Landroid/app/Activity;Ljava/lang/String;Lcom/tencent/tauth/IUiListener;)I

    move-result v0

    return v0
.end method

.method public logout(Landroid/content/Context;)V
    .locals 3

    const/4 v2, 0x0

    const-string v0, "openSDK_LOG"

    const-string v1, "logout() --start"

    invoke-static {v0, v1}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;)V

    invoke-static {p1}, Landroid/webkit/CookieSyncManager;->createInstance(Landroid/content/Context;)Landroid/webkit/CookieSyncManager;

    invoke-virtual {p0, v2, v2}, Lcom/tencent/connect/auth/QQAuth;->setAccessToken(Ljava/lang/String;Ljava/lang/String;)V

    invoke-virtual {p0, p1, v2}, Lcom/tencent/connect/auth/QQAuth;->setOpenId(Landroid/content/Context;Ljava/lang/String;)V

    const-string v0, "openSDK_LOG"

    const-string v1, "logout() --end"

    invoke-static {v0, v1}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method

.method public onActivityResult(IILandroid/content/Intent;)Z
    .locals 3

    const-string v0, "openSDK_LOG"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "onActivityResult() ,resultCode = "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ""

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/tencent/a/a/c;->c(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v0, p0, Lcom/tencent/connect/auth/QQAuth;->a:Lcom/tencent/connect/auth/AuthAgent;

    invoke-virtual {v0, p1, p2, p3}, Lcom/tencent/connect/auth/AuthAgent;->onActivityResult(IILandroid/content/Intent;)V

    const/4 v0, 0x1

    return v0
.end method

.method public reAuth(Landroid/app/Activity;Ljava/lang/String;Lcom/tencent/tauth/IUiListener;)I
    .locals 6

    const/4 v4, 0x1

    const-string v0, "openSDK_LOG"

    const-string v1, "reAuth()"

    invoke-static {v0, v1}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v0, p0, Lcom/tencent/connect/auth/QQAuth;->a:Lcom/tencent/connect/auth/AuthAgent;

    move-object v1, p1

    move-object v2, p2

    move-object v3, p3

    move v5, v4

    invoke-virtual/range {v0 .. v5}, Lcom/tencent/connect/auth/AuthAgent;->doLogin(Landroid/app/Activity;Ljava/lang/String;Lcom/tencent/tauth/IUiListener;ZZ)I

    move-result v0

    return v0
.end method

.method public setAccessToken(Ljava/lang/String;Ljava/lang/String;)V
    .locals 3

    const-string v0, "openSDK_LOG"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "setAccessToken(), validTimeInSecond = "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ""

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v0, p0, Lcom/tencent/connect/auth/QQAuth;->b:Lcom/tencent/connect/auth/QQToken;

    invoke-virtual {v0, p1, p2}, Lcom/tencent/connect/auth/QQToken;->setAccessToken(Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method

.method public setOpenId(Landroid/content/Context;Ljava/lang/String;)V
    .locals 2

    const-string v0, "openSDK_LOG"

    const-string v1, "setOpenId() --start"

    invoke-static {v0, v1}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v0, p0, Lcom/tencent/connect/auth/QQAuth;->b:Lcom/tencent/connect/auth/QQToken;

    invoke-virtual {v0, p2}, Lcom/tencent/connect/auth/QQToken;->setOpenId(Ljava/lang/String;)V

    iget-object v0, p0, Lcom/tencent/connect/auth/QQAuth;->b:Lcom/tencent/connect/auth/QQToken;

    invoke-static {p1, v0}, Lcom/tencent/connect/a/a;->d(Landroid/content/Context;Lcom/tencent/connect/auth/QQToken;)V

    const-string v0, "openSDK_LOG"

    const-string v1, "setOpenId() --end"

    invoke-static {v0, v1}, Lcom/tencent/a/a/c;->a(Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method


text:
package kieker.examples.monitoring.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Scope("singleton")
public class CRM {

	@Autowired
	private Catalog catalog;

	public void getOffers() {
		this.catalog.getBook(false);
	}

}