text:
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.Linq;
using System.Text;

namespace EduHub.Data.Entities
{
    /// <summary>
    /// On line receipt history Data Set
    /// </summary>
    [GeneratedCode("EduHub Data", "0.9")]
    public sealed partial class SIRHDataSet : EduHubDataSet<SIRH>
    {
        /// <inheritdoc />
        public override string Name { get { return "SIRH"; } }

        /// <inheritdoc />
        public override bool SupportsEntityLastModified { get { return true; } }

        internal SIRHDataSet(EduHubContext Context)
            : base(Context)
        {
            Index_PRINT_ID = new Lazy<Dictionary<int, SIRH>>(() => this.ToDictionary(i => i.PRINT_ID));
            Index_SIRHKEY = new Lazy<Dictionary<string, SIRH>>(() => this.ToDictionary(i => i.SIRHKEY));
        }

        /// <summary>
        /// Matches CSV file headers to actions, used to deserialize <see cref="SIRH" />
        /// </summary>
        /// <param name="Headers">The CSV column headers</param>
        /// <returns>An array of actions which deserialize <see cref="SIRH" /> fields for each CSV column header</returns>
        internal override Action<SIRH, string>[] BuildMapper(IReadOnlyList<string> Headers)
        {
            var mapper = new Action<SIRH, string>[Headers.Count];

            for (var i = 0; i < Headers.Count; i++) {
                switch (Headers[i]) {
                    case "SIRHKEY":
                        mapper[i] = (e, v) => e.SIRHKEY = v;
                        break;
                    case "CODE":
                        mapper[i] = (e, v) => e.CODE = v;
                        break;
                    case "TRXLEDGER":
                        mapper[i] = (e, v) => e.TRXLEDGER = v;
                        break;
                    case "TRREF":
                        mapper[i] = (e, v) => e.TRREF = v;
                        break;
                    case "TRBATCH":
                        mapper[i] = (e, v) => e.TRBATCH = v == null ? (int?)null : int.Parse(v);
                        break;
                    case "TRDET":
                        mapper[i] = (e, v) => e.TRDET = v;
                        break;
                    case "TRDATE":
                        mapper[i] = (e, v) => e.TRDATE = v == null ? (DateTime?)null : DateTime.ParseExact(v, "d/MM/yyyy h:mm:ss tt", CultureInfo.InvariantCulture);
                        break;
                    case "TRAMT":
                        mapper[i] = (e, v) => e.TRAMT = v == null ? (decimal?)null : decimal.Parse(v);
                        break;
                    case "RTYPE":
                        mapper[i] = (e, v) => e.RTYPE = v;
                        break;
                    case "RECEIPT_USER":
                        mapper[i] = (e, v) => e.RECEIPT_USER = v;
                        break;
                    case "RECEIPT_DATE":
                        mapper[i] = (e, v) => e.RECEIPT_DATE = v == null ? (DateTime?)null : DateTime.ParseExact(v, "d/MM/yyyy h:mm:ss tt", CultureInfo.InvariantCulture);
                        break;
                    case "RECEIPT_TIME":
                        mapper[i] = (e, v) => e.RECEIPT_TIME = v == null ? (short?)null : short.Parse(v);
                        break;
                    case "NEW_TRREF":
                        mapper[i] = (e, v) => e.NEW_TRREF = v;
                        break;
                    case "ERROR_FLAG":
                        mapper[i] = (e, v) => e.ERROR_FLAG = v;
                        break;
                    case "ERROR_COMMENT":
                        mapper[i] = (e, v) => e.ERROR_COMMENT = v;
                        break;
                    case "ERROR_USER":
                        mapper[i] = (e, v) => e.ERROR_USER = v;
                        break;
                    case "FORMAT_ID":
                        mapper[i] = (e, v) => e.FORMAT_ID = v;
                        break;
                    case "PRINT_ID":
                        mapper[i] = (e, v) => e.PRINT_ID = int.Parse(v);
                        break;
                    case "LW_DATE":
                        mapper[i] = (e, v) => e.LW_DATE = v == null ? (DateTime?)null : DateTime.ParseExact(v, "d/MM/yyyy h:mm:ss tt", CultureInfo.InvariantCulture);
                        break;
                    case "LW_TIME":
                        mapper[i] = (e, v) => e.LW_TIME = v == null ? (short?)null : short.Parse(v);
                        break;
                    case "LW_USER":
                        mapper[i] = (e, v) => e.LW_USER = v;
                        break;
                    default:
                        mapper[i] = MapperNoOp;
                        break;
                }
            }

            return mapper;
        }

        /// <summary>
        /// Merges <see cref="SIRH" /> delta entities
        /// </summary>
        /// <param name="Entities">Iterator for base <see cref="SIRH" /> entities</param>
        /// <param name="DeltaEntities">List of delta <see cref="SIRH" /> entities</param>
        /// <returns>A merged <see cref="IEnumerable{SIRH}"/> of entities</returns>
        internal override IEnumerable<SIRH> ApplyDeltaEntities(IEnumerable<SIRH> Entities, List<SIRH> DeltaEntities)
        {
            HashSet<int> Index_PRINT_ID = new HashSet<int>(DeltaEntities.Select(i => i.PRINT_ID));
            HashSet<string> Index_SIRHKEY = new HashSet<string>(DeltaEntities.Select(i => i.SIRHKEY));

            using (var deltaIterator = DeltaEntities.GetEnumerator())
            {
                using (var entityIterator = Entities.GetEnumerator())
                {
                    while (deltaIterator.MoveNext())
                    {
                        var deltaClusteredKey = deltaIterator.Current.SIRHKEY;
                        bool yieldEntity = false;

                        while (entityIterator.MoveNext())
                        {
                            var entity = entityIterator.Current;

                            bool overwritten = false;
                            overwritten = overwritten || Index_PRINT_ID.Remove(entity.PRINT_ID);
                            overwritten = overwritten || Index_SIRHKEY.Remove(entity.SIRHKEY);

                            if (entity.SIRHKEY.CompareTo(deltaClusteredKey) <= 0)
                            {
                                if (!overwritten)
                                {
                                    yield return entity;
                                }
                            }
                            else
                            {
                                yieldEntity = !overwritten;
                                break;
                            }
                        }

                        yield return deltaIterator.Current;
                        if (yieldEntity)
                        {
                            yield return entityIterator.Current;
                        }
                    }

                    while (entityIterator.MoveNext())
                    {
                        yield return entityIterator.Current;
                    }
                }
            }
        }

        #region Index Fields

        private Lazy<Dictionary<int, SIRH>> Index_PRINT_ID;
        private Lazy<Dictionary<string, SIRH>> Index_SIRHKEY;

        #endregion

        #region Index Methods

        /// <summary>
        /// Find SIRH by PRINT_ID field
        /// </summary>
        /// <param name="PRINT_ID">PRINT_ID value used to find SIRH</param>
        /// <returns>Related SIRH entity</returns>
        /// <exception cref="ArgumentOutOfRangeException">No match was found</exception>
        public SIRH FindByPRINT_ID(int PRINT_ID)
        {
            return Index_PRINT_ID.Value[PRINT_ID];
        }

        /// <summary>
        /// Attempt to find SIRH by PRINT_ID field
        /// </summary>
        /// <param name="PRINT_ID">PRINT_ID value used to find SIRH</param>
        /// <param name="Value">Related SIRH entity</param>
        /// <returns>True if the related SIRH entity is found</returns>
        /// <exception cref="ArgumentOutOfRangeException">No match was found</exception>
        public bool TryFindByPRINT_ID(int PRINT_ID, out SIRH Value)
        {
            return Index_PRINT_ID.Value.TryGetValue(PRINT_ID, out Value);
        }

