text:
namespace spot
{

  tgta_explicit::tgta_explicit(const const_twa_ptr& tgba,
                               unsigned n_acc,
                               state_ta_explicit* artificial_initial_state) :
    tgta(tgba->get_dict()),
    ta_(make_ta_explicit(tgba, n_acc, artificial_initial_state))
  {
  }

  state*
  tgta_explicit::get_init_state() const
  {
    return ta_->get_artificial_initial_state();
  }

  twa_succ_iterator*
  tgta_explicit::succ_iter(const spot::state* state) const
  {
    return ta_->succ_iter(state);
  }

  std::string
  tgta_explicit::format_state(const spot::state* s) const
  {
    return ta_->format_state(s);
  }

  spot::twa_succ_iterator*
  tgta_explicit::succ_iter_by_changeset(const spot::state* s, bdd chngset) const
  {
    return ta_->succ_iter(s, chngset);
  }

}


text:
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved
// Plugin written by Philipp Buerki. Copyright 2017. All Rights reserved..

#pragma once

#include "CoreMinimal.h"
#include "UObject/CoreOnline.h"
#include "OnlineSubsystemB3atZTypes.h"
#include "OnlineDelegateMacros.h"

class FOnlineSession;
class FOnlineSessionSearchB3atZ;
class FOnlineSessionSearchResult;
class FOnlineSessionSettings;

/**
 * Delegate fired when a session create request has completed
 *
 * @param SessionName the name of the session this callback is for
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnCreateSessionComplete, FName, bool);
typedef FOnCreateSessionComplete::FDelegate FOnCreateSessionCompleteDelegate;

/**
 * Delegate fired when the online session has transitioned to the started state
 *
 * @param SessionName the name of the session the that has transitioned to started
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnStartSessionComplete, FName, bool);
typedef FOnStartSessionComplete::FDelegate FOnStartSessionCompleteDelegate;

/**
 * Delegate fired when a update session request has completed
 *
 * @param SessionName the name of the session this callback is for
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnUpdateSessionComplete, FName, bool);
typedef FOnUpdateSessionComplete::FDelegate FOnUpdateSessionCompleteDelegate;

/**
 * Delegate fired when the online session has transitioned to the ending state
 *
 * @param SessionName the name of the session the that was ended
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnEndSessionComplete, FName, bool);
typedef FOnEndSessionComplete::FDelegate FOnEndSessionCompleteDelegate;

/**
 * Delegate fired when a destroying an online session has completed
 *
 * @param SessionName the name of the session this callback is for
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnDestroySessionComplete, FName, bool);
typedef FOnDestroySessionComplete::FDelegate FOnDestroySessionCompleteDelegate;

/**
 * Delegate fired when the Matchmaking for an online session has completed
 *
 * @param SessionName the name of the session the that can now be joined (on success)
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnMatchmakingComplete, FName, bool);
typedef FOnMatchmakingComplete::FDelegate FOnMatchmakingCompleteDelegate;

/**
 * Delegate fired when the Matchmaking request has been canceled
 *
 * @param SessionName the name of the session that was passed to StartMatchmaking
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnCancelMatchmakingComplete, FName, bool);
typedef FOnCancelMatchmakingComplete::FDelegate FOnCancelMatchmakingCompleteDelegate;

/**
 * Delegate fired when the search for an online session has completed
 *
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
DECLARE_MULTICAST_DELEGATE_OneParam(FOnFindSessionsComplete, bool);
typedef FOnFindSessionsComplete::FDelegate FOnFindSessionsCompleteDelegate;

/**
 * Delegate fired when the cancellation of a search for an online session has completed
 *
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
DECLARE_MULTICAST_DELEGATE_OneParam(FOnCancelFindSessionsComplete, bool);
typedef FOnCancelFindSessionsComplete::FDelegate FOnCancelFindSessionsCompleteDelegate;

/** Possible results of a JoinSession attempt */
namespace EOnJoinSessionCompleteResult
{
	enum Type
	{
		/** The join worked as expected */
		Success,
		/** There are no open slots to join */
		SessionIsFull,
		/** The session couldn't be found on the service */
		SessionDoesNotExist,
		/** There was an error getting the session server's address */
		CouldNotRetrieveAddress,
		/** The user attempting to join is already a member of the session */
		AlreadyInSession,
		/** An error not covered above occurred */
		UnknownError
	};
}
/**
 * Delegate fired when the joining process for an online session has completed
 *
 * @param SessionName the name of the session this callback is for
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnJoinSessionComplete, FName, EOnJoinSessionCompleteResult::Type);
typedef FOnJoinSessionComplete::FDelegate FOnJoinSessionCompleteDelegate;

/**
 * Delegate fired once a single search result is returned (ie friend invite / join)
 * Session has not been joined at this point, and requires a call to JoinSession()
 *
 * @param LocalUserNum the controller number of the accepting user
 * @param bWasSuccessful the session was found and is joinable, false otherwise
 * @param SearchResult the search/settings for the session result we've been given
 */
DECLARE_MULTICAST_DELEGATE_ThreeParams(FOnSingleSessionResultComplete, int32, bool, const FOnlineSessionSearchResult&);
typedef FOnSingleSessionResultComplete::FDelegate FOnSingleSessionResultCompleteDelegate;

/**
 * Delegate fired once the find friend task has completed
 * Session has not been joined at this point, and requires a call to JoinSession()
 *
 * @param LocalUserNum the controller number of the accepting user
 * @param bWasSuccessful the session was found and is joinable, false otherwise
 * @param FriendSearchResult the search/settings for the session we're attempting to join
 */
typedef FOnSingleSessionResultComplete FOnFindFriendSessionComplete;
typedef FOnFindFriendSessionComplete::FDelegate FOnFindFriendSessionCompleteDelegate;

/**
 * Delegate fired when an individual server's query has completed
 *
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
DECLARE_MULTICAST_DELEGATE_OneParam(FOnPingSearchResultsComplete, bool);
typedef FOnPingSearchResultsComplete::FDelegate FOnPingSearchResultsCompleteDelegate;

/**
 * Called when a user accepts a session invitation. Allows the game code a chance
 * to clean up any existing state before accepting the invite. The invite must be
 * accepted by calling JoinSession() after clean up has completed
 *
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 * @param ControllerId the controller number of the accepting user
 * @param UserId the user being invited
 * @param InviteResult the search/settings for the session we're joining via invite
 */
DECLARE_MULTICAST_DELEGATE_FourParams(FOnSessionUserInviteAccepted, const bool, const int32, TSharedPtr<const FUniqueNetId>, const FOnlineSessionSearchResult&);
typedef FOnSessionUserInviteAccepted::FDelegate FOnSessionUserInviteAcceptedDelegate;

/**
 * Called when a user receives a session invitation. Allows the game code to decide
 * on accepting the invite. The invite can be accepted by calling JoinSession()
 *
 * @param UserId the user being invited
 * @param FromId the user that sent the invite
 * @param AppId the id of the client/app user was in when sending hte game invite
 * @param InviteResult the search/settings for the session we're joining via invite
 */
DECLARE_MULTICAST_DELEGATE_FourParams(FOnSessionInviteReceived, const FUniqueNetId& /*UserId*/, const FUniqueNetId& /*FromId*/, const FString& /*AppId*/, const FOnlineSessionSearchResult& /*InviteResult*/);
typedef FOnSessionInviteReceived::FDelegate FOnSessionInviteReceivedDelegate;

/**
 * Delegate fired when the session registration process has completed
 *
 * @param SessionName the name of the session the player joined or not
 * @param Players the players that were registered from the online service
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
DECLARE_MULTICAST_DELEGATE_ThreeParams(FOnRegisterPlayersComplete, FName, const TArray< TSharedRef<const FUniqueNetId> >&, bool);
typedef FOnRegisterPlayersComplete::FDelegate FOnRegisterPlayersCompleteDelegate;

/**
 * Delegate fired when the un-registration process has completed
 *
 * @param SessionName the name of the session the player left
 * @param PlayerId the players that were unregistered from the online service
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
DECLARE_MULTICAST_DELEGATE_ThreeParams(FOnUnregisterPlayersComplete, FName, const TArray< TSharedRef<const FUniqueNetId> >&, bool);
typedef FOnUnregisterPlayersComplete::FDelegate FOnUnregisterPlayersCompleteDelegate;

/**
 * Delegate fired when local player registration has completed
 */
DECLARE_DELEGATE_TwoParams(FOnRegisterLocalPlayerCompleteDelegate, const FUniqueNetId&, EOnJoinSessionCompleteResult::Type);

/**
 * Delegate fired when local player unregistration has completed
 */
DECLARE_DELEGATE_TwoParams(FOnUnregisterLocalPlayerCompleteDelegate, const FUniqueNetId&, const bool);

/** Possible reasons for the service to cause a session failure */
namespace ESessionFailure
{
	enum Type
	{
		/** General loss of connection */
		ServiceConnectionLost
	};
}

/**
 * Delegate fired when an unexpected error occurs that impacts session connectivity or use
 *
 * @param PlayerId The player impacted by the failure (may be empty if unknown, or if all players are affected)
 * @param FailureType What kind of failure occurred
 */
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnSessionFailure, const FUniqueNetId&, ESessionFailure::Type);
typedef FOnSessionFailure::FDelegate FOnSessionFailureDelegate;

/**
 * Interface definition for the online services session services
 * Session services are defined as anything related managing a session
 * and its state within a platform service
 */
class IOnlineSession
{
protected:

	/** Hidden on purpose */
	IOnlineSession() {};

	/**
	 * Adds a new named session to the list (new session)
	 *
	 * @param SessionName the name to search for
	 * @param GameSettings the game settings to add
	 *
	 * @return a pointer to the struct that was added
	 */
	virtual class FNamedOnlineSession* AddNamedSession(FName SessionName, const FOnlineSessionSettings& SessionSettings) = 0;

	/**
	 * Adds a new named session to the list (from existing session data)
	 *
	 * @param SessionName the name to search for
	 * @param GameSettings the game settings to add
	 *
	 * @return a pointer to the struct that was added
	 */
	virtual class FNamedOnlineSession* AddNamedSession(FName SessionName, const FOnlineSession& Session) = 0;

public:
	virtual ~IOnlineSession() {};

	/**
	 * Searches the named session array for the specified session
	 *
	 * @param SessionName the name to search for
	 *
	 * @return pointer to the struct if found, NULL otherwise
	 */
	virtual class FNamedOnlineSession* GetNamedSession(FName SessionName) = 0;

	/**
	 * Searches the named session array for the specified session and removes it
	 *
	 * @param SessionName the name to search for
	 */
	virtual void RemoveNamedSession(FName SessionName) = 0;

	/**
	 * Searches the named session array for any presence enabled session
	 */
	virtual bool HasPresenceSession() = 0;

	/**
	 * Get the current state of a named session
	 *
	 * @param SessionName name of session to query
	 *
	 * @return State of specified session
	 */
	virtual EB3atZOnlineSessionState::Type GetSessionState(FName SessionName) const = 0;

	/**
	 * Creates an online session based upon the settings object specified.
	 * NOTE: online session registration is an async process and does not complete
	 * until the OnCreateSessionComplete delegate is called.
	 *
	 * @param HostingPlayerNum the index of the player hosting the session
	 * @param SessionName the name to use for this session so that multiple sessions can exist at the same time
	 * @param NewSessionSettings the settings to use for the new session
	 *
	 * @return true if successful creating the session, false otherwise
	 */
	virtual bool CreateSession(int32 HostingPlayerNum, FName SessionName, const FOnlineSessionSettings& NewSessionSettings) = 0;

	/**
	 * Creates an online session based upon the settings object specified.
	 * NOTE: online session registration is an async process and does not complete
	 * until the OnCreateSessionComplete delegate is called.
	 *
	 * @param HostingPlayerId the index of the player hosting the session
	 * @param SessionName the name to use for this session so that multiple sessions can exist at the same time
	 * @param NewSessionSettings the settings to use for the new session
	 *
	 * @return true if successful creating the session, false otherwise
	 */
	virtual bool CreateSession(const FUniqueNetId& HostingPlayerId, FName SessionName, const FOnlineSessionSettings& NewSessionSettings) = 0;

