text:
package tyrfing.games.id3.lib.prayers;

import tyrfing.games.id3.lib.Settings;
import tyrfing.games.id3.lib.mechanics.State;
import tyrfing.games.id3.lib.rooms.RoomFactoryConfig;

public class Quake extends Prayer {

	private static String NAME = "Quake";
	private static String DESC = "A dead end.\nOnce more our path upwards\nhas been blocked.\n\nI pray to you god,\nif you have yet not\nabandoned us.\n\n...Help us.";
	private static int REWARD_PER_LEVEL = 500;
	private static int BASE_REWARD = 800;
	private int level;

	public Quake(int level, int pos, State state,PrayerPower power) {
		super(pos, state, power);
		this.level = level;
		super.build();
	}

	@Override
	public String getName() {
		return NAME;
	}

	@Override
	protected String getDesc() {
		return DESC;
	}

	@Override
	protected Settings setupDungeon() {
		Settings settings = new Settings();

		settings.roomFactoryConfig = new RoomFactoryConfig();
		settings.fallSpeed = 20;
		settings.speedUp = 20;
		settings.roomFactoryConfig.STAIRS_DOWN_MIN_ROOMS = 32;
		settings.roomFactoryConfig.createDefaultShapes();
		settings.roomFactoryConfig.PROB_GREEN_DOOR = 1;
		settings.roomFactoryConfig.MIN_DOORS = 3;
		settings.roomFactoryConfig.MAX_DOORS = 6;
		settings.roomFactoryConfig.allowGreenDoors = true;

		return settings;
	}

	@Override
	public int getReward() {
		return level * REWARD_PER_LEVEL + BASE_REWARD;
	}

	@Override
	public int getLevel() {
		return level;
	}

	protected PrayerType getType()
	{
		return PrayerType.QUAKE;
	}

}

redpajama_set_name: RedPajamaGithub


text:
package io.apiman.manager.api.rest.contract;

import io.apiman.manager.api.beans.audit.AuditEntryBean;
import io.apiman.manager.api.beans.idm.UpdateUserBean;
import io.apiman.manager.api.beans.idm.UserBean;
import io.apiman.manager.api.beans.search.SearchCriteriaBean;
import io.apiman.manager.api.beans.search.SearchResultsBean;
import io.apiman.manager.api.beans.summary.ApiSummaryBean;
import io.apiman.manager.api.beans.summary.ClientSummaryBean;
import io.apiman.manager.api.beans.summary.OrganizationSummaryBean;
import io.apiman.manager.api.rest.contract.exceptions.InvalidSearchCriteriaException;
import io.apiman.manager.api.rest.contract.exceptions.NotAuthorizedException;
import io.apiman.manager.api.rest.contract.exceptions.UserNotFoundException;
import io.swagger.annotations.Api;

import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

/**
 * The User API.
 *
 * @author eric.wittmann@redhat.com
 */
@Path("users")
@Api
public interface IUserResource {

    /**
     * Use this endpoint to get information about a specific user by the User ID.
     * @summary Get User by ID
     * @param userId The user ID.
     * @statuscode 200 If the user exists and information is returned.
     * @return Full user information.
     * @throws UserNotFoundException when specified user not found
     */
    @GET
    @Path("{userId}")
    @Produces(MediaType.APPLICATION_JSON)
    public UserBean get(@PathParam("userId") String userId) throws UserNotFoundException;

    /**
     * Use this endpoint to update the information about a user.  This will fail
     * unless the authenticated user is an admin or identical to the user being
     * updated.
     * @summary Update a User by ID
     * @param userId The user ID.
     * @param user Updated user information.
     * @statuscode 204 If the user information is successfully updated.
     * @throws UserNotFoundException when specified user not found
     * @throws NotAuthorizedException when not authorized to invoke this method
     */
    @PUT
    @Path("{userId}")
    @Consumes(MediaType.APPLICATION_JSON)
    public void update(@PathParam("userId") String userId, UpdateUserBean user) throws UserNotFoundException, NotAuthorizedException;

    /**
     * Use this endpoint to search for users.  The search criteria is
     * provided in the body of the request, including filters, order-by, and paging
     * information.
     * @summary Search for Users
     * @param criteria The search criteria.
     * @statuscode 200 If the search is successful.
     * @return The search results (a page of organizations).
     * @throws InvalidSearchCriteriaException when provided criteria are invalid
     */
    @POST
    @Path("search")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public SearchResultsBean<UserBean> search(SearchCriteriaBean criteria) throws InvalidSearchCriteriaException;

    /**
     * This endpoint returns the list of organizations that the user is a member of.  The
     * user is a member of an organization if she has at least one role for the org.
     * @summary List User Organizations
     * @param userId The user ID.
     * @statuscode 200 If the organization list is successfully returned.
     * @return List of organizations.
     */
    @GET
    @Path("{userId}/organizations")
    @Produces(MediaType.APPLICATION_JSON)
    public List<OrganizationSummaryBean> getOrganizations(@PathParam("userId") String userId);

    /**
     * This endpoint returns all clients that the user has permission to edit.
     * @summary List User Clients
     * @param userId The user ID.
     * @statuscode 200 If the client list is successfully returned.
     * @return List of clients.
     */
    @GET
    @Path("{userId}/clients")
    @Produces(MediaType.APPLICATION_JSON)
    public List<ClientSummaryBean> getClients(@PathParam("userId") String userId);

    /**
     * This endpoint returns all APIs that the user has permission to edit.
     * @summary List User APIs
     * @param userId The user ID.
     * @statuscode 200 If the API list is successfully returned.
     * @return List of APIs.
     */
    @GET
    @Path("{userId}/apis")
    @Produces(MediaType.APPLICATION_JSON)
    public List<ApiSummaryBean> getApis(@PathParam("userId") String userId);

    /**
     * Use this endpoint to get information about the user's audit history.  This
     * returns audit entries corresponding to each of the actions taken by the
     * user.  For example, when a user creates a new Organization, an audit entry
     * is recorded and would be included in the result of this endpoint.
     * @summary Get User Activity
     * @param userId The user ID.
     * @param page The page of the results to return.
     * @param pageSize The number of results per page to return.
     * @statuscode 200 If the activity is successfully returned.
     * @return List of audit entries.
     */
    @GET
    @Path("{userId}/activity")
    @Produces(MediaType.APPLICATION_JSON)
    public SearchResultsBean<AuditEntryBean> getActivity(@PathParam("userId") String userId,
            @QueryParam("page") int page, @QueryParam("count") int pageSize);

}


text:
Presentation in Bulgarian for a 30 minute lecture about the x86 CPU pipeline

Created for Rogue Conf 2014


text:
package org.ehcache.exceptions;

import java.lang.Exception;

/**
 * Exception that can occur from operations on {@link org.ehcache.PersistentCacheManager}.
 *
 * @see org.ehcache.PersistentCacheManager#destroyCache(String)
 */
public class CachePersistenceException extends Exception {

  /**
   * Creates an exception with the provided message.
   *
   * @param message information about the exception
   */
  public CachePersistenceException(String message) {
    super(message);
  }

  /**
   * Creates an exception with the provided message and cause.
   *
   * @param message information about the exception
   * @param cause the cause of this exception
   */
  public CachePersistenceException(String message, Throwable cause) {
    super(message, cause);
  }
}


text:
@interface SyntaxPairItem : NSObject <SyntaxItemProtocol>
@property NSString* begin;
@property NSString* end;
@property NSDictionary* beginCaptures;
@property NSDictionary* endCaptures;
@property NSString* contentName;
@property id<SyntaxPatternsDelegate> patterns;

