// ----------------------------------------------------------------------------
// <copyright file="Enums.cs" company="Exit Games GmbH">
//   PhotonNetwork Framework for Unity - Copyright (C) 2011 Exit Games GmbH
// </copyright>
//
//
//
// <author>developer@exitgames.com</author>
// ----------------------------------------------------------------------------

#pragma warning disable 1587
/// \file
/// Wraps up several of the commonly used enumerations.
#pragma warning restore 1587

using System;
using ExitGames.Client.Photon;

///
/// This enum defines the set of MonoMessages Photon Unity Networking is using as callbacks. Implemented by PunBehaviour.
///
/// <remarks>
/// Much like "Update()" in Unity, PUN will call methods in specific situations.
/// Often, these methods are triggered when network operations complete (example: when joining a room).
///
/// All those methods are defined and described in this enum and implemented by PunBehaviour
/// (which makes it easy to implement them as override).
///
/// Each entry is the name of such a method and the description tells you when it gets used by PUN.
///
/// Make sure to read the remarks per entry as some methods have optional parameters.
/// </remarks>
/// \ingroup publicApi
public enum PhotonNetworkingMessage
{
    ///
    /// Called when the initial connection got established but before you can use the server. OnJoinedLobby() or OnConnectedToMaster() are called when PUN is ready.
    ///
    /// <remarks>
    /// This callback is only useful to detect if the server can be reached at all (technically).
    /// Most often, it's enough to implement OnFailedToConnectToPhoton() and OnDisconnectedFromPhoton().
    ///
    /// OnJoinedLobby() or OnConnectedToMaster() are called when PUN is ready.
    ///
    /// When this is called, the low level connection is established and PUN will send your AppId, the user, etc in the background.
    /// This is not called for transitions from the masterserver to game servers.
    ///
    /// Example: void OnConnectedToPhoton() { ... }
    /// </remarks>
    OnConnectedToPhoton,

    ///
    /// Called when the local user/client left a room.
    ///
    /// <remarks>
    /// When leaving a room, PUN brings you back to the Master Server.
    /// Before you can use lobbies and join or create rooms, OnJoinedLobby() or OnConnectedToMaster() will get called again.
    ///
    /// Example: void OnLeftRoom() { ... }
    /// </remarks>
    OnLeftRoom,

    ///
    /// Called after switching to a new MasterClient when the current one leaves.
    ///
    /// <remarks>
    /// This is not called when this client enters a room.
    /// The former MasterClient is still in the player list when this method get called.
    ///
    /// Example: void OnMasterClientSwitched(PhotonPlayer newMasterClient) { ... }
    /// </remarks>
    OnMasterClientSwitched,

    ///
    /// Called when a CreateRoom() call failed. Optional parameters provide ErrorCode and message.
    ///
    /// <remarks>
    /// Most likely because the room name is already in use (some other client was faster than you).
    /// PUN logs some info if the PhotonNetwork.logLevel is >= PhotonLogLevel.Informational.
    ///
    /// Example: void OnPhotonCreateRoomFailed() { ... }
    ///
    /// Example: void OnPhotonCreateRoomFailed(object[] codeAndMsg) { // codeAndMsg[0] is short ErrorCode. codeAndMsg[1] is string debug msg.  }
    /// </remarks>
    OnPhotonCreateRoomFailed,

    ///
    /// Called when a JoinRoom() call failed. Optional parameters provide ErrorCode and message.
    ///
    /// <remarks>
    /// Most likely error is that the room does not exist or the room is full (some other client was faster than you).
    /// PUN logs some info if the PhotonNetwork.logLevel is >= PhotonLogLevel.Informational.
    ///
    /// Example: void OnPhotonJoinRoomFailed() { ... }
    ///
    /// Example: void OnPhotonJoinRoomFailed(object[] codeAndMsg) { // codeAndMsg[0] is short ErrorCode. codeAndMsg[1] is string debug msg.  }
    /// </remarks>
    OnPhotonJoinRoomFailed,

    ///
    /// Called when this client created a room and entered it. OnJoinedRoom() will be called as well.
    ///
    /// <remarks>
    /// This callback is only called on the client which created a room (see PhotonNetwork.CreateRoom).
    ///
    /// As any client might close (or drop connection) anytime, there is a chance that the
    /// creator of a room does not execute OnCreatedRoom.
    ///
    /// If you need specific room properties or a "start signal", it is safer to implement
    /// OnMasterClientSwitched() and to make the new MasterClient check the room's state.
    ///
    /// Example: void OnCreatedRoom() { ... }
    /// </remarks>
    OnCreatedRoom,

    ///
    /// Called on entering a lobby on the Master Server. The actual room-list updates will call OnReceivedRoomListUpdate().
    ///
    /// <remarks>
    /// Note: When PhotonNetwork.autoJoinLobby is false, OnConnectedToMaster() will be called and the room list won't become available.
    ///
    /// While in the lobby, the roomlist is automatically updated in fixed intervals (which you can't modify).
    /// The room list gets available when OnReceivedRoomListUpdate() gets called after OnJoinedLobby().
    ///
    /// Example: void OnJoinedLobby() { ... }
    /// </remarks>
    OnJoinedLobby,

    ///
    /// Called after leaving a lobby.
    ///
    /// <remarks>
    /// When you leave a lobby, [CreateRoom](@ref PhotonNetwork.CreateRoom) and [JoinRandomRoom](@ref PhotonNetwork.JoinRandomRoom)
    /// automatically refer to the default lobby.
    ///
    /// Example: void OnLeftLobby() { ... }
    /// </remarks>
    OnLeftLobby,

    ///
    /// Called after disconnecting from the Photon server.
    ///
    /// <remarks>
    /// In some cases, other callbacks are called before OnDisconnectedFromPhoton is called.
    /// Examples: OnConnectionFail() and OnFailedToConnectToPhoton().
    ///
    /// Example: void OnDisconnectedFromPhoton() { ... }
    /// </remarks>
    OnDisconnectedFromPhoton,

    ///
    /// Called when something causes the connection to fail (after it was established), followed by a call to OnDisconnectedFromPhoton().
    ///
    /// <remarks>
    /// If the server could not be reached in the first place, OnFailedToConnectToPhoton is called instead.
    /// The reason for the error is provided as StatusCode.
    ///
    /// Example: void OnConnectionFail(DisconnectCause cause) { ... }
    /// </remarks>
    OnConnectionFail,

    ///
    /// Called if a connect call to the Photon server failed before the connection was established, followed by a call to OnDisconnectedFromPhoton().
    ///
    /// <remarks>
    /// OnConnectionFail only gets called when a connection to a Photon server was established in the first place.
    ///
    /// Example: void OnFailedToConnectToPhoton(DisconnectCause cause) { ... }
    /// </remarks>
    OnFailedToConnectToPhoton,

    ///
    /// Called for any update of the room-listing while in a lobby (PhotonNetwork.insideLobby) on the Master Server.
    ///
    /// <remarks>
    /// PUN provides the list of rooms by PhotonNetwork.GetRoomList().

    /// Each item is a RoomInfo which might include custom properties (provided you defined those as lobby-listed when creating a room).
    ///
    /// Not all types of lobbies provide a listing of rooms to the client. Some are silent and specialized for server-side matchmaking.
    ///
    /// Example: void OnReceivedRoomListUpdate() { ... }
    /// </remarks>
    OnReceivedRoomListUpdate,

    ///
    /// Called when entering a room (by creating or joining it). Called on all clients (including the Master Client).
    ///
    /// <remarks>
    /// This method is commonly used to instantiate player characters.
    /// If a match has to be started "actively", you can instead call an [PunRPC](@ref PhotonView.RPC) triggered by a user's button-press or a timer.
    ///
    /// When this is called, you can usually already access the existing players in the room via PhotonNetwork.playerList.
    /// Also, all custom properties should be already available as Room.customProperties. Check Room.playerCount to find out if
    /// enough players are in the room to start playing.
    ///
    /// Example: void OnJoinedRoom() { ... }
    /// </remarks>
    OnJoinedRoom,

    ///
    /// Called when a remote player entered the room. This PhotonPlayer is already added to the playerlist at this time.
    ///
    /// <remarks>
    /// If your game starts with a certain number of players, this callback can be useful to check the
    /// Room.playerCount and find out if you can start.
    ///
    /// Example: void OnPhotonPlayerConnected(PhotonPlayer newPlayer) { ... }
    /// </remarks>
    OnPhotonPlayerConnected,

    ///
    /// Called when a remote player left the room. This PhotonPlayer is already removed from the playerlist at this time.
    ///
    /// <remarks>
    /// When your client calls PhotonNetwork.leaveRoom, PUN will call this method on the remaining clients.
    /// When a remote client drops connection or gets closed, this callback gets executed. after a timeout
    /// of several seconds.
    ///
    /// Example: void OnPhotonPlayerDisconnected(PhotonPlayer otherPlayer) { ... }
    /// </remarks>
    OnPhotonPlayerDisconnected,

    ///
    /// Called after a JoinRandom() call failed. Optional parameters provide ErrorCode and message.
    ///
    /// <remarks>
    /// Most likely all rooms are full or no rooms are available.
    /// When using multiple lobbies (via JoinLobby or TypedLobby), another lobby might have more/fitting rooms.
    /// PUN logs some info if the PhotonNetwork.logLevel is >= PhotonLogLevel.Informational.
    ///
    /// Example: void OnPhotonRandomJoinFailed() { ... }
    ///
    /// Example: void OnPhotonRandomJoinFailed(object[] codeAndMsg) { // codeAndMsg[0] is short ErrorCode. codeAndMsg[1] is string debug msg.  }
    /// </remarks>
    OnPhotonRandomJoinFailed,

    ///
    /// Called after the connection to the master is established and authenticated but only when PhotonNetwork.autoJoinLobby is false.
    ///
    /// <remarks>
    /// If you set PhotonNetwork.autoJoinLobby to true, OnJoinedLobby() will be called instead of this.
    ///
    /// You can join rooms and create them even without being in a lobby. The default lobby is used in that case.
    /// The list of available rooms won't become available unless you join a lobby via PhotonNetwork.joinLobby.
    ///
    /// Example: void OnConnectedToMaster() { ... }
    /// </remarks>
    OnConnectedToMaster,