	/**
	* Delegate fired when a session create request has completed
	*
	* @param SessionName the name of the session this callback is for
	* @param bWasSuccessful true if the async action completed without error, false if there was an error
	*/
	DEFINE_ONLINE_DELEGATE_TWO_PARAM(OnCreateSessionComplete, FName, bool);

	virtual int32 GetPort() = 0;

	/**
	 * Marks an online session as in progress (as opposed to being in lobby or pending)
	 *
	 * @param SessionName the name of the session that is being started
	 *
	 * @return true if the call succeeds, false otherwise
	 */
	virtual bool StartSession(FName SessionName) = 0;

	/**
	 * Delegate fired when the online session has transitioned to the started state
	 *
	 * @param SessionName the name of the session the that has transitioned to started
	 * @param bWasSuccessful true if the async action completed without error, false if there was an error
	 */
	DEFINE_ONLINE_DELEGATE_TWO_PARAM(OnStartSessionComplete, FName, bool);

	/**
	 * Updates the localized settings/properties for the session in question
	 *
	 * @param SessionName the name of the session to update
	 * @param UpdatedSessionSettings the object to update the session settings with
	 * @param bShouldRefreshOnlineData whether to submit the data to the backend or not
	 *
	 * @return true if successful creating the session, false otherwise
	 */
	virtual bool UpdateSession(FName SessionName, FOnlineSessionSettings& UpdatedSessionSettings, bool bShouldRefreshOnlineData = true) = 0;

	/**
	 * Delegate fired when a update request has completed
	 *
	 * @param SessionName the name of the session this callback is for
	 * @param bWasSuccessful true if the async action completed without error, false if there was an error
	 */
	DEFINE_ONLINE_DELEGATE_TWO_PARAM(OnUpdateSessionComplete, FName, bool);

	/**
	 * Marks an online session as having been ended
	 *
	 * @param SessionName the name of the session the to end
	 *
	 * @return true if the call succeeds, false otherwise
	 */
	virtual bool EndSession(FName SessionName) = 0;

	/**
	 * Delegate fired when the online session has transitioned to the ending state
	 *
	 * @param SessionName the name of the session the that was ended
	 * @param bWasSuccessful true if the async action completed without error, false if there was an error
	 */
	DEFINE_ONLINE_DELEGATE_TWO_PARAM(OnEndSessionComplete, FName, bool);

	/**
	 * Destroys the specified online session
	 * NOTE: online session de-registration is an async process and does not complete
	 * until the OnDestroySessionComplete delegate is called.
	 *
	 * @param SessionName the name of the session to delete
	 *
	 * @return true if successful destroying the session, false otherwise
	 */
	virtual bool DestroySession(FName SessionName, const FOnDestroySessionCompleteDelegate& CompletionDelegate = FOnDestroySessionCompleteDelegate()) = 0;

	/**
	 * Delegate fired when a destroying an online session has completed
	 *
	 * @param SessionName the name of the session this callback is for
	 * @param bWasSuccessful true if the async action completed without error, false if there was an error
	 */
	DEFINE_ONLINE_DELEGATE_TWO_PARAM(OnDestroySessionComplete, FName, bool);

	/**
	 * Determine if the player is registered in the specified session
	 *
	 * @param UniqueId the player to check if in session or not
	 * @return true if the player is registered in the session
	 */
	virtual bool IsPlayerInSession(FName SessionName, const FUniqueNetId& UniqueId) = 0;

	/**
	 * Begins cloud based matchmaking for a session
	 *
	 * @param LocalPlayers the ids of all local players that will participate in the match
	 * @param SessionName the name of the session to use, usually will be GAME_SESSION_NAME
	 * @param NewSessionSettings the desired settings to match against or create with when forming new sessions
	 * @param SearchSettings the desired settings that the matched session will have
	 *
	 * @return true if successful searching for sessions, false otherwise
	 */
	virtual bool StartMatchmaking(const TArray< TSharedRef<const FUniqueNetId> >& LocalPlayers, FName SessionName, const FOnlineSessionSettings& NewSessionSettings, TSharedRef<FOnlineSessionSearchB3atZ>& SearchSettings) = 0;

	/**
	 * Delegate fired when the cloud matchmaking has completed
	 *
	 * @param SessionName The name of the session that was found via matchmaking
	 * @param bWasSuccessful true if the async action completed without error, false if there was an error
	 */
	DEFINE_ONLINE_DELEGATE_TWO_PARAM(OnMatchmakingComplete, FName, bool);

	/**
	 * Cancel a Matchmaking request for a given session name
	 *
	 * @param SearchingPlayerNum the index of the player canceling the search
	 * @param SessionName the name of the session that was passed to StartMatchmaking (or CreateSession)
	 */
	virtual bool CancelMatchmaking(int32 SearchingPlayerNum, FName SessionName) = 0;

	/**
	 * Cancel a Matchmaking request for a given session name
	 *
	 * @param SearchingPlayerId the id of the player canceling the search
	 * @param SessionName the name of the session that was passed to StartMatchmaking (or CreateSession)
	 */
	virtual bool CancelMatchmaking(const FUniqueNetId& SearchingPlayerId, FName SessionName) = 0;

	/**
	 * Delegate fired when the cloud matchmaking has been canceled
	 *
	 * @param SessionName the name of the session that was canceled
	 * @param bWasSuccessful true if the async action completed without error, false if there was an error
	 */
	DEFINE_ONLINE_DELEGATE_TWO_PARAM(OnCancelMatchmakingComplete, FName, bool);

	/**
	 * Searches for sessions matching the settings specified
	 *
	 * @param SearchingPlayerNum the index of the player searching for a match
	 * @param SearchSettings the desired settings that the returned sessions will have
	 *
	 * @return true if successful searching for sessions, false otherwise
	 */
	virtual bool FindSessions(int32 SearchingPlayerNum, const TSharedRef<FOnlineSessionSearchB3atZ>& SearchSettings) = 0;

	/**
	 * Searches for sessions matching the settings specified
	 *
	 * @param SearchingPlayerId the id of the player searching for a match
	 * @param SearchSettings the desired settings that the returned sessions will have
	 *
	 * @return true if successful searching for sessions, false otherwise
	 */
	virtual bool FindSessions(const FUniqueNetId& SearchingPlayerId, const TSharedRef<FOnlineSessionSearchB3atZ>& SearchSettings) = 0;

	/**
	 * Delegate fired when the search for an online session has completed
	 *
	 * @param bWasSuccessful true if the async action completed without error, false if there was an error
	 */
	DEFINE_ONLINE_DELEGATE_ONE_PARAM(OnFindSessionsComplete, bool);

	/**
	 * Find a single advertised session by session id
	 *
	 * @param SearchingUserId user initiating the request
	 * @param SessionId session id to search for
	 * @param FriendId optional id of user to verify in session
	 * @param CompletionDelegate delegate to call on completion
	 *
	 * @return true on success, false otherwise
	 */
	virtual bool FindSessionById(const FUniqueNetId& SearchingUserId, const FUniqueNetId& SessionId, const FUniqueNetId& FriendId, const FOnSingleSessionResultCompleteDelegate& CompletionDelegate) = 0;

	/**
	 * Cancels the current search in progress if possible for that search type
	 *
	 * @return true if successful searching for sessions, false otherwise
	 */
	virtual bool CancelFindSessions() = 0;

	/**
	 * Delegate fired when the cancellation of a search for an online session has completed
	 *
	 * @param bWasSuccessful true if the async action completed without error, false if there was an error
	 */
	DEFINE_ONLINE_DELEGATE_ONE_PARAM(OnCancelFindSessionsComplete, bool);

	/**
	 * Fetches the additional data a session exposes outside of the online service.
	 * NOTE: notifications will come from the OnPingSearchResultsComplete delegate
	 *
	 * @param SearchResult the specific search result to query
	 *
	 * @return true if the query was started, false otherwise
	 */
	virtual bool PingSearchResults(const FOnlineSessionSearchResult& SearchResult) = 0;

	/**
	 * Delegate fired when an individual server's query has completed
	 *
	 * @param bWasSuccessful true if the async action completed without error, false if there was an error
	 */
	DEFINE_ONLINE_DELEGATE_ONE_PARAM(OnPingSearchResultsComplete, bool);

	/**
	 * Joins the session specified
	 *
	 * @param LocalUserNum the index of the player searching for a match
	 * @param SessionName the name of the session to join
	 * @param DesiredSession the desired session to join
	 *
	 * @return true if the call completed successfully, false otherwise
	 */
	virtual bool JoinSession(int32 LocalUserNum, FName SessionName, const FOnlineSessionSearchResult& DesiredSession) = 0;

	/**
	 * Joins the session specified
	 *
	 * @param LocalUserId the id of the player searching for a match
	 * @param SessionName the name of the session to join
	 * @param DesiredSession the desired session to join
	 *
	 * @return true if the call completed successfully, false otherwise
	 */
	virtual bool JoinSession(const FUniqueNetId& LocalUserId, FName SessionName, const FOnlineSessionSearchResult& DesiredSession) = 0;

	/**
	 * Delegate fired when the joining process for an online session has completed
	 *
	 * @param SessionName the name of the session this callback is for
	 * @param bWasSuccessful true if the async action completed without error, false if there was an error
	 */
	DEFINE_ONLINE_DELEGATE_TWO_PARAM(OnJoinSessionComplete, FName, EOnJoinSessionCompleteResult::Type);

	/**
	 * Allows the local player to follow a friend into a session
	 *
	 * @param LocalUserNum the local player wanting to join
	 * @param Friend the player that is being followed
	 *
	 * @return true if the async call worked, false otherwise
	 */
	virtual bool FindFriendSession(int32 LocalUserNum, const FUniqueNetId& Friend) = 0;

	/**
	 * Allows the local player to follow a friend into a session
	 *
	 * @param LocalUserId the local player wanting to join
	 * @param Friend the player that is being followed
	 *
	 * @return true if the async call worked, false otherwise
	 */
	virtual bool FindFriendSession(const FUniqueNetId& LocalUserId, const FUniqueNetId& Friend) = 0;

	/**
	 * Delegate fired once the find friend task has completed
	 * Session has not been joined at this point, and still requires a call to JoinSession()
	 *
	 * @param LocalUserNum the controller number of the accepting user
	 * @param bWasSuccessful the session was found and is joinable, false otherwise
	 * @param FriendSearchResult the search/settings for the session we're attempting to join
	 */
	DEFINE_ONLINE_PLAYER_DELEGATE_TWO_PARAM(MAX_LOCAL_PLAYERS, OnFindFriendSessionComplete, bool, const FOnlineSessionSearchResult&);

	/**
	 * Sends an invitation to play in the player's current session
	 *
	 * @param LocalUserNum the user that is sending the invite
	 * @param SessionName session to invite them to
	 * @param Friend the player to send the invite to
	 *
	 * @return true if successful, false otherwise
	 */
	virtual bool SendSessionInviteToFriend(int32 LocalUserNum, FName SessionName, const FUniqueNetId& Friend) = 0;

	/**
	 * Sends an invitation to play in the player's current session
	 *
	 * @param LocalUserId the user that is sending the invite
	 * @param SessionName session to invite them to
	 * @param Friend the player to send the invite to
	 *
	 * @return true if successful, false otherwise
	 */
	virtual bool SendSessionInviteToFriend(const FUniqueNetId& LocalUserId, FName SessionName, const FUniqueNetId& Friend) = 0;

	/**
	 * Sends invitations to play in the player's current session
	 *
	 * @param LocalUserNum the user that is sending the invite
	 * @param SessionName session to invite them to
	 * @param Friends the player to send the invite to
	 *
	 * @return true if successful, false otherwise
	 */
	virtual bool SendSessionInviteToFriends(int32 LocalUserNum, FName SessionName, const TArray< TSharedRef<const FUniqueNetId> >& Friends) = 0;

	/**
	 * Sends invitations to play in the player's current session
	 *
	 * @param LocalUserId the user that is sending the invite
	 * @param SessionName session to invite them to
	 * @param Friends the player to send the invite to
	 *
	 * @return true if successful, false otherwise
	 */
	virtual bool SendSessionInviteToFriends(const FUniqueNetId& LocalUserId, FName SessionName, const TArray< TSharedRef<const FUniqueNetId> >& Friends) = 0;