        /// <summary>
        /// Attempt to find SIRH by PRINT_ID field
        /// </summary>
        /// <param name="PRINT_ID">PRINT_ID value used to find SIRH</param>
        /// <returns>Related SIRH entity, or null if not found</returns>
        /// <exception cref="ArgumentOutOfRangeException">No match was found</exception>
        public SIRH TryFindByPRINT_ID(int PRINT_ID)
        {
            SIRH value;
            if (Index_PRINT_ID.Value.TryGetValue(PRINT_ID, out value))
            {
                return value;
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// Find SIRH by SIRHKEY field
        /// </summary>
        /// <param name="SIRHKEY">SIRHKEY value used to find SIRH</param>
        /// <returns>Related SIRH entity</returns>
        /// <exception cref="ArgumentOutOfRangeException">No match was found</exception>
        public SIRH FindBySIRHKEY(string SIRHKEY)
        {
            return Index_SIRHKEY.Value[SIRHKEY];
        }

        /// <summary>
        /// Attempt to find SIRH by SIRHKEY field
        /// </summary>
        /// <param name="SIRHKEY">SIRHKEY value used to find SIRH</param>
        /// <param name="Value">Related SIRH entity</param>
        /// <returns>True if the related SIRH entity is found</returns>
        /// <exception cref="ArgumentOutOfRangeException">No match was found</exception>
        public bool TryFindBySIRHKEY(string SIRHKEY, out SIRH Value)
        {
            return Index_SIRHKEY.Value.TryGetValue(SIRHKEY, out Value);
        }

        /// <summary>
        /// Attempt to find SIRH by SIRHKEY field
        /// </summary>
        /// <param name="SIRHKEY">SIRHKEY value used to find SIRH</param>
        /// <returns>Related SIRH entity, or null if not found</returns>
        /// <exception cref="ArgumentOutOfRangeException">No match was found</exception>
        public SIRH TryFindBySIRHKEY(string SIRHKEY)
        {
            SIRH value;
            if (Index_SIRHKEY.Value.TryGetValue(SIRHKEY, out value))
            {
                return value;
            }
            else
            {
                return null;
            }
        }

        #endregion

        #region SQL Integration

        /// <summary>
        /// Returns a <see cref="SqlCommand"/> which checks for the existence of a SIRH table, and if not found, creates the table and associated indexes.
        /// </summary>
        /// <param name="SqlConnection">The <see cref="SqlConnection"/> to be associated with the <see cref="SqlCommand"/></param>
        public override SqlCommand GetSqlCreateTableCommand(SqlConnection SqlConnection)
        {
            return new SqlCommand(
                connection: SqlConnection,
                cmdText:
@"IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SIRH]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
    CREATE TABLE [dbo].[SIRH](
        [SIRHKEY] varchar(20) NOT NULL,
        [CODE] varchar(10) NULL,
        [TRXLEDGER] varchar(2) NULL,
        [TRREF] varchar(10) NULL,
        [TRBATCH] int NULL,
        [TRDET] varchar(30) NULL,
        [TRDATE] datetime NULL,
        [TRAMT] money NULL,
        [RTYPE] varchar(2) NULL,
        [RECEIPT_USER] varchar(128) NULL,
        [RECEIPT_DATE] datetime NULL,
        [RECEIPT_TIME] smallint NULL,
        [NEW_TRREF] varchar(10) NULL,
        [ERROR_FLAG] varchar(1) NULL,
        [ERROR_COMMENT] varchar(MAX) NULL,
        [ERROR_USER] varchar(128) NULL,
        [FORMAT_ID] varchar(7) NULL,
        [PRINT_ID] int IDENTITY NOT NULL,
        [LW_DATE] datetime NULL,
        [LW_TIME] smallint NULL,
        [LW_USER] varchar(128) NULL,
        CONSTRAINT [SIRH_Index_SIRHKEY] PRIMARY KEY CLUSTERED (
            [SIRHKEY] ASC
        )
    );
    CREATE NONCLUSTERED INDEX [SIRH_Index_PRINT_ID] ON [dbo].[SIRH]
    (
            [PRINT_ID] ASC
    );
END");
        }

        /// <summary>
        /// Returns a <see cref="SqlCommand"/> which disables all non-clustered table indexes.
        /// Typically called before <see cref="SqlBulkCopy"/> to improve performance.
        /// <see cref="GetSqlRebuildIndexesCommand(SqlConnection)"/> should be called to rebuild and enable indexes after performance sensitive work is completed.
        /// </summary>
        /// <param name="SqlConnection">The <see cref="SqlConnection"/> to be associated with the <see cref="SqlCommand"/></param>
        /// <returns>A <see cref="SqlCommand"/> which (when executed) will disable all non-clustered table indexes</returns>
        public override SqlCommand GetSqlDisableIndexesCommand(SqlConnection SqlConnection)
        {
            return new SqlCommand(
                connection: SqlConnection,
                cmdText:
@"IF EXISTS (SELECT * FROM dbo.sysindexes WHERE id = OBJECT_ID(N'[dbo].[SIRH]') AND name = N'SIRH_Index_PRINT_ID')
    ALTER INDEX [SIRH_Index_PRINT_ID] ON [dbo].[SIRH] DISABLE;
");
        }

        /// <summary>
        /// Returns a <see cref="SqlCommand"/> which rebuilds and enables all non-clustered table indexes.
        /// </summary>
        /// <param name="SqlConnection">The <see cref="SqlConnection"/> to be associated with the <see cref="SqlCommand"/></param>
        /// <returns>A <see cref="SqlCommand"/> which (when executed) will rebuild and enable all non-clustered table indexes</returns>
        public override SqlCommand GetSqlRebuildIndexesCommand(SqlConnection SqlConnection)
        {
            return new SqlCommand(
                connection: SqlConnection,
                cmdText:
@"IF EXISTS (SELECT * FROM dbo.sysindexes WHERE id = OBJECT_ID(N'[dbo].[SIRH]') AND name = N'SIRH_Index_PRINT_ID')
    ALTER INDEX [SIRH_Index_PRINT_ID] ON [dbo].[SIRH] REBUILD PARTITION = ALL;
");
        }

        /// <summary>
        /// Returns a <see cref="SqlCommand"/> which deletes the <see cref="SIRH"/> entities passed
        /// </summary>
        /// <param name="SqlConnection">The <see cref="SqlConnection"/> to be associated with the <see cref="SqlCommand"/></param>
        /// <param name="Entities">The <see cref="SIRH"/> entities to be deleted</param>
        public override SqlCommand GetSqlDeleteCommand(SqlConnection SqlConnection, IEnumerable<SIRH> Entities)
        {
            SqlCommand command = new SqlCommand();
            int parameterIndex = 0;
            StringBuilder builder = new StringBuilder();

            List<int> Index_PRINT_ID = new List<int>();
            List<string> Index_SIRHKEY = new List<string>();

            foreach (var entity in Entities)
            {
                Index_PRINT_ID.Add(entity.PRINT_ID);
                Index_SIRHKEY.Add(entity.SIRHKEY);
            }

            builder.AppendLine("DELETE [dbo].[SIRH] WHERE");

            // Index_PRINT_ID
            builder.Append("[PRINT_ID] IN (");
            for (int index = 0; index < Index_PRINT_ID.Count; index++)
            {
                if (index != 0)
                    builder.Append(", ");

                // PRINT_ID
                var parameterPRINT_ID = $"@p{parameterIndex++}";
                builder.Append(parameterPRINT_ID);
                command.Parameters.Add(parameterPRINT_ID, SqlDbType.Int).Value = Index_PRINT_ID[index];
            }
            builder.AppendLine(") OR");

            // Index_SIRHKEY
            builder.Append("[SIRHKEY] IN (");
            for (int index = 0; index < Index_SIRHKEY.Count; index++)
            {
                if (index != 0)
                    builder.Append(", ");

                // SIRHKEY
                var parameterSIRHKEY = $"@p{parameterIndex++}";
                builder.Append(parameterSIRHKEY);
                command.Parameters.Add(parameterSIRHKEY, SqlDbType.VarChar, 20).Value = Index_SIRHKEY[index];
            }
            builder.Append(");");

            command.Connection = SqlConnection;
            command.CommandText = builder.ToString();

            return command;
        }

        /// <summary>
        /// Provides a <see cref="IDataReader"/> for the SIRH data set
        /// </summary>
        /// <returns>A <see cref="IDataReader"/> for the SIRH data set</returns>
        public override EduHubDataSetDataReader<SIRH> GetDataSetDataReader()
        {
            return new SIRHDataReader(Load());
        }

        /// <summary>
        /// Provides a <see cref="IDataReader"/> for the SIRH data set
        /// </summary>
        /// <returns>A <see cref="IDataReader"/> for the SIRH data set</returns>
        public override EduHubDataSetDataReader<SIRH> GetDataSetDataReader(List<SIRH> Entities)
        {
            return new SIRHDataReader(new EduHubDataSetLoadedReader<SIRH>(this, Entities));
        }

        // Modest implementation to primarily support SqlBulkCopy
        private class SIRHDataReader : EduHubDataSetDataReader<SIRH>
        {
            public SIRHDataReader(IEduHubDataSetReader<SIRH> Reader)
                : base (Reader)
            {
            }

            public override int FieldCount { get { return 21; } }

            public override object GetValue(int i)
            {
                switch (i)
                {
                    case 0: // SIRHKEY
                        return Current.SIRHKEY;
                    case 1: // CODE
                        return Current.CODE;
                    case 2: // TRXLEDGER
                        return Current.TRXLEDGER;
                    case 3: // TRREF
                        return Current.TRREF;
                    case 4: // TRBATCH
                        return Current.TRBATCH;
                    case 5: // TRDET
                        return Current.TRDET;
                    case 6: // TRDATE
                        return Current.TRDATE;
                    case 7: // TRAMT
                        return Current.TRAMT;
                    case 8: // RTYPE
                        return Current.RTYPE;
                    case 9: // RECEIPT_USER
                        return Current.RECEIPT_USER;
                    case 10: // RECEIPT_DATE
                        return Current.RECEIPT_DATE;
                    case 11: // RECEIPT_TIME
                        return Current.RECEIPT_TIME;
                    case 12: // NEW_TRREF
                        return Current.NEW_TRREF;
                    case 13: // ERROR_FLAG
                        return Current.ERROR_FLAG;
                    case 14: // ERROR_COMMENT
                        return Current.ERROR_COMMENT;
                    case 15: // ERROR_USER
                        return Current.ERROR_USER;
                    case 16: // FORMAT_ID
                        return Current.FORMAT_ID;
                    case 17: // PRINT_ID
                        return Current.PRINT_ID;
                    case 18: // LW_DATE
                        return Current.LW_DATE;
                    case 19: // LW_TIME
                        return Current.LW_TIME;
                    case 20: // LW_USER
                        return Current.LW_USER;
                    default:
                        throw new ArgumentOutOfRangeException(nameof(i));
                }
            }

            public override bool IsDBNull(int i)
            {
                switch (i)
                {
                    case 1: // CODE
                        return Current.CODE == null;
                    case 2: // TRXLEDGER
                        return Current.TRXLEDGER == null;
                    case 3: // TRREF
                        return Current.TRREF == null;
                    case 4: // TRBATCH
                        return Current.TRBATCH == null;
                    case 5: // TRDET
                        return Current.TRDET == null;
                    case 6: // TRDATE
                        return Current.TRDATE == null;
                    case 7: // TRAMT
                        return Current.TRAMT == null;
                    case 8: // RTYPE
                        return Current.RTYPE == null;
                    case 9: // RECEIPT_USER
                        return Current.RECEIPT_USER == null;
                    case 10: // RECEIPT_DATE
                        return Current.RECEIPT_DATE == null;
                    case 11: // RECEIPT_TIME
                        return Current.RECEIPT_TIME == null;
                    case 12: // NEW_TRREF
                        return Current.NEW_TRREF == null;
                    case 13: // ERROR_FLAG
                        return Current.ERROR_FLAG == null;
                    case 14: // ERROR_COMMENT
                        return Current.ERROR_COMMENT == null;
                    case 15: // ERROR_USER
                        return Current.ERROR_USER == null;
                    case 16: // FORMAT_ID
                        return Current.FORMAT_ID == null;
                    case 18: // LW_DATE
                        return Current.LW_DATE == null;
                    case 19: // LW_TIME
                        return Current.LW_TIME == null;
                    case 20: // LW_USER
                        return Current.LW_USER == null;
                    default:
                        return false;
                }
            }

            public override string GetName(int ordinal)
            {
                switch (ordinal)
                {
                    case 0: // SIRHKEY
                        return "SIRHKEY";
                    case 1: // CODE
                        return "CODE";
                    case 2: // TRXLEDGER
                        return "TRXLEDGER";
                    case 3: // TRREF
                        return "TRREF";
                    case 4: // TRBATCH
                        return "TRBATCH";
                    case 5: // TRDET
                        return "TRDET";
                    case 6: // TRDATE
                        return "TRDATE";
                    case 7: // TRAMT
                        return "TRAMT";
                    case 8: // RTYPE
                        return "RTYPE";
                    case 9: // RECEIPT_USER
                        return "RECEIPT_USER";
                    case 10: // RECEIPT_DATE
                        return "RECEIPT_DATE";
                    case 11: // RECEIPT_TIME
                        return "RECEIPT_TIME";
                    case 12: // NEW_TRREF
                        return "NEW_TRREF";
                    case 13: // ERROR_FLAG
                        return "ERROR_FLAG";
                    case 14: // ERROR_COMMENT
                        return "ERROR_COMMENT";
                    case 15: // ERROR_USER
                        return "ERROR_USER";
                    case 16: // FORMAT_ID
                        return "FORMAT_ID";
                    case 17: // PRINT_ID
                        return "PRINT_ID";
                    case 18: // LW_DATE
                        return "LW_DATE";
                    case 19: // LW_TIME
                        return "LW_TIME";
                    case 20: // LW_USER
                        return "LW_USER";
                    default:
                        throw new ArgumentOutOfRangeException(nameof(ordinal));
                }
            }

            public override int GetOrdinal(string name)
            {
                switch (name)
                {
                    case "SIRHKEY":
                        return 0;
                    case "CODE":
                        return 1;
                    case "TRXLEDGER":
                        return 2;
                    case "TRREF":
                        return 3;
                    case "TRBATCH":
                        return 4;
                    case "TRDET":
                        return 5;
                    case "TRDATE":
                        return 6;
                    case "TRAMT":
                        return 7;
                    case "RTYPE":
                        return 8;
                    case "RECEIPT_USER":
                        return 9;
                    case "RECEIPT_DATE":
                        return 10;
                    case "RECEIPT_TIME":
                        return 11;
                    case "NEW_TRREF":
                        return 12;
                    case "ERROR_FLAG":
                        return 13;
                    case "ERROR_COMMENT":
                        return 14;
                    case "ERROR_USER":
                        return 15;
                    case "FORMAT_ID":
                        return 16;
                    case "PRINT_ID":
                        return 17;
                    case "LW_DATE":
                        return 18;
                    case "LW_TIME":
                        return 19;
                    case "LW_USER":
                        return 20;
                    default:
                        throw new ArgumentOutOfRangeException(nameof(name));
                }
            }
        }

        #endregion

    }
}


text:
package de.lukweb.twitchchat.twitch.commands;

import de.lukweb.twitchchat.events.user.UserDonateBitsEvent;
import de.lukweb.twitchchat.events.user.UserSendMessageEvent;
import de.lukweb.twitchchat.twitch.Command;
import de.lukweb.twitchchat.twitch.TurboChannel;
import de.lukweb.twitchchat.twitch.TurboChat;
import de.lukweb.twitchchat.twitch.TurboUser;
import de.lukweb.twitchchat.twitch.messages.MessageAttributes;
import de.lukweb.twitchchat.twitch.utils.IntegerUtils;

import java.util.Map;

public class PrivmsgC extends Command {

    public PrivmsgC() {
        super("PRIVMSG");
    }

    @Override
    public void handle(String sender, Map<String, String> tags, String[] arguments, TurboChat chat) {
        if (arguments.length < 2) return;

        MessageAttributes attributes = new MessageAttributes(tags);

        TurboChannel channel = chat.getChannel(arguments[0].substring(1));
        TurboUser user = channel.createTurboChatter(getUsernameBySender(sender));
        String message = arguments[1].substring(1);
        for (int i = 2; i < arguments.length; i++) message += " " + arguments[i];

        user.update(attributes);

        if (tags.containsKey("room-id") && IntegerUtils.isInt(tags.get("room-id"))) {
            channel.setRoomId(Integer.parseInt(tags.get("room-id")));
        }

        boolean emoteMessage = message.charAt(0) == 1;
        if (emoteMessage) message = message.substring(1, message.length() - 1);

        UserSendMessageEvent event;
        if (tags.containsKey("bits")) {
            event = new UserDonateBitsEvent(user, message, attributes, Integer.parseInt(tags.get("bits")));
        } else {
            event = new UserSendMessageEvent(user, message, attributes, emoteMessage);
        }

        chat.getEventManager().callEvent(event);
    }
}

redpajama_set_name: RedPajamaGithub


text:
from skip_list.tests.test_skip_list import SkipListTestMixin
import unittest

if __name__ == "__main__":
    unittest.main()


text:
<?php
    $fetchFiletypes = mysqli_fetch_array( mysqli_query( $con, "SELECT meta_value FROM " . TSA_DB_PREFIX . "settings WHERE meta_key='downloads_whitelist' LIMIT 1;" ) );
    $filetypes = json_decode( $fetchFiletypes['meta_value'], true );
    $fetchDownloadDir = mysqli_query( $con, "SELECT meta_value FROM " . TSA_DB_PREFIX . "settings WHERe meta_key='downloads_location' LIMIT 1;" );
    if( mysqli_num_rows( $fetchDownloadDir ) == 0 ) {
        $insertDlDir = mysqli_query( $con, "INSERT INTO " . TSA_DB_PREFIX . "settings( meta_key, meta_value ) VALUES( 'downloads_location', '' );" );
        if( !$insertDlDir ) {
            ?>

<?php echo mysqli_error( $con ); ?>

            <?php
        }
        $downloadsDir = '';
    } else {
        $fetchDlDirArray = mysqli_fetch_array( $fetchDownloadDir );
        $downloadsDir = $fetchDlDirArray['meta_value'];
    }

    if( !empty( $_POST['add_filetype'] ) ) {
        $add_filetype = $_POST['add_filetype'];
        $mimeType = ( !empty( $_POST['add_mimetype'] ) ? $_POST['add_mimetype'] : 'application/octet-stream' );
        if( isset( $filetypes[ $add_filetype ] ) ) {
            ?>

This filetype already exists with the MIME-type: <?php echo $filetypes[ $add_filetype ]; ?>

            <?php
        } else {
            $filetypes[ $add_filetype ] = $mimeType;
            $filetypes = json_encode( $filetypes );
            $updateFiletypes = mysqli_query( $con, "UPDATE " . TSA_DB_PREFIX . "settings SET meta_value='" . $filetypes . "' WHERE meta_key='downloads_whitelist';" );
            if( $updateFiletypes ) {
                ?>

<?php echo $add_filetype; ?> has successfully been added as a filetype.

                <?php
            } else {
                ?>

MySQL Error! <?php echo mysqli_error( $con ); ?>

                <?php
            }
        }
    } elseif( !empty( $_POST['del_filetype'] ) ) {
        $del_filetype = $_POST['del_filetype'];
        if( isset( $filetypes[ $del_filetype ] ) ) {
            unset( $filetypes[ $del_filetype ] );
            $filetypes = json_encode( $filetypes );
            $updateFiletypes = mysqli_query( $con, "UPDATE " . TSA_DB_PREFIX . "settings SET meta_value='" . $filetypes . "' WHERE meta_key='downloads_whitelist';" );
            if( $updateFiletypes ) {
                ?>

<?php echo $del_filetype; ?> has successfully been removed as a filetype.

                <?php
            } else {
                ?>

MySQL Error! <?php echo mysqli_error( $con ); ?>

                <?php
            }
        } else {
            ?>

This filetype does not exist.

            <?php
        }
    }

    $dlDirSuccess = false;
    if( !empty( $_POST['downloads_dir'] ) ) {
        $downloads_dir = mysqli_real_escape_string( $con, $_POST['downloads_dir'] );
        $updateDlDir = mysqli_query( $con, "UPDATE " . TSA_DB_PREFIX . "settings SET meta_value='" . $downloads_dir . "' WHERE meta_key='downloads_location';" );
        if( file_exists( $downloads_dir ) ) {
            if( is_dir( $downloads_dir ) ) {
                if( !is_writeable( $downloads_dir ) ) {
                    echo '
' . $downloads_dir . ' is not writable.
';
                } else {
                    $dlDirSuccess = true;
                }
            } else {
                echo '
' . $downloads_dir . ' is not a folder.
';
            }
        } else {
            if( !mkdir( $downloads_dir, 0777, true ) ) {
                echo '
Unable to create folder for downloadable files at: ' . $downloads_dir . '
';
            } else {
                $dlDirSuccess = true;
            }
        }

        if( $dlDirSuccess && $updateDlDir ) {
            ?>

Downloads location successfully updated.

            <?php
            $downloadsDir = $downloads_dir;
        } else {
            if( mysqli_error( $con ) ) {
                ?>

<?php echo mysqli_error( $con ); ?>

                <?php
            }
        }
    }
    $fetchFiletypes = mysqli_fetch_array( mysqli_query( $con, "SELECT meta_value FROM " . TSA_DB_PREFIX . "settings WHERE meta_key='downloads_whitelist' LIMIT 1;" ) );
    $filetypes = json_decode( $fetchFiletypes['meta_value'], true );
?>

Add whitelisted filetype

        <form method="post" action="admin.php?page=downloads">

                File extension:
                <input type="text" name="add_filetype" id="add_filetype" class="form-control" required="" />
                Do not include the period in front of the file extension.

                MIME type:
                <input type="text" name="add_mimetype" id="add_mimetype" class="form-control" placeholder="Optional" />
                This is an optional parameter that allows you to specify a specific MIME type for certain filetypes.

            <button type="submit" class="btn btn-success">Add filetype</button>
        </form>

Remove whitelisted filetype

        <form method="post" action="admin.php?page=downloads">

                File extension:
                <select name="del_filetype" class="form-control" id="del_filetype" required="">
                    <option selected="">Select a filetype</option>
                    <?php
                        foreach( $filetypes as $ext => $mime ) {
                            ?>
                            <option value="<?php echo $ext; ?>"><?php echo $ext; ?> - <?php echo $mime; ?></option>
                            <?php
                        }
                    ?>
                </select>

            <button type="submit" class="btn btn-danger" onclick='return confirm( "Are you sure you want to remove this filetyper?" );' )>Remove filetype</button>
        </form>

Set new downloads directory

        <form method="post" action="admin.php?page=downloads">

                Downloads directory
                <input type="text" value="<?php echo $downloadsDir; ?>" class="form-control" required="" name="downloads_dir" id="downloads_dir" />
                This will not move old download files to the new location, so please do this manually.

            <button type="submit" class="btn btn-warning">Set new downloads directory</button>
        </form>


text:
package javax.naming;

/**
 * The object, implementing this interface, can provided the
 * {@link Reference} about itself.
 */
public interface Referenceable
{
  /**
   * Get the reference about this object.
   *
   * @return the reference about this object, cannot be null.
   *
   * @throws NamingException if the naming exception has been raised while
   *           retrieving the reference.
   */
  Reference getReference() throws NamingException;
}


text:
<?php
namespace backend\controllers;

use Yii;
use yii\base\InvalidParamException;
use yii\web\BadRequestHttpException;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use common\models\LoginForm;
use frontend\models\PasswordResetRequestForm;
use frontend\models\ResetPasswordForm;
use yii\data\SqlDataProvider;
use kartik\mpdf\Pdf;
Use app\itbz\fpdf\src\fpdf\fpdf;

/**
 * Site controller
 */
class SiteController extends Controller
{
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            'access' => [
                'class' => AccessControl::className(),
                'rules' => [
                    [
                        'actions' => ['login', 'error'],
                        'allow' => true,
                    ],
                    [
                        'actions' => ['logout', 'tahun', 'index', 'mpdf', 'fpdf', 'musrenkeclamp2'],
                        'allow' => true,
                        'roles' => ['@'],
                    ],
                ],
            ],
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'logout' => ['post'],
                ],
            ],
        ];
    }

