text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  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.
-->

<!--
  This is a dummy manifest which is required by Android Studio's _all target.
  No <uses-sdk> is allowed due to https://crbug.com/841529.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="org.dummy">
</manifest>

redpajama_set_name: RedPajamaGithub


text:
package ru.emil.TrackerLists;

import java.util.ArrayList;

public class Property {

    private String  name;
    private String[] value = new String[100];

    public Property(String name){ //constructor
        this.name = name;
        for(int i = 0; i < value.length; i++){
            value[i] = "";
        }

    }

    //getters and setters
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue(int numberOfOfject) {
        numberOfOfject -=1;
        return value[numberOfOfject];
    }

    public void setValueOfObject(int numberOfObject, String value) {
        numberOfObject -= 1;
        this.value[numberOfObject] = value;

    }

}


text:
    background-color: #EFEFEF;
    padding: 7px;
}

#gallery_selection label {
    font-weight: 600;
    position: relative;
    top: -1px;
}

#gallery_name {
    width: auto;
    min-width: 200px;
}

#gallery_name.error {
    border: solid 1px red;
}

#upload_images_content {
    padding: 0px;
}

#upload_images_content .plupload_container {
    padding: 0px;
}

.plupload_header {
    display: none;
}

.plupload_buttons {
    display: inline
}

.plupload_droptext {
    font-size: 16px;
    color: silver;
}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="local/dashboard/db" VERSION="20170328" COMMENT="XMLDB file for Moodle local/dashboard"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
  <TABLES>

      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="timecreated" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="time row created"/>
        <FIELD NAME="userid" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="the moodle user id"/>
        <FIELD NAME="country" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="user country"/>
        <FIELD NAME="region" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="user region"/>
        <FIELD NAME="city" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="longitude" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="latitude" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="id" TYPE="primary" FIELDS="id" COMMENT="prymary key"/>
      </KEYS>

      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="time" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="time in unix format"/>
        <FIELD NAME="sessions" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="session during that hour"/>
        <FIELD NAME="avgsessiontime" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="average duration of that hour sessions"/>
        <FIELD NAME="courseviews" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="pageviews for that hour"/>
        <FIELD NAME="users" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="amount of users logged"/>
        <FIELD NAME="newusers" TYPE="int" LENGTH="20" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="amount of new users"/>
        <FIELD NAME="windows" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="Windows OS users"/>
        <FIELD NAME="linux" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="linux OS users"/>
        <FIELD NAME="macintosh" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="apple OS users"/>
        <FIELD NAME="ios" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="ios users"/>
        <FIELD NAME="android" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="number of android users"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="time" UNIQUE="true" FIELDS="time" COMMENT="time and date"/>
      </INDEXES>

      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="courseid" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="course id of the activity"/>
        <FIELD NAME="time" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="Resource day"/>
        <FIELD NAME="resourceid" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="resource name"/>
        <FIELD NAME="activity" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="resource activity"/>
        <FIELD NAME="amountcreated" TYPE="int" LENGTH="20" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="amount of resources created"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id" COMMENT="course id of the activity"/>
      </KEYS>

      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="time" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false" COMMENT="moment of the action"/>
        <FIELD NAME="courseid" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="amountcreated" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="useramount" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false" COMMENT="count the amount of users using turnitin"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>

      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="time" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="courseid" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false" COMMENT="the course id"/>
        <FIELD NAME="amountcreated" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="digitalized" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="corrections" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="publish" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>

      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="time" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="categoryid" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="sessionsnumber" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="presence" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="discussion" TYPE="int" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>

  </TABLES>
</XMLDB>


text:
using Python.Runtime;
using QuantConnect.Algorithm;
using QuantConnect.Configuration;
using QuantConnect.Data;
using QuantConnect.Data.Fundamental;
using QuantConnect.Data.Market;
using QuantConnect.Indicators;
using QuantConnect.Interfaces;
using QuantConnect.Lean.Engine;
using QuantConnect.Lean.Engine.DataFeeds;
using QuantConnect.Lean.Engine.HistoricalData;
using QuantConnect.Securities;
using QuantConnect.Securities.Future;
using QuantConnect.Securities.Option;
using QuantConnect.Statistics;
using QuantConnect.Util;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using QuantConnect.Data.UniverseSelection;
using QuantConnect.Packets;
using QuantConnect.Lean.Engine.DataFeeds.Enumerators.Factories;
using System.Threading.Tasks;

namespace QuantConnect.Research
{
    /// <summary>
    /// Provides access to data for quantitative analysis
    /// </summary>
    public class QuantBook : QCAlgorithm
    {
        private dynamic _pandas;
        private IDataCacheProvider _dataCacheProvider;
        private IDataProvider _dataProvider;
        private static bool _isPythonNotebook;

        static QuantBook()
        {
            //Determine if we are in a Python Notebook
            try
            {
                PythonEngine.Initialize();
                using (Py.GIL())
                {
                    var isPython = PyModule.FromString(Guid.NewGuid().ToString(),
                        "try:\n" +
                        "   import IPython\n" +
                        "   def IsPythonNotebook():\n" +
                        "       return (IPython.get_ipython() != None)\n" +
                        "except:\n" +
                        "   print('No IPython installed')\n" +
                        "   def IsPythonNotebook():\n" +
                        "       return false\n").GetAttr("IsPythonNotebook").Invoke();
                    isPython.TryConvert(out _isPythonNotebook);
                }
            }
            catch
            {
                //Default to false
                _isPythonNotebook = false;
                Logging.Log.Error("QuantBook failed to determine Notebook kernel language");
            }

            Logging.Log.Trace($"QuantBook started; Is Python: {_isPythonNotebook}");
        }

        /// <summary>
        /// <see cref = "QuantBook" /> constructor.
        /// Provides access to data for quantitative analysis
        /// </summary>
        public QuantBook() : base()
        {
            try
            {
                using (Py.GIL())
                {
                    _pandas = Py.Import("pandas");
                }

                // Issue #4892 : Set start time relative to NY time
                // when the data is available from the previous day
                var newYorkTime = DateTime.UtcNow.ConvertFromUtc(TimeZones.NewYork);
                var hourThreshold = Config.GetInt("qb-data-hour", 9);

                // If it is after our hour threshold; then we can use today
                if (newYorkTime.Hour >= hourThreshold)
                {
                    SetStartDate(newYorkTime);
                }
                else
                {
                    SetStartDate(newYorkTime - TimeSpan.FromDays(1));
                }

                // Sets PandasConverter
                SetPandasConverter();

                // Reset our composer; needed for re-creation of QuantBook
                Composer.Instance.Reset();
                var composer = Composer.Instance;

                // Create our handlers with our composer instance
                var algorithmHandlers = LeanEngineAlgorithmHandlers.FromConfiguration(composer, researchMode: true);
                var systemHandlers = LeanEngineSystemHandlers.FromConfiguration(composer);

                // init the API
                systemHandlers.Initialize();
                systemHandlers.LeanManager.Initialize(systemHandlers,
                    algorithmHandlers,
                    new BacktestNodePacket(),
                    new AlgorithmManager(false));
                systemHandlers.LeanManager.SetAlgorithm(this);

                ProjectId = Config.GetInt("project-id");

                algorithmHandlers.DataPermissionsManager.Initialize(new AlgorithmNodePacket(PacketType.BacktestNode)
                {
                    UserToken = Config.Get("api-access-token"),
                    UserId = Config.GetInt("job-user-id"),
                    ProjectId = ProjectId,
                    OrganizationId = Config.Get("job-organization-id"),
                    Version = Globals.Version
                });

                algorithmHandlers.ObjectStore.Initialize(Config.GetInt("job-user-id"),
                    ProjectId,
                    Config.Get("api-access-token"),
                    new Controls
                    {
                        // if <= 0 we disable periodic persistence and make it synchronous
                        PersistenceIntervalSeconds = -1,
                        StorageLimit = Config.GetValue("storage-limit", 10737418240L),
                        StorageFileCount = Config.GetInt("storage-file-count", 10000),
                        StoragePermissions = (FileAccess) Config.GetInt("storage-permissions", (int)FileAccess.ReadWrite)
                    });
                SetObjectStore(algorithmHandlers.ObjectStore);

                _dataCacheProvider = new ZipDataCacheProvider(algorithmHandlers.DataProvider);
                _dataProvider = algorithmHandlers.DataProvider;

                var symbolPropertiesDataBase = SymbolPropertiesDatabase.FromDataFolder();
                var registeredTypes = new RegisteredSecurityDataTypesProvider();
                var securityService = new SecurityService(Portfolio.CashBook,
                    MarketHoursDatabase,
                    symbolPropertiesDataBase,
                    this,
                    registeredTypes,
                    new SecurityCacheProvider(Portfolio));
                Securities.SetSecurityService(securityService);
                SubscriptionManager.SetDataManager(
                    new DataManager(new NullDataFeed(),
                        new UniverseSelection(this, securityService, algorithmHandlers.DataPermissionsManager, algorithmHandlers.DataProvider),
                        this,
                        TimeKeeper,
                        MarketHoursDatabase,
                        false,
                        registeredTypes,
                        algorithmHandlers.DataPermissionsManager));

                var mapFileProvider = algorithmHandlers.MapFileProvider;
                HistoryProvider = new HistoryProviderManager();
                HistoryProvider.Initialize(
                    new HistoryProviderInitializeParameters(
                        null,
                        null,
                        algorithmHandlers.DataProvider,
                        _dataCacheProvider,
                        mapFileProvider,
                        algorithmHandlers.FactorFileProvider,
                        null,
                        true,
                        algorithmHandlers.DataPermissionsManager
                    )
                );

                SetOptionChainProvider(new CachingOptionChainProvider(new BacktestingOptionChainProvider(_dataCacheProvider, mapFileProvider)));
                SetFutureChainProvider(new CachingFutureChainProvider(new BacktestingFutureChainProvider(_dataCacheProvider)));
            }
            catch (Exception exception)
            {
                throw new Exception("QuantBook.Main(): " + exception);
            }
        }

