text:
namespace Microsoft.Azure.Management.EventGrid
{
    using Microsoft.Rest;
    using Microsoft.Rest.Azure;
    using Models;
    using System.Collections;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// Extension methods for TopicsOperations.
    /// </summary>
    public static partial class TopicsOperationsExtensions
    {
            /// <summary>
            /// Get a topic
            /// </summary>
            /// <remarks>
            /// Get properties of a topic
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            public static Topic Get(this ITopicsOperations operations, string resourceGroupName, string topicName)
            {
                return operations.GetAsync(resourceGroupName, topicName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Get a topic
            /// </summary>
            /// <remarks>
            /// Get properties of a topic
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<Topic> GetAsync(this ITopicsOperations operations, string resourceGroupName, string topicName, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, topicName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Create a topic
            /// </summary>
            /// <remarks>
            /// Asynchronously creates a new topic with the specified parameters.
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='topicInfo'>
            /// Topic information
            /// </param>
            public static Topic CreateOrUpdate(this ITopicsOperations operations, string resourceGroupName, string topicName, Topic topicInfo)
            {
                return operations.CreateOrUpdateAsync(resourceGroupName, topicName, topicInfo).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Create a topic
            /// </summary>
            /// <remarks>
            /// Asynchronously creates a new topic with the specified parameters.
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='topicInfo'>
            /// Topic information
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<Topic> CreateOrUpdateAsync(this ITopicsOperations operations, string resourceGroupName, string topicName, Topic topicInfo, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, topicName, topicInfo, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Delete a topic
            /// </summary>
            /// <remarks>
            /// Delete existing topic
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            public static void Delete(this ITopicsOperations operations, string resourceGroupName, string topicName)
            {
                operations.DeleteAsync(resourceGroupName, topicName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Delete a topic
            /// </summary>
            /// <remarks>
            /// Delete existing topic
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task DeleteAsync(this ITopicsOperations operations, string resourceGroupName, string topicName, CancellationToken cancellationToken = default(CancellationToken))
            {
                (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, topicName, null, cancellationToken).ConfigureAwait(false)).Dispose();
            }

            /// <summary>
            /// Update a topic
            /// </summary>
            /// <remarks>
            /// Asynchronously updates a topic with the specified parameters.
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='tags'>
            /// Tags of the resource
            /// </param>
            public static Topic Update(this ITopicsOperations operations, string resourceGroupName, string topicName, IDictionary<string, string> tags = default(IDictionary<string, string>))
            {
                return operations.UpdateAsync(resourceGroupName, topicName, tags).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Update a topic
            /// </summary>
            /// <remarks>
            /// Asynchronously updates a topic with the specified parameters.
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='tags'>
            /// Tags of the resource
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<Topic> UpdateAsync(this ITopicsOperations operations, string resourceGroupName, string topicName, IDictionary<string, string> tags = default(IDictionary<string, string>), CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, topicName, tags, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// List topics under an Azure subscription
            /// </summary>
            /// <remarks>
            /// List all the topics under an Azure subscription
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='filter'>
            /// Filter the results using OData syntax.
            /// </param>
            /// <param name='top'>
            /// The number of results to return.
            /// </param>
            public static IPage<Topic> ListBySubscription(this ITopicsOperations operations, string filter = default(string), int? top = default(int?))
            {
                return operations.ListBySubscriptionAsync(filter, top).GetAwaiter().GetResult();
            }

            /// <summary>
            /// List topics under an Azure subscription
            /// </summary>
            /// <remarks>
            /// List all the topics under an Azure subscription
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='filter'>
            /// Filter the results using OData syntax.
            /// </param>
            /// <param name='top'>
            /// The number of results to return.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IPage<Topic>> ListBySubscriptionAsync(this ITopicsOperations operations, string filter = default(string), int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(filter, top, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// List topics under a resource group
            /// </summary>
            /// <remarks>
            /// List all the topics under a resource group
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='filter'>
            /// Filter the results using OData syntax.
            /// </param>
            /// <param name='top'>
            /// The number of results to return.
            /// </param>
            public static IPage<Topic> ListByResourceGroup(this ITopicsOperations operations, string resourceGroupName, string filter = default(string), int? top = default(int?))
            {
                return operations.ListByResourceGroupAsync(resourceGroupName, filter, top).GetAwaiter().GetResult();
            }

            /// <summary>
            /// List topics under a resource group
            /// </summary>
            /// <remarks>
            /// List all the topics under a resource group
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='filter'>
            /// Filter the results using OData syntax.
            /// </param>
            /// <param name='top'>
            /// The number of results to return.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IPage<Topic>> ListByResourceGroupAsync(this ITopicsOperations operations, string resourceGroupName, string filter = default(string), int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, filter, top, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// List keys for a topic
            /// </summary>
            /// <remarks>
            /// List the two keys used to publish to a topic
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            public static TopicSharedAccessKeys ListSharedAccessKeys(this ITopicsOperations operations, string resourceGroupName, string topicName)
            {
                return operations.ListSharedAccessKeysAsync(resourceGroupName, topicName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// List keys for a topic
            /// </summary>
            /// <remarks>
            /// List the two keys used to publish to a topic
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<TopicSharedAccessKeys> ListSharedAccessKeysAsync(this ITopicsOperations operations, string resourceGroupName, string topicName, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListSharedAccessKeysWithHttpMessagesAsync(resourceGroupName, topicName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Regenerate key for a topic
            /// </summary>
            /// <remarks>
            /// Regenerate a shared access key for a topic
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='keyName'>
            /// Key name to regenerate key1 or key2
            /// </param>
            public static TopicSharedAccessKeys RegenerateKey(this ITopicsOperations operations, string resourceGroupName, string topicName, string keyName)
            {
                return operations.RegenerateKeyAsync(resourceGroupName, topicName, keyName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Regenerate key for a topic
            /// </summary>
            /// <remarks>
            /// Regenerate a shared access key for a topic
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='keyName'>
            /// Key name to regenerate key1 or key2
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<TopicSharedAccessKeys> RegenerateKeyAsync(this ITopicsOperations operations, string resourceGroupName, string topicName, string keyName, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.RegenerateKeyWithHttpMessagesAsync(resourceGroupName, topicName, keyName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// List topic event types
            /// </summary>
            /// <remarks>
            /// List event types for a topic
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='providerNamespace'>
            /// Namespace of the provider of the topic
            /// </param>
            /// <param name='resourceTypeName'>
            /// Name of the topic type
            /// </param>
            /// <param name='resourceName'>
            /// Name of the topic
            /// </param>
            public static IEnumerable<EventType> ListEventTypes(this ITopicsOperations operations, string resourceGroupName, string providerNamespace, string resourceTypeName, string resourceName)
            {
                return operations.ListEventTypesAsync(resourceGroupName, providerNamespace, resourceTypeName, resourceName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// List topic event types
            /// </summary>
            /// <remarks>
            /// List event types for a topic
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='providerNamespace'>
            /// Namespace of the provider of the topic
            /// </param>
            /// <param name='resourceTypeName'>
            /// Name of the topic type
            /// </param>
            /// <param name='resourceName'>
            /// Name of the topic
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IEnumerable<EventType>> ListEventTypesAsync(this ITopicsOperations operations, string resourceGroupName, string providerNamespace, string resourceTypeName, string resourceName, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListEventTypesWithHttpMessagesAsync(resourceGroupName, providerNamespace, resourceTypeName, resourceName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Create a topic
            /// </summary>
            /// <remarks>
            /// Asynchronously creates a new topic with the specified parameters.
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='topicInfo'>
            /// Topic information
            /// </param>
            public static Topic BeginCreateOrUpdate(this ITopicsOperations operations, string resourceGroupName, string topicName, Topic topicInfo)
            {
                return operations.BeginCreateOrUpdateAsync(resourceGroupName, topicName, topicInfo).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Create a topic
            /// </summary>
            /// <remarks>
            /// Asynchronously creates a new topic with the specified parameters.
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='topicInfo'>
            /// Topic information
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<Topic> BeginCreateOrUpdateAsync(this ITopicsOperations operations, string resourceGroupName, string topicName, Topic topicInfo, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, topicName, topicInfo, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Delete a topic
            /// </summary>
            /// <remarks>
            /// Delete existing topic
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            public static void BeginDelete(this ITopicsOperations operations, string resourceGroupName, string topicName)
            {
                operations.BeginDeleteAsync(resourceGroupName, topicName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Delete a topic
            /// </summary>
            /// <remarks>
            /// Delete existing topic
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task BeginDeleteAsync(this ITopicsOperations operations, string resourceGroupName, string topicName, CancellationToken cancellationToken = default(CancellationToken))
            {
                (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, topicName, null, cancellationToken).ConfigureAwait(false)).Dispose();
            }

            /// <summary>
            /// Update a topic
            /// </summary>
            /// <remarks>
            /// Asynchronously updates a topic with the specified parameters.
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='tags'>
            /// Tags of the resource
            /// </param>
            public static Topic BeginUpdate(this ITopicsOperations operations, string resourceGroupName, string topicName, IDictionary<string, string> tags = default(IDictionary<string, string>))
            {
                return operations.BeginUpdateAsync(resourceGroupName, topicName, tags).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Update a topic
            /// </summary>
            /// <remarks>
            /// Asynchronously updates a topic with the specified parameters.
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group within the user's subscription.
            /// </param>
            /// <param name='topicName'>
            /// Name of the topic
            /// </param>
            /// <param name='tags'>
            /// Tags of the resource
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<Topic> BeginUpdateAsync(this ITopicsOperations operations, string resourceGroupName, string topicName, IDictionary<string, string> tags = default(IDictionary<string, string>), CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, topicName, tags, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// List topics under an Azure subscription
            /// </summary>
            /// <remarks>
            /// List all the topics under an Azure subscription
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            public static IPage<Topic> ListBySubscriptionNext(this ITopicsOperations operations, string nextPageLink)
            {
                return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult();
            }

            /// <summary>
            /// List topics under an Azure subscription
            /// </summary>
            /// <remarks>
            /// List all the topics under an Azure subscription
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IPage<Topic>> ListBySubscriptionNextAsync(this ITopicsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// List topics under a resource group
            /// </summary>
            /// <remarks>
            /// List all the topics under a resource group
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            public static IPage<Topic> ListByResourceGroupNext(this ITopicsOperations operations, string nextPageLink)
            {
                return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult();
            }

            /// <summary>
            /// List topics under a resource group
            /// </summary>
            /// <remarks>
            /// List all the topics under a resource group
            /// </remarks>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IPage<Topic>> ListByResourceGroupNextAsync(this ITopicsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

    }
}


text:
ACCEPTED

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

#### Published in
null

#### Original name
Antirhea pedicellaris Borhidi & Bisse

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{padding:0px; margin:0px;}
fieldset, img{border:0;}
ol, ul{list-style: none;}
.clr:after{content:" "; display:block; height:0px; clear:both; visibility:hidden;}.clr{display:inline-block;}* html .clr{height:0%;}.clr{display:block;}
.col{display:inline-block;zoom:1;*display:inline;overflow:hidden;vertical-align:middle;}
.wrap{overflow:hidden; *display:inline-block;}.wrap{*display:block;}
.l{ float:left;}.r{ float:right;}
h1{font-size:34px;}h2{font-size:26px;}h3{font-size:18px; }h4{font-size:16px;}h5{font-size:14px;}h6{font-size:12px;}h1,h2,h3{font-family:microsoft yahei,simhei;}

body{background:url(../images/i_body_bg.jpg) repeat-x #006295;}
.body_box{background:url(../images/i_bodyb_bg.jpg) repeat-x 0% 100%; padding-bottom:28px;}
.main_box{width:1000px; margin:0px auto;}
.hd{height:288px; overflow:hidden; background:url(../images/i_hd_bg.jpg) no-repeat; position:relative;}

.ct{ margin:10px 0px; background-color:#117CB9;}
.ct .l{ background:url(../images/i_c_icon.jpg) no-repeat; width:231px; height:200px; margin:20px 40px 20px 20px;}
.ct .ct_box{color:#fff; float:left; width:660px; font-size:12px; line-height:24px;height:auto!important; height:300px; min-height:300px;margin:20px 0;}
.ct .bg_t{background:url(../images/i_c_tbg.gif) no-repeat; height:8px;}
.ct .bg_b{background:url(../images/i_c_bbg.gif) no-repeat 0% 100%; height:8px;}

.btn_box a{background:url(../images/i_t_btn.jpg) no-repeat; display:inline-block;zoom:1;*display:inline;overflow:hidden;vertical-align:middle;}
.btn_box{text-align:center;}
a.is_btn{width:140px; height:65px; background-position:-111px 0px; margin:0px 10px;line-height:40px;color:#FFF; font-size:16px; font-weight:bold; text-decoration:none;}
a.s_btn,a.x_btn{background-position:0px 0px; width:100px; height:65px; line-height:40px; font-size:16px; font-weight:bold; text-decoration:none;color:#FFF;margin:0px 4px;}
a.pre{color:#CCC;}
a.pre:hover{color:#fff;}

.bz{background:url(../images/i_loadin.jpg) no-repeat; width:1000px; height:114px; position:absolute; bottom:1px;}
.bz .jj_bg{ background:url(../images/jj_bg.jpg) no-repeat 100% 0px; width:23px; height:8px; position:absolute;right:0;top:49px;}
.hd .a1{width:140px;}.hd .a2{width:290px;}.hd .a3{width:440px;}.hd .a4{width:554px;}.hd .a5{width:704px;}.hd .a5{width:704px;}.hd .a6{width:818px;}.hd .a7{width:1000px;}
.a7 .jj_bg{display:none;}


text:
package edu.ucsc.dbtune.inum;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;

import edu.ucsc.dbtune.DatabaseSystem;
import edu.ucsc.dbtune.advisor.candidategeneration.CandidateGenerator;
import edu.ucsc.dbtune.metadata.Index;
import edu.ucsc.dbtune.optimizer.InumOptimizer;
import edu.ucsc.dbtune.optimizer.Optimizer;
import edu.ucsc.dbtune.optimizer.plan.InumPlan;
import edu.ucsc.dbtune.optimizer.plan.SQLStatementPlan;
import edu.ucsc.dbtune.util.Environment;
import edu.ucsc.dbtune.util.InumPlanSetWithCache;
import edu.ucsc.dbtune.workload.SQLStatement;
import edu.ucsc.dbtune.workload.Workload;

import org.junit.BeforeClass;
import org.junit.Test;

import static com.google.common.collect.Iterables.get;

import static edu.ucsc.dbtune.DatabaseSystem.newDatabaseSystem;
import static edu.ucsc.dbtune.util.MathUtils.combinations;
import static edu.ucsc.dbtune.util.OptimizerUtils.getBaseOptimizer;
import static edu.ucsc.dbtune.util.TestUtils.loadWorkloads;
import static edu.ucsc.dbtune.util.TestUtils.workloads;

import static org.hamcrest.Matchers.is;

import static org.junit.Assert.assertThat;

/**
 * @author Ivo Jimenez
 */
public class MatchingStrategyFunctionalTest
{
    private static DatabaseSystem db;
    private static Environment env;
    private static Optimizer delegate;
    private static CandidateGenerator candGen;
    private static InumSpaceComputation computation;
    private static Random r;

    /**
     * @throws Exception
     *      if {@link #newDatabaseSystem} throws an exception
     */
    @BeforeClass
    public static void beforeClass() throws Exception
    {
        env = Environment.getInstance();
        db = newDatabaseSystem(env);
        delegate = getBaseOptimizer(db.getOptimizer());
        candGen = CandidateGenerator.Factory.newCandidateGenerator(env, delegate);
        computation = InumSpaceComputation.Factory.newInumSpaceComputation(env);
        r = new Random(System.currentTimeMillis());

        loadWorkloads(db.getConnection());
    }

    /**
     * @throws Exception
     *      if something goes wrong
     */
    @Test
    public void testMatching() throws Exception
    {
        if (!(db.getOptimizer() instanceof InumOptimizer))
            return;

        List<MatchingStrategy> available = new ArrayList<MatchingStrategy>();

        available.add(new GreedyMatchingStrategy());
        available.add(new ExhaustiveMatchingStrategy());

        SQLStatementPlan plan;
        StringBuilder report;
        long cacheWarmingTime;
        long time;
        long matchTime;
        int queryNumber;

        report = new StringBuilder();
        report.append("workload name, query number, cache warming time (using exhaustive), ");

        for (MatchingStrategy s : available)
            report.append(s.getClass().getName() + " time,");

        for (List<SQLStatement> wl : workloads(env.getWorkloadFolders())) {

            Set<Index> conf = candGen.generate(wl);

            queryNumber = 1;

            for (SQLStatement sql : wl) {

                queryNumber++;

                if (r.nextInt(100) > 20)
                    // run 20% of queries, to speedup the testing
                    continue;

                Set<InumPlan> inumSpace = new InumPlanSetWithCache();
                Map<MatchingStrategy, SQLStatementPlan> plans =
                    new HashMap<MatchingStrategy, SQLStatementPlan>();

                computation.compute(inumSpace, sql, delegate, db.getCatalog());

                time = System.nanoTime();
                new ExhaustiveMatchingStrategy().match(inumSpace, conf).getInstantiatedPlan();
                cacheWarmingTime = System.nanoTime() - time;

                report.append(
                    sql.getWorkload().getWorkloadName() + "," +
                    queryNumber + "," +
                    cacheWarmingTime + ",");

                for (MatchingStrategy s : available) {
                    time = System.nanoTime();
                    plan = s.match(inumSpace, conf).getInstantiatedPlan();
                    matchTime = System.nanoTime() - time;
                    report.append(matchTime + ",");
                    plans.put(s, plan);
                }

                for (Set<MatchingStrategy> pair : combinations(available, 2)) {
                    MatchingStrategy one = get(pair, 0);
                    MatchingStrategy two = get(pair, 1);
                    assertThat(
                            "Workload: " + sql.getWorkload().getWorkloadName() + "\n" +
                            "Statement: " + queryNumber + "\n" +
                            "MatchingStrategy one: " + one.getClass().getName() + "\n" +
                            "MatchingStrategy one: " + two.getClass().getName() + "\n" +
                            "Instantiated plan one:\n" + plans.get(one) + "\n" +
                            "Instantiated plan two:\n" + plans.get(two),
                            plans.get(one), is(plans.get(two)));
                }

                report.append("\n");
            }
        }
    }
}


text:
package vn.getgreen.common;

public class Constants {
	public static final boolean DEBUG = true;
	public static final boolean USE_HOST_PRODUCTION = true;
	public static final String PREFS_NAME = "PREFS_GETGREN";
	public static final String API_KEY = "ecom2014";
	public static final String CLIENT_SECRET = "ecom2014";
	public static int DAYS_TOKEN_EXPRIED = 14; //14 days will expried OTT
	public static final String HOST_PRODUCTION = "http://songxanh.tk/forum/api/index.php?";

	public static final int SCALED_IMAGE = 1;// 1-100%; 2-50%; 4-25%
	public static final float CACHE_SIZE = 0.5f;// 50% app memory
	public static final String IMAGE_CACHE_DIR = "getgreen_cached";
}


text:
describe('ns.router', function() {

    describe('API', function() {

        it('should be defined', function() {
            expect(ns.router).to.be.a('function');
        });

        it('ns.router.init should be defined', function() {
            expect(ns.router.init).to.be.a('function');
        });

        it('ns.router.regexps should be defined', function() {
            expect(ns.router.regexps).to.be.an('object');
        });
    });

    describe('routes', function() {

        beforeEach(function() {
            ns.router.routes = {
                redirect: {
                    '/': '/inbox',
                    '/inbox/old/{int:int}': '/inbox',
                    '/inbox/my': function() {
                        return '/inbox';
                    },
                    '/inbox/my/1': function() {
                        return '/landing';
                    },
                    '/inbox/my/{int:int}': function(params) {
                        return '/inbox/' + params.int;
                    }
                },
                route: {
                    '/inbox': 'messages',
                    '/message/{mid:int}': 'message',
                    '/page/prefix{page:int}': 'url-with-prefix',
                    '/search/{request:any}': 'search'
                }
            };

            ns.router.regexps['any'] = '.+?';

            ns.router.init();
        });

        afterEach(function() {
            delete ns.router.regexps['any'];
        });

        var test_route = function(url, params, test_name) {
            test_name = test_name || (url + ' -> ' + params.page);
            it(test_name, function() {
                expect(ns.router(url)).to.be.eql(params);
            });
        };

        test_route('', {page: ns.R.REDIRECT, params: {}, redirect: '/inbox'});
        test_route('/', {page: ns.R.REDIRECT, params: {}, redirect: '/inbox'});
        test_route('/inbox/old/123', {page: ns.R.REDIRECT, params: {}, redirect: '/inbox'});
        test_route('/inbox/my', {page: ns.R.REDIRECT, params: {}, redirect: '/inbox'});
        test_route('/inbox/my/1', {page: ns.R.REDIRECT, params: {}, redirect: '/landing'});
        test_route('/inbox/my/123', {page: ns.R.REDIRECT, params: {}, redirect: '/inbox/123'});
        test_route('/?foo=bar', {page: ns.R.REDIRECT, params: {}, redirect: '/inbox'});
        test_route('/inbox', {page: 'messages', params: {}});
        test_route('/inbox/', {page: 'messages', params: {}});

        test_route('/message', {page: ns.R.NOT_FOUND, params: {}});
        test_route('/message/', {page: ns.R.NOT_FOUND, params: {}});

        test_route('/message/12345', {page: 'message', params: {mid: '12345'}});
        test_route('/message/12345/', {page: 'message', params: {mid: '12345'}});

        test_route('/page/prefix1/', {page: 'url-with-prefix', params: {page: '1'}});

        test_route('/search/request/', {page: 'search', params: {request: 'request'}});
        test_route('/search/' + encodeURIComponent('/') + '/', {page: 'search', params: {request: '/'}});
        // test for invalid urlencode
        test_route('/search/' + encodeURIComponent('/') + '%F/', {page: 'search', params: {request: undefined}});
    });

    describe('default value', function() {

        beforeEach(function() {
            ns.router.regexps[ 'page' ] = 'folder|home';
            ns.router.routes = {
                route: {
                    '/messages/{folder:id=inbox}/{message_id:int}': 'message',
                    '/folder/{folder:id=inbox}': 'folder',
                    '/{page:page=home}': 'page'
                }
            };
            ns.router.init();
        });

        var test_route = function(url, page, params, test_name) {
            it(test_name || url, function() {
                expect(ns.router(url)).to.be.eql({ page: page, params: params });
            });
        };

        test_route('/folder/',        'folder', { folder: 'inbox' });
        test_route('/folder/inbox',   'folder', { folder: 'inbox' });
        test_route('/folder/starred', 'folder', { folder: 'starred' });
        test_route('/folder',         'folder', { folder: 'inbox' }, '/folder : slash near param with default value can collapse');

        test_route('/', 'page', { page: 'home' }, '/ resolved to default value of a custom type');

        test_route('/messages/inbox/45?var1=val1&var2=val2', 'message', { folder: 'inbox', message_id: '45', var1: 'val1', var2: 'val2' });
        //FIXME
        //test_route('/messages/inbox/45?var1=val1&',           'message', { folder: 'inbox', message_id: '45', var1: 'val1' });
        test_route('/messages/inbox/45?var1=val1',           'message', { folder: 'inbox', message_id: '45', var1: 'val1' });
        //  NOTE может надо какое-то другое значение для val1 ?
        test_route('/messages/inbox/45?val1',                'message', { folder: 'inbox', message_id: '45', val1: '' });
        test_route('/messages/inbox/45?',                    'message', { folder: 'inbox', message_id: '45' });
        test_route('/messages/inbox/45',                     'message', { folder: 'inbox', message_id: '45' });

        test_route('/messages/45?var1=val1&var2=val2', 'message', { folder: 'inbox', message_id: '45', var1: 'val1', var2: 'val2' });
        test_route('/messages/45?var1=val1',           'message', { folder: 'inbox', message_id: '45', var1: 'val1' });
        test_route('/messages/45?val1',                'message', { folder: 'inbox', message_id: '45', val1: '' });
        test_route('/messages/45?',                    'message', { folder: 'inbox', message_id: '45' });
        test_route('/messages/45',                     'message', { folder: 'inbox', message_id: '45' });

        // fail
        test_route('/messages//45?var1=val1&var2=val2', 'not-found', {}, '/messages//45?var1=val1&var2=val2: MUST FAIL');
        test_route('/messages//45?var1=val1',           'not-found', {}, '/messages//45?var1=val1: MUST FAIL');
        test_route('/messages//45?val1',                'not-found', {}, '/messages//45?val1: MUST FAIL');
        test_route('/messages//45?',                    'not-found', {}, '/messages//45?: MUST FAIL');
        test_route('/messages//45',                     'not-found', {}, '/messages//45: MUST FAIL');
    });

    describe('filter value', function() {

        beforeEach(function() {
            ns.router.regexps['context'] = 'search|tag|top';
            ns.router.routes = {
                route: {
                    '/{context:context==search}/{query}/image/{id:int}': 'view',
                    '/{context:context==tag}/{tag}/image/{id:int}': 'view',
                    '/{context:context=}/image/{id:int}': 'view'
                }
            };
            ns.router.init();
        });

        var test_route = function(url, page, params, test_name) {
            it(test_name || url, function() {
                expect(ns.router(url)).to.be.eql({ page: page, params: params });
            });
        };

        test_route('/search/airport/image/1', 'view', { context: 'search', query: 'airport', id: '1' });
        test_route('/tag/airport/image/2',    'view', { context: 'tag', tag: 'airport', id: '2' });
        test_route('/top/image/3',            'view', { context: 'top', id: '3' });
    });

    describe('baseDir: routing', function() {
        beforeEach(function() {
            ns.router.baseDir = '/ver2';
            ns.router.routes = {
                route: {
                    '/index': 'index'
                }
            };
            ns.router.init();
        });

        afterEach(function() {
            delete ns.router._routes;
            delete ns.router.routes;
            ns.router.baseDir= '';
        });

        it('NOT_APP_URL in case url does not match baseDir', function() {
            expect(ns.router('/ver1/index')).to.eql({
                page: ns.R.NOT_APP_URL,
                params: {},
                redirect: '/ver1/index'
            });
        });

        it('NOT_APP_URL in case url does not match baseDir but match route', function() {
            expect(ns.router('/index')).to.eql({
                page: ns.R.NOT_APP_URL,
                params: {},
                redirect: '/index'
            });
        });

        it('prefixed url is routed fine', function() {
            expect(ns.router('/ver2/index')).to.be.eql({ page: 'index', params: {} });
        });
    });

    describe('baseDir: url generate with baseDir', function() {
        beforeEach(function() {
            ns.router.baseDir = '/ver2';
            ns.router.routes = {};
            ns.router.init();
        });

        afterEach(function() {
            delete ns.router._routes;
            delete ns.router.routes;
            ns.router.baseDir= '';
        });

        // URL GENERATION
        it('generate prefixed url when baseDir is not empty', function() {
            expect(ns.router.url('/index')).to.be.eql('/ver2/index');
        });
    });

    describe('baseDir: url generate without baseDir', function() {
        beforeEach(function() {
            ns.router.routes = {};
            ns.router.init();
        });

        afterEach(function() {
            delete ns.router._routes;
            delete ns.router.routes;
            ns.router.baseDir= '';
        });

        it('generate unprefixed url when baseDir is empty', function() {
            expect(ns.router.url('/index')).to.be.eql('/index');
        });
    });

    describe('rewrite', function() {

        beforeEach(function() {
            ns.router.routes = {
                rewriteUrl: {
                    '/page1': '/page/1'
                },
                route: {
                    '/page/{id:int}': 'layout'
                }
            };
            ns.router.init();
        });

        var tests = [
            {
                'url': '/page1',
                'route': {
                    'page': 'layout',
                    'params': {
                        'id': '1'
                    }
                }
            },

            {
                'url': '/page1?foo=bar',
                'route': {
                    'page': 'layout',
                    'params': {
                        'id': '1',
                        'foo': 'bar'
                    }
                }
            }
        ];

        tests.forEach(function(test) {

            it('should process "' + test.url + '" as "' + JSON.stringify(test.route) + '"', function() {
                expect(ns.router(test.url)).to.be.eql(test.route);
            });

        });

    });

    describe('special case: parameter is a path', function() {

        beforeEach(function() {
            ns.router.regexps.path = '(?:\\/[^\\/\\?]+)+';
            ns.router.regexps.dialog = 'copy|move';
            ns.router.regexps.divider = '\\|';

            ns.router.routes = {
                route: {
                    '/from{from-path:path}/{dialog:dialog}{div:divider}{to-path:path}': 'page',
                    '/from{from-path:path}/{dialog:dialog}{div:divider}': 'page',
                    '/from{from-path:path}/{dialog:dialog}': 'page',
                    '/from{from-path:path}': 'page'
                }
            };
            ns.router.init();
        });

        var test_route = function(url, params, test_name) {
            test_name = test_name || (url + ' -> ' + params.page);
            it(test_name, function() {
                expect(ns.router(url)).to.be.eql(params);
            });
        };

        test_route('/from/var/logs/nginx/copy|/users/me/local', { page: 'page', params: { dialog: 'copy', div: '|', 'from-path': '/var/logs/nginx', 'to-path': '/users/me/local' } } );
        test_route('/from/var/logs/nginx/copy|', { page: 'page', params: { dialog: 'copy', div: '|', 'from-path': '/var/logs/nginx' } } );
        test_route('/from/var/logs/nginx/copy', { page: 'page', params: { dialog: 'copy', 'from-path': '/var/logs/nginx' } } );
        test_route('/from/var/logs/nginx', { page: 'page', params: { 'from-path': '/var/logs/nginx' } } );
    });
});


text:
angular.module('app')
	.controller('Auth.Signup', ['Auth', '$mdDialog', 'baseConfig','$rootScope',
       function (Auth, $mdDialog, baseConfig, $rootScope) {
		var _this = this;
		this.user = {};
		this.signup = function (user) {
			_this.errorMessage = null;
			Auth.signup(user)
				.then(function (res) {
					//user account was created successfully
					$mdDialog.hide(res);
				}, function (res){
					_this.errorMessage = res.error || 'Failed to sign up.';

				});
		};
		this.loginCancel = function () {
			$mdDialog.cancel();
		}
		this.changeToSignin= function () {

			$mdDialog.cancel()
				//according to the docs this should RESOLVE when dialog closes,
				//but after version 0.11 it REJECTS it instead,
				//might not be an intended behavior and break with newer versions
				.catch(function () {
						var modalConf = {
						templateUrl: baseConfig.modalBase + 'signin.html',
						clickOutsideToClose:true,
						controller: 'Auth.Signin as signinCtrl',

					}
					var modal = $mdDialog.show(modalConf)
					.then(function (res) {
						//if promise gets resolved it means the user has successfully signed up
						//which means we can resolve this promise
						Auth.loginConfirmed();
					},  function () {
						//cancel login
						Auth.loginCancelled();
					});
				})
		}

	}])


text:
package org.http4s
package headers

import cats.parse.Parser
import cats.parse.Rfc5234
import org.http4s.Header
import org.typelevel.ci._

object `X-B3-Sampled` {

  def parse(s: String): ParseResult[`X-B3-Sampled`] =
    ParseResult.fromParser(parser, "Invalid X-B3-Sampled header")(s)

  private[http4s] val parser: Parser[`X-B3-Sampled`] =
    Rfc5234.bit.map(s => `X-B3-Sampled`(s == '1'))

  implicit val headerInstance: Header[`X-B3-Sampled`, Header.Single] =
    Header.create(
      ci"X-B3-Sampled",
      v => if (v.sampled) "1" else "0",
      parse,
    )

}

final case class `X-B3-Sampled`(sampled: Boolean)


text:
package io.github.marcelbraghetto.dailydeviations.framework.foundation.utils;

import android.app.Activity;
import android.app.Application;
import android.os.Bundle;

/**
 * Created by Marcel Braghetto on 4/06/16.
 *
 * Basic empty implementation of the activity life cycle callbacks to allow optional
 * method overriding.
 */
public abstract class BasicActivityLifecycleCallbacks implements Application.ActivityLifecycleCallbacks {
    @Override public void onActivityCreated(Activity activity, Bundle savedInstanceState) { }
    @Override public void onActivityStarted(Activity activity) { }
    @Override public void onActivityResumed(Activity activity) { }
    @Override public void onActivityPaused(Activity activity) { }
    @Override public void onActivityStopped(Activity activity) { }
    @Override public void onActivitySaveInstanceState(Activity activity, Bundle outState) { }
    @Override public void onActivityDestroyed(Activity activity) { }
}


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>KinectProject: Model.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>

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

KinectProject

A shell for creating projects using projectors and kinects

Main Page

Namespaces

Classes

Files

Directories

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

File List

File Members

lib

app

Model.h

Go to the documentation of this file.

00001 /*
00002  *  Model.h
00003  *  emptyExample
00004  *
00005  *  Created by Marek Bereza on 06/01/2011.
00006  *
00007  */
00008
00009 #pragma once
00010 #include "ofxOBJModel.h"
00011 #include "ofMain.h"
00012 #include "Settings.h"
00013
00017 class Model: public ofNode { //: public ofNode {
00018 public:
00019     ofxOBJModel model;
00020
00021     Model() {
00022         model.load(settings.get("model file", "scene.obj"));
00023     }
00024
00025     void customDraw() {
00026         glColor3f(1,1,1);
00027         model.draw(false);
00028     }
00029     void drawModel() {
00030         glColor3f(1,1,1);
00031         model.draw(true);
00032     }
00033 };

 All Classes Namespaces Files Functions Variables Defines

<address class="footer">Generated on Tue Feb 1 2011 14:49:48 for KinectProject by

 1.7.3 </address>


text:
<?php
declare(strict_types = 1);

namespace Innmind\Neo4j\ONM\Exception;

final class IdentityNotManaged extends RuntimeException
{
}


text: <link rel="shortcut icon" type="image/x-icon" href="{{ "favicon.ico" | relative_url }}">


text:
class VersionControlConstants:
    GIT_TYPE = 'git'
    SUBVERSION_TYPE = 'svn'


text:
package com.yext.serialization.csv;

import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.List;

import com.csvreader.CsvReader;
import com.google.common.base.CharMatcher;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;

import com.yext.serialization.core.DeserializingException;
import com.yext.serialization.core.SerializationFormat;
import com.yext.serialization.core.SerializationWrapper;
import com.yext.serialization.core.Setter;

/**
 * Deserializes CSV files into classes
 *
 * @author Joel Stein (joel@yext.com)
 */
public class CsvDeserializer {
    private char fieldDelimiter = ',';
    private Character recordDelimiter = null;
    private List<String> headerStrings = null;
    private EscapeMode escapeMode = null;

    public CsvDeserializer setFieldDelimiter(char fieldDelimiter) {
        this.fieldDelimiter = fieldDelimiter;
        return this;
    }

    public CsvDeserializer setRecordDelimiter(Character recordDelimiter) {
        this.recordDelimiter = recordDelimiter;
        return this;
    }

    public CsvDeserializer setHeaderStrings(List<String> headerStrings) {
        this.headerStrings = headerStrings == null ? null : ImmutableList.copyOf(headerStrings);
        return this;
    }

    public CsvDeserializer setEscapeMode(EscapeMode escapeMode) {
        this.escapeMode = escapeMode;
        return this;
    }

    public static <T> List<T> deserialize(String str, final Class<T> clazz)
        throws DeserializingException
    {
        try {
            return deserialize(new StringReader(str), clazz);
        } catch (IOException e) {
            throw new DeserializingException(e);
        }
    }

    public static <T> List<T> deserialize(Reader reader, final Class<T> clazz)
        throws DeserializingException, IOException
    {
        return deserialize(reader, clazz, ',', null);
    }

    public static <T> List<T> deserialize(
        Reader reader,
        final Class<T> clazz,
        char fieldDelimiter,
        Character recordDelimiter
        ) throws DeserializingException, IOException
    {
        return deserialize(reader, clazz, fieldDelimiter, recordDelimiter, null);
    }

    //TODO(joel): Make legacy stuff use the builder pattern
    public static <T> List<T> deserialize(
        Reader reader,
        final Class<T> clazz,
        char fieldDelimiter,
        Character recordDelimiter,
        List<String> headerStrings
        ) throws DeserializingException, IOException
    {
        return new CsvDeserializer().setFieldDelimiter(fieldDelimiter)
                                    .setRecordDelimiter(recordDelimiter)
                                    .setHeaderStrings(headerStrings)
                                    .deserializeFromReader(reader, clazz);
    }

    public <T> List<T> deserializeFromReader(
        Reader reader,
        final Class<T> clazz
        ) throws DeserializingException, IOException
    {
        Preconditions.checkNotNull(reader);
        List<T> result = Lists.newArrayList();
        CsvReader csvReader = new CsvReader(reader);
        csvReader.setDelimiter(fieldDelimiter);
        if (recordDelimiter != null) csvReader.setRecordDelimiter(recordDelimiter);

        List<String> headerStrings = null;
        if (this.headerStrings == null) {
            if (!csvReader.readHeaders()) throw new DeserializingException("Could not read headers");
            headerStrings = Lists.newArrayList(csvReader.getHeaders());
            // Strip carriage returns & BOM
            if (!headerStrings.isEmpty()) {
                headerStrings.set(headerStrings.size() - 1,
                    headerStrings.get(headerStrings.size() - 1).replace("\r", ""));
                headerStrings.set(0, CharMatcher.INVISIBLE.trimLeadingFrom(headerStrings.get(0)));
            }
        } else {
            headerStrings = this.headerStrings;
        }
        List<Setter> headers = getSettersFromHeaders(headerStrings, clazz);

        if (escapeMode != null && escapeMode != EscapeMode.DEFAULT) {
            csvReader.setEscapeMode(escapeMode.getValue());
        }

        while (csvReader.readRecord()) {
            List<String> line = Lists.newArrayList(csvReader.getValues());
            if (line.size() == headers.size()) {
                result.add(deserialize(headers, line, clazz));
            } else if (clazz.isAnnotationPresent(FixTokenMismatches.class)) {
                // TODO(joel): Possibly make this a Serialization param and add tests
                while (line.size() < headers.size()) {
                    line.add("");
                }
                while (line.size() > headers.size()) {
                    line.remove(line.size() - 1);
                }
                result.add(deserialize(headers, line, clazz));
            } else if (!clazz.isAnnotationPresent(IgnoreGarbageLines.class)) {
                throw new DeserializingException("Token count mismatch: The line has " +
                                                 line.size() + " tokens, while the header has " +
                                                 headers.size() + "\n" +
                                                 Joiner.on(",").useForNull("").join(line));
            }
        }

        return result;
    }

    private static <T> T deserialize(List<Setter> headers, List<String> line, final Class<T> clazz)
        throws DeserializingException
    {
        try {
            Constructor<T> constructor = clazz.getDeclaredConstructor();
            constructor.setAccessible(true);
            T instance = constructor.newInstance();

            int i = 0;
            for (Setter setter : headers) {
                if (setter != null) {
                    setter.set(
                        instance,
                        setter.preprocessAndHandleIfNecessary(
                            line.get(i), (Class<?>)setter.getType()));
                }
                ++i;
            }

            return instance;
        } catch (IllegalAccessException e) {
            throw new DeserializingException(e);
        } catch (NoSuchMethodException e) {
            throw new DeserializingException(e);
        } catch (InstantiationException e) {
            throw new DeserializingException(e);
        } catch (InvocationTargetException e) {
            throw new DeserializingException(e);
        }
    }

    private static <T> List<Setter> getSettersFromHeaders(List<String> headers, Class<T> clazz) {
        List<Setter> result = Lists.newArrayList();

        for (String header : headers) {
            result.add(null);
        }

        for (Setter setter : new SerializationWrapper(clazz, SerializationFormat.CSV).getSetters()) {
            int i;
            for (i = 0; i < headers.size() && !setter.matchName(headers.get(i)); ++i);

            if (i < headers.size()) {
                result.set(i, setter);
            }
        }

        return result;
    }

    public static enum EscapeMode {
        DEFAULT(-1),
        BACKSLASH(CsvReader.ESCAPE_MODE_BACKSLASH),
        DOUBLED(CsvReader.ESCAPE_MODE_DOUBLED),
        ;

        private final int value;
        private EscapeMode(int value) {
            this.value = value;
        }

        public int getValue() {
            return value;
        }
    }
}


text:
//
// Created by Aman LaChapelle on 5/25/17.
//
// pytorch_inference
// Copyright (c) 2017 Aman LaChapelle
// Full license at pytorch_inference/LICENSE.txt
//

#ifndef PYTORCH_INFERENCE_POOLING_HPP
#define PYTORCH_INFERENCE_POOLING_HPP

// STL
#include <vector>

// ArrayFire
#include <arrayfire.h>

// Project
#include "Layer.hpp"
#include "../functional/pooling.hpp"

namespace pytorch {
  /**
   * @class MaxPool2d "include/layers.hpp"
   * @file "include/layers.hpp"
   * @brief Equivalent to MaxPool2d in pytorch (with a caveat)
   *
   * This layer implements the forward pass of pytorch's nn.MaxPool2d module. This holds the pooling indices
   * inside itself - unpooling will be another challenge if it's even possible with this framework. For now,
   * we just store the indices in arrayfire format for future use.
   */
  class MaxPool2d : public Layer {
  private:
    pooling_params_t params;
    tensor indices;
  public:
    /**
     * @brief Constructs the MaxPool2d layer. Requires pooling parameters that are functionally equivalent to
     * the convolutional parameters.
     *
     * @param params Pooling parameters like window, stride, etc.
     */
    MaxPool2d(const pooling_params_t &params) : params(params) {}

    inline tensor get_indices() const {
      return indices;
    }

    /**
     * @brief Implements the forward pass
     *
     * @param input The input array to be pooled
     * @return The pooled array
     */
    inline std::vector<tensor> forward(const std::vector<tensor> &input){
      return {functional::maxpool(params, input[0], indices)};
    }

    /**
     * @brief Implements the forward pass
     *
     * @param input The input array to be pooled
     * @return The pooled array
     */
    inline std::vector<tensor> operator()(const std::vector<tensor> &input){
      return {functional::maxpool(params, input[0], indices)};
    }
  };

  /**
   * @class MaxUnool2d "include/layers.hpp"
   * @file "include/layers.hpp"
   * @brief Equivalent to MaxUnool2d in pytorch
   *
   * This layer implements the forward pass of pytorch's nn.MaxUnool2d module. This holds a pointer to a maxpool
   * layer from which to get the indices for the unpooling process.
   */
  class MaxUnpool2d : public Layer {
  private:
    pooling_params_t params;
    const MaxPool2d *mp_ref;
  public:
    /**
     * @brief Constructs the MaxUnpool2d layer. Requires pooling parameters that are functionally equivalent to
     * the convolutional parameters.
     *
     * @param params Pooling parameters like window, stride, etc.
     */
    MaxUnpool2d(const pooling_params_t &params, const MaxPool2d *mp_ref) : params(params), mp_ref(mp_ref) {}

    /**
     * @brief Implements the forward pass
     *
     * @param input The input array to be unpooled
     * @return The unpooled array
     */
    inline std::vector<tensor> forward(const std::vector<tensor> &input){
      return {functional::unpool(params, input[0], mp_ref->get_indices())};
    }

    /**
     * @brief Implements the forward pass
     *
     * @param input The input array to be unpooled
     * @return The unpooled array
     */
    inline std::vector<tensor> operator()(const std::vector<tensor> &input){
      return {functional::unpool(params, input[0], mp_ref->get_indices())};
    }
  };

  /**
   * @class AvgPool2d "include/layers.hpp"
   * @file "include/layers.hpp"
   * @brief Equivalent to AvgPool2d in pytorch
   *
   * This layer implements the forward pass of pytorch's nn.AvgPool2d module. It doesn't do anything fancy,
   * just takes the mean of the various windows.
   */
  class AvgPool2d : public Layer {
  private:
    pooling_params_t params;
  public:
    /**
     * @brief Constructs the AvgPool2d layer. Requires pooling parameters that are functionally
     * identical to the convolution parameters.
     *
     * @param params Pooling parameters
     */
    AvgPool2d(const pooling_params_t &params) : params(params) {}

    /**
     * @brief Implements the forwards pass
     *
     * @param input The input array to be pooled
     * @return The pooled array
     */
    inline std::vector<tensor> forward(const std::vector<tensor> &input){
      return {functional::avgpool(params, input[0])};
    }

    /**
     * @brief Implements the forwards pass
     *
     * @param input The input array to be pooled
     * @return The pooled array
     */
    inline std::vector<tensor> operator()(const std::vector<tensor> &input){
      return {functional::avgpool(params, input[0])};
    }
  };
} // pytorch

#endif //PYTORCH_INFERENCE_POOLING_HPP


text:
from .base import (  # noqa: F401
    Dependency, DependencyException, DependencyMethods, ExternalProgram, ExternalLibrary, ExtraFrameworkDependency,
    InternalDependency, PkgConfigDependency, find_external_dependency, get_dep_identifier, packages)
from .dev import GMockDependency, GTestDependency, LLVMDependency, ValgrindDependency
from .misc import BoostDependency, Python3Dependency, ThreadDependency
from .platform import AppleFrameworks
from .ui import GLDependency, GnuStepDependency, Qt4Dependency, Qt5Dependency, SDL2Dependency, WxDependency

packages.update({
    # From dev:
    'gtest': GTestDependency,
    'gmock': GMockDependency,
    'llvm': LLVMDependency,
    'valgrind': ValgrindDependency,

    # From misc:
    'boost': BoostDependency,
    'python3': Python3Dependency,
    'threads': ThreadDependency,

    # From platform:
    'appleframeworks': AppleFrameworks,

    # From ui:
    'gl': GLDependency,
    'gnustep': GnuStepDependency,
    'qt4': Qt4Dependency,
    'qt5': Qt5Dependency,
    'sdl2': SDL2Dependency,
    'wxwidgets': WxDependency,
})


text:
day: 	5
title:	Advent, Advent,
active: active
---

### [Pascal Simon](https://github.com/psunix)
[Cryptopus](https://github.com/puzzle/cryptopus): Heute hat Cryptopus development seeds für die User erhalten.

### [Max Burri](https://github.com/mburri)
[Man kann jetzt tatsächlich spielen (und verlieren)](http://mburri.github.io/break-out/dist/index.html)
- ich musste einige Teile der Applikation anpassen und habe einiges über die redux reducers, vor allem über die Kombination mehrerer reducers, gelernt.
- aus heiterem Himmel kam mein erster (nicht Puzzler) Follower [vom anderen Ende der Welt](https://github.com/TomClarkson).

### [Philipp Matti](https://github.com/phil-matti)
[c-for-sys-linux](https://github.com/phil-matti/c-for-sys-linux) Ich erstelle einige Beispiele für die Nutzung von C unter Linux. Ziel ist es, einen eigenen Daemon zu programmieren und möglichst viel dabei zu lernen.

### [Thomas Philipona](https://github.com/phil-pona)
Copy & Paste Fehler im offiziellen Wildfly 9 STI Dockerfile gefixed und per [Pull Request](https://github.com/openshift/sti-wildfly/pull/62) eingegeben, Pull Request gemerged.
Zusätzlich habe ich heute den Wildfly 10.0.0CR4 im OpenShift [Wildfly S2I Repo](https://github.com/phil-pona/sti-wildfly/) hinzugefügt und dafür einen [Pull Request](https://github.com/openshift/sti-wildfly/pull/63) erstellt.

### [Oliver Gugger](https://github.com/guggero)
Initiales Projekt-Setup für das AngularJS-Modul [ng-user-auth](https://github.com/guggero/ng-user-auth): Projekt-Skeleton mit Karma-Tests und Travis-CI-Integration.

### [Lorenz Bischof](https://github.com/lbischof)
Ich habe heute mehrere kleine Änderungen an [Puzzle Forms](https://github.com/lbischof/puzzle-forms) gemacht. Es gibt jetzt neu ein Configfile und der Prozess im Dockercontainer läuft nicht mehr als root. Zusätzlich habe ich eine neue Library eingesetzt welche das neue [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) einsetzt und endlich [XMLHttpRequest](https://developer.mozilla.org/de/docs/Web/API/XMLHttpRequest) ablöst.

### [Janiss Binder](https://github.com/janissbinder)
Heute habe ich das ERD vom Cryptopus erneuert: <https://github.com/puzzle/cryptopus/wiki>

### [Daniel Tschan](https://github.com/dtschan)
OpenShift Enterprise 3.1 enthält nun einen integrierten EFK (Elasticsearch, Fluentd, Kibana) Stack um alle Container- und Platformlogs aggregrieren und analysieren zu können. Dessen Installation erfordert momentan noch diverse manuelle Schritte. Ich habe heute begonnen diese in unserem OpenShift 3 Puppet Modul zu automatisieren: <https://github.com/puzzle/puppet-openshift3/commits/logging>

### [Philipp Gassmann](https://github.com/pgassmann)
Letsencrypt Puppet Modul auf Forge hochgeladen: <https://forge.puppetlabs.com/pgassmann/letsencrypt>
Alternatives Letsencrypt Puppetmodul gefunden: <https://forge.puppetlabs.com/danzilio/letsencrypt>

### [Daniel Binggeli](https://github.com/drnoa)
[bumblebee-installer](https://github.com/drnoa/bumblebee-installer) um Konfigurationsteil erweitert. Ist sicher noch nicht für jeden Rechner geeignet, aber lokal funktioniert das ganze bereits.

### [Philipp Grogg](https://github.com/gro-gg)
Dokumentation des Java Profilers [modjprof](https://github.com/gro-gg/modjprof) ergänzt.


text:
runkit_function_redefine() and revert
--SKIPIF--
<?php if(!extension_loaded("runkit") || !RUNKIT_FEATURE_MANIPULATION) print "skip"; ?>
--INI--
error_reporting=E_ALL
display_errors=on
runkit.internal_override=On
--FILE--
<?php
//xdebug_start_code_coverage();
echo sprintf("%s\n",'bar');
runkit_function_copy('sprintf','sprintf_old');
runkit_function_redefine('sprintf','$a,$b', 'return "new function\n" . sprintf_old($a,$b);');
echo sprintf("%s\n",'bar');
runkit_function_remove('sprintf');
runkit_function_copy('sprintf_old','sprintf');
runkit_function_remove('sprintf_old');
echo sprintf("%s\n",'foo');
?>
--EXPECT--
bar
new function
bar
foo


text:
package metrics

import (
	"time"
)

func InMicroseconds(d time.Duration) float64 {
	return float64(d.Nanoseconds() / time.Microsecond.Nanoseconds())
}

type (
	Counter func(...string)
	Adder   func(float64, ...string)
	Watcher func(float64, ...string)
)

// Int adds the value of `x`; convenience func for adding integers.
func (a Adder) Int(x int, s ...string) {
	a(float64(x), s...)
}

// Since records an observation of time.Now().Sub(t) in microseconds
func (w Watcher) Since(t time.Time, s ...string) {
	w(InMicroseconds(time.Now().Sub(t)), s...)
}

// Harness funcs execute the given func and record metrics concerning the execution. The error
// returned from the harness is the same error returned from the execution of the func param.
type Harness func(func() error, ...string) error

// NewHarness generates and returns an execution harness that records metrics. `counts` and `errors`
// are required; `timed` and `clock` must either both be nil, or both be non-nil.
func NewHarness(counts, errors Counter, timed Watcher, clock func() time.Time) Harness {
	var harness Harness
	if timed != nil && clock != nil {
		harness = func(f func() error, labels ...string) error {
			counts(labels...)
			var (
				t   = clock()
				err = f()
			)
			timed.Since(t, labels...)
			if err != nil {
				errors(labels...)
			}
			return err
		}
	} else {
		harness = func(f func() error, labels ...string) error {
			counts(labels...)
			err := f()
			if err != nil {
				errors(labels...)
			}
			return err
		}
	}
	return harness
}


text:
Before you continue, make sure you have your SSO integration Client ID. You will use the Client ID to replace the `SSO_CLIENT_ID` placeholders.

![Locate Client ID](https://auth0.com/docs/media/articles/dashboard/sso-integrations/dashboard-integrations-sso-create_view-tutorial.png)

1. Log in to SpringCM as an admin.

2. Select the **SAML SSO** menu under **Account Preferences**.

3. Enter the **Issuer**:
`urn:${account.namespace}`

4. Enter the **Service Provider (SP) Initiated Endpoint** (be sure to replace the SSO_CLIENT_ID placeholder with the Client ID of your SSO Integration):
`https://${account.namespace}/samlp/SSO_CLIENT_ID`

Alternatively, to log in with a specific identity provider, you can add a `connection` parameter (be sure to replace the SSO_CLIENT_ID placeholder with the Client ID of your SSO Integration):
```text
https://${account.namespace}/samlp/SSO_CLIENT_ID?connection=email
https://${account.namespace}/samlp/SSO_CLIENT_ID?connection=google-oauth2
https://${account.namespace}/samlp/SSO_CLIENT_ID?connection=Username-Password-Authentication
```

In this case, Auth0 will redirect users to the specified connection and will not display the Login widget. Make sure you send the SAMLRequest using `HTTP POST`.

5. [Download your Auth0 signing certificate](https://${account.namespace}/pem), and upload it to SpringCM. Then select the uploaded file as the **Issuing Certificate**.


text:
require 'spec_helper'

describe Ruote::Synchronize::Broker do

  before :each do

    @board = Ruote::Dashboard.new(Ruote::Worker.new(Ruote::HashStorage.new))

    @board.register(/^block_/) do |workitem|
      workitem.fields[workitem.participant_name] = 'was here'
    end

    Ruote::Synchronize.setup(@board)

  end

  after :each do

    @board.shutdown
    @board.storage.purge!

  end

  context '#initialize' do

    it 'accepts a context' do

      expect{Ruote::Synchronize::Broker.new}.to raise_error
      expect{Ruote::Synchronize::Broker.new(@board.context)}.not_to raise_error

    end

    it 'registers the synchronize participant' do

      sync = Ruote::Synchronize::Broker.new(@board.context)
      expect(@board.participant('synchronize')).not_to be_nil
      expect(@board.participant('synchronize').class).to eq(Ruote::Synchronize::Participant)

    end

  end

  context '#publish' do

    let(:sync) { Ruote::Synchronize::Broker.new(@board.context) }
    let(:key) { 'my_key' }
    let(:workitem) { Ruote::Workitem.new({'abc'=> true}) }

    context 'with a fresh storage' do

      it 'stores the workitem with the message' do
        sync.publish(key, workitem)
        expect(@board.context.storage.get('synchronize', key)['workitem']).to eq(workitem.to_h)
      end

      it 'returns false' do
        expect(sync.publish(key, workitem).is_a? FalseClass).to be_true
      end

    end

    context 'with a previously published message' do

      before :each do
        sync.publish(key, workitem)
      end

      let(:another_workitem) { Ruote::Workitem.new({:def => true})  }

      it 'deletes the previous message' do
        sync.publish(key, another_workitem)
        expect(@board.context.storage.get('synchronize', key)).to be_nil

      end

      it 'returns true' do
        expect(sync.publish(key, another_workitem).is_a? TrueClass).to be_true
      end

      it 'receives the previous workitem' do
        sync.should_receive(:receive).with(workitem)
        sync.publish(key, another_workitem)
      end

    end

  end

  context '#unpublish' do

    let(:sync) { Ruote::Synchronize::Broker.new(@board.context) }
    let(:key) { 'my_key' }
    let(:workitem) { Ruote::Workitem.new({'abc'=> true}) }

    context 'with a fresh storage' do

      it 'returns nil' do
        expect(sync.unpublish(key)).to be_nil
      end

    end

    context 'with a previously published message' do

      before :each do
        sync.publish(key, workitem)
      end

      it 'deletes the previous message' do
        sync.unpublish(key)
        expect(@board.context.storage.get('synchronize', key)).to be_nil
      end

    end

  end

end


text:
package org.jabref.logic.importer.fileformat;

import java.io.BufferedReader;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.regex.Pattern;

import javax.xml.datatype.XMLGregorianCalendar;

import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.importer.fileformat.bibtexml.Entry;
import org.jabref.logic.importer.fileformat.bibtexml.File;
import org.jabref.logic.importer.fileformat.bibtexml.Inbook;
import org.jabref.logic.importer.fileformat.bibtexml.Incollection;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.Month;
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.FieldFactory;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.types.StandardEntryType;

import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Unmarshaller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Importer for the BibTeXML format.
 *

 * check here for details on the format
 * http://bibtexml.sourceforge.net/
 */
public class BibTeXMLImporter extends Importer {

    private static final Logger LOGGER = LoggerFactory.getLogger(BibTeXMLImporter.class);

    private static final Pattern START_PATTERN = Pattern.compile("<(bibtex:)?file .*");

    private static final List<String> IGNORED_METHODS = Arrays.asList("getClass", "getAnnotate", "getContents",
            "getPrice", "getSize", "getChapter");

    @Override
    public String getName() {
        return "BibTeXML";
    }

    @Override
    public StandardFileType getFileType() {
        return StandardFileType.BIBTEXML;
    }

    @Override
    public String getDescription() {
        return "Importer for the BibTeXML format.";
    }

    @Override
    public boolean isRecognizedFormat(BufferedReader reader) throws IOException {
        // Our strategy is to look for the "<bibtex:file *" line.
        String str;
        while ((str = reader.readLine()) != null) {
            if (START_PATTERN.matcher(str).find()) {
                return true;
            }
        }
        return false;
    }

    @Override
    public ParserResult importDatabase(BufferedReader reader) throws IOException {
        Objects.requireNonNull(reader);

        List<BibEntry> bibItems = new ArrayList<>();

        try {
            JAXBContext context = JAXBContext.newInstance("org.jabref.logic.importer.fileformat.bibtexml");
            Unmarshaller unmarshaller = context.createUnmarshaller();
            File file = (File) unmarshaller.unmarshal(reader);

            List<Entry> entries = file.getEntry();
            Map<Field, String> fields = new HashMap<>();

            for (Entry entry : entries) {
                BibEntry bibEntry = new BibEntry();
                if (entry.getArticle() != null) {
                    bibEntry.setType(StandardEntryType.Article);
                    parse(entry.getArticle(), fields);
                } else if (entry.getBook() != null) {
                    bibEntry.setType(StandardEntryType.Book);
                    parse(entry.getBook(), fields);
                } else if (entry.getBooklet() != null) {
                    bibEntry.setType(StandardEntryType.Booklet);
                    parse(entry.getBooklet(), fields);
                } else if (entry.getConference() != null) {
                    bibEntry.setType(StandardEntryType.Conference);
                    parse(entry.getConference(), fields);
                } else if (entry.getInbook() != null) {
                    bibEntry.setType(StandardEntryType.InBook);
                    parseInbook(entry.getInbook(), fields);
                } else if (entry.getIncollection() != null) {
                    bibEntry.setType(StandardEntryType.InCollection);
                    Incollection incollection = entry.getIncollection();
                    if (incollection.getChapter() != null) {
                        fields.put(StandardField.CHAPTER, String.valueOf(incollection.getChapter()));
                    }
                    parse(incollection, fields);
                } else if (entry.getInproceedings() != null) {
                    bibEntry.setType(StandardEntryType.InProceedings);
                    parse(entry.getInproceedings(), fields);
                } else if (entry.getManual() != null) {
                    bibEntry.setType(StandardEntryType.Manual);
                    parse(entry.getManual(), fields);
                } else if (entry.getMastersthesis() != null) {
                    bibEntry.setType(StandardEntryType.MastersThesis);
                    parse(entry.getMastersthesis(), fields);
                } else if (entry.getMisc() != null) {
                    bibEntry.setType(StandardEntryType.Misc);
                    parse(entry.getMisc(), fields);
                } else if (entry.getPhdthesis() != null) {
                    bibEntry.setType(StandardEntryType.PhdThesis);
                    parse(entry.getPhdthesis(), fields);
                } else if (entry.getProceedings() != null) {
                    bibEntry.setType(StandardEntryType.Proceedings);
                    parse(entry.getProceedings(), fields);
                } else if (entry.getTechreport() != null) {
                    bibEntry.setType(StandardEntryType.TechReport);
                    parse(entry.getTechreport(), fields);
                } else if (entry.getUnpublished() != null) {
                    bibEntry.setType(StandardEntryType.Unpublished);
                    parse(entry.getUnpublished(), fields);
                }

                if (entry.getId() != null) {
                    bibEntry.setCitationKey(entry.getId());
                }
                bibEntry.setField(fields);
                bibItems.add(bibEntry);
            }
        } catch (JAXBException e) {
            LOGGER.error("Error with XML parser configuration", e);
            return ParserResult.fromError(e);
        }
        return new ParserResult(bibItems);
    }

    /**
     * We use a generic method and not work on the real classes, because they all have the same behaviour. They call all get methods
     * that are needed and use the return value. So this will prevent writing similar methods for every type.
     *

     * In this method, all get methods that entryType has will be used and their value will be put to fields,
     * if it is not null. So for example if entryType has the method getAbstract, then
     * "abstract" will be put as key to fields and the value of getAbstract will be put as value to fields.
     * Some get methods shouldn't be mapped to fields, so getClass for example will be skipped.
     *
     * @param entryType This can be all possible BibTeX types. It contains all fields of the entry and their values.
     * @param fields    A map where the name and the value of all fields that the entry contains will be put.
     */
    private <T> void parse(T entryType, Map<Field, String> fields) {
        Method[] declaredMethods = entryType.getClass().getDeclaredMethods();
        for (Method method : declaredMethods) {
            try {
                if (method.getName().equals("getYear")) {
                    putYear(fields, (XMLGregorianCalendar) method.invoke(entryType));
                    continue;
                } else if (method.getName().equals("getNumber")) {
                    putNumber(fields, (BigInteger) method.invoke(entryType));
                    continue;
                } else if (method.getName().equals("getMonth")) {
                    putMonth(fields, Month.parse((String) method.invoke(entryType)));
                    continue;
                } else if (isMethodToIgnore(method.getName())) {
                    continue;
                } else if (method.getName().startsWith("get")) {
                    putIfValueNotNull(fields, FieldFactory.parseField(entryType, method.getName().replace("get", "")), (String) method.invoke(entryType));
                }
            } catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
                LOGGER.error("Could not invoke method", e);
            }
        }
    }

    /**
     * Returns whether the value of the given method name should be mapped or whether the method can be ignored.
     *
     * @param methodName The name of the method as String
     * @return true if the method can be ignored, else false
     */
    private boolean isMethodToIgnore(String methodName) {
        return IGNORED_METHODS.contains(methodName);
    }

    /**
     * Inbook needs a special Treatment, because inbook.getContent() returns a list of JAXBElements.
     * The other types have just get methods, which return the values as Strings.
     */
    private void parseInbook(Inbook inbook, Map<Field, String> fields) {
        List<JAXBElement<?>> content = inbook.getContent();
        for (JAXBElement<?> element : content) {
            Field field = FieldFactory.parseField(element.getName().getLocalPart());
            Object elementValue = element.getValue();
            if (elementValue instanceof String) {
                String value = (String) elementValue;
                if (StandardField.MONTH.equals(field)) {
                    putMonth(fields, Month.parse(value));
                } else {
                    putIfValueNotNull(fields, field, value);
                }
            } else if (elementValue instanceof BigInteger) {
                BigInteger value = (BigInteger) elementValue;
                if (StandardField.NUMBER.equals(field)) {
                    fields.put(StandardField.NUMBER, String.valueOf(value));
                } else if (StandardField.CHAPTER.equals(field)) {
                    fields.put(StandardField.CHAPTER, String.valueOf(value));
                }
            } else if (elementValue instanceof XMLGregorianCalendar) {
                XMLGregorianCalendar value = (XMLGregorianCalendar) elementValue;
                if (StandardField.YEAR.equals(field)) {
                    putYear(fields, value);
                } else {
                    LOGGER.info("Unexpected field was found");
                }
            } else {
                LOGGER.info("Unexpected field was found");
            }
        }
    }

    private void putYear(Map<Field, String> fields, XMLGregorianCalendar year) {
        if (year != null) {
            fields.put(StandardField.YEAR, String.valueOf(year));
        }
    }

    private void putNumber(Map<Field, String> fields, BigInteger number) {
        if (number != null) {
            fields.put(StandardField.NUMBER, String.valueOf(number));
        }
    }

    private void putMonth(Map<Field, String> fields, Optional<Month> month) {
        if (month.isPresent()) {
            fields.put(StandardField.MONTH, month.get().getJabRefFormat());
        }
    }

    private void putIfValueNotNull(Map<Field, String> fields, Field field, String value) {
        if (value != null) {
            fields.put(field, value);
        }
    }
}


text:
layout: organization
category: national

title: Hands on New Orleans
impact_area: Disaster Relief
keywords:
location_services:
location_offices:
website: www.handsonneworleans.org

description:
mission: |
  HandsOn New Orleans inspires and motivates people to meet critical community needs by encouraging active citizenship through meaningful service.

cash_grants:
grants:
service_opp:
services:

learn:
cont_relationship:

salutation:
first_name:
last_name:
title_contact_person:

city: New Orleans
state: LA
address: |
  1050 S. Jefferson Davis Parkway
  New Orleans LA 70125
lat: 29.958885
lng: -90.10174
phone: 504-483-7041
ext:
fax: 504-483-7043
email:
preferred_contact:
contact_person_intro:
---


text:
package apps::pacemaker::local::mode::clustat;

use base qw(centreon::plugins::templates::counter);

use strict;
use warnings;
use centreon::plugins::misc;
use XML::Simple;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);

my %map_node_state = (
    0 => 'down',
    1 => 'up',
    2 => 'clean'
);

sub custom_state_output {
    my ($self, %options) = @_;

    return sprintf("state is '%s'", $self->{result_values}->{state});
}

sub set_counters {
    my ($self, %options) = @_;

    $self->{maps_counters_type} = [
        { name => 'nodes', type => 1, cb_prefix_output => 'prefix_node_output', message_multiple => 'All nodes are ok' },
        { name => 'groups', type => 1, cb_prefix_output => 'prefix_group_output', message_multiple => 'All groups/resources are ok' }
    ];

    $self->{maps_counters}->{nodes} = [
        { label => 'node', type => 2, critical_default => '%{state} !~ /up|clean/', set => {
                key_values => [ { name => 'state' }, { name => 'display' } ],
                closure_custom_output => $self->can('custom_state_output'),
                closure_custom_threshold_check => \&catalog_status_threshold_ng,
                closure_custom_perfdata => sub { return 0; }
            }
        }
    ];

    $self->{maps_counters}->{groups} = [
        { label => 'group', type => 2, critical_default => '%{state} !~ /starting|started/', set => {
                key_values => [ { name => 'state' }, { name => 'display' } ],
                closure_custom_output => $self->can('custom_state_output'),
                closure_custom_threshold_check => \&catalog_status_threshold_ng,
                closure_custom_perfdata => sub { return 0; }
            }
        }
    ];
}

sub prefix_node_output {
    my ($self, %options) = @_;

    return "Node: '" . $options{instance_value}->{display} . "' ";
}

sub prefix_group_output {
    my ($self, %options) = @_;

    return "Resource group: '" . $options{instance_value}->{display} . "' ";
}

sub new {
    my ($class, %options) = @_;
    my $self = $class->SUPER::new(package => __PACKAGE__, %options);
    bless $self, $class;

    $options{options}->add_options(arguments => {
        'filter-node:s'    => { name => 'filter_node' },
        'filter-groups:s'  => { name => 'filter_groups' }
    });

    return $self;
}

sub manage_selection {
    my ($self, %options) = @_;

    my ($stdout) = $options{custom}->execute_command(
        command => 'clustat',
        command_path => '/usr/sbin',
        command_options => '-x 2>&1'
    );

    my $clustat_hash = XMLin($stdout);

    foreach my $node (keys %{$clustat_hash->{nodes}->{node}}) {
        if (defined($self->{option_results}->{filter_node}) && $self->{option_results}->{filter_node} ne '' &&
            $node !~ /$self->{option_results}->{filter_node}/) {
            $self->{output}->output_add(long_msg => "skipping peer '" . $node . "': no matching filter.", debug => 1);
            next;
        }

        $self->{nodes}->{$node} = {
            display => $node,
            state => $map_node_state{$clustat_hash->{nodes}->{node}->{$node}->{state}}
        };
    }

    foreach my $group_name (keys %{$clustat_hash->{groups}->{group}}) {
        if (defined($self->{option_results}->{filter_group}) && $self->{option_results}->{filter_group} ne '' &&
            $group_name !~ /$self->{option_results}->{filter_group}/) {
            $self->{output}->output_add(long_msg => "skipping peer '" . $group_name . "': no matching filter.", debug => 1);
            next;
        }

        $self->{groups}->{$group_name} = {
            display => $group_name,
            state => $clustat_hash->{groups}->{group}->{$group_name}->{state_str}
        };
    }

}

1;

__END__

=head1 MODE

Check Cluster Resource Manager (need 'clustat' command).
Should be executed on a cluster node.

Command used: /usr/sbin/clustat -x 2>&1

=over 8

=item B<--warning-*>

Can be ('group','node')
Warning threshold for status.

=item B<--critical-*>

Can be ('group','node')
Critical threshold for status. (Default: --critical-node '%{state} !~ /up|clean/' --critical-group '%{state} !~ /started|starting/')

=back

=cut