text:
class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|
      t.string :email, null: false
      t.string :password_digest, null: false
      t.string :session_token

      t.timestamps
    end

    add_index :users, :email, unique: true
  end
end


text:
package cache;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileNotFoundException;

public class CacheImpl {

    /*************************************************************************************************
     * SEND PARAMS METHODS
     *************************************************************************************************/
    public static Container method(int val, boolean bool, String s, String fileIn, String fileInOut, String fileOut,
        Container c1, Container c2) {

        // Print basic types
        System.out.println("INT VAL:    " + val);
        System.out.println("BOOL VAL:   " + bool);
        System.out.println("STRING VAL: " + s);

        // Write fileIn
        FileInputStream fis = null;
        FileOutputStream fos = null;
        try {
            fis = new FileInputStream(fileIn);
            int count = fis.read();
            fos = new FileOutputStream(fileIn);
            fos.write(++count); // Should be transparent to master since it is IN
        } catch (FileNotFoundException fnfe) {
            fnfe.printStackTrace();
            System.exit(-1);
        } catch (IOException ioe) {
            ioe.printStackTrace();
            System.exit(-1);
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                    System.exit(-1);
                }
            }

            if (fos != null) {
                try {
                    fos.close();
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                    System.exit(-1);
                }
            }
        }

        // Write fileInOut
        fis = null;
        fos = null;
        try {
            fis = new FileInputStream(fileInOut);
            int count = fis.read();
            fos = new FileOutputStream(fileInOut);
            fos.write(++count); // Should be transparent to master since it is IN
        } catch (FileNotFoundException fnfe) {
            fnfe.printStackTrace();
            System.exit(-1);
        } catch (IOException ioe) {
            ioe.printStackTrace();
            System.exit(-1);
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                    System.exit(-1);
                }
            }

            if (fos != null) {
                try {
                    fos.close();
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                    System.exit(-1);
                }
            }
        }

        // Write fileOut
        fos = null;
        int value = 10;
        try {
            fos = new FileOutputStream(fileOut);
            fos.write(value); // Should be transparent to master since it is IN
        } catch (FileNotFoundException fnfe) {
            fnfe.printStackTrace();
            System.exit(-1);
        } catch (IOException ioe) {
            ioe.printStackTrace();
            System.exit(-1);
        } finally {
            if (fos != null) {
                try {
                    fos.close();
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                    System.exit(-1);
                }
            }
        }

        // Write IN container
        c1.setValue(c1.getValue() + 1);

        // Write INOUT container
        c2.setValue(c2.getValue() + 1);

        // Write OUT container
        Container c3 = new Container(value);

        return c3;
    }

    /*************************************************************************************************
     * OBJECT CHECKER METHODS
     *************************************************************************************************/
    public static void objectIN(Container c) {
        int val = c.getValue();
        c.setValue(val + 1); // Should be transparent to master since it is IN
    }

    public static void objectINOUT(Container c) {
        int val = c.getValue();
        c.setValue(val + 1);
    }

    public static Container objectOUT() {
        int val = 10;
        Container c = new Container(val);
        return c;
    }

    /*************************************************************************************************
     * FILE CHECKER METHODS
     *************************************************************************************************/
    public static void fileIN(String fileName) {
        FileInputStream fis = null;
        FileOutputStream fos = null;
        try {
            fis = new FileInputStream(fileName);
            int count = fis.read();
            fos = new FileOutputStream(fileName);
            fos.write(++count); // Should be transparent to master since it is IN
        } catch (FileNotFoundException fnfe) {
            fnfe.printStackTrace();
            System.exit(-1);
        } catch (IOException ioe) {
            ioe.printStackTrace();
            System.exit(-1);
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                    System.exit(-1);
                }
            }

            if (fos != null) {
                try {
                    fos.close();
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                    System.exit(-1);
                }
            }
        }
    }

    public static void fileINOUT(String fileName) {
        FileInputStream fis = null;
        FileOutputStream fos = null;
        try {
            fis = new FileInputStream(fileName);
            int count = fis.read();
            fos = new FileOutputStream(fileName);
            fos.write(++count);
        } catch (FileNotFoundException fnfe) {
            fnfe.printStackTrace();
            System.exit(-1);
        } catch (IOException ioe) {
            ioe.printStackTrace();
            System.exit(-1);
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                    System.exit(-1);
                }
            }

            if (fos != null) {
                try {
                    fos.close();
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                    System.exit(-1);
                }
            }
        }
    }

    public static void fileOUT(String fileName) {
        int val = 10;
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream(fileName);
            fos.write(val);
        } catch (FileNotFoundException fnfe) {
            fnfe.printStackTrace();
            System.exit(-1);
        } catch (IOException ioe) {
            ioe.printStackTrace();
            System.exit(-1);
        } finally {
            if (fos != null) {
                try {
                    fos.close();
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                    System.exit(-1);
                }
            }
        }
    }

}

redpajama_set_name: RedPajamaGithub


text:
module NoNonsenseCurrencyConverter
  VERSION = '0.2.0'
end


text:
using System;
using System.Collections.Generic;
using SharpKit.Html;
using SharpKit.JavaScript;

namespace qx.bom.client
{
    /// <summary>
	/// <para>The main purpose of this class to hold all checks about ECMAScript.</para>
	/// <para>This class is used by <see cref="qx.core.Environment"/> and should not be used
	/// directly. Please check its class comment for details how to use it.</para>
	/// </summary>
	[JsType(JsMode.Prototype, Name = "qx.bom.client.EcmaScript", OmitOptionalParameters = true, Export = false)]
    public partial class EcmaScript
    {
		#region Methods

		public EcmaScript() { throw new NotImplementedException(); }

		#endregion Methods
    }
}


text:
package net.sf.uadetector.datastore;

import net.sf.uadetector.datareader.DataReader;
import net.sf.uadetector.datareader.XmlDataReader;

/**
 * This is the simplest implementation of a {@link RefreshableDataStore}. It initialize the store by reading the
 * UAS data online via {@link DataStore#DEFAULT_DATA_URL} and store it only in the Java heap space.
 *

 * Attentation: During initialization the fallback data store will be used and the remote data will be read in
 * background (non-blocking).
 *
 * @author André Rouél
 */
public final class OnlineXmlDataStore extends AbstractRefreshableDataStore {

	/**
	 * The default data reader to read in UAS data in XML format
	 */
	private static final DataReader DEFAULT_DATA_READER = new XmlDataReader();

	/**
	 * Constructs an {@code OnlineXmlDataStore} by reading UAS data by the specified default URL
	 * {@link DataStore#DEFAULT_DATA_URL} (in XML format).
	 *
	 * @param fallback
	 *            UAS data as fallback in case the data on the specified resource can not be read correctly
	 */
	public OnlineXmlDataStore(final DataStore fallback) {
		super(DEFAULT_DATA_READER, DEFAULT_DATA_URL, DEFAULT_VERSION_URL, DEFAULT_CHARSET, fallback);
	}

}


text:
/*
 * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package java.beans.beancontext;

/**
 *

 * This interface is implemented by a JavaBean that does
 * not directly have a BeanContext(Child) associated with
 * it (via implementing that interface or a subinterface thereof),
 * but has a public BeanContext(Child) delegated from it.
 * For example, a subclass of java.awt.Container may have a BeanContext
 * associated with it that all Component children of that Container shall
 * be contained within.
 *

 *

 * An Object may not implement this interface and the
 * BeanContextChild interface
 * (or any subinterfaces thereof) they are mutually exclusive.
 *

 *

 * Callers of this interface shall examine the return type in order to
 * obtain a particular subinterface of BeanContextChild as follows:
 *
 * BeanContextChild bcc = o.getBeanContextProxy();
 *
 * if (bcc instanceof BeanContext) {
 *      // ...
 * }
 *
 * or
 *
 * BeanContextChild bcc = o.getBeanContextProxy();
 * BeanContext      bc  = null;
 *
 * try {
 *     bc = (BeanContext)bcc;
 * } catch (ClassCastException cce) {
 *     // cast failed, bcc is not an instanceof BeanContext
 * }
 *
 *

 *

 * The return value is a constant for the lifetime of the implementing
 * instance
 *

 * @author Laurence P. G. Cable
 * @since 1.2
 *
 * @see java.beans.beancontext.BeanContextChild
 * @see java.beans.beancontext.BeanContextChildSupport
 */

public interface BeanContextProxy {

    /**
     * Gets the BeanContextChild (or subinterface)
     * associated with this object.
     * @return the BeanContextChild (or subinterface)
     * associated with this object
     */
    BeanContextChild getBeanContextProxy();
}


text:
namespace Poco {

const std::string EnvironmentImpl::TEMP("TEMP");
const std::string EnvironmentImpl::TMP("TMP");
const std::string EnvironmentImpl::HOMEPATH("HOMEPATH");
const std::string EnvironmentImpl::COMPUTERNAME("COMPUTERNAME");
const std::string EnvironmentImpl::OS("OS");
const std::string EnvironmentImpl::NUMBER_OF_PROCESSORS("NUMBER_OF_PROCESSORS");
const std::string EnvironmentImpl::PROCESSOR_ARCHITECTURE("PROCESSOR_ARCHITECTURE");

std::string EnvironmentImpl::getImpl(const std::string& name)
{
	std::string value;
	if (!envVar(name, &value)) throw NotFoundException(name);
	return value;
}

bool EnvironmentImpl::hasImpl(const std::string& name)
{
	return envVar(name, 0);
}

void EnvironmentImpl::setImpl(const std::string& name, const std::string& value)
{
	throw NotImplementedException("Cannot set environment variables on Windows CE");
}

std::string EnvironmentImpl::osNameImpl()
{
	return "Windows CE";
}

std::string EnvironmentImpl::osDisplayNameImpl()
{
	return osNameImpl();
}

std::string EnvironmentImpl::osVersionImpl()
{
	OSVERSIONINFOW vi;
	vi.dwOSVersionInfoSize = sizeof(vi);
	if (GetVersionExW(&vi) == 0) throw SystemException("Cannot get OS version information");
	std::ostringstream str;
	str << vi.dwMajorVersion << "." << vi.dwMinorVersion << " (Build " << (vi.dwBuildNumber & 0xFFFF);
	std::string version;
	UnicodeConverter::toUTF8(vi.szCSDVersion, version);
	if (!version.empty()) str << ": " << version;
	str << ")";
	return str.str();
}

std::string EnvironmentImpl::osArchitectureImpl()
{
	SYSTEM_INFO si;
	GetSystemInfo(&si);
	switch (si.wProcessorArchitecture)
	{
	case PROCESSOR_ARCHITECTURE_INTEL:
		return "IA32";
	case PROCESSOR_ARCHITECTURE_MIPS:
		return "MIPS";
	case PROCESSOR_ARCHITECTURE_ALPHA:
		return "ALPHA";
	case PROCESSOR_ARCHITECTURE_PPC:
		return "PPC";
	case PROCESSOR_ARCHITECTURE_IA64:
		return "IA64";
#ifdef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
	case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
		return "IA64/32";
#endif
#ifdef PROCESSOR_ARCHITECTURE_AMD64
	case PROCESSOR_ARCHITECTURE_AMD64:
		return "AMD64";
#endif
	case PROCESSOR_ARCHITECTURE_SHX:
		return "SHX";
	case PROCESSOR_ARCHITECTURE_ARM:
		return "ARM";
	default:
		return "Unknown";
	}
}

std::string EnvironmentImpl::nodeNameImpl()
{
    HKEY hKey;
	DWORD dwDisposition;
    if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"\\Ident", 0, 0, 0, 0, 0, &hKey, &dwDisposition) != ERROR_SUCCESS)
		throw SystemException("Cannot get node name", "registry key not found");

	std::string value;
    DWORD dwType;
    BYTE bData[1026];
    DWORD dwData = sizeof(bData);
	if (RegQueryValueExW(hKey, L"Name", 0, &dwType, bData, &dwData) == ERROR_SUCCESS)
	{
		switch (dwType)
		{
		case REG_SZ:
			UnicodeConverter::toUTF8(reinterpret_cast<wchar_t*>(bData), value);
			break;

		default:
			RegCloseKey(hKey);
			throw SystemException("Cannot get node name", "registry value has wrong type");
		}
	}
	else
	{
	    RegCloseKey(hKey);
		throw SystemException("Cannot get node name", "registry value not found");
	}
    RegCloseKey(hKey);
	return value;
}