        /// <summary>
        /// Python implementation of GetFundamental, get fundamental data for input symbols or tickers
        /// </summary>
        /// <param name="input">The symbols or tickers to retrieve fundamental data for</param>
        /// <param name="selector">Selects a value from the Fundamental data to filter the request output</param>
        /// <param name="start">The start date of selected data</param>
        /// <param name="end">The end date of selected data</param>
        /// <returns>pandas DataFrame</returns>
        public PyObject GetFundamental(PyObject input, string selector = null, DateTime? start = null, DateTime? end = null)
        {
            //Covert to symbols
            var symbols = PythonUtil.ConvertToSymbols(input);

            //Fetch the data
            var fundamentalData = GetAllFundamental(symbols, selector, start, end);

            using (Py.GIL())
            {
                var data = new PyDict();
                foreach (var day in fundamentalData.OrderBy(x => x.Key))
                {
                    var orderedValues = day.Value.OrderBy(x => x.Key.ID.ToString()).ToList();
                    var columns = orderedValues.Select(x => x.Key.ID.ToString());
                    var values = orderedValues.Select(x => x.Value);
                    var row = _pandas.Series(values, columns);
                    data.SetItem(day.Key.ToPython(), row);
                }

                return _pandas.DataFrame.from_dict(data, orient:"index");
            }
        }

        /// <summary>
        /// Get fundamental data from given symbols
        /// </summary>
        /// <param name="symbols">The symbols to retrieve fundamental data for</param>
        /// <param name="selector">Selects a value from the Fundamental data to filter the request output</param>
        /// <param name="start">The start date of selected data</param>
        /// <param name="end">The end date of selected data</param>
        /// <returns>Enumerable collection of DataDictionaries, one dictionary for each day there is data</returns>
        public IEnumerable<DataDictionary<dynamic>> GetFundamental(IEnumerable<Symbol> symbols, string selector = null, DateTime? start = null, DateTime? end = null)
        {
            var data = GetAllFundamental(symbols, selector, start, end);

            foreach (var kvp in data.OrderBy(kvp => kvp.Key))
            {
                yield return kvp.Value;
            }
        }

        /// <summary>
        /// Get fundamental data for a given symbol
        /// </summary>
        /// <param name="symbol">The symbol to retrieve fundamental data for</param>
        /// <param name="selector">Selects a value from the Fundamental data to filter the request output</param>
        /// <param name="start">The start date of selected data</param>
        /// <param name="end">The end date of selected data</param>
        /// <returns>Enumerable collection of DataDictionaries, one Dictionary for each day there is data.</returns>
        public IEnumerable<DataDictionary<dynamic>> GetFundamental(Symbol symbol, string selector = null, DateTime? start = null, DateTime? end = null)
        {
            var list = new List<Symbol>
            {
                symbol
            };

            return GetFundamental(list, selector, start, end);
        }

        /// <summary>
        /// Get fundamental data for a given set of tickers
        /// </summary>
        /// <param name="tickers">The tickers to retrieve fundamental data for</param>
        /// <param name="selector">Selects a value from the Fundamental data to filter the request output</param>
        /// <param name="start">The start date of selected data</param>
        /// <param name="end">The end date of selected data</param>
        /// <returns>Enumerable collection of DataDictionaries, one dictionary for each day there is data.</returns>
        public IEnumerable<DataDictionary<dynamic>> GetFundamental(IEnumerable<string> tickers, string selector = null, DateTime? start = null, DateTime? end = null)
        {
            var list = new List<Symbol>();
            foreach (var ticker in tickers)
            {
                list.Add(QuantConnect.Symbol.Create(ticker, SecurityType.Equity, Market.USA));
            }

            return GetFundamental(list, selector, start, end);
        }

        /// <summary>
        /// Get fundamental data for a given ticker
        /// </summary>
        /// <param name="symbol">The symbol to retrieve fundamental data for</param>
        /// <param name="selector">Selects a value from the Fundamental data to filter the request output</param>
        /// <param name="start">The start date of selected data</param>
        /// <param name="end">The end date of selected data</param>
        /// <returns>Enumerable collection of DataDictionaries, one Dictionary for each day there is data.</returns>
        public dynamic GetFundamental(string ticker, string selector = null, DateTime? start = null, DateTime? end = null)
        {
            //Check if its Python; PythonNet likes to convert the strings, but for python we want the DataFrame as the return object
            //So we must route the function call to the Python version.
            if (_isPythonNotebook)
            {
                return GetFundamental(ticker.ToPython(), selector, start, end);
            }

            var symbol = QuantConnect.Symbol.Create(ticker, SecurityType.Equity, Market.USA);
            var list = new List<Symbol>
            {
                symbol
            };

            return GetFundamental(list, selector, start, end);
        }

        /// <summary>
        /// Gets <see cref="OptionHistory"/> object for a given symbol, date and resolution
        /// </summary>
        /// <param name="symbol">The symbol to retrieve historical option data for</param>
        /// <param name="start">The history request start time</param>
        /// <param name="end">The history request end time. Defaults to 1 day if null</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="fillForward">True to fill forward missing data, false otherwise</param>
        /// <param name="extendedMarket">True to include extended market hours data, false otherwise</param>
        /// <returns>A <see cref="OptionHistory"/> object that contains historical option data.</returns>
        public OptionHistory GetOptionHistory(Symbol symbol, DateTime start, DateTime? end = null, Resolution? resolution = null,
            bool fillForward = true, bool extendedMarket = false)
        {
            if (!end.HasValue || end.Value == start)
            {
                end = start.AddDays(1);
            }

            // Load a canonical option Symbol if the user provides us with an underlying Symbol
            if (!symbol.SecurityType.IsOption())
            {
                var option = AddOption(symbol, resolution, symbol.ID.Market, fillForward);

                // Allow 20 strikes from the money for futures. No expiry filter is applied
                // so that any future contract provided will have data returned.
                if (symbol.SecurityType == SecurityType.Future && symbol.IsCanonical())
                {
                    throw new ArgumentException("The Future Symbol provided is a canonical Symbol (i.e. a Symbol representing all Futures), which is not supported at this time. " +
                        "If you are using the Symbol accessible from `AddFuture(...)`, use the Symbol from `AddFutureContract(...)` instead. " +
                        "You can use `qb.FutureOptionChainProvider(canonicalFuture, datetime)` to get a list of futures contracts for a given date, and add them to your algorithm with `AddFutureContract(symbol, Resolution)`.");
                }
                if (symbol.SecurityType == SecurityType.Future && !symbol.IsCanonical())
                {
                    option.SetFilter(universe => universe.Strikes(-10, +10));
                }

                symbol = option.Symbol;
            }

            IEnumerable<Symbol> symbols;
            if (symbol.IsCanonical())
            {
                // canonical symbol, lets find the contracts
                var option = Securities[symbol] as Option;
                var resolutionToUseForUnderlying = resolution ?? SubscriptionManager.SubscriptionDataConfigService
                                                       .GetSubscriptionDataConfigs(symbol)
                                                       .GetHighestResolution();
                if (!Securities.ContainsKey(symbol.Underlying))
                {
                    if (symbol.Underlying.SecurityType == SecurityType.Equity)
                    {
                        // only add underlying if not present
                        AddEquity(symbol.Underlying.Value, resolutionToUseForUnderlying, fillDataForward: fillForward,
                            extendedMarketHours: extendedMarket);
                    }
                    if (symbol.Underlying.SecurityType == SecurityType.Future && symbol.Underlying.IsCanonical())
                    {
                        AddFuture(symbol.Underlying.ID.Symbol, resolutionToUseForUnderlying, fillDataForward: fillForward,
                            extendedMarketHours: extendedMarket);
                    }
                    else if (symbol.Underlying.SecurityType == SecurityType.Future)
                    {
                        AddFutureContract(symbol.Underlying, resolutionToUseForUnderlying, fillDataForward: fillForward,
                            extendedMarketHours: extendedMarket);
                    }
                }
                var allSymbols = new List<Symbol>();
                for (var date = start; date < end; date = date.AddDays(1))
                {
                    if (option.Exchange.DateIsOpen(date))
                    {
                        allSymbols.AddRange(OptionChainProvider.GetOptionContractList(symbol.Underlying, date));
                    }
                }

                var optionFilterUniverse = new OptionFilterUniverse();
                var distinctSymbols = allSymbols.Distinct();
                symbols = base.History(symbol.Underlying, start, end.Value, resolution)
                    .SelectMany(x =>
                    {
                        // the option chain symbols wont change so we can set 'exchangeDateChange' to false always
                        optionFilterUniverse.Refresh(distinctSymbols, x, exchangeDateChange:false);
                        return option.ContractFilter.Filter(optionFilterUniverse);
                    })
                    .Distinct().Concat(new[] { symbol.Underlying });
            }
            else
            {
                // the symbol is a contract
                symbols = new List<Symbol>{ symbol };
            }

            return new OptionHistory(History(symbols, start, end.Value, resolution, fillForward, extendedMarket));
        }

        /// <summary>
        /// Gets <see cref="FutureHistory"/> object for a given symbol, date and resolution
        /// </summary>
        /// <param name="symbol">The symbol to retrieve historical future data for</param>
        /// <param name="start">The history request start time</param>
        /// <param name="end">The history request end time. Defaults to 1 day if null</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="fillForward">True to fill forward missing data, false otherwise</param>
        /// <param name="extendedMarket">True to include extended market hours data, false otherwise</param>
        /// <returns>A <see cref="FutureHistory"/> object that contains historical future data.</returns>
        public FutureHistory GetFutureHistory(Symbol symbol, DateTime start, DateTime? end = null, Resolution? resolution = null,
            bool fillForward = true, bool extendedMarket = false)
        {
            if (!end.HasValue || end.Value == start)
            {
                end = start.AddDays(1);
            }

            var allSymbols = new HashSet<Symbol>();
            if (symbol.IsCanonical())
            {
                // canonical symbol, lets find the contracts
                var future = Securities[symbol] as Future;

                for (var date = start; date < end; date = date.AddDays(1))
                {
                    if (future.Exchange.DateIsOpen(date))
                    {
                        var underlying = new Tick { Time = date };
                        var allList = FutureChainProvider.GetFutureContractList(future.Symbol, date);

                        allSymbols.UnionWith(future.ContractFilter.Filter(new FutureFilterUniverse(allList, underlying)));
                    }
                }
            }
            else
            {
                // the symbol is a contract
                allSymbols.Add(symbol);
            }

            return new FutureHistory(History(allSymbols, start, end.Value, resolution, fillForward, extendedMarket));
        }

