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

<title>TileObserver (Java Platform SE 8 )</title>
<meta name="date" content="2014-12-17">
<meta name="keywords" content="java.awt.image.TileObserver interface">
<meta name="keywords" content="tileUpdate()">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Java™ Platform
Standard Ed. 8

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

java.awt.image

Interface TileObserver

public interface TileObserver

An interface for objects that wish to be informed when tiles
 of a WritableRenderedImage become modifiable by some writer via
 a call to getWritableTile, and when they become unmodifiable via
 the last call to releaseWritableTile.

See Also:

WritableRenderedImage

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

void
tileUpdate(WritableRenderedImage source,
          int tileX,
          int tileY,
          boolean willBeWritable)

A tile is about to be updated (it is either about to be grabbed
 for writing, or it is being released from writing).

Method Detail

tileUpdate

void tileUpdate(WritableRenderedImage source,
                int tileX,
                int tileY,
                boolean willBeWritable)

A tile is about to be updated (it is either about to be grabbed
 for writing, or it is being released from writing).

Parameters:

source - the image that owns the tile.

tileX - the X index of the tile that is being updated.

tileY - the Y index of the tile that is being updated.

willBeWritable - If true, the tile will be grabbed for writing;
                        otherwise it is being released.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Java™ Platform
Standard Ed. 8

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

 Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2015, Oracle and/or its affiliates.  All rights reserved.


text:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using Business;
using Business.Data.Laboratorio;
using Business.Data;

namespace WebLab.Antibioticos
{
    public partial class AntibioticoList : System.Web.UI.Page
    {
        Utility oUtil = new Utility();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                VerificaPermisos("Antibioticos");
                CargarGrilla();
            }
        }

        private int Permiso /*el permiso */
        {
            get { return ViewState["Permiso"] == null ? 0 : int.Parse(ViewState["Permiso"].ToString()); }
            set { ViewState["Permiso"] = value; }
        }

        private void VerificaPermisos(string sObjeto)
        {
            if (Session["s_permiso"] != null)
            {
               // Utility oUtil = new Utility();
                Permiso = oUtil.VerificaPermisos((ArrayList)Session["s_permiso"], sObjeto);
                switch (Permiso)
                {
                    case 0: Response.Redirect("../AccesoDenegado.aspx", false); break;
                    case 1: btnAgregar.Visible = false; break;
                }
            }
            else Response.Redirect("../FinSesion.aspx", false);

        }

        private void CargarGrilla()
        {
            gvLista.AutoGenerateColumns = false;
            gvLista.DataSource = LeerDatos();
            gvLista.DataBind();
        }

        private object LeerDatos()
        {
            string m_strSQL = " SELECT idAntibiotico , nombreCorto , descripcion " +
                              " FROM LAB_Antibiotico " +
                              " where baja=0 " +
                              " order by descripcion ";
            DataSet Ds = new DataSet();
            SqlConnection conn = (SqlConnection)NHibernateHttpModule.CurrentSession.Connection;
            SqlDataAdapter adapter = new SqlDataAdapter();
            adapter.SelectCommand = new SqlCommand(m_strSQL, conn);
            adapter.Fill(Ds);

            return Ds.Tables[0];
        }

        protected void btnAgregar_Click(object sender, EventArgs e)
        {
            Response.Redirect("AntibioticoEdit.aspx");
        }

        protected void gvLista_RowCommand1(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Modificar")
            {
                string MyURL;

                MyURL = "AntibioticoEdit.aspx?id=" + e.CommandArgument.ToString();
                Response.Redirect(MyURL);
            }
            if (e.CommandName == "Eliminar")
            {
                Eliminar(e.CommandArgument);
                CargarGrilla();
            }
        }

        private void Eliminar(object p)
        {
            Antibiotico oRegistro = new Antibiotico();
            oRegistro = (Antibiotico)oRegistro.Get(typeof(Antibiotico), int.Parse(p.ToString()));
            Usuario oUser = new Usuario();
            oRegistro.Baja = true;
            oRegistro.IdUsuarioRegistro = (Usuario)oUser.Get(typeof(Usuario), int.Parse(Session["idUsuario"].ToString()));
            oRegistro.FechaRegistro = DateTime.Now;
            oRegistro.Save();
        }

        protected void gvLista_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ImageButton CmdModificar = (ImageButton)e.Row.Cells[2].Controls[1];
                CmdModificar.CommandArgument = this.gvLista.DataKeys[e.Row.RowIndex].Value.ToString();
                CmdModificar.CommandName = "Modificar";

                ImageButton CmdEliminar = (ImageButton)e.Row.Cells[3].Controls[1];
                CmdEliminar.CommandArgument = this.gvLista.DataKeys[e.Row.RowIndex].Value.ToString();
                CmdEliminar.CommandName = "Eliminar";

                if (Permiso == 1)
                {
                    CmdEliminar.Visible = false;
                    CmdModificar.ToolTip = "Consultar";
                }
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
Ti.include('/lang.js');

var newsletter = Titanium.UI.currentWindow;

var label = Ti.UI.createLabel({
	text:L('Introduce tu email'),
	height:'auto',
	width:'auto',
	top:30
});
var textField = Ti.UI.createTextField({
	hintText:'Email',
	height:'auto',
	width:250,
	top:80,
	borderStyle:Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
	keyboardType:Ti.UI.KEYBOARD_EMAIL
});
var button = Ti.UI.createButton({
	title:L('Guardar'),
	top:130,
	height:'auto',
	width:'auto'
});
var label2 = Ti.UI.createLabel({
	text:L('Para darte de baja, pincha aquí'),
	height:'auto',
	width:'auto',
	bottom:80
});
var button2 = Ti.UI.createButton({
	title:L('Darme de baja'),
	bottom:20,
	height:'auto',
	width:'auto'
});
var label3 = Ti.UI.createLabel({
	text:L('Enhorabuena!\r\nYa estás registrado en la newsletter\r\nTu email es:') + ' ' + Ti.App.Properties.getString('email'),
	height:'auto',
	width:'auto',
	textAlign:'center',
	top:20
});
var button3 = Ti.UI.createButton({
	title:L('Editar'),
	top:100,
	height:'auto',
	width:'auto'
});
var button4 = Ti.UI.createButton({
	title:L('Cancelar'),
	top:130,
	right:60,
	height:'auto',
	width:'auto'
});
var button5 = Ti.UI.createButton({
	title:L('Editar'),
	top:130,
	left:60,
	height:'auto',
	width:'auto'
});

if (email = Ti.App.Properties.getString('email')) {
	newsletter.add(label3);
	newsletter.add(button3);
	newsletter.add(label2);
	newsletter.add(button2);
} else {
	newsletter.add(label);
	newsletter.add(textField);
	newsletter.add(button);
}
button.addEventListener('click', function(e) { // Guardar
	save();
});
button5.addEventListener('click', function(e) { // Editar-Guardar
	save();
});
button2.addEventListener('click', function(e) { // Baja
	Ti.App.Properties.setString('email', null);
	textField.value = null;
	newsletter.remove(label3);
	newsletter.remove(button3);
	newsletter.remove(label2);
	newsletter.remove(button2);
	newsletter.add(label);
	newsletter.add(textField);
	newsletter.add(button);
});
button3.addEventListener('click', function(e) { // Editar
	textField.value = Ti.App.Properties.getString('email');
	newsletter.remove(label3);
	newsletter.remove(button3);
	newsletter.remove(label2);
	newsletter.remove(button2);
	newsletter.add(label);
	newsletter.add(textField);
	newsletter.add(button5);
	newsletter.add(button4);
});
button4.addEventListener('click', function(e) { // Cancelar
	newsletter.add(label3);
	newsletter.add(button3);
	newsletter.add(label2);
	newsletter.add(button2);
	newsletter.remove(label);
	textField.blur();
	newsletter.remove(textField);
	newsletter.remove(button);
	newsletter.remove(button4);
	newsletter.remove(button5);
});

function save() {
	if (!textField.value) {
		alert(L('Debes rellenar el campo'));
	} else{
		Ti.App.Properties.setString('email', textField.value);
		label3.text = L('Enhorabuena!\r\nYa estás registrado en la newsletter\r\nTu email es:') + ' ' + textField.value;
		newsletter.add(label3);
		newsletter.add(button3);
		newsletter.add(label2);
		newsletter.add(button2);
		newsletter.remove(label);
		textField.blur();
		newsletter.remove(textField);
		newsletter.remove(button);
		newsletter.remove(button4);
		newsletter.remove(button5);
	}
}


text:
namespace AngleSharp.Html.Dom
{
    using AngleSharp.Dom;
    using System;

    /// <summary>
    /// Represents the an HTML heading element (h1, h2, h3, h4, h5, h6).
    /// </summary>
    sealed class HtmlHeadingElement : HtmlElement, IHtmlHeadingElement
    {
        public HtmlHeadingElement(Document owner, String? name = null, String? prefix = null)
            : base(owner, name ?? TagNames.H1, prefix, NodeFlags.Special)
        {
        }
    }
}


text:
package io.gank.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import io.gank.R;
import io.gank.adapter.RandomAdapter;
import io.gank.http.GankHttpClient;
import io.gank.model.GankModel;
import io.gank.model.ResultModel;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;

public class RandomFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener {

    private static RandomFragment mRandomFragment;
    private Context mContext;
    private RecyclerView mRecyclerView;
    private List<GankModel> mGankModels;
    private RandomAdapter mRandomAdapter;
    private SwipeRefreshLayout mSwipeRefreshLayout;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_random, container, false);
        mContext = getActivity();
        initView(view);
        initData();
        initListener();
        return view;
    }

    private void initData() {
        mSwipeRefreshLayout.postDelayed(new Runnable() {
            @Override
            public void run() {
                mSwipeRefreshLayout.setRefreshing(true);
                getData();
            }
        }, 300);

    }

    private void initView(View view) {
        mRecyclerView = (RecyclerView) view.findViewById(R.id.rv_list);
        mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.srl_view);
        LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
        mRecyclerView.setLayoutManager(layoutManager);
        mSwipeRefreshLayout.setColorSchemeResources(R.color.red, R.color.blue, R.color.yellow, R.color.green);
        mGankModels = new ArrayList<GankModel>();
        mRandomAdapter = new RandomAdapter(mContext, mGankModels, null);
        mRecyclerView.setAdapter(mRandomAdapter);
    }

    private void initListener() {
        mSwipeRefreshLayout.setOnRefreshListener(this);
    }

    public static RandomFragment newInstance() {
        if (mRandomFragment == null) {
            mRandomFragment = new RandomFragment();
        }
        return mRandomFragment;
    }

    private void getData() {
        Random random = new Random();
        int index = random.nextInt(7);
        final String type = getResources().getStringArray(R.array.type)[index];
        GankHttpClient.getRandomData(type, new Callback<ResultModel>() {
            @Override
            public void success(ResultModel resultModel, Response response) {
                mGankModels.clear();
                mGankModels.addAll(resultModel.getResults());
                mRandomAdapter.setType(type);
                mRandomAdapter.notifyDataSetChanged();
                mSwipeRefreshLayout.setRefreshing(false);
            }

            @Override
            public void failure(RetrofitError error) {
                mSwipeRefreshLayout.setRefreshing(false);
            }
        });
    }

    @Override
    public void onRefresh() {
        getData();
    }
}