    /**
     * @inheritdoc
     */
    public function actions()
    {
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction',
            ],
        ];
    }

    public function actionIndex()
    {
        return $this->render('index');
    }

    public function actionMpdf() {
        $connection = \Yii::$app->db;
        $count      =   Yii::$app->db->createCommand('SELECT COUNT(id) FROM t_renja_kegiatan WHERE kd_bahas = 1')->queryScalar();
        $sql = "SELECT c.Nm_Sub_Unit, a.uraian AS kegiatan, a.pagu_kegiatan, a.pagu_musrenbang, b.biaya AS Usulan FROM t_renja_kegiatan a LEFT JOIN
            (SELECT renja_kegiatan_id, SUM(biaya) AS biaya FROM t_subkegiatan GROUP BY renja_kegiatan_id) b ON a.id = b.renja_kegiatan_id
            INNER JOIN r_sub_unit c ON a.kd_urusan = c.Kd_Urusan AND a.kd_bidang = c.Kd_Bidang AND a.kd_unit = c.Kd_Unit AND a.kd_sub = c.Kd_Sub
            WHERE a.kd_bahas = 1";
        $query = $connection->createCommand($sql);
        $data = $query->queryAll();
        $dataProvider = new SqlDataProvider([
                'sql' => $sql,
                'totalCount' => $count,
            ]);

        // get your HTML raw content without any layouts or scripts
        $content = $this->renderPartial('laporan', ['data' => $data, 'dataProvider' => $dataProvider]);

        // setup kartik\mpdf\Pdf component
        $pdf = new Pdf([
            // set to use core fonts only
            'mode' => Pdf::MODE_CORE,
            // A4 paper format
            'format' => Pdf::FORMAT_A4,
            // portrait orientation
            'orientation' => Pdf::ORIENT_PORTRAIT,
            // stream to browser inline
            'destination' => Pdf::DEST_BROWSER,
            // your html content input
            'content' => $content,
            // format content from your own css file if needed or use the
            // enhanced bootstrap css built by Krajee for mPDF formatting
            'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css',
            // any css to be embedded if required
            'cssInline' => '.kv-heading-1{font-size:18px}',
             // set mPDF properties on the fly
            'options' => ['title' => 'judulfile'],
             // call mPDF methods on the fly
            'methods' => [
                'SetHeader'=>['Ine Header'],
                'SetFooter'=>['{PAGENO}'],
            ]
        ]);

        // return the pdf output as per the destination setting
        return $pdf->render();
    }

    public function actionFpdf()
    {
        $connection = \Yii::$app->db;
        $sql = "SELECT c.Nm_Sub_Unit, a.uraian AS kegiatan, a.pagu_kegiatan, a.pagu_musrenbang, b.biaya AS Usulan FROM t_renja_kegiatan a LEFT JOIN
            (SELECT renja_kegiatan_id, SUM(biaya) AS biaya FROM t_subkegiatan GROUP BY renja_kegiatan_id) b ON a.id = b.renja_kegiatan_id
            INNER JOIN r_sub_unit c ON a.kd_urusan = c.Kd_Urusan AND a.kd_bidang = c.Kd_Bidang AND a.kd_unit = c.Kd_Unit AND a.kd_sub = c.Kd_Sub
            WHERE a.kd_bahas = 1 LIMIT 0,10";
        $query = $connection->createCommand($sql);
        $data = $query->queryAll();
        return $this->render('fpdf', ['data'=> $data,]);
    }

    public function actionMusrenkeclamp2()
    {
        $id = 2;
        $ba_id = $id; //disiapkan untuk mengambil data berita acara. Data pertama u/ header laporan
        $connection = \Yii::$app->db;
        $sql = "CALL rpt_musrenKecLampII(4,1)";
        $query = $connection->createCommand($sql);
        $data = $query->queryAll();
        return $this->render('rpt_musrenkeclamp2', ['data'=> $data,]);
    }

    public function actionLogin()
    {
        if (!Yii::$app->user->isGuest) {
            return $this->goHome();
        }

        $model = new LoginForm();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
            return $this->goBack();
        } else {
            return $this->render('login', [
                'model' => $model,
            ]);
        }
    }

    /**
     * Signs user up.
     *
     * @return mixed
     */
    public function actionCreate()
    {
        $model = new SignupForm();
        $modelPeran = new Tperan();
        if ($model->load(Yii::$app->request->post())) {
            if ($user = $model->signup()) {
                if (Yii::$app->getUser()->login($user)) {
                    return $this->goHome();
                }
            }
        }

        return $this->render('signup', [
            'model' => $model,
        ]);
    }

    public function actionLogout()
    {
        Yii::$app->user->logout();

        return $this->goHome();
    }