	/**
	 * Called when a user accepts a session invitation. Allows the game code a chance
	 * to clean up any existing state before accepting the invite. The invite must be
	 * accepted by calling JoinSession() after clean up has completed
	 *
	 * @param bWasSuccessful true if the async action completed without error, false if there was an error
	 * @param ControllerId the controller number of the accepting user
	 * @param UserId the user being invited
	 * @param InviteResult the search/settings for the session we're joining via invite
	 */
	DEFINE_ONLINE_DELEGATE_FOUR_PARAM(OnSessionUserInviteAccepted, const bool, const int32, TSharedPtr<const FUniqueNetId>, const FOnlineSessionSearchResult&);

	/**
	 * Called when a user receives a session invitation. Allows the game code to decide
	 * on accepting the invite. The invite can be accepted by calling JoinSession()
	 *
	 * @param UserId the user being invited
	 * @param FromId the user that sent the invite
	 * @param AppId the id of the client/app user was in when sending hte game invite
	 * @param InviteResult the search/settings for the session we're joining via invite
	 */
	DEFINE_ONLINE_DELEGATE_FOUR_PARAM(OnSessionInviteReceived, const FUniqueNetId& /*UserId*/, const FUniqueNetId& /*FromId*/, const FString& /*AppId*/, const FOnlineSessionSearchResult& /*InviteResult*/);

	/**
	 * Returns the platform specific connection information for joining the match.
	 * Call this function from the delegate of join completion
	 *
	 * @param SessionName the name of the session to resolve
	 * @param ConnectInfo the string containing the platform specific connection information
	 *
	 * @return true if the call was successful, false otherwise
	 */
	virtual bool GetResolvedConnectString(FName SessionName, FString& ConnectInfo) = 0;

	/**
	 * Returns the platform specific connection information for joining a search result.
	 *
	 * @param SearchResult the search result to get connection info from
	 * @param PortType type of port to append to result (Game, Beacon, etc)
	 * @param ConnectInfo the string containing the platform specific connection information
	 *
	 * @return true if the call was successful, false otherwise
	 */
	virtual bool GetResolvedConnectString(const class FOnlineSessionSearchResult& SearchResult, FName PortType, FString& ConnectInfo) = 0;

	/**
	 * Returns the session settings object for the session with a matching name
	 *
	 * @param SessionName the name of the session to return
	 *
	 * @return the settings for this session name
	 */
	virtual FOnlineSessionSettings* GetSessionSettings(FName SessionName) = 0;

	/**
	 * Registers a player with the online service as being part of the online session
	 *
	 * @param SessionName the name of the session the player is joining
	 * @param UniquePlayerId the player to register with the online service
	 * @param bWasInvited whether the player was invited to the session or searched for it
	 *
	 * @return true if the call succeeds, false otherwise
	 */
	virtual bool RegisterPlayer(FName SessionName, const FUniqueNetId& PlayerId, bool bWasInvited) = 0;

	/**
	 * Registers a group of players with the online service as being part of the online session
	 *
	 * @param SessionName the name of the session the player is joining
	 * @param Players the list of players to register with the online service
	 * @param bWasInvited was this list of players invited
	 *
	 * @return true if the call succeeds, false otherwise
	 */
	virtual bool RegisterPlayers(FName SessionName, const TArray< TSharedRef<const FUniqueNetId> >& Players, bool bWasInvited = false) = 0;

	/**
	 * Delegate fired when the session registration process has completed
	 *
	 * @param SessionName the name of the session the player joined or not
	 * @param PlayerId the player that was registered in the online service
	 * @param bWasSuccessful true if the async action completed without error, false if there was an error
	 */
	DEFINE_ONLINE_DELEGATE_THREE_PARAM(OnRegisterPlayersComplete, FName, const TArray< TSharedRef<const FUniqueNetId> >&, bool);

	/**
	 * Unregisters a player with the online service as being part of the online session
	 *
	 * @param SessionName the name of the session the player is leaving
	 * @param PlayerId the player to unregister with the online service
	 *
	 * @return true if the call succeeds, false otherwise
	 */
	virtual bool UnregisterPlayer(FName SessionName, const FUniqueNetId& PlayerId) = 0;

	/**
	 * Unregisters a group of players with the online service as being part of the online session
	 *
	 * @param SessionName the name of the session the player is joining
	 * @param Players the list of players to unregister with the online service
	 *
	 * @return true if the call succeeds, false otherwise
	 */
	virtual bool UnregisterPlayers(FName SessionName, const TArray< TSharedRef<const FUniqueNetId> >& Players) = 0;

	/**
	 * Delegate fired when the un-registration process has completed
	 *
	 * @param SessionName the name of the session the player left
	 * @param PlayerId the player that was unregistered from the online service
	 * @param bWasSuccessful true if the async action completed without error, false if there was an error
	 */
	DEFINE_ONLINE_DELEGATE_THREE_PARAM(OnUnregisterPlayersComplete, FName, const TArray< TSharedRef<const FUniqueNetId> >&, bool);

	/**
	 * Registers a local player with a session.
	 *
	 * @param PlayerId the player to register
	 * @param SessionName the session in which to register the player
	 * @param Delegate the delegate executed when the asynchronous operation completes
	 */
	virtual void RegisterLocalPlayer(const FUniqueNetId& PlayerId, FName SessionName, const FOnRegisterLocalPlayerCompleteDelegate& Delegate) = 0;

	/**
	 * Unregisters a local player with a session.
	 *
	 * @param PlayerId the player to unregister
	 * @param SessionName the session in which to unregister the player
	 * @param Delegate the delegate executed when the asynchronous operation completes
	 */
	virtual void UnregisterLocalPlayer(const FUniqueNetId& PlayerId, FName SessionName, const FOnUnregisterLocalPlayerCompleteDelegate& Delegate) = 0;

	/**
	 * Delegate fired when an unexpected error occurs that impacts session connectivity or use
	 *
	 * @param PlayerId The player impacted by the failure (may be empty if unknown, or if all players are affected)
	 * @param FailureType What kind of failure occured
	 */
	DEFINE_ONLINE_DELEGATE_TWO_PARAM(OnSessionFailure, const FUniqueNetId&, ESessionFailure::Type);

	/**
	 * Gets the number of known sessions registered with the interface
	 */
	virtual int32 GetNumSessions() = 0;

	/**
	 *	Dumps out the session state for all known sessions
	 */
	virtual void DumpSessionState() = 0;
};

typedef TSharedPtr<IOnlineSession, ESPMode::ThreadSafe> IOnlineSessionPtr;

redpajama_set_name: RedPajamaGithub


text:
<?php if($this->session->userdata("logged_in")==""){ ?>

<?php } else {
    if($this->session->userdata("logged_in")!="" && $this->session->userdata("tipe_user")=="admin_panitia") { ?>

    <?php } else if($this->session->userdata("logged_in")!="" && $this->session->userdata("tipe_user")=="operator") { ?>

    <?php } else if($this->session->userdata("logged_in")!="" && $this->session->userdata("tipe_user")=="panlih") { ?>

        <audio controls autoplay="autoplay">
            <source src="<?php echo base_url(); ?>asset/theme/blue-clouds/images/log_in.mp3" type="audio/mpeg">
            Browser Immawan/Immawati tidak support memainkan musik.
        </audio>

    <?php } } ?>

<?php echo $_SESSION['site_footer']; ?>


text:
package com.ocdsoft.bacta.swg.server.login.message;

import com.ocdsoft.bacta.soe.message.GameNetworkMessage;
import com.ocdsoft.bacta.soe.message.Priority;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.nio.ByteBuffer;

/**
 * Created by kyle on 5/24/2016.
 */
@Getter
@Priority(0x05)
@AllArgsConstructor
public class GameServerAuthenticate extends GameNetworkMessage {

    private final byte[] serverName;
    private final byte[] serverKey;

    public GameServerAuthenticate(final ByteBuffer buffer) {
        this.serverName = new byte[buffer.getShort()];
        buffer.get(this.serverName);

        this.serverKey = new byte[buffer.getShort()];
        buffer.get(this.serverKey);
    }

    @Override
    public void writeToBuffer(final ByteBuffer buffer) {
        buffer.putShort((short) serverName.length);
        buffer.put(serverName);

        buffer.putShort((short) serverKey.length);
        buffer.put(serverKey);
    }
}


text:
namespace peloton {
namespace index {

Index *IndexFactory::GetIndex(IndexMetadata *metadata) {
  LOG_TRACE("Creating index %s", metadata->GetName().c_str());

  // The size of the key in bytes
  const auto key_size = metadata->key_schema->GetLength();
  LOG_TRACE("key_size : %d", key_size);
  LOG_TRACE("Indexed column count: %ld",
            metadata->key_schema->GetIndexedColumns().size());

  // Check whether the index key only has ints.
  // If so, then we can rock a specialized IntsKeyComparator
  // that is faster than the FastGenericComparator
  bool ints_only = true;
  for (auto column : metadata->key_schema->GetColumns()) {
    auto col_type = column.GetType();
    if (col_type != type::TypeId::TINYINT && col_type != type::TypeId::SMALLINT &&
        col_type != type::TypeId::INTEGER && col_type != type::TypeId::BIGINT) {
      ints_only = false;
      break;
    }
  }  // FOR

  // If we want to use a specialized IntsKey template, make sure that
  // we are not longer than the largest IntsKey that we have
  if (ints_only && key_size > sizeof(uint64_t) * INTSKEY_MAX_SLOTS) {
    ints_only = false;
  }

  auto index_type = metadata->GetIndexType();
  Index *index = nullptr;
  LOG_TRACE("Index type : %s", IndexTypeToString(index_type).c_str());

  // -----------------------
  // BW-TREE
  // -----------------------
  if (index_type == IndexType::BWTREE) {
    if (ints_only) {
      index = IndexFactory::GetBwTreeIntsKeyIndex(metadata);
    } else {
      index = IndexFactory::GetBwTreeGenericKeyIndex(metadata);
    }

  // -----------------------
  // SKIP-LIST
  // -----------------------
  } else if (index_type == IndexType::SKIPLIST) {
    if (ints_only) {
      index = IndexFactory::GetSkipListIntsKeyIndex(metadata);
    } else {
      index = IndexFactory::GetSkipListGenericKeyIndex(metadata);
    }

  // -----------------------
  // ERROR
  // -----------------------
  } else {
    throw IndexException("Unsupported index scheme.");
  }
  PL_ASSERT(index != nullptr);

  return (index);
}

Index *IndexFactory::GetBwTreeIntsKeyIndex(IndexMetadata *metadata) {
  // Our new Index!
  Index *index = nullptr;

  // The size of the key in bytes
  const auto key_size = metadata->key_schema->GetLength();

// Debug Output
#ifdef LOG_TRACE_ENABLED
  std::string comparatorType;
#endif

  if (key_size <= sizeof(uint64_t)) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "CompactIntsKey<1>";
#endif
    index =
        new BWTreeIndex<CompactIntsKey<1>, ItemPointer *,
                        CompactIntsComparator<1>, CompactIntsEqualityChecker<1>,
                        CompactIntsHasher<1>, ItemPointerComparator,
                        ItemPointerHashFunc>(metadata);
  } else if (key_size <= sizeof(uint64_t) * 2) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "CompactIntsKey<2>";
#endif
    index =
        new BWTreeIndex<CompactIntsKey<2>, ItemPointer *,
                        CompactIntsComparator<2>, CompactIntsEqualityChecker<2>,
                        CompactIntsHasher<2>, ItemPointerComparator,
                        ItemPointerHashFunc>(metadata);
  } else if (key_size <= sizeof(uint64_t) * 3) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "CompactIntsKey<3>";
#endif
    index =
        new BWTreeIndex<CompactIntsKey<3>, ItemPointer *,
                        CompactIntsComparator<3>, CompactIntsEqualityChecker<3>,
                        CompactIntsHasher<3>, ItemPointerComparator,
                        ItemPointerHashFunc>(metadata);
  } else if (key_size <= sizeof(uint64_t) * 4) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "CompactIntsKey<4>";