        /// <summary>
        /// Gets the historical data of an indicator for the specified symbol. The exact number of bars will be returned.
        /// The symbol must exist in the Securities collection.
        /// </summary>
        /// <param name="symbol">The symbol to retrieve historical data for</param>
        /// <param name="periods">The number of bars to request</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame of historical data of an indicator</returns>
        public PyObject Indicator(IndicatorBase<IndicatorDataPoint> indicator, Symbol symbol, int period, Resolution? resolution = null, Func<IBaseData, decimal> selector = null)
        {
            var history = History(new[] { symbol }, period, resolution);
            return Indicator(indicator, history, selector);
        }

        /// <summary>
        /// Gets the historical data of a bar indicator for the specified symbol. The exact number of bars will be returned.
        /// The symbol must exist in the Securities collection.
        /// </summary>
        /// <param name="symbol">The symbol to retrieve historical data for</param>
        /// <param name="periods">The number of bars to request</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame of historical data of a bar indicator</returns>
        public PyObject Indicator(IndicatorBase<IBaseDataBar> indicator, Symbol symbol, int period, Resolution? resolution = null, Func<IBaseData, IBaseDataBar> selector = null)
        {
            var history = History(new[] { symbol }, period, resolution);
            return Indicator(indicator, history, selector);
        }

        /// <summary>
        /// Gets the historical data of a bar indicator for the specified symbol. The exact number of bars will be returned.
        /// The symbol must exist in the Securities collection.
        /// </summary>
        /// <param name="symbol">The symbol to retrieve historical data for</param>
        /// <param name="periods">The number of bars to request</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame of historical data of a bar indicator</returns>
        public PyObject Indicator(IndicatorBase<TradeBar> indicator, Symbol symbol, int period, Resolution? resolution = null, Func<IBaseData, TradeBar> selector = null)
        {
            var history = History(new[] { symbol }, period, resolution);
            return Indicator(indicator, history, selector);
        }

        /// <summary>
        /// Gets the historical data of an indicator for the specified symbol. The exact number of bars will be returned.
        /// The symbol must exist in the Securities collection.
        /// </summary>
        /// <param name="indicator">Indicator</param>
        /// <param name="symbol">The symbol to retrieve historical data for</param>
        /// <param name="span">The span over which to retrieve recent historical data</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame of historical data of an indicator</returns>
        public PyObject Indicator(IndicatorBase<IndicatorDataPoint> indicator, Symbol symbol, TimeSpan span, Resolution? resolution = null, Func<IBaseData, decimal> selector = null)
        {
            var history = History(new[] { symbol }, span, resolution);
            return Indicator(indicator, history, selector);
        }

        /// <summary>
        /// Gets the historical data of a bar indicator for the specified symbol. The exact number of bars will be returned.
        /// The symbol must exist in the Securities collection.
        /// </summary>
        /// <param name="indicator">Indicator</param>
        /// <param name="symbol">The symbol to retrieve historical data for</param>
        /// <param name="span">The span over which to retrieve recent historical data</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame of historical data of a bar indicator</returns>
        public PyObject Indicator(IndicatorBase<IBaseDataBar> indicator, Symbol symbol, TimeSpan span, Resolution? resolution = null, Func<IBaseData, IBaseDataBar> selector = null)
        {
            var history = History(new[] { symbol }, span, resolution);
            return Indicator(indicator, history, selector);
        }

        /// <summary>
        /// Gets the historical data of a bar indicator for the specified symbol. The exact number of bars will be returned.
        /// The symbol must exist in the Securities collection.
        /// </summary>
        /// <param name="indicator">Indicator</param>
        /// <param name="symbol">The symbol to retrieve historical data for</param>
        /// <param name="span">The span over which to retrieve recent historical data</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame of historical data of a bar indicator</returns>
        public PyObject Indicator(IndicatorBase<TradeBar> indicator, Symbol symbol, TimeSpan span, Resolution? resolution = null, Func<IBaseData, TradeBar> selector = null)
        {
            var history = History(new[] { symbol }, span, resolution);
            return Indicator(indicator, history, selector);
        }

        /// <summary>
        /// Gets the historical data of an indicator for the specified symbol. The exact number of bars will be returned.
        /// The symbol must exist in the Securities collection.
        /// </summary>
        /// <param name="indicator">Indicator</param>
        /// <param name="symbol">The symbol to retrieve historical data for</param>
        /// <param name="start">The start time in the algorithm's time zone</param>
        /// <param name="end">The end time in the algorithm's time zone</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame of historical data of an indicator</returns>
        public PyObject Indicator(IndicatorBase<IndicatorDataPoint> indicator, Symbol symbol, DateTime start, DateTime end, Resolution? resolution = null, Func<IBaseData, decimal> selector = null)
        {
            var history = History(new[] { symbol }, start, end, resolution);
            return Indicator(indicator, history, selector);
        }

        /// <summary>
        /// Gets the historical data of a bar indicator for the specified symbol. The exact number of bars will be returned.
        /// The symbol must exist in the Securities collection.
        /// </summary>
        /// <param name="indicator">Indicator</param>
        /// <param name="symbol">The symbol to retrieve historical data for</param>
        /// <param name="start">The start time in the algorithm's time zone</param>
        /// <param name="end">The end time in the algorithm's time zone</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame of historical data of a bar indicator</returns>
        public PyObject Indicator(IndicatorBase<IBaseDataBar> indicator, Symbol symbol, DateTime start, DateTime end, Resolution? resolution = null, Func<IBaseData, IBaseDataBar> selector = null)
        {
            var history = History(new[] { symbol }, start, end, resolution);
            return Indicator(indicator, history, selector);
        }

        /// <summary>
        /// Gets the historical data of a bar indicator for the specified symbol. The exact number of bars will be returned.
        /// The symbol must exist in the Securities collection.
        /// </summary>
        /// <param name="indicator">Indicator</param>
        /// <param name="symbol">The symbol to retrieve historical data for</param>
        /// <param name="start">The start time in the algorithm's time zone</param>
        /// <param name="end">The end time in the algorithm's time zone</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame of historical data of a bar indicator</returns>
        public PyObject Indicator(IndicatorBase<TradeBar> indicator, Symbol symbol, DateTime start, DateTime end, Resolution? resolution = null, Func<IBaseData, TradeBar> selector = null)
        {
            var history = History(new[] { symbol }, start, end, resolution);
            return Indicator(indicator, history, selector);
        }

        /// <summary>
        /// Gets Portfolio Statistics from a pandas.DataFrame with equity and benchmark values
        /// </summary>
        /// <param name="dataFrame">pandas.DataFrame with the information required to compute the Portfolio statistics</param>
        /// <returns><see cref="PortfolioStatistics"/> object wrapped in a <see cref="PyDict"/> with the portfolio statistics.</returns>
        public PyDict GetPortfolioStatistics(PyObject dataFrame)
        {
            var dictBenchmark = new SortedDictionary<DateTime, double>();
            var dictEquity = new SortedDictionary<DateTime, double>();
            var dictPL = new SortedDictionary<DateTime, double>();

            using (Py.GIL())
            {
                var result = new PyDict();

                try
                {
                    // Converts the data from pandas.DataFrame into dictionaries keyed by time
                    var df = ((dynamic)dataFrame).dropna();
                    dictBenchmark = GetDictionaryFromSeries((PyObject)df["benchmark"]);
                    dictEquity = GetDictionaryFromSeries((PyObject)df["equity"]);
                    dictPL = GetDictionaryFromSeries((PyObject)df["equity"].pct_change());
                }
                catch (PythonException e)
                {
                    result.SetItem("Runtime Error", e.Message.ToPython());
                    return result;
                }

                // Convert the double into decimal
                var equity = new SortedDictionary<DateTime, decimal>(dictEquity.ToDictionary(kvp => kvp.Key, kvp => (decimal)kvp.Value));
                var profitLoss = new SortedDictionary<DateTime, decimal>(dictPL.ToDictionary(kvp => kvp.Key, kvp => double.IsNaN(kvp.Value) ? 0 : (decimal)kvp.Value));

                // Gets the last value of the day of the benchmark and equity
                var listBenchmark = CalculateDailyRateOfChange(dictBenchmark);
                var listPerformance = CalculateDailyRateOfChange(dictEquity);

                // Gets the startting capital
                var startingCapital = Convert.ToDecimal(dictEquity.FirstOrDefault().Value);

                // Compute portfolio statistics
                var stats = new PortfolioStatistics(profitLoss, equity, listPerformance, listBenchmark, startingCapital);

                result.SetItem("Average Win (%)", Convert.ToDouble(stats.AverageWinRate * 100).ToPython());
                result.SetItem("Average Loss (%)", Convert.ToDouble(stats.AverageLossRate * 100).ToPython());
                result.SetItem("Compounding Annual Return (%)", Convert.ToDouble(stats.CompoundingAnnualReturn * 100m).ToPython());
                result.SetItem("Drawdown (%)", Convert.ToDouble(stats.Drawdown * 100).ToPython());
                result.SetItem("Expectancy", Convert.ToDouble(stats.Expectancy).ToPython());
                result.SetItem("Net Profit (%)", Convert.ToDouble(stats.TotalNetProfit * 100).ToPython());
                result.SetItem("Sharpe Ratio", Convert.ToDouble(stats.SharpeRatio).ToPython());
                result.SetItem("Win Rate (%)", Convert.ToDouble(stats.WinRate * 100).ToPython());
                result.SetItem("Loss Rate (%)", Convert.ToDouble(stats.LossRate * 100).ToPython());
                result.SetItem("Profit-Loss Ratio", Convert.ToDouble(stats.ProfitLossRatio).ToPython());
                result.SetItem("Alpha", Convert.ToDouble(stats.Alpha).ToPython());
                result.SetItem("Beta", Convert.ToDouble(stats.Beta).ToPython());
                result.SetItem("Annual Standard Deviation", Convert.ToDouble(stats.AnnualStandardDeviation).ToPython());
                result.SetItem("Annual Variance", Convert.ToDouble(stats.AnnualVariance).ToPython());
                result.SetItem("Information Ratio", Convert.ToDouble(stats.InformationRatio).ToPython());
                result.SetItem("Tracking Error", Convert.ToDouble(stats.TrackingError).ToPython());
                result.SetItem("Treynor Ratio", Convert.ToDouble(stats.TreynorRatio).ToPython());

                return result;
            }
        }