    ///
    /// Implement to customize the data a PhotonView regularly synchronizes. Called every 'network-update' when observed by PhotonView.
    ///
    /// <remarks>
    /// This method will be called in scripts that are assigned as Observed component of a PhotonView.
    /// PhotonNetwork.sendRateOnSerialize affects how often this method is called.
    /// PhotonNetwork.sendRate affects how often packages are sent by this client.
    ///
    /// Implementing this method, you can customize which data a PhotonView regularly synchronizes.
    /// Your code defines what is being sent (content) and how your data is used by receiving clients.
    ///
    /// Unlike other callbacks, OnPhotonSerializeView only gets called when it is assigned
    /// to a PhotonView as PhotonView.observed script.
    ///
    /// To make use of this method, the PhotonStream is essential. It will be in "writing" mode" on the
    /// client that controls a PhotonView (PhotonStream.isWriting == true) and in "reading mode" on the
    /// remote clients that just receive that the controlling client sends.
    ///
    /// If you skip writing any value into the stream, PUN will skip the update. Used carefully, this can
    /// conserve bandwidth and messages (which have a limit per room/second).
    ///
    /// Note that OnPhotonSerializeView is not called on remote clients when the sender does not send
    /// any update. This can't be used as "x-times per second Update()".
    ///
    /// Example: void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { ... }
    /// </remarks>
    OnPhotonSerializeView,

    ///
    /// Called on all scripts on a GameObject (and children) that have been Instantiated using PhotonNetwork.Instantiate.
    ///
    /// <remarks>
    /// PhotonMessageInfo parameter provides info about who created the object and when (based off PhotonNetworking.time).
    ///
    /// Example: void OnPhotonInstantiate(PhotonMessageInfo info) { ... }
    /// </remarks>
    OnPhotonInstantiate,

    ///
    /// Because the concurrent user limit was (temporarily) reached, this client is rejected by the server and disconnecting.
    ///
    /// <remarks>
    /// When this happens, the user might try again later. You can't create or join rooms in OnPhotonMaxCcuReached(), cause the client will be disconnecting.
    /// You can raise the CCU limits with a new license (when you host yourself) or extended subscription (when using the Photon Cloud).
    /// The Photon Cloud will mail you when the CCU limit was reached. This is also visible in the Dashboard (webpage).
    ///
    /// Example: void OnPhotonMaxCccuReached() { ... }
    /// </remarks>
    OnPhotonMaxCccuReached,

    ///
    /// Called when a room's custom properties changed. The propertiesThatChanged contains all that was set via Room.SetCustomProperties.
    ///
    /// <remarks>
    /// Since v1.25 this method has one parameter: Hashtable propertiesThatChanged.
    /// Changing properties must be done by Room.SetCustomProperties, which causes this callback locally, too.
    ///
    /// Example: void OnPhotonCustomRoomPropertiesChanged(Hashtable propertiesThatChanged) { ... }
    /// </remarks>
    OnPhotonCustomRoomPropertiesChanged,

    ///
    /// Called when custom player-properties are changed. Player and the changed properties are passed as object[].
    ///
    /// <remarks>
    /// Since v1.25 this method has one parameter: object[] playerAndUpdatedProps, which contains two entries.

    /// [0] is the affected PhotonPlayer.

    /// [1] is the Hashtable of properties that changed.

    ///
    /// We are using a object[] due to limitations of Unity's GameObject.SendMessage (which has only one optional parameter).
    ///
    /// Changing properties must be done by PhotonPlayer.SetCustomProperties, which causes this callback locally, too.
    ///
    /// Example:

    /// void OnPhotonPlayerPropertiesChanged(object[] playerAndUpdatedProps) {
    ///     PhotonPlayer player = playerAndUpdatedProps[0] as PhotonPlayer;
    ///     Hashtable props = playerAndUpdatedProps[1] as Hashtable;
    ///     //...
    /// }

    /// </remarks>
    OnPhotonPlayerPropertiesChanged,

    ///
    /// Called when the server sent the response to a FindFriends request and updated PhotonNetwork.Friends.
    ///
    /// <remarks>
    /// The friends list is available as PhotonNetwork.Friends, listing name, online state and
    /// the room a user is in (if any).
    ///
    /// Example: void OnUpdatedFriendList() { ... }
    /// </remarks>
    OnUpdatedFriendList,

    ///
    /// Called when the custom authentication failed. Followed by disconnect!
    ///
    /// <remarks>
    /// Custom Authentication can fail due to user-input, bad tokens/secrets.
    /// If authentication is successful, this method is not called. Implement OnJoinedLobby() or OnConnectedToMaster() (as usual).
    ///
    /// During development of a game, it might also fail due to wrong configuration on the server side.
    /// In those cases, logging the debugMessage is very important.
    ///
    /// Unless you setup a custom authentication service for your app (in the [Dashboard](https://www.photonengine.com/dashboard)),
    /// this won't be called!
    ///
    /// Example: void OnCustomAuthenticationFailed(string debugMessage) { ... }
    /// </remarks>
    OnCustomAuthenticationFailed,

    ///
    /// Called when your Custom Authentication service responds with additional data.
    ///
    /// <remarks>
    /// Custom Authentication services can include some custom data in their response.
    /// When present, that data is made available in this callback as Dictionary.
    /// While the keys of your data have to be strings, the values can be either string or a number (in Json).
    /// You need to make extra sure, that the value type is the one you expect. Numbers become (currently) int64.
    ///
    /// Example: void OnCustomAuthenticationResponse(Dictionary<string, object> data) { ... }
    /// </remarks>
    /// <see cref="https://doc.photonengine.com/en/realtime/current/reference/custom-authentication"/>
    OnCustomAuthenticationResponse,

    ///
    /// Called by PUN when the response to a WebRPC is available. See PhotonNetwork.WebRPC.
    ///
    /// <remarks>
    /// Important: The response.ReturnCode is 0 if Photon was able to reach your web-service.
    /// The content of the response is what your web-service sent. You can create a WebResponse instance from it.
    /// Example: WebRpcResponse webResponse = new WebRpcResponse(operationResponse);
    ///
    /// Please note: Class OperationResponse is in a namespace which needs to be "used":
    /// using ExitGames.Client.Photon;  // includes OperationResponse (and other classes)
    ///
    /// The OperationResponse.ReturnCode by Photon is:
    ///  0 for "OK"
    /// -3 for "Web-Service not configured" (see Dashboard / WebHooks)
    /// -5 for "Web-Service does now have RPC path/name" (at least for Azure)
    ///
    /// Example: void OnWebRpcResponse(OperationResponse response) { ... }
    /// </remarks>
    OnWebRpcResponse,

    ///
    /// Called when another player requests ownership of a PhotonView from you (the current owner).
    ///
    /// <remarks>
    /// The parameter viewAndPlayer contains:
    ///
    /// PhotonView view = viewAndPlayer[0] as PhotonView;
    ///
    /// PhotonPlayer requestingPlayer = viewAndPlayer[1] as PhotonPlayer;
    /// </remarks>
    /// <example>void OnOwnershipRequest(object[] viewAndPlayer) {} //</example>
    OnOwnershipRequest,

    ///
    /// Called when the Master Server sent an update for the Lobby Statistics, updating PhotonNetwork.LobbyStatistics.
    ///
    /// <remarks>
    /// This callback has two preconditions:
    /// EnableLobbyStatistics must be set to true, before this client connects.
    /// And the client has to be connected to the Master Server, which is providing the info about lobbies.
    /// </remarks>
    OnLobbyStatisticsUpdate,

	///
	/// Called when a remote Photon Player activity changed. This will be called ONLY is PlayerTtl is greater then 0.
	///
	/// Use PhotonPlayer.IsInactive to check the current activity state
	///
	/// Example: void OnPhotonPlayerActivityChanged(PhotonPlayer otherPlayer) {...}
	///
	/// <remarks>
	/// This callback has precondition:
	/// PlayerTtl must be greater then 0
	/// </remarks>
	OnPhotonPlayerActivityChanged,

	///
	/// Called when a PhotonView Owner is transfered to a Player.
	///
	/// <remarks>
	/// The parameter viewAndPlayers contains:
	///
	/// PhotonView view = viewAndPlayers[0] as PhotonView;
	///
	/// PhotonPlayer newOwner = viewAndPlayers[1] as PhotonPlayer;
	///
	/// PhotonPlayer oldOwner = viewAndPlayers[2] as PhotonPlayer;
	/// </remarks>
	/// <example>void OnOwnershipTransfered(object[] viewAndPlayers) {} //</example>
	OnOwnershipTransfered,
}

/// Used to define the level of logging output created by the PUN classes. Either log errors, info (some more) or full.
/// \ingroup publicApi
public enum PhotonLogLevel
{
    /// Show only errors. Minimal output. Note: Some might be "runtime errors" which you have to expect.
    ErrorsOnly,
    /// Logs some of the workflow, calls and results.
    Informational,
    /// Every available log call gets into the console/log. Only use for debugging.
    Full
}

/// Enum of "target" options for RPCs. These define which remote clients get your RPC call.
/// \ingroup publicApi
public enum PhotonTargets
{
    /// Sends the RPC to everyone else and executes it immediately on this client. Player who join later will not execute this RPC.
    All,
    /// Sends the RPC to everyone else. This client does not execute the RPC. Player who join later will not execute this RPC.
    Others,
    /// Sends the RPC to MasterClient only. Careful: The MasterClient might disconnect before it executes the RPC and that might cause dropped RPCs.
    MasterClient,
    /// Sends the RPC to everyone else and executes it immediately on this client. New players get the RPC when they join as it's buffered (until this client leaves).
    AllBuffered,
    /// Sends the RPC to everyone. This client does not execute the RPC. New players get the RPC when they join as it's buffered (until this client leaves).
    OthersBuffered,
    /// Sends the RPC to everyone (including this client) through the server.
    /// <remarks>
    /// This client executes the RPC like any other when it received it from the server.
    /// Benefit: The server's order of sending the RPCs is the same on all clients.
    /// </remarks>
    AllViaServer,
    /// Sends the RPC to everyone (including this client) through the server and buffers it for players joining later.
    /// <remarks>
    /// This client executes the RPC like any other when it received it from the server.
    /// Benefit: The server's order of sending the RPCs is the same on all clients.
    /// </remarks>
    AllBufferedViaServer
}