text:
<?php

class Agileo_View_Helper_PopoverIframeInit extends Zend_View_Helper_Abstract
{

    protected static $_isInit = false;

    public function popoverIframeInit()
    {

        if(!self::$_isInit) {

            self::$_isInit = true;

            $html = '

                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

                <button class="btn" data-dismiss="modal" aria-hidden="true">'.$this->view->translate('modal_close').'</button>

            ';

            $js = "
            function agiIframePopoverShow(title, src) {
                $('#jIframePopover h3').html(title);

                $('#jIframePopoverLoader').show();
                $('#jIframePopoverIframe').css('height', 0);

                $('#jIframePopoverIframe').attr('src', src);
                $('#jIframePopoverIframe').load(function() {
                    $('#jIframePopoverLoader').hide();
                    $('#jIframePopoverIframe').css('height', '100%');
                });

                $('#jIframePopover').modal('show');
            }
            function agiIframePopoverHide(title, src) {
                $('#jIframePopover').modal('hide');
            }
            ";

            $this->view->inlineScript()->appendScript($js);

            return $html;

        }

        return '';

    }

}


text:
import _ from '_';

import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { isArray, isNormal, pInt, isUnd, noop } from 'Common/Utils';
import { ClientSideKeyName, ServerFolderType } from 'Common/Enums';
import * as Cache from 'Common/Cache';

import * as Settings from 'Storage/Settings';
import * as Local from 'Storage/Client';

import AppStore from 'Stores/User/App';
import FolderStore from 'Stores/User/Folder';

import Remote from 'Remote/User/Ajax';

import { FolderModel } from 'Model/Folder';
import { AbstractBasicPromises } from 'Promises/AbstractBasic';

class PromisesUserPopulator extends AbstractBasicPromises {
	/**
	 * @param {string} sFullNameHash
	 * @param {Array?} expandedFolders
	 * @returns {boolean}
	 */
	isFolderExpanded(sFullNameHash, expandedFolders) {
		return expandedFolders && isArray(expandedFolders) && -1 !== _.indexOf(expandedFolders, sFullNameHash);
	}

	/**
	 * @param {string} sFolderFullNameRaw
	 * @returns {string}
	 */
	normalizeFolder(sFolderFullNameRaw) {
		return '' === sFolderFullNameRaw ||
			UNUSED_OPTION_VALUE === sFolderFullNameRaw ||
			null !== Cache.getFolderFromCacheList(sFolderFullNameRaw)
			? sFolderFullNameRaw
			: '';
	}

	/**
	 * @param {string} sNamespace
	 * @param {Array} aFolders
	 * @param {Array?} expandedFolders
	 * @returns {Array}
	 */
	folderResponseParseRec(sNamespace, aFolders, expandedFolders) {
		const bDisplaySpecSetting = FolderStore.displaySpecSetting(),
			aList = [];

		_.each(aFolders, (oFolder) => {
			if (oFolder) {
				let oCacheFolder = Cache.getFolderFromCacheList(oFolder.FullNameRaw);
				if (!oCacheFolder) {
					oCacheFolder = FolderModel.newInstanceFromJson(oFolder);
					if (oCacheFolder) {
						Cache.setFolderToCacheList(oFolder.FullNameRaw, oCacheFolder);
						Cache.setFolderFullNameRaw(oCacheFolder.fullNameHash, oFolder.FullNameRaw, oCacheFolder);
					}
				}

				if (oCacheFolder) {
					if (bDisplaySpecSetting) {
						oCacheFolder.checkable(!!oFolder.Checkable);
					} else {
						oCacheFolder.checkable(true);
					}

					oCacheFolder.collapsed(!this.isFolderExpanded(oCacheFolder.fullNameHash, expandedFolders));

					if (oFolder.Extended) {
						if (oFolder.Extended.Hash) {
							Cache.setFolderHash(oCacheFolder.fullNameRaw, oFolder.Extended.Hash);
						}

						if (isNormal(oFolder.Extended.MessageCount)) {
							oCacheFolder.messageCountAll(oFolder.Extended.MessageCount);
						}

						if (isNormal(oFolder.Extended.MessageUnseenCount)) {
							oCacheFolder.messageCountUnread(oFolder.Extended.MessageUnseenCount);
						}
					}

					if (
						oFolder.SubFolders &&
						'Collection/FolderCollection' === oFolder.SubFolders['@Object'] &&
						oFolder.SubFolders['@Collection'] &&
						isArray(oFolder.SubFolders['@Collection'])
					) {
						oCacheFolder.subFolders(
							this.folderResponseParseRec(sNamespace, oFolder.SubFolders['@Collection'], expandedFolders)
						);
					}

					aList.push(oCacheFolder);
				}
			}
		});

		return aList;
	}

	foldersList(oData) {
		if (
			oData &&
			'Collection/FolderCollection' === oData['@Object'] &&
			oData['@Collection'] &&
			isArray(oData['@Collection'])
		) {
			const expandedFolders = Local.get(ClientSideKeyName.ExpandedFolders),
				cnt = pInt(oData.CountRec);

			let limit = pInt(Settings.appSettingsGet('folderSpecLimit'));
			limit = 100 < limit ? 100 : 10 > limit ? 10 : limit;

			FolderStore.displaySpecSetting(0 >= cnt || limit < cnt);

			FolderStore.folderList(
				this.folderResponseParseRec(
					isUnd(oData.Namespace) ? '' : oData.Namespace,
					oData['@Collection'],
					expandedFolders
				)
			); // @todo optimization required
		}
	}

	foldersAdditionalParameters(oData) {
		if (
			oData &&
			oData &&
			'Collection/FolderCollection' === oData['@Object'] &&
			oData['@Collection'] &&
			isArray(oData['@Collection'])
		) {
			if (!isUnd(oData.Namespace)) {
				FolderStore.namespace = oData.Namespace;
			}

			AppStore.threadsAllowed(!!Settings.appSettingsGet('useImapThread') && oData.IsThreadsSupported && true);

			FolderStore.folderList.optimized(!!oData.Optimized);

			let update = false;

			if (
				oData.SystemFolders &&
				'' ===
					'' +
						Settings.settingsGet('SentFolder') +
						Settings.settingsGet('DraftFolder') +
						Settings.settingsGet('SpamFolder') +
						Settings.settingsGet('TrashFolder') +
						Settings.settingsGet('ArchiveFolder') +
						Settings.settingsGet('NullFolder')
			) {
				Settings.settingsSet('SentFolder', oData.SystemFolders[ServerFolderType.SENT] || null);
				Settings.settingsSet('DraftFolder', oData.SystemFolders[ServerFolderType.DRAFTS] || null);
				Settings.settingsSet('SpamFolder', oData.SystemFolders[ServerFolderType.JUNK] || null);
				Settings.settingsSet('TrashFolder', oData.SystemFolders[ServerFolderType.TRASH] || null);
				Settings.settingsSet('ArchiveFolder', oData.SystemFolders[ServerFolderType.ALL] || null);

				update = true;
			}

			FolderStore.sentFolder(this.normalizeFolder(Settings.settingsGet('SentFolder')));
			FolderStore.draftFolder(this.normalizeFolder(Settings.settingsGet('DraftFolder')));
			FolderStore.spamFolder(this.normalizeFolder(Settings.settingsGet('SpamFolder')));
			FolderStore.trashFolder(this.normalizeFolder(Settings.settingsGet('TrashFolder')));
			FolderStore.archiveFolder(this.normalizeFolder(Settings.settingsGet('ArchiveFolder')));

			if (update) {
				Remote.saveSystemFolders(noop, {
					SentFolder: FolderStore.sentFolder(),
					DraftFolder: FolderStore.draftFolder(),
					SpamFolder: FolderStore.spamFolder(),
					TrashFolder: FolderStore.trashFolder(),
					ArchiveFolder: FolderStore.archiveFolder(),
					NullFolder: 'NullFolder'
				});
			}

			Local.set(ClientSideKeyName.FoldersLashHash, oData.FoldersHash);
		}
	}
}

export default new PromisesUserPopulator();


text:
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.osgi.test.cases.cdi.interfaces;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import javax.inject.Qualifier;

@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
public @interface BundleContextBeanQualifier {
}


text:
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2017 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
///     http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
////////////////////////////////////////////////////////////////////////////////

#ifndef ARANGOD_VOC_BASE_AUTH_INFO_H
#define ARANGOD_VOC_BASE_AUTH_INFO_H 1

#include "ApplicationFeatures/ApplicationFeature.h"
#include "Aql/QueryRegistry.h"
#include "Basics/Common.h"
#include "Basics/LruCache.h"
#include "Basics/Mutex.h"
#include "Basics/ReadWriteLock.h"
#include "Basics/Result.h"
#include "Rest/CommonDefines.h"
#include "Utils/Authentication.h"
#include "Utils/ExecContext.h"
#include "VocBase/AuthUserEntry.h"

#include <velocypack/Builder.h>
#include <velocypack/Slice.h>
#include <chrono>

namespace arangodb {

class AuthResult {
 public:
  AuthResult() : _authorized(false) {}

  explicit AuthResult(std::string const& username)
      : _username(username), _authorized(false) {}

  std::string _username;
  bool _authorized;
};

class AuthJwtResult : public AuthResult {
 public:
  AuthJwtResult() : AuthResult(), _expires(false) {}
  bool _expires;
  std::chrono::system_clock::time_point _expireTime;
};

class AuthenticationHandler;

class AuthInfo {
 public:
  AuthInfo(std::unique_ptr<AuthenticationHandler>&&);
  ~AuthInfo();

 public:
  void setQueryRegistry(aql::QueryRegistry* registry) {
    TRI_ASSERT(registry != nullptr);
    _queryRegistry = registry;
  }

  /// Tells coordinator to reload his data. Only call in HearBeat thread
  void outdate() { _outdated = true; }

  /// Trigger eventual reload, user facing API call
  void reloadAllUsers();