- (id)initWithBegin:(NSString*)begin
                End:(NSString*)end
               Name:(NSString*)name
                CPS:(NSArray*)cps
      BeginCaptures:(NSDictionary*)beginCaptures
        EndCaptures:(NSDictionary*)endCaptures
        ContentName:(NSString*)contentName
      EmbedPatterns:(id<SyntaxPatternsDelegate>)patterns;

@end


text:
MDAdditions
===========

MDAdditions contains various Objective-C improvements that can in some cases make my life easier.

## Usage

You can browse the header files to see the available methods. Each method should be fully documented, so figuring out how something works is easy.

## Installation

Simply add the files to your project; make sure that they are also added to the target.

## License

MDAdditions is released under the MIT License. See the bundled LICENSE file for details.


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Elasticsearch.Net;

namespace Nest
{
	using TemplateExistConverter = Func<IElasticsearchResponse, Stream, ExistsResponse>;

	public partial class ElasticClient
	{
		/// <inheritdoc />
		public IExistsResponse TemplateExists(Func<TemplateExistsDescriptor, TemplateExistsDescriptor> selector)
		{
			return this.Dispatcher.Dispatch<TemplateExistsDescriptor, TemplateExistsRequestParameters, ExistsResponse>(
				selector,
				(p, d) => this.RawDispatch.IndicesExistsTemplateDispatch<ExistsResponse>(
					p.DeserializationState(new TemplateExistConverter(DeserializeExistsResponse))
				)
			);
		}

		/// <inheritdoc />
		public IExistsResponse TemplateExists(ITemplateExistsRequest templateRequest)
		{
			return this.Dispatcher.Dispatch<ITemplateExistsRequest, TemplateExistsRequestParameters, ExistsResponse>(
				templateRequest,
				(p, d) => this.RawDispatch.IndicesExistsTemplateDispatch<ExistsResponse>(
					p.DeserializationState(new TemplateExistConverter(DeserializeExistsResponse))
				)
			);
		}

		/// <inheritdoc />
		public Task<IExistsResponse> TemplateExistsAsync(Func<TemplateExistsDescriptor, TemplateExistsDescriptor> selector)
		{
			return this.Dispatcher.DispatchAsync<TemplateExistsDescriptor, TemplateExistsRequestParameters, ExistsResponse, IExistsResponse>(
				selector,
				(p, d) => this.RawDispatch.IndicesExistsTemplateDispatchAsync<ExistsResponse>(
					p.DeserializationState(new TemplateExistConverter(DeserializeExistsResponse))
				)
			);
		}

		/// <inheritdoc />
		public Task<IExistsResponse> TemplateExistsAsync(ITemplateExistsRequest templateRequest)
		{
			return this.Dispatcher.DispatchAsync<ITemplateExistsRequest, TemplateExistsRequestParameters, ExistsResponse, IExistsResponse>(
				templateRequest,
				(p, d) => this.RawDispatch.IndicesExistsTemplateDispatchAsync<ExistsResponse>(
					p.DeserializationState(new TemplateExistConverter(DeserializeExistsResponse))
				)
			);
		}

	}
}


text:
package org.drools.workbench.screens.testscenario.client.utils;

import com.google.gwt.user.client.ui.FlexTable;
import org.drools.workbench.models.testscenarios.shared.ExecutionTrace;
import org.drools.workbench.models.testscenarios.shared.Scenario;

public class ScenarioUtils {

    public static final String BOTTOM_RIGHT_PADDING = "padding-right: 10px; padding-bottom: 10px";

    public static ExecutionTrace findExecutionTrace(final Scenario scenario) {
        return scenario.getFixtures().stream()
                .filter(f -> f instanceof ExecutionTrace)
                .map(f -> (ExecutionTrace) f)
                .findFirst().orElse(new ExecutionTrace());
    }

    public static void addBottomAndRightPaddingToTableCells(final FlexTable table) {
        for (int rowIndex = 0; rowIndex < table.getRowCount(); rowIndex++) {
            for (int cellIndex = 0; cellIndex < table.getCellCount(rowIndex); cellIndex++) {
                table.getCellFormatter().getElement(rowIndex, cellIndex).setAttribute("style", BOTTOM_RIGHT_PADDING);
            }
        }
    }
}


text:
import datetime
import unittest
from typing import List

from irctk.message import Message, MessageTag
from irctk.nick import Nick
from tests.mock_client import MockClient as Client