//Choose what year this application will use as default year --@hoaaah

    public function actionTahun($id)
    {
        $session = Yii::$app->session;
        IF($session['tahun']){
            $session->remove('tahun');
        }
        $session->set('tahun', $id);

        return $this->redirect(Yii::$app->request->referrer);
    }
}


text:
      <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse">
        Toggle navigation

      </button>
      CleverStack.io

Home

Dashboard

Login

Register

Logout


text:
"""Calls made by the web client."""

import base64
import copy
import hmac
import random
import string
import sys
from hashlib import sha1

import validictory

from gmusicapi.compat import json
from gmusicapi.exceptions import CallFailure, ValidationException
from gmusicapi.protocol.metadata import md_expectations
from gmusicapi.protocol.shared import Call, authtypes
from gmusicapi.utils import utils

base_url = 'https://play.google.com/music/'
service_url = base_url + 'services/'

#Shared response schemas, built to include metadata expectations.
song_schema = {
    "type": "object",
    "properties": dict(
        (name, expt.get_schema()) for
        name, expt in md_expectations.items()
    ),
    #don't allow metadata not in expectations
    "additionalProperties": False
}

song_array = {
    "type": "array",
    "items": song_schema
}

pl_schema = {
    "type": "object",
    "properties": {
        "continuation": {"type": "boolean"},
        "playlist": song_array,
        "playlistId": {"type": "string"},
        "unavailableTrackCount": {"type": "integer"},
        # unsure what this field does. sometimes it's not there.
        "token": {"type": "string", "required": False},
        #only appears when loading multiple playlists
        "title": {"type": "string", "required": False},
        "continuationToken": {"type": "string", "required": False},
    },
    "additionalProperties": False
}