  VPackBuilder allUsers();
  /// Add user from arangodb, do not use for LDAP  users
  Result storeUser(bool replace, std::string const& user,
                   std::string const& pass, bool active);
  Result enumerateUsers(std::function<void(AuthUserEntry&)> const& func);
  Result updateUser(std::string const& username,
                    std::function<void(AuthUserEntry&)> const&);
  Result accessUser(std::string const& username,
                  std::function<void(AuthUserEntry const&)> const&);
  velocypack::Builder serializeUser(std::string const& user);
  Result removeUser(std::string const& user);
  Result removeAllUsers();

  velocypack::Builder getConfigData(std::string const& user);
  Result setConfigData(std::string const& user, velocypack::Slice const& data);
  velocypack::Builder getUserData(std::string const& user);
  Result setUserData(std::string const& user, velocypack::Slice const& data);

  AuthResult checkPassword(std::string const& username,
                           std::string const& password);

  AuthResult checkAuthentication(arangodb::rest::AuthenticationMethod authType,
                                 std::string const& secret);

  AuthLevel canUseDatabase(std::string const& username,
                           std::string const& dbname);
  AuthLevel canUseCollection(std::string const& username,
                             std::string const& dbname,
                             std::string const& coll);

  void setJwtSecret(std::string const&);
  std::string jwtSecret();
  std::string generateJwt(VPackBuilder const&);
  std::string generateRawJwt(VPackBuilder const&);
  /*
    std::shared_ptr<AuthContext> getAuthContext(std::string const& username,
                                                std::string const& database);*/

 private:
  void loadFromDB();
  bool parseUsers(velocypack::Slice const& slice);
  void insertInitial();
  Result storeUserInternal(AuthUserEntry const& user, bool replace);

  AuthResult checkAuthenticationBasic(std::string const& secret);
  AuthResult checkAuthenticationJWT(std::string const& secret);
  bool validateJwtHeader(std::string const&);
  AuthJwtResult validateJwtBody(std::string const&);
  bool validateJwtHMAC256Signature(std::string const&, std::string const&);
  std::shared_ptr<VPackBuilder> parseJson(std::string const&,
                                          std::string const&);

 private:
  basics::ReadWriteLock _authInfoLock;
  basics::ReadWriteLock _authJwtLock;
  Mutex _loadFromDBLock;
  std::atomic<bool> _outdated;

  std::unordered_map<std::string, AuthUserEntry> _authInfo;
  std::unordered_map<std::string, arangodb::AuthResult> _authBasicCache;
  arangodb::basics::LruCache<std::string, arangodb::AuthJwtResult>
      _authJwtCache;
  std::string _jwtSecret;
  aql::QueryRegistry* _queryRegistry;
  std::unique_ptr<AuthenticationHandler> _authenticationHandler;
};
}

#endif


text:
//Copyright 2006-2011 Jeroen van Menen
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.

#endregion Copyright

using mshtml;
using SHDocVw;

namespace WatiN.Core.Native.InternetExplorer
{
    internal interface IWebBrowser2Processor
    {
        HTMLDocument HTMLDocument();
        void Process(IWebBrowser2 webBrowser2);
        bool Continue();
    }
}


text:
package utils

import org.scalatestplus.play.guice.GuiceOneAppPerSuite
import org.scalatestplus.play.PlaySpec
import play.api.test.Helpers._

class LicenseUtilSpec extends PlaySpec with GuiceOneAppPerSuite {

  lazy val licenseUtil = app.injector.instanceOf[LicenseUtil]

  "LicenseUtil detect" must {
    "detect the MIT license from a Twitter license" in {
      val twitterLicense =
        """The MIT License (MIT)
          |
          |Copyright (c) 2011-2015 Twitter, Inc
          |
          |Permission is hereby granted, free of charge, to any person obtaining a copy
          |of this software and associated documentation files (the "Software"), to deal
          |in the Software without restriction, including without limitation the rights
          |to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
          |copies of the Software, and to permit persons to whom the Software is
          |furnished to do so, subject to the following conditions:
          |
          |The above copyright notice and this permission notice shall be included in
          |all copies or substantial portions of the Software.
          |
          |THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
          |IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
          |FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
          |AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
          |LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
          |OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
          |THE SOFTWARE.""".stripMargin
      await(licenseUtil.detect(twitterLicense)) must be (Some("MIT"))
    }
    "detect the MIT license from a jQuery license" in {
      val jqueryLicense =
        """Copyright jQuery Foundation and other contributors, https://jquery.org/
          |
          |This software consists of voluntary contributions made by many
          |individuals. For exact contribution history, see the revision history
          |available at https://github.com/jquery/jquery
          |
          |The following license applies to all parts of this software except as
          |documented below:
          |
          |====
          |
          |Permission is hereby granted, free of charge, to any person obtaining
          |a copy of this software and associated documentation files (the
          |"Software"), to deal in the Software without restriction, including
          |without limitation the rights to use, copy, modify, merge, publish,
          |distribute, sublicense, and/or sell copies of the Software, and to
          |permit persons to whom the Software is furnished to do so, subject to
          |the following conditions:
          |
          |The above copyright notice and this permission notice shall be
          |included in all copies or substantial portions of the Software.
          |
          |THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
          |EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
          |MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
          |NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
          |LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
          |OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
          |WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
          |
          |====
          |
          |All files located in the node_modules and external directories are
          |externally maintained libraries used by this software which have their
          |own licenses; we recommend you read them, as their terms may differ from
          |the terms above.""".stripMargin
      await(licenseUtil.detect(jqueryLicense)) must be (Some("MIT"))
    }
    "not detect a license from a non-license" in {
      await(licenseUtil.detect("asdf")) must be (None)
    }
  }

}


text:
package io.quarkus.smallrye.faulttolerance.deployment;

import java.lang.annotation.Annotation;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Consumer;

import org.eclipse.microprofile.faulttolerance.Asynchronous;
import org.eclipse.microprofile.faulttolerance.Bulkhead;
import org.eclipse.microprofile.faulttolerance.CircuitBreaker;
import org.eclipse.microprofile.faulttolerance.Fallback;
import org.eclipse.microprofile.faulttolerance.Retry;
import org.eclipse.microprofile.faulttolerance.Timeout;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.jandex.IndexView;
import org.jboss.jandex.MethodInfo;
import org.jboss.jandex.Type;

import io.quarkus.arc.processor.AnnotationStore;
import io.quarkus.deployment.builditem.AnnotationProxyBuildItem;
import io.quarkus.deployment.recording.RecorderContext;
import io.quarkus.gizmo.ClassOutput;
import io.smallrye.common.annotation.Blocking;
import io.smallrye.common.annotation.NonBlocking;
import io.smallrye.faulttolerance.api.ApplyFaultTolerance;
import io.smallrye.faulttolerance.api.AsynchronousNonBlocking;
import io.smallrye.faulttolerance.api.CircuitBreakerName;
import io.smallrye.faulttolerance.api.CustomBackoff;
import io.smallrye.faulttolerance.api.ExponentialBackoff;
import io.smallrye.faulttolerance.api.FibonacciBackoff;
import io.smallrye.faulttolerance.api.RateLimit;
import io.smallrye.faulttolerance.autoconfig.FaultToleranceMethod;
import io.smallrye.faulttolerance.autoconfig.MethodDescriptor;

final class FaultToleranceScanner {
    private final IndexView index;
    private final AnnotationStore annotationStore;

    private final AnnotationProxyBuildItem proxy;
    private final ClassOutput output;

    private final RecorderContext recorderContext;

    FaultToleranceScanner(IndexView index, AnnotationStore annotationStore, AnnotationProxyBuildItem proxy,
            ClassOutput output, RecorderContext recorderContext) {
        this.index = index;
        this.annotationStore = annotationStore;
        this.proxy = proxy;
        this.output = output;
        this.recorderContext = recorderContext;
    }

    boolean hasFTAnnotations(ClassInfo clazz) {
        // first check annotations on type
        if (annotationStore.hasAnyAnnotation(clazz, DotNames.FT_ANNOTATIONS)) {
            return true;
        }

        // then check on the methods
        for (MethodInfo method : clazz.methods()) {
            if (annotationStore.hasAnyAnnotation(method, DotNames.FT_ANNOTATIONS)) {
                return true;
            }
        }

        // then check on the parent
        DotName parentClassName = clazz.superName();
        if (parentClassName == null || parentClassName.equals(DotNames.OBJECT)) {
            return false;
        }
        ClassInfo parentClass = index.getClassByName(parentClassName);
        if (parentClass == null) {
            return false;
        }
        return hasFTAnnotations(parentClass);
    }

    void forEachMethod(ClassInfo clazz, Consumer<MethodInfo> action) {
        for (MethodInfo method : clazz.methods()) {
            if (method.name().startsWith("<")) {
                // constructors (or static init blocks) can't be intercepted
                continue;
            }
            if (method.isSynthetic()) {
                // synthetic methods can't be intercepted
                continue;
            }
            if (annotationStore.hasAnnotation(method, io.quarkus.arc.processor.DotNames.NO_CLASS_INTERCEPTORS)
                    && !annotationStore.hasAnyAnnotation(method, DotNames.FT_ANNOTATIONS)) {
                // methods annotated @NoClassInterceptors and not annotated with an interceptor binding are not intercepted
                continue;
            }

            action.accept(method);
        }

        DotName parentClassName = clazz.superName();
        if (parentClassName == null || parentClassName.equals(DotNames.OBJECT)) {
            return;
        }
        ClassInfo parentClass = index.getClassByName(parentClassName);
        if (parentClass == null) {
            return;
        }
        forEachMethod(parentClass, action);
    }