#endif
    index =
        new BWTreeIndex<CompactIntsKey<4>, ItemPointer *,
                        CompactIntsComparator<4>, CompactIntsEqualityChecker<4>,
                        CompactIntsHasher<4>, ItemPointerComparator,
                        ItemPointerHashFunc>(metadata);
  } else {
    throw IndexException("Unsupported IntsKey scheme");
  }

#ifdef LOG_TRACE_ENABLED
  LOG_TRACE("%s", IndexFactory::GetInfo(metadata, comparatorType).c_str());
#endif
  return (index);
}

Index *IndexFactory::GetBwTreeGenericKeyIndex(IndexMetadata *metadata) {
  // Our new Index!
  Index *index = nullptr;

  // The size of the key in bytes
  const auto key_size = metadata->key_schema->GetLength();

// Debug Output
#ifdef LOG_TRACE_ENABLED
  std::string comparatorType;
#endif

  if (key_size <= 4) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "GenericKey<4>";
#endif
    index =
        new BWTreeIndex<GenericKey<4>, ItemPointer *, FastGenericComparator<4>,
                        GenericEqualityChecker<4>, GenericHasher<4>,
                        ItemPointerComparator, ItemPointerHashFunc>(metadata);
  } else if (key_size <= 8) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "GenericKey<8>";
#endif
    index =
        new BWTreeIndex<GenericKey<8>, ItemPointer *, FastGenericComparator<8>,
                        GenericEqualityChecker<8>, GenericHasher<8>,
                        ItemPointerComparator, ItemPointerHashFunc>(metadata);
  } else if (key_size <= 16) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "GenericKey<16>";
#endif
    index =
        new BWTreeIndex<GenericKey<16>, ItemPointer *,
                        FastGenericComparator<16>, GenericEqualityChecker<16>,
                        GenericHasher<16>, ItemPointerComparator,
                        ItemPointerHashFunc>(metadata);
  } else if (key_size <= 64) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "GenericKey<64>";
#endif
    index =
        new BWTreeIndex<GenericKey<64>, ItemPointer *,
                        FastGenericComparator<64>, GenericEqualityChecker<64>,
                        GenericHasher<64>, ItemPointerComparator,
                        ItemPointerHashFunc>(metadata);
  } else if (key_size <= 256) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "GenericKey<256>";
#endif
    index =
        new BWTreeIndex<GenericKey<256>, ItemPointer *,
                        FastGenericComparator<256>, GenericEqualityChecker<256>,
                        GenericHasher<256>, ItemPointerComparator,
                        ItemPointerHashFunc>(metadata);
  } else {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "TupleKey";
#endif
    index =
        new BWTreeIndex<TupleKey, ItemPointer *, TupleKeyComparator,
                        TupleKeyEqualityChecker, TupleKeyHasher,
                        ItemPointerComparator, ItemPointerHashFunc>(metadata);
  }

#ifdef LOG_TRACE_ENABLED
  LOG_TRACE("%s", IndexFactory::GetInfo(metadata, comparatorType).c_str());
#endif
  return (index);
}

Index *IndexFactory::GetSkipListIntsKeyIndex(IndexMetadata *metadata) {
  // Our new Index!
  Index *index = nullptr;

  // The size of the key in bytes
  const auto key_size = metadata->key_schema->GetLength();

// Debug Output
#ifdef LOG_TRACE_ENABLED
  std::string comparatorType;
#endif

  if (key_size <= sizeof(uint64_t)) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "CompactIntsKey<1>";
#endif
    index =
        new SkipListIndex<CompactIntsKey<1>, ItemPointer *,
                          CompactIntsComparator<1>,
                          CompactIntsEqualityChecker<1>, ItemPointerComparator>(
            metadata);
  } else if (key_size <= sizeof(uint64_t) * 2) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "CompactIntsKey<2>";
#endif
    index =
        new SkipListIndex<CompactIntsKey<2>, ItemPointer *,
                          CompactIntsComparator<2>,
                          CompactIntsEqualityChecker<2>, ItemPointerComparator>(
            metadata);
  } else if (key_size <= sizeof(uint64_t) * 3) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "CompactIntsKey<3>";
#endif
    index =
        new SkipListIndex<CompactIntsKey<3>, ItemPointer *,
                          CompactIntsComparator<3>,
                          CompactIntsEqualityChecker<3>, ItemPointerComparator>(
            metadata);
  } else if (key_size <= sizeof(uint64_t) * 4) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "CompactIntsKey<4>";
#endif
    index =
        new SkipListIndex<CompactIntsKey<4>, ItemPointer *,
                          CompactIntsComparator<4>,
                          CompactIntsEqualityChecker<4>, ItemPointerComparator>(
            metadata);
  } else {
    throw IndexException("Unsupported IntsKey scheme");
  }

#ifdef LOG_TRACE_ENABLED
  LOG_TRACE("%s", IndexFactory::GetInfo(metadata, comparatorType).c_str());
#endif
  return (index);
}

Index *IndexFactory::GetSkipListGenericKeyIndex(IndexMetadata *metadata) {
  // Our new Index!
  Index *index = nullptr;

  // The size of the key in bytes
  const auto key_size = metadata->key_schema->GetLength();

// Debug Output
#ifdef LOG_TRACE_ENABLED
  std::string comparatorType;
#endif

  if (key_size <= 4) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "GenericKey<4>";
#endif
    index =
        new SkipListIndex<GenericKey<4>, ItemPointer *,
                          FastGenericComparator<4>, GenericEqualityChecker<4>,
                          ItemPointerComparator>(metadata);
  } else if (key_size <= 8) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "GenericKey<8>";
#endif
    index =
        new SkipListIndex<GenericKey<8>, ItemPointer *,
                          FastGenericComparator<8>, GenericEqualityChecker<8>,
                          ItemPointerComparator>(metadata);
  } else if (key_size <= 16) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "GenericKey<16>";
#endif
    index =
        new SkipListIndex<GenericKey<16>, ItemPointer *,
                          FastGenericComparator<16>, GenericEqualityChecker<16>,
                          ItemPointerComparator>(metadata);
  } else if (key_size <= 64) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "GenericKey<64>";
#endif
    index =
        new SkipListIndex<GenericKey<64>, ItemPointer *,
                          FastGenericComparator<64>, GenericEqualityChecker<64>,
                          ItemPointerComparator>(metadata);
  } else if (key_size <= 256) {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "GenericKey<256>";
#endif
    index =
        new SkipListIndex<GenericKey<256>, ItemPointer *,
                          FastGenericComparator<256>,
                          GenericEqualityChecker<256>, ItemPointerComparator>(
            metadata);
  } else {
#ifdef LOG_TRACE_ENABLED
    comparatorType = "TupleKey";
#endif
    index = new SkipListIndex<TupleKey, ItemPointer *, TupleKeyComparator,
                              TupleKeyEqualityChecker, ItemPointerComparator>(
        metadata);
  }

#ifdef LOG_TRACE_ENABLED
  LOG_TRACE("%s", IndexFactory::GetInfo(metadata, comparatorType).c_str());
#endif
  return (index);
}

std::string IndexFactory::GetInfo(IndexMetadata *metadata,
                                  std::string comparatorType) {
  std::ostringstream os;
  os << "Index '" << metadata->GetName() << "' => "
     << IndexTypeToString(metadata->GetIndexType()) << "::" << comparatorType
     << "(";
  bool first = true;
  for (auto column : metadata->key_schema->GetColumns()) {
    if (first == false) os << ", ";
    os << column.GetName();
    first = false;
  }
  os << ")";
  return (os.str());
}

}  // End index namespace
}  // End peloton namespace


text:
using System;
using System.Collections.Generic;
using System.Linq;
using MapzenGo.Models.Enums;
using MapzenGo.Models.Settings.Base;
using UnityEngine;

namespace MapzenGo.Models.Settings
{
    public class EarthFactorySettings: SettingsLayers
    {
        public EarthSettings DefaultEarth = new EarthSettings();
        public List<EarthSettings> SettingsEarth = new List<EarthSettings>();

        public EarthFactorySettings()
        {
            DefaultEarth = new EarthSettings()
            {
                Material = null,
                Type = EarthType.Earth
            };
            SettingsEarth = new List<EarthSettings>();
        }

        public override EarthSettings GetSettingsFor<EarthSettings>(Enum type)
        {
            return SettingsEarth.FirstOrDefault(x => x.Type == (EarthType)type)as EarthSettings ?? DefaultEarth as EarthSettings;
        }

        public override bool HasSettingsFor(Enum type)
        {
            return SettingsEarth.Any(x => x.Type == (EarthType)type);
        }
    }
    [Serializable]
    public class EarthSettings : BaseSetting
    {
        public EarthType Type;
        public Material Material;

        public EarthSettings()
        {
            Type = EarthType.Earth;
            Material = null;
        }

    }
}


text:
This image is java runtime image, used for compile your project to a jar file, and upload it to the target

### Learn how to build it?

Use the `docker build` command build the image, and your project must build with gradle

 gradle jar

```
docker build -t containerops/compile/java_gradle_jar ./
```
### Component Usage
```
docker run \
    --rm \
    --env CO_DATA=" \
    version=gradle3 \
    git-url=https://github.com/vanniuner/gradle-demo.git \
    target=https://hub.opshub.sh/binary/v1/containerops/component/binary/2.2.4/demo.jar" \
    containerops/compile/java_gradle_jar
```

### Parameters
- `version` gradle version available value: gradle3,gradle4
- `git-url` where your code is located
- `target`  where your package file to upload, curl -i -X PUT -T file target
### Versions 1.0.0


text:
cd "$(dirname "${BASH_SOURCE}")"
source cni-plugin.sh
source docker-bootstrap.sh