pl_array = {
    "type": "array",
    "items": pl_schema
}

class Init(Call):
    """Called one time per session, immediately after login.

    This performs one-time setup:
    it gathers the cookies we need (specifically `xt`), and Google uses it
    to create the webclient DOM.

    Note the use of the HEAD verb. Google uses GET, but we don't need
    the large response containing Google's webui.
    """

    static_method = 'HEAD'
    static_url = base_url + 'listen'

    required_auth = authtypes(sso=True)

    #This call doesn't actually request/return anything useful aside from cookies.
    @staticmethod
    def parse_response(response):
        return response.text

    @classmethod
    def check_success(cls, response, msg):
        if response.status_code != 200:
            raise CallFailure(('status code %s != 200' % response.status_code), cls.__name__)
        if 'xt' not in response.cookies:
            raise CallFailure('did not receieve xt cookies', cls.__name__)

class WcCall(Call):
    """Abstract base for web client calls."""

    required_auth = authtypes(xt=True, sso=True)

    #validictory schema for the response
    _res_schema = utils.NotImplementedField

    @classmethod
    def validate(cls, response, msg):
        """Use validictory and a static schema (stored in cls._res_schema)."""
        try:
            return validictory.validate(msg, cls._res_schema)
        except ValueError as e:
            trace = sys.exc_info()[2]
            raise ValidationException(str(e)), None, trace

    @classmethod
    def check_success(cls, response, msg):
        #Failed responses always have a success=False key.
        #Some successful responses do not have a success=True key, however.
        #TODO remove utils.call_succeeded

        if 'success' in msg and not msg['success']:
            raise CallFailure(
                "the server reported failure. This is usually"
                " caused by bad arguments, but can also happen if requests"
                " are made too quickly (eg creating a playlist then"
                " modifying it before the server has created it)",
                cls.__name__)

    @classmethod
    def parse_response(cls, response):
        return cls._parse_json(response.text)

class AddToPlaylist(WcCall):
    """Adds songs to a playlist."""
    static_method = 'POST'
    static_url = service_url + 'addtoplaylist'

    _res_schema = {
        "type": "object",
        "properties": {
            "playlistId": {"type": "string"},
            "songIds": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "songId": {"type": "string"},
                        "playlistEntryId": {"type": "string"}
                    }
                }
            }
        },
        "additionalProperties": False
    }

    @staticmethod
    def dynamic_data(playlist_id, song_ids):
        """
        :param playlist_id: id of the playlist to add to.
        :param song_ids: a list of song ids
        """
        #TODO unsure what type means here. Likely involves uploaded vs store/free.
        song_refs = [{'id': sid, 'type': 1} for sid in song_ids]

        return {
            'json': json.dumps(
                {"playlistId": playlist_id, "songRefs": song_refs}
            )
        }

    @staticmethod
    def filter_response(msg):
        filtered = copy.copy(msg)
        filtered['songIds'] = ["<%s songs>" % len(filtered.get('songIds', []))]
        return filtered

class ChangePlaylistOrder(WcCall):
    """Reorder existing tracks in a playlist."""

    static_method = 'POST'
    static_url = service_url + 'changeplaylistorder'

    _res_schema = {
        "type": "object",
        "properties": {
            "afterEntryId": {"type": "string", "blank": True},
            "playlistId": {"type": "string"},
            "movedSongIds": {
                "type": "array",
                "items": {"type": "string"}
            }
        },
        "additionalProperties": False
    }

    @staticmethod
    def dynamic_data(playlist_id, song_ids_moving, entry_ids_moving,
                     after_entry_id=None, before_entry_id=None):
        """
        :param playlist_id: id of the playlist getting reordered.
        :param song_ids_moving: a list of consecutive song ids. Matches entry_ids_moving.
        :param entry_ids_moving: a list of consecutive entry ids to move. Matches song_ids_moving.
        :param after_entry_id: the entry id to place these songs after. Default first position.
        :param before_entry_id: the entry id to place these songs before. Default last position.
        """

        # empty string means first/last position
        if after_entry_id is None:
            after_entry_id = ""
        if before_entry_id is None:
            before_entry_id = ""

        return {
            'json': json.dumps(
                {
                    "playlistId": playlist_id,
                    "movedSongIds": song_ids_moving,
                    "movedEntryIds": entry_ids_moving,
                    "afterEntryId": after_entry_id,
                    "beforeEntryId": before_entry_id
                }
            )
        }

    @staticmethod
    def filter_response(msg):
        filtered = copy.copy(msg)
        filtered['movedSongIds'] = ["<%s songs>" % len(filtered.get('movedSongIds', []))]
        return filtered

class DeletePlaylist(WcCall):
    """Delete a playlist."""

    static_method = 'POST'
    static_url = service_url + 'deleteplaylist'

    _res_schema = {
        "type": "object",
        "properties": {
            "deleteId": {"type": "string"}
        },
        "additionalProperties": False
    }

    @staticmethod
    def dynamic_data(playlist_id):
        """
        :param playlist_id: id of the playlist to delete.
        """
        return {
            'json': json.dumps(
                {"id": playlist_id}
            )
        }

class DeleteSongs(WcCall):
    """Delete a song from the entire library or a single playlist."""

    static_method = 'POST'
    static_url = service_url + 'deletesong'

    _res_schema = {
        "type": "object",
        "properties": {
            "listId": {"type": "string"},
            "deleteIds":
            {
                "type": "array",
                "items": {"type": "string"}
            }
        },
        "additionalProperties": False
    }

    @staticmethod
    def dynamic_data(song_ids, playlist_id='all', entry_ids=None):
        """
        :param song_ids: a list of song ids.
        :param playlist_id: playlist id to delete from, or 'all' for deleting from library.
        :param entry_ids: when deleting from playlists, corresponding list of entry ids.
        """

        if entry_ids is None:
            #this is strange, but apparently correct
            entry_ids = [''] * len(song_ids)

        return {
            'json': json.dumps(
                {"songIds": song_ids, "entryIds": entry_ids, "listId": playlist_id}
            )
        }

    @staticmethod
    def filter_response(msg):
        filtered = copy.copy(msg)
        filtered['deleteIds'] = ["<%s songs>" % len(filtered.get('deleteIds', []))]
        return filtered

class GetLibrarySongs(WcCall):
    """Loads tracks from the library.

    Libraries can have many tracks, so GM gives them back in chunks.

    Chunks will send a continuation token to get the next chunk.

    The first request needs no continuation token.
    The last response will not send a token.
    """

    static_method = 'POST'
    static_url = service_url + 'loadalltracks'

    _res_schema = {
        "type": "object",
        "properties": {
            "continuation": {"type": "boolean"},
            "differentialUpdate": {"type": "boolean"},
            "playlistId": {"type": "string"},
            "requestTime": {"type": "integer"},
            "playlist": song_array,
        },
        "additionalProperties": {
            "continuationToken": {"type": "string"}}
    }

    @staticmethod
    def dynamic_data(cont_token=None):
        """:param cont_token: (optional) token to get the next library chunk."""
        if not cont_token:
            req = {}
        else:
            req = {"continuationToken": cont_token}

        return {'json': json.dumps(req)}

    @staticmethod
    def filter_response(msg):
        """Only log the number of songs."""
        filtered = copy.copy(msg)
        filtered['playlist'] = ["<%s songs>" % len(filtered.get('playlist', []))]

        return filtered

class GetPlaylistSongs(WcCall):
    """Loads tracks from a playlist.
    Tracks include playlistEntryIds.
    """

    static_method = 'POST'
    static_url = service_url + 'loadplaylist'

    @classmethod
    def dynamic_data(cls, playlist_id):
        """
        :param playlist_id: id to retrieve from, or 'all' to get all playlists.
        """

        #This call has a dynamic response schema based on the request.
        # TODO wow, this is a terrible idea

        if playlist_id == 'all':
            cls._res_schema = {
                "type": "object",
                "properties": {
                    "playlists": pl_array,
                },
                "additionalProperties": False
            }

            return {'json': json.dumps({})}

        else:
            cls._res_schema = pl_schema
            return {'json': json.dumps({'id': playlist_id})}

    @staticmethod
    def filter_response(msg):
        """Log number of songs/playlists."""
        filtered = copy.copy(msg)

        if 'playlists' in msg:
            filtered['playlists'] = ["<%s playlists>" % len(filtered['playlists'])]

        else:
            filtered['playlist'] = ["<%s songs>" % len(filtered['playlist'])]

        return filtered