class ClientTests(unittest.TestCase):
    def setUp(self) -> None:
        self.client = Client('kylef', 'kyle', 'Kyle Fuller')
        self.client.nick.nick = 'kylef'
        self.client.delegate = self

        self.private_messages: List = []
        self.channel_messages: List = []

    # Delegate

    def irc_private_message(self, client, nick, message):
        self.private_messages.append((client, nick, message))

    def irc_channel_message(self, client, nick, channel, message):
        self.channel_messages.append((client, nick, channel, message))

    def test_set_delegate(self) -> None:
        self.client.delegate = self
        self.assertEqual(self.client.delegate, self)

    # Tests

    def test_client_has_nickname(self) -> None:
        self.assertEqual(self.client.nickname, 'kylef')

    def test_client_has_ident(self) -> None:
        self.assertEqual(self.client.ident, 'kyle')

    def test_client_has_realname(self) -> None:
        self.assertEqual(self.client.realname, 'Kyle Fuller')

    # Registration

    def test_client_is_not_registered_by_default(self) -> None:
        self.assertFalse(self.client.is_registered)

    def test_client_is_registered_after_001(self) -> None:
        self.client.process_line(':irc.kylefuller.co.uk 001 kyle :Welcome')
        self.assertTrue(self.client.is_registered)

    def test_client_takes_nick_from_001(self) -> None:
        self.client.process_line(':irc.kylefuller.co.uk 001 kyle5 :Welcome')
        self.assertEqual(self.client.nick.nick, 'kyle5')

    def test_client_ignores_message_tags(self) -> None:
        self.client.process_line(
            '@time=bar;foo=x :irc.kylefuller.co.uk 001 kyle :Welcome'
        )
        self.assertTrue(self.client.is_registered)

    # Ping

    def test_client_sends_pong_when_pinged(self) -> None:
        self.client.process_line('PING :hello')
        self.assertEqual(self.client.sent_lines, ['PONG hello'])

    # Nick Change

    def test_clients_handles_nick_change(self) -> None:
        self.client.process_line(':irc.example.com 001 kyle :Welcome')
        self.client.process_line(':kyle!kyle@cocode.org NICK kyle2')
        self.assertEqual(self.client.nick.nick, 'kyle2')

    def test_clients_handles_nick_change_case_insensitive(self) -> None:
        self.client.process_line(':irc.example.com 001 kyle :Welcome')
        self.client.process_line(':KYLE!kyle@cocode.org NICK kyle2')
        self.assertEqual(self.client.nick.nick, 'kyle2')

    # Handling

    def test_client_handles_5_parsing_support(self) -> None:
        self.client.process_line(
            ':irc.kylefuller.co.uk 005 kyle :NICKLEN=5 CHANNELLEN=6'
        )
        self.assertEqual(self.client.isupport.maximum_nick_length, 5)
        self.assertEqual(self.client.isupport.maximum_channel_length, 6)

    def test_client_handles_joining_channel(self) -> None:
        self.client.process_line(':kylef!kyle@kyle JOIN #test')

        channel = self.client.channels[0]
        self.assertEqual(channel.name, '#test')
        self.assertEqual(channel.members[0].nick.nick, self.client.nick.nick)
        self.assertTrue(channel.is_attached)

    def test_client_handles_parting_channel(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':kylef!kyle@kyle JOIN #test')
        self.client.process_line(':kylef!kyle@kyle PART #test :goodbye')
        self.assertEqual(channel.members, [])
        self.assertFalse(channel.is_attached)

    def test_client_handles_parting_channel_without_reason(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':kylef!kyle@kyle JOIN #test')
        self.client.process_line(':kylef!kyle@kyle PART #test')
        self.assertEqual(channel.members, [])

    def test_client_handles_quit_removing_from_channel(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':kylef!kyle@kyle JOIN #test')

        self.client.process_line(':doe!kyle@kyle JOIN #test')
        self.assertEqual(len(channel.members), 2)

        self.client.process_line(':doe!kyle@kyle QUIT :goodbye')
        self.assertEqual(len(channel.members), 1)

    def test_client_handles_getting_kicked_from_channel(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':kylef!kyle@kyle JOIN #test')
        self.client.process_line(':kylef!kyle@kyle KICK #test kylef :goodbye')
        self.assertEqual(channel.members, [])

    def test_client_handles_channel_new_mode(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':kyle!kyle@kyle MODE #test +tn')
        self.assertTrue(channel.modes['t'])
        self.assertTrue(channel.modes['n'])

    def test_client_handles_channel_remove_mode(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':kyle!kyle@kyle MODE #test +tn')
        self.client.process_line(':kyle!kyle@kyle MODE #test -tn')
        self.assertEqual(channel.modes, {})

    def test_client_handles_setting_channel_list_mode(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':kyle!kyle@kyle MODE #test +b cake')
        self.client.process_line(':kyle!kyle@kyle MODE #test +b snake')
        self.assertEqual(channel.modes['b'], ['cake', 'snake'])

    def test_client_handles_removing_channel_list_mode(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':kyle!kyle@kyle MODE #test +b cake')
        self.client.process_line(':kyle!kyle@kyle MODE #test +b snake')
        self.client.process_line(':kyle!kyle@kyle MODE #test -b cake')
        self.assertEqual(channel.modes['b'], ['snake'])

    def test_client_handles_removing_channel_list_mode2(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':kyle!kyle@kyle MODE #test +l 5')
        self.client.process_line(':kyle!kyle@kyle MODE #test +l 6')
        self.assertEqual(channel.modes['l'], '6')

    def test_client_handles_324_mode(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':server 324 kylef #test +nt')
        self.assertEqual(channel.modes, {'n': True, 't': True})

    def test_client_handles_329_creation_date(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':server 329 kylef #test 1358579621')
        self.assertEqual(
            channel.creation_date, datetime.datetime(2013, 1, 19, 7, 13, 41)
        )

    def test_client_handles_332_topic(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':server 332 kylef #test :My Awesome Topic')
        self.assertEqual(channel.topic, 'My Awesome Topic')

    def test_client_handles_333_topic(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':server 333 kylef #test james!james@james 1395663680')
        self.assertEqual(channel.topic_owner, 'james!james@james')
        self.assertEqual(channel.topic_date, datetime.datetime(2014, 3, 24, 12, 21, 20))

    def test_client_handles_352(self) -> None:
        self.client.process_line(
            ':server 352 kylef * ~doe example.com irc-eu-1.darkscience.net kylef Hs :0 irctk'
        )
        self.assertEqual(self.client.nick.ident, '~doe')
        self.assertEqual(self.client.nick.host, 'example.com')

    def test_client_handles_353_names(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(
            ':server 353 kylef = #test :Derecho!der@der +Tempest!tmp@tmp dijit +other'
        )
        self.assertEqual(len(channel.members), 4)
        self.assertEqual(channel.members[0].nick, Nick.parse('Derecho!der@der'))
        self.assertEqual(channel.members[1].nick, Nick.parse('Tempest!tmp@tmp'))
        self.assertEqual(channel.members[2].nick, Nick(nick='dijit'))
        self.assertEqual(channel.members[3].nick, Nick(nick='other'))
        self.assertTrue(channel.members[1].has_mode('v'))
        self.assertTrue(channel.members[3].has_mode('v'))

    def test_client_updates_to_channel_topic(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':kyle!kyle@kyle TOPIC #test :Hello World')
        self.assertEqual(channel.topic, 'Hello World')

        assert isinstance(channel.topic_owner, Nick)
        self.assertEqual(channel.topic_owner.nick, 'kyle')

    def test_client_updates_channel_membership_during_nick_change(self) -> None:
        channel = self.client.add_channel('#test')
        self.client.process_line(':kyle!kyle@kyle JOIN #test')
        self.client.process_line(':kyle!kyle@kyle NICK kyle2')

        self.assertEqual(channel.members[0].nick.nick, 'kyle2')

    def test_client_updates_channel_membership_during_nick_change_case_insensitive(
        self,
    ):
        channel = self.client.add_channel('#test')
        self.client.process_line(':kyle!kyle@kyle JOIN #test')
        self.client.process_line(':KYLE!kyle@kyle NICK kyle2')

        self.assertEqual(channel.members[0].nick.nick, 'kyle2')

    # Capabilities

    def test_client_asks_for_server_capabilities_on_connection(self) -> None:
        self.client.authenticate()
        self.assertEqual(self.client.sent_lines[0], 'CAP LS')

    def test_client_ends_capabilities_negotiation_after_no_caps(self) -> None:
        self.client.authenticate()
        self.client.sent_lines = []  # reset, we dont care about auth stuff
        self.client.process_line(':barjavel.freenode.net CAP * LS :unknown-capability')
        self.assertEqual(self.client.sent_lines, ['CAP END'])

    def test_client_requests_multi_prefix_capability(self) -> None:
        self.client.authenticate()
        self.client.sent_lines = []  # reset, we dont care about auth stuff
        self.client.process_line(':barjavel.freenode.net CAP * LS :multi-prefix')
        self.assertEqual(self.client.sent_lines, ['CAP REQ multi-prefix'])
        self.client.sent_lines = []
        self.client.process_line(':barjavel.freenode.net CAP * ACK :multi-prefix')
        self.assertEqual(self.client.sent_lines, ['CAP END'])
        self.assertEqual(self.client.cap_accepted, ['multi-prefix'])

    def test_client_requests_multi_prefix_capability_and_handles_rejection(
        self,
    ) -> None:
        self.client.authenticate()
        self.client.sent_lines = []  # reset, we dont care about auth stuff
        self.client.process_line(':barjavel.freenode.net CAP * LS :multi-prefix')
        self.assertEqual(self.client.sent_lines, ['CAP REQ multi-prefix'])
        self.client.sent_lines = []
        self.client.process_line(':barjavel.freenode.net CAP * NAK :multi-prefix')
        self.assertEqual(self.client.sent_lines, ['CAP END'])
        self.assertEqual(self.client.cap_accepted, [])

    # Perform

    def test_client_perform_on_connect(self) -> None:
        self.client.authenticate()

        self.assertEqual(
            self.client.sent_lines,
            ['CAP LS', 'NICK kylef', 'USER kyle 0 * :Kyle Fuller'],
        )

    def test_client_perform_on_connect_with_password(self) -> None:
        self.client.password = 'sekret'
        self.client.authenticate()

        self.assertEqual(
            self.client.sent_lines,
            ['CAP LS', 'PASS sekret', 'NICK kylef', 'USER kyle 0 * :Kyle Fuller'],
        )

    # Delegate

    def test_client_forwards_private_messages_to_delegate(self) -> None:
        self.client.process_line(':bob!b@irc.kylefuller.co.uk PRIVMSG kylef :Hey')
        self.assertEqual(
            self.private_messages,
            [(self.client, Nick.parse('bob!b@irc.kylefuller.co.uk'), 'Hey')],
        )

    def test_client_forwards_channel_messages_to_delegate(self) -> None:
        self.client.process_line(':kylef!b@irc.kylefuller.co.uk JOIN #example')
        self.client.process_line(':bob!b@irc.kylefuller.co.uk PRIVMSG #example :Hey')

        self.assertEqual(len(self.channel_messages), 1)
        self.assertEqual(self.channel_messages[0][1].nick, 'bob')
        self.assertEqual(self.channel_messages[0][2].name, '#example')
        self.assertEqual(self.channel_messages[0][3], 'Hey')

    # Sending

    def test_client_send_message(self) -> None:
        message = Message(command='PRIVMSG', parameters=['kyle', 'Hello World'])
        self.client.send(message)

        self.assertEqual(self.client.sent_lines, ['PRIVMSG kyle :Hello World'])

    def test_client_send_message_bad_args(self) -> None:
        message = Message(command='PRIVMSG', parameters=['kyle', 'Hello World'])

        with self.assertRaises(TypeError):
            self.client.send(message, 'x')

    def test_client_send_privmsg(self) -> None:
        self.client.send_privmsg('kyle', 'Hello')
        self.assertEqual(self.client.sent_lines, ['PRIVMSG kyle :Hello'])

    def test_client_send_join(self) -> None:
        self.client.send_join('#palaver')
        self.assertEqual(self.client.sent_lines, ['JOIN #palaver'])

    def test_client_send_join_with_key(self) -> None:
        self.client.send_join('#palaver', 'secret')
        self.assertEqual(self.client.sent_lines, ['JOIN #palaver secret'])

    def test_client_send_part(self) -> None:
        self.client.send_part('#palaver')
        self.assertEqual(self.client.sent_lines, ['PART #palaver'])

    def test_client_send_label_message(self) -> None:
        message = Message(command='PING', parameters=['localhost'])
        message.tags.append(MessageTag(name='label', value='xx'))
        future = self.client.send(message)
        self.assertFalse(future.done())

        self.assertEqual(self.client.sent_lines, ['@label=xx PING localhost'])

        self.client.process_line('@label=xx PONG localhost')
        self.assertTrue(future.done())
        self.assertEqual(str(future.result()), '@label=xx PONG localhost')

    def test_client_send_label_message_ack(self) -> None:
        message = Message(command='PONG', parameters=['localhost'])
        message.tags.append(MessageTag(name='label', value='xx'))
        future = self.client.send(message)
        self.assertFalse(future.done())

        self.assertEqual(self.client.sent_lines, ['@label=xx PONG localhost'])

        self.client.process_line('@label=xx :irc.example.com ACK')
        self.assertTrue(future.done())
        self.assertEqual(str(future.result()), '@label=xx :irc.example.com ACK')

    def test_client_send_label_message_batch(self) -> None:
        message = Message(command='WHOIS', parameters=['kyle'])
        message.tags.append(MessageTag(name='label', value='mGhe5V7RTV'))
        future = self.client.send(message)

        self.assertEqual(self.client.sent_lines, ['@label=mGhe5V7RTV WHOIS kyle'])

        self.client.process_line(
            '@label=mGhe5V7RTV :irc.example.com BATCH +NMzYSq45x labeled-response'
        )
        self.client.process_line(
            '@batch=NMzYSq45x :irc.example.com 311 client nick ~ident host * :Name'
        )
        self.client.process_line(
            '@batch=NMzYSq45x :irc.example.com 318 client nick :End of /WHOIS list.'
        )
        self.assertFalse(future.done())

        self.client.process_line(':irc.example.com BATCH -NMzYSq45x')
        self.assertTrue(future.done())
        self.assertEqual(
            [str(m) for m in future.result()],
            [
                '@label=mGhe5V7RTV :irc.example.com BATCH +NMzYSq45x labeled-response',
                '@batch=NMzYSq45x :irc.example.com 311 client nick ~ident host * Name',
                '@batch=NMzYSq45x :irc.example.com 318 client nick :End of /WHOIS list.',
                ':irc.example.com BATCH -NMzYSq45x',
            ],
        )

    def test_client_send_nick(self) -> None:
        message = Message(command='NICK', parameters=['newnick'])
        future = self.client.send(message)

        self.assertFalse(future.done())
        self.assertEqual(self.client.sent_lines, ['NICK newnick'])

        self.client.process_line(':kylef NICK newnick')
        self.assertTrue(future.done())
        self.assertEqual(str(future.result()), ':kylef NICK newnick')

    def test_client_send_nick_no_nickname_given(self) -> None:
        message = Message(command='NICK', parameters=[])
        future = self.client.send(message)

        self.assertFalse(future.done())
        self.assertEqual(self.client.sent_lines, ['NICK'])

        self.client.process_line(':example.com 431 kylef :No nickname given')
        self.assertTrue(future.done())

    def test_client_send_nick_erroneus_nickname(self) -> None:
        message = Message(command='NICK', parameters=['doe'])
        future = self.client.send(message)

        self.assertFalse(future.done())
        self.assertEqual(self.client.sent_lines, ['NICK doe'])

        self.client.process_line(':example.com 432 kylef doe :Erroneus nickname')
        self.assertTrue(future.done())

    def test_client_send_nick_nickname_in_use(self) -> None:
        message = Message(command='NICK', parameters=['doe'])
        future = self.client.send(message)

        self.assertFalse(future.done())
        self.assertEqual(self.client.sent_lines, ['NICK doe'])

        self.client.process_line(
            ':example.com 433 kylef doe :Nickname is already in use'
        )
        self.assertTrue(future.done())

    def test_client_send_nick_nick_collision(self) -> None:
        message = Message(command='NICK', parameters=['doe'])
        future = self.client.send(message)

        self.assertFalse(future.done())
        self.assertEqual(self.client.sent_lines, ['NICK doe'])

        self.client.process_line(':example.com 436 kylef doe :Nickname collision KILL')
        self.assertTrue(future.done())

    def test_client_send_nick_complete_registration(self) -> None:
        message = Message(command='NICK', parameters=['doe'])
        future = self.client.send(message)

        self.assertFalse(future.done())
        self.assertEqual(self.client.sent_lines, ['NICK doe'])

        self.client.process_line(':irc.example.com 001 doe :Welcome')
        self.assertTrue(future.done())


text:
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Collections.Generic;
using Unity.Profiling;
using UnityEngine;
using UnityEngine.EventSystems;

namespace Microsoft.MixedReality.Toolkit.SpatialAwareness
{
    /// <summary>
    /// Class providing a base implementation of the <see cref="IMixedRealitySpatialAwarenessMeshObserver"/> interface.
    /// </summary>
    public abstract class BaseSpatialMeshObserver : BaseSpatialObserver, IMixedRealitySpatialAwarenessMeshObserver, ISpatialAwarenessPhysicsProperties
    {
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="spatialAwarenessSystem">The <see cref="SpatialAwareness.IMixedRealitySpatialAwarenessSystem"/> to which the observer is providing data.</param>
        /// <param name="name">The friendly name of the data provider.</param>
        /// <param name="priority">The registration priority of the data provider.</param>
        /// <param name="profile">The configuration profile for the data provider.</param>
        protected BaseSpatialMeshObserver(
            IMixedRealitySpatialAwarenessSystem spatialAwarenessSystem,
            string name = null,
            uint priority = DefaultPriority,
            BaseMixedRealityProfile profile = null) : base(spatialAwarenessSystem, name, priority, profile)
        {
        }

        #region BaseSpatialMeshObserver Implementation

        protected MixedRealitySpatialAwarenessEventData<SpatialAwarenessMeshObject> meshEventData = null;

        private GameObject observedObjectParent = null;

        /// <summary>
        /// The parent GameObject for all observed meshes to be placed under.
        /// </summary>
        protected virtual GameObject ObservedObjectParent => observedObjectParent != null ? observedObjectParent : (observedObjectParent = Service?.CreateSpatialAwarenessObservationParent(Name));

        protected virtual void ReadProfile()
        {
            if (ConfigurationProfile == null)
            {
                Debug.LogError($"{Name} requires a configuration profile to run properly.");
                return;
            }

            MixedRealitySpatialAwarenessMeshObserverProfile profile = ConfigurationProfile as MixedRealitySpatialAwarenessMeshObserverProfile;
            if (profile == null)
            {
                Debug.LogError($"{Name}'s configuration profile must be a MixedRealitySpatialAwarenessMeshObserverProfile.");
                return;
            }

            // IMixedRealitySpatialAwarenessObserver settings
            StartupBehavior = profile.StartupBehavior;
            IsStationaryObserver = profile.IsStationaryObserver;
            ObservationExtents = profile.ObservationExtents;
            ObserverVolumeType = profile.ObserverVolumeType;
            UpdateInterval = profile.UpdateInterval;

            // IMixedRealitySpatialAwarenessMeshObserver settings
            DisplayOption = profile.DisplayOption;
            TrianglesPerCubicMeter = profile.TrianglesPerCubicMeter; // Set this before LevelOfDetail so it doesn't overwrite in the non-Custom case
            LevelOfDetail = profile.LevelOfDetail;
            MeshPhysicsLayer = profile.MeshPhysicsLayer;
            OcclusionMaterial = profile.OcclusionMaterial;
            PhysicsMaterial = profile.PhysicsMaterial;
            RecalculateNormals = profile.RecalculateNormals;
            VisibleMaterial = profile.VisibleMaterial;

            RuntimeSpatialMeshPrefab = profile.RuntimeSpatialMeshPrefab;
        }

        private static readonly ProfilerMarker ApplyUpdatedMeshDisplayOptionPerfMarker = new ProfilerMarker("[MRTK] BaseSpatialMeshObserver.ApplyUpdatedMeshDisplayOption");

        /// <summary>
        /// Applies the mesh display option to existing meshes when modified at runtime.
        /// </summary>
        /// <param name="option">The <see cref="SpatialAwarenessMeshDisplayOptions"/> value to be used to determine the appropriate material.</param>
        protected virtual void ApplyUpdatedMeshDisplayOption(SpatialAwarenessMeshDisplayOptions option)
        {
            using (ApplyUpdatedMeshDisplayOptionPerfMarker.Auto())
            {
                bool enable = (option != SpatialAwarenessMeshDisplayOptions.None);

                foreach (SpatialAwarenessMeshObject meshObject in Meshes.Values)
                {
                    if (meshObject?.Renderer == null) { continue; }

                    if (enable)
                    {
                        meshObject.Renderer.sharedMaterial = (option == SpatialAwarenessMeshDisplayOptions.Visible) ?
                            VisibleMaterial :
                            OcclusionMaterial;
                    }

                    meshObject.Renderer.enabled = enable;
                }
            }
        }

        private static readonly ProfilerMarker ApplyUpdatedMeshPhysicsPerfMarker = new ProfilerMarker("[MRTK] BaseSpatialMeshObserver.ApplyUpdatedMeshPhysics");

        /// <summary>
        /// Applies the physical material to existing meshes when modified at runtime.
        /// </summary>
        protected virtual void ApplyUpdatedMeshPhysics()
        {
            using (ApplyUpdatedMeshPhysicsPerfMarker.Auto())
            {
                foreach (SpatialAwarenessMeshObject meshObject in Meshes.Values)
                {
                    if (meshObject?.Collider == null) { continue; }
                    meshObject.Collider.material = PhysicsMaterial;
                }
            }
        }

        /// <summary>
        /// Maps <see cref="SpatialAwarenessMeshLevelOfDetail"/> to <see cref="TrianglesPerCubicMeter"/>.
        /// </summary>
        /// <param name="levelOfDetail">The desired level of density for the spatial mesh.</param>
        /// <returns>
        /// The number of triangles per cubic meter that will result in the desired level of density.
        /// </returns>
        protected virtual int LookupTriangleDensity(SpatialAwarenessMeshLevelOfDetail levelOfDetail)
        {
            // By default, returns the existing value. This will be custom defined for each platform, if necessary.
            return TrianglesPerCubicMeter;
        }

        private static readonly ProfilerMarker ApplyUpdatedPhysicsLayerPerfMarker = new ProfilerMarker("[MRTK] BaseSpatialMeshObserver.ApplyUpdatedPhysicsLayer");

        /// <summary>
        /// Updates the mesh physics layer for current mesh observations.
        /// </summary>
        protected virtual void ApplyUpdatedPhysicsLayer()
        {
            using (ApplyUpdatedPhysicsLayerPerfMarker.Auto())
            {
                foreach (SpatialAwarenessMeshObject meshObject in Meshes.Values)
                {
                    if (meshObject?.GameObject == null) { continue; }

                    meshObject.GameObject.layer = MeshPhysicsLayer;
                }
            }
        }

        private static readonly ProfilerMarker OnMeshAddedPerfMarker = new ProfilerMarker("[MRTK] BaseSpatialMeshObserver.OnMeshAdded - Raising OnObservationAdded");

        /// <summary>
        /// Event sent whenever a mesh is added.
        /// </summary>
        protected static readonly ExecuteEvents.EventFunction<IMixedRealitySpatialAwarenessObservationHandler<SpatialAwarenessMeshObject>> OnMeshAdded =
            delegate (IMixedRealitySpatialAwarenessObservationHandler<SpatialAwarenessMeshObject> handler, BaseEventData eventData)
            {
                using (OnMeshAddedPerfMarker.Auto())
                {
                    MixedRealitySpatialAwarenessEventData<SpatialAwarenessMeshObject> spatialEventData = ExecuteEvents.ValidateEventData<MixedRealitySpatialAwarenessEventData<SpatialAwarenessMeshObject>>(eventData);
                    handler.OnObservationAdded(spatialEventData);
                }
            };

        private static readonly ProfilerMarker OnMeshUpdatedPerfMarker = new ProfilerMarker("[MRTK] BaseSpatialMeshObserver.OnMeshUpdated - Raising OnObservationUpdated");

        /// <summary>
        /// Event sent whenever a mesh is updated.
        /// </summary>
        protected static readonly ExecuteEvents.EventFunction<IMixedRealitySpatialAwarenessObservationHandler<SpatialAwarenessMeshObject>> OnMeshUpdated =
            delegate (IMixedRealitySpatialAwarenessObservationHandler<SpatialAwarenessMeshObject> handler, BaseEventData eventData)
            {
                using (OnMeshUpdatedPerfMarker.Auto())
                {
                    MixedRealitySpatialAwarenessEventData<SpatialAwarenessMeshObject> spatialEventData = ExecuteEvents.ValidateEventData<MixedRealitySpatialAwarenessEventData<SpatialAwarenessMeshObject>>(eventData);
                    handler.OnObservationUpdated(spatialEventData);
                }
            };

        private static readonly ProfilerMarker OnMeshRemovedPerfMarker = new ProfilerMarker("[MRTK] BaseSpatialMeshObserver.OnMeshRemoved - Raising OnObservationRemoved");

        /// <summary>
        /// Event sent whenever a mesh is discarded.
        /// </summary>
        protected static readonly ExecuteEvents.EventFunction<IMixedRealitySpatialAwarenessObservationHandler<SpatialAwarenessMeshObject>> OnMeshRemoved =
            delegate (IMixedRealitySpatialAwarenessObservationHandler<SpatialAwarenessMeshObject> handler, BaseEventData eventData)
            {
                using (OnMeshRemovedPerfMarker.Auto())
                {
                    MixedRealitySpatialAwarenessEventData<SpatialAwarenessMeshObject> spatialEventData = ExecuteEvents.ValidateEventData<MixedRealitySpatialAwarenessEventData<SpatialAwarenessMeshObject>>(eventData);
                    handler.OnObservationRemoved(spatialEventData);
                }
            };

        #endregion BaseSpatialMeshObserver Implementation

        #region IMixedRealityDataProvider Implementation

        /// <summary>
        /// Initializes event data and creates the observer.
        /// </summary>
        public override void Initialize()
        {
            meshEventData = new MixedRealitySpatialAwarenessEventData<SpatialAwarenessMeshObject>(EventSystem.current);

            ReadProfile();

            base.Initialize();
        }

        #endregion IMixedRealityDataProvider Implementation

        #region IMixedRealitySpatialMeshObserver Implementation

        private SpatialAwarenessMeshDisplayOptions displayOption = SpatialAwarenessMeshDisplayOptions.Visible;

        /// <inheritdoc />
        public SpatialAwarenessMeshDisplayOptions DisplayOption
        {
            get { return displayOption; }
            set
            {
                displayOption = value;
                if (Application.isPlaying)
                {
                    ApplyUpdatedMeshDisplayOption(displayOption);
                }
            }
        }

        private SpatialAwarenessMeshLevelOfDetail levelOfDetail = SpatialAwarenessMeshLevelOfDetail.Coarse;

        /// <inheritdoc />
        public SpatialAwarenessMeshLevelOfDetail LevelOfDetail
        {
            get { return levelOfDetail; }
            set
            {
                if (value != SpatialAwarenessMeshLevelOfDetail.Custom)
                {
                    TrianglesPerCubicMeter = LookupTriangleDensity(value);
                }

                levelOfDetail = value;
            }
        }

        /// <summary>
        /// The backing field for Meshes, to allow the mesh observer implementation to track its meshes.
        /// </summary>
        protected readonly Dictionary<int, SpatialAwarenessMeshObject> meshes = new Dictionary<int, SpatialAwarenessMeshObject>();

        /// <inheritdoc />
        public IReadOnlyDictionary<int, SpatialAwarenessMeshObject> Meshes => new Dictionary<int, SpatialAwarenessMeshObject>(meshes);

        private int meshPhysicsLayer = 31;

        /// <inheritdoc />
        public int MeshPhysicsLayer
        {
            get { return meshPhysicsLayer; }
            set
            {
                if ((value < 0) || (value > 31))
                {
                    Debug.LogError("Specified MeshPhysicsLayer is out of bounds. Please set a value between 0 and 31, inclusive.");
                    return;
                }

                meshPhysicsLayer = value;
                ApplyUpdatedPhysicsLayer();
            }
        }

        /// <inheritdoc />
        public int MeshPhysicsLayerMask => (1 << MeshPhysicsLayer);

        /// <inheritdoc />
        public bool RecalculateNormals { get; set; } = true;

        /// <inheritdoc />
        public int TrianglesPerCubicMeter { get; set; } = 0;

        private Material occlusionMaterial = null;

        /// <inheritdoc />
        public Material OcclusionMaterial
        {
            get { return occlusionMaterial; }
            set
            {
                if (value != occlusionMaterial)
                {
                    occlusionMaterial = value;

                    if (Application.isPlaying && DisplayOption == SpatialAwarenessMeshDisplayOptions.Occlusion)
                    {
                        ApplyUpdatedMeshDisplayOption(SpatialAwarenessMeshDisplayOptions.Occlusion);
                    }
                }
            }
        }

        private PhysicMaterial physicsMaterial;

        public PhysicMaterial PhysicsMaterial
        {
            get { return physicsMaterial; }
            set
            {
                if (value != physicsMaterial)
                {
                    physicsMaterial = value;
                    ApplyUpdatedMeshPhysics();
                }
            }
        }

        private Material visibleMaterial = null;

        /// <inheritdoc />
        public Material VisibleMaterial
        {
            get { return visibleMaterial; }
            set
            {
                if (value != visibleMaterial)
                {
                    visibleMaterial = value;

                    if (Application.isPlaying && DisplayOption == SpatialAwarenessMeshDisplayOptions.Visible)
                    {
                        ApplyUpdatedMeshDisplayOption(SpatialAwarenessMeshDisplayOptions.Visible);
                    }
                }
            }
        }

        private GameObject runtimeSpatialMeshPrefab = null;

        /// <inheritdoc />
        public GameObject RuntimeSpatialMeshPrefab
        {
            get { return runtimeSpatialMeshPrefab; }
            set
            {
                if (value != runtimeSpatialMeshPrefab)
                {
                    runtimeSpatialMeshPrefab = value;
                }
            }
        }

        #endregion IMixedRealitySpatialMeshObserver Implementation

        /// <summary>
        /// Instantiates and appends a prefab to the Runtime (on device and not in editor)
        /// Spatial Awareness hierarchy.
        ///
        /// The default structure of the Spatial Awareness System:
        ///
        /// Spatial Awareness System
        ///     Windows Mixed Reality Spatial Mesh Observer
        ///         Spatial Mesh - ID
        ///         Spatial Mesh - ID
        ///         ...
        ///
        /// If the Runtime Spatial Mesh Prefab field is not null, this method adds the prefab
        /// between the Spatial Awareness System and the Windows Mixed Reality Spatial Mesh Observer which results in this structure:
        ///
        /// Spatial Awareness System
        ///         Runtime Spatial Mesh Prefab
        ///             Windows Mixed Reality Spatial Mesh Observer
        ///                 Spatial Mesh - ID
        ///                 Spatial Mesh - ID
        ///                 ...
        /// </summary>
        protected void AddRuntimeSpatialMeshPrefabToHierarchy()
        {
            if (RuntimeSpatialMeshPrefab != null)
            {
                GameObject spatialMeshPrefab = Object.Instantiate(RuntimeSpatialMeshPrefab, Service.SpatialAwarenessObjectParent.transform);

                if (spatialMeshPrefab.transform.position != Vector3.zero)
                {
                    spatialMeshPrefab.transform.position = Vector3.zero;
                }

                ObservedObjectParent.transform.SetParent(spatialMeshPrefab.transform, false);
            }
        }
    }
}


text:
package org.wso2.carbon.identity.mgt.mail;

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.transport.base.BaseConstants;
import org.apache.axis2.transport.mail.MailConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.core.CarbonConfigurationContextFactory;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.HashMap;
import java.util.Map;

/**
 * Default email sending implementation
 */
public class DefaultEmailSendingModule extends AbstractEmailSendingModule {

    public static final String CONF_STRING = "confirmation";
    private static final String SEND_MAIL_PROPERTY = "mailto:";
    private static Log log = LogFactory.getLog(DefaultEmailSendingModule.class);
    private static final Log diagnosticLog = LogFactory.getLog("diagnostics");
    private BlockingQueue<Notification> notificationQueue = new LinkedBlockingDeque<Notification>();

    /**
     * Replace the {user-parameters} in the config file with the respective
     * values
     *
     * @param text           the initial text
     * @param userParameters mapping of the key and its value
     * @return the final text to be sent in the email
     */
    public static String replacePlaceHolders(String text, Map<String, String> userParameters) {
        if (userParameters != null) {
            for (Map.Entry<String, String> entry : userParameters.entrySet()) {
                String key = entry.getKey();
                if (key != null && entry.getValue() != null) {
                    text = text.replaceAll("\\{" + key + "\\}", entry.getValue());
                }
            }
        }
        return text;
    }

    @Override
    public void sendEmail() {

        Map<String, String> headerMap = new HashMap<String, String>();

        try {
            Notification notification = notificationQueue.take();
            if (notification == null) {
                throw new IllegalStateException("Notification not set. " +
                        "Please set the notification before sending messages");
            }
            PrivilegedCarbonContext.startTenantFlow();
            if (notificationData != null) {
                String tenantDomain = notificationData.getDomainName();
                PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
                carbonContext.setTenantDomain(tenantDomain, true);
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("notification data not found. Tenant might not be loaded correctly");
                }
            }

            headerMap.put(MailConstants.MAIL_HEADER_SUBJECT, notification.getSubject());

            OMElement payload = OMAbstractFactory.getOMFactory().createOMElement(
                    BaseConstants.DEFAULT_TEXT_WRAPPER, null);
            StringBuilder contents = new StringBuilder();
            contents.append(notification.getBody())
                    .append(System.getProperty("line.separator"))
                    .append(System.getProperty("line.separator"))
                    .append(notification.getFooter());
            payload.setText(contents.toString());
            ServiceClient serviceClient;
            ConfigurationContext configContext = CarbonConfigurationContextFactory
                    .getConfigurationContext();
            if (configContext != null) {
                serviceClient = new ServiceClient(configContext, null);
            } else {
                serviceClient = new ServiceClient();
            }
            Options options = new Options();
            options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
            options.setProperty(MessageContext.TRANSPORT_HEADERS, headerMap);
            options.setProperty(MailConstants.TRANSPORT_MAIL_FORMAT,
                    MailConstants.TRANSPORT_FORMAT_TEXT);
            options.setTo(new EndpointReference(SEND_MAIL_PROPERTY + notification.getSendTo()));
            serviceClient.setOptions(options);
            log.info("Sending an email notification to " + notification.getSendTo());
            diagnosticLog.info("Sending an email notification to " + notification.getSendTo());
            serviceClient.fireAndForget(payload);

            if (log.isDebugEnabled()) {
                log.debug("Email content : " + notification.getBody());
            }
            log.info("Email notification has been sent to " + notification.getSendTo());
            diagnosticLog.info("Email notification has been sent to " + notification.getSendTo());
        } catch (AxisFault axisFault) {
            diagnosticLog.error("Failed Sending Email. Error message: " + axisFault.getMessage());
            log.error("Failed Sending Email", axisFault);
        } catch (InterruptedException e) {
            diagnosticLog.error("Interrupted while waiting until an element becomes available in the notification " +
                    "queue. Error message: " + e.getMessage());
            log.error("Interrupted while waiting until an element becomes available in the notification queue.", e);
        } finally {
            PrivilegedCarbonContext.endTenantFlow();
        }

    }

    public String getRequestMessage(EmailConfig emailConfig) {

        StringBuilder msg;
        String targetEpr = emailConfig.getTargetEpr();
        if (emailConfig.getEmailBody().length() == 0) {
            msg = new StringBuilder(EmailConfig.DEFAULT_VALUE_MESSAGE);
            msg.append("\n");
            if (notificationData.getNotificationCode() != null) {

                msg.append(targetEpr).append("?").append(CONF_STRING).append(notificationData
                        .getNotificationCode()).append("\n");
            }
        } else {
            msg = new StringBuilder(emailConfig.getEmailBody());
            msg.append("\n");
        }
        if (emailConfig.getEmailFooter() != null) {
            msg.append("\n").append(emailConfig.getEmailFooter());
        }
        return msg.toString();
    }

    @Override
    public Notification getNotification() {
        return notificationQueue.peek();
    }

    @Override
    public void setNotification(Notification notification) {
        notificationQueue.add(notification);
    }

}