        /// <summary>
        /// Converts a pandas.Series into a <see cref="SortedDictionary{DateTime, Double}"/>
        /// </summary>
        /// <param name="series">pandas.Series to be converted</param>
        /// <returns><see cref="SortedDictionary{DateTime, Double}"/> with pandas.Series information</returns>
        private SortedDictionary<DateTime, double> GetDictionaryFromSeries(PyObject series)
        {
            var dictionary = new SortedDictionary<DateTime, double>();

            var pyDict = new PyDict(((dynamic)series).to_dict());
            foreach (PyObject item in pyDict.Items())
            {
                var key = (DateTime)item[0].AsManagedObject(typeof(DateTime));
                var value = (double)item[1].AsManagedObject(typeof(double));
                dictionary.Add(key, value);
            }

            return dictionary;
        }

        /// <summary>
        /// Calculates the daily rate of change
        /// </summary>
        /// <param name="dictionary"><see cref="IDictionary{DateTime, Double}"/> with prices keyed by time</param>
        /// <returns><see cref="List{Double}"/> with daily rate of change</returns>
        private List<double> CalculateDailyRateOfChange(IDictionary<DateTime, double> dictionary)
        {
            var daily = dictionary.GroupBy(kvp => kvp.Key.Date)
                .ToDictionary(x => x.Key, v => v.LastOrDefault().Value)
                .Values.ToArray();

            var rocp = new double[daily.Length];
            for (var i = 1; i < daily.Length; i++)
            {
                rocp[i] = (daily[i] - daily[i - 1]) / daily[i - 1];
            }
            rocp[0] = 0;

            return rocp.ToList();
        }

        /// <summary>
        /// Gets the historical data of an indicator and convert it into pandas.DataFrame
        /// </summary>
        /// <param name="indicator">Indicator</param>
        /// <param name="history">Historical data used to calculate the indicator</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame containing the historical data of <param name="indicator"></returns>
        private PyObject Indicator(IndicatorBase<IndicatorDataPoint> indicator, IEnumerable<Slice> history, Func<IBaseData, decimal> selector = null)
        {
            // Reset the indicator
            indicator.Reset();

            // Create a dictionary of the properties
            var name = indicator.GetType().Name;

            var properties = indicator.GetType().GetProperties()
                .Where(x => x.PropertyType.IsGenericType)
                .ToDictionary(x => x.Name, y => new List<IndicatorDataPoint>());
            properties.Add(name, new List<IndicatorDataPoint>());

            indicator.Updated += (s, e) =>
            {
                if (!indicator.IsReady)
                {
                    return;
                }

                foreach (var kvp in properties)
                {
                    var dataPoint = kvp.Key == name ? e : GetPropertyValue(s, kvp.Key + ".Current");
                    kvp.Value.Add((IndicatorDataPoint)dataPoint);
                }
            };

            selector = selector ?? (x => x.Value);

            history.PushThrough(bar =>
            {
                var value = selector(bar);
                indicator.Update(bar.EndTime, value);
            });

            return PandasConverter.GetIndicatorDataFrame(properties);
        }

        /// <summary>
        /// Gets the historical data of an bar indicator and convert it into pandas.DataFrame
        /// </summary>
        /// <param name="indicator">Bar indicator</param>
        /// <param name="history">Historical data used to calculate the indicator</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame containing the historical data of <param name="indicator"></returns>
        private PyObject Indicator<T>(IndicatorBase<T> indicator, IEnumerable<Slice> history, Func<IBaseData, T> selector = null)
            where T : IBaseData
        {
            // Reset the indicator
            indicator.Reset();

            // Create a dictionary of the properties
            var name = indicator.GetType().Name;

            var properties = indicator.GetType().GetProperties()
                .Where(x => x.PropertyType.IsGenericType)
                .ToDictionary(x => x.Name, y => new List<IndicatorDataPoint>());
            properties.Add(name, new List<IndicatorDataPoint>());

            indicator.Updated += (s, e) =>
            {
                if (!indicator.IsReady)
                {
                    return;
                }

                foreach (var kvp in properties)
                {
                    var dataPoint = kvp.Key == name ? e : GetPropertyValue(s, kvp.Key + ".Current");
                    kvp.Value.Add((IndicatorDataPoint)dataPoint);
                }
            };

            selector = selector ?? (x => (T)x);

            history.PushThrough(bar => indicator.Update(selector(bar)));

            return PandasConverter.GetIndicatorDataFrame(properties);
        }

        /// <summary>
        /// Gets a value of a property
        /// </summary>
        /// <param name="baseData">Object with the desired property</param>
        /// <param name="fullName">Property name</param>
        /// <returns>Property value</returns>
        private object GetPropertyValue(object baseData, string fullName)
        {
            foreach (var name in fullName.Split('.'))
            {
                if (baseData == null) return null;

                var info = baseData.GetType().GetProperty(name);

                baseData = info?.GetValue(baseData, null);
            }

            return baseData;
        }

        /// <summary>
        /// Get all fundamental data for given symbols
        /// </summary>
        /// <param name="symbols">The symbols to retrieve fundamental data for</param>
        /// <param name="start">The start date of selected data</param>
        /// <param name="end">The end date of selected data</param>
        /// <returns>DataDictionary of Enumerable IBaseData</returns>
        private Dictionary<DateTime, DataDictionary<dynamic>> GetAllFundamental(IEnumerable<Symbol> symbols, string selector, DateTime? start = null, DateTime? end = null)
        {
            //SubscriptionRequest does not except nullable DateTimes, so set a startTime and endTime
            var startTime = start.HasValue ? (DateTime)start : QuantConnect.Time.BeginningOfTime;
            var endTime = end.HasValue ? (DateTime) end : DateTime.UtcNow.Date;

            //Collection to store our results
            var data = new Dictionary<DateTime, DataDictionary<dynamic>>();

            //Build factory
            var factory = new FineFundamentalSubscriptionEnumeratorFactory(false);

            //Get all data for each symbol and fill our dictionary
            var options = new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount };
            Parallel.ForEach(symbols, options, symbol =>
            {
                var config = new SubscriptionDataConfig(
                        typeof(FineFundamental),
                        symbol,
                        Resolution.Daily,
                        TimeZones.NewYork,
                        TimeZones.NewYork,
                        false,
                        false,
                        false
                    );
                var security = Securities.CreateSecurity(symbol, config);
                var request = new SubscriptionRequest(false, null, security, config, startTime.ConvertToUtc(TimeZones.NewYork), endTime.ConvertToUtc(TimeZones.NewYork));
                using (var enumerator = factory.CreateEnumerator(request, _dataProvider))
                {
                    while (enumerator.MoveNext())
                    {
                        var dataPoint = string.IsNullOrWhiteSpace(selector)
                            ? enumerator.Current
                            : GetPropertyValue(enumerator.Current, selector);

                        lock (data)
                        {
                            if (!data.ContainsKey(enumerator.Current.Time))
                            {
                                data[enumerator.Current.Time] = new DataDictionary<dynamic>(enumerator.Current.Time);
                            }
                            data[enumerator.Current.Time].Add(enumerator.Current.Symbol, dataPoint);
                        }
                    }
                }
            });
            return data;
        }
    }
}


text:
package com.etiennelawlor.trestle.library;

import android.graphics.Typeface;
import android.text.TextUtils;
import android.text.style.ClickableSpan;

/**
 * Created by etiennelawlor on 6/1/15.
 */
public class Span {

    // region Member Variables
    private String Text;
    private Integer ForegroundColor;
    private Integer BackgroundColor;
    private Float RelativeSize;
    private Integer AbsoluteSize;
    private android.graphics.Typeface Typeface;
    private Boolean IsUrl;
    private Boolean IsUnderline;
    private Boolean IsStrikethru;
    private Integer QuoteColor;
    private Boolean IsSubscript;
    private Boolean IsSuperscript;
    private String Regex;
    private android.text.style.ClickableSpan ClickableSpan;
    private Float ScaleX;

    // endregion

    // region Constructor
    private Span(Builder builder) {
        Text = builder.Text;
        ForegroundColor = builder.ForegroundColor;
        BackgroundColor = builder.BackgroundColor;
        Typeface = builder.Typeface;
        RelativeSize = builder.RelativeSize;
        AbsoluteSize = builder.AbsoluteSize;
        IsUrl = builder.IsUrl;
        IsUnderline = builder.IsUnderline;
        IsStrikethru = builder.IsStrikethru;
        QuoteColor = builder.QuoteColor;
        IsSubscript = builder.IsSubscript;
        IsSuperscript = builder.IsSuperscript;
        Regex = builder.Regex;
        ClickableSpan = builder.ClickableSpan;
        ScaleX = builder.ScaleX;
    }
    // endregion

    // region Getters
    public String getText() {
        if (TextUtils.isEmpty(Text)) {
            return "";
        } else {
            return Text;
        }
    }