class ChangeSongMetadata(WcCall):
    """Edit the metadata of songs."""

    static_method = 'POST'
    static_url = service_url + 'modifyentries'

    _res_schema = {
        "type": "object",
        "properties": {
            "success": {"type": "boolean"},
            "songs": song_array
        },
        "additionalProperties": False
    }

    @staticmethod
    def dynamic_data(songs):
        """
        :param songs: a list of dictionary representations of songs
        """
        return {'json': json.dumps({'entries': songs})}

    @staticmethod
    def filter_response(msg):
        filtered = copy.copy(msg)
        filtered['songs'] = ["<%s songs>" % len(filtered.get('songs', []))]
        return filtered

    @staticmethod
    def validate(response, msg):
        """The data that comes back doesn't follow normal metadata rules,
        and is meaningless anyway; it'll lie about results."""
        pass

class GetDownloadInfo(WcCall):
    """Get download links and counts for songs."""

    static_method = 'POST'
    static_url = service_url + 'multidownload'

    _res_schema = {
        "type": "object",
        "properties": {
            "downloadCounts": {
                "type": "object",
                "items": {
                    "type": "object",
                    "properties": {
                        "id": {"type": "integer"}
                    }
                }
            },
            "url": {"type": "string"}
        },
        "additionalProperties": False
    }

    @staticmethod
    def dynamic_data(song_ids):
        """
        :param: (list) song_ids
        """
        return {'json': json.dumps({'songIds': song_ids})}

class GetStreamUrl(WcCall):
    """Used to request a streaming link of a track."""

    static_method = 'GET'
    static_url = base_url + 'play'  # note use of base_url, not service_url

    required_auth = authtypes(sso=True)  # no xt required

    _res_schema = {
        "type": "object",
        "properties": {
            "url": {"type": "string", "required": False},
            "urls": {"type": "array", "required": False},
            'now': {'type': 'integer', 'required': False},
            'tier': {'type': 'integer', 'required': False},
        },
        "additionalProperties": False
    }

    @staticmethod
    def dynamic_params(song_id):

        # https://github.com/simon-weber/Unofficial-Google-Music-API/issues/137
        # there are three cases when streaming:
        #   | track type              | guid songid? | slt/sig needed? |
        #    user-uploaded              yes            no
        #    AA track in library        yes            yes
        #    AA track not in library    no             yes

        # without the track['type'] field we can't tell between 1 and 2, but
        # include slt/sig anyway; the server ignores the extra params.
        key = '27f7313e-f75d-445a-ac99-56386a5fe879'
        salt = ''.join(random.choice(string.ascii_lowercase + string.digits) for x in range(12))
        sig = base64.urlsafe_b64encode(hmac.new(key, (song_id + salt), sha1).digest())[:-1]

        params = {
            'u': 0,
            'pt': 'e',
            'slt': salt,
            'sig': sig
        }

        # TODO match guid instead, should be more robust
        if song_id[0] == 'T':
            # all access
            params['mjck'] = song_id
        else:
            params['songid'] = song_id
        return params

class ReportBadSongMatch(WcCall):
    """Request to signal the uploader to reupload a matched track."""

    static_method = 'POST'
    static_url = service_url + 'fixsongmatch'
    static_params = {'format': 'jsarray'}

    #This no longer holds.
    expected_response = [[0], []]

    @classmethod
    def validate(cls, response, msg):
        pass
        #if msg != cls.expected_response:
        #    raise ValidationException("response != %r" % cls.expected_response)

    @staticmethod
    def dynamic_data(song_ids):
        return json.dumps([["", 1], [song_ids]])

class UploadImage(WcCall):
    """Upload an image for use as album art."""

    static_method = 'POST'
    static_url = service_url + 'imageupload'
    static_params = {'zx': '',  # ??
                     'u': 0}

    _res_schema = {
        'type': 'object',
        'properties': {
            'imageUrl': {'type': 'string', 'blank': False},
            'imageDisplayUrl': {'type': 'string', 'blank': False},
        },
        'additionalProperties': False
    }

    @staticmethod
    def dynamic_files(image_filepath):
        """
        :param image_filepath: path to an image
        """
        with open(image_filepath, 'rb') as f:
            contents = f.read()

        return {'albumArt': (image_filepath, contents)}

class GetSettings(WcCall):
    """Get data that populates the settings tab: labs and devices."""

    static_method = 'POST'
    static_url = service_url + 'loadsettings'

    _device_schema = {
        'type': 'object',
        'additionalProperties': False,
        'properties': {
            'date': {'type': 'integer',
                     'format': 'utc-millisec'},
            'id': {'type': 'string'},
            'name': {'type': 'string', 'blank': True},
            'type': {'type': 'string'},

            # only for type == PHONE:
            'model': {'type': 'string', 'blank': True, 'required': False},
            'manufacturer': {'type': 'string', 'blank': True, 'required': False},

            'carrier': {'type': 'string', 'blank': True, 'required': False},
        },
    }

    _lab_schema = {
        'type': 'object',
        'additionalProperties': False,
        'properties': {
            'description': {'type': 'string'},
            'enabled': {'type': 'boolean'},
            'name': {'type': 'string'},
            'title': {'type': 'string'},
        },
    }

    _res_schema = {
        'type': 'object',
        'additionalProperties': False,
        'properties': {
            'settings': {
                'type': 'object',
                'additionalProperties': False,
                'properties': {
                    'devices': {'type': 'array', 'items': _device_schema},
                    'labs': {'type': 'array', 'items': _lab_schema},
                    'maxTracks': {'type': 'integer'},
                    'expirationMillis': {
                        'type': 'integer',
                        'format': 'utc-millisec',
                        'required': False,
                    },
                    'isSubscription': {'type': 'boolean', 'required': False},
                    'isTrial': {'type': 'boolean', 'required': False},
                    'hasFreeTrial': {'type': 'boolean', 'required': False},
                    'subscriptionNewsletter': {'type': 'boolean'},
                    'isCanceled': {'type': 'boolean', 'required': False},
                },
            },
        },
    }

    @staticmethod
    def dynamic_data(session_id):
        """
        :param: session_id
        """
        return {'json': json.dumps({'sessionId': session_id})}

class DeauthDevice(WcCall):
    """Deauthorize a device from GetSettings."""
    static_method = 'POST'
    static_url = service_url + 'modifysettings'

    @staticmethod
    def dynamic_data(device_id, session_id):
        return {'json': json.dumps({'deauth': device_id, 'sessionId': session_id})}

    @classmethod
    def validate(cls, response, msg):
        if msg.text != '{}':
            raise ValidationException("expected an empty object; received %r" % msg.text)


text:
namespace blink {

class DOMFormData;
class WebPasswordCredential;

class PasswordCredential final : public Credential {
    DEFINE_WRAPPERTYPEINFO();
public:
    static PasswordCredential* create(const String& id, const String& password, ExceptionState& exceptionState)
    {
        return create(id, password, emptyString(), emptyString(), exceptionState);
    }

    static PasswordCredential* create(const String& id, const String& password, const String& name, ExceptionState& exceptionState)
    {
        return create(id, password, name, emptyString(), exceptionState);
    }

    static PasswordCredential* create(const String& id, const String& password, const String& name, const String& icon, ExceptionState&);
    static PasswordCredential* create(WebPasswordCredential*);

    // PasswordCredential.idl
    const String& password() const;
    DOMFormData* formData() const { return m_formData; }

    DECLARE_VIRTUAL_TRACE();

private:
    PasswordCredential(WebPasswordCredential*);
    PasswordCredential(const String& id, const String& password, const String& name, const KURL& icon);

    Member<DOMFormData> m_formData;
};

} // namespace blink

#endif // PasswordCredential_h