text:
<!DOCTYPE HTML>

  <meta charset="UTF-8">
  <title>Resolution App</title>
  <meta name="viewport" content="width=device-width, user-scalable=yes">
  <link rel="stylesheet" href="themes/mozilla/styles/style.css">

Achieve it!

Quote

Gut ist der Vorsatz, aber die Erfüllung schwer.

Johann Wolfgang von Goethe

Achieve it!

Sebastian Röhling, Lucas Groß-Hardt, Julia Rosenboom

{Mobile Applikationen, Prof. Dr. Dennis Pfisterer}

Die App-Idee

Die Applikation erinnert seinen Nutzer an Vorsätze.

Diese Vorsätze können standartmäßig aus voreingestellten Themen gewählt oder eigenhändig eingegeben werden.

Ein besonderer Vorsatz hängt auch mit Kontakten zusammen: Hier kann man sich daran erinnern lassen, mit einem Bekannten oder der Familie öfter in Kontakt zu treten.

Mittels Geo-Fences an bestimmten Orten oder per Konfiguration wird der Nutzer mittels Push-Benachrichtigungen erinnert.

        Notes here

Welchen Nutzen haben unsere User?

Regelmäßige Erinnerungen in Form von Push-Benachrichtigungen erinnen den Nutzer an seinen Vorsatz:

Anhand von Geo-Location-Daten (Erinnerung an Sport wenn man an einem Sportstudio vorbeiläuft)

Oder durch fest gesetzte Reminder (z.B. einmal in der Woche)

        Notes here

Welchen Nutzen haben unsere User?

Die Push-Benachrichtigungen sollen den User nicht dazu verleiten, in das bestimmte Fitnessstudio zu gehen, sondern ihn an seinen Vorsatz erinnern

Denn: Stetige Erinnerung an den Vorsatz steigert das schlechte Gewissen, den Vorsatz nicht einzuhalten.

        Notes here

Die verwendeten Technologien

Als Grundgerüst für unsere hybride App dient das Framework Ionic, das auf AngularJS basiert, in Verbindung mit Cordova:

Zugriff auf Kamera, Gallerie und Kontakte

Geofences

Deeplinks

IOS und Android-Kompatibilität

Die verwendeten Technologien

Google Firebase:

Datenhaltung

E-Mail Verification

Anmelde- und Registrierungsfunktion, Authentifizierung

Push-Notifications mit One-Signal

Die App

      <video controls class="middle shadow">
        <source src="pictures/My_Movie.webm" type="video/webm">
        <source src="pictures/MyMovie.mp4" type="video/mp4">
      </video>

Bildnachweise