kube::multinode::main(){

  # Require root
  if [[ "$(id -u)" != "0" ]]; then
    kube::log::fatal "Please run as root"
  fi

  for tool in curl ip docker; do
    if [[ ! -f $(which ${tool} 2>&1) ]]; then
      kube::log::fatal "The binary ${tool} is required. Install it."
    fi
  done

  # Make sure docker daemon is running
  if [[ $(docker ps 2>&1 1>/dev/null; echo $?) != 0 ]]; then
    kube::log::fatal "Docker is not running on this machine!"
  fi

  LATEST_STABLE_K8S_VERSION=$(curl -sSL "https://storage.googleapis.com/kubernetes-release/release/stable.txt")
  K8S_VERSION=${K8S_VERSION:-${LATEST_STABLE_K8S_VERSION}}

  CURRENT_PLATFORM=$(kube::helpers::host_platform)
  ARCH=${ARCH:-${CURRENT_PLATFORM##*/}}

  if [[ ${ARCH} == "arm" ]]; then
    ETCD_VERSION=${ETCD_VERSION:-"2.2.5"}
  else
    ETCD_VERSION=${ETCD_VERSION:-"3.0.4"}
  fi

  FLANNEL_VERSION=${FLANNEL_VERSION:-"v0.6.1"}
  FLANNEL_IPMASQ=${FLANNEL_IPMASQ:-"true"}
  FLANNEL_BACKEND=${FLANNEL_BACKEND:-"udp"}
  FLANNEL_NETWORK=${FLANNEL_NETWORK:-"10.1.0.0/16"}

  RESTART_POLICY=${RESTART_POLICY:-"unless-stopped"}

  DEFAULT_IP_ADDRESS=$(ip -o -4 addr list $(ip -o -4 route show to default | awk '{print $5}' | head -1) | awk '{print $4}' | cut -d/ -f1 | head -1)
  IP_ADDRESS=${IP_ADDRESS:-${DEFAULT_IP_ADDRESS}}

  TIMEOUT_FOR_SERVICES=${TIMEOUT_FOR_SERVICES:-20}
  USE_CNI=${USE_CNI:-"false"}
  USE_CONTAINERIZED=${USE_CONTAINERIZED:-"false"}
  CNI_ARGS=""

  BOOTSTRAP_DOCKER_SOCK="unix:///var/run/docker-bootstrap.sock"
  BOOTSTRAP_DOCKER_PARAM="-H ${BOOTSTRAP_DOCKER_SOCK}"
  ETCD_NET_PARAM="--net host"

  if [[ ${USE_CONTAINERIZED} == "true" ]]; then
    ROOTFS_MOUNT="-v /:/rootfs:ro"
    KUBELET_MOUNT="-v /var/lib/kubelet:/var/lib/kubelet:slave"
    CONTAINERIZED_FLAG="--containerized"
  else
    ROOTFS_MOUNT=""
    KUBELET_MOUNT="-v /var/lib/kubelet:/var/lib/kubelet:shared"
    CONTAINERIZED_FLAG=""
  fi

  KUBELET_MOUNTS="\
    ${ROOTFS_MOUNT} \
    -v /sys:/sys:rw \
    -v /var/run:/var/run:rw \
    -v /run:/run:rw \
    -v /var/lib/docker:/var/lib/docker:rw \
    ${KUBELET_MOUNT} \
    -v /var/log/containers:/var/log/containers:rw"

  # Paths
  FLANNEL_SUBNET_DIR=${FLANNEL_SUBNET_DIR:-/run/flannel}

  if [[ ${USE_CNI} == "true" ]]; then

    BOOTSTRAP_DOCKER_PARAM=""
    ETCD_NET_PARAM="-p 2379:2379 -p 2380:2380 -p 4001:4001"
    CNI_ARGS="\
      --network-plugin=cni \
      --network-plugin-dir=/etc/cni/net.d"
  fi
}

# Ensure everything is OK, docker is running and we're root
kube::multinode::log_variables() {

  kube::helpers::parse_version ${K8S_VERSION}

  # Output the value of the variables
  kube::log::status "K8S_VERSION is set to: ${K8S_VERSION}"
  kube::log::status "ETCD_VERSION is set to: ${ETCD_VERSION}"
  kube::log::status "FLANNEL_VERSION is set to: ${FLANNEL_VERSION}"
  kube::log::status "FLANNEL_IPMASQ is set to: ${FLANNEL_IPMASQ}"
  kube::log::status "FLANNEL_NETWORK is set to: ${FLANNEL_NETWORK}"
  kube::log::status "FLANNEL_BACKEND is set to: ${FLANNEL_BACKEND}"
  kube::log::status "RESTART_POLICY is set to: ${RESTART_POLICY}"
  kube::log::status "MASTER_IP is set to: ${MASTER_IP}"
  kube::log::status "ARCH is set to: ${ARCH}"
  kube::log::status "IP_ADDRESS is set to: ${IP_ADDRESS}"
  kube::log::status "USE_CNI is set to: ${USE_CNI}"
  kube::log::status "USE_CONTAINERIZED is set to: ${USE_CONTAINERIZED}"
  kube::log::status "--------------------------------------------"
}

# Start etcd on the master node
kube::multinode::start_etcd() {

  kube::log::status "Launching etcd..."

  # TODO: Remove the 4001 port as it is deprecated
  docker ${BOOTSTRAP_DOCKER_PARAM} run -d \
    --name kube_etcd_$(kube::helpers::small_sha) \
    --restart=${RESTART_POLICY} \
    ${ETCD_NET_PARAM} \
    -v /var/lib/kubelet/etcd:/var/etcd \
    gcr.io/google_containers/etcd-${ARCH}:${ETCD_VERSION} \
    /usr/local/bin/etcd \
      --listen-client-urls=http://0.0.0.0:2379,http://0.0.0.0:4001 \
      --advertise-client-urls=http://localhost:2379,http://localhost:4001 \
      --listen-peer-urls=http://0.0.0.0:2380 \
      --data-dir=/var/etcd/data

  # Wait for etcd to come up
  local SECONDS=0
  while [[ $(curl -fsSL http://localhost:2379/health 2>&1 1>/dev/null; echo $?) != 0 ]]; do
    ((SECONDS++))
    if [[ ${SECONDS} == ${TIMEOUT_FOR_SERVICES} ]]; then
      kube::log::fatal "etcd failed to start. Exiting..."
    fi
    sleep 1
  done

  sleep 2
}

# Start flannel in docker bootstrap, both for master and worker
kube::multinode::start_flannel() {

  kube::log::status "Launching flannel..."

  # Set flannel net config (when running on master)
  if [[ "${MASTER_IP}" == "localhost" ]]; then
    curl -sSL http://localhost:2379/v2/keys/coreos.com/network/config -XPUT \
      -d value="{ \"Network\": \"${FLANNEL_NETWORK}\", \"Backend\": {\"Type\": \"${FLANNEL_BACKEND}\"}}"
  fi

  # Make sure that a subnet file doesn't already exist
  rm -f ${FLANNEL_SUBNET_DIR}/subnet.env

  docker ${BOOTSTRAP_DOCKER_PARAM} run -d \
    --name kube_flannel_$(kube::helpers::small_sha) \
    --restart=${RESTART_POLICY} \
    --net=host \
    --privileged \
    -v /dev/net:/dev/net \
    -v ${FLANNEL_SUBNET_DIR}:${FLANNEL_SUBNET_DIR} \
    quay.io/coreos/flannel:${FLANNEL_VERSION}-${ARCH} \
    /opt/bin/flanneld \
      --etcd-endpoints=http://${MASTER_IP}:2379 \
      --ip-masq="${FLANNEL_IPMASQ}" \
      --iface="${IP_ADDRESS}"

  # Wait for the flannel subnet.env file to be created instead of a timeout. This is faster and more reliable
  local SECONDS=0
  while [[ ! -f ${FLANNEL_SUBNET_DIR}/subnet.env ]]; do
    ((SECONDS++))
    if [[ ${SECONDS} == ${TIMEOUT_FOR_SERVICES} ]]; then
      kube::log::fatal "flannel failed to start. Exiting..."
    fi
    sleep 1
  done

  source ${FLANNEL_SUBNET_DIR}/subnet.env

  kube::log::status "FLANNEL_SUBNET is set to: ${FLANNEL_SUBNET}"
  kube::log::status "FLANNEL_MTU is set to: ${FLANNEL_MTU}"
}

# Start kubelet first and then the master components as pods
kube::multinode::start_k8s_master() {
  kube::multinode::create_kubeconfig
  kube::log::status "Launching Kubernetes master components..."

  kube::multinode::make_shared_kubelet_dir

  docker run -d \
    --net=host \
    --pid=host \
    --privileged \
    --restart=${RESTART_POLICY} \
    --name kube_kubelet_$(kube::helpers::small_sha) \
    ${KUBELET_MOUNTS} \
    gcr.io/google_containers/hyperkube-${ARCH}:${K8S_VERSION} \
    /hyperkube kubelet \
      --allow-privileged \
      --api-servers=http://localhost:8080 \
      --config=/etc/kubernetes/manifests-multi \
      --cluster-dns=10.0.0.10 \
      --cluster-domain=cluster.local \
      ${CNI_ARGS} \
      ${CONTAINERIZED_FLAG} \
      --hostname-override=${IP_ADDRESS} \
      --v=2
}

# Start kubelet in a container, for a worker node
kube::multinode::start_k8s_worker() {
  kube::multinode::create_kubeconfig
  kube::log::status "Launching Kubernetes worker components..."

  kube::multinode::make_shared_kubelet_dir

  # TODO: Use secure port for communication
  docker run -d \
    --net=host \
    --pid=host \
    --privileged \
    --restart=${RESTART_POLICY} \
    --name kube_kubelet_$(kube::helpers::small_sha) \
    ${KUBELET_MOUNTS} \
    gcr.io/google_containers/hyperkube-${ARCH}:${K8S_VERSION} \
    /hyperkube kubelet \
      --allow-privileged \
      --api-servers=http://${MASTER_IP}:8080 \
      --cluster-dns=10.0.0.10 \
      --cluster-domain=cluster.local \
      ${CNI_ARGS} \
      ${CONTAINERIZED_FLAG} \
      --hostname-override=${IP_ADDRESS} \
      --v=2
}

# Start kube-proxy in a container, for a worker node
kube::multinode::start_k8s_worker_proxy() {

  kube::log::status "Launching kube-proxy..."
  docker run -d \
    --net=host \
    --privileged \
    --name kube_proxy_$(kube::helpers::small_sha) \
    --restart=${RESTART_POLICY} \
    gcr.io/google_containers/hyperkube-${ARCH}:${K8S_VERSION} \
    /hyperkube proxy \
        --master=http://${MASTER_IP}:8080 \
        --v=2
}

# Turndown the local cluster
kube::multinode::turndown(){

  # Check if docker bootstrap is running
  DOCKER_BOOTSTRAP_PID=$(ps aux | grep ${BOOTSTRAP_DOCKER_SOCK} | grep -v "grep" | awk '{print $2}')
  if [[ ! -z ${DOCKER_BOOTSTRAP_PID} ]]; then

    kube::log::status "Killing docker bootstrap..."

    # Kill the bootstrap docker daemon and it's containers
    docker -H ${BOOTSTRAP_DOCKER_SOCK} rm -f $(docker -H ${BOOTSTRAP_DOCKER_SOCK} ps -q) >/dev/null 2>/dev/null
    kill ${DOCKER_BOOTSTRAP_PID}
  fi

  kube::log::status "Killing all kubernetes containers..."

  if [[ $(docker ps | grep "kube_" | awk '{print $1}' | wc -l) != 0 ]]; then
    docker rm -f $(docker ps | grep "kube_" | awk '{print $1}')
  fi
  if [[ $(docker ps | grep "k8s_" | awk '{print $1}' | wc -l) != 0 ]]; then
    docker rm -f $(docker ps | grep "k8s_" | awk '{print $1}')
  fi

  if [[ -d /var/lib/kubelet ]]; then
    read -p "Do you want to clean /var/lib/kubelet? [Y/n] " clean_kubelet_dir

    case $clean_kubelet_dir in
      [nN]*)
        ;; # Do nothing
      *)
        # umount if there are mounts in /var/lib/kubelet
        if [[ ! -z $(mount | grep "/var/lib/kubelet" | awk '{print $3}') ]]; then

          # The umount command may be a little bit stubborn sometimes, so run the commands twice to ensure the mounts are gone
          mount | grep "/var/lib/kubelet/*" | awk '{print $3}' | xargs umount 1>/dev/null 2>/dev/null
          mount | grep "/var/lib/kubelet/*" | awk '{print $3}' | xargs umount 1>/dev/null 2>/dev/null
          umount /var/lib/kubelet 1>/dev/null 2>/dev/null
          umount /var/lib/kubelet 1>/dev/null 2>/dev/null
        fi

        # Delete the directory
        rm -rf /var/lib/kubelet
        ;;
    esac
  fi

  # Remove cni0 bridge if K8S_VERSION = v1.4.0-alpha.2
  # With versions above that, it's not required. TODO: Remove this later
  kube::multinode::delete_bridge cni0
}

kube::multinode::delete_bridge() {
  if [[ ! -z $(ip link | grep "$1") ]]; then
    ip link set $1 down
    ip link del $1
  fi
}

# Make shared kubelet directory
kube::multinode::make_shared_kubelet_dir() {

  # This only has to be done when the host doesn't use systemd
  if ! kube::helpers::command_exists systemctl; then
    mkdir -p /var/lib/kubelet
    mount --bind /var/lib/kubelet /var/lib/kubelet
    mount --make-shared /var/lib/kubelet

    kube::log::status "Mounted /var/lib/kubelet with shared propagnation"
  fi
}

kube::multinode::create_kubeconfig(){
  # Create a kubeconfig.yaml file for the proxy daemonset
  mkdir -p /var/lib/kubelet/kubeconfig
  sed -e "s|MASTER_IP|${MASTER_IP}|g" kubeconfig.yaml > /var/lib/kubelet/kubeconfig/kubeconfig.yaml
}

# Check if a command is valid
kube::helpers::command_exists() {
  command -v "$@" > /dev/null 2>&1
}

# Backup the current file
kube::helpers::backup_file(){
  cp -f ${1} ${1}.backup
}

# Returns five "random" chars
kube::helpers::small_sha(){
  date | md5sum | cut -c-5
}

# Get the architecture for the current machine
kube::helpers::host_platform() {
  local host_os
  local host_arch
  case "$(uname -s)" in
    Linux)
      host_os=linux;;
    *)
      kube::log::fatal "Unsupported host OS. Must be linux.";;
  esac

  case "$(uname -m)" in
    x86_64*)
      host_arch=amd64;;
    i?86_64*)
      host_arch=amd64;;
    amd64*)
      host_arch=amd64;;
    aarch64*)
      host_arch=arm64;;
    arm64*)
      host_arch=arm64;;
    arm*)
      host_arch=arm;;
    ppc64le*)
      host_arch=ppc64le;;
    *)
      kube::log::fatal "Unsupported host arch. Must be x86_64, arm, arm64 or ppc64le.";;
  esac
  echo "${host_os}/${host_arch}"
}