    FaultToleranceMethod createFaultToleranceMethod(ClassInfo beanClass, MethodInfo method) {
        Set<Class<? extends Annotation>> annotationsPresentDirectly = new HashSet<>();

        FaultToleranceMethod result = new FaultToleranceMethod();

        result.beanClass = getClassProxy(beanClass);
        result.method = createMethodDescriptor(method);

        result.applyFaultTolerance = getAnnotation(ApplyFaultTolerance.class, method, beanClass, annotationsPresentDirectly);

        result.asynchronous = getAnnotation(Asynchronous.class, method, beanClass, annotationsPresentDirectly);
        result.asynchronousNonBlocking = getAnnotation(AsynchronousNonBlocking.class, method, beanClass,
                annotationsPresentDirectly);
        result.blocking = getAnnotation(Blocking.class, method, beanClass, annotationsPresentDirectly);
        result.nonBlocking = getAnnotation(NonBlocking.class, method, beanClass, annotationsPresentDirectly);

        result.bulkhead = getAnnotation(Bulkhead.class, method, beanClass, annotationsPresentDirectly);
        result.circuitBreaker = getAnnotation(CircuitBreaker.class, method, beanClass, annotationsPresentDirectly);
        result.circuitBreakerName = getAnnotation(CircuitBreakerName.class, method, beanClass, annotationsPresentDirectly);
        result.fallback = getAnnotation(Fallback.class, method, beanClass, annotationsPresentDirectly);
        result.rateLimit = getAnnotation(RateLimit.class, method, beanClass, annotationsPresentDirectly);
        result.retry = getAnnotation(Retry.class, method, beanClass, annotationsPresentDirectly);
        result.timeout = getAnnotation(Timeout.class, method, beanClass, annotationsPresentDirectly);

        result.customBackoff = getAnnotation(CustomBackoff.class, method, beanClass, annotationsPresentDirectly);
        result.exponentialBackoff = getAnnotation(ExponentialBackoff.class, method, beanClass, annotationsPresentDirectly);
        result.fibonacciBackoff = getAnnotation(FibonacciBackoff.class, method, beanClass, annotationsPresentDirectly);

        result.annotationsPresentDirectly = annotationsPresentDirectly;

        return result;
    }

    private MethodDescriptor createMethodDescriptor(MethodInfo method) {
        MethodDescriptor result = new MethodDescriptor();
        result.declaringClass = getClassProxy(method.declaringClass());
        result.name = method.name();
        result.parameterTypes = method.parameterTypes()
                .stream()
                .map(this::getClassProxy)
                .toArray(Class[]::new);
        result.returnType = getClassProxy(method.returnType());
        return result;
    }

    private <A extends Annotation> A getAnnotation(Class<A> annotationType, MethodInfo method,
            ClassInfo beanClass, Set<Class<? extends Annotation>> directlyPresent) {

        DotName annotationName = DotName.createSimple(annotationType);
        if (annotationStore.hasAnnotation(method, annotationName)) {
            directlyPresent.add(annotationType);
            AnnotationInstance annotation = annotationStore.getAnnotation(method, annotationName);
            return createAnnotation(annotationType, annotation);
        }

        return getAnnotationFromClass(annotationType, beanClass);
    }

    private <A extends Annotation> A getAnnotationFromClass(Class<A> annotationType, ClassInfo clazz) {
        DotName annotationName = DotName.createSimple(annotationType);
        if (annotationStore.hasAnnotation(clazz, annotationName)) {
            AnnotationInstance annotation = annotationStore.getAnnotation(clazz, annotationName);
            return createAnnotation(annotationType, annotation);
        }

        // then check on the parent
        DotName parentClassName = clazz.superName();
        if (parentClassName == null || parentClassName.equals(DotNames.OBJECT)) {
            return null;
        }
        ClassInfo parentClass = index.getClassByName(parentClassName);
        if (parentClass == null) {
            return null;
        }
        return getAnnotationFromClass(annotationType, parentClass);
    }

    private <A extends Annotation> A createAnnotation(Class<A> annotationType, AnnotationInstance instance) {
        return proxy.builder(instance, annotationType).build(output);
    }

    // using class proxies instead of attempting to load the class, because the class
    // doesn't have to exist in the deployment classloader at all -- instead, it may be
    // generated by another Quarkus extension (such as RestClient Reactive)
    private Class<?> getClassProxy(ClassInfo clazz) {
        return recorderContext.classProxy(clazz.name().toString());
    }

    private Class<?> getClassProxy(Type type) {
        // Type.name() returns the right thing
        return recorderContext.classProxy(type.name().toString());
    }
}


text:
from setuptools import setup

setup(name='TracDulwich',
      install_requires='Trac >= 0.12',
      description='GIT version control plugin, with the pure-python Dulwich module, for Trac 0.12',
      author='Niels Sascha Reedijk',
      author_email='niels.reedijk@gmail.com',
      keywords='trac scm plugin git dulwich',
      url="http://",
      version='0.1.0',
      license="MIT",
      long_description="",
      packages=['trac_dulwich'],
      entry_points = {'trac.plugins':
                                ['dulwich = trac_dulwich.dulwich_fs',
                                 'dulwich.cache = trac_dulwich.cache',
                                 'dulwich.api = trac_dulwich.api',
                                 ]},
)


text:
require_relative 'test_helper'

class MachineMultipleTest < BaseTestCase
  def setup
    @model = new_model do
      connection.add_column table_name, :status, :string
    end
    @state_machine = StateMachines::Machine.new(@model, :initial => :parked)
    @status_machine = StateMachines::Machine.new(@model, :status, :initial => :idling)
  end

  def test_should_should_initialize_each_state
    record = @model.new
    assert_equal 'parked', record.state
    assert_equal 'idling', record.status
  end
end


text:
<?php

namespace App\Base\Controllers;

use Yajra\Datatables\Services\DataTable;

abstract class DataTableController extends DataTable
{
    /**
     * Default parameters
     *
     * @var array
     */
    protected $parameters = [
        'dom' => 'Bfrtip',
        'buttons' => ['csv', 'excel', 'pdf'],
        'columnDefs' => [['defaultContent' => '-', 'targets' => '_all']]
    ];

    /**
     * Model that is used to generate this DataTable
     *
     * @var string
     */
    protected $model = "";

    /**
     * Columns to show
     *
     * @var array
     */
    protected $columns =  [];

    /**
     * Image columns to show within image tag
     *
     * @var array
     */
    protected $image_columns =  [];

    /**
     * Properties of the relationships that are loaded via eager loading
     * For instance let Article has a Category and we want to show the Category title within the Article Datatable
     * You can load the article that belongs to category within query function like:
     *
     * public function query()
     * {
     *      $articles = Article::with('category');
     *      return $this->applyScopes($articles);
     * }
     *
     * $eager_columns = ['category' => 'title'];
     *
     * Another example, if there are two relationships loaded via eager loading
     *
     * public function query()
     * {
     *      $comments = Comment::with('category', 'article');
     *      return $this->applyScopes($articles);
     * }
     *
     * $eager_columns = ['category' => 'title', 'article' => 'title'];
     *
     * @var array
     */
    protected $eager_columns =  [];

    /**
     * Boolean columns for translation, show meaningful text instead of 1/true or 0/false
     *
     * @var array
     */
    protected $boolean_columns =  [];

    /**
     * Relations count columns, show the number of related models
     *
     * @var array
     */
    protected $count_columns =  [];

    /**
     * Show the action buttons, show, edit and delete
     *
     * @var bool
     */
    protected $ops = true;

    /**
     * Common columns such that used by more than one class, so that translation belongs to root, not to any model
     * specially, for instance, every model has `created_at` and `updated_at` attribute, hence translation of those
     * properties are single, instead of defining for each model, like `admin.fields.published_at` and so on.
     *
     * @var array
     */
    protected $common_columns = ['created_at', 'updated_at'];

    /**
     * Display ajax response.
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function ajax()
    {
        list($model, $datatables) = $this->getAjaxParameters();
        collect($this->image_columns)->each(function ($image_column) use (&$datatables) {
            return $datatables->editColumn($image_column, function ($model) use ($image_column) {
                return $this->wrapImage($model, $image_column);
            });
        })->recollect($this->boolean_columns)->each(function ($boolean_column) use (&$datatables) {
            return $datatables->editColumn($boolean_column, function ($model) use ($boolean_column) {
                return $model->$boolean_column == true ? trans("admin.fields.yes") : trans("admin.fields.no");
            });
        })->recollect($this->eager_columns)->each(function ($eager_column, $relation) use (&$datatables) {
            return $datatables->editColumn(join(".", [$relation, $eager_column]), function ($model) use ($relation, $eager_column) {
                return $model->$relation->$eager_column;
            });
        })->recollect($this->count_columns)->each(function ($count_column) use (&$datatables) {
            return $datatables->editColumn($count_column, function ($model) use ($count_column) {
                return count($model->$count_column);
            });
        });
        return $this->pushOps($datatables, $model)->make(true);
    }

    /**
     * Optional method if you want to use html builder.
     *
     * @return \Yajra\Datatables\Html\Builder
     */
    public function html()
    {
        return $this->builder()
            ->columns($this->getColumns())
            ->parameters($this->getParameters());
    }

    /**
     * @return array
     */
    protected function getAjaxParameters()
    {
        return [$this->getModelName(), $this->datatables->eloquent($this->query())];
    }

    /**
     * Translate and edit column names
     *
     * Countable columns which are the count of a relation should not have order and search options thus they
     * should get merged lastly, to make them searchable and orderable, you need to join through their table.
     *
     * @param array $result
     *
     * @return array
     */
    protected function getColumns($result = [])
    {
        list($columns, $countColumnsPosition, $model, $table) = $this->getColumnParameters();
        collect($columns)->each(function ($column, $key) use ($model, $table, $countColumnsPosition, &$result) {
            $orderAndSearch = $key < $countColumnsPosition ? true : false;
            $this->pushColumns($result, [
                'data' => $column,
                'name' => join([$table, $column], "."),
                'title' => trans('admin.fields.' . join([$model, $column], "."))
            ], $orderAndSearch);
        })->recollect($this->eager_columns)->each(function ($column, $key) use (&$result) {
            $string = join([$key, $column], ".");
            $this->pushColumns($result, [
                'data' => $string,
                'name' => $string,
                'title' => trans('admin.fields.' . $string),
            ]);
        })->recollect($this->common_columns)->each(function ($column) use ($table, &$result) {
            $string = join([$table, $column], ".");
            $this->pushColumns($result, [
                'data' => $column,
                'name' => $string,
                'title' => trans('admin.fields.' . $column),
            ]);
        });
        return $this->pushOps($result);
    }

    /**
     * @param      $result
     * @param      $data
     * @param bool $orderAndSearch
     *
     * @return int
     */
    protected function pushColumns(&$result, $data, $orderAndSearch = true)
    {
        return array_push($result, array_merge($data, [
            'orderable' => $orderAndSearch,
            'searchable' => $orderAndSearch
        ]));
    }

    /**
     * @param        $result
     *
     * @param string $model
     *
     * @return mixed
     */
    protected function pushOps($result, $model = "")
    {
        if ($this->ops === true) {
            if (empty($model)) {
                $this->pushColumns($result, [
                    'data' => 'ops',
                    'name' => 'ops',
                    'title' => trans('admin.ops.name')
                ], false);
            } else {
                $result = $result->addColumn('ops', function ($data) use ($model) {
                    return get_ops($model, $data->id);
                });
            }
        }
        return $result;
    }