/// Currently available Photon Cloud regions as enum.
/// <remarks>
/// This is used in PhotonNetwork.ConnectToRegion.
/// </remarks>
public enum CloudRegionCode
{
    /// European servers in Amsterdam.
    eu = 0,
    /// US servers (East Coast).
    us = 1,
    /// Asian servers in Singapore.
    asia = 2,
    /// Japanese servers in Tokyo.
    jp = 3,
    /// Australian servers in Melbourne.
    au = 5,
    ///USA West, San José, usw
    usw = 6,
    ///South America, Sao Paulo, sa
    sa = 7,
    ///Canada East, Montreal, cae
    cae = 8,
    ///South Korea, Seoul, kr
    kr = 9,
    ///India, Chennai, in
    @in = 10,
    /// Russia, ru
    ru = 11,

    /// No region selected.
    none = 4
};

///
/// Available regions as enum of flags. To be used as "enabled" flags for Best Region pinging.
///
/// <remarks>Note that these enum values skip CloudRegionCode.none and their values are in strict order (power of 2).</remarks>
[Flags]
public enum CloudRegionFlag
{
    eu =    1 << 0,
    us =    1 << 1,
    asia =  1 << 2,
    jp =    1 << 3,
    au =    1 << 4,
    usw =   1 << 5,
    sa =    1 << 6,
    cae =   1 << 7,
    kr =    1 << 8,
    @in =   1 << 9,
    ru =    1 << 10
};

///
/// High level connection state of the client. Better use the more detailed <see cref="ClientState"/>.
///
public enum ConnectionState
{
    Disconnected,
    Connecting,
    Connected,
    Disconnecting,
    InitializingApplication
}

///
/// Defines how the communication gets encrypted.
///
public enum EncryptionMode
{
    ///
    /// This is the default encryption mode: Messages get encrypted only on demand (when you send operations with the "encrypt" parameter set to true).
    ///
    PayloadEncryption,
    ///
    /// With this encryption mode for UDP, the connection gets setup and all further datagrams get encrypted almost entirely. On-demand message encryption (like in PayloadEncryption) is skipped.
    ///
    /// <remarks>
    /// This mode requires AuthOnce or AuthOnceWss as AuthMode!
    /// </remarks>
    DatagramEncryption = 10,
}

public static class EncryptionDataParameters
{
    ///
    /// Key for encryption mode
    ///
    public const byte Mode = 0;
    ///
    /// Key for first secret
    ///
    public const byte Secret1 = 1;
    ///
    /// Key for second secret
    ///
    public const byte Secret2 = 2;
}


<?php
/**
 * @runParallel
 */
class UnitTestInSubSubLevelTest extends PHPUnit_Framework_TestCase
{
    /**
     * @group fixtures
     */
    public function testTruth()
    {
        $this->assertTrue(true);
    }

    /**
     * @group fixtures
     */
    public function testFalsehood()
    {
        $this->assertFalse(false);
    }

    /**
     * @group fixtures
     */
    public function testArrayLength()
    {
        $elems = array(1,2,3,4,5);
        $this->assertEquals(5, sizeof($elems));
    }
}


@interface MyViewController () @end

@implementation MyViewController {}

@synthesize webView, baseURL, url;

- (void)viewDidLoad
{
	[super viewDidLoad];
	self.title = @"Presented ViewController";
	[self.webView setMainFrameURL:[self appURL]];
}

- (IBAction)dismiss:(id)sender
{
	if (self.presentingViewController) {
		[self.presentingViewController dismissViewController:self];
	} else {
		// for the 'show' transition
		[self.view.window close];
	}
}

// Changes the greeting message by executing a function in JavaScript.
// This is triggered from the Change Greeting menu item.
- (IBAction)changeGreeting:(id)sender
{
	[[webView windowScriptObject] evaluateWebScript:@"changeGreeting('Hello from Objective-C!')"];
}

// Here we grab the URL to the bundled index.html document.
// Normally it would be the URL to your web app such as @"http://example.com".
- (NSString *)appURL
{
	// return [[[NSBundle mainBundle] URLForResource:@"http://www.google" withExtension:@"html"] absoluteString];

//	self.baseURL	= [NSURL URLWithString:@"file:///path/to/web_root/"];
//	self.url		= [NSURL URLWithString:@"folder/file.html" relativeToURL:self.baseURL];

    NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
    self.url = [NSURL fileURLWithPath:path];
    [[self.webView mainFrame] loadRequest:[NSURLRequest requestWithURL:self.url]];

	NSURL *absURL = [self.url absoluteURL];
	NSLog(@"absURL = %@", absURL);
	NSString *getURL = [NSString stringWithContentsOfURL:absURL encoding:1000 error:nil];
	// self.title = [NSString stringWithContentsOfURL:absURL encoding:1000 error:nil];;

	return getURL;
}

// This delegate method gets triggered every time the page loads, but before the JavaScript runs
- (void)webView:(WebView *)webView windowScriptObjectAvailable:(WebScriptObject *)windowScriptObject
{
	// Allow this class to be usable through the "window.app" object in JavaScript
	// This could be any Objective-C class
	[windowScriptObject setValue:self forKey:@"app"];
}

- (IBAction)resetSafari:(id)sender {

	[self openAppleScript:(NSString *)@"SafariCloseAllWindows"];
    [self openAppleScript:(NSString *)@"ResetSafari"];

}

#pragma mark ViewController openAppleScript

- (void)openAppleScript:(NSString *)scriptName
{
    NSLog(@"%@", NSStringFromSelector(_cmd));
    NSString		*path			= [[NSBundle mainBundle] pathForResource:scriptName ofType:@"scpt"];
    NSURL			*openUrl			= [NSURL fileURLWithPath:path]; NSDictionary *errors = [NSDictionary dictionary];
    NSAppleScript	*appleScript	= [[NSAppleScript alloc] initWithContentsOfURL:openUrl error:&errors];
    [appleScript executeAndReturnError:nil];
}

- (IBAction)openMyPayPal:(id)sender{

    [self openAppleScript:(NSString *)@"OpenMyPaypal"];

}

@end


/**
 * @author Toru Nagashima
 * See LICENSE file in root directory for full license.
 */
"use strict"

const { READ } = require("eslint-utils")
const checkForPreferGlobal = require("../../util/check-prefer-global")

const trackMap = {
    globals: {
        process: { [READ]: true },
    },
    modules: {
        process: { [READ]: true },
    },
}

module.exports = {
    meta: {
        docs: {
            description: 'enforce either `process` or `require("process")`',
            category: "Stylistic Issues",
            recommended: false,
            url:
                "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/prefer-global/process.md",
        },
        type: "suggestion",
        fixable: null,
        schema: [{ enum: ["always", "never"] }],
        messages: {
            preferGlobal:
                "Unexpected use of 'require(\"process\")'. Use the global variable 'process' instead.",
            preferModule:
                "Unexpected use of the global variable 'process'. Use 'require(\"process\")' instead.",
        },
    },

    create(context) {
        return {
            "Program:exit"() {
                checkForPreferGlobal(context, trackMap)
            },
        }
    },
}


using System;
using System.Diagnostics;

#pragma warning disable 1591
// ReSharper disable UnusedMember.Global
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable IntroduceOptionalParameters.Global
// ReSharper disable MemberCanBeProtected.Global
// ReSharper disable InconsistentNaming