Background Image

        Notes here

Lizenz

Diese Präsentation ist lizenziert unter einer Creative Commons Namensnennung 4.0 International Lizenz.

        Notes here


text:
Adds the ability to schedule content items to be published at a given future date and time. Attach the Publish Later Part to any content type where you want the feature to be available.

## Video

<iframe width="560" height="315" src="https://www.youtube.com/embed/E7UH8R14EUA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>


text:
<?php
/**
 * Created by PhpStorm.
 * User: Nicolas Canfrère
 * Date: 02/09/14
 * Time: 14:46
 */
  /*
           ____________________
  __      /     ______         \
 {  \ ___/___ /       }         \
  {  /       / #      }          |
   {/ ô ô  ;       __}           |
   /          \__}    /  \       /\
<=(_    __<==/  |    /\___\     |  \
   (_ _(    |   |   |  |   |   /    #
    (_ (_   |   |   |  |   |   |
      (__<  |mm_|mm_|  |mm_|mm_|
*/

namespace ZPB\AdminBundle\Controller\Animation;

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use ZPB\AdminBundle\Controller\BaseController;
use ZPB\AdminBundle\Entity\AnimationDay;
use ZPB\AdminBundle\Entity\AnimationSchedule;
use ZPB\AdminBundle\Form\Type\AnimationDayType;