    /**
     * Get the columns that are being translated, model and table
     *
     * @return array
     */
    protected function getColumnParameters()
    {
        $columns = array_merge($this->image_columns, $this->columns, $this->boolean_columns, $this->count_columns);
        return [
            $columns,
            count($columns) - count($this->count_columns),
            $this->getModelName(),
            $this->getTableName()
        ];
    }

    /**
     * Get the table name of the model
     *
     * @return string
     */
    protected function getTableName()
    {
        return ((new $this->model)->getTable());
    }

    /**
     * Get model name
     *
     * @return string
     */
    protected function getModelName()
    {
        return snake_case(class_basename($this->model));
    }

    /**
     * Show image instead of url for the image columns
     *
     * @param $model
     * @param $image_column
     *
     * @return string
     */
    protected function wrapImage($model, $image_column)
    {
        $url = asset($model->$image_column);
        return "

               ";
    }

    /**
     * Translate DataTable parameters, such as search, showing number to number out of number entries exc.
     *
     * @return array
     */
    protected function getParameters()
    {
        return array_merge($this->parameters, ['oLanguage' => trans('admin.datatables')]);
    }
}


text:
declare namespace exjs {
    var version: string;
}
declare namespace exjs {
}
declare namespace exjs {
    interface IProjectionFunc<T, TResult> {
        (t: T): TResult;
    }
    interface IProjectionIndexFunc<T, TResult> {
        (t: T, index: number): TResult;
    }
    interface IEnumerable<T> {
        getEnumerator(): IEnumerator<T>;
    }
    interface IEnumerableEx<T> extends IEnumerable<T> {
        aggregate<TAccumulate>(seed: TAccumulate, accumulator: (acc: TAccumulate, cur: T) => TAccumulate): TAccumulate;
        all(predicate: IProjectionFunc<T, boolean>): boolean;
        all(predicate: IProjectionIndexFunc<T, boolean>): boolean;
        any(predicate?: IProjectionFunc<T, boolean>): boolean;
        any(predicate?: IProjectionIndexFunc<T, boolean>): boolean;
        append(...items: T[]): IEnumerableEx<T>;
        apply<T>(action: IProjectionFunc<T, any>): IEnumerableEx<T>;
        apply<T>(action: IProjectionIndexFunc<T, any>): IEnumerableEx<T>;
        at(index: number): T;
        average(selector?: (t: T) => number): number;
        concat(second: IEnumerable<T>): IEnumerableEx<T>;
        concat(second: T[]): IEnumerableEx<T>;
        count(predicate?: (t: T) => boolean): number;
        difference(second: IEnumerable<T>, comparer?: (f: T, s: T) => boolean): IDifference<T>;
        difference(second: T[], comparer?: (f: T, s: T) => boolean): IDifference<T>;
        distinct(comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        except(second: IEnumerable<T>, comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        except(second: T[], comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        first(match?: (t: T) => boolean): T;
        firstIndex(match?: (t: T) => boolean): number;
        forEach(action: (t: T) => any): any;
        groupBy<TKey>(keySelector: (t: T) => TKey, comparer?: (k1: TKey, k2: TKey) => boolean): IEnumerableEx<IGrouping<TKey, T>>;
        intersect(second: IEnumerable<T>, comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        intersect(second: T[], comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        join<TInner, TKey, TResult>(inner: IEnumerable<TInner>, outerKeySelector: (t: T) => TKey, innerKeySelector: (t: TInner) => TKey, resultSelector: (o: T, i: TInner) => TResult, comparer?: (k1: TKey, k2: TKey) => boolean): IEnumerableEx<TResult>;
        join<TInner, TKey, TResult>(inner: TInner[], outerKeySelector: (t: T) => TKey, innerKeySelector: (t: TInner) => TKey, resultSelector: (o: T, i: TInner) => TResult, comparer?: (k1: TKey, k2: TKey) => boolean): IEnumerableEx<TResult>;
        last(match?: (t: T) => boolean): T;
        lastIndex(match?: (t: T) => boolean): number;
        max(selector?: (t: T) => number): number;
        min(selector?: (t: T) => number): number;
        orderBy<TKey>(keySelector: (t: T) => TKey, comparer?: (f: TKey, s: TKey) => number): IOrderedEnumerable<T>;
        orderByDescending<TKey>(keySelector: (t: T) => TKey, comparer?: (f: TKey, s: TKey) => number): IOrderedEnumerable<T>;
        prepend(...items: T[]): IEnumerableEx<T>;
        reverse(): IEnumerableEx<T>;
        select<TResult>(selector: IProjectionFunc<T, TResult>): IEnumerableEx<TResult>;
        select<TResult>(selector: IProjectionIndexFunc<T, TResult>): IEnumerableEx<TResult>;
        selectMany<TResult>(selector: (t: T) => IEnumerable<TResult>): IEnumerableEx<TResult>;
        selectMany<TResult>(selector: (t: T) => TResult[]): IEnumerableEx<TResult>;
        skip(count: number): IEnumerableEx<T>;
        skipWhile(predicate: IProjectionFunc<T, boolean>): IEnumerableEx<T>;
        skipWhile(predicate: IProjectionIndexFunc<T, boolean>): IEnumerableEx<T>;
        standardDeviation(selector?: (t: T) => number): number;
        sum(selector?: (t: T) => number): number;
        take(count: number): IEnumerableEx<T>;
        takeWhile(predicate: IProjectionFunc<T, boolean>): IEnumerableEx<T>;
        takeWhile(predicate: IProjectionIndexFunc<T, boolean>): IEnumerableEx<T>;
        toArray(): T[];
        toList(): IList<T>;
        toMap<TKey, TValue>(keySelector: (t: T) => TKey, valueSelector: (t: T) => TValue): IMap<TKey, TValue>;
        traverse(selector: (t: T) => T[]): IEnumerableEx<T>;
        traverse(selector: (t: T) => IEnumerable<T>): IEnumerableEx<T>;
        traverseUnique(selector: (t: T) => T[], matcher?: (t1: T, t2: T) => boolean): IEnumerableEx<T>;
        traverseUnique(selector: (t: T) => IEnumerable<T>, matcher?: (t1: T, t2: T) => boolean): IEnumerableEx<T>;
        union(second: IEnumerable<T>, comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        union(second: T[], comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        where(filter: (t: T) => boolean): IEnumerableEx<T>;
        zip<TSecond, TResult>(second: IEnumerable<TSecond>, resultSelector: (f: T, s: TSecond) => TResult): IEnumerableEx<TResult>;
        zip<TSecond, TResult>(second: TSecond[], resultSelector: (f: T, s: TSecond) => TResult): IEnumerableEx<TResult>;
    }
    interface IEnumerator<T> {
        current: T;
        moveNext(): boolean;
    }
    interface IOrderedEnumerable<T> extends IEnumerableEx<T> {
        thenBy<TKey>(keySelector: (t: T) => TKey, comparer?: (f: TKey, s: TKey) => number): IOrderedEnumerable<T>;
        thenByDescending<TKey>(keySelector: (t: T) => TKey, comparer?: (f: TKey, s: TKey) => number): IOrderedEnumerable<T>;
    }
    interface IGrouping<TKey, TElement> extends IEnumerableEx<TElement> {
        key: TKey;
    }
    interface IDifference<T> {
        intersection: IEnumerableEx<T>;
        aNotB: IEnumerableEx<T>;
        bNotA: IEnumerableEx<T>;
    }
    interface IList<T> extends IEnumerableEx<T> {
        toString(): string;
        toLocaleString(): string;
        pop(): T;
        push(...items: T[]): number;
        shift(): T;
        slice(start: number, end?: number): T[];
        sort(compareFn?: (a: T, b: T) => number): T[];
        splice(start: number): T[];
        splice(start: number, deleteCount: number, ...items: T[]): T[];
        unshift(...items: T[]): number;
        indexOf(searchElement: T, fromIndex?: number): number;
        lastIndexOf(searchElement: T, fromIndex?: number): number;
        every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
        some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
        forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
        map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
        filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
        reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
        reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
        reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
        reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
        length: number;
        [n: number]: T;
        remove(item: T): boolean;
        removeWhere(predicate: (t: T, index?: number) => boolean): IEnumerableEx<T>;
    }
    class Enumerable<T> implements IEnumerableEx<T> {
        constructor();
        getEnumerator(): IEnumerator<T>;
        aggregate<TAccumulate>(seed: TAccumulate, accumulator: (acc: TAccumulate, cur: T) => TAccumulate): TAccumulate;
        all(predicate: IProjectionIndexFunc<T, boolean>): boolean;
        any(predicate?: IProjectionIndexFunc<T, boolean>): boolean;
        append(...items: T[]): IEnumerableEx<T>;
        apply<T>(action: IProjectionIndexFunc<T, any>): IEnumerableEx<T>;
        at(index: number): T;
        average(selector?: (t: T) => number): number;
        concat(second: IEnumerable<T>): IEnumerableEx<T>;
        concat(second: T[]): IEnumerableEx<T>;
        count(predicate?: (t: T) => boolean): number;
        difference(second: IEnumerable<T>, comparer?: (f: T, s: T) => boolean): IDifference<T>;
        difference(second: T[], comparer?: (f: T, s: T) => boolean): IDifference<T>;
        distinct(comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        except(second: IEnumerable<T>, comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        except(second: T[], comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        first(match?: (t: T) => boolean): T;
        firstIndex(match?: (t: T) => boolean): number;
        forEach(action: (t: T) => any): void;
        groupBy<TKey>(keySelector: (t: T) => TKey, comparer?: (k1: TKey, k2: TKey) => boolean): IEnumerableEx<IGrouping<TKey, T>>;
        intersect(second: IEnumerable<T>, comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        intersect(second: T[], comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        join<TInner, TKey, TResult>(inner: IEnumerable<TInner>, outerKeySelector: (t: T) => TKey, innerKeySelector: (t: TInner) => TKey, resultSelector: (o: T, i: TInner) => TResult, comparer?: (k1: TKey, k2: TKey) => boolean): IEnumerableEx<TResult>;
        join<TInner, TKey, TResult>(inner: TInner[], outerKeySelector: (t: T) => TKey, innerKeySelector: (t: TInner) => TKey, resultSelector: (o: T, i: TInner) => TResult, comparer?: (k1: TKey, k2: TKey) => boolean): IEnumerableEx<TResult>;
        last(match?: (t: T) => boolean): T;
        lastIndex(match?: (t: T) => boolean): number;
        max(selector?: (t: T) => number): number;
        min(selector?: (t: T) => number): number;
        orderBy<TKey>(keySelector: (t: T) => TKey, comparer?: (f: TKey, s: TKey) => number): IOrderedEnumerable<T>;
        orderByDescending<TKey>(keySelector: (t: T) => TKey, comparer?: (f: TKey, s: TKey) => number): IOrderedEnumerable<T>;
        prepend(...items: T[]): IEnumerableEx<T>;
        reverse(): IEnumerableEx<T>;
        select<TResult>(selector: IProjectionIndexFunc<T, TResult>): IEnumerableEx<TResult>;
        selectMany<TResult>(selector: (t: T) => IEnumerable<TResult>): IEnumerableEx<TResult>;
        selectMany<TResult>(selector: (t: T) => TResult[]): IEnumerableEx<TResult>;
        skip(count: number): IEnumerableEx<T>;
        skipWhile(predicate: IProjectionIndexFunc<T, boolean>): IEnumerableEx<T>;
        standardDeviation(selector?: (t: T) => number): number;
        sum(selector?: (t: T) => number): number;
        take(count: number): IEnumerableEx<T>;
        takeWhile(predicate: IProjectionIndexFunc<T, boolean>): IEnumerableEx<T>;
        traverse(selector: (t: T) => T[]): IEnumerableEx<T>;
        traverse(selector: (t: T) => IEnumerable<T>): IEnumerableEx<T>;
        traverseUnique(selector: (t: T) => T[], uniqueMatch?: (t1: T, t2: T) => boolean): IEnumerableEx<T>;
        traverseUnique(selector: (t: T) => IEnumerable<T>, matcher?: (t1: T, t2: T) => boolean): IEnumerableEx<T>;
        toArray(): T[];
        toMap<TKey, TValue>(keySelector: (t: T) => TKey, valueSelector: (t: T) => TValue): IMap<TKey, TValue>;
        toList(): IList<T>;
        union(second: IEnumerable<T>, comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        union(second: T[], comparer?: (f: T, s: T) => boolean): IEnumerableEx<T>;
        where(filter: (t: T) => boolean): IEnumerableEx<T>;
        zip<TSecond, TResult>(second: IEnumerable<TSecond>, resultSelector: (f: T, s: TSecond) => TResult): IEnumerableEx<TResult>;
        zip<TSecond, TResult>(second: TSecond[], resultSelector: (f: T, s: TSecond) => TResult): IEnumerableEx<TResult>;
    }
}
declare namespace exjs {
}
interface Symbol {
    toString(): string;
    valueOf(): symbol;
}
interface SymbolConstructor {
    readonly prototype: Symbol;
    (description?: string | number): symbol;
    for(key: string): symbol;
    keyFor(sym: symbol): string | undefined;
}
declare var Symbol: SymbolConstructor;
interface SymbolConstructor {
    readonly iterator: symbol;
}
interface IteratorResult<T> {
    done: boolean;
    value: T;
}
interface Iterator<T> {
    next(value?: any): IteratorResult<T>;
    return?(value?: any): IteratorResult<T>;
    throw?(e?: any): IteratorResult<T>;
}
interface Iterable<T> {
    [Symbol.iterator](): Iterator<T>;
}
interface IterableIterator<T> extends Iterator<T> {
    [Symbol.iterator](): IterableIterator<T>;
}
declare var global: any;
declare var window: Window;
declare namespace exjs {
    class Map<TKey, TValue> implements IMap<TKey, TValue> {
        private _keys;
        private _values;
        readonly size: number;
        constructor();
        constructor(enumerable: any[][]);
        constructor(enumerable: IEnumerable<any[]>);
        clear(): void;
        delete(key: TKey): boolean;
        entries(): IEnumerableEx<any[]>;
        forEach(callbackFn: (value: TValue, key: TKey, map?: IMap<TKey, TValue>) => void, thisArg?: any): void;
        get(key: TKey): TValue;
        has(key: TKey): boolean;
        keys(): IEnumerableEx<TKey>;
        set(key: TKey, value: TValue): any;
        values(): IEnumerableEx<TValue>;
    }
}
declare namespace exjs {
    interface IMap<TKey, TValue> {
        size: number;
        clear(): any;
        delete(key: TKey): boolean;
        entries(): IEnumerableEx<any[]>;
        forEach(callbackFn: (value: TValue, key: TKey, map?: IMap<TKey, TValue>) => void, thisArg?: any): any;
        get(key: TKey): TValue;
        has(key: TKey): boolean;
        keys(): IEnumerableEx<TKey>;
        set(key: TKey, value: TValue): any;
        values(): IEnumerableEx<TValue>;
    }
}
declare namespace exjs {
    function anonymous<T>(iterator: (en: IEnumerator<T>) => boolean): IEnumerableEx<T>;
}
declare namespace exjs {
}
declare namespace exjs {
}
interface Array<T> {
    en(): exjs.IEnumerableEx<T>;
}
declare namespace exjs {
}
declare namespace exjs {
}
declare namespace exjs {
}
declare namespace exjs {
}
interface Function {
    fromJson<T>(o: any, mappingOverrides?: any): T;
}
declare namespace exjs {
}
declare namespace exjs {
}
declare namespace exjs {
}
declare namespace exjs {
    class List<T> extends Enumerable<T> implements IList<T> {
        toString(): string;
        toLocaleString(): string;
        pop(): T;
        push(...items: T[]): number;
        shift(): T;
        slice(start: number, end?: number): T[];
        sort(compareFn?: (a: T, b: T) => number): T[];
        splice(start: number): T[];
        splice(start: number, deleteCount: number, ...items: T[]): T[];
        unshift(...items: T[]): number;
        indexOf(searchElement: T, fromIndex?: number): number;
        lastIndexOf(searchElement: T, fromIndex?: number): number;
        every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
        some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
        forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
        map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
        filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
        reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
        reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
        length: number;
        [n: number]: T;
        remove(item: T): boolean;
        removeWhere(predicate: (t: T, index?: number) => boolean): IEnumerableEx<T>;
    }
}
declare namespace exjs {
}
declare namespace exjs {
}
declare namespace exjs {
    function range(start: number, end: number, increment?: number): IEnumerableEx<number>;
}
declare namespace exjs {
}
declare namespace exjs {
    function round(value: number, digits?: number): number;
}
declare namespace exjs {
}
declare namespace exjs {
    function selectorEnumerator<T, TResult>(en: IEnumerable<T>): IEnumerator<TResult>;
    function selectorEnumerator<T, TResult>(arr: T[]): IEnumerator<TResult>;
}
declare namespace exjs {
}
declare namespace exjs {
}
declare namespace exjs {
}
declare namespace exjs {
}
declare namespace exjs {
}
declare namespace exjs {
    function en<T>(enu: IEnumerable<T>): IEnumerableEx<T>;
}
declare var ex: typeof exjs.en;
declare namespace exjs {
}


text:
(async function() {
  'use strict';
  TestRunner.addResult(`Tests content is available for failed image request.\n`);
  await TestRunner.loadTestModule('network_test_runner');
  await TestRunner.loadLegacyModule('console'); await TestRunner.loadTestModule('console_test_runner');
  await TestRunner.showPanel('network');
  await TestRunner.evaluateInPagePromise(`
      function loadData()
      {
          const image = new Image();
          image.src = "resources/404.php";
          image.onerror = resourceLoaded;
      }

      function resourceLoaded()
      {
          console.log("Done.");
      }
  `);

  NetworkTestRunner.recordNetwork();
  ConsoleTestRunner.addConsoleSniffer(step2);
  TestRunner.evaluateInPage('loadData()');

  function step2() {
    const request1 = NetworkTestRunner.networkRequests().pop();
    TestRunner.addResult(request1.url());
    TestRunner.addResult('resource.type: ' + request1.resourceType());
    TestRunner.assertTrue(!request1.failed, 'Resource loading failed.');
    request1.requestContent().then(step3);
  }

  async function step3() {
    var requests =
        NetworkTestRunner.networkRequests().filter((e, i, a) => i % 2 == 0);
    requests.sort(function(a, b) {
      return a.url().localeCompare(b.url());
    });
    TestRunner.addResult('resources count = ' + requests.length);
    for (let i = 0; i < requests.length; i++) {
      TestRunner.addResult(requests[i].url());
      const {content} = await requests[i].requestContent();
      TestRunner.addResult('resource.content after requesting content: ' + content);
    }

    TestRunner.completeTest();
  }
})();


text:
ModuleFileSystem::ModuleFileSystem(const char* name, bool start_enabled) : Module(name, start_enabled)
{
	// need to be created before Awake so other modules can use it
	char* base_path = SDL_GetBasePath();
	PHYSFS_init(base_path);
	SDL_free(base_path);

	// By default we include executable's own directory
	AddPath(".");
	AddPath("Resources.zip");
}

// Destructor
ModuleFileSystem::~ModuleFileSystem()
{
	PHYSFS_deinit();
}

// Called before render is available
bool ModuleFileSystem::Init(Data& config)
{
	LOG("Loading File System");
	bool ret = true;

	// Add all paths in configuration in order
	//AddPath() manually

	if (PHYSFS_setWriteDir(".") == 0)
	{
		LOG("File System error while creating write dir: %s\n", PHYSFS_getLastError());
	}
	//Search Assets and Library folders
	SearchResourceFolders();

	return ret;
}

// Called before quitting
bool ModuleFileSystem::CleanUp()
{
	//LOG("Freeing File System subsystem");
	return true;
}

// Add a new zip file or folder
bool ModuleFileSystem::AddPath(const char* path_or_zip, const char* mount_point)
{
	bool ret = false;

	if (PHYSFS_mount(path_or_zip, mount_point, 1) == 0)
	{
		LOG("File System error while adding a path or zip(%s): %s\n", path_or_zip, PHYSFS_getLastError());
	}
	else
		ret = true;

	return ret;
}

// Check if a file exists
bool ModuleFileSystem::Exists(const char* file) const
{
	return PHYSFS_exists(file) != 0;
}

// Check if a file is a directory
bool ModuleFileSystem::IsDirectory(const char* file) const
{
	return PHYSFS_isDirectory(file) != 0;
}

bool ModuleFileSystem::IsDirectoryOutside(const char * file) const
{
	return (GetFileAttributes((LPCTSTR)file) == FILE_ATTRIBUTE_DIRECTORY) ? true : false;
}

// Read a whole file and put it in a new buffer
unsigned int ModuleFileSystem::Load(const char* file, char** buffer) const
{
	unsigned int ret = 0;

	PHYSFS_file* fs_file = PHYSFS_openRead(file);

	if (fs_file != NULL)
	{
		PHYSFS_sint64 size = PHYSFS_fileLength(fs_file);

		if (size > 0)
		{
			*buffer = new char[(uint)size];
			PHYSFS_sint64 readed = PHYSFS_read(fs_file, *buffer, 1, (PHYSFS_sint32)size);
			if (readed != size)
			{
				LOG("File System error while reading from file %s: %s\n", file, PHYSFS_getLastError());
				if (buffer)
					delete[] buffer;
			}
			else
				ret = (uint)readed;
		}

		if (PHYSFS_close(fs_file) == 0)
			LOG("File System error while closing file %s: %s\n", file, PHYSFS_getLastError());
	}
	else
		LOG("File System error while opening file %s: %s\n", file, PHYSFS_getLastError());

	return ret;
}

// Read a whole file and put it in a new buffer
SDL_RWops* ModuleFileSystem::Load(const char* file) const
{
	char* buffer;
	int size = Load(file, &buffer);

	if (size > 0)
	{
		SDL_RWops* r = SDL_RWFromConstMem(buffer, size);
		if (r != NULL)
			r->close = close_sdl_rwops;

		return r;
	}
	else
		return NULL;
}

int close_sdl_rwops(SDL_RWops *rw)
{
	if (rw->hidden.mem.base)
		delete rw->hidden.mem.base;
	SDL_FreeRW(rw);
	return 0;
}

// Save a whole buffer to disk
unsigned int ModuleFileSystem::Save(const char* file, const void* buffer, unsigned int size) const
{
	unsigned int ret = 0;

	PHYSFS_file* fs_file = PHYSFS_openWrite(file);

	if (fs_file != NULL)
	{
		PHYSFS_sint64 written = PHYSFS_write(fs_file, (const void*)buffer, 1, size);
		if (written != size)
		{
			LOG("File System error while writing to file %s: %s\n", file, PHYSFS_getLastError());
		}
		else
			ret = (uint)written;

		if (PHYSFS_close(fs_file) == 0)
			LOG("File System error while closing file %s: %s\n", file, PHYSFS_getLastError());
	}
	else
		LOG("File System error while opening file %s: %s\n", file, PHYSFS_getLastError());

	return ret;
}

bool ModuleFileSystem::SaveUnique(const char * file, const void* buffer, unsigned int size, const char * path, const char * extension,std::string& output_name)
{ //TODO: check if the file already exists

	char name_to_save[50];
	sprintf_s(name_to_save, 50, "%s.%s", file, extension);

	vector<string> files_in_path;
	GetEnumerateFiles(path, files_in_path);

	int copies = 0;

	bool name_unique = false;

	while (name_unique == false)
	{
		name_unique = true;

		vector<string>::iterator name_file = files_in_path.begin();
		for (name_file; name_file != files_in_path.end(); name_file++)
		{

			if ((*name_file).compare(name_to_save) == 0)
			{
				//add +1 to the file number
				++copies;
				sprintf_s(name_to_save, 50, "%s%d.%s", file, copies, extension);
				name_unique = false;
				break;
			}
		}
	}

	char name[300];
	sprintf_s(name, 300, "%s%s", path, name_to_save);

	if (Save(name, buffer, size) > 0)
	{
		output_name = name;
		return true;
	}
	else
		return false;
}

bool ModuleFileSystem::GetEnumerateFiles(const char * dir, std::vector<std::string>& buffer)
{
	char** ef =PHYSFS_enumerateFiles(dir);

	for (char** i = ef; *i != NULL; i++)
	{
		buffer.push_back(*i);
	}

	PHYSFS_freeList(ef);

	return (ef != NULL) ? true : false;
}

void ModuleFileSystem::GetFilesAndDirectories(const char * dir, std::vector<string>& folders, std::vector<string>& files, bool only_meta_files) const
{
	char** ef = PHYSFS_enumerateFiles(dir);

	string directory(dir);
	string file_name;
	for (char**i = ef; *i != NULL; i++)
	{
		if (PHYSFS_isDirectory((directory+(*i)).c_str()))
		{
			folders.push_back(*i);
		}
		else
		{
			if(!only_meta_files)
				files.push_back(*i);
			else
			{
				file_name = (*i);
				if (file_name.length() >= 6)
				{
					file_name = file_name.substr(file_name.length() - 4, 4);
					if (file_name.compare("meta") == 0)
						files.push_back(*i);
				}
			}
		}
	}

	PHYSFS_freeList(ef);
}

void ModuleFileSystem::GetFilesAndDirectoriesOutside(const char * dir, std::vector<string>& folders, std::vector<string>& files)
{
	//Only for Windows
	string directory = dir;
	string search_path = directory + "/*.*";
	WIN32_FIND_DATA find_data;
	HANDLE handle_find = ::FindFirstFile(search_path.data(), &find_data);
	if (handle_find != INVALID_HANDLE_VALUE)
	{
		while (::FindNextFile(handle_find, &find_data))
		{
			if (!(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
				files.push_back(find_data.cFileName);
			else
			{
				if(strcmp("..", find_data.cFileName) != 0)
					folders.push_back(find_data.cFileName);
			}

		}
		::FindClose(handle_find);
	}
}

bool ModuleFileSystem::CopyFromOutsideFile(const char * from_path, const char * to_path) const
{
	bool ret = false;

	FILE* file;
	fopen_s(&file, from_path, "rb"); //rb-> read in binary
	PHYSFS_file* fs_file = PHYSFS_openWrite(to_path);
	char buffer[8192];

	if (fs_file && file)
	{
		size_t read_ret;
		PHYSFS_sint64 written = 0;
		while( read_ret = fread_s(buffer, 8192, 1, 8192, file))
			written += PHYSFS_write(fs_file, buffer, 1, read_ret);

		ret = true;
	}
	else
	{
		LOG("File System error while copying %s", from_path);
	}

	fclose(file);
	PHYSFS_close(fs_file);

	return ret;
}

string ModuleFileSystem::GetNameFromPath(const string & path) const
{
	//Note: we supose the given path is a file and not a directory.
	size_t name = path.find_last_of("/\\");
	return path.substr(name + 1);
}

double ModuleFileSystem::GetLastModificationTime(const char * file_path) const
{
	return PHYSFS_getLastModTime(file_path);
}

bool ModuleFileSystem::GenerateDirectory(const char * path) const
{
	return PHYSFS_mkdir(path);
}

bool ModuleFileSystem::Delete(string filename) const
{
	int ret;
	vector<string> directories, files;
	if (IsDirectory(filename.data()))
	{
		GetFilesAndDirectories(filename.data(), directories, files);
		for (vector<string>::const_iterator directory = directories.begin(); directory != directories.end(); ++directory)
		{
			string directory_name = filename + *directory + "/";
			Delete(directory_name.data());
		}

		for (vector<string>::const_iterator file = files.begin(); file != files.end(); ++file)
			PHYSFS_delete((filename + '/' + (*file)).data());
	}
	ret = PHYSFS_delete(filename.data());

	return (ret) ? true : false;
}

bool ModuleFileSystem::DuplicateFile(const char * src, const char * dst) const
{
	char* buffer;
	int size = Load(src, &buffer);

	if (size == 0)
	{
		delete[] buffer;
		LOG("Couldn't duplicate %s file to %s", src, dst);
		return false;
	}

	int success = Save(dst, buffer, size);
	delete[] buffer;

	return (success != 0) ? true : false;
}

void ModuleFileSystem::SearchResourceFolders()
{
	const char* folders[] = { ASSETS_FOLDER, LIBRARY_FOLDER}; //2 folders

	for (int i = 0; i < 2; i++)
		if (PHYSFS_exists(folders[i]) == 0)
			PHYSFS_mkdir(folders[i]);

}


text: module.exports = require('oriento').RecordId;


text:
@implementation ParamTableViewCell

@end


text:
<?php

namespace Admin\MedBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Admin\MedBundle\Entity\Planmejoramiento;
use Admin\MedBundle\Form\PlanmejoramientoType;

/**
 * Planmejoramiento controller.
 *
 * @Route("/dec/planm")
 */
class PlanmejoramientoController extends Controller
{

    /**
     * Lists all Planmejoramiento entities.
     *
     * @Route("/", name="planmejoramiento")
     * @Method("GET")
     * @Template()
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();
        $session = $this->getRequest()->getSession();
        $entities = $em->getRepository('AdminMedBundle:Planmejoramiento')->findBy(array('autorid' => $session->get('escuelaid')));

        return array(
            'entities' => $entities,
        );
    }
    /**
     * Creates a new Planmejoramiento entity.
     *
     * @Route("/", name="planmejoramiento_create")
     * @Method("POST")
     * @Template("AdminMedBundle:Planmejoramiento:new.html.twig")
     */
    public function createAction(Request $request)
    {
        $entity = new Planmejoramiento();
        $form = $this->createCreateForm($entity);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('planmejoramiento_show', array('id' => $entity->getId())));
        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
    * Creates a form to create a Planmejoramiento entity.
    *
    * @param Planmejoramiento $entity The entity
    *
    * @return \Symfony\Component\Form\Form The form
    */
    private function createCreateForm(Planmejoramiento $entity)
    {
        $form = $this->createForm(new PlanmejoramientoType(), $entity, array(
            'action' => $this->generateUrl('planmejoramiento_create'),
            'method' => 'POST',
        ));

        $form->add('submit', 'submit', array('label' => 'Create'));

        return $form;
    }

    /**
     * Displays a form to create a new Planmejoramiento entity.
     *
     * @Route("/new", name="planmejoramiento_new")
     * @Method("GET")
     * @Template()
     */
    public function newAction()
    {
        $entity = new Planmejoramiento();
        $form   = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

        /**
     * Seleccionar docente
     *
     * @Route("/add", name="planmejoramiento_add")
     * @Method("GET")
     * @Template()
     */
    public function addAction()
    {
       $em = $this->getDoctrine()->getManager();
       $session = $this->getRequest()->getSession();
       $escuela = $em->getRepository('AdminUnadBundle:Escuela')->find($session->get('escuelaid'));
       $entities = $em->getRepository('AdminUnadBundle:Docente')->findBy(array('escuela' => $escuela));
        return array(
        'entities' => $entities,
        );
    }

     /**
     * Agregar Plan Mejoramiento a Docente
     *
     * @Route("/add/{id}", name="planmejoramiento_agregar")
     * @Method("GET")
     * @Template()
     */
    public function agregarAction($id)
    {
       $planm = new Planmejoramiento();
       $em = $this->getDoctrine()->getManager();
       $session = $this->getRequest()->getSession();
       $docente = $em->getRepository('AdminUnadBundle:Docente')->findOneBy(array('id' => $id));
       $planm->setDocente($docente);
       $planm->setFechaCreacion(new \DateTime());
       $planm->setAutorid($session->get('escuelaid'));
       $em->persist($planm);
       $em->flush();

      return $this->redirect($this->generateUrl('planmejoramiento'));

    }

    /**
     * Finds and displays a Planmejoramiento entity.
     *
     * @Route("/{id}", name="planmejoramiento_show")
     * @Method("GET")
     * @Template()
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('AdminMedBundle:Planmejoramiento')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Planmejoramiento entity.');
        }

        $deleteForm = $this->createDeleteForm($id);

        return array(
            'entity'      => $entity,
            'delete_form' => $deleteForm->createView(),
        );
    }

     /**
     * Finds and displays a Planmejoramiento entity.
     *
     * @Method("GET")
     * @Template()
     */
    public function docAction($id)
    {
        $em = $this->getDoctrine()->getManager();
        //$session = $this->getRequest()->getSession();
        //$docente = $em->getRepository('AdminUnadBundle:Docente')->find($session->get('docenteid'));
        $entity = $em->getRepository('AdminMedBundle:Planmejoramiento')->find($id);
        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Planmejoramiento entity.');
        }

        return array(
            'entity'      => $entity,
        );
    }

    /**
     * Displays a form to edit an existing Planmejoramiento entity.
     *
     * @Route("/{id}/edit", name="planmejoramiento_edit")
     * @Method("GET")
     * @Template()
     */
    public function editAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('AdminMedBundle:Planmejoramiento')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Planmejoramiento entity.');
        }

        $editForm = $this->createEditForm($entity);

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
        );
    }

    /**
    * Creates a form to edit a Planmejoramiento entity.
    *
    * @param Planmejoramiento $entity The entity
    *
    * @return \Symfony\Component\Form\Form The form
    */
    private function createEditForm(Planmejoramiento $entity)
    {
        $form = $this->createForm(new PlanmejoramientoType(), $entity, array(
            'action' => $this->generateUrl('planmejoramiento_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
    /**
     * Edits an existing Planmejoramiento entity.
     *
     * @Route("/{id}", name="planmejoramiento_update")
     * @Method("PUT")
     * @Template("AdminMedBundle:Planmejoramiento:edit.html.twig")
     */
    public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('AdminMedBundle:Planmejoramiento')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Planmejoramiento entity.');
        }

        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);
        $entity->setFechaCierre(new \DateTime());
        if ($editForm->isValid()) {
            $em->flush();

            return $this->redirect($this->generateUrl('planmejoramiento_show', array('id' => $id)));
        }

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
    /**
     * Deletes a Planmejoramiento entity.
     *
     * @Route("/{id}", name="planmejoramiento_delete")
     * @Method("DELETE")
     */
    public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository('AdminMedBundle:Planmejoramiento')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Planmejoramiento entity.');
            }

            $em->remove($entity);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('planmejoramiento'));
    }

    /**
     * Creates a form to delete a Planmejoramiento entity by id.
     *
     * @param mixed $id The entity id
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createDeleteForm($id)
    {
        return $this->createFormBuilder()
            ->setAction($this->generateUrl('planmejoramiento_delete', array('id' => $id)))
            ->setMethod('DELETE')
            ->add('submit', 'submit', array('label' => 'Borrar Plan'))
            ->getForm()
        ;
    }
}


text:
package com.vmware.vim25;

/**
* @author Steve Jin (http://www.doublecloud.org)
* @version 5.1
*/

@SuppressWarnings("all")
public class HostStorageDeviceInfo extends DynamicData {
  public HostHostBusAdapter[] hostBusAdapter;
  public ScsiLun[] scsiLun;
  public HostScsiTopology scsiTopology;
  public HostMultipathInfo multipathInfo;
  public HostPlugStoreTopology plugStoreTopology;
  public boolean softwareInternetScsiEnabled;

  public HostHostBusAdapter[] getHostBusAdapter() {
    return this.hostBusAdapter;
  }

  public ScsiLun[] getScsiLun() {
    return this.scsiLun;
  }

  public HostScsiTopology getScsiTopology() {
    return this.scsiTopology;
  }

  public HostMultipathInfo getMultipathInfo() {
    return this.multipathInfo;
  }

  public HostPlugStoreTopology getPlugStoreTopology() {
    return this.plugStoreTopology;
  }

  public boolean isSoftwareInternetScsiEnabled() {
    return this.softwareInternetScsiEnabled;
  }

  public void setHostBusAdapter(HostHostBusAdapter[] hostBusAdapter) {
    this.hostBusAdapter=hostBusAdapter;
  }

  public void setScsiLun(ScsiLun[] scsiLun) {
    this.scsiLun=scsiLun;
  }

  public void setScsiTopology(HostScsiTopology scsiTopology) {
    this.scsiTopology=scsiTopology;
  }

  public void setMultipathInfo(HostMultipathInfo multipathInfo) {
    this.multipathInfo=multipathInfo;
  }

  public void setPlugStoreTopology(HostPlugStoreTopology plugStoreTopology) {
    this.plugStoreTopology=plugStoreTopology;
  }

  public void setSoftwareInternetScsiEnabled(boolean softwareInternetScsiEnabled) {
    this.softwareInternetScsiEnabled=softwareInternetScsiEnabled;
  }
}


text:
package org.elasticsearch.xpack.sql.analysis;

import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.xpack.sql.ClientSqlException;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.Node;

import static org.elasticsearch.common.logging.LoggerMessageFormat.format;

public class AnalysisException extends ClientSqlException {

    private final int line;
    private final int column;

    public AnalysisException(Node<?> source, String message, Object... args) {
        super(message, args);

        Location loc = Location.EMPTY;
        if (source != null && source.source() != null) {
            loc = source.source().source();
        }
        this.line = loc.getLineNumber();
        this.column = loc.getColumnNumber();
    }

    public AnalysisException(Node<?> source, String message, Throwable cause) {
        super(message, cause);

        Location loc = Location.EMPTY;
        if (source != null && source.source() != null) {
            loc = source.source().source();
        }
        this.line = loc.getLineNumber();
        this.column = loc.getColumnNumber();
    }

    public int getLineNumber() {
        return line;
    }

    public int getColumnNumber() {
        return column;
    }

    @Override
    public RestStatus status() {
        return RestStatus.BAD_REQUEST;
    }

    @Override
    public String getMessage() {
        return format("line {}:{}: {}", getLineNumber(), getColumnNumber(), super.getMessage());
    }
}


text:
'use strict';

var assert = require('assert');

/**
 * A double linked list.
 * @exports List
 * @constructor
 * @property {ListItem|null} head
 * @property {ListItem|null} tail
 * @property {Number} size
 */

function List() {
  if (!(this instanceof List))
    return new List();

  this.head = null;
  this.tail = null;
  this.size = 0;
}

/**
 * Reset the cache. Clear all items.
 */

List.prototype.reset = function reset() {
  var item, next;

  for (item = this.head; item; item = next) {
    next = item.next;
    item.prev = null;
    item.next = null;
  }

  assert(!item);

  this.head = null;
  this.tail = null;
  this.size = 0;
};

/**
 * Remove the first item in the list.
 * @returns {ListItem}
 */

List.prototype.shift = function shift() {
  var item = this.head;

  if (!item)
    return;

  this.remove(item);

  return item;
};

/**
 * Prepend an item to the linked list (sets new head).
 * @param {ListItem}
 * @returns {Boolean}
 */

List.prototype.unshift = function unshift(item) {
  return this.insert(null, item);
};

/**
 * Append an item to the linked list (sets new tail).
 * @param {ListItem}
 * @returns {Boolean}
 */

List.prototype.push = function push(item) {
  return this.insert(this.tail, item);
};

/**
 * Remove the last item in the list.
 * @returns {ListItem}
 */

List.prototype.pop = function pop() {
  var item = this.tail;

  if (!item)
    return;

  this.remove(item);

  return item;
};

/**
 * Insert item into the linked list.
 * @private
 * @param {ListItem|null} ref
 * @param {ListItem} item
 * @returns {Boolean}
 */

List.prototype.insert = function insert(ref, item) {
  if (item.prev || item.next || item === this.head)
    return false;

  assert(!item.prev);
  assert(!item.next);

  if (ref == null) {
    if (!this.head) {
      this.head = item;
      this.tail = item;
    } else {
      this.head.prev = item;
      item.next = this.head;
      this.head = item;
    }
    this.size++;
    return true;
  }

  item.next = ref.next;
  item.prev = ref;
  ref.next = item;

  if (ref === this.tail)
    this.tail = item;

  this.size++;

  return true;
};

/**
 * Remove item from the linked list.
 * @private
 * @param {ListItem}
 * @returns {Boolean}
 */

List.prototype.remove = function remove(item) {
  if (!item.prev && !item.next && item !== this.head)
    return false;

  if (item.prev)
    item.prev.next = item.next;

  if (item.next)
    item.next.prev = item.prev;

  if (item === this.head)
    this.head = item.next;

  if (item === this.tail)
    this.tail = item.prev || this.head;

  if (!this.head)
    assert(!this.tail);

  if (!this.tail)
    assert(!this.head);

  item.prev = null;
  item.next = null;

  this.size--;

  return true;
};

/**
 * Replace an item in-place.
 * @param {ListItem} ref
 * @param {ListItem} item
 */

List.prototype.replace = function replace(ref, item) {
  if (ref.prev)
    ref.prev.next = item;

  if (ref.next)
    ref.next.prev = item;

  item.prev = ref.prev;
  item.next = ref.next;

  ref.next = null;
  ref.prev = null;

  if (this.head === ref)
    this.head = item;

  if (this.tail === ref)
    this.tail = item;
};

/**
 * Slice the list to an array of items.
 * Will remove the items sliced.
 * @param {Number?} total
 * @returns {ListItem[]}
 */

List.prototype.slice = function slice(total) {
  var items = [];
  var item, next;

  if (total == null)
    total = Infinity;

  for (item = this.head; item; item = next) {
    next = item.next;
    item.prev = null;
    item.next = null;

    this.size--;

    items.push(item);

    if (items.length === total)
      break;
  }

  if (next) {
    this.head = next;
    next.prev = null;
  } else {
    this.head = null;
    this.tail = null;
  }

  return items;
};

/**
 * Convert the list to an array of items.
 * @returns {ListItem[]}
 */

List.prototype.toArray = function toArray() {
  var items = [];
  var item;

  for (item = this.head; item; item = item.next)
    items.push(item);

  return items;
};

/**
 * Represents an linked list item.
 * @constructor
 * @private
 * @param {String} key
 * @param {Object} value
 */

function ListItem(value) {
  this.next = null;
  this.prev = null;
}

/*
 * Expose
 */

exports = List;
exports.Item = ListItem;

module.exports = exports;