// ReSharper disable once CheckNamespace
namespace StackingEntities.Model.Annotations
{
  ///
  /// Indicates that the value of the marked element could be <c>null</c> sometimes,
  /// so the check for <c>null</c> is necessary before its usage
  ///
  /// <example>
  /// [CanBeNull] public object Test() { return null; }
  /// public void UseTest() {
  ///   var p = Test();
  ///   var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
  /// }
  /// </example>
  [AttributeUsage(
    AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
    AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class CanBeNullAttribute : Attribute { }

  ///
  /// Indicates that the value of the marked element could never be <c>null</c>
  ///
  /// <example>
  /// [NotNull] public object Foo() {
  ///   return null; // Warning: Possible 'null' assignment
  /// }
  /// </example>
  [AttributeUsage(
    AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
    AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class NotNullAttribute : Attribute { }

  ///
  /// Indicates that collection or enumerable value does not contain null elements
  ///
  [AttributeUsage(
    AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
    AttributeTargets.Delegate | AttributeTargets.Field)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class ItemNotNullAttribute : Attribute { }

  ///
  /// Indicates that collection or enumerable value can contain null elements
  ///
  [AttributeUsage(
    AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
    AttributeTargets.Delegate | AttributeTargets.Field)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class ItemCanBeNullAttribute : Attribute { }

  ///
  /// Indicates that the marked method builds string by format pattern and (optional) arguments.
  /// Parameter, which contains format string, should be given in constructor. The format string
  /// should be in <see cref="string.Format(IFormatProvider,string,object[])"/>-like form
  ///
  /// <example>
  /// [StringFormatMethod("message")]
  /// public void ShowError(string message, params object[] args) { /* do something */ }
  /// public void Foo() {
  ///   ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
  /// }
  /// </example>
  [AttributeUsage(
    AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Delegate)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class StringFormatMethodAttribute : Attribute
  {
    /// <param name="formatParameterName">
    /// Specifies which parameter of an annotated method should be treated as format-string
    /// </param>
    public StringFormatMethodAttribute(string formatParameterName)
    {
      FormatParameterName = formatParameterName;
    }

    public string FormatParameterName { get; private set; }
  }

  ///
  /// For a parameter that is expected to be one of the limited set of values.
  /// Specify fields of which type should be used as values for this parameter.
  ///
  [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class ValueProviderAttribute : Attribute
  {
    public ValueProviderAttribute(string name)
    {
      Name = name;
    }

    [NotNull] public string Name { get; private set; }
  }

  ///
  /// Indicates that the function argument should be string literal and match one
  /// of the parameters of the caller function. For example, ReSharper annotates
  /// the parameter of <see cref="System.ArgumentNullException"/>
  ///
  /// <example>
  /// public void Foo(string param) {
  ///   if (param == null)
  ///     throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol
  /// }
  /// </example>
  [AttributeUsage(AttributeTargets.Parameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class InvokerParameterNameAttribute : Attribute { }

  ///
  /// Indicates that the method is contained in a type that implements
  /// <c>System.ComponentModel.INotifyPropertyChanged</c> interface and this method
  /// is used to notify that some property value changed
  ///
  /// <remarks>
  /// The method should be non-static and conform to one of the supported signatures:
  /// <list>
  /// <item><c>NotifyChanged(string)</c></item>
  /// <item><c>NotifyChanged(params string[])</c></item>
  /// <item><c>NotifyChanged{T}(Expression{Func{T}})</c></item>
  /// <item><c>NotifyChanged{T,U}(Expression{Func{T,U}})</c></item>
  /// <item><c>SetProperty{T}(ref T, T, string)</c></item>
  /// </list>
  /// </remarks>
  /// <example>
  /// public class Foo : INotifyPropertyChanged {
  ///   public event PropertyChangedEventHandler PropertyChanged;
  ///   [NotifyPropertyChangedInvocator]
  ///   protected virtual void NotifyChanged(string propertyName) { ... }
  ///
  ///   private string _name;
  ///   public string Name {
  ///     get { return _name; }
  ///     set { _name = value; NotifyChanged("LastName"); /* Warning */ }
  ///   }
  /// }
  ///
  /// Examples of generated notifications:
  /// <list>
  /// <item><c>NotifyChanged("Property")</c></item>
  /// <item><c>NotifyChanged(() => Property)</c></item>
  /// <item><c>NotifyChanged((VM x) => x.Property)</c></item>
  /// <item><c>SetProperty(ref myField, value, "Property")</c></item>
  /// </list>
  /// </example>
  [AttributeUsage(AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
  {
    public NotifyPropertyChangedInvocatorAttribute() { }
    public NotifyPropertyChangedInvocatorAttribute(string parameterName)
    {
      ParameterName = parameterName;
    }

    public string ParameterName { get; private set; }
  }

  ///
  /// Describes dependency between method input and output
  ///
  /// <syntax>
  ///
Function Definition Table syntax:

  /// <list>
  /// <item>FDT      ::= FDTRow [;FDTRow]*</item>
  /// <item>FDTRow   ::= Input => Output | Output <= Input</item>
  /// <item>Input    ::= ParameterName: Value [, Input]*</item>
  /// <item>Output   ::= [ParameterName: Value]* {halt|stop|void|nothing|Value}</item>
  /// <item>Value    ::= true | false | null | notnull | canbenull</item>
  /// </list>
  /// If method has single input parameter, it's name could be omitted.

  /// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same)
  /// for method output means that the methos doesn't return normally.

  /// <c>canbenull</c> annotation is only applicable for output parameters.

  /// You can use multiple <c>[ContractAnnotation]</c> for each FDT row,
  /// or use single attribute with rows separated by semicolon.

  /// </syntax>
  /// <examples><list>
  /// <item>
  /// [ContractAnnotation("=> halt")]
  /// public void TerminationMethod()
  /// </item>
  /// <item>
  /// [ContractAnnotation("halt <= condition: false")]
  /// public void Assert(bool condition, string text) // regular assertion method
  /// </item>
  /// <item>
  /// [ContractAnnotation("s:null => true")]
  /// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty()
  /// </item>
  /// <item>
  /// // A method that returns null if the parameter is null,
  /// // and not null if the parameter is not null
  /// [ContractAnnotation("null => null; notnull => notnull")]
  /// public object Transform(object data)
  /// </item>
  /// <item>
  /// [ContractAnnotation("s:null=>false; =>true,result:notnull; =>false, result:null")]
  /// public bool TryParse(string s, out Person result)
  /// </item>
  /// </list></examples>
  [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class ContractAnnotationAttribute : Attribute
  {
    public ContractAnnotationAttribute([NotNull] string contract)
      : this(contract, false) { }

    public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates)
    {
      Contract = contract;
      ForceFullStates = forceFullStates;
    }

    public string Contract { get; private set; }
    public bool ForceFullStates { get; private set; }
  }

  ///
  /// Indicates that marked element should be localized or not
  ///
  /// <example>
  /// [LocalizationRequiredAttribute(true)]
  /// public class Foo {
  ///   private string str = "my string"; // Warning: Localizable string
  /// }
  /// </example>
  [AttributeUsage(AttributeTargets.All)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class LocalizationRequiredAttribute : Attribute
  {
    public LocalizationRequiredAttribute() : this(true) { }
    public LocalizationRequiredAttribute(bool required)
    {
      Required = required;
    }

    public bool Required { get; private set; }
  }

  ///
  /// Indicates that the value of the marked type (or its derivatives)
  /// cannot be compared using '==' or '!=' operators and <c>Equals()</c>
  /// should be used instead. However, using '==' or '!=' for comparison
  /// with <c>null</c> is always permitted.
  ///
  /// <example>
  /// [CannotApplyEqualityOperator]
  /// class NoEquality { }
  /// class UsesNoEquality {
  ///   public void Test() {
  ///     var ca1 = new NoEquality();
  ///     var ca2 = new NoEquality();
  ///     if (ca1 != null) { // OK
  ///       bool condition = ca1 == ca2; // Warning
  ///     }
  ///   }
  /// }
  /// </example>
  [AttributeUsage(
    AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class CannotApplyEqualityOperatorAttribute : Attribute { }

  ///
  /// When applied to a target attribute, specifies a requirement for any type marked
  /// with the target attribute to implement or inherit specific type or types.
  ///
  /// <example>
  /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement
  /// public class ComponentAttribute : Attribute { }
  /// [Component] // ComponentAttribute requires implementing IComponent interface
  /// public class MyComponent : IComponent { }
  /// </example>
  [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
  [BaseTypeRequired(typeof(Attribute))]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class BaseTypeRequiredAttribute : Attribute
  {
    public BaseTypeRequiredAttribute([NotNull] Type baseType)
    {
      BaseType = baseType;
    }

    [NotNull] public Type BaseType { get; private set; }
  }

  ///
  /// Indicates that the marked symbol is used implicitly
  /// (e.g. via reflection, in external library), so this symbol
  /// will not be marked as unused (as well as by other usage inspections)
  ///
  [AttributeUsage(AttributeTargets.All)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class UsedImplicitlyAttribute : Attribute
  {
    public UsedImplicitlyAttribute()
      : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }

    public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags)
      : this(useKindFlags, ImplicitUseTargetFlags.Default) { }

    public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags)
      : this(ImplicitUseKindFlags.Default, targetFlags) { }

    public UsedImplicitlyAttribute(
      ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
    {
      UseKindFlags = useKindFlags;
      TargetFlags = targetFlags;
    }

    public ImplicitUseKindFlags UseKindFlags { get; private set; }
    public ImplicitUseTargetFlags TargetFlags { get; private set; }
  }

  ///
  /// Should be used on attributes and causes ReSharper
  /// to not mark symbols marked with such attributes as unused
  /// (as well as by other usage inspections)
  ///
  [AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class MeansImplicitUseAttribute : Attribute
  {
    public MeansImplicitUseAttribute()
      : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }

    public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags)
      : this(useKindFlags, ImplicitUseTargetFlags.Default) { }

    public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags)
      : this(ImplicitUseKindFlags.Default, targetFlags) { }

    public MeansImplicitUseAttribute(
      ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
    {
      UseKindFlags = useKindFlags;
      TargetFlags = targetFlags;
    }

    [UsedImplicitly] public ImplicitUseKindFlags UseKindFlags { get; private set; }
    [UsedImplicitly] public ImplicitUseTargetFlags TargetFlags { get; private set; }
  }

  [Flags]
  public enum ImplicitUseKindFlags
  {
    Default = Access | Assign | InstantiatedWithFixedConstructorSignature,
    /// Only entity marked with attribute considered used
    Access = 1,
    /// Indicates implicit assignment to a member
    Assign = 2,
    ///
    /// Indicates implicit instantiation of a type with fixed constructor signature.
    /// That means any unused constructor parameters won't be reported as such.
    ///
    InstantiatedWithFixedConstructorSignature = 4,
    /// Indicates implicit instantiation of a type
    InstantiatedNoFixedConstructorSignature = 8,
  }

  ///
  /// Specify what is considered used implicitly when marked
  /// with <see cref="MeansImplicitUseAttribute"/> or <see cref="UsedImplicitlyAttribute"/>
  ///
  [Flags]
  public enum ImplicitUseTargetFlags
  {
    Default = Itself,
    Itself = 1,
    /// Members of entity marked with attribute are considered used
    Members = 2,
    /// Entity marked with attribute and all its members considered used
    WithMembers = Itself | Members
  }

  ///
  /// This attribute is intended to mark publicly available API
  /// which should not be removed and so is treated as used
  ///
  [MeansImplicitUse]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class PublicAPIAttribute : Attribute
  {
    public PublicAPIAttribute() { }
    public PublicAPIAttribute([NotNull] string comment)
    {
      Comment = comment;
    }

    public string Comment { get; private set; }
  }

  ///
  /// Tells code analysis engine if the parameter is completely handled
  /// when the invoked method is on stack. If the parameter is a delegate,
  /// indicates that delegate is executed while the method is executed.
  /// If the parameter is an enumerable, indicates that it is enumerated
  /// while the method is executed
  ///
  [AttributeUsage(AttributeTargets.Parameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class InstantHandleAttribute : Attribute { }

  ///
  /// Indicates that a method does not make any observable state changes.
  /// The same as <c>System.Diagnostics.Contracts.PureAttribute</c>
  ///
  /// <example>
  /// [Pure] private int Multiply(int x, int y) { return x * y; }
  /// public void Foo() {
  ///   const int a = 2, b = 2;
  ///   Multiply(a, b); // Waring: Return value of pure method is not used
  /// }
  /// </example>
  [AttributeUsage(AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class PureAttribute : Attribute { }

  ///
  /// Indicates that a parameter is a path to a file or a folder within a web project.
  /// Path can be relative or absolute, starting from web root (~)
  ///
  [AttributeUsage(AttributeTargets.Parameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public class PathReferenceAttribute : Attribute
  {
    public PathReferenceAttribute() { }
    public PathReferenceAttribute([PathReference] string basePath)
    {
      BasePath = basePath;
    }

    public string BasePath { get; private set; }
  }

  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute
  {
    public AspMvcAreaMasterLocationFormatAttribute(string format)
    {
      Format = format;
    }

    public string Format { get; private set; }
  }

  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute
  {
    public AspMvcAreaPartialViewLocationFormatAttribute(string format)
    {
      Format = format;
    }

    public string Format { get; private set; }
  }

  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute
  {
    public AspMvcAreaViewLocationFormatAttribute(string format)
    {
      Format = format;
    }

    public string Format { get; private set; }
  }

  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcMasterLocationFormatAttribute : Attribute
  {
    public AspMvcMasterLocationFormatAttribute(string format)
    {
      Format = format;
    }

    public string Format { get; private set; }
  }

  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute
  {
    public AspMvcPartialViewLocationFormatAttribute(string format)
    {
      Format = format;
    }

    public string Format { get; private set; }
  }

  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcViewLocationFormatAttribute : Attribute
  {
    public AspMvcViewLocationFormatAttribute(string format)
    {
      Format = format;
    }

    public string Format { get; private set; }
  }

  ///
  /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
  /// is an MVC action. If applied to a method, the MVC action name is calculated
  /// implicitly from the context. Use this attribute for custom wrappers similar to
  /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>
  ///
  [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcActionAttribute : Attribute
  {
    public AspMvcActionAttribute() { }
    public AspMvcActionAttribute(string anonymousProperty)
    {
      AnonymousProperty = anonymousProperty;
    }

    public string AnonymousProperty { get; private set; }
  }

  ///
  /// ASP.NET MVC attribute. Indicates that a parameter is an MVC area.
  /// Use this attribute for custom wrappers similar to
  /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>
  ///
  [AttributeUsage(AttributeTargets.Parameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcAreaAttribute : PathReferenceAttribute
  {
    public AspMvcAreaAttribute() { }
    public AspMvcAreaAttribute(string anonymousProperty)
    {
      AnonymousProperty = anonymousProperty;
    }

    public string AnonymousProperty { get; private set; }
  }

  ///
  /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is
  /// an MVC controller. If applied to a method, the MVC controller name is calculated
  /// implicitly from the context. Use this attribute for custom wrappers similar to
  /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String)</c>
  ///
  [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcControllerAttribute : Attribute
  {
    public AspMvcControllerAttribute() { }
    public AspMvcControllerAttribute(string anonymousProperty)
    {
      AnonymousProperty = anonymousProperty;
    }

    public string AnonymousProperty { get; private set; }
  }

  ///
  /// ASP.NET MVC attribute. Indicates that a parameter is an MVC Master. Use this attribute
  /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, String)</c>
  ///
  [AttributeUsage(AttributeTargets.Parameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcMasterAttribute : Attribute { }

  ///
  /// ASP.NET MVC attribute. Indicates that a parameter is an MVC model type. Use this attribute
  /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, Object)</c>
  ///
  [AttributeUsage(AttributeTargets.Parameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcModelTypeAttribute : Attribute { }

  ///
  /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC
  /// partial view. If applied to a method, the MVC partial view name is calculated implicitly
  /// from the context. Use this attribute for custom wrappers similar to
  /// <c>System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String)</c>
  ///
  [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcPartialViewAttribute : PathReferenceAttribute { }

  ///
  /// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method
  ///
  [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcSupressViewErrorAttribute : Attribute { }

  ///
  /// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template.
  /// Use this attribute for custom wrappers similar to
  /// <c>System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String)</c>
  ///
  [AttributeUsage(AttributeTargets.Parameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcDisplayTemplateAttribute : Attribute { }

  ///
  /// ASP.NET MVC attribute. Indicates that a parameter is an MVC editor template.
  /// Use this attribute for custom wrappers similar to
  /// <c>System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String)</c>
  ///
  [AttributeUsage(AttributeTargets.Parameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcEditorTemplateAttribute : Attribute { }

  ///
  /// ASP.NET MVC attribute. Indicates that a parameter is an MVC template.
  /// Use this attribute for custom wrappers similar to
  /// <c>System.ComponentModel.DataAnnotations.UIHintAttribute(System.String)</c>
  ///
  [AttributeUsage(AttributeTargets.Parameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcTemplateAttribute : Attribute { }

  ///
  /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
  /// is an MVC view. If applied to a method, the MVC view name is calculated implicitly
  /// from the context. Use this attribute for custom wrappers similar to
  /// <c>System.Web.Mvc.Controller.View(Object)</c>
  ///
  [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcViewAttribute : PathReferenceAttribute { }

  ///
  /// ASP.NET MVC attribute. When applied to a parameter of an attribute,
  /// indicates that this parameter is an MVC action name
  ///
  /// <example>
  /// [ActionName("Foo")]
  /// public ActionResult Login(string returnUrl) {
  ///   ViewBag.ReturnUrl = Url.Action("Foo"); // OK
  ///   return RedirectToAction("Bar"); // Error: Cannot resolve action
  /// }
  /// </example>
  [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AspMvcActionSelectorAttribute : Attribute { }

  [AttributeUsage(
    AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class HtmlElementAttributesAttribute : Attribute
  {
    public HtmlElementAttributesAttribute() { }
    public HtmlElementAttributesAttribute(string name)
    {
      Name = name;
    }

    public string Name { get; private set; }
  }

  [AttributeUsage(
    AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class HtmlAttributeValueAttribute : Attribute
  {
    public HtmlAttributeValueAttribute([NotNull] string name)
    {
      Name = name;
    }

    [NotNull] public string Name { get; private set; }
  }

  ///
  /// Razor attribute. Indicates that a parameter or a method is a Razor section.
  /// Use this attribute for custom wrappers similar to
  /// <c>System.Web.WebPages.WebPageBase.RenderSection(String)</c>
  ///
  [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class RazorSectionAttribute : Attribute { }

  ///
  /// Indicates how method invocation affects content of the collection
  ///
  [AttributeUsage(AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class CollectionAccessAttribute : Attribute
  {
    public CollectionAccessAttribute(CollectionAccessType collectionAccessType)
    {
      CollectionAccessType = collectionAccessType;
    }

    public CollectionAccessType CollectionAccessType { get; private set; }
  }

  [Flags]
  public enum CollectionAccessType
  {
    /// Method does not use or modify content of the collection
    None = 0,
    /// Method only reads content of the collection but does not modify it
    Read = 1,
    /// Method can change content of the collection but does not add new elements
    ModifyExistingContent = 2,
    /// Method can add new elements to the collection
    UpdatedContent = ModifyExistingContent | 4
  }

  ///
  /// Indicates that the marked method is assertion method, i.e. it halts control flow if
  /// one of the conditions is satisfied. To set the condition, mark one of the parameters with
  /// <see cref="AssertionConditionAttribute"/> attribute
  ///
  [AttributeUsage(AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AssertionMethodAttribute : Attribute { }

  ///
  /// Indicates the condition parameter of the assertion method. The method itself should be
  /// marked by <see cref="AssertionMethodAttribute"/> attribute. The mandatory argument of
  /// the attribute is the assertion type.
  ///
  [AttributeUsage(AttributeTargets.Parameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class AssertionConditionAttribute : Attribute
  {
    public AssertionConditionAttribute(AssertionConditionType conditionType)
    {
      ConditionType = conditionType;
    }

    public AssertionConditionType ConditionType { get; private set; }
  }

  ///
  /// Specifies assertion type. If the assertion method argument satisfies the condition,
  /// then the execution continues. Otherwise, execution is assumed to be halted
  ///
  public enum AssertionConditionType
  {
    /// Marked parameter should be evaluated to true
    IS_TRUE = 0,
    /// Marked parameter should be evaluated to false
    IS_FALSE = 1,
    /// Marked parameter should be evaluated to null value
    IS_NULL = 2,
    /// Marked parameter should be evaluated to not null value
    IS_NOT_NULL = 3,
  }

  ///
  /// Indicates that the marked method unconditionally terminates control flow execution.
  /// For example, it could unconditionally throw exception
  ///
  [Obsolete("Use [ContractAnnotation('=> halt')] instead")]
  [AttributeUsage(AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class TerminatesProgramAttribute : Attribute { }

  ///
  /// Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select,
  /// .Where). This annotation allows inference of [InstantHandle] annotation for parameters
  /// of delegate type by analyzing LINQ method chains.
  ///
  [AttributeUsage(AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class LinqTunnelAttribute : Attribute { }

  ///
  /// Indicates that IEnumerable, passed as parameter, is not enumerated.
  ///
  [AttributeUsage(AttributeTargets.Parameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class NoEnumerationAttribute : Attribute { }

  ///
  /// XAML attribute. Indicates the type that has <c>ItemsSource</c> property and should be
  /// treated as <c>ItemsControl</c>-derived type, to enable inner  items <c>DataContext</c>
  /// type resolve.
  ///
  [AttributeUsage(AttributeTargets.Class)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class XamlItemsControlAttribute : Attribute { }

  ///
  /// XAML attibute. Indicates the property of some <c>BindingBase</c>-derived type, that
  /// is used to bind some item of <c>ItemsControl</c>-derived type. This annotation will
  /// enable the <c>DataContext</c> type resolve for XAML bindings for such properties.
  ///
  /// <remarks>
  /// Property should have the tree ancestor of the <c>ItemsControl</c> type or
  /// marked with the <see cref="XamlItemsControlAttribute"/> attribute.
  /// </remarks>
  [AttributeUsage(AttributeTargets.Property)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class XamlItemBindingOfItemsControlAttribute : Attribute { }

  [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public class AspChildControlTypeAttribute : Attribute
  {
    public AspChildControlTypeAttribute(string tagName, Type controlType)
    {
      TagName = tagName;
      ControlType = controlType;
    }

    public string TagName { get; private set; }
    public Type ControlType { get; private set; }
  }

  [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public class AspDataFieldAttribute : Attribute { }

  [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public class AspDataFieldsAttribute : Attribute { }

  [AttributeUsage(AttributeTargets.Property)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public class AspMethodPropertyAttribute : Attribute { }

  [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public class AspRequiredAttributeAttribute : Attribute
  {
    public AspRequiredAttributeAttribute([NotNull] string attribute)
    {
      Attribute = attribute;
    }

    public string Attribute { get; private set; }
  }

  [AttributeUsage(AttributeTargets.Property)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public class AspTypePropertyAttribute : Attribute
  {
    public bool CreateConstructorReferences { get; private set; }

    public AspTypePropertyAttribute(bool createConstructorReferences)
    {
      CreateConstructorReferences = createConstructorReferences;
    }
  }

  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class RazorImportNamespaceAttribute : Attribute
  {
    public RazorImportNamespaceAttribute(string name)
    {
      Name = name;
    }

    public string Name { get; private set; }
  }

  [AttributeUsage(AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class RazorHelperCommonAttribute : Attribute { }

  [AttributeUsage(AttributeTargets.Property)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class RazorLayoutAttribute : Attribute { }

  [AttributeUsage(AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class RazorWriteLiteralMethodAttribute : Attribute { }

  [AttributeUsage(AttributeTargets.Method)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class RazorWriteMethodAttribute : Attribute { }

  [AttributeUsage(AttributeTargets.Parameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class RazorWriteMethodParameterAttribute : Attribute { }

  ///
  /// Indicates that parameter is regular expression pattern.
  ///
  [AttributeUsage(AttributeTargets.Parameter)]
  [Conditional("JETBRAINS_ANNOTATIONS")]
  public sealed class RegexPatternAttribute : Attribute { }

}


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

    <title>Class</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />

            Ruby on Rails 4.1.8

            Class
            Class

                <

                    Object

/home/kristof/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.8/lib/active_support/core_ext/class/attribute.rb

/home/kristof/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.8/lib/active_support/core_ext/class/delegating_attributes.rb

/home/kristof/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.8/lib/active_support/core_ext/class/subclasses.rb

Methods

C

                class_attribute

S

                subclasses,

                superclass_delegating_accessor

Instance Public methods

              class_attribute(*attrs)

            Link

Declare a class-level attribute whose value is inheritable by subclasses.
Subclasses can change their own value and it will not impact parent class.

class Base
  class_attribute :setting
end

class Subclass < Base
end

Base.setting = true
Subclass.setting            # => true
Subclass.setting = false
Subclass.setting            # => false
Base.setting                # => true

In the above case as long as Subclass does not assign a value to setting by
performing Subclass.setting = something ,
Subclass.setting would read value assigned to parent class.
Once Subclass assigns a value then the value assigned by Subclass would be
returned.

This matches normal Ruby method inheritance: think of writing an attribute
on a subclass as overriding the reader method. However, you need to be
aware when using class_attribute with mutable structures as
Array or Hash. In such cases, you don't want
to do changes in places but use setters:

Base.setting = []
Base.setting                # => []
Subclass.setting            # => []

# Appending in child changes both parent and child because it is the same object:
Subclass.setting << :foo
Base.setting               # => [:foo]
Subclass.setting           # => [:foo]

# Use setters to not propagate changes:
Base.setting = []
Subclass.setting += [:foo]
Base.setting               # => []
Subclass.setting           # => [:foo]

For convenience, an instance predicate method is defined as well. To skip
it, pass instance_predicate: false.

Subclass.setting?       # => false

Instances may overwrite the class value in the same way:

Base.setting = true
object = Base.new
object.setting          # => true
object.setting = false
object.setting          # => false
Base.setting            # => true

To opt out of the instance reader method, pass instance_reader:
false.

object.setting          # => NoMethodError
object.setting?         # => NoMethodError

To opt out of the instance writer method, pass instance_writer:
false.

object.setting = false  # => NoMethodError

To opt out of both instance methods, pass instance_accessor:
false.

                Source:
                show

# File ../.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.8/lib/active_support/core_ext/class/attribute.rb, line 71
def class_attribute(*attrs)
  options = attrs.extract_options!
  instance_reader = options.fetch(:instance_accessor, true) && options.fetch(:instance_reader, true)
  instance_writer = options.fetch(:instance_accessor, true) && options.fetch(:instance_writer, true)
  instance_predicate = options.fetch(:instance_predicate, true)

  attrs.each do |name|
    define_singleton_method(name) { nil }
    define_singleton_method("#{name}?") { !!public_send(name) } if instance_predicate

    ivar = "@#{name}"

    define_singleton_method("#{name}=") do |val|
      singleton_class.class_eval do
        remove_possible_method(name)
        define_method(name) { val }
      end

      if singleton_class?
        class_eval do
          remove_possible_method(name)
          define_method(name) do
            if instance_variable_defined? ivar
              instance_variable_get ivar
            else
              singleton_class.send name
            end
          end
        end
      end
      val
    end

    if instance_reader
      remove_possible_method name
      define_method(name) do
        if instance_variable_defined?(ivar)
          instance_variable_get ivar
        else
          self.class.public_send name
        end
      end
      define_method("#{name}?") { !!public_send(name) } if instance_predicate
    end

    attr_writer name if instance_writer
  end
end

              subclasses()

            Link

Returns an array with the direct children of self.

Integer.subclasses # => [Fixnum, Bignum]

class Foo; end
class Bar < Foo; end
class Baz < Bar; end

Foo.subclasses # => [Bar]

                Source:
                show

# File ../.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.8/lib/active_support/core_ext/class/subclasses.rb, line 35
def subclasses
  subclasses, chain = [], descendants
  chain.each do |k|
    subclasses << k unless chain.any? { |c| c > k }
  end
  subclasses
end

              superclass_delegating_accessor(name, options = {})

            Link

                Source:
                show

# File ../.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.8/lib/active_support/core_ext/class/delegating_attributes.rb, line 5
def superclass_delegating_accessor(name, options = {})
  # Create private _name and _name= methods that can still be used if the public
  # methods are overridden.
  _superclass_delegating_accessor("_#{name}", options)

  # Generate the public methods name, name=, and name?.
  # These methods dispatch to the private _name, and _name= methods, making them
  # overridable.
  singleton_class.send(:define_method, name) { send("_#{name}") }
  singleton_class.send(:define_method, "#{name}?") { !!send("_#{name}") }
  singleton_class.send(:define_method, "#{name}=") { |value| send("_#{name}=", value) }

  # If an instance_reader is needed, generate public instance methods name and name?.
  if options[:instance_reader] != false
    define_method(name) { send("_#{name}") }
    define_method("#{name}?") { !!send("#{name}") }
  end
end


<?php

namespace ZFTest\Rest;

use PHPUnit_Framework_TestCase as TestCase;
use Zend\Http\Request as HttpRequest;
use Zend\InputFilter\InputFilter;
use Zend\Mvc\Router\RouteMatch;
use Zend\Stdlib\Parameters;
use ZF\MvcAuth\Identity\GuestIdentity;
use ZF\Rest\ResourceEvent;

class ResourceEventTest extends TestCase
{
    public function setUp()
    {
        $this->matches = new RouteMatch(array(
            'foo' => 'bar',
            'baz' => 'inga',
        ));
        $this->query = new Parameters(array(
            'foo' => 'bar',
            'baz' => 'inga',
        ));

        $this->event = new ResourceEvent();
    }

    public function testRouteMatchIsNullByDefault()
    {
        $this->assertNull($this->event->getRouteMatch());
    }

    public function testQueryParamsAreNullByDefault()
    {
        $this->assertNull($this->event->getQueryParams());
    }

    public function testRouteMatchIsMutable()
    {
        $this->event->setRouteMatch($this->matches);
        $this->assertSame($this->matches, $this->event->getRouteMatch());
        return $this->event;
    }

    public function testQueryParamsAreMutable()
    {
        $this->event->setQueryParams($this->query);
        $this->assertSame($this->query, $this->event->getQueryParams());
        return $this->event;
    }

    public function testRequestIsNullByDefault()
    {
        $this->assertNull($this->event->getRequest());
    }

    public function testRequestIsMutable()
    {
        $request = new HttpRequest();
        $this->event->setRequest($request);
        $this->assertSame($request, $this->event->getRequest());
        return $this->event;
    }

    /**
     * @depends testRouteMatchIsMutable
     */
    public function testRouteMatchIsNullable(ResourceEvent $event)
    {
        $event->setRouteMatch(null);
        $this->assertNull($event->getRouteMatch());
    }

    /**
     * @depends testQueryParamsAreMutable
     */
    public function testQueryParamsAreNullable(ResourceEvent $event)
    {
        $event->setQueryParams(null);
        $this->assertNull($event->getQueryParams());
    }

    /**
     * @depends testRequestIsMutable
     */
    public function testRequestIsNullable(ResourceEvent $event)
    {
        $event->setRequest(null);
        $this->assertNull($event->getRequest());
    }

    public function testCanInjectRequestViaSetParams()
    {
        $request = new HttpRequest();
        $this->event->setParams(array('request' => $request));
        $this->assertSame($request, $this->event->getRequest());
    }

    public function testCanFetchIndividualRouteParameter()
    {
        $this->event->setRouteMatch($this->matches);
        $this->assertEquals('bar', $this->event->getRouteParam('foo'));
        $this->assertEquals('inga', $this->event->getRouteParam('baz'));
    }

    public function testCanFetchIndividualQueryParameter()
    {
        $this->event->setQueryParams($this->query);
        $this->assertEquals('bar', $this->event->getQueryParam('foo'));
        $this->assertEquals('inga', $this->event->getQueryParam('baz'));
    }

    public function testReturnsDefaultParameterWhenPullingUnknownRouteParameter()
    {
        $this->assertNull($this->event->getRouteParam('foo'));
        $this->assertEquals('bat', $this->event->getRouteParam('baz', 'bat'));
    }

    public function testReturnsDefaultParameterWhenPullingUnknownQueryParameter()
    {
        $this->assertNull($this->event->getQueryParam('foo'));
        $this->assertEquals('bat', $this->event->getQueryParam('baz', 'bat'));
    }

    public function testInputFilterIsUndefinedByDefault()
    {
        $this->assertNull($this->event->getInputFilter());
    }

    /**
     * @depends testInputFilterIsUndefinedByDefault
     */
    public function testCanComposeInputFilter()
    {
        $inputFilter = new InputFilter();
        $this->event->setInputFilter($inputFilter);
        $this->assertSame($inputFilter, $this->event->getInputFilter());
    }

    /**
     * @depends testCanComposeInputFilter
     */
    public function testCanNullifyInputFilter()
    {
        $this->event->setInputFilter(null);
        $this->assertNull($this->event->getInputFilter());
    }

    public function testIdentityIsUndefinedByDefault()
    {
        $this->assertNull($this->event->getIdentity());
    }

    /**
     * @depends testIdentityIsUndefinedByDefault
     */
    public function testCanComposeIdentity()
    {
        $identity = new GuestIdentity();
        $this->event->setIdentity($identity);
        $this->assertSame($identity, $this->event->getIdentity());
    }

    /**
     * @depends testCanComposeIdentity
     */
    public function testCanNullifyIdentity()
    {
        $this->event->setIdentity(null);
        $this->assertNull($this->event->getIdentity());
    }
}


package search

import (
	"encoding/json"
	"errors"
	"fmt"

	"github.com/sebas7dk/go-recipes/config"
	"github.com/sebas7dk/go-recipes/models"
	elastigo "github.com/mattbaird/elastigo/lib"
)

type Connection struct {
	Conn *elastigo.Conn
}

var index string

//SetIndex set the index name
func SetIndex(i string) {
	index = i
}

//NewConnection create a new Elastic Search connection
func NewConnection() (*Connection, error) {
	c := elastigo.NewConn()
	if c == nil {
		return nil, errors.New("Unable to connect to Elastic Search")
	}

	c.Domain = config.Get("ES_DOMAIN")
	c.Port = config.Get("ES_PORT")

	conn := &Connection{Conn: c}

	return conn, nil
}

//Show all the docs in the index
func (c *Connection) Show() ([]models.Recipe, error) {
	searchJSON := `{
      "query" : {
          "match_all" : {}
      }
  }`

	o, err := c.Conn.Search(index, "recipe", nil, searchJSON)
	r := BuildResults(o.Hits.Hits)

	return r, err
}

//GetById show the doc by id
func (c *Connection) GetById(id string) (*models.Recipe, error) {
	var recipe *models.Recipe

	o, err := c.Conn.Get(index, "recipe", id, nil)

	if err == nil {
		json.Unmarshal(*o.Source, &recipe)
		recipe.Id = o.Id
	}

	return recipe, err
}

//Create a new doc
func (c *Connection) Create(r models.Recipe) (elastigo.BaseResponse, error) {
	return c.Conn.Index(index, "recipe", "", nil, r)
}

//Update a doc by id
func (c *Connection) Update(id string, r models.Recipe) (elastigo.BaseResponse, error) {
	return c.Conn.Index(index, "recipe", id, nil, r)
}

//Query the index and match the search term
func (c *Connection) Query(s string) ([]models.Recipe, error) {
	searchJSON := fmt.Sprintf(`{
	    "query" : {
	        "multi_match": {
	            "query" : "%s",
	            "fields" : ["title^50", "category^30", "instructions^25", "ingredients^20"]
	        }
	    }
	}`, s)

	o, err := c.Conn.Search(index, "recipe", nil, searchJSON)
	r := BuildResults(o.Hits.Hits)

	return r, err
}

//Delete a doc from the index
func (c *Connection) Delete(id string) (elastigo.BaseResponse, error) {
	return c.Conn.Delete(index, "recipe", id, nil)
}

//DeleteIndex alll docs from the index
func (c *Connection) DeleteIndex() (elastigo.BaseResponse, error) {
	return c.Conn.DeleteIndex(index)
}

//BuildResults loop through the hits based on the total hits
func BuildResults(recipes []elastigo.Hit) []models.Recipe {
	var recipe models.Recipe
	rs := make(models.Recipes, 0)

	for _, r := range recipes {
		if err := json.Unmarshal(*r.Source, &recipe); err == nil {
			recipe.Id = r.Id
			rs = append(rs, recipe)
		}
	}

	return rs
}


(function() {
  var ArrayIterator, IteratorOutput, PairwiseArrayIterator, __assert_unfinished__, __throw_iterator_finished__;

  __throw_iterator_finished__ = function() {
    throw new Error("Iterator has already finished");
  };

  __assert_unfinished__ = function(iteratorOutput) {
    if (iteratorOutput.done) {
      return __throw_iterator_finished__();
    }
  };

  IteratorOutput = (function() {
    function IteratorOutput(value) {
      this.value = value;
      this.done = false;
    }

    return IteratorOutput;

  })();

  ArrayIterator = (function() {
    function ArrayIterator(array) {
      this.array = array;
      this.index = 0;
      this.out = new IteratorOutput;
    }

    ArrayIterator.prototype.next = function() {
      var array, index, out;
      array = this.array, index = this.index, out = this.out;
      __assert_unfinished__(out);
      if (index < array.length) {
        out.value = array[index];
      } else {
        out.value = void 0;
        out.done = true;
      }
      this.index += 1;
      return out;
    };

    return ArrayIterator;

  })();

  PairwiseArrayIterator = (function() {
    function PairwiseArrayIterator(array) {
      this.array = array;
      if (array.length % 2) {
        throw new Error("Odd number of elements");
      }
      this.index = 0;
      this.out = new IteratorOutput([]);
    }

    PairwiseArrayIterator.prototype.next = function() {
      var array, index, out;
      array = this.array, index = this.index, out = this.out;
      __assert_unfinished__(out);
      if (index < array.length) {
        out.value[0] = array[index];
        out.value[1] = array[index + 1];
      } else {
        out.value[0] = void 0;
        out.value[1] = void 0;
        out.done = true;
      }
      this.index += 2;
      return out;
    };

    return PairwiseArrayIterator;

  })();

  module.exports = {
    ArrayIterator: ArrayIterator,
    PairwiseArrayIterator: PairwiseArrayIterator
  };

}).call(this);


<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>projective-geometry: Not compatible 👼</title>
    <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
    <link href="../../../../../bootstrap.min.css" rel="stylesheet">
    <link href="../../../../../bootstrap-custom.css" rel="stylesheet">
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

             Coq bench

clean / released

8.8.1 / projective-geometry - 8.5.0

            « Up

              projective-geometry

                8.5.0
                Not compatible 👼

📅  (2022-04-08 16:37:15 UTC)

Context

# Packages matching: installed
# Name              # Installed # Synopsis
base-bigarray       base
base-threads        base
base-unix           base
camlp5              7.14        Preprocessor-pretty-printer of OCaml
conf-findutils      1           Virtual package relying on findutils
conf-perl           2           Virtual package relying on perl
coq                 8.8.1       Formal proof management system
num                 1.4         The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml               4.09.1      The OCaml compiler (virtual package)
ocaml-base-compiler 4.09.1      Official release 4.09.1
ocaml-config        1           OCaml Switch Configuration
ocamlfind           1.9.3       A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "matej.kosik@inria.fr"
homepage: "https://github.com/coq-contribs/projective-geometry"
license: "Proprietary"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/ProjectiveGeometry"]
depends: [
  "ocaml"
  "coq" {>= "8.5" & < "8.6~"}
]
tags: [
  "keyword:geometry"
  "keyword:projective"
  "keyword:Fano"
  "keyword:homogeneous coordinates model"
  "keyword:flat"
  "keyword:rank"
  "keyword:Desargues"
  "keyword:Moulton"
  "category:Mathematics/Geometry/General"
  "date:2009-10"
]
authors: [ "Nicolas Magaud <Nicolas.Magaud@lsiit-cnrs.unistra.fr>" "Julien Narboux <Julien.Narboux@lsiit-cnrs.unistra.fr>" "Pascal Schreck <Pascal.Schreck@lsiit-cnrs.unistra.fr>" ]
bug-reports: "https://github.com/coq-contribs/projective-geometry/issues"
dev-repo: "git+https://github.com/coq-contribs/projective-geometry.git"
synopsis: "Projective Geometry"
description: """
This contributions contains elements of formalization of projective geometry.
In the plane:
Two axiom systems are shown equivalent. We prove some results about the
decidability of the the incidence and equality predicates. The classic
notion of duality between points and lines is formalized thanks to a
functor. The notion of 'flat' is defined and flats are characterized.
Fano's plane, the smallest projective plane is defined. We show that Fano's plane is desarguesian.
In the space:
We prove Desargues' theorem."""
flags: light-uninstall
url {
  src:
    "https://github.com/coq-contribs/projective-geometry/archive/v8.5.0.tar.gz"
  checksum: "md5=b538b6b3caec10362391436a1f91d9c9"
}

Lint

Command

true

Return code

0

Dry install 🏜

Dry install with the current Coq version:

Command

opam install -y --show-action coq-projective-geometry.8.5.0 coq.8.8.1

Return code

5120

Output

[NOTE] Package coq is already installed (current version is 8.8.1).
The following dependencies couldn't be met:
  - coq-projective-geometry -> coq < 8.6~ -> ocaml < 4.06.0
      base of this switch (use `--unlock-base' to force)
No solution found, exiting

Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:

Command

opam remove -y coq; opam install -y --show-action --unlock-base coq-projective-geometry.8.5.0

Return code

0

Install dependencies

Command

true

Return code

0

Duration

0 s

Install 🚀

Command

true

Return code

0

Duration

0 s

Installation size

No files were installed.

Uninstall 🧹

Command

true

Return code

0

Missing removes

                none

Wrong removes

                none

          Sources are on GitHub © Guillaume Claret 🐣


@interface DemoViewController ()

@end

@implementation DemoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (IBAction)openCalendar:(id)sender {
    [self openCalendarVC:self];
}

- (void)openCalendarVC:(UIViewController *)vc {
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        UIViewController *viewController = [[UIStoryboard storyboardWithName:@"main-iPad" bundle:NULL] instantiateViewControllerWithIdentifier:@"MainNav"];
        viewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

        [vc presentViewController:viewController animated:YES completion:nil];
    } else {
        UIViewController *viewController = [[UIStoryboard storyboardWithName:@"main-iPhone" bundle:NULL] instantiateViewControllerWithIdentifier:@"MainNav"];
        viewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

        [vc presentViewController:viewController animated:YES completion:nil];
    }
}

@end


package club.zhcs.thunder.controller.admin.log;

import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import club.zhcs.thunder.biz.log.LoginLogService;
import club.zhcs.thunder.controller.base.BaseController;
import club.zhcs.thunder.domain.log.LoginLog;
import club.zhcs.titans.utils.db.Pager;
import club.zhcs.titans.utils.db.Result;

/**
 *
 * @author admin
 *
 * @email kerbores@gmail.com
 *
 */
@Controller
@RequestMapping("login")
public class LoginLogController extends BaseController {

	@Autowired
	LoginLogService loginLogService;

	@RequestMapping("list")
	@RequiresRoles("admin")
	public String list(@RequestParam(value = "page", defaultValue = "1") int page, Model model) {
		Pager<LoginLog> pager = loginLogService.searchByPage(_fixPage(page));
		pager.setUrl(_base() + "/login/list");
		model.addAttribute("obj", Result.success().addData("pager", pager).setTitle(" 登录日志列表"));
		return "pages/log/login/list";
	}

	@RequestMapping("search")
	@RequiresRoles("admin")
	public String search(@RequestParam(value = "page", defaultValue = "1") int page, @RequestParam("key") String key, Model model) {
		Pager<LoginLog> pager = loginLogService.searchByKeyAndPage(_fixSearchKey(key), _fixPage(page), "account", "ip");
		pager.setUrl(_base() + "/login/search");
		pager.addParas("key", key);
		model.addAttribute("obj", Result.success().addData("pager", pager).setTitle(" 登录日志列表"));
		return "pages/log/login/list";
	}

}


<?php
class ClassHelper
{
    protected $origin;

    /** @var ReflectionClass */
    protected $target;

    /**
     * Creates and returns the wrapper.
     * Only objects are allowed to be passed, else an exception will be thrown.
     * Store the input object to the created wrapper.
     *
     * @param $object
     *
     * @return Helper
     */
    public static function instance($object)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('Only objects are allowed to be passed to the helper.');
        }

        $response = new self();
        $response->origin = $object;
        $response->target = new ReflectionClass($object);
        return $response;
    }

    public function __get($name)
    {
        $property = $this->getProperty($name);
        $value = $property->getValue($this->origin);
        return $value;
    }

    public function __set($name, $value)
    {
        $property = $this->getProperty($name);
        $property->setValue($this->origin, $value);
        return true;
    }

    protected function getProperty($name)
    {
        if (!$this->target->hasProperty($name)) {
            $message = sprintf('Property not found on object %s.', get_class($this->origin));
            throw new OutOfBoundsException($message);
        }

        /** @var ReflectionProperty $property */
        $property = $this->target->getProperty($name);
        $property->setAccessible(true);

        return $property;
    }

    public function call($name, array $args = [])
    {
        if (!$this->target->hasMethod($name)) {
            $message = sprintf('Method not found on object %s.', get_class($this->origin));
            throw new BadMethodCallException($message);
        }

        $method = $this->target->getMethod($name);
        $method->setAccessible(true);
        $response = $method->invokeArgs($this->origin, $args);

        return $response;
    }
}


'use strict';

if (process.platform === 'darwin') {
	module.exports = require('./lib/osx');
	module.exports.sync = require('./lib/osx').sync;
} else if (process.platform === 'win32') {
	module.exports = require('./lib/win');
	module.exports.sync = require('./lib/win').sync;
} else {
	module.exports = require('./lib/linux');
	module.exports.sync = require('./lib/linux').sync;
}


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>UntypedResultSet.Row (apache-cassandra API)</title>
<meta name="date" content="2015-05-13">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.cassandra.cql3

Class UntypedResultSet.Row

java.lang.Object

org.apache.cassandra.cql3.UntypedResultSet.Row

Enclosing class:

UntypedResultSet

public static class UntypedResultSet.Row
extends java.lang.Object

Constructor Summary

Constructors

Constructor and Description

UntypedResultSet.Row(java.util.List<ColumnSpecification> names,
                    java.util.List<java.nio.ByteBuffer> columns)

UntypedResultSet.Row(java.util.Map<java.lang.String,java.nio.ByteBuffer> data)

Method Summary

Methods

Modifier and Type
Method and Description

boolean
getBoolean(java.lang.String column)

java.nio.ByteBuffer
getBytes(java.lang.String column)

java.util.List<ColumnSpecification>
getColumns()

double
getDouble(java.lang.String column)

java.net.InetAddress
getInetAddress(java.lang.String column)

int
getInt(java.lang.String column)

<T> java.util.List<T>
getList(java.lang.String column,
       AbstractType<T> type)

long
getLong(java.lang.String column)

<K,V> java.util.Map<K,V>
getMap(java.lang.String column,
      AbstractType<K> keyType,
      AbstractType<V> valueType)

<T> java.util.Set<T>
getSet(java.lang.String column,
      AbstractType<T> type)

java.lang.String
getString(java.lang.String column)

java.util.Date
getTimestamp(java.lang.String column)

java.util.UUID
getUUID(java.lang.String column)

boolean
has(java.lang.String column)

java.lang.String
toString()

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

UntypedResultSet.Row

public UntypedResultSet.Row(java.util.Map<java.lang.String,java.nio.ByteBuffer> data)

UntypedResultSet.Row

public UntypedResultSet.Row(java.util.List<ColumnSpecification> names,
                    java.util.List<java.nio.ByteBuffer> columns)

Method Detail

has

public boolean has(java.lang.String column)

getString

public java.lang.String getString(java.lang.String column)

getBoolean

public boolean getBoolean(java.lang.String column)

getInt

public int getInt(java.lang.String column)

getDouble

public double getDouble(java.lang.String column)

getBytes

public java.nio.ByteBuffer getBytes(java.lang.String column)

getInetAddress

public java.net.InetAddress getInetAddress(java.lang.String column)

getUUID

public java.util.UUID getUUID(java.lang.String column)

getTimestamp

public java.util.Date getTimestamp(java.lang.String column)

getLong

public long getLong(java.lang.String column)

getSet

public <T> java.util.Set<T> getSet(java.lang.String column,
                          AbstractType<T> type)

getList

public <T> java.util.List<T> getList(java.lang.String column,
                            AbstractType<T> type)

getMap

public <K,V> java.util.Map<K,V> getMap(java.lang.String column,
                              AbstractType<K> keyType,
                              AbstractType<V> valueType)

getColumns

public java.util.List<ColumnSpecification> getColumns()

toString

public java.lang.String toString()

Overrides:

toString in class java.lang.Object

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2015 The Apache Software Foundation


package com.orientechnologies.orient.server.distributed;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.orientechnologies.orient.core.db.ODatabaseSession;
import com.orientechnologies.orient.core.db.OrientDB;
import com.orientechnologies.orient.core.db.OrientDBConfig;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.metadata.schema.OClass;
import com.orientechnologies.orient.core.record.OVertex;
import com.orientechnologies.orient.core.sql.executor.OResult;
import com.orientechnologies.orient.core.sql.executor.OResultSet;
import com.orientechnologies.orient.setup.SetupConfig;
import com.orientechnologies.orient.setup.TestSetup;
import com.orientechnologies.orient.setup.TestSetupUtil;
import com.orientechnologies.orient.setup.configs.SimpleDServerConfig;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class SimpleQueryDistributedIT {

  private TestSetup setup;
  private SetupConfig config;
  private String server0, server1, server2;

  private OrientDB remote;
  private ODatabaseSession session;

  @Before
  public void before() throws Exception {
    config = new SimpleDServerConfig();
    server0 = SimpleDServerConfig.SERVER0;
    server1 = SimpleDServerConfig.SERVER1;
    server2 = SimpleDServerConfig.SERVER2;
    setup = TestSetupUtil.create(config);
    setup.setup();

    remote = setup.createRemote(server0, "root", "test", OrientDBConfig.defaultConfig());
    remote.execute(
        "create database ? plocal users(admin identified by 'admin' role admin)", "test");
    session = remote.open("test", "admin", "admin");
  }

  @Test
  public void test() {
    OVertex vertex = session.newVertex("V");
    vertex.setProperty("name", "one");
    session.save(vertex);

    // Query with SQL
    OResultSet res = session.query("select from V");
    assertTrue(res.hasNext());
    assertEquals(res.next().getProperty("name"), "one");

    // Query with script
    res = session.execute("sql", "select from V");
    assertTrue(res.hasNext());
    assertEquals(res.next().getProperty("name"), "one");

    // Query order by
    OClass v2 = session.createVertexClass("V2");
    int records = (OGlobalConfiguration.QUERY_REMOTE_RESULTSET_PAGE_SIZE.getValueAsInteger() + 10);
    for (int i = 0; i < records; i++) {
      vertex = session.newVertex("V2");
      vertex.setProperty("name", "one");
      vertex.setProperty("pos", i);
      session.save(vertex);
    }

    res = session.query("select from V2 order by pos");
    for (int i = 0; i < records; i++) {
      assertTrue(res.hasNext());
      OResult ele = res.next();
      assertEquals((int) ele.getProperty("pos"), i);
      assertEquals(ele.getProperty("name"), "one");
    }
  }

  @After
  public void after() throws InterruptedException {
    System.out.println("Tearing down test setup.");
    try {
      if (remote != null) {
        remote.drop("test");
        remote.close();
      }
    } finally {
      setup.teardown();
      ODatabaseDocumentTx.closeAll();
    }
  }
}