    public Integer getForegroundColor() {
        if (ForegroundColor == null)
            return -1;
        else
            return ForegroundColor;
    }

    public Integer getBackgroundColor() {
        if (BackgroundColor == null)
            return -1;
        else
            return BackgroundColor;
    }

    public android.graphics.Typeface getTypeface() {
        return Typeface;
    }

    public Float getRelativeSize() {
        if (RelativeSize == null)
            return 0.0F;
        else
            return RelativeSize;
    }

    public Integer getAbsoluteSize() {
        if (AbsoluteSize == null)
            return -1;
        else
            return AbsoluteSize;
    }

    public Boolean isUrl() {
        if (IsUrl == null)
            return false;
        else
            return IsUrl;
    }

    public Boolean isUnderline() {
        if (IsUnderline == null)
            return false;
        else
            return IsUnderline;
    }

    public Boolean isStrikethru() {
        if (IsStrikethru == null)
            return false;
        else
            return IsStrikethru;
    }

    public Integer getQuoteColor() {
        if (QuoteColor == null)
            return -1;
        else
            return QuoteColor;
    }

    public Boolean isSubscript() {
        if (IsSubscript == null)
            return false;
        else
            return IsSubscript;
    }

    public Boolean isSuperscript() {
        if (IsSuperscript == null)
            return false;
        else
            return IsSuperscript;
    }

    public String getRegex() {
        if (TextUtils.isEmpty(Regex)) {
            return "";
        } else {
            return Regex;
        }
    }

    public android.text.style.ClickableSpan getClickableSpan() {
        return ClickableSpan;
    }

    public Float getScaleX() {
        if (ScaleX == null)
            return 0.0F;
        else
            return ScaleX;
    }

    // endregion

    // region Builder class

    public static class Builder {
        // Required parameters
        private final String Text;

        // Optional parameters - initialized to default values
        private Integer ForegroundColor = 0;
        private Integer BackgroundColor = 0;
        private android.graphics.Typeface Typeface = null;
        private Float RelativeSize = 0.0F;
        private Integer AbsoluteSize = 0;
        private Boolean IsUrl = false;
        private Boolean IsUnderline = false;
        private Boolean IsStrikethru = false;
        private Integer QuoteColor = 0;
        private Boolean IsSubscript = false;
        private Boolean IsSuperscript = false;
        private String Regex = "";
        private ClickableSpan ClickableSpan = null;
        private Float ScaleX = 0.0F;

        public Builder(String text) {
            this.Text = text;
        }

        public Builder foregroundColor(Integer fgColor) {
            ForegroundColor = fgColor;
            return this;
        }

        public Builder backgroundColor(Integer bgColor) {
            BackgroundColor = bgColor;
            return this;
        }

        public Builder typeface(Typeface typeface) {
            Typeface = typeface;
            return this;
        }

        public Builder relativeSize(Float relativeSize) {
            RelativeSize = relativeSize;
            return this;
        }

        public Builder absoluteSize(Integer absoluteSize) {
            AbsoluteSize = absoluteSize;
            return this;
        }

        public Builder isUrl(Boolean isUrl) {
            IsUrl = isUrl;
            return this;
        }

        public Builder isUnderline(Boolean isUnderline) {
            IsUnderline = isUnderline;
            return this;
        }

        public Builder isStrikethru(Boolean isStrikethru) {
            IsStrikethru = isStrikethru;
            return this;
        }

        public Builder quoteColor(Integer quoteColor) {
            QuoteColor = quoteColor;
            return this;
        }

        public Builder subscript(Boolean isSubscript) {
            IsSubscript = isSubscript;
            return this;
        }

        public Builder superscript(Boolean isSuperscript) {
            IsSuperscript = isSuperscript;
            return this;
        }

        public Builder regex(String regex) {
            Regex = regex;
            return this;
        }

        public Builder clickableSpan(ClickableSpan clickableSpan) {
            ClickableSpan = clickableSpan;
            return this;
        }

        public Builder scaleX(Float scaleX) {
            ScaleX = scaleX;
            return this;
        }

        public Span build() {
            return new Span(this);
        }
    }
    // endregion

}


text:
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class AddFieldsToUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table(config('laravel-acl.tables.user'), function (Blueprint $table) {
            $table->integer('level_id')->unsigned()->nullable();

            $table->index('level_id');
            $table->foreign('level_id')->references('id')->on(config('laravel-acl.tables.level'));
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table(config('laravel-acl.tables.user'), function (Blueprint $table) {
            $table->dropForeign(['level_id']);
            $table->dropColumn('level_id');
        });
    }
}


text:
package com.google.gerrit.acceptance.rest.config;

import static com.google.common.truth.Truth.assertThat;

import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.RestResponse;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.server.restapi.config.ListTasks.TaskInfo;
import com.google.gson.reflect.TypeToken;
import java.util.List;
import org.junit.Test;

public class GetTaskIT extends AbstractDaemonTest {

  @Test
  public void getTask() throws Exception {
    RestResponse r = adminRestSession.get("/config/server/tasks/" + getLogFileCompressorTaskId());
    r.assertOK();
    TaskInfo info = newGson().fromJson(r.getReader(), new TypeToken<TaskInfo>() {}.getType());
    assertThat(info.id).isNotNull();
    Long.parseLong(info.id, 16);
    assertThat(info.command).isEqualTo("Log File Compressor");
    assertThat(info.startTime).isNotNull();
  }

  @Test
  public void getTask_NotFound() throws Exception {
    userRestSession.get("/config/server/tasks/" + getLogFileCompressorTaskId()).assertNotFound();
  }

  @Nullable
  private String getLogFileCompressorTaskId() throws Exception {
    RestResponse r = adminRestSession.get("/config/server/tasks/");
    List<TaskInfo> result =
        newGson().fromJson(r.getReader(), new TypeToken<List<TaskInfo>>() {}.getType());
    r.consume();
    for (TaskInfo info : result) {
      if ("Log File Compressor".equals(info.command)) {
        return info.id;
      }
    }
    return null;
  }
}


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Continuation (Kurento JSON-RPC Client 6.6.2-SNAPSHOT API)</title>
<meta name="date" content="2017-04-03">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Kurento JSON-RPC Client 6.6.2-SNAPSHOT

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.kurento.jsonrpc.client

Interface Continuation<F>

Type Parameters:

F - The data type of the callback´s response in case of successful outcome.

public interface Continuation<F>

This interface is to be used in asynchronous calls to the media server.

Since:

2.0.0

Author:

Luis López (llopez@gsyc.es), Ivan Gracia (igracia@gsyc.es)

Method Summary

Methods

Modifier and Type
Method and Description

void
onError(Throwable cause)

This method gets called when the operation fails

void
onSuccess(F result)

This method is called when the operation succeeds

Method Detail

onSuccess

void onSuccess(F result)

This method is called when the operation succeeds

Parameters:

result -

onError

void onError(Throwable cause)

This method gets called when the operation fails

Parameters:

cause - The cause of the failure

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Kurento JSON-RPC Client 6.6.2-SNAPSHOT

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2017 Kurento. All rights reserved.


text:
! { dg-do run }
! { dg-options "-fshort-enums" }
! Program to test enumerations when option -fshort-enums is given

program main
  implicit none
  enum, bind (c)
    enumerator :: red, black = 127
    enumerator blue
  end enum
  if (red /= 0) call abort
  if (black /= 127) call abort
  if (blue /= 128) call abort
end program main


text:
package Thread;

/**
 * Created by cnkaptan on 4/27/15.
 */
public class Sync {
    public static void main(String[] args){
        int a[] = {1, 2, 3, 4, 5};
        NewThread mt1 = new NewThread("Child #1", a);
        NewThread mt2 = new NewThread("Child #2", a);

        try {
            mt1.thrd.join();
            mt2.thrd.join();
        }
        catch(InterruptedException exc) {
            System.out.println("Main thread interrupted.");
        }
    }
}

class NewThread implements Runnable{
    Thread thrd;
    static SumArray sa = new SumArray();
    int a[];
    int answer;
    // Construct a new thread.
    NewThread(String name, int nums[]) {
        thrd = new Thread(this, name);
        a = nums;
        thrd.start(); // start the thread
    }
    // Begin execution of new thread.
    public void run() {
        int sum;
        System.out.println(thrd.getName() + " starting.");
        answer = sa.sumArray(a);
        System.out.println("Sum for " + thrd.getName() +
                " is " + answer);
        System.out.println(thrd.getName() + " terminating.");
    }
}

class SumArray{
    private int sum;

        synchronized int sumArray(int[] nums){
        sum = 0; // reset sum

        for (int i = 0; i < nums.length; i++) {
            sum += nums[i];
            System.out.println("Running total for " +
                    Thread.currentThread().getName() + " is " + sum);
        }
        try {
            Thread.sleep(10); // allow task-switch
        }
        catch(InterruptedException exc) {
            System.out.println("Thread interrupted.");
        }

        return sum;
    }
}


text:
<!DOCTYPE html>

    <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
    <meta content='width=device-width, initial-scale=1.0' name='viewport'>
    <title>Your Message Subject or Title</title>

Password reset

                                            Username:
                                            john.doe

                                            E-mail:
                                            john@doe.com

                                            Eos dolores vel velit perspiciatis qui asperiores vitae esse quas alias aperiam tenetur illum consectetur ut sit sint quam ut possimus eaque nihil et veritatis doloremque eius maiores et quo nam quia enim cum ea sequi illo quod voluptatem distinctio voluptas et pariatur quia est.

Change my password


text:
package models.daos

import javax.inject.Inject

import models.daos.drivers.{Neo4j, NeoParsers}
import models.{Feedback, Score}
import play.api.libs.json.{JsValue, Json}

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future