kube::helpers::parse_version() {
  local -r version_regex="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-(beta|alpha)\\.(0|[1-9][0-9]*))?$"
  local -r version="${1-}"
  [[ "${version}" =~ ${version_regex} ]] || {
    kube::log::fatal "Invalid release version: '${version}', must match regex ${version_regex}"
    return 1
  }
  VERSION_MAJOR="${BASH_REMATCH[1]}"
  VERSION_MINOR="${BASH_REMATCH[2]}"
  VERSION_PATCH="${BASH_REMATCH[3]}"
  VERSION_EXTRA="${BASH_REMATCH[4]}"
  VERSION_PRERELEASE="${BASH_REMATCH[5]}"
  VERSION_PRERELEASE_REV="${BASH_REMATCH[6]}"
}

# Print a status line. Formatted to show up in a stream of output.
kube::log::status() {
  timestamp=$(date +"[%m%d %H:%M:%S]")
  echo "+++ $timestamp $1"
  shift
  for message; do
    echo "    $message"
  done
}

# Log an error and exit
kube::log::fatal() {
  timestamp=$(date +"[%m%d %H:%M:%S]")
  echo "!!! $timestamp ${1-}" >&2
  shift
  for message; do
    echo "    $message" >&2
  done
  exit 1
}


text:
//
//  HMDealAnnoRightButton.m
//  黑团HD
//
//  Created by apple on 14-8-27.
//  Copyright (c) 2014年 heima. All rights reserved.
//

#import "HMDealAnnoRightButton.h"

@implementation HMDealAnnoRightButton

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end


text:
import * as React from "react";
import * as renderer from "react-test-renderer";

import Progress from "../../src/components/Progress";

describe("Progress", () => {
  it("should render Progress", () => {
    const tree = renderer.create(
      <Progress
        size="4"
        color="primary"
      />
    ).toJSON();

    expect(tree).toMatchSnapshot();
  });
});


text:
game: Telestrations
players: 8
position: 6th
opinion: A delightful party game
localImage: tele.jpeg
---


text:
package com.twitter.finatra.validation.tests

import com.twitter.finatra.validation.tests.caseclasses._
import com.twitter.inject.Test
import com.twitter.inject.conversions.time._
import com.twitter.util.validation.ScalaValidator
import jakarta.validation.UnexpectedTypeException
import org.joda.time.DateTime

/**
 * Options are "unwrapped" by default for validation, meaning any supplied constraint
 * annotation is applied to the contained type/value of the Option. The unwrapping
 * happens through the Validator and not in the individual ConstraintValidator thus we
 * test though a Validator here and why these tests are not in the individual ConstraintValidator
 * tests.
 */
class OptionUnwrappingTest extends Test with AssertValidation {

  override protected val validator: ScalaValidator = ScalaValidator.builder.validator

  test("AssertFalse") {
    assertValidation(
      obj = AssertFalseOptionExample(Some(true)),
      withErrors = Seq(
        "boolValue: must be false"
      )
    )
    assertValidation(obj = AssertFalseOptionExample(None))
  }

  test("AssertTrue") {
    assertValidation(
      obj = AssertTrueOptionExample(Some(false)),
      withErrors = Seq(
        "boolValue: must be true"
      )
    )
    assertValidation(obj = AssertTrueOptionExample(None))
  }

  test("CountryCode") {
    assertValidation(
      obj = CountryCodeOptionExample(Some("11")),
      withErrors = Seq(
        "countryCode: [11] is not a valid country code"
      )
    )
    assertValidation(obj = CountryCodeOptionExample(None))

    assertValidation(
      obj = CountryCodeOptionSeqExample(Some(Seq("11", "22"))),
      withErrors = Seq(
        "countryCode: [11,22] is not a valid country code"
      )
    )
    assertValidation(obj = CountryCodeOptionSeqExample(None))

    assertValidation(
      obj = CountryCodeOptionArrayExample(Some(Array("11", "22"))),
      withErrors = Seq(
        "countryCode: [11,22] is not a valid country code"
      )
    )
    assertValidation(obj = CountryCodeOptionArrayExample(None))

    assertValidation(
      obj = CountryCodeOptionInvalidTypeExample(Some(12345L)),
      withErrors = Seq(
        "countryCode: [12345] is not a valid country code"
      )
    )
    assertValidation(obj = CountryCodeOptionInvalidTypeExample(None))
  }

  test("FutureTime") {
    val notFutureTime: DateTime = DateTime.now().minusWeeks(5)
    assertValidation(
      obj = FutureOptionExample(Some(notFutureTime)),
      withErrors = Seq(
        "dateTime: [%s] is not in the future".format(notFutureTime.utcIso8601)
      )
    )
    assertValidation(obj = FutureOptionExample(None))
  }

  test("Max") {
    assertValidation(
      obj = MaxOptionIntExample(Some(1)),
      withErrors = Seq(
        "numberValue: [1] is not less than or equal to 0"
      )
    )
    assertValidation(MaxOptionIntExample(None))

    assertValidation(
      obj = MaxOptionDoubleExample(Some(1.0d)),
      withErrors = Seq(
        "numberValue: [1.0] is not less than or equal to 0"
      )
    )
    assertValidation(MaxOptionDoubleExample(None))

    assertValidation(
      obj = MaxOptionFloatExample(Some(1.0f)),
      withErrors = Seq(
        "numberValue: [1.0] is not less than or equal to 0"
      )
    )
    assertValidation(MaxOptionFloatExample(None))

    assertValidation(
      obj = MaxOptionLongExample(Some(1L)),
      withErrors = Seq(
        "numberValue: [1] is not less than or equal to 0"
      )
    )
    assertValidation(MaxOptionLongExample(None))

    assertValidation(
      obj = MaxOptionBigIntExample(Some(BigInt(1))),
      withErrors = Seq(
        "numberValue: [1] is not less than or equal to 0"
      )
    )
    assertValidation(MaxOptionBigIntExample(None))

    assertValidation(
      obj = MaxOptionBigDecimalExample(Some(BigDecimal(1.0d))),
      withErrors = Seq(
        "numberValue: [1.0] is not less than or equal to 0"
      )
    )
    assertValidation(MaxOptionBigDecimalExample(None))

    val maxOptionSeq = Option(for (_ <- 1 to 102) yield 9)
    assertValidation(
      obj = MaxOptionSeqExample(maxOptionSeq),
      withErrors = Seq(
        "numberValue: [102] is not less than or equal to 100"
      )
    )
    assertValidation(MaxOptionSeqExample(None))

    val maxOptionMap = Option((for {
      i <- 1 to 102
    } yield { i.toString -> 9 }).toMap)
    assertValidation(
      obj = MaxOptionMapExample(maxOptionMap),
      withErrors = Seq(
        "numberValue: [102] is not less than or equal to 100"
      )
    )
    assertValidation(MaxOptionMapExample(None))

    val maxOptionArray = Option((for (_ <- 1 to 102) yield 9).toArray)
    assertValidation(
      obj = MaxOptionArrayExample(maxOptionArray),
      withErrors = Seq(
        "numberValue: [102] is not less than or equal to 100"
      )
    )
    assertValidation(MaxOptionArrayExample(None))

    val e = intercept[UnexpectedTypeException] {
      assertValidation(MaxOptionInvalidTypeExample(Some("foobar")))
    }
    e.getMessage should be(
      "Class [java.lang.String] is not supported by com.twitter.finatra.validation.constraints.MaxConstraintValidator")
    assertValidation(MaxOptionInvalidTypeExample(None))
  }

  test("Min") {
    assertValidation(
      obj = MinOptionIntExample(Some(0)),
      withErrors = Seq(
        "numberValue: [0] is not greater than or equal to 1"
      )
    )
    assertValidation(MinOptionIntExample(None))

    assertValidation(
      obj = MinOptionLongExample(Some(0L)),
      withErrors = Seq(
        "numberValue: [0] is not greater than or equal to 1"
      )
    )
    assertValidation(MinOptionLongExample(None))

    assertValidation(
      obj = MinOptionDoubleExample(Some(0.0d)),
      withErrors = Seq(
        "numberValue: [0.0] is not greater than or equal to 1"
      )
    )
    assertValidation(MinOptionDoubleExample(None))

    assertValidation(
      obj = MinOptionFloatExample(Some(0.0f)),
      withErrors = Seq(
        "numberValue: [0.0] is not greater than or equal to 1"
      )
    )
    assertValidation(MinOptionFloatExample(None))

    assertValidation(
      obj = MinOptionBigIntExample(Some(BigInt(0))),
      withErrors = Seq(
        "numberValue: [0] is not greater than or equal to 1"
      )
    )
    assertValidation(MinOptionBigIntExample(None))

    assertValidation(
      obj = MinOptionBigDecimalExample(Some(BigDecimal(0.0d))),
      withErrors = Seq(
        "numberValue: [0.0] is not greater than or equal to 1"
      )
    )
    assertValidation(MinOptionBigDecimalExample(None))

    assertValidation(
      obj = MinOptionSeqExample(Some(Seq.empty)),
      withErrors = Seq(
        "numberValue: [0] is not greater than or equal to 10"
      )
    )
    assertValidation(MinOptionSeqExample(None))

    assertValidation(
      obj = MinOptionMapExample(Some(Map.empty)),
      withErrors = Seq(
        "numberValue: [0] is not greater than or equal to 10"
      )
    )
    assertValidation(MinOptionMapExample(None))

    assertValidation(
      obj = MinOptionArrayExample(Some(Array.empty)),
      withErrors = Seq(
        "numberValue: [0] is not greater than or equal to 10"
      )
    )
    assertValidation(MinOptionArrayExample(None))

    val e = intercept[UnexpectedTypeException] {
      assertValidation(MinOptionInvalidTypeExample(Some("10")))
    }
    e.getMessage should be(
      "Class [java.lang.String] is not supported by com.twitter.finatra.validation.constraints.MinConstraintValidator")
    assertValidation(MinOptionInvalidTypeExample(None))
  }

  test("NotEmpty") {
    assertValidation(
      obj = NotEmptyOptionExample(Some("")),
      withErrors = Seq(
        "stringValue: cannot be empty"
      )
    )
    assertValidation(NotEmptyOptionExample(None))

    assertValidation(
      obj = NotEmptyOptionArrayExample(Some(Array.empty)),
      withErrors = Seq(
        "stringValue: cannot be empty"
      )
    )
    assertValidation(NotEmptyOptionArrayExample(None))

    assertValidation(
      obj = NotEmptyOptionMapExample(Some(Map.empty)),
      withErrors = Seq(
        "stringValue: cannot be empty"
      )
    )
    assertValidation(NotEmptyOptionMapExample(None))

    assertValidation(
      obj = NotEmptyOptionSeqExample(Some(Seq.empty)),
      withErrors = Seq(
        "stringValue: cannot be empty"
      )
    )
    assertValidation(NotEmptyOptionSeqExample(None))

    val e = intercept[UnexpectedTypeException] {
      assertValidation(NotEmptyOptionInvalidTypeExample(Some(10L)))
    }
    e.getMessage should be(
      "Class [java.lang.Long] is not supported by com.twitter.finatra.validation.constraints.NotEmptyConstraintValidator")
    assertValidation(NotEmptyOptionInvalidTypeExample(None))
  }

  test("OneOf") {
    assertValidation(
      obj = OneOfOptionExample(Some("g")),
      withErrors = Seq(
        "enumValue: [g] is not one of [a,B,c]"
      )
    )
    assertValidation(OneOfOptionExample(None))

    assertValidation(
      obj = OneOfOptionSeqExample(Some(Seq("g", "h", "i"))),
      withErrors = Seq(
        "enumValue: [g,h,i] is not one of [a,B,c]"
      )
    )
    assertValidation(OneOfOptionSeqExample(None))

    assertValidation(
      obj = OneOfOptionInvalidTypeExample(Some(10L)),
      withErrors = Seq(
        "enumValue: [10] is not one of [a,B,c]"
      )
    )
    assertValidation(OneOfOptionInvalidTypeExample(None))
  }