text:
$(function() {
    var aspxCommonObj = {
        StoreID: AspxCommerce.utils.GetStoreID(),
        PortalID: AspxCommerce.utils.GetPortalID(),
        UserName: AspxCommerce.utils.GetUserName(),
        CultureName: AspxCommerce.utils.GetCultureName()
    };
    var totalStoreRevenue = {
        config: {
            isPostBack: false,
            async: false,
            cache: false,
            type: 'POST',
            contentType: "application/json; charset=utf-8",
            data: '{}',
            dataType: 'json',
            baseURL: AspxCommerce.utils.GetAspxServicePath() + "AspxCoreHandler.ashx/",
            method: "",
            url: "",
            ajaxCallMode: 0
        },
        ajaxCall: function(config) {
            $.ajax({
                type: totalStoreRevenue.config.type,
                contentType: totalStoreRevenue.config.contentType,
                cache: totalStoreRevenue.config.cache,
                async: totalStoreRevenue.config.async,
                url: totalStoreRevenue.config.url,
                data: totalStoreRevenue.config.data,
                dataType: totalStoreRevenue.config.dataType,
                success: totalStoreRevenue.ajaxSuccess,
                error: totalStoreRevenue.ajaxFailure
            });
        },
        GetTotalOrdererRevenueAdmindash: function() {
            this.config.url = this.config.baseURL + "GetTotalOrderAmountAdmindash";
            this.config.data = JSON2.stringify({ aspxCommonObj: aspxCommonObj });
            this.config.ajaxCallMode = 1;
            this.ajaxCall(this.config);
        },
        ajaxSuccess: function(msg) {
            switch (totalStoreRevenue.config.ajaxCallMode) {
            case 0:
                break;
            case 1:
                var length = msg.d.length;
                if (length > 0) {
                    var bodyElements = '';
                    var headELements = '';
                    headELements += '

';
                    headELements += '
' + getLocale(AspxAdminDashBoard, "Revenue") + '	';
                    headELements += '' + getLocale(AspxAdminDashBoard, "Tax") + '	';
                    headELements += '' + getLocale(AspxAdminDashBoard, "Shipping Cost") + '	';
                    headELements += '' + getLocale(AspxAdminDashBoard, "Quantity") + '	';
                    headELements += '

';
                    $("#divTotalOrderRevenueAdmindash").html(headELements);

                    var value;
                    for (var index = 0; index < length; index++) {
                        value = msg.d[index];
                        if (value !== null) {
                            bodyElements += '
' + (value.Revenue != null ? value.Revenue.toFixed(2) : 0) + '	';
                            bodyElements += '' + (value.TaxTotal != null ? value.TaxTotal.toFixed(2) : 0) + '	';
                            bodyElements += '' + (value.ShippingCost != null ? value.ShippingCost.toFixed(2) : 0) + '	';
                            bodyElements += '' + (value.Quantity != null ? value.Quantity : 0)+ '';
                            bodyElements += '
';
                        }
                    };
                    $("#divTotalOrderRevenueAdmindash").find('table>tbody').append(bodyElements);
                    $('.cssClassFormatCurrency').formatCurrency({ colorize: true, region: '' + region + '' });
                    $(".classTableWrapper > tbody tr:even").addClass("sfEven");
                    $(".classTableWrapper > tbody tr:odd").addClass("sfOdd");
                } else {
                $("#divTotalOrderRevenueAdmindash").html("" + getLocale(AspxAdminDashBoard,'No Data Found!!')+"");
                }
                break;
            }
        },
        ajaxFailure: function(msg) {
            switch (totalStoreRevenue.config.ajaxCallMode) {
            case 0:
                break;
            case 1:
                csscody.error('
' + getLocale(AspxAdminDashBoard, "Error Message") + '

' + getLocale(AspxAdminDashBoard, "Failed to load Total Store Revenue.") + '
');
                break;
            }
        },
        init: function(config) {
            totalStoreRevenue.GetTotalOrdererRevenueAdmindash();
        }
    };
    totalStoreRevenue.init();
});


text:
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.password_manager;

import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.ui.base.WindowAndroid;
import org.chromium.ui.modaldialog.DialogDismissalCause;

/**
 * JNI call glue between native password generation and Java objects.
 */
public class PasswordGenerationDialogBridge {
    private long mNativePasswordGenerationDialogViewAndroid;
    private final PasswordGenerationDialogCoordinator mPasswordGenerationDialog;
    // TODO(ioanap): Get the generated password from the model once editing is in place.
    private String mGeneratedPassword;

    private PasswordGenerationDialogBridge(
            WindowAndroid windowAndroid, long nativePasswordGenerationDialogViewAndroid) {
        mNativePasswordGenerationDialogViewAndroid = nativePasswordGenerationDialogViewAndroid;
        ChromeActivity activity = (ChromeActivity) windowAndroid.getActivity().get();
        mPasswordGenerationDialog = new PasswordGenerationDialogCoordinator(activity);
    }

    @CalledByNative
    public static PasswordGenerationDialogBridge create(
            WindowAndroid windowAndroid, long nativeDialog) {
        return new PasswordGenerationDialogBridge(windowAndroid, nativeDialog);
    }

    @CalledByNative
    public void showDialog(String generatedPassword, String explanationString) {
        mGeneratedPassword = generatedPassword;
        mPasswordGenerationDialog.showDialog(generatedPassword,
                explanationString,
                this::onPasswordAcceptedOrRejected);
    }

    @CalledByNative
    private void destroy() {
        mNativePasswordGenerationDialogViewAndroid = 0;
        mPasswordGenerationDialog.dismissDialog(DialogDismissalCause.DISMISSED_BY_NATIVE);
    }

    private void onPasswordAcceptedOrRejected(boolean accepted) {
        if (mNativePasswordGenerationDialogViewAndroid == 0) return;

        if (accepted) {
            PasswordGenerationDialogBridgeJni.get().passwordAccepted(
                    mNativePasswordGenerationDialogViewAndroid, PasswordGenerationDialogBridge.this,
                    mGeneratedPassword);
        } else {
            PasswordGenerationDialogBridgeJni.get().passwordRejected(
                    mNativePasswordGenerationDialogViewAndroid,
                    PasswordGenerationDialogBridge.this);
        }
        mPasswordGenerationDialog.dismissDialog(DialogDismissalCause.ACTION_ON_CONTENT);
    }

    @NativeMethods
    interface Natives {
        void passwordAccepted(long nativePasswordGenerationDialogViewAndroid,
                PasswordGenerationDialogBridge caller, String generatedPassword);
        void passwordRejected(long nativePasswordGenerationDialogViewAndroid,
                PasswordGenerationDialogBridge caller);
    }
}


text:
package org.squin.dataset.jenacommon;

import com.hp.hpl.jena.graph.Node;

import org.squin.common.Statistics;
import org.squin.common.StatisticsProvider;

/**
 * A dictionary that assigns identifiers to RDF nodes.
 *
 * @author Olaf Hartig (hartig@informatik.hu-berlin.de)
 */
public interface NodeDictionary extends StatisticsProvider
{
	/**
	 * Returns the RDF term (Jena Node object) identified by the given
	 * identifier, or null if there is no such identifier in the dictionary.
	 */
// 	public Node getNode ( long id );
	public Node getNode ( int id );

	/**
	 * Returns the identifier that identifies the given RDF term (Jena Node
	 * object), or {@link org.squin.dataset.Triple#UNKNOWN_IDENTIFIER} if
	 * there is no such node in the dictionary.
	 */
// 	public long getId ( Node n );
	public int getId ( Node n );

	/**
	 * Returns an identifier that identifies the given RDF term (Jena Node
	 * object).
	 * If there is no identifier for the given node, yet, this method creates
	 * a new identifier and adds it to the dictionary.
	 */
// 	public long createId ( Node n );
	public int createId ( Node n );

	/**
	 * Returns statistics about this dictionary.
	 * The actual statistics depends on the implementation.
	 */
	public Statistics getStatistics ();

}


text:
package instantclient

import (
	"net/http"

	"github.com/tschf/odl/arch"
	"github.com/tschf/odl/resource"
)

func GetIcBasicResources() []*resource.OracleResource {

	acceptCookieIcWinx64 := &http.Cookie{
		Name:   "oraclelicense",
		Value:  "accept-ic_winx8664-cookie",
		Domain: ".oracle.com",
	}

	acceptCookieIcLinuxx64 := &http.Cookie{
		Name:   "oraclelicense",
		Value:  "accept-ic_linuxx8664-cookie",
		Domain: ".oracle.com",
	}

	acceptCookieIcLinuxx86 := &http.Cookie{
		Name:   "oraclelicense",
		Value:  "accept-ic_linux32-cookie",
		Domain: ".oracle.com",
	}

	acceptCookieIcWinx86 := &http.Cookie{
		Name:   "oraclelicense",
		Value:  "accept-ic_win32-cookie",
		Domain: ".oracle.com",
	}

	acceptCookieIcOSX := &http.Cookie{
		Name:   "oraclelicense",
		Value:  "accept-ic_solarisx8664-cookie",
		Domain: ".oracle.com",
	}

	BasicResources := []*resource.OracleResource{}

	// 12.2.0.1.0

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.2.0.1.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/nt/instantclient/122010/instantclient-basic-windows.x64-12.2.0.1.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "windows",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcWinx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.2.0.1.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/nt/instantclient/122010/instantclient-basic-nt-12.2.0.1.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "windows",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcWinx86,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.2.0.1.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/122010/oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux-rpm",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.2.0.1.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/122010/oracle-instantclient12.2-basic-12.2.0.1.0-1.i386.rpm"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux-rpm",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx86,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.2.0.1.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/122010/instantclient-basic-linux-12.2.0.1.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx86,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.2.0.1.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/122010/instantclient-basic-linux.x64-12.2.0.1.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx64,
	})

	// BasicResources = append(BasicResources, &resource.OracleResource{
	// 	Component:    "instantclient-basic",
	// 	Version:      "12.2.0.1.0",
	// 	File:         []string{"https://edelivery.oracle.com/akam/otn/mac/instantclient/122010/instantclient-basic-macos.x64-12.2.0.1.0.zip"},
	// 	License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
	// 	OS:           "osx",
	// 	Arch:         arch.X64,
	// 	Lang:         "na",
	// 	AcceptCookie: acceptCookieIcOSX,
	// })
	//
	// BasicResources = append(BasicResources, &resource.OracleResource{
	// 	Component:    "instantclient-basic",
	// 	Version:      "12.2.0.1.0",
	// 	File:         []string{"https://edelivery.oracle.com/akam/otn/mac/instantclient/122010/instantclient-basic-macos.x32-12.2.0.1.0.zip"},
	// 	License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
	// 	OS:           "osx",
	// 	Arch:         arch.X86,
	// 	Lang:         "na",
	// 	AcceptCookie: acceptCookieIcOSX,
	// })

	// 12.1.0.2.0

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.1.0.2.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/nt/instantclient/121020/instantclient-basic-windows.x64-12.1.0.2.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "windows",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcWinx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.1.0.2.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/nt/instantclient/121020/instantclient-basic-nt-12.1.0.2.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "windows",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcWinx86,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.1.0.2.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/121020/oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux-rpm",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.1.0.2.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/121020/oracle-instantclient12.1-basic-12.1.0.2.0-1.i386.rpm"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux-rpm",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx86,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.1.0.2.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/121020/instantclient-basic-linux-12.1.0.2.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx86,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.1.0.2.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/121020/instantclient-basic-linux.x64-12.1.0.2.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.1.0.2.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/mac/instantclient/121020/instantclient-basic-macos.x64-12.1.0.2.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "osx",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcOSX,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "12.1.0.2.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/mac/instantclient/121020/instantclient-basic-macos.x32-12.1.0.2.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "osx",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcOSX,
	})

	// 11.2.0.4.0

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.2.0.4.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/nt/instantclient/11204/instantclient-basic-windows.x64-11.2.0.4.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "windows",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcWinx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.2.0.4.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/nt/instantclient/11204/instantclient-basic-nt-11.2.0.4.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "windows",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcWinx86,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.2.0.4.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/11204/oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux-rpm",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.2.0.4.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/11204/instantclient-basic-linux.x64-11.2.0.4.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.2.0.4.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/11204/oracle-instantclient11.2-basic-11.2.0.4.0-1.i386.rpm"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux-rpm",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.2.0.4.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/11204/instantclient-basic-linux-11.2.0.4.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.2.0.4.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/mac/instantclient/11204/instantclient-basic-macos.x64-11.2.0.4.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "osx",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcOSX,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.2.0.4.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/mac/instantclient/11204/instantclient-basic-macos.x32-11.2.0.4.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "osx",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcOSX,
	})

	// 11.1.0.7.0

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.1.0.7.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/nt/instantclient/111070/instantclient-basic-win-x86-64-11.1.0.7.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "windows",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcWinx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.1.0.7.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/nt/instantclient/111070/instantclient-basic-win32-11.1.0.7.0.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "windows",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcWinx86,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.1.0.7.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/111070/oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64.rpm"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux-rpm",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.1.0.7.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/111070/basic-11.1.0.70-linux-x86_64.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux",
		Arch:         arch.X64,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.1.0.7.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/111070/oracle-instantclient11.1-basic-11.1.0.7.0-1.i386.rpm"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux-rpm",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx64,
	})

	BasicResources = append(BasicResources, &resource.OracleResource{
		Component:    "instantclient-basic",
		Version:      "11.1.0.7.0",
		File:         []string{"https://edelivery.oracle.com/akam/otn/linux/instantclient/111070/instantclient-basic-linux32-11.1.0.7.zip"},
		License:      "http://www.oracle.com/technetwork/licenses/distribution-license-152002.html",
		OS:           "linux",
		Arch:         arch.X86,
		Lang:         "na",
		AcceptCookie: acceptCookieIcLinuxx64,
	})

	return BasicResources
}