class DayController extends BaseController
{
    public function listAction()
    {
        $animationDays = $this->getRepo('ZPBAdminBundle:AnimationDay')->findAll();
        $animations = $this->getRepo('ZPBAdminBundle:Animation')->findAllToArray();
        return $this->render('ZPBAdminBundle:Animation:day/list.html.twig', ['animDays'=>$animationDays, 'animations'=>$animations]);
    }

    public function createAction(Request $request)
    {
        $animationDay = new AnimationDay();
        $animationDay->setColor('30b34e');
        $form=$this->createForm(new AnimationDayType(), $animationDay, ['em'=>$this->getManager()]);
        $form->handleRequest($request);
        if($form->isValid()){
            $em = $this->getManager();
            foreach($animationDay->getSchedules() as $schedule){
                $schedule->setAnimationDay($animationDay);
                $em->persist($schedule);
            }

            $em->persist($animationDay);
            $em->flush();
        }
        return $this->render('ZPBAdminBundle:Animation:day/create.html.twig', ['form'=>$form->createView()]);
    }

    public function updateAction($id, Request $request)
    {

    }

    public function deleteAction($id, Request $request)
    {

    }

    public function xhrScheduleChangeHourAction(Request $request)
    {
        if(!$request->isMethod('POST') || !$request->isXmlHttpRequest()){
            throw $this->createAccessDeniedException();
        }
        $response = ['error'=>true, 'msg'=>'Données Manquantes.'];
        $scheduleId = $request->request->get('id', false);
        $hour = $request->request->get('hour', false);
        if($scheduleId !== false && $hour !== false){
            $scheduleId = intval($scheduleId);
            $hour = (intval($hour)<10) ? '0' . $hour : $hour;
            /** @var \ZPB\AdminBundle\Entity\AnimationSchedule $schedule */
            $schedule = $this->getRepo('ZPBAdminBundle:AnimationSchedule')->find($scheduleId);
            if($schedule){
                $min = $schedule->getTimetable()->format('i');

                $date = \DateTime::createFromFormat('H:i:s', $hour . ':' . $min . ':00' );

                $schedule->setTimetable($date);
                $this->getManager()->persist($schedule);
                $this->getManager()->flush();
                $response['error'] = true;
                $response['msg'] = 'Horaire modifié';
            }
        }

        return new JsonResponse($response);
    }