void EnvironmentImpl::nodeIdImpl(NodeId& id)
{
	PIP_ADAPTER_INFO pAdapterInfo;
	PIP_ADAPTER_INFO pAdapter = 0;
	ULONG len    = sizeof(IP_ADAPTER_INFO);
	pAdapterInfo = reinterpret_cast<IP_ADAPTER_INFO*>(new char[len]);
	// Make an initial call to GetAdaptersInfo to get
	// the necessary size into len
	DWORD rc = GetAdaptersInfo(pAdapterInfo, &len);
	if (rc == ERROR_BUFFER_OVERFLOW)
	{
		delete [] reinterpret_cast<char*>(pAdapterInfo);
		pAdapterInfo = reinterpret_cast<IP_ADAPTER_INFO*>(new char[len]);
	}
	else if (rc != ERROR_SUCCESS)
	{
		throw SystemException("cannot get network adapter list");
	}
	try
	{
		bool found = false;
		if (GetAdaptersInfo(pAdapterInfo, &len) == NO_ERROR)
		{
			pAdapter = pAdapterInfo;
			while (pAdapter && !found)
			{
				if (pAdapter->Type == MIB_IF_TYPE_ETHERNET && pAdapter->AddressLength == sizeof(id))
				{
					std::memcpy(&id, pAdapter->Address, pAdapter->AddressLength);
					found = true;
				}
				pAdapter = pAdapter->Next;
			}
		}
		else throw SystemException("cannot get network adapter list");
		if (!found) throw SystemException("no Ethernet adapter found");
	}
	catch (Exception&)
	{
		delete [] reinterpret_cast<char*>(pAdapterInfo);
		throw;
	}
	delete [] reinterpret_cast<char*>(pAdapterInfo);
}

unsigned EnvironmentImpl::processorCountImpl()
{
	SYSTEM_INFO si;
	GetSystemInfo(&si);
	return si.dwNumberOfProcessors;
}

bool EnvironmentImpl::envVar(const std::string& name, std::string* value)
{
	if (icompare(name, TEMP) == 0)
	{
		if (value) *value = Path::temp();
	}
	else if (icompare(name, TMP) == 0)
	{
		if (value) *value = Path::temp();
	}
	else if (icompare(name, HOMEPATH) == 0)
	{
		if (value) *value = Path::home();
	}
	else if (icompare(name, COMPUTERNAME) == 0)
	{
		if (value) *value = nodeNameImpl();
	}
	else if (icompare(name, OS) == 0)
	{
		if (value) *value = osNameImpl();
	}
	else if (icompare(name, NUMBER_OF_PROCESSORS) == 0)
	{
		if (value) *value = NumberFormatter::format(processorCountImpl());
	}
	else if (icompare(name, PROCESSOR_ARCHITECTURE) == 0)
	{
		if (value) *value = osArchitectureImpl();
	}
	else return false;
	return true;
}

} // namespace Poco