text:
from os import PathLike
from pathlib import Path
from typing import Any, Dict, List, Optional, Union

from marshmallow import INCLUDE

from azure.ai.ml._schema._data.mltable_metadata_schema import MLTableMetadataSchema
from azure.ai.ml._utils.utils import load_yaml
from azure.ai.ml.constants._common import BASE_PATH_CONTEXT_KEY
from azure.ai.ml.entities._util import load_from_dict

class MLTableMetadataPath:
    type: str  # Literal["pattern", "file", "folder"]
    value: str

    def __init__(self, *, pathDict: Dict):
        if pathDict.get("pattern", None):
            self.type = "pattern"
            self.value = pathDict.get("pattern")
        if pathDict.get("file", None):
            self.type = "file"
            self.value = pathDict.get("file")
        if pathDict.get("folder", None):
            self.type = "folder"
            self.value = pathDict.get("folder")

class MLTableMetadata:
    """MLTableMetadata for data assets.

    :param paths: List of paths which the MLTableMetadata refers to.
    :type paths: List[MLTableMetadataPath]
    :param transformations: Any transformations to be applied to the data referenced in paths.
    :type transformations: List[Any]
    :param base_path: Base path to resolve relative paths from.
    :type base_path: str
    """

    def __init__(
        self,
        *,
        paths: List[MLTableMetadataPath],
        transformations: Optional[List[Any]] = None,
        base_path: str,
        **_kwargs,
    ):
        self.base_path = base_path
        self.paths = paths
        self.transformations = transformations

    @classmethod
    def load(
        cls,
        yaml_path: Union[PathLike, str],
        **kwargs,
    ) -> "MLTableMetadata":
        """Construct an MLTable object from yaml file.

        :param yaml_path: Path to a local file as the source.
        :type PathLike | str

        :return: Constructed MLTable object.
        :rtype: MLTable
        """
        yaml_dict = load_yaml(yaml_path)
        return cls._load(yaml_data=yaml_dict, yaml_path=yaml_path, **kwargs)

    @classmethod
    def _load(
        cls,
        yaml_data: Optional[Dict],
        yaml_path: Optional[Union[PathLike, str]],
        **kwargs,
    ) -> "MLTableMetadata":
        yaml_data = yaml_data or {}
        context = {
            BASE_PATH_CONTEXT_KEY: Path(yaml_path).parent if yaml_path else Path("./"),
        }
        return load_from_dict(MLTableMetadataSchema, yaml_data, context, "", unknown=INCLUDE, **kwargs)

    def _to_dict(self) -> Dict:
        return MLTableMetadataSchema(context={BASE_PATH_CONTEXT_KEY: "./"}, unknown=INCLUDE).dump(self)

    def referenced_uris(self) -> List[str]:
        return [path.value for path in self.paths]


text:
package com.thoughtworks.go.plugin.activation.test;

import com.thoughtworks.go.plugin.api.GoApplicationAccessor;
import com.thoughtworks.go.plugin.api.GoPlugin;
import com.thoughtworks.go.plugin.api.GoPluginIdentifier;
import com.thoughtworks.go.plugin.api.annotation.Extension;
import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException;
import com.thoughtworks.go.plugin.api.request.GoPluginApiRequest;
import com.thoughtworks.go.plugin.api.response.GoPluginApiResponse;

public class DummyClassWithLocalInnerClass {

    public void foo() {
        @Extension
        class DummyInnerClassWithExtension implements GoPlugin {
            @Override
            public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
                throw new UnsupportedOperationException();
            }

            @Override
            public GoPluginApiResponse handle(GoPluginApiRequest requestMessage) throws UnhandledRequestTypeException {
                throw new UnsupportedOperationException();
            }

            @Override
            public GoPluginIdentifier pluginIdentifier() {
                throw new UnsupportedOperationException();
            }
        }
    }
}


text:
package org.sakaiproject.dash.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sakaiproject.dash.logic.DashboardLogic;
import org.sakaiproject.dash.app.SakaiProxy;
import org.sakaiproject.event.api.Event;
import org.sakaiproject.site.api.SiteService;

/**
 * This is the event handler for site.unpublish event
 * it will remove links for all existing NewsItem/CalendarItem for all eligible users within the site
 */
public class SiteUnpublishEventProcessor implements EventProcessor {

	private static Logger logger = LoggerFactory.getLogger(SiteUnpublishEventProcessor.class);

	protected DashboardLogic dashboardLogic;
	public void setDashboardLogic(DashboardLogic dashboardLogic) {
		this.dashboardLogic = dashboardLogic;
	}

	protected SakaiProxy sakaiProxy;
	public void setSakaiProxy(SakaiProxy proxy) {
		this.sakaiProxy = proxy;
	}

	/* (non-Javadoc)
	 * @see org.sakaiproject.dash.listener.EventProcessor#getEventIdentifer()
	 */
	public String getEventIdentifer() {

		return SiteService.EVENT_SITE_UNPUBLISH;
	}

	/* (non-Javadoc)
	 * @see org.sakaiproject.dash.listener.EventProcessor#processEvent(org.sakaiproject.event.api.Event)
	 */
	public void processEvent(Event event) {

		if(logger.isDebugEnabled()) {
			logger.debug("\n\n\n=============================================================\n" + event
					+ "\n=============================================================\n\n\n");
		}

		// get site id
		String site_reference = event.getResource();
		if (site_reference != null && site_reference.contains(SiteService.REFERENCE_ROOT))
		{
			// get the substring of site id
			String context = site_reference.substring(SiteService.REFERENCE_ROOT.length() + 1);

			logger.info(this + " process Event start removing News links and Calendar links for site " + context);

			// if unpublished, remove all news links and calendar links
			dashboardLogic.modifyLinksByContext(context, dashboardLogic.TYPE_NEWS, false/*removing*/);
			dashboardLogic.modifyLinksByContext(context, dashboardLogic.TYPE_CALENDAR, false/*removing*/);

			logger.info(this + " process Event end removing News links and Calendar links for site " + context);
		}
	}

	public void init() {

		this.dashboardLogic.registerEventProcessor(this);
	}
}