  test("PastTime") {
    val notPastTime: DateTime = DateTime.now().plusWeeks(5)
    assertValidation(
      obj = PastOptionExample(Some(notPastTime)),
      withErrors = Seq(
        "dateTime: [%s] is not in the past".format(notPastTime.utcIso8601)
      )
    )
    assertValidation(PastOptionExample(None))
  }

  test("Pattern") {
    assertValidation(
      obj = NumberPatternOptionExample(Some("words")),
      withErrors = Seq(
        "stringValue: [words] does not match regex [0-9]+"
      )
    )
    assertValidation(NumberPatternOptionExample(None))

    assertValidation(
      obj = NumberPatternOptionArrayExample(Some(Array("22", "words"))),
      withErrors = Seq(
        "stringValue: [22,words] does not match regex [0-9]+"
      )
    )
    assertValidation(NumberPatternOptionArrayExample(None))

    // empty regex matches everything
    assertValidation(EmptyPatternOptionExample(Some("notEmpty")))
    assertValidation(EmptyPatternOptionExample(None))

    assertValidation(
      obj = InvalidPatternOptionExample(Some("notEmpty")),
      withErrors = Seq(
        "stringValue: java.util.regex.PatternSyntaxException"
      )
    )
    assertValidation(InvalidPatternOptionExample(None))
  }

  test("Range") {
    assertValidation(
      obj = RangeOptionIntExample(Some(55)),
      withErrors = Seq(
        "pointValue: [55] is not between 1 and 50"
      )
    )
    assertValidation(RangeOptionIntExample(None))

    assertValidation(
      obj = RangeOptionLongExample(Some(55L)),
      withErrors = Seq(
        "pointValue: [55] is not between 1 and 50"
      )
    )
    assertValidation(RangeOptionLongExample(None))

    assertValidation(
      obj = RangeOptionDoubleExample(Some(55.0d)),
      withErrors = Seq(
        "pointValue: [55.0] is not between 1 and 50"
      )
    )
    assertValidation(RangeOptionDoubleExample(None))

    assertValidation(
      obj = RangeOptionFloatExample(Some(55.0f)),
      withErrors = Seq(
        "pointValue: [55.0] is not between 1 and 50"
      )
    )
    assertValidation(RangeOptionFloatExample(None))

    assertValidation(
      obj = RangeOptionBigDecimalExample(Some(BigDecimal(55.0d))),
      withErrors = Seq(
        "pointValue: [55.0] is not between 1 and 50"
      )
    )
    assertValidation(RangeOptionBigDecimalExample(None))

    assertValidation(
      obj = RangeOptionBigIntExample(Some(BigInt(55))),
      withErrors = Seq(
        "pointValue: [55] is not between 1 and 50"
      )
    )
    assertValidation(RangeOptionBigIntExample(None))

    val e = intercept[UnexpectedTypeException] {
      assertValidation(RangeOptionInvalidTypeExample(Some("hello")))
    }
    e.getMessage should be(
      "Class [java.lang.String] is not supported by com.twitter.finatra.validation.constraints.RangeConstraintValidator")
    assertValidation(RangeOptionInvalidTypeExample(None))
  }

  test("Size") {
    assertValidation(
      obj = SizeOptionArrayExample(Some(Array.empty)),
      withErrors = Seq(
        "sizeValue: size [0] is not between 10 and 50"
      )
    )
    assertValidation(SizeOptionArrayExample(None))

    assertValidation(
      obj = SizeOptionSeqExample(Some(Seq.empty)),
      withErrors = Seq(
        "sizeValue: size [0] is not between 10 and 50"
      )
    )
    assertValidation(SizeOptionSeqExample(None))

    assertValidation(
      obj = SizeOptionMapExample(Some(Map.empty)),
      withErrors = Seq(
        "sizeValue: size [0] is not between 10 and 50"
      )
    )
    assertValidation(SizeOptionMapExample(None))

    assertValidation(
      obj = SizeOptionStringExample(Some("")),
      withErrors = Seq(
        "sizeValue: size [0] is not between 10 and 140"
      )
    )
    assertValidation(SizeOptionStringExample(None))

    val e = intercept[UnexpectedTypeException] {
      assertValidation(SizeOptionInvalidTypeExample(Some(10)))
    }
    e.getMessage should be(
      "Class [java.lang.Integer] is not supported by com.twitter.finatra.validation.constraints.SizeConstraintValidator")
    assertValidation(SizeOptionInvalidTypeExample(None))
  }

  test("TimeGranularity") {
    val dateTime = new DateTime("2014-3-26T01:10:10.001Z")

    val nano = java.util.concurrent.TimeUnit.NANOSECONDS.toNanos(dateTime.getMillis)
    assertValidation(TimeGranularityOptionNanosecondsExample(Some(new DateTime(nano))))
    assertValidation(TimeGranularityOptionNanosecondsExample(None))

    val micro = java.util.concurrent.TimeUnit.MICROSECONDS.toMicros(dateTime.getMillis)
    assertValidation(TimeGranularityOptionMicrosecondsExample(Some(new DateTime(micro))))
    assertValidation(TimeGranularityOptionMicrosecondsExample(None))

    val millis = java.util.concurrent.TimeUnit.MILLISECONDS.toMillis(dateTime.getMillis)
    assertValidation(TimeGranularityOptionMillisecondsExample(Some(new DateTime(millis))))
    assertValidation(TimeGranularityOptionMillisecondsExample(None))

    val notSeconds = java.util.concurrent.TimeUnit.MILLISECONDS.toMillis(dateTime.getMillis)
    assertValidation(
      obj = TimeGranularityOptionSecondsExample(Some(new DateTime(notSeconds))),
      withErrors = Seq(
        "timeValue: [2014-03-26T01:10:10.001Z] is not second granularity"
      )
    )
    assertValidation(TimeGranularityOptionSecondsExample(None))

    val notMinutes = java.util.concurrent.TimeUnit.MILLISECONDS.toMillis(dateTime.getMillis)
    assertValidation(
      obj = TimeGranularityOptionMinutesExample(Some(new DateTime(notMinutes))),
      withErrors = Seq(
        "timeValue: [2014-03-26T01:10:10.001Z] is not minute granularity"
      )
    )
    assertValidation(TimeGranularityOptionMinutesExample(None))

    val notHours = java.util.concurrent.TimeUnit.MILLISECONDS.toMillis(dateTime.getMillis)
    assertValidation(
      obj = TimeGranularityOptionHoursExample(Some(new DateTime(notHours))),
      withErrors = Seq(
        "timeValue: [2014-03-26T01:10:10.001Z] is not hour granularity"
      )
    )
    assertValidation(TimeGranularityOptionHoursExample(None))

    val notDays = java.util.concurrent.TimeUnit.MILLISECONDS.toMillis(dateTime.getMillis)
    assertValidation(
      obj = TimeGranularityOptionDaysExample(Some(new DateTime(notDays))),
      withErrors = Seq(
        "timeValue: [2014-03-26T01:10:10.001Z] is not day granularity"
      )
    )
    assertValidation(TimeGranularityOptionDaysExample(None))
  }

  test("UUID") {
    assertValidation(
      obj = UUIDOptionExample(Some("abcd1234")),
      withErrors = Seq(
        "uuid: [abcd1234] is not a valid UUID"
      )
    )
    assertValidation(obj = UUIDOptionExample(None))
  }
}


text:
/* ----

# Single Theme
# By: Dreamer-Paul
# Last Update: 2020.9.11

一个简洁大气,含夜间模式的 Typecho 博客模板。

本代码为奇趣保罗原创,并遵守 MIT 开源协议。欢迎访问我的博客:https://paugram.com

---- */

var Paul_Single = function (config) {
    var body = document.body;
    var content = ks.select(".post-content:not(.is-special), .page-content:not(.is-special)");

    // 菜单按钮
    this.header = function () {
        var menu = document.getElementsByClassName("head-menu")[0];

        ks.select(".toggle-btn").onclick = function () {
            menu.classList.toggle("active");
        };

        ks.select(".light-btn").onclick = this.night;

        var search = document.getElementsByClassName("search-btn")[0];
        var bar = document.getElementsByClassName("head-search")[0];

        search.addEventListener("click", function () {
            bar.classList.toggle("active");
        })
    };

    // 关灯切换
    this.night = function () {
        if(body.classList.contains("dark-theme")){
            body.classList.remove("dark-theme");
            document.cookie = "night=false;" + "path=/;" + "max-age=21600";
        }
        else{
            body.classList.add("dark-theme");
            document.cookie = "night=true;" + "path=/;" + "max-age=21600";
        }
    };

    // 目录树
    this.tree = function () {
        var id = 1;
        var wrap = ks.select(".wrap");
        var headings = content.querySelectorAll("h1, h2, h3, h4, h5, h6");

        if(headings.length > 0){
            body.classList.add("has-trees");

            var trees = ks.create("section", {
                class: "article-list",
                html: "
目录
"
            });

            ks.each(headings, function (t) {
                var cls, text = t.innerText;

                t.id = "title-" + id;

                switch (t.tagName){
                    case "H2": cls = "item-2"; break;
                    case "H3": cls = "item-3"; break;
                    case "H4": cls = "item-4"; break;
                    case "H5": cls = "item-5"; break;
                    case "H6": cls = "item-6"; break;
                }

                trees.appendChild(ks.create("a", {class: cls, text: text, href: "#title-" + id}));

                id++;
            });

            wrap.appendChild(trees);

            function toggle_tree() {
                var buttons = ks.select("footer .buttons");
                var btn = ks.create("a", {class: "toggle-list"});
                buttons.appendChild(btn);

                btn.addEventListener("click", function () {
                    trees.classList.toggle("active");
                })
            }
            toggle_tree();
        }
    };

    // 自动添加外链
    this.links = function () {
        var l = content.getElementsByTagName("a");

        if(l){
            ks.each(l, function (t) {
                t.target = "_blank";
            });
        }
    };

    this.comment_list = function () {
        ks(".comment-content [href^='#comment']").each(function (t) {
            var item = ks.select(t.getAttribute("href"));

            t.onmouseover = function () {
                item.classList.add("active");
            };

            t.onmouseout = function () {
                item.classList.remove("active");
            };
        });
    };

    // 返回页首
    this.to_top = function () {
        var btn = document.getElementsByClassName("to-top")[0];
        var scroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;

        scroll >= window.innerHeight / 2 ? btn.classList.add("active") : btn.classList.remove("active");
    };

    this.header();

    if(content){
        this.tree();
        this.links();
        this.comment_list();
    }

    // 返回页首
    window.addEventListener("scroll", this.to_top);

    // 如果开启自动夜间模式
    if(config.night){
        var hour = new Date().getHours();

        if(document.cookie.indexOf("night") === -1 && (hour <= 5 || hour >= 22)){
            document.body.classList.add("dark-theme");
            document.cookie = "night=true;" + "path=/;" + "max-age=21600";
        }
    }
    else if(document.cookie.indexOf("night") !== -1){
        if(document.cookie.indexOf("night=true") !== -1){
            document.body.classList.add("dark-theme");
        }
        else{
            document.body.classList.remove("dark-theme");
        }
    }

    // 如果开启复制内容提示
    if(config.copyright){
        document.oncopy = function () {
            ks.notice("复制内容请注明来源并保留版权信息!", {color: "yellow", overlay: true})
        };
    }
};

// 图片缩放
ks.image(".post-content:not(.is-special) img, .page-content:not(.is-special) img");

// 请保留版权说明
if (window.console && window.console.log) {
    console.log("%c Single %c https://paugram.com ","color: #fff; margin: 1em 0; padding: 5px 0; background: #ffa628;","margin: 1em 0; padding: 5px 0; background: #efefef;");
}


text:
#pragma once
#ifndef _AIMLib_LesionObservationEntity_Class_
#define _AIMLib_LesionObservationEntity_Class_

#include <vector>
#include <memory>

namespace aim_lib
{
	class AIMLIB_API LesionObservationEntity : public Entity
	{
	public:
		virtual ~LesionObservationEntity(void);
		LesionObservationEntity& operator=(const LesionObservationEntity& lesionObservationEntity);
		virtual LesionObservationEntity* Clone() const = 0;