text:
(function() {
  var exec, fs, path, spawn, _ref;
  var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
  fs = require('fs');
  path = require('path');
  _ref = require('child_process'), spawn = _ref.spawn, exec = _ref.exec;
  this.Gitit = {
    opened: false,
    open: function(url) {
      if (this.opened) {
        return;
      }
      this.opened = true;
      return exec("open " + url);
    },
    hostURL: function(host, user, repo) {
      switch (host) {
        case "github.com":
          return "https://" + host + "/" + user + "/" + repo;
          break;
      }
    },
    actions: {
      ".git/config": function(filePath) {
        return fs.readFile(filePath, __bind(function(err, data) {
          var host, matched, matches, repo, user;
          matches = data.toString().match(/.*\[remote\s[\"\']origin[\"\']\][^\[]*.*url\s?=\s?.*@(.*):(.*)\/(.*)\.git\n/);
          if (!matches) {
            return;
          }
          matched = matches[0], host = matches[1], user = matches[2], repo = matches[3];
          if ((host != null) && (user != null) && (repo != null)) {
            return this.open(this.hostURL(host, user, repo));
          }
        }, this));
      },
      "package.json": function(filePath) {
        var ext, host, match, matches, package, repo, repoName, url, user, _ref, _ref2;
        package = require(filePath);
        repo = (_ref = package.repository) != null ? _ref : {};
        url = typeof repo === 'string' ? repo : (_ref2 = repo.url) != null ? _ref2 : "";
        if (url.length > 0) {
          matches = url.match(/.*:\/\/(.*)\/(.*)\/([^\.]+)(.*)?/);
          if (!matches) {
            return;
          }
          match = matches[0], host = matches[1], user = matches[2], repoName = matches[3], ext = matches[4];
          url = this.hostURL(host, user, repoName);
        } else if (package.name.toString().length > 0) {
          url = "'https://github.com/search?utf8=✓&q=" + package.name + "&type=Everything&start_value=1'";
        }
        if (url.length > 0) {
          return this.open(url);
        }
      }
    },
    run: function() {
      var action, file, relativePath, _ref, _ref2, _results;
      relativePath = (_ref = process.argv[2]) != null ? _ref : "";
      _ref2 = this.actions;
      _results = [];
      for (file in _ref2) {
        action = _ref2[file];
        _results.push(__bind(function(file, action) {
          var filePath;
          filePath = path.resolve(path.join(relativePath, file));
          return path.exists(filePath, __bind(function(exists) {
            if (exists && !this.opened) {
              return action.call(this, filePath);
            }
          }, this));
        }, this)(file, action));
      }
      return _results;
    }
  };
}).call(this);


text:
<?php

$lang['main_nav_item_0'] = 'Início';
$lang['main_nav_item_1'] = 'Pesquisar Itens';
$lang['main_nav_item_2'] = 'Como funciona';
$lang['main_nav_item_3'] = 'Sobre';
$lang['main_nav_item_4'] = 'Começar';
$lang['main_nav_item_5'] = 'Entrar';
$lang['main_nav_item_6'] = 'Minha conta';
$lang['main_nav_item_7'] = 'Sair';
$lang['main_tooltip_logout'] = 'Você quer isto? ):';
$lang['main_tooltip_items'] = 'Pesquisar itens disponíveis';
$lang['main_tooltip_account'] = 'Seu painel';
$lang['main_tooltip_enter'] = 'Entre para trocar algo :)';

$lang['main_notification_alert_title'] = "Psiuuu!!!";
$lang['main_notification_alert'] = "Estamos em fase de testes. Para que notificações e o chat funcionem corretamente, precisamos que você ative a notificação <3";
$lang['main_notification_alert_ok'] = "Deixe me decidir!";
$lang['main_notification_alert_bubble'] = "Queremos o melhor para você. Tem certeza que não quer ativar a notificação? ):";

?>


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

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

Redirecting to the actual home page.

If you're stuck here, it means you don't have javascript
    enabled. Javascript is required to actually use the GeoServer admin console.


text:
// Dojo Requires
dojo.require("esri.arcgis.utils");
dojo.require("esri.IdentityManager");
dojo.require("esri.arcgis.Portal");
dojo.require("dojo.NodeList-manipulate");
dojo.require("dojo.NodeList-traverse");
dojo.require("dojox.NodeList.delegate");
dojo.require("dijit.Dialog");
dojo.require("dojo.io.script");
dojo.require("dojo.number");
// Map Only
dojo.require("esri.map");
dojo.require("esri.dijit.Legend");
dojo.require("esri.dijit.Scalebar");
dojo.require("esri.dijit.OverviewMap");
dojo.require("esri.dijit.BasemapGallery");
dojo.require("esri.tasks.locator");
// Localization
dojo.requireLocalization("esriTemplate","template");
/*------------------------------------*/
// on dojo load
/*------------------------------------*/
dojo.addOnLoad(function(){
	// set default options
	setDefaultConfigOptions();
	// set app ID settings and call setWebmap after
	setAppIdSettings(function(){
		// create portal
		createPortal(function(){
			// query group info
			queryGroup(function(){
				// set webmap info
				setWebmap();
			});
		});
	});
});
/*------------------------------------*/
// Sets the webmap to load
/*------------------------------------*/
function setWebmap(){
	// if webmap set
	if(configOptions.webmap) {
		// init map page
		initMap();
	}
	// get first map in group if no webmap is set
	else{
		// call featured maps function to get 1 webmap
		queryArcGISGroupItems({
			// settings
			id_group: configOptions.group,
			searchType: "Web Map",
			filterType: "Web Mapping Application",
			sortField: configOptions.sortField,
			sortOrder: configOptions.sortOrder,
			perPage: 1,
			// executed after ajax is returned
			callback: function(obj, data){
				// if group has at least 1 webmap
				if(data.results.length > 0){
					// set webmap
					configOptions.webmap = data.results[0].id;
					// init map page
					initMap();
				}
				else{
					// show error dialog
					var dialog = new dijit.Dialog({
						title: i18n.viewer.errors.general,
						content: i18n.viewer.errors.noSearchResults
					});
					dialog.show();
				}
			}
		});
	}
}
/*------------------------------------*/
// Toggle full screen map view
/*------------------------------------*/
function toggleFullscreenMap(value){
	var buttonText;
	// Record center of map
	mapCenter = map.extent.getCenter();
	// if true, fullscreen
	if(value){
		// button text
		buttonText = i18n.viewer.mapPage.exitFullscreen;
		// change html class
		dojo.query("html").addClass('fullScreen');
		// set buttton classes and text
		dojo.query("#fullScreen").attr('title',buttonText);
		// toggle global variable
		mapFullscreen = true;
	}
	// exit fullscreen
	else{
		// button text
		buttonText = i18n.viewer.mapPage.enterFullscreen;
		// change html class
		dojo.query("html").removeClass('fullScreen');
		// set buttton classes and text
		dojo.query("#fullScreen").attr('title',buttonText);
		// toggle global variable
		mapFullscreen = false;
	}
	// reset center of map
	resizeMapAndCenter();
}
/*------------------------------------*/
// Tabs
/*------------------------------------*/
function tabMenu(menuObj, buttonObj){
	// hide all tabs
	dojo.query('.tabMenu').style('display','none');
	// remove selected button class
	dojo.query('#tabMenu .toggleButton').removeClass('buttonSelected');
	// show new tab
	dojo.query(menuObj).style('display','block');
	// set new tab button to selected
	dojo.query(buttonObj).addClass('buttonSelected');
}
/*------------------------------------*/
// Map Buttons
/*------------------------------------*/
function setInnerMapButtons(){
	var html = '';
	// fullscreen button
	if (configOptions.showFullScreenButton) {
		html += '

';
		// fullscreen button
		dojo.query(document).delegate("#fullScreen", "onclick,keyup", function(event){
			if(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13)){
				// if currently in full screen
				if(!mapFullscreen){
					// enter fullscreen
					toggleFullscreenMap(true);
				}
				else{
					// exit fullscreen
					toggleFullscreenMap(false);
				}
			}
	    });
	}
	// if gelocation is available
	/*if(navigator.geolocation){
		// MH if the fullscreen button is not visible, make sure the geolocate button is moved to the right
		var geoButtonID = "geoButton";
		if (!configOptions.showFullScreenButton){
			geoButtonID = "fullScreen";
		}
		html += '

';
		dojo.query(document).delegate("#" + geoButtonID, "onclick,keyup", function(event){
			if(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13)){
				navigator.geolocation.getCurrentPosition(geoLocateMap);
			}
		});
	}*/
	// insert html
	dojo.place(html, "map", "last");
}
/*------------------------------------*/
// Hide auto-complete
/*------------------------------------*/
function hideAutoComplete(){
	dojo.query(".searchList").removeClass('autoCompleteOpen');
	dojo.query("#autoComplete").style('display','none');
}
/*------------------------------------*/
// Set map content
/*------------------------------------*/
function setDelegations(){
    // show about button click
	dojo.query(document).delegate("#showAbout", "onclick,keyup", function(event){
		if(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13)){
			tabMenu('#aboutMenu',this);
		}
    });
	// show legend button click
	dojo.query(document).delegate("#showLegend", "onclick,keyup", function(event){
		if(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13)){
			tabMenu('#legendMenu',this);
		}
	});
	// escape button when in full screen view
	dojo.query(document).delegate("body", "onkeyup", function(e){
		// if esc key and map is fullscreen
		if(e.keyCode === 27 && mapFullscreen) {
			// exit fullscreen
			toggleFullscreenMap(false);
		}
	});
	// Search Button
	dojo.query(document).delegate("#searchAddressButton", "onclick,keyup", function(event){
		if(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13)){
			locate();
			hideAutoComplete();
		}
	});
	// Clear address button
	dojo.query(document).delegate(".iconInput .iconReset", "onclick,keyup", function(event){
		if(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13)){
			var obj = dojo.query(this).prevAll('input');
			clearAddress(obj);
		}
	});
	// auto complete && address specific action listeners
	dojo.query(document).delegate("#searchAddress", "onkeyup", function(e){
		checkAddressStatus(this);
		var aquery = dojo.query(this).attr('value')[0];
		var alength = aquery.length;
		// enter key
		if(e.keyCode === 13 && aquery !== '') {
			clearTimeout (timer);
			clearLocate();
			locate();
			hideAutoComplete();
		}
		// up arrow key
		else if(e.keyCode === 38) {
			dojo.query('#autoComplete li:last')[0].focus();
		}
		// down arrow key
		else if(e.keyCode === 40) {
			dojo.query('#autoComplete li:first')[0].focus();
		}
		// more than 3 chars
		else if(alength >= 2){
			clearTimeout (timer);
			timer = setTimeout(function(){
				autoComplete(aquery);
			}, 250);
		}
		else{
			hideAutoComplete();
		}
	});
	// autocomplete result key up
	dojo.query(document).delegate("#autoComplete ul li", "onclick,keyup", function(e){
		if(e.type === 'click' || (e.type === 'keyup' && e.keyCode === 13)){
			var locTxt = dojo.query(this).text();
			var locNum = dojo.indexOf(dojo.query('#autoComplete ul li'), this);
			dojo.query('#searchAddress').attr('value', locTxt);
			showResults(ACObj, locNum);
			hideAutoComplete();
		}
		else if(e.type === 'keyup' && e.keyCode === 40) {
			dojo.query(this).next('li')[0].focus();
		}
		else if(e.type === 'keyup' && e.keyCode === 38) {
			dojo.query(this).prev('li')[0].focus();
		}
	});
	// clear address
	dojo.query(document).delegate("#clearAddress", "onclick,keyup", function(event){
		if(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13)){
			clearLocate();
			hideAutoComplete();
		}
	});
	// toggle legend layers
	dojo.query(document).delegate("#mapLayerToggle .toggleLayers", "onclick,keyup", function(event){
		if(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13)){
			var dataAttr = dojo.query(this).attr('data-layers')[0].split(',');
			for(var i = 0; i < dataAttr.length; i++){
				toggleLayerSwitch(dataAttr[i]);
			}
		}
    });
}
/*------------------------------------*/
// show autocomplete
/*------------------------------------*/
function showAutoComplete(geocodeResults){
    var aResults = '';
    var partialMatch = dojo.query("#searchAddress").attr('value')[0];
    var regex = new RegExp('(' + partialMatch + ')','gi');
    if(geocodeResults !== null){
		dojo.query(".searchList").addClass('autoCompleteOpen');
        ACObj = geocodeResults;
        aResults += '
';
        for(var i = 0; i < geocodeResults.length; i++){
            var layerClass = '';
            if(i % 2 === 0){
                layerClass = '';
            }
            else{
                layerClass = 'stripe';
            }
			aResults += '
' + geocodeResults[i].address.replace(regex,'' + partialMatch + '')  + '
';
        }
        aResults += '
';
        if(geocodeResults.length > 0){
			var node = dojo.byId('autoComplete');
			if(node){
				setNodeHTML(node, aResults);
				dojo.style(node, 'display', 'block');
			}
		}
		else{
			hideAutoComplete();
		}
    }
}
/*------------------------------------*/
// map now loaded
/*------------------------------------*/
function mapNowLoaded(layers){
	// Map Loaded Class
	dojo.query("#map").addClass('mapLoaded');
	// if overview map
	if(configOptions.showOverviewMap){
		//add the overview map
		var overviewMapDijit = new esri.dijit.OverviewMap({
			map: map,
			attachTo: "bottom-left",
			visible: false
		});
		overviewMapDijit.startup();
	}
	initUI(layers);
	// add popup theme
	dojo.addClass(map.infoWindow.domNode, configOptions.theme);
}
/*------------------------------------*/
// clear the locate graphic
/*------------------------------------*/
function clearLocate() {
	// if locate layer exists
    if(locateResultLayer){
		// clear it
        locateResultLayer.clear();
    }
	// reset locate string
    locateString = "";
}
/*------------------------------------*/
// Locate
/*------------------------------------*/
function locate() {
    var query = dojo.byId("searchAddress").value;
	if(query){
		// add loading spinner
		addSpinner("locateSpinner");
		// locate string
		locateString = query;
		// address object
		var address = {
			SingleLine: locateString
		};
		// get address and set callback. * includes all fields in query
		aoGeocoder.addressToLocations(address,["*"]);
	}
}
/*------------------------------------*/
// search box functions
/*------------------------------------*/
function autoComplete(query) {
	// set global locate string
	locateString = query;
	// address object
	var address = {
		SingleLine: locateString
	};
	// get address and set callback. * includes all fields in query
    aoGeoCoderAutocomplete.addressToLocations(address,["*"]);
}
/*------------------------------------*/
// Show search results
/*------------------------------------*/
function showResults(geocodeResults, resultNumber){
	// remove spinner
	removeSpinner();
	// hide autocomplete
	hideAutoComplete();
	// if result found
	if(geocodeResults.length > 0) {
		// num result variable
		var numResult = 0;
		// if result number
		if(resultNumber){
			numResult = resultNumber;
		}
		// if point graphic set
		if(configOptions.pointGraphic){
			// if locate results
			if(locateResultLayer) {
				locateResultLayer.clear();
			}
			else{
				locateResultLayer = new esri.layers.GraphicsLayer();
				map.addLayer(locateResultLayer);
			}
			// create point marker
			var pointMeters = esri.geometry.geographicToWebMercator(geocodeResults[0].location);
			var pointSymbol = new esri.symbol.PictureMarkerSymbol(configOptions.pointGraphic, 21, 25).setOffset(0,12);
			var locationGraphic = new esri.Graphic(pointMeters,pointSymbol);
			locateResultLayer.add(locationGraphic);
		}
		// set extent variables
		var xminNew, yminNew, xmaxNew, ymaxNew;
		// if no attributes set
		if(!geocodeResults[numResult].hasOwnProperty('attributes')){
			geocodeResults[numResult].attributes = {};
		}
		// if one of the extent properteis isn't set
		if(!geocodeResults[numResult].attributes.hasOwnProperty('West_Lon') || !geocodeResults[numResult].attributes.hasOwnProperty('South_Lat') || !geocodeResults[numResult].attributes.hasOwnProperty('East_Lon') || !geocodeResults[numResult].attributes.hasOwnProperty('North_Lat')){
			xminNew = parseFloat(geocodeResults[numResult].location.x - 0.011);
			yminNew = parseFloat(geocodeResults[numResult].location.y - 0.011);
			xmaxNew = parseFloat(geocodeResults[numResult].location.x + 0.011);
			ymaxNew = parseFloat(geocodeResults[numResult].location.y + 0.011);
		}
		else{
			xminNew = parseFloat(geocodeResults[numResult].attributes.West_Lon);
			yminNew = parseFloat(geocodeResults[numResult].attributes.South_Lat);
			xmaxNew = parseFloat(geocodeResults[numResult].attributes.East_Lon);
			ymaxNew =  parseFloat(geocodeResults[numResult].attributes.North_Lat);
		}
		// create new extent
		var newExtent = new esri.geometry.Extent({
			xmin: xminNew,
			ymin: yminNew,
			xmax: xmaxNew,
			ymax: ymaxNew,
			spatialReference: map.extent.spatialReference
		});
		// set extent converted to web mercator
		map.setExtent(esri.geometry.geographicToWebMercator(newExtent));
	}
	else{
		// show error dialog
		var dialog = new dijit.Dialog({
			title: i18n.viewer.errors.general,
			content: i18n.viewer.errors.noSearchResults
		});
		dialog.show();
	}
}
/*------------------------------------*/
// Basemap Gallery
/*------------------------------------*/
function createBasemapGallery() {
	var html = '';
	// insert HTML for basemap
	html += '
 ' + i18n.viewer.mapPage.switchBasemap + '
';
	html += '

';
	html += '

';
	// if node exists
	var node = dojo.byId("basemapContainer");
	setNodeHTML(node, html);
	//add the basemap gallery, in this case we'll display maps from ArcGIS.com including bing maps
	var basemapGallery = new esri.dijit.BasemapGallery({
		showArcGISBasemaps: true,
		bingMapsKey: configOptions.bingMapsKey,
		map: map
	}, dojo.create("div"));
	dojo.byId("basemapGallery").appendChild(basemapGallery.domNode);
	// start it up!
	basemapGallery.startup();
	// if something bad happened
	dojo.connect(basemapGallery, "onError", function(msg){
		// show error dialog
		var dialog = new dijit.Dialog({
			title: i18n.viewer.errors.general,
			content: msg
		});
		dialog.show();
	});
	// toggle basemap button
	dojo.query(document).delegate("#basemapButton", "onclick,keyup", function(event){
		if(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13)){
			// get nodes
			var buttonNode = dojo.query(this);
			var node = dojo.byId('basemapGallery');
			// if they exist
			if(node && buttonNode){
				// remove classes
				buttonNode.removeClass('buttonSelected open');
				// if already shown
				if(dojo.style(node, 'display') === 'block'){
					// hide
					dojo.style(node, 'display', 'none');
				}
				else{
					// show and add class
					dojo.style(node, 'display', 'block');
					buttonNode.addClass('buttonSelected open');
				}
			}
		}
    });
}
/*------------------------------------*/
// Set search address html
/*------------------------------------*/
function setAddressContainer(){
	var html = '';
	html += '
';
	if(configOptions.locatorserviceurl && configOptions.showMapSearch){
		html += '
';
			html += '
';
				html += '<input tabindex="0" placeholder="' + i18n.viewer.mapPage.findPlaceholder + '" title="' + i18n.viewer.mapPage.findLocation + '" id="searchAddress" value="" autocomplete="off" type="text" tabindex="1">';
				html += '

';
			html += '
';
			html += '

';
			html += '

';
		html += '
';
		html += '

';
		html += '
';
			html += '

';
		html += '
';
		html += '

';
	}
	else{
		html += ' ';
	}
	html += '
';
	html += '

';
	html += '
';
	html += '

';
	// Set
	var node = dojo.byId("addressContainer");
	setNodeHTML(node, html);
}
/*------------------------------------*/
// Insert Menu Tab HTML
/*------------------------------------*/
function insertMenuTabs(){
	var html = '';
	html += '
' + i18n.viewer.sidePanel.legendButton + '
';
	html += '
' + i18n.viewer.sidePanel.aboutButton + '
';
	html += '

';
	// Set
	var node = dojo.byId("tabMenu");
	setNodeHTML(node, html);
}
/*------------------------------------*/
// Add bottom map buttons
/*------------------------------------*/
function addBottomMapButtons(){
	var html = '';
	if(configOptions.showExplorerButton && !isMobileUser()){
		// add open in explorer button
		html += '' + i18n.viewer.mapPage.openInExplorer + '';
	}
	if(configOptions.showArcGISOnlineButton){
		// add open in arcgis button
		html += '' + i18n.viewer.mapPage.openInArcGIS + '';
	}
	// If mobile user
	if(isMobileUser() && configOptions.showMobileButtons){
		// add button
		html += '' + i18n.viewer.mapPage.openInMobile + '';
		// add app button
		html += 'Get Mobile App'; // localize
	}
	if(html === ''){
		html = ' ';
	}
	// insert
	var node = dojo.byId("mapButtons");
	setNodeHTML(node, html);
}
/*------------------------------------*/
// Init Map
/*------------------------------------*/
function initMap() {
	// set map content
	setDelegations();
	// set map buttons
	setInnerMapButtons();
	// ITEM
	var itemDeferred = esri.arcgis.utils.getItem(configOptions.webmap);
	itemDeferred.addErrback(function(error) {
		// show error dialog
		dialog = new dijit.Dialog({
			title: i18n.viewer.errors.general,
			content: i18n.viewer.errors.createMap + error
		});
		dialog.show();
		// hide all content
		hideAllContent();
	});
	itemDeferred.addCallback(function(itemInfo) {
		var html = '';
		// if it's a webmap
		if(itemInfo && itemInfo.item && itemInfo.item.type === 'Web Map'){
			// insert menu tab html
			insertMenuTabs();
			// insert address html
			setAddressContainer();
			// if no title set in config
			if(!configOptions.mapTitle){
				configOptions.mapTitle = itemInfo.item.title;
			}
			// if no subtitle set in config
			if(!configOptions.mapSnippet){
				configOptions.mapSnippet = itemInfo.item.snippet;
			}
			// if no description set in config
			if(!configOptions.mapItemDescription){
				configOptions.mapItemDescription = itemInfo.item.description;
			}
			// Set title
			// MH Set the drupal page title instead.
			var titleNode = dojo.byId("page-title");
            // MH var titleNode = dojo.byId("title");
			setNodeHTML(titleNode, '
' + configOptions.mapTitle + '
' || "");
			// Set subtitle
			var subTitleNode = dojo.byId("subtitle");
			setNodeHTML(subTitleNode, '
'+ configOptions.mapSnippet + '
' || "");
			// if showMoreInfo is set
			if(configOptions.showMoreInfo){
				var d, dateLocale;
				html = '';
				html += '
' + i18n.viewer.mapPage.moreInformation + '
';
				html += '
';
				// Set owner
				if(itemInfo.item.owner){
					html += '
' + i18n.viewer.mapPage.ownerHeader + '
' + itemInfo.item.owner + '
';
				}
				// item page link
				html += '
';
				html += '' + i18n.viewer.mapPage.arcgisLink + '';
				html += '
';
				html += '
';
				// set html to node
				var mapMoreInfo = dojo.byId("mapMoreInfo");
				setNodeHTML(mapMoreInfo, html);
			}
			// Set description
			var descriptionInfo = configOptions.mapItemDescription || "";
			var descNode = dojo.byId("descriptionContent");
			setNodeHTML(descNode, '
' + i18n.viewer.mapPage.aboutHeader + '
' + descriptionInfo + '

');
			// set page title
			if(configOptions.mapTitle){
				document.title = configOptions.siteTitle + ' | ' + configOptions.mapTitle;
			}
			else{
				document.title = configOptions.siteTitle;
			}
			// add bottom map buttons
			addBottomMapButtons();
			// create map
			var mapDeferred = esri.arcgis.utils.createMap(itemInfo, "map", {
				mapOptions: {
					slider: true,
					sliderStyle: "small",
					wrapAround180:true,
					nav: false
				},
				ignorePopups:false,
				bingMapsKey: configOptions.bingMapsKey,
				geometryServiceURL: configOptions.geometryserviceurl
			});
			// map response
			mapDeferred.addCallback(function(response) {
				// set map
				map = response.map;
				var layers = response.itemInfo.itemData.operationalLayers;
				// LAYER TOGGLE
				if(configOptions.showLayerToggle && layers.length > 0){
					var html = '';
					var mapLayersNode = dojo.byId('mapLayers');
					if(mapLayersNode){
						html += '
' + i18n.viewer.mapPage.layersHeader + '
';
						html += '
';
						html += "
";
						for(j=0; j < layers.length; j++){
							var checked;
							// if feature collection
							if(layers[j].featureCollection){
								html += "
";
								checked = '';
								if(layers[j].visibility){
									checked = 'checked="checked"';
								}
								// check column
								html += '<input tabindex="0" class="toggleLayers" id="layerCheckbox' + j + '" ' + checked + ' type="checkbox" data-layers="';
								// if feature collection layers
								if(layers[j].featureCollection.layers){
									for(k = 0; k < layers[j].featureCollection.layers.length; k++){
										html += layers[j].featureCollection.layers[k].id;
										// if not last
										if(k !== (layers[j].featureCollection.layers.length - 1)){
											html += ",";
										}
									}
								}
								// csv
								else{
									html += layers[j].id;
								}
								html += '" />	';
								// label column
								html += '' + layers[j].title + '	';
								html += "
";
							}
							else{
								html += "
";
								checked = '';
								if(layers[j].visibility){
									checked = 'checked="checked"';
								}
								// check column
								html += '<input tabindex="0" class="toggleLayers" id="layerSingleCheckbox' + j + '" ' + checked + ' type="checkbox" data-layers="';
								html += layers[j].id;
								html += '" />	';
								// label column
								html += '' + layers[j].title + '	';
								html += "
";
							}
						}
						html += "
";
						html += '
';
						html += '

';
						setNodeHTML(mapLayersNode, html);
					}
				}
				// ENDLAYER TOGGLE
				if(map.loaded){
					mapNowLoaded(layers);
				}
				else{
					dojo.connect(map,"onLoad",function(){
						mapNowLoaded(layers);
					});
				}
			});
			mapDeferred.addErrback(function(error) {
				// show error dialog
				var dialog = new dijit.Dialog({
					title: i18n.viewer.errors.general,
					content: i18n.viewer.errors.createMap + " : " + error
				});
				dialog.show();
				// hide all content
				hideAllContent();
			});
			// LOCATOR
			aoGeocoder = new esri.tasks.Locator(configOptions.locatorserviceurl);
			aoGeoCoderAutocomplete = new esri.tasks.Locator(configOptions.locatorserviceurl);
			dojo.connect(aoGeocoder, "onAddressToLocationsComplete", showResults);
			dojo.connect(aoGeoCoderAutocomplete, "onAddressToLocationsComplete", showAutoComplete);
			itemDeferred.addErrback(function(error) {
				var dialog;
				// don't i18n this. I'ts returned from the server
				if (error && error.message === "BingMapsKey must be provided.") {
					dialog = new dijit.Dialog({
						title: i18n.viewer.errors.general,
						content: i18n.viewer.errors.bingError
					});
					dialog.show();
				}
				else {
					// show error dialog
					dialog = new dijit.Dialog({
						title: i18n.viewer.errors.general,
						content: i18n.viewer.errors.createMap + " : " + error
					});
					dialog.show();
					// hide all content
					hideAllContent();
				}
			});
		}
		else{
			// show error dialog
			dialog = new dijit.Dialog({
				title: i18n.viewer.errors.general,
				content: i18n.viewer.errors.createMap
			});
			dialog.show();
			// hide all content
			hideAllContent();
		}
	});
}
/*------------------------------------*/
// TOGGLE LAYER
/*------------------------------------*/
function toggleLayerSwitch(layerid){
	var layer = map.getLayer(layerid);
	if(layer){
		//if visible hide the layer
		if(layer.visible === true) {
			layer.hide();
		}
		//otherwise show
		else {
			layer.show();
		}
	}
}
/*------------------------------------*/
// BUILD LAYERS LIST
/*------------------------------------*/
function buildLayersList(layers) {
    //layers  arg is  response.itemInfo.itemData.operationalLayers;
    var layerInfos = [];
    dojo.forEach(layers, function (mapLayer, index) {
        var layerInfo = {};
        if (mapLayer.featureCollection && mapLayer.type !== "CSV") {
            if (mapLayer.featureCollection.showLegend === true) {
                dojo.forEach(mapLayer.featureCollection.layers, function (fcMapLayer) {
                    if (fcMapLayer.showLegend !== false) {
                        layerInfo = {
                            "layer": fcMapLayer.layerObject,
                            "title": mapLayer.title,
                            "defaultSymbol": false
                        };
                        if (mapLayer.featureCollection.layers.length > 1) {
                            layerInfo.title += " - " + fcMapLayer.layerDefinition.name;
                        }
                        layerInfos.push(layerInfo);
                    }
                });
            }
        } else if (mapLayer.showLegend !== false && mapLayer.layerObject) {
			var showDefaultSymbol = false;
			if (mapLayer.layerObject.version < 10.1 && (mapLayer.layerObject instanceof esri.layers.ArcGISDynamicMapServiceLayer || mapLayer.layerObject instanceof esri.layers.ArcGISTiledMapServiceLayer)) {
				showDefaultSymbol = true;
			}
			layerInfo = {
				"layer": mapLayer.layerObject,
				"title": mapLayer.title,
				"defaultSymbol": showDefaultSymbol
			};
            //does it have layers too? If so check to see if showLegend is false
            if (mapLayer.layers) {
                var hideLayers = dojo.map(dojo.filter(mapLayer.layers, function (lyr) {
                    return (lyr.showLegend === false);
                }), function (lyr) {
                    return lyr.id;
                });
                if (hideLayers.length) {
                    layerInfo.hideLayers = hideLayers;
                }
            }
            layerInfos.push(layerInfo);
        }
    });
    return layerInfos;
}
/*------------------------------------*/
// INIT UI
/*------------------------------------*/
function initUI(layers) {
	// Set legend header
	var node = dojo.byId('legendHeader');
	setNodeHTML(node, i18n.viewer.sidePanel.title);
	// Set basemap gallery
	if(configOptions.showBasemapGallery){
		createBasemapGallery();
	}
	// Set map background image
	dojo.query("#map").style('background-image','none');
	// Setup resize map
	dojo.connect(window, "onresize", resizeMap);
	//add scalebar
	var scalebar = new esri.dijit.Scalebar({
		map: map,
		scalebarUnit: i18n.viewer.main.scaleBarUnits
	});
	// Legend Information
	var layerInfo = buildLayersList(layers);
	// Build Legend
	if(layerInfo.length > 0){
		var legendDijit = new esri.dijit.Legend({
			map:map,
			layerInfos:layerInfo
		},"legendContent");
		legendDijit.startup();
	}
	else{
		var legendContentNode = dojo.byId('legendContent');
		setNodeHTML(legendContentNode, i18n.viewer.errors.noLayers);
	}
}
/*------------------------------------*/
// Resize and Reposition Map
/*------------------------------------*/
function mapResizeAndReposition(){
	map.resize();
	map.reposition();
}
/*------------------------------------*/
// Resize Map And Center
/*------------------------------------*/
function resizeMapAndCenter(){
	clearTimeout(resizeTimer);
	resizeTimer = setTimeout(function() {
		mapResizeAndReposition();
		if(mapCenter.x && mapCenter.y){
			setTimeout(function() {
				map.centerAt(mapCenter);
				mapResizeAndReposition();
			}, 500);
		}
	}, 500);
}
/*------------------------------------*/
// Resize Map
/*------------------------------------*/
function resizeMap() {
	clearTimeout(resizeTimer);
	if(map){
		resizeTimer = setTimeout(function() {
			mapResizeAndReposition();
		}, 500);
	}
}


text:
package cs220.users

import scalikejdbc._

object Lives {
  Class.forName("org.h2.Driver")
  ConnectionPool.singleton("jdbc:h2:./users", "sa", "")
  implicit val session = AutoSession

  private def printUser(a: Address): Unit =
    println(s"  ${a.street}, ${a.city}, ${a.state}, ${a.zipcode}")

  private def printUser(u: User): Unit = {
    println(s"\n${u.fname} ${u.lname}")
    u.lives.foreach(printUser)
  }

  def printUser: Unit =
    User.list.foreach(printUser)

  private def printAddress(a: Address): Unit = {
    println(s"\n${a.street}, ${a.city}, ${a.state}, ${a.zipcode}")
    a.lives.foreach(printAddress)
  }

  private def printAddress(u: User): Unit = {
    println(s"  ${u.fname} ${u.lname}")
  }

  def printAddress: Unit =
    Address.list.foreach(printAddress)
}


text:
using System.Collections.Generic;
using System.Text.Json;
using Azure.Core;
using Azure.ResourceManager.Compute;

namespace Azure.ResourceManager.Compute.Models
{
    internal partial class OSVersionListResult
    {
        internal static OSVersionListResult DeserializeOSVersionListResult(JsonElement element)
        {
            IReadOnlyList<CloudServiceOSVersionData> value = default;
            Optional<string> nextLink = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    List<CloudServiceOSVersionData> array = new List<CloudServiceOSVersionData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(CloudServiceOSVersionData.DeserializeCloudServiceOSVersionData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return new OSVersionListResult(value, nextLink.Value);
        }
    }
}


text:
"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var Serializable_1 = require("../../store/decorators/Serializable");
var ShiftAction_1 = require("./ShiftAction");
var Go = /** @class */ (function (_super) {
    __extends(Go, _super);
    function Go() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = Go_1.type;
        return _this;
    }
    Go_1 = Go;
    Go.prototype.fn = function (state) {
        return state.go;
    };
    var Go_1;
    Go.type = 'Go';
    Go = Go_1 = __decorate([
        Serializable_1.default
    ], Go);
    return Go;
}(ShiftAction_1.default));
exports.default = Go;
//# sourceMappingURL=Go.js.map


text:
'use strict';

angular.module('techRadarApp').factory('radarService', ['radarData', function(radarData) {

    function Radar(title, data) {
      this.title = title || 'Technology Radar';
      this.data = data ? data : [
        {
          label: 'Adopt',
          text: 'Switch to these',
          categories: [
            { label: 'Tools', technologies: []},
            { label: 'Techniques', technologies: []},
            { label: 'Platforms', technologies: []},
            { label: 'Languages & Frameworks', technologies: []},
          ]
        },
        {
          label: 'Trial',
          categories: [
            { label: 'Tools', technologies: []},
            { label: 'Techniques', technologies: []},
            { label: 'Platforms', technologies: []},
            { label: 'Languages & Frameworks', technologies: []},
          ]
        },
        {
          label: 'Assess',
          categories: [
            { label: 'Tools', technologies: []},
            { label: 'Techniques', technologies: []},
            { label: 'Platforms', technologies: []},
            { label: 'Languages & Frameworks', technologies: []},
          ]
        },
        {
          label: 'Hold',
          text: 'Don\'t start with it now. Try to replace.',
          categories: [
            { label: 'Tools', technologies: []},
            { label: 'Techniques', technologies: []},
            { label: 'Platforms', technologies: []},
            { label: 'Languages & Frameworks', technologies: []},
          ]
        }
      ];

      data.forEach(function(status) {
        var technologies = _.flatten(_.pluck(_.flatten(status.categories), 'technologies'));
        technologies.forEach(function(technology) {
          technology.status = status.label;
        });
      });

      this.allCategories = _.flatten(_.pluck(data, 'categories'));
      this.allTechnologies = _.flatten(_.pluck(this.allCategories, 'technologies'));
    }

    Radar.prototype.getTechnologies = function() {
      return this.allTechnologies;
    };

    Radar.prototype.getCategories = function() {
      return this.allCategories;
    };

    Radar.prototype.getTechnologiesOfSameType = function(tech) {
      return _.where(this.allTechnologies, {type: tech.type});
    };

    var selectedRadar = radarData[0];
    var radar = new Radar(selectedRadar.title, selectedRadar.data);

    function getCategories() {
      var categories = _.flatten(_.pluck(radar.data, 'categories'));
      return _.uniq(_.pluck(categories, 'label'));
    }

    function getStatuses() {
      return _.pluck(radar.data, 'label');
    }

    var radarDescriptions = _.pluck(radarData, 'title');

    var selectRadar = function(title) {
      var selectedRadar = _.findWhere(radarData, {'title': title});
      radar = new Radar(selectedRadar.title, selectedRadar.data);
      return radar;
    };

    return {
      getRadar: function() {
        return radar;
      },
      radarDescriptions: radarDescriptions,
      selectedRadarTitle: radar.title,
      selectRadar: selectRadar,
      categories: getCategories(),
      statuses: getStatuses() };
  }]);


text:
package com.adobe.acs.commons.genericlists;

import com.adobe.acs.commons.mcp.form.FormField;
import com.adobe.acs.commons.mcp.form.MultifieldComponent;
import java.util.List;
import java.util.Locale;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import javax.inject.Named;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.DefaultInjectionStrategy;
import org.apache.sling.models.annotations.Model;
import org.osgi.annotation.versioning.ProviderType;

/**
 * A generic list of title/value pairs.
 */
@ProviderType
@Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL, resourceType = "acs-commons/components/utilities/genericlist")
public interface GenericList {

    /**
     * Return an ordered list of title/value pairs.
     *
     * @return the item list
     */
    @Nonnull
    @Inject
    @Named("list")
    @FormField(name = "List", component = MultifieldComponent.class)
    List<Item> getItems();

    /**
     * Get an item's title by its value.
     *
     * @param value the list item's value
     * @return the title or null
     */
    @CheckForNull
    String lookupTitle(String value);

    /**
     * Get an item's localized title by its value.
     *
     * @param value the list item's value
     * @param locale the locale for localization
     * @return the title or null
     */
    @CheckForNull
    String lookupTitle(String value, Locale locale);

    /**
     * A generic item/value pair within a list.
     *
     */
    @Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL, resourceType = "acs-commons/components/utilities/genericlist/item")
    interface Item {

        /**
         * Get the item's title.
         *
         * @return the title
         */
        @Nonnull
        @Inject
        @Named("jcr:title")
        @FormField(name = "Title", localize = true)
        String getTitle();

        /**
         * Get the item's localized title.
         *
         * @param locale the locale for localization
         *
         * @return the title
         */
        @Nonnull
        String getTitle(Locale locale);

        /**
         * Get the item's value.
         *
         * @return the value
         */
        @Nonnull
        @Inject
        @Named("value")
        @FormField(name = "Value")
        String getValue();
    }
}


text:
'use strict';

const EARTH_RADIUS_IN_KILOMETERS = 6371;

class GeopositionHelper {
  calculateLatitudeDegreesFromRadiusInKilometers(radius) {
    let oneKilometerInLatitudeDegrees = 1 / 110.54;

    return radius * oneKilometerInLatitudeDegrees;
  }
  calculateLongitudeDegreesFromRadiusInKilometers(latitude, radius) {
    let oneKilometerInLongitudeDegrees = 1 / (111.320 * Math.cos(latitude * (Math.PI / 180)));

    return radius * oneKilometerInLongitudeDegrees;
  }

  calculateDistanceInKilometers(firstPosition, secondPosition) {
    // Formula source:
    // http://stackoverflow.com/questions/27928/calculate-distance-between-two-latitude-longitude-points-haversine-formula

    let deltaLatitude = convertDegreesToRadians(secondPosition.latitude - firstPosition.latitude);
    let deltaLongitude = convertDegreesToRadians(secondPosition.longitude - firstPosition.longitude);

    let sinusHalfDeltaLatitude = Math.sin(deltaLatitude / 2);
    let sinusHalfDeltaLongitude = Math.sin(deltaLongitude / 2);

    let a = Math.pow(sinusHalfDeltaLatitude, 2) +
      Math.cos(convertDegreesToRadians(firstPosition.latitude)) *
      Math.cos(convertDegreesToRadians(secondPosition.latitude)) *
      Math.pow(sinusHalfDeltaLongitude, 2);

    let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
    let distance = EARTH_RADIUS_IN_KILOMETERS * c;

    return distance;
  }
}

function convertDegreesToRadians(degrees) {
  let radians = degrees * (Math.PI / 180);

  return radians;
}

module.exports = {
  GeopositionHelper: GeopositionHelper,
  defaultInstance: new GeopositionHelper()
};


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

 Lorem ipsum dolor sit amet

Product Code : DEN1098

 $70 $95

In scelerisque libero ut elit porttitor commodo Suspendisse laoreet magna.

COLOR

                            <select class="form-control">
                                <option value="strawberries" selected>Quantity</option>
                                <option value="mango">1</option>
                                <option value="bananas">2</option>
                                <option value="watermelon">3</option>
                                <option value="grapes">4</option>
                                <option value="oranges">5</option>
                                <option value="pineapple">6</option>
                                <option value="peaches">7</option>
                                <option value="cherries">8</option>
                            </select>

                            <select class="form-control">
                                <option value="strawberries" selected>Size</option>
                                <option value="mango">XL</option>
                                <option value="bananas">XXL</option>
                                <option value="watermelon">M</option>
                                <option value="apples">L</option>
                                <option value="apples">S</option>
                            </select>

                        <button onclick="productAddToCartForm.submit(this);"
                                class="button btn-block btn-cart cart first" title="Add to Cart"
                                type="button">
                            Add to Cart
                        </button>

Add to Wishlist

 SHARE


text:
jQuery-TableNav
=================

A jQuery plugin providing navigation with arrow keys in a table with
input fields.

It's created with Coffeescript since it's fun and efficient to work with!

##Why this plugin?
You know the way you can navigate between cells in those spreadsheets apps? It's
nice to have something like that as well in your HTML tables.

##Installing
Grab one of the two files from dist/ in the repository and make sure you
insert the following line in you HTML document. Insert jquery.tablenav.js
_after_ the jQuery script:

```html
<script src="jquery.tablenav.js"></script>
```
##Usage
```javascript
$('#my-awesome-table').tableNav();
```

That's all! Now you can use your arrow keys to navigate between the enabled
input fields in the table.

##Example

Check out this [live](http://www.invetek.nl/samples/tablenav) sample (and its [source](sample)).


text:
namespace {

using views::Widget;

using AnyWidgetObserverTest = views::test::WidgetTest;

TEST_F(AnyWidgetObserverTest, ObservesInitialize) {
  views::AnyWidgetObserver observer(views::test::AnyWidgetTestPasskey{});

  bool initialized = false;

  observer.set_initialized_callback(
      base::BindLambdaForTesting([&](Widget*) { initialized = true; }));

  EXPECT_FALSE(initialized);
  WidgetAutoclosePtr w0(WidgetTest::CreateTopLevelPlatformWidget());
  EXPECT_TRUE(initialized);
}

TEST_F(AnyWidgetObserverTest, ObservesClose) {
  views::AnyWidgetObserver observer(views::test::AnyWidgetTestPasskey{});

  bool closing = false;

  observer.set_closing_callback(
      base::BindLambdaForTesting([&](Widget*) { closing = true; }));

  EXPECT_FALSE(closing);
  { WidgetAutoclosePtr w0(WidgetTest::CreateTopLevelPlatformWidget()); }
  EXPECT_TRUE(closing);
}

TEST_F(AnyWidgetObserverTest, ObservesShow) {
  views::AnyWidgetObserver observer(views::test::AnyWidgetTestPasskey{});

  bool shown = false;

  observer.set_shown_callback(
      base::BindLambdaForTesting([&](Widget*) { shown = true; }));

  EXPECT_FALSE(shown);
  WidgetAutoclosePtr w0(WidgetTest::CreateTopLevelPlatformWidget());
  w0->Show();
  EXPECT_TRUE(shown);
}

TEST_F(AnyWidgetObserverTest, ObservesHide) {
  views::AnyWidgetObserver observer(views::test::AnyWidgetTestPasskey{});

  bool hidden = false;

  observer.set_hidden_callback(
      base::BindLambdaForTesting([&](Widget*) { hidden = true; }));

  EXPECT_FALSE(hidden);
  WidgetAutoclosePtr w0(WidgetTest::CreateTopLevelPlatformWidget());
  w0->Hide();
  EXPECT_TRUE(hidden);
}

class NamedWidgetShownWaiterTest : public views::test::WidgetTest {
 public:
  NamedWidgetShownWaiterTest() = default;
  ~NamedWidgetShownWaiterTest() override = default;

  views::Widget* CreateNamedWidget(const std::string& name) {
    Widget* widget = new Widget;
    Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
    params.native_widget = views::test::CreatePlatformNativeWidgetImpl(
        widget, views::test::kStubCapture, nullptr);
    params.name = name;
    widget->Init(std::move(params));
    return widget;
  }
};

TEST_F(NamedWidgetShownWaiterTest, ShownAfterWait) {
  views::NamedWidgetShownWaiter waiter(views::test::AnyWidgetTestPasskey{},
                                       "TestWidget");

  WidgetAutoclosePtr w0(CreateNamedWidget("TestWidget"));
  base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
      FROM_HERE, base::BindOnce([](views::Widget* widget) { widget->Show(); },
                                base::Unretained(w0.get())));
  EXPECT_EQ(waiter.WaitIfNeededAndGet(), w0.get());
}

TEST_F(NamedWidgetShownWaiterTest, ShownBeforeWait) {
  views::NamedWidgetShownWaiter waiter(views::test::AnyWidgetTestPasskey{},
                                       "TestWidget");
  WidgetAutoclosePtr w0(CreateNamedWidget("TestWidget"));
  w0->Show();
  EXPECT_EQ(waiter.WaitIfNeededAndGet(), w0.get());
}

TEST_F(NamedWidgetShownWaiterTest, ShownInactive) {
  views::NamedWidgetShownWaiter waiter(views::test::AnyWidgetTestPasskey{},
                                       "TestWidget");
  WidgetAutoclosePtr w0(CreateNamedWidget("TestWidget"));
  w0->ShowInactive();
  EXPECT_EQ(waiter.WaitIfNeededAndGet(), w0.get());
}

TEST_F(NamedWidgetShownWaiterTest, OtherWidgetShown) {
  views::NamedWidgetShownWaiter waiter(views::test::AnyWidgetTestPasskey{},
                                       "TestWidget");
  WidgetAutoclosePtr w0(CreateNamedWidget("NotTestWidget"));
  WidgetAutoclosePtr w1(CreateNamedWidget("TestWidget"));
  w0->Show();
  w1->Show();
  EXPECT_EQ(waiter.WaitIfNeededAndGet(), w1.get());
}

}  // namespace


text:
result_expires = 12 * 3600
task_reject_on_worker_lost = True


text:
package lu.gab.com.alertapet.util;

/**
 * Created by Lu on 27/06/2017.
 */

public class Constants {

    public static final String REPORT_KEY = "reports";
    public static final String MY_REPORTS = "my_reports";
    public static final String USERS_KEYS = "users";

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<DeviceInformation>
   <MACAddress>0003E369A125</MACAddress>
   <HostName>SEP0003E369A125</HostName>
   <phoneDN>5920</phoneDN>
   <appLoadID>P00308010200</appLoadID>
   <bootLoadID>PC03A300</bootLoadID>
   <versionID>8.1</versionID>
   <DSPLoadID>4.0</DSPLoadID>
   <addonModule1></addonModule1>
   <addonModule2></addonModule2>
   <hardwareRevision>1.0</hardwareRevision>
   <serialNumber>INMXXXXXXX</serialNumber>
   <modelNumber>CP-7940</modelNumber>
   <Codec>ADLCodec</Codec>
   <Amps>3V Amp</Amps>
   <C3PORevision>2</C3PORevision>
   <MessageWaiting>OUI</MessageWaiting>
</DeviceInformation>


text:
> Oh, dogs. Sure, I like dags. I like caravans more.

Wavelet-based step counter.


text:
<TITLE>isgraph()</TITLE>
<LINK REL=StyleSheet HREF="../rw.css" TYPE="text/css" TITLE="Rogue Wave Standard Stylesheet">

Rogue Wave C++ Standard Library Reference Guide

isgraph()

Module:  Standard C++ Library   Library:  Localization

Function

Local Index

Summary

Synopsis

Description

See Also

Standards Conformance

Local Index

No Entries

Summary

Locale convenience function that determines if a character is a graphic character

Synopsis

#include <locale>

namespace std {
  template <class charT>
  bool isgraph(charT c, const locale& loc);
}

Description

The <SAMP>isgraph()</SAMP> function returns <SAMP>true</SAMP> if the character passed as a parameter is a graphic character. Otherwise the function returns <SAMP>false</SAMP>.   The check is made using the <SAMP>ctype</SAMP> facet from the <SAMP>locale</SAMP> parameter.

See Also

ctype, locale, <SAMP>isalnum()</SAMP>, <SAMP>isalpha()</SAMP>, <SAMP>iscntrl()</SAMP>, <SAMP>isdigit()</SAMP>, <SAMP>islower()</SAMP>, <SAMP>isprint()</SAMP>, <SAMP>ispunct()</SAMP>, <SAMP>isspace()</SAMP>, <SAMP>isupper()</SAMP>, <SAMP>isxdigit()</SAMP>

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 22.1.3.1


text:
* training settings can be edited at top of \__main__.py file

### Dependencies

* python 3.4
* theano 0.7
* numpy/scipy

tested on Ubuntu 14.04.2, NVIDIA GeForce GTX 870M, Driver Version: 346.72, Cuda 7.0, Bumblebee 3.2.1

### Run

```bash
cd confusion-words
python3 lstm_language_model
```

or with bumblebee for NVIDIA optimus support on Linux:

```bash
cd confusion-words
optirun python3 lstm_language_model
```

### Results

* results for generating sequences during training will be printed
* weights and cost function errors will be pickled to files in regular intervals during training
* saved files can be loaded for continuing training
* saved weights file can be used to apply model and calculate scores in test.py script

### Acknowledgements

* Christian Herta for LSTM tutorial: http://christianherta.de/lehre/dataScience/machineLearning/neuralNetworks/LSTM.php (code snippet inspired by tutorial marked in \__main__.py)


text:
package com.mapswithme.maps.settings;

import android.app.Activity;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;

import java.util.List;
import java.util.Locale;

import com.mapswithme.maps.R;
import com.mapswithme.maps.base.OnBackPressListener;
import com.mapswithme.util.Constants;
import com.mapswithme.util.Utils;

public class StoragePathFragment extends BaseSettingsFragment
                              implements StoragePathManager.MoveFilesListener,
                                         OnBackPressListener
{
  private TextView mHeader;
  private ListView mList;

  private StoragePathAdapter mAdapter;
  private final StoragePathManager mPathManager = new StoragePathManager();

  @Override
  protected int getLayoutRes()
  {
    return R.layout.fragment_prefs_storage;
  }

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
  {
    super.onCreateView(inflater, container, savedInstanceState);

    mHeader = (TextView) mFrame.findViewById(R.id.header);
    mList = (ListView) mFrame.findViewById(R.id.list);
    mList.setOnItemClickListener(new AdapterView.OnItemClickListener()
    {
      @Override
      public void onItemClick(AdapterView<?> parent, View view, int position, long id)
      {
        mAdapter.onItemClick(position);
      }
    });

    return mFrame;
  }

  @Override
  public void onResume()
  {
    super.onResume();
    mPathManager.startExternalStorageWatching(getActivity(), new StoragePathManager.OnStorageListChangedListener()
    {
      @Override
      public void onStorageListChanged(List<StorageItem> storageItems, int currentStorageIndex)
      {
        updateList();
      }
    }, this);

    if (mAdapter == null)
      mAdapter = new StoragePathAdapter(mPathManager, getActivity());

    updateList();
    mList.setAdapter(mAdapter);
  }

  @Override
  public void onPause()
  {
    super.onPause();
    mPathManager.stopExternalStorageWatching();
  }

  private void updateList()
  {
    long dirSize = StorageUtils.getWritableDirSize();
    mHeader.setText(getString(R.string.maps) + ": " + getSizeString(dirSize));

    if (mAdapter != null)
      mAdapter.update(mPathManager.getStorageItems(), mPathManager.getCurrentStorageIndex(), dirSize);
  }

  @Override
  public void moveFilesFinished(String newPath)
  {
    updateList();
  }

  @Override
  public void moveFilesFailed(int errorCode)
  {
    if (!isAdded())
      return;

    final String message = "Failed to move maps with internal error: " + errorCode;
    final Activity activity = getActivity();
    if (activity.isFinishing())
      return;

    new AlertDialog.Builder(activity)
        .setTitle(message)
        .setPositiveButton(R.string.report_a_bug, new DialogInterface.OnClickListener()
        {
          @Override
          public void onClick(DialogInterface dialog, int which)
          {
            Utils.sendSupportMail(activity, message);
          }
        }).show();
  }

  static String getSizeString(long size)
  {
    final String units[] = { "Kb", "Mb", "Gb" };

    long current = Constants.KB;
    int i = 0;
    for (; i < units.length; ++i)
    {
      final long bound = Constants.KB * current;
      if (size < bound)
        break;

      current = bound;
    }

    // left 1 digit after the comma and add postfix string
    return String.format(Locale.US, "%.1f %s", (double) size / current, units[i]);
  }

  @Override
  public boolean onBackPressed()
  {
    return false;
  }
}


text:
/* ###
 * IP: GHIDRA
 *
 * 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 ghidra.util.database;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.*;

import db.DBHandle;
import ghidra.framework.data.DBDomainObjectSupport;
import ghidra.util.Msg;
import ghidra.util.Swing;
import ghidra.util.task.TaskMonitor;

/**
 * A domain object that can use {@link DBCachedObjectStoreFactory}.
 *
 *

 * Technically, this only introduces a read-write lock to the domain object. The
 * {@link DBCachedObjectStoreFactory} and related require this read-write lock. Sadly, this idea
 * didn't pan out, and that read-write lock is just a degenerate wrapper of the Ghidra
 * {@link ghidra.util.Lock}, which is not a read-write lock. This class may disappear.
 */
public abstract class DBCachedDomainObjectAdapter extends DBDomainObjectSupport {

	static class SwingAwareReadWriteLock extends ReentrantReadWriteLock {
		private SwingAwareReadLock readerLock = new SwingAwareReadLock(this);
		private SwingAwareWriteLock writerLock = new SwingAwareWriteLock(this);

		static class SwingAwareReadLock extends ReadLock {
			protected SwingAwareReadLock(ReentrantReadWriteLock lock) {
				super(lock);
			}

			@Override
			public void lock() {
				long blockStartTime = System.currentTimeMillis();
				super.lock();
				long blockEndTime = System.currentTimeMillis();
				long lapsed = blockEndTime - blockStartTime;
				if (Swing.isSwingThread() && lapsed > 30) {
					Msg.warn(this, "Read-Locked the swing thread for " + lapsed + " ms!");
				}
			}
		}

		static class SwingAwareWriteLock extends WriteLock {
			protected SwingAwareWriteLock(ReentrantReadWriteLock lock) {
				super(lock);
			}

			@Override
			public void lock() {
				long blockStartTime = System.currentTimeMillis();
				super.lock();
				long blockEndTime = System.currentTimeMillis();
				long lapsed = blockEndTime - blockStartTime;
				if (Swing.isSwingThread() && lapsed > 30) {
					Msg.warn(this, "Write-Locked the swing thread for " + lapsed + " ms!");
				}
			}
		}

		@Override
		public ReadLock readLock() {
			return readerLock;
		}

		@Override
		public WriteLock writeLock() {
			return writerLock;
		}
	}

	/**
	 * Adapts a {@link ghidra.util.Lock} to the {@link Lock} interface
	 *
	 *

	 * Not all operations are supported. In particular, no {@link #lockInterruptibly()},
	 * {@link #tryLock(long,TimeUnit)}, nor {@link #newCondition()}.
	 */
	static class GhidraLockWrappingLock implements Lock {
		private final ghidra.util.Lock ghidraLock;

		public GhidraLockWrappingLock(ghidra.util.Lock ghidraLock) {
			this.ghidraLock = ghidraLock;
		}

		@Override
		public void lock() {
			ghidraLock.acquire();
		}

		@Override
		public void lockInterruptibly() throws InterruptedException {
			throw new UnsupportedOperationException();
		}

		@Override
		public boolean tryLock() {
			synchronized (ghidraLock) { // Yes, sync on the lock's intrinsic lock
				Thread lockOwner = ghidraLock.getOwner();
				if (lockOwner == null || lockOwner == Thread.currentThread()) {
					ghidraLock.acquire();
					return true;
				}
				return false;
			}
		}

		@Override
		public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
			throw new UnsupportedOperationException();
		}

		@Override
		public void unlock() {
			ghidraLock.release();
		}

		@Override
		public Condition newCondition() {
			throw new UnsupportedOperationException();
		}
	}

	/**
	 * Not a true read-write lock, but adapts a {@link ghidra.util.Lock} to the
	 * {@link ReadWriteLock} interface. The read lock and the write lock are just the same lock
	 */
	static class GhidraLockWrappingRWLock implements ReadWriteLock {
		private final GhidraLockWrappingLock oneLock;

		public GhidraLockWrappingRWLock(ghidra.util.Lock ghidraLock) {
			this.oneLock = new GhidraLockWrappingLock(ghidraLock);
		}

		@Override
		public Lock readLock() {
			return oneLock;
		}

		@Override
		public Lock writeLock() {
			return oneLock;
		}
	}

	protected ReadWriteLock rwLock;

	/**
	 * @see {@link DBDomainObjectSupport}
	 */
	protected DBCachedDomainObjectAdapter(DBHandle dbh, DBOpenMode openMode, TaskMonitor monitor,
			String name, int timeInterval, int bufSize, Object consumer) {
		super(dbh, openMode, monitor, name, timeInterval, bufSize, consumer);
		this.rwLock = new GhidraLockWrappingRWLock(lock);
	}

	/**
	 * Get the "read-write" lock
	 *
	 * @return the lock
	 */
	public ReadWriteLock getReadWriteLock() {
		return rwLock;
	}
}


text:
<?php

namespace Google\Service\AndroidPublisher\Resource;

use Google\Service\AndroidPublisher\SubscriptionPurchase;
use Google\Service\AndroidPublisher\SubscriptionPurchasesAcknowledgeRequest;
use Google\Service\AndroidPublisher\SubscriptionPurchasesDeferRequest;
use Google\Service\AndroidPublisher\SubscriptionPurchasesDeferResponse;

/**
 * The "subscriptions" collection of methods.
 * Typical usage is:
 *  <code>
 *   $androidpublisherService = new Google\Service\AndroidPublisher(...);
 *   $subscriptions = $androidpublisherService->subscriptions;
 *  </code>
 */
class PurchasesSubscriptions extends \Google\Service\Resource
{
  /**
   * Acknowledges a subscription purchase. (subscriptions.acknowledge)
   *
   * @param string $packageName The package name of the application for which this
   * subscription was purchased (for example, 'com.some.thing').
   * @param string $subscriptionId The purchased subscription ID (for example,
   * 'monthly001').
   * @param string $token The token provided to the user's device when the
   * subscription was purchased.
   * @param SubscriptionPurchasesAcknowledgeRequest $postBody
   * @param array $optParams Optional parameters.
   */
  public function acknowledge($packageName, $subscriptionId, $token, SubscriptionPurchasesAcknowledgeRequest $postBody, $optParams = [])
  {
    $params = ['packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token, 'postBody' => $postBody];
    $params = array_merge($params, $optParams);
    return $this->call('acknowledge', [$params]);
  }
  /**
   * Cancels a user's subscription purchase. The subscription remains valid until
   * its expiration time. (subscriptions.cancel)
   *
   * @param string $packageName The package name of the application for which this
   * subscription was purchased (for example, 'com.some.thing').
   * @param string $subscriptionId The purchased subscription ID (for example,
   * 'monthly001').
   * @param string $token The token provided to the user's device when the
   * subscription was purchased.
   * @param array $optParams Optional parameters.
   */
  public function cancel($packageName, $subscriptionId, $token, $optParams = [])
  {
    $params = ['packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token];
    $params = array_merge($params, $optParams);
    return $this->call('cancel', [$params]);
  }
  /**
   * Defers a user's subscription purchase until a specified future expiration
   * time. (subscriptions.defer)
   *
   * @param string $packageName The package name of the application for which this
   * subscription was purchased (for example, 'com.some.thing').
   * @param string $subscriptionId The purchased subscription ID (for example,
   * 'monthly001').
   * @param string $token The token provided to the user's device when the
   * subscription was purchased.
   * @param SubscriptionPurchasesDeferRequest $postBody
   * @param array $optParams Optional parameters.
   * @return SubscriptionPurchasesDeferResponse
   */
  public function defer($packageName, $subscriptionId, $token, SubscriptionPurchasesDeferRequest $postBody, $optParams = [])
  {
    $params = ['packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token, 'postBody' => $postBody];
    $params = array_merge($params, $optParams);
    return $this->call('defer', [$params], SubscriptionPurchasesDeferResponse::class);
  }
  /**
   * Checks whether a user's subscription purchase is valid and returns its expiry
   * time. (subscriptions.get)
   *
   * @param string $packageName The package name of the application for which this
   * subscription was purchased (for example, 'com.some.thing').
   * @param string $subscriptionId The purchased subscription ID (for example,
   * 'monthly001').
   * @param string $token The token provided to the user's device when the
   * subscription was purchased.
   * @param array $optParams Optional parameters.
   * @return SubscriptionPurchase
   */
  public function get($packageName, $subscriptionId, $token, $optParams = [])
  {
    $params = ['packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token];
    $params = array_merge($params, $optParams);
    return $this->call('get', [$params], SubscriptionPurchase::class);
  }
  /**
   * Refunds a user's subscription purchase, but the subscription remains valid
   * until its expiration time and it will continue to recur.
   * (subscriptions.refund)
   *
   * @param string $packageName The package name of the application for which this
   * subscription was purchased (for example, 'com.some.thing').
   * @param string $subscriptionId "The purchased subscription ID (for example,
   * 'monthly001').
   * @param string $token The token provided to the user's device when the
   * subscription was purchased.
   * @param array $optParams Optional parameters.
   */
  public function refund($packageName, $subscriptionId, $token, $optParams = [])
  {
    $params = ['packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token];
    $params = array_merge($params, $optParams);
    return $this->call('refund', [$params]);
  }
  /**
   * Refunds and immediately revokes a user's subscription purchase. Access to the
   * subscription will be terminated immediately and it will stop recurring.
   * (subscriptions.revoke)
   *
   * @param string $packageName The package name of the application for which this
   * subscription was purchased (for example, 'com.some.thing').
   * @param string $subscriptionId The purchased subscription ID (for example,
   * 'monthly001').
   * @param string $token The token provided to the user's device when the
   * subscription was purchased.
   * @param array $optParams Optional parameters.
   */
  public function revoke($packageName, $subscriptionId, $token, $optParams = [])
  {
    $params = ['packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token];
    $params = array_merge($params, $optParams);
    return $this->call('revoke', [$params]);
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(PurchasesSubscriptions::class, 'Google_Service_AndroidPublisher_Resource_PurchasesSubscriptions');


text:
module PortfolioEngine
  module DefaultHelper
  end
end


text:
"use strict";

import React from 'react';

/**
 * Admin Page
 */
var AdminPage = React.createClass({
	componentDidMount: function() {
		console.log('AdminPage.js');
	},
	render: function() {
		return (

Admin

		);
	}
});

export default AdminPage;


text:
package com.baidu.bjf.remoting.protobuf.descriptor;

import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.google.protobuf.DescriptorProtos.OneofDescriptorProto;

/**
 * JProtobuf supports for {@link OneofDescriptorProto}
 * @author xiemalin
 * @since 2.0.1
 */
public class OneofDescriptorProtoPOJO {

    @Protobuf(order = OneofDescriptorProto.NAME_FIELD_NUMBER)
    public String name;

    @Override
    public String toString() {
        return "OneofDescriptorProtoPOJO [name=" + name + "]";
    }

}


text:
namespace Security.HMAC
{
    using System;

    internal class SystemTime : ITime
    {
        public static readonly ITime Instance = new SystemTime();

        public DateTimeOffset UtcNow => DateTimeOffset.UtcNow;
    }
}


text:
=head1 LICENSE

Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute

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.

=cut

package EnsEMBL::Web::Document::Element::BodyJavascript;

use strict;

use previous qw(init);

sub init {
  my $self = shift;
  my $type = $self->hub->type;

  $self->PREV::init;
  $self->add_sources('solr', 'SOLR_JS_NAME') if $type and $type eq 'Search';
}

1;


text:
'use strict';
/*jshint asi: true */

var test = require('tap').test
  , transform = require('../lib/transform');

test('\ngiven a file with edge-case header names', function (t) {
  var content = require('fs').readFileSync(__dirname + '/fixtures/readme-with-weird-headers.md', 'utf8');
  var headers = transform(content);

  t.deepEqual(
      headers.toc.split('\n')
    , [ '## Table of Contents',
        '',
        '- [hasOwnProperty](#hasownproperty)',
        '- [something else](#something-else)',
        '' ]
    , 'generates a correct toc when headers are weird'
  )

  t.end()
})


text:
package org.drools.core.reteoo;

import org.drools.core.facttemplates.FactTemplate;
import org.drools.core.facttemplates.FactTemplateObjectType;
import org.drools.core.impl.InternalKnowledgeBase;
import org.drools.core.rule.EntryPointId;
import org.drools.core.rule.TypeDeclaration;
import org.drools.core.spi.ObjectType;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

public class FactTemplateTypeConf
    implements
    ObjectTypeConf,
    Externalizable {

    private static final long serialVersionUID = 510l;

    private transient InternalKnowledgeBase kBase;

    private ObjectType        objectType;
    private FactTemplate      factTemplate;
    private ObjectTypeNode    concreteObjectTypeNode;
    private ObjectTypeNode[]  cache;

    private boolean          tmsEnabled;

    EntryPointId entryPoint;

    public FactTemplateTypeConf() {
    }

    public FactTemplateTypeConf(final EntryPointId entryPoint,
                                final FactTemplate factTemplate,
                                final InternalKnowledgeBase kBase) {
        this.kBase = kBase;
        this.factTemplate = factTemplate;
        this.entryPoint = entryPoint;
        this.objectType = new FactTemplateObjectType( factTemplate );
        this.concreteObjectTypeNode = (ObjectTypeNode) kBase.getRete().getObjectTypeNodes( entryPoint ).get( objectType );
        this.cache = new ObjectTypeNode[]{this.concreteObjectTypeNode};
    }

    public void readExternal(ObjectInput in) throws IOException,
                                            ClassNotFoundException {
        kBase = (InternalKnowledgeBase) in.readObject();
        factTemplate = (FactTemplate) in.readObject();
        concreteObjectTypeNode = (ObjectTypeNode) in.readObject();
        cache = (ObjectTypeNode[]) in.readObject();
        objectType = (ObjectType) in.readObject();
    }

    public void writeExternal(ObjectOutput out) throws IOException {
        out.writeObject( kBase );
        out.writeObject( factTemplate );
        out.writeObject( concreteObjectTypeNode );
        out.writeObject( cache );
        out.writeObject( objectType );
    }

    public ObjectTypeNode getConcreteObjectTypeNode() {
        if (concreteObjectTypeNode == null) {
            concreteObjectTypeNode = kBase.getRete().getObjectTypeNodes( entryPoint ).get( objectType );
        }
        return this.concreteObjectTypeNode;
    }

    public ObjectTypeNode[] getObjectTypeNodes() {
        if ( this.cache == null ) {
            this.cache = new ObjectTypeNode[]{this.concreteObjectTypeNode};
        }
        return this.cache;
    }

    public boolean isAssignableFrom(Object object) {
        return this.factTemplate.equals( object );
    }

    public void resetCache() {
        this.cache = null;
    }

    public boolean isActive() {
        return true;
    }

    public boolean isEvent() {
        return false;
    }

    public boolean isTrait() {
        return false;
    }

    public TypeDeclaration getTypeDeclaration() {
        return null;
    }

    public boolean isDynamic() {
        return false;
    }

    public boolean isTMSEnabled() {
        return this.tmsEnabled;
    }

    public boolean isTraitTMSEnabled() {
        return false;
    }

    public void enableTMS() {
        this.tmsEnabled = true;
    }

    public EntryPointId getEntryPoint() {
        return this.entryPoint;
    }

    public boolean isSupportsPropertyChangeListeners() {
        return false;
    }

    @Override
    public String getTypeName() {
    	return factTemplate.getName();
    }

}


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

import { ConvertToSpacesPipe } from './convert-to-spaces.pipe';
import { StarComponent } from './star.component';

@NgModule({
  imports: [
    CommonModule
  ],
  declarations: [
    StarComponent,
    ConvertToSpacesPipe
  ],
  exports: [
    StarComponent,
    CommonModule,
    FormsModule,
    ConvertToSpacesPipe
  ]
})
export class SharedModule { }


text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>


text:
package us.illyohs.civilmagiks.common.item.armor;

import us.illyohs.civilmagiks.api.CivilMagicksAPI;
import us.illyohs.civilmagiks.common.core.lib.LibInfo;

import net.minecraft.item.ItemArmor;

public class ArmorMonocle extends ItemArmor {

	public ArmorMonocle() {
		super(CivilMagicksAPI.armorCivil, 0, 0);
		setUnlocalizedName(LibInfo.MOD_ID + ":monocle");
	}

}