class ScoreDAO @Inject()(neo: Neo4j,
                        parser: NeoParsers) {

  /**
   * Saves a score into the data store.
   *
   * @param username username of the user who score the repo
   * @param repoName repository which was scored
   * @param score score given by the user to the repository
   * @return saved score.
   */
  def save(username: String, repoName: String, score: Score): Future[Option[Score]] = {
    neo.cypher(
      """
        MATCH (u:User),(r:Repository)
        WHERE u.username={username} AND r.name={repoName}
        CREATE UNIQUE (u)-[c:SCORED {props}]->(r)
        RETURN c
      """,
      Json.obj(
        "username" -> username,
        "repoName" -> repoName,
        "props" -> Json.toJson(score)
      )
    ).map(parser.parseNeoScore)
  }

  /**
   * Find a score from a user to a repo
   *
   * @param username username of the user who score the repo
   * @param repoName repository which was scored
   * @return saved score.
   */
  def find(username: String, repoName: String): Future[Option[Score]] = {
    neo.cypher(
      """
        MATCH (u:User)-[c:SCORED]->(r:Repository)
        WHERE u.username={username} AND r.name={repoName}
        RETURN c
      """,
      Json.obj(
        "username" -> username,
        "repoName" -> repoName
      )
    ).map(parser.parseNeoScore)
  }

  /**
   * Delete a score from a user to a repo
   *
   * @param username username of the user who score the repo
   * @param repoName repository which was scored
   * @return Empty JsValue
   */
  def delete(username: String, repoName: String): Future[JsValue] = {
    neo.cypher(
      """
        MATCH (u:User)-[c:SCORED]->(r:Repository)
        WHERE u.username={username} AND r.name={repoName}
        DELETE c
      """,
      Json.obj(
        "username" -> username,
        "repoName" -> repoName
      )
    )
  }

  /**
   * Update a score from a user to a repo
   *
   * @param username username of the user who score the repo
   * @param repoName repository which was scored
   * @return
   */
  def update(username: String, repoName: String,score: Score): Future[Option[Score]] = {
    neo.cypher(
      """
        MATCH (u:User)-[c:SCORED]->(r:Repository)
        WHERE u.username={username} AND r.name={repoName}
        SET c={props}
        RETURN c
      """,
      Json.obj(
        "username" -> username,
        "repoName" -> repoName,
        "props" -> Json.toJson(score)
      )
    ).map(parser.parseNeoScore)
  }

  /**
   * Get all the scoring made for a repository corresponding to the page and items per page specified arguments.
   *
   * @param repoName name of the repository to get the scores from ("owner/repo")
   * @param page page number to get from the database. Default value to 1
   * @param itemsPerPage number of items to display in a database page
   * @return Seq of Feedback.
   */
  def findRepositoryFeedback(repoName: String, page: Int = 1, itemsPerPage: Int = 10): Future[Seq[Feedback]] = {

    if (page < 1){
      throw new Exception("Page must be a positive non null integer")
    }

    neo.cypher(
      """
        MATCH (u:User)-[c:SCORED]->(r:Repository)
        WHERE r.name={repoName}
        RETURN c, u ORDER BY c.timestamp DESC SKIP {feedbackSkip} LIMIT {pageSize}
      """, Json.obj(
        "repoName" -> repoName,
        "feedbackSkip" -> (page - 1) * itemsPerPage,
        "pageSize" -> itemsPerPage
      )
    ).map(parser.parseNeoFeedbackList)
  }

  /**
   * Get all the scoring made for a repository corresponding to the page and items per page specified arguments.
   *
   * @param repoName name of the repository to get the scores from ("owner/repo")
   * @param page page number to get from the database. Default value to 1
   * @param itemsPerPage number of items to display in a database page
   * @return Seq of Scores.
   */
  def findRepositoryScores(repoName: String, page: Int=1, itemsPerPage: Int=10): Future[Seq[Score]] = {
    if (page < 1){
      throw new Exception("Page must be a positive non null integer")
    }

    neo.cypher(
      """
        MATCH (u:User)-[c:SCORED]->(r:Repository)
        WHERE r.name={repoName}
        RETURN c ORDER BY c.timestamp DESC SKIP {scoreSkip} LIMIT {pageSize}
      """, Json.obj(
        "repoName" -> repoName,
        "scoreSkip" -> (page - 1) * itemsPerPage,
        "pageSize" -> itemsPerPage
      )
    ).map(parser.parseNeoScoreList)
  }

  /**
   * Gets the number of feedback there is for a given repository
   *
   * @param repoName name of the repository to get the feedback count from
   * @return
   */
  def countRepositoryFeedback(repoName: String): Future[Int] = {
    neo.cypher(
      """
      MATCH (u:User)-[c:SCORED]->(r:Repository)
      WHERE r.name={repoName}
      RETURN count(c) AS feedbackCount
      """,
      Json.obj("repoName" -> repoName)
    ).map(json => (((json \ "results")(0) \ "data")(0) \ "row")(0).as[Int])
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/widget_meals_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:background="#80000000"
        android:orientation="vertical">

    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Reichenbachstraße"
            android:drawableStart="@drawable/ic_fork_and_knife_widget"
            android:drawablePadding="6dp"
            android:textAppearance="@style/Widget.HTW.Meals.Header"
            tools:ignore="HardcodedText" />

    <TextView
            android:id="@+id/tvDate"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/Widget.HTW.Meals.Date"
            tools:text="16. September"/>

    <LinearLayout
            android:id="@+id/llMeals"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="8dp"
            android:padding="@dimen/default_space"
            android:background="@drawable/widget_background"/>

</LinearLayout>


text:
/* globals $ */
'use strict';

angular.module('moviefanApp')
    .directive('moviefanAppPager', function() {
        return {
            templateUrl: 'scripts/components/form/pager.html'
        };
    });


text:
<?php

namespace CloudCreativity\LaravelJsonApi\Console\Commands;

/**
 * Class MakeAdapter
 *
 * @package CloudCreativity\LaravelJsonApi
 */
class MakeAdapter extends AbstractGeneratorCommand
{

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'make:json-api:adapter';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Create a new JSON API resource adapter';

    /**
     * The type of class being generated.
     *
     * @var string
     */
    protected $type = 'Adapter';
}


text:
Sudoku project that will be coded live at http://www.twitch.tv/brambelthorn

Check out notes.txt for onging information on the project.  Feel free to fork and run.


text:
module Ceely
  module Scales
    module Pythagorean
      # A Pythagorean::Note is a Note with the syntonic comma defined
      class Note < Ceely::Note
        include Ceely::Mixins::SyntonicComma
      end

      # A Pythagorean::Scale is a Scale with a set Pythagorean::Notes
      class Scale < Ceely::Scale
        NOTE_NAMES = %w{ C C# D D# E F Gb F# G G# A A# B }
        NOTE_TYPES = %w{ 1 m2 2 m3 M3 4 b5(b) b5(#) 5 m6 M6 m7 M7 }
        MODE_NAMES = %w{ ionian dorian phrygian lydian mixolydian aeolian locrian }

        def initialize(fundamental_frequency=528.0, *args)
          size = (args.shift || 13)
          offset = (args.shift || -1)
          note_names = (args.shift || NOTE_NAMES)
          note_types = (args.shift || NOTE_TYPES)
          # A pythagorean note has a factor equal to 3/2
          # raised to the power of the index
          factor = -> note { Rational(3, 2)**note.index }
          super(fundamental_frequency, factor, size, offset, note_names, note_types)
        end

        MODE_NAMES.each_with_index do |mode, index|
          define_method(mode) do |octave|
            mode_index = index + (octave*(size+1))
            nth_mode(mode_index)
          end
        end

        # Play the named mode in the given octave
        def play_mode(mode, octave, amplitude, &block)
          raise ArgumentError.new("Don't know that mode") unless MODE_NAMES.include?(mode)
          notes = send(mode.to_sym, octave)
          play_notes(notes, amplitude, &block)
        end

        # Override the circle of fifths to reject
        # one of the diminished fifths, default to Gb
        def circle_of_fifths(diminished_fifth_reject="Gb")
          return @circle_of_fifth if defined? @circle_of_fifths
          @circle_of_fifths = []
          # Reject one of the diminished fifths
          sorted_notes.reject! { |note| note.name.eql? diminished_fifth_reject }
          # Start at the beginning
          @circle_of_fifths << sorted_notes.first
          (1..(sorted_notes.size-1)).step do
            @circle_of_fifths << sorted_notes.rotate!(7).first
          end
          @circle_of_fifths
        end
      end
    end
  end
end


text:
title: Causing a VS Web Project to fail compilation when content is missing
tags: TFS
date: 2013-01-11 13:48:13 +10:00
---

Sometimes things go wrong. For example, when files are not on your local disk when you expect them to be. I see this pop up every now and then when working in a team environment or even as a single develop across multiple machines. Usually it is because something has not be submitted into source control. Maybe the file was never bound to source control in the first place. I have seen Visual Studio simply miss files as well.

Normally this is not a problem. The compiler will complain if a C# class file is missing because it can't do its job. Unfortunately a Web project does not throw a compiler error when a content file is missing. Thankfully there is an easy fix.

<!--more-->

Take a new Web project for example.

![][0]

We can simulate this issue by simply going down into the file system and renaming Site.css to another name.

![][1]

The project will now identify the missing file in Solution Explorer if you refresh the window.

![][2]

Ok, but what about a build.

```text
1>------ Rebuild All started: Project: MvcApplication1, Configuration: Debug Any CPU ------
1>  MvcApplication1 -> c:\Dev\MvcApplication1\bin\MvcApplication1.dll
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

Build Summary
-------------
00:00.883 - Success - Debug Any CPU - MvcApplication1\MvcApplication1.csproj

Total build time: 00:00.893

========== Rebuild All: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
```

I see this as a problem. You can check this in and every other developer/machine will be essentially broken. Worse still, any TFS gated build will pass as well. There is therefore no way out of the box to ensure that you do not corrupt your code line.

The trick here is to modify the project file. Edit the project file and you will find the following at the bottom:

```xml
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
     Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target> -->
```

We want to remove the comments surrounding BeforeBuild and change it to the following:

```xml
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
     Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="AfterBuild">
</Target> -->
<target name="BeforeBuild">
    <itemgroup>
        <missingcontentfiles include="@(Content)" condition="!Exists(%(Content.FullPath))" />
    </itemgroup>
    <message text="Item: %(Content.FullPath)" />
    <message text="Missing: %(MissingContentFiles.FullPath)" />
    <error text="Content file '%(MissingContentFiles.FullPath)' was not found." condition="'@(MissingContentFiles)' != ''" continueonerror="true" />
    <error text="One or more content files are missing." condition="'@(MissingContentFiles)' != ''" />
</target>
```

This will output warnings for each file that is missing, then fail the compilation. This allows you to see multiple files that are missing before compilation is halted.

```text
1>------ Build started: Project: MvcApplication1, Configuration: Debug Any CPU ------
1>C:\Dev\MvcApplication1\MvcApplication1.csproj(329,5): warning : Content file 'C:\Dev\MvcApplication1\Scripts\jquery.validate.min.js' was not found.
1>C:\Dev\MvcApplication1\MvcApplication1.csproj(329,5): warning : Content file 'C:\Dev\MvcApplication1\Content\Site.css' was not found.
1>C:\Dev\MvcApplication1\MvcApplication1.csproj(330,5): error : One or more content files are missing.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Build Summary
-------------
00:00.649 - Failed  - Debug Any CPU - MvcApplication1\MvcApplication1.csproj
Total build time: 00:00.910
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
```

![][3]

Job done.
[0]: /files/image_150.png
[1]: /files/image_151.png
[2]: /files/image_152.png
[3]: /files/image_153.png


text:
using namespace llvm;

namespace {

// All possible address modes.
typedef struct Address {
  enum { RegBase, FrameIndexBase } BaseType;

  union {
    unsigned Reg;
    int FI;
  } Base;

  int64_t Offset;

  // Innocuous defaults for our address.
  Address() : BaseType(RegBase), Offset(0) { Base.Reg = 0; }
} Address;

class MipsFastISel final : public FastISel {

  /// Subtarget - Keep a pointer to the MipsSubtarget around so that we can
  /// make the right decision when generating code for different targets.
  Module &M;
  const TargetMachine &TM;
  const TargetInstrInfo &TII;
  const TargetLowering &TLI;
  const MipsSubtarget *Subtarget;
  MipsFunctionInfo *MFI;

  // Convenience variables to avoid some queries.
  LLVMContext *Context;

  bool TargetSupported;

public:
  explicit MipsFastISel(FunctionLoweringInfo &funcInfo,
                        const TargetLibraryInfo *libInfo)
      : FastISel(funcInfo, libInfo),
        M(const_cast<Module &>(*funcInfo.Fn->getParent())),
        TM(funcInfo.MF->getTarget()), TII(*TM.getInstrInfo()),
        TLI(*TM.getTargetLowering()),
        Subtarget(&TM.getSubtarget<MipsSubtarget>()) {
    MFI = funcInfo.MF->getInfo<MipsFunctionInfo>();
    Context = &funcInfo.Fn->getContext();
    TargetSupported = ((Subtarget->getRelocationModel() == Reloc::PIC_) &&
                       (Subtarget->hasMips32r2() && (Subtarget->isABI_O32())));
  }

  bool TargetSelectInstruction(const Instruction *I) override;
  unsigned TargetMaterializeConstant(const Constant *C) override;

  bool ComputeAddress(const Value *Obj, Address &Addr);

private:
  bool EmitLoad(MVT VT, unsigned &ResultReg, Address &Addr,
                unsigned Alignment = 0);
  bool EmitStore(MVT VT, unsigned SrcReg, Address &Addr,
                 unsigned Alignment = 0);
  bool SelectLoad(const Instruction *I);
  bool SelectRet(const Instruction *I);
  bool SelectStore(const Instruction *I);

  bool isTypeLegal(Type *Ty, MVT &VT);
  bool isLoadTypeLegal(Type *Ty, MVT &VT);

  unsigned MaterializeFP(const ConstantFP *CFP, MVT VT);
  unsigned MaterializeGV(const GlobalValue *GV, MVT VT);
  unsigned MaterializeInt(const Constant *C, MVT VT);
  unsigned Materialize32BitInt(int64_t Imm, const TargetRegisterClass *RC);

  // for some reason, this default is not generated by tablegen
  // so we explicitly generate it here.
  //
  unsigned FastEmitInst_riir(uint64_t inst, const TargetRegisterClass *RC,
                             unsigned Op0, bool Op0IsKill, uint64_t imm1,
                             uint64_t imm2, unsigned Op3, bool Op3IsKill) {
    return 0;
  }

  MachineInstrBuilder EmitInst(unsigned Opc) {
    return BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(Opc));
  }

  MachineInstrBuilder EmitInst(unsigned Opc, unsigned DstReg) {
    return BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(Opc),
                   DstReg);
  }

  MachineInstrBuilder EmitInstStore(unsigned Opc, unsigned SrcReg,
                                    unsigned MemReg, int64_t MemOffset) {
    return EmitInst(Opc).addReg(SrcReg).addReg(MemReg).addImm(MemOffset);
  }

  MachineInstrBuilder EmitInstLoad(unsigned Opc, unsigned DstReg,
                                      unsigned MemReg, int64_t MemOffset) {
    return EmitInst(Opc, DstReg).addReg(MemReg).addImm(MemOffset);
  }

#include "MipsGenFastISel.inc"
};

bool MipsFastISel::isTypeLegal(Type *Ty, MVT &VT) {
  EVT evt = TLI.getValueType(Ty, true);
  // Only handle simple types.
  if (evt == MVT::Other || !evt.isSimple())
    return false;
  VT = evt.getSimpleVT();

  // Handle all legal types, i.e. a register that will directly hold this
  // value.
  return TLI.isTypeLegal(VT);
}

bool MipsFastISel::isLoadTypeLegal(Type *Ty, MVT &VT) {
  if (isTypeLegal(Ty, VT))
    return true;
  // We will extend this in a later patch:
  //   If this is a type than can be sign or zero-extended to a basic operation
  //   go ahead and accept it now.
  if (VT == MVT::i8 || VT == MVT::i16)
    return true;
  return false;
}

bool MipsFastISel::ComputeAddress(const Value *Obj, Address &Addr) {
  // This construct looks a big awkward but it is how other ports handle this
  // and as this function is more fully completed, these cases which
  // return false will have additional code in them.
  //
  if (isa<Instruction>(Obj))
    return false;
  else if (isa<ConstantExpr>(Obj))
    return false;
  Addr.Base.Reg = getRegForValue(Obj);
  return Addr.Base.Reg != 0;
}

bool MipsFastISel::EmitLoad(MVT VT, unsigned &ResultReg, Address &Addr,
                            unsigned Alignment) {
  //
  // more cases will be handled here in following patches.
  //
  unsigned Opc;
  switch (VT.SimpleTy) {
  case MVT::i32: {
    ResultReg = createResultReg(&Mips::GPR32RegClass);
    Opc = Mips::LW;
    break;
  }
  case MVT::i16: {
    ResultReg = createResultReg(&Mips::GPR32RegClass);
    Opc = Mips::LHu;
    break;
  }
  case MVT::i8: {
    ResultReg = createResultReg(&Mips::GPR32RegClass);
    Opc = Mips::LBu;
    break;
  }
  case MVT::f32: {
    ResultReg = createResultReg(&Mips::FGR32RegClass);
    Opc = Mips::LWC1;
    break;
  }
  case MVT::f64: {
    ResultReg = createResultReg(&Mips::AFGR64RegClass);
    Opc = Mips::LDC1;
    break;
  }
  default:
    return false;
  }
  EmitInstLoad(Opc, ResultReg, Addr.Base.Reg, Addr.Offset);
  return true;
}

// Materialize a constant into a register, and return the register
// number (or zero if we failed to handle it).
unsigned MipsFastISel::TargetMaterializeConstant(const Constant *C) {
  EVT CEVT = TLI.getValueType(C->getType(), true);

  // Only handle simple types.
  if (!CEVT.isSimple())
    return 0;
  MVT VT = CEVT.getSimpleVT();

  if (const ConstantFP *CFP = dyn_cast<ConstantFP>(C))
    return MaterializeFP(CFP, VT);
  else if (const GlobalValue *GV = dyn_cast<GlobalValue>(C))
    return MaterializeGV(GV, VT);
  else if (isa<ConstantInt>(C))
    return MaterializeInt(C, VT);

  return 0;
}

bool MipsFastISel::EmitStore(MVT VT, unsigned SrcReg, Address &Addr,
                             unsigned Alignment) {
  //
  // more cases will be handled here in following patches.
  //
  unsigned Opc;
  switch (VT.SimpleTy) {
  case MVT::i8:
    Opc = Mips::SB;
    break;
  case MVT::i16:
    Opc = Mips::SH;
    break;
  case MVT::i32:
    Opc = Mips::SW;
    break;
  case MVT::f32:
    Opc = Mips::SWC1;
    break;
  case MVT::f64:
    Opc = Mips::SDC1;
    break;
  default:
    return false;
  }
  EmitInstStore(Opc, SrcReg, Addr.Base.Reg, Addr.Offset);
  return true;
}

bool MipsFastISel::SelectLoad(const Instruction *I) {
  // Atomic loads need special handling.
  if (cast<LoadInst>(I)->isAtomic())
    return false;

  // Verify we have a legal type before going any further.
  MVT VT;
  if (!isLoadTypeLegal(I->getType(), VT))
    return false;

  // See if we can handle this address.
  Address Addr;
  if (!ComputeAddress(I->getOperand(0), Addr))
    return false;

  unsigned ResultReg;
  if (!EmitLoad(VT, ResultReg, Addr, cast<LoadInst>(I)->getAlignment()))
    return false;
  UpdateValueMap(I, ResultReg);
  return true;
}

bool MipsFastISel::SelectStore(const Instruction *I) {
  Value *Op0 = I->getOperand(0);
  unsigned SrcReg = 0;

  // Atomic stores need special handling.
  if (cast<StoreInst>(I)->isAtomic())
    return false;

  // Verify we have a legal type before going any further.
  MVT VT;
  if (!isLoadTypeLegal(I->getOperand(0)->getType(), VT))
    return false;

  // Get the value to be stored into a register.
  SrcReg = getRegForValue(Op0);
  if (SrcReg == 0)
    return false;

  // See if we can handle this address.
  Address Addr;
  if (!ComputeAddress(I->getOperand(1), Addr))
    return false;

  if (!EmitStore(VT, SrcReg, Addr, cast<StoreInst>(I)->getAlignment()))
    return false;
  return true;
}

bool MipsFastISel::SelectRet(const Instruction *I) {
  const ReturnInst *Ret = cast<ReturnInst>(I);

  if (!FuncInfo.CanLowerReturn)
    return false;
  if (Ret->getNumOperands() > 0) {
    return false;
  }
  EmitInst(Mips::RetRA);
  return true;
}

bool MipsFastISel::TargetSelectInstruction(const Instruction *I) {
  if (!TargetSupported)
    return false;
  switch (I->getOpcode()) {
  default:
    break;
  case Instruction::Load:
    return SelectLoad(I);
  case Instruction::Store:
    return SelectStore(I);
  case Instruction::Ret:
    return SelectRet(I);
  }
  return false;
}
}

unsigned MipsFastISel::MaterializeFP(const ConstantFP *CFP, MVT VT) {
  int64_t Imm = CFP->getValueAPF().bitcastToAPInt().getZExtValue();
  if (VT == MVT::f32) {
    const TargetRegisterClass *RC = &Mips::FGR32RegClass;
    unsigned DestReg = createResultReg(RC);
    unsigned TempReg = Materialize32BitInt(Imm, &Mips::GPR32RegClass);
    EmitInst(Mips::MTC1, DestReg).addReg(TempReg);
    return DestReg;
  } else if (VT == MVT::f64) {
    const TargetRegisterClass *RC = &Mips::AFGR64RegClass;
    unsigned DestReg = createResultReg(RC);
    unsigned TempReg1 = Materialize32BitInt(Imm >> 32, &Mips::GPR32RegClass);
    unsigned TempReg2 =
        Materialize32BitInt(Imm & 0xFFFFFFFF, &Mips::GPR32RegClass);
    EmitInst(Mips::BuildPairF64, DestReg).addReg(TempReg2).addReg(TempReg1);
    return DestReg;
  }
  return 0;
}

unsigned MipsFastISel::MaterializeGV(const GlobalValue *GV, MVT VT) {
  // For now 32-bit only.
  if (VT != MVT::i32)
    return 0;
  const TargetRegisterClass *RC = &Mips::GPR32RegClass;
  unsigned DestReg = createResultReg(RC);
  const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV);
  bool IsThreadLocal = GVar && GVar->isThreadLocal();
  // TLS not supported at this time.
  if (IsThreadLocal)
    return 0;
  EmitInst(Mips::LW, DestReg).addReg(MFI->getGlobalBaseReg()).addGlobalAddress(
      GV, 0, MipsII::MO_GOT);
  return DestReg;
}
unsigned MipsFastISel::MaterializeInt(const Constant *C, MVT VT) {
  if (VT != MVT::i32 && VT != MVT::i16 && VT != MVT::i8 && VT != MVT::i1)
    return 0;
  const TargetRegisterClass *RC = &Mips::GPR32RegClass;
  const ConstantInt *CI = cast<ConstantInt>(C);
  int64_t Imm;
  if (CI->isNegative())
    Imm = CI->getSExtValue();
  else
    Imm = CI->getZExtValue();
  return Materialize32BitInt(Imm, RC);
}

unsigned MipsFastISel::Materialize32BitInt(int64_t Imm,
                                           const TargetRegisterClass *RC) {
  unsigned ResultReg = createResultReg(RC);

  if (isInt<16>(Imm)) {
    unsigned Opc = Mips::ADDiu;
    EmitInst(Opc, ResultReg).addReg(Mips::ZERO).addImm(Imm);
    return ResultReg;
  } else if (isUInt<16>(Imm)) {
    EmitInst(Mips::ORi, ResultReg).addReg(Mips::ZERO).addImm(Imm);
    return ResultReg;
  }
  unsigned Lo = Imm & 0xFFFF;
  unsigned Hi = (Imm >> 16) & 0xFFFF;
  if (Lo) {
    // Both Lo and Hi have nonzero bits.
    unsigned TmpReg = createResultReg(RC);
    EmitInst(Mips::LUi, TmpReg).addImm(Hi);
    EmitInst(Mips::ORi, ResultReg).addReg(TmpReg).addImm(Lo);
  } else {
    EmitInst(Mips::LUi, ResultReg).addImm(Hi);
  }
  return ResultReg;
}

namespace llvm {
FastISel *Mips::createFastISel(FunctionLoweringInfo &funcInfo,
                               const TargetLibraryInfo *libInfo) {
  return new MipsFastISel(funcInfo, libInfo);
}
}


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\select2\Select2;
use yii\helpers\ArrayHelper;

/* @var $this yii\web\View */
/* @var $model app\models\PelajarKelas */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin(); ?>

    <?php
	if($id_kelas>0){
		$model->id_kelas = $id_kelas;
	}
	if(\Yii::$app->user->can('Guru')){
		$datakelas = Yii::$app->getDb()->createCommand("SELECT kelas.id,concat(tingkatan,' - ',keterangan,' (',tahun,')') kelasinfo FROM `kelas` inner join sesi on kelas.id_sesi = sesi.id inner join ref_kelas on nama_kelas=ref_kelas.id WHERE id_guru IN (select id from guru where id_guru = '". Yii::$app->user->id ."') AND tahun >= YEAR(CURDATE()) ORDER by tahun,tingkatan ASC")->queryAll();
	}else{
		$datakelas = Yii::$app->getDb()->createCommand("SELECT kelas.id,concat(tingkatan,' ',keterangan,' - ',tahun) kelasinfo FROM `kelas` inner join sesi on kelas.id_sesi = sesi.id inner join ref_kelas on nama_kelas=ref_kelas.id WHERE tahun >= YEAR(CURDATE()) order by tahun,tingkatan ASC")->queryAll();
	}
	?>

	<?= $form->field($model, 'id_kelas')->widget(Select2::classname(),
		[
			'data' => ArrayHelper::map($datakelas,'id', 'kelasinfo'),
			'pluginOptions'=>[
				'allowClear'=>true
			],
			'options' => [
				'placeholder' => 'Carian Kelas'
			],
			'disabled'=>$id_kelas > 0 ? true : false
		])->label('Kelas Baru') ?>

	<?php
	if($id_kelas>0){
		echo $form->field($model, 'id_pelajar')->widget(Select2::classname(),['data' => ArrayHelper::map(app\models\Pelajar::find()->select(['id','concat(nama_pelajar," ",no_mykid) as value'])->asArray()->orderBy('nama_pelajar')->where(['id_status' => 1])->all(), 'id', 'value'), 'pluginOptions'=>['allowClear'=>true],'options' => ['placeholder' => 'Carian Pelajar']]);
	?>

		<button style="float:left;background-color: #286090;border-color: #204d74;" id="refresh_pelajar" class="btn" type="button">+ Tambah pelajar ke senarai dibawah</button>

	<?php
	}
	?>

        <?php
		if($id_kelas>0){
			//do nothing
		}else{
			echo Html::submitButton($model->isNewRecord ? 'Seterusnya' : 'Simpan', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
		}
		?>

    <?php ActiveForm::end(); ?>

<?php
	if($id_kelas>0){
	$this->registerJs('$("#refresh_pelajar").click(function(){
		$("#pelajar").html("loading..."),
				$.ajax({url: "viewpelajar?pelajar="+ $("#pelajarkelas-id_pelajar").val() +"&id_kelas=" + $("#pelajarkelas-id_kelas").val() , success: function(result){
				$("#pelajar").html(result);
				}}),

				$("#pelajar").on("click",".buang", function(){
					$("#pelajar").html("loading..."),
					$.ajax({url: "deletepelajar?id="+ $(this).attr("buangid") +"&id_kelas="+ $("#pelajarkelas-id_kelas").val(), success: function(result){
					$("#pelajar").html(result);
					}});
				});
		$("#catatan-id").val("");
	});
			//load kumpulan
			$( document ).ready(function() {
				$("#pelajar").html("loading..."),
				$.ajax({url: "viewpelajar?id_kelas="+ $("#pelajarkelas-id_kelas").val() , success: function(result){
				$("#pelajar").html(result);
				}}),

				$("#pelajar").on("click",".buang", function(){
				$("#pelajar").html("loading..."),
				$.ajax({url: "deletepelajar?id="+ $(this).attr("buangid") +"&id_kelas="+ $("#pelajarkelas-id_kelas").val(), success: function(result){
				$("#pelajar").html(result);
				}});
				});
			});
			//delete
			$("#pelajar").on("click",".buang", function(){
				$("#pelajar").html("loading..."),
				$.ajax({url: "deletepelajar?id=" + $(this).attr("buangid") +"&id_kelas="+ $("#pelajarkelas-id_kelas").val(), success: function(result){
				$("#pelajar").html(result);
				}});
			});
		');
	}
?>


text:
package com.georges.grape.social.twitter;

import javax.inject.Inject;

import org.springframework.social.twitter.api.Twitter;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class TwitterTrendsController {

	private final Twitter twitter;

	@Inject
	public TwitterTrendsController(Twitter twitter) {
		this.twitter = twitter;
	}

	@RequestMapping(value="/twitter/trends/daily", method=RequestMethod.GET)
	public String showTrends(Model model) {
		model.addAttribute("trends", twitter.searchOperations().getDailyTrends().get(0));
		return "twitter/dailyTrends";
	}

}