    public function xhrScheduleChangeMinAction(Request $request)
    {
        if(!$request->isMethod('POST') || !$request->isXmlHttpRequest()){
            throw $this->createAccessDeniedException();
        }
        $response = ['error'=>true, 'msg'=>'Données Manquantes.'];
        $scheduleId = $request->request->get("id", false);
        $min = $request->request->get("min", false);
        if($scheduleId !== false && $min !== false){
            $scheduleId = intval($scheduleId);
            //$min = (intval($min)<10) ? '0' . $min : $min;
            /** @var \ZPB\AdminBundle\Entity\AnimationSchedule $schedule */
            $schedule = $this->getRepo('ZPBAdminBundle:AnimationSchedule')->find($scheduleId);
            if($schedule){
                $hour = $schedule->getTimetable()->format('H');
                $date = \DateTime::createFromFormat('H:i:s', $hour . ':' . $min . ':00' );

                $schedule->setTimetable($date);
                $this->getManager()->persist($schedule);
                $this->getManager()->flush();
                $response['error'] = true;
                $response['msg'] = 'Horaire modifié';

            }
        }

        return new JsonResponse($response);
    }

    public function xhrAddScheduleToDayAction(Request $request)
    {
        if(!$request->isMethod('POST') || !$request->isXmlHttpRequest()){
            throw $this->createAccessDeniedException();
        }
        $response = ['error'=>true, 'msg'=>'Données Manquantes.', 'horaire'=>null];
        $dayId = $request->request->get('dayId', false);
        $hour = $request->request->get('hour', false);
        $min = $request->request->get('min', false);
        $animId = $request->request->get('animId', false);
        if($dayId !== false && $hour !== false && $min !== false && $animId !== false){
            /** @var \ZPB\AdminBundle\Entity\AnimationDay $animationDay */
            $animationDay = $this->getRepo('ZPBAdminBundle:AnimationDay')->find(intval($dayId));
            /** @var \ZPB\AdminBundle\Entity\Animation $animationDay */
            $animation = $this->getRepo('ZPBAdminBundle:Animation')->find(intval($animId));

            if($animationDay !== null && $animation !== null){
                $schedule = new AnimationSchedule();
                $schedule->setAnimation($animation);
                $date = \DateTime::createFromFormat('H:i:s', $hour.':'.$min.':00');
                $schedule->setTimetable($date);
                $schedule->setAnimationDay($animationDay);
                $this->getManager()->persist($schedule);

                $this->getManager()->flush();
                $response['error'] = false;
                $response['msg'] = 'Horaire enregistré';
                $response['horaire'] = ['id'=>$schedule->getId(), 'animation'=>$animation->getName()];
            }

        }

        return new JsonResponse($response);
    }

}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Bull. trimest. Soc. mycol. Fr. 43: 114 (1927)

#### Original name
Androsaceus hederae Kühner, 1927

### Remarks
null


text:
import {Box, Flex, Spinner, Text} from '@sanity/ui'
import React from 'react'

export function SpinnerWithText(props: {text: string}) {
  const {text} = props

  return (
    <Flex direction="row" justify="center" align="center">
      <Spinner />
      <Box marginLeft={2}>
        <Text>{text}</Text>
      </Box>
    </Flex>
  )
}


text:
<?php

namespace Oro\Bundle\DashboardBundle;

use Oro\Component\DependencyInjection\Compiler\PriorityTaggedLocatorCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
 * The DashboardBundle bundle class.
 */
class OroDashboardBundle extends Bundle
{
    /**
     * {@inheritdoc}
     */
    public function build(ContainerBuilder $container)
    {
        parent::build($container);

        $container->addCompilerPass(new PriorityTaggedLocatorCompilerPass(
            'oro_dashboard.widget_config_value.provider',
            'oro_dashboard.value.converter',
            'form_type'
        ));
        $container->addCompilerPass(new PriorityTaggedLocatorCompilerPass(
            'oro_dashboard.provider.big_number.processor',
            'oro_dashboard.big_number.provider',
            'alias'
        ));
    }
}


text:
[[ -s "$HOME/Repos/homedir/git_prompt.bash" ]] && source "$HOME/Repos/homedir/git_prompt.bash"
[[ -s "$HOME/Repos/homedir/shared_history.bash" ]] && source "$HOME/Repos/homedir/shared_history.bash"

export EDITOR=emacs

# See http://rabexc.org/posts/pitfalls-of-ssh-agents for why I'm not doing ssh-agent here. Instead,
# I set my terminal emulator to run my bash shell inside of it with the following bit of magic:
# `/usr/bin/ssh-agent /bin/bash -l`, which gives me one agent per shell so some redundant password
# entry, but I was able to verify they unload correctly which is nice. And the password only
# prompts, in combo with "AddKeysToAgent yes", when first needed.