		const iso_21090::II& GetLesionUniqueIdentifier() const;
		bool* GetIsAdditionalObservation() const;

		void SetLesionUniqueIdentifier(const iso_21090::II& newVal);
		void SetIsAdditionalObservation(bool* newVal);
	protected:
		LesionObservationEntity(void);
		LesionObservationEntity(const LesionObservationEntity& lesionObservationEntity);

		iso_21090::II _lesionUniqueIdentifier;
		std::auto_ptr<bool> _isAdditionalObservation; // default: false
	};

	typedef std::vector<LesionObservationEntity*> LesionObservationEntityPtrVector;
}
#endif // _AIMLib_LesionObservationEntity_Class_


text:
namespace net_instaweb {

ExpensiveOperationContext::ExpensiveOperationContext() {
}

ExpensiveOperationContext::~ExpensiveOperationContext() {
}

ExpensiveOperationCallback::ExpensiveOperationCallback(
    Sequence* sequence)
    : CentralControllerCallback<ExpensiveOperationContext>(sequence) {
}

ExpensiveOperationCallback::~ExpensiveOperationCallback() {
}

}  // namespace net_instaweb


text:
package vm

import (
	"flag"

	"github.com/vmware/govmomi/govc/cli"
	"github.com/vmware/govmomi/govc/flags"
	"golang.org/x/net/context"
)

type markastemplate struct {
	*flags.ClientFlag
	*flags.SearchFlag
}

func init() {
	cli.Register("vm.markastemplate", &markastemplate{})
}

func (cmd *markastemplate) Register(ctx context.Context, f *flag.FlagSet) {
	cmd.ClientFlag, ctx = flags.NewClientFlag(ctx)
	cmd.ClientFlag.Register(ctx, f)

	cmd.SearchFlag, ctx = flags.NewSearchFlag(ctx, flags.SearchVirtualMachines)
	cmd.SearchFlag.Register(ctx, f)
}

func (cmd *markastemplate) Process(ctx context.Context) error {
	if err := cmd.ClientFlag.Process(ctx); err != nil {
		return err
	}
	if err := cmd.SearchFlag.Process(ctx); err != nil {
		return err
	}
	return nil
}

func (cmd *markastemplate) Run(ctx context.Context, f *flag.FlagSet) error {
	vms, err := cmd.VirtualMachines(f.Args())
	if err != nil {
		return err
	}

	for _, vm := range vms {
		err := vm.MarkAsTemplate(context.TODO())
		if err != nil {
			return err
		}
	}

	return nil
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Physcia aegialita var. saxicola Räsänen

### Remarks
null


text:
package model;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.ImageView;

public class BaseProfileModel extends ImageView{

	//protected£º¿ÉÒÔ±»×ÓÀà·ÃÎÊ
	protected Paint paint;
	protected Paint linePaint;
	protected Bitmap bitmap = null;   //ÓÃÓڴ洢ģ°å
	protected Canvas canvasBitmap;

	protected int width, height;

	protected float[] fmlLines;
	protected boolean[] isDraw;

    protected int flag;

    public BaseProfileModel(Context context, float[] lines){
    	super(context);
    	fmlLines = new float[lines.length];
        isDraw = new boolean[lines.length-1];
        for (int i = 0; i < lines.length; i++) {
        	fmlLines[i] = lines[i];
		}
        for (int i = 0; i < lines.length-1; i++) {
        	isDraw[i] = true;
		}
        paint = new Paint();
		paint.setColor(Color.WHITE);
		paint.setStyle(Paint.Style.STROKE);//ÉèÖÿÕÐÄ
		paint.setStrokeWidth(3);
		paint.setTextSize(30);

		linePaint = new Paint();
		linePaint.setColor(Color.WHITE);
		linePaint.setStyle(Paint.Style.STROKE);//ÉèÖÿÕÐÄ
		linePaint.setStrokeWidth(6);
    }

//    public BaseProfileModel(Context context, AttributeSet attrs, float[] lines) {
//        super(context, attrs);
//        fmlLines = new float[lines.length];
//        isDraw = new boolean[lines.length-1];
//        for (int i = 0; i < lines.length; i++) {
//        	fmlLines[i] = lines[i];
//		}
//        for (int i = 0; i < lines.length-1; i++) {
//        	isDraw[i] = true;
//		}
//        paint = new Paint();
//		paint.setColor(Color.WHITE);
//		paint.setStyle(Paint.Style.STROKE);//ÉèÖÿÕÐÄ
//		paint.setStrokeWidth(3);
//		paint.setTextSize(30);
//
//		linePaint = new Paint();
//		linePaint.setColor(Color.WHITE);
//		linePaint.setStyle(Paint.Style.STROKE);//ÉèÖÿÕÐÄ
//		linePaint.setStrokeWidth(6);
//    }

	public Bitmap getProModelBitmap() {
		if (bitmap != null) {
			return bitmap;
		}else {
			return null;
		}
	}

	int num =  0;
	public void deleteProfile(int n) {
		isDraw[n-1+num] = false;
		if (num<isDraw.length-1) {
			num++;
		}
		for(int i = fmlLines.length-1; i>=n;i--){
			fmlLines[i] = fmlLines[i-1];
		}
		invalidate();
	}

}


text:
package org.apache.ambari.server.topology;

import org.apache.ambari.server.orm.entities.KerberosDescriptorEntity;

public class KerberosDescriptorImpl implements KerberosDescriptor {

    private final String name;

    private final String descriptor;

    public KerberosDescriptorImpl(String name, String descriptor) {
        this.name = name;
        this.descriptor = descriptor;
    }

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

    public String getDescriptor() {
        return descriptor;
    }

    @Override
    public KerberosDescriptorEntity toEntity() {
        KerberosDescriptorEntity entity = new KerberosDescriptorEntity();
        entity.setName(getName());
        entity.setKerberosDescriptorText(getDescriptor());
        return entity;
    }
}


text:
	<title>Vinegar.js Double Curleys Example</title>

{{VINEGAR}} ferments json data via HTML metabolization.

Some situations may require you to alter the shoe and hat delimiter of the Vinegar
template syntax. This allows you to change <{ into anything you would like!

In this example we will change the <{ into {{.

The process is fast and can render content on the fly.

You simply pass an object to the template engine with a JSON data array for
the replacement objects.

Object replacement is higharchial meaning, you can replace a Vinegar {{PIECE_OF_CANDY}}
with another {{piece_of_candy}} with another {{candy}} and so on.


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>sub! (Rake::FileList)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />

      # File lib/rake.rb, line 1471
1471:     def sub!(pat, rep)
1472:       each_with_index { |fn, i| self[i] = fn.sub(pat,rep) }
1473:       self
1474:     end


text:
package com.example.josh.socialnetwork.Login;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

import com.example.josh.socialnetwork.R;
import com.example.josh.socialnetwork.Utils.FirebaseMethods;
import com.example.josh.socialnetwork.models.User;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;

/**
 * Created by JOSH on 12-10-2017.
 */

public class RegisterActivity extends AppCompatActivity {
    private static final String TAG = "RegisterActivity";

    private Context mContext;
    private String email,password,username;
    private EditText mEmail,mPassword,mUsername;
    private TextView loadingPleasewait;
    private Button btnRegister;
    private ProgressBar mProgressBar;

    //FireBase
    private FirebaseAuth mAuth;
    private FirebaseAuth.AuthStateListener mAuthListener;
    private FirebaseMethods firebaseMethods;
    private FirebaseDatabase mFirebaseDatabase;
    private DatabaseReference myRef;

    private String append;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        mContext = RegisterActivity.this;
        firebaseMethods = new FirebaseMethods(mContext);
        Log.d(TAG, "onCreate: started");

        initwidgets();
        setupFirebaseAuth();
        init();
    }

    private void init(){
        btnRegister.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                email = mEmail.getText().toString();
                username = mUsername.getText().toString();
                password = mPassword.getText().toString();

                if(checkInputs(email,username,password)){
                    mProgressBar.setVisibility(View.VISIBLE);
                    loadingPleasewait.setVisibility(View.VISIBLE);

                    firebaseMethods.registerNewEmail(email, password, username);
                }
            }
        });
    }

    private boolean checkInputs(String email, String username, String password){
        Log.d(TAG, "checkInputs: checking inputs for null values");
        if (email.equals("") || username.equals("")|| password.equals("")){
            Toast.makeText(mContext, "All Fields must be filled out", Toast.LENGTH_SHORT).show();
            return false;
        }
        return true;
    }
    /**
     * Initialize the Activity Widgets
     */
    private void initwidgets(){
        Log.d(TAG, "initwidgets: initializing widgets");
        mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
        loadingPleasewait = (TextView) findViewById(R.id.loadingPleasewait);
        mEmail = (EditText) findViewById(R.id.input_email);
        mUsername = (EditText) findViewById(R.id.input_username);
        btnRegister = (Button) findViewById(R.id.btn_signup);
        mPassword = (EditText) findViewById(R.id.input_password);
        mContext = RegisterActivity.this;
        mProgressBar.setVisibility(View.GONE);
        loadingPleasewait.setVisibility(View.GONE);
    }

    private boolean isStringNull(String string){
        Log.d(TAG, "isStringNull: checking if string is Null.");

        if(string.equals("")){
            return true;
        }
        else
            return false;
    }
        /*
    ------------------------------------------Firebase---------------------------------------------
    */

    /**
     * Check if @param username is already in the database
     * @param username
     */
    private void checkIfUsernameExists(final String username) {
        Log.d(TAG, "checkIfUsernameExists: Checking if Username:" + username +" already exists");

        DatabaseReference reference = FirebaseDatabase.getInstance().getReference();
        Query query = reference
                .child(getString(R.string.dbname_users))
                .orderByChild(getString(R.string.field_username))
                .equalTo(username);
        query.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {

                for(DataSnapshot singleSnapshot: dataSnapshot.getChildren()){
                    if(singleSnapshot.exists()){
                        Log.d(TAG, "CheckIfUsernameExists:onDataChange: FOUND A MATCH:" + singleSnapshot.getValue(User.class).getUsername());
                        append = myRef.push().getKey().substring(3,10);
                        Log.d(TAG, "onDataChange: username already exists . Apending random string:" + append);
                    }
                }
                String mUsername = " ";
                mUsername = username + append;
                //add new users to the database
                firebaseMethods.addNewUser(email, mUsername, "", "", "");

                Toast.makeText(mContext, "Signup Successful. Sending verification email.", Toast.LENGTH_SHORT).show();

                mAuth.signOut();
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });
    }

    /**
     * Setup the firebase auth object
     */

    private void setupFirebaseAuth(){
        Log.d(TAG, "setupFirebaseAuth: setting up firebase auth");
        mAuth = FirebaseAuth.getInstance();
        mFirebaseDatabase = FirebaseDatabase.getInstance();
        myRef = mFirebaseDatabase.getReference();

        mAuthListener = new FirebaseAuth.AuthStateListener() {
            @Override
            public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                FirebaseUser user = firebaseAuth.getCurrentUser();

                if (user != null) {
                    // User is signed in
                    Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());

                    myRef.addListenerForSingleValueEvent(new ValueEventListener() {
                        @Override
                        public void onDataChange(DataSnapshot dataSnapshot) {
                         checkIfUsernameExists(username);
                        }

                        @Override
                        public void onCancelled(DatabaseError databaseError) {

                        }
                    });

                    finish();

                } else {
                    // User is signed out
                    Log.d(TAG, "onAuthStateChanged:signed_out");
                }
                // ...
            }
        };
    }

    @Override
    public void onStart() {
        super.onStart();
        mAuth.addAuthStateListener(mAuthListener);

    }

    @Override
    public void onStop() {
        super.onStop();
        if (mAuthListener != null) {
            mAuth.removeAuthStateListener(mAuthListener);
        }
    }
}


text:
.p-listbox-list-wrapper {
    overflow: auto;
}

.p-listbox-list {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.p-listbox-item {
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.p-listbox-header {
    display: flex;
    align-items: center;
}

.p-listbox-filter-container {
    position: relative;
    flex: 1 1 auto;
}

.p-listbox-filter-icon {
    position: absolute;
    top: 50%;
    margin-top: -.5rem;
}

.p-listbox-filter {
    width: 100%;
}