text:
POST https://api.recurly.com/v2/accounts HTTP/1.1
X-Api-Version: 2.1
Accept: application/xml
Authorization: Basic YXBpa2V5Og==
User-Agent: recurly-python/{version}
Content-Type: application/xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<account>
  <account_code>pages-mock-7</account_code>
</account>

HTTP/1.1 201 Created
Content-Type: application/xml; charset=utf-8
Location: https://api.recurly.com/v2/accounts/pages-mock-7

<?xml version="1.0" encoding="UTF-8"?>
<account href="https://api.recurly.com/v2/accounts/pages-mock-7">
  <adjustments href="https://api.recurly.com/v2/accounts/pages-mock-7/adjustments"/>
  <billing_info href="https://api.recurly.com/v2/accounts/pages-mock-7/billing_info"/>
  <invoices href="https://api.recurly.com/v2/accounts/pages-mock-7/invoices"/>
  <subscriptions href="https://api.recurly.com/v2/accounts/pages-mock-7/subscriptions"/>
  <transactions href="https://api.recurly.com/v2/accounts/pages-mock-7/transactions"/>
  <account_code>pages-mock-7</account_code>
  <username nil="nil"></username>
  <email nil="nil"></email>
  <first_name nil="nil"></first_name>
  <last_name nil="nil"></last_name>
  <company_name nil="nil"></company_name>
  <accept_language nil="nil"></accept_language>
</account>


text:
package br.com.delogic.jpasy.populator;

import java.lang.reflect.Method;

import org.junit.Test;

import br.com.delogic.jpasy.populator.AttributeConfiguration;
import br.com.delogic.jpasy.populator.AttributeGenerator;
import br.com.delogic.jpasy.populator.AttributeGeneratorVarargs;
import br.com.delogic.jpasy.populator.PopulatorService;

public class ApiUsageTest {

	@Test
	public void test() {
		for (Method m : Person.class.getMethods()) {
			System.out.println(m.getName());
		}
	}

	public void usageTest() throws InstantiationException,
			IllegalAccessException {

		PopulatorService populator = PopulatorService.class.newInstance();

		// configure the amount right on top of the service
		populator.setAmountPerEntity(100);

		populator.setAttributeGenerator("image",
				new AttributeGenerator<String>() {
					public String generate(int index,
							AttributeConfiguration configuration) {
						return "image.jpg";
					}
				});

		// populate simple class with no harness
		populator.prepare(Person.class).populate();

		// populate a simples class changing the amount
		populator.prepare(Person.class).setAmount(100).populate();

		// populate a simple class, changing the way an attribute is generated
		populator
				.prepare(Person.class)
				.setAttributeGenerator("name",
						new AttributeGenerator<String>() {
							public String generate(int index,
									AttributeConfiguration config) {
								return "A different String " + index;
							}
						}).populate();

		populator.prepare(Person.class).setAttributeGenerator("name",
				new AttributeGeneratorVarargs<String>("John", "Mary", "Paul"));

		AttributeConfiguration config = populator.prepare(Person.class)
				.getAttributeConfiguration("name");
		config.setNullable(true);
		config.getAttributeName();

	}

}

redpajama_set_name: RedPajamaGithub


text:
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy } from "@angular/core";
import { Store } from "@ngrx/store";
import { Observable, Subscription, pipe, of } from "rxjs";
import { ActivatedRoute } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { FormGroup, FormControl, FormBuilder, FormArray, Validators } from "@angular/forms";

import { RouterExtensions, Config } from "../../modules/core/index";
import { Platform } from "../../modules/datas/models/index";
import { Country } from "../../modules/countries/models/country";

import {
    IAppState,
    getPlatformPageError,
    getSelectedPlatform,
    getAuthCountry,
    getPlatformPageMsg,
    getAllCountriesInApp,
    getLangues,
    getPlatformImpErrors,
    getPlatformImpMsg
} from "../../modules/ngrx/index";
import { PlatformAction } from "../../modules/datas/actions/index";
import { CountriesAction } from "../../modules/countries/actions/index";
import { Csv2JsonService } from "../../modules/core/services/csv2json.service";
import { CountryListService } from "../../modules/countries/services/country-list.service";
import { PlatformService } from "../../modules/datas/services/platform.service";

@Component({
    moduleId: module.id,
    changeDetection: ChangeDetectionStrategy.OnPush,
    selector: "bc-platform-import-page",
    templateUrl: "./platform-import-page.component.html",
    styleUrls: ["./platform-import-page.component.css"]
})
export class PlatformImportPageComponent implements OnInit, OnDestroy {
    error$: Observable<string | null>;
    isAdmin$: Observable<Country>;
    msg$: Observable<string | null>;
    importError$: Observable<string[]>;
    userCountry$: Observable<Country>;
    locale$: Observable<boolean>;
    actionsSubscription: Subscription;
    needHelp: boolean = false;
    private csvFileAdmin: string;
    private docs_repo: string;
    countries$: Observable<Country[]>;
    platformsErr = [];
    error = true;
    csvFile: any;
    importCsvFile: any = null;
    platformForm: FormGroup = new FormGroup({
        platformInputFile: new FormControl()
    });

    constructor(private translate: TranslateService, private store: Store<IAppState>, public routerext: RouterExtensions, route: ActivatedRoute) {
        this.actionsSubscription = this.store.select(getLangues).subscribe((l: any) => {
            this.docs_repo = "../../../assets/files/";
            this.csvFile = "importPlatform-" + l + ".csv";
            this.csvFileAdmin = "importPlatformAdmin-" + l + ".csv";
        });
    }

    ngOnInit() {
        this.countries$ = this.store.select(getAllCountriesInApp);
        this.error$ = this.store.select(getPlatformPageError);
        this.importError$ = this.store.select(getPlatformImpErrors);
        this.msg$ = this.store.select(getPlatformImpMsg);
        this.userCountry$ = this.store.select(getAuthCountry);
    }

    ngOnDestroy() {
        this.actionsSubscription.unsubscribe();
    }

    handleUpload(csvFile: any): void {
        let notFoundMsg = this.translate.instant('NO_CSV_FOUND');

        let reader = new FileReader();

        if (csvFile.target.files && csvFile.target.files.length > 0) {
            this.importCsvFile = csvFile.target.files["0"];
            this.check(this.importCsvFile);
        } else {
            this.store.dispatch(new PlatformAction.AddPlatformFailAction(notFoundMsg));
        }
    }

    check(csvFile) {
        this.userCountry$.subscribe(userCountry => {
            if (userCountry.code === "AA") {
                this.store.dispatch(new PlatformAction.CheckPlatformCsvFile(csvFile));
            } else {
                this.msg$ = of("Import can be performed");
            }
        });
    }

    changeNeedHelp() {
        this.needHelp = !this.needHelp;
    }

    send() {
        this.store.dispatch(new PlatformAction.ImportPlatformAction(this.importCsvFile));
    }

    clearInput() {
        this.platformForm.get("platformInputFile").reset();
    }

    getCsvPlatform() {
        return this.csvFile;
    }

    getCsvPlatformsUrl() {
        return this.docs_repo + this.csvFile;
    }

    getCsvPlatformsUrlAdmin() {
        return this.docs_repo + this.csvFileAdmin;
    }

    return() {
        this.routerext.navigate(["/platform/"], {
            transition: {
                duration: 1000,
                name: "slideTop"
            }
        });
    }
}


text:
var searchData=
[
  ['tlmaccelerometerevent',['TLMAccelerometerEvent',['../interface_t_l_m_accelerometer_event.html',1,'']]],
  ['tlmangle',['TLMAngle',['../interface_t_l_m_angle.html',1,'']]],
  ['tlmarmsyncevent',['TLMArmSyncEvent',['../interface_t_l_m_arm_sync_event.html',1,'']]],
  ['tlmarmunsyncevent',['TLMArmUnsyncEvent',['../interface_t_l_m_arm_unsync_event.html',1,'']]],
  ['tlmemgevent',['TLMEmgEvent',['../interface_t_l_m_emg_event.html',1,'']]],
  ['tlmeulerangles',['TLMEulerAngles',['../interface_t_l_m_euler_angles.html',1,'']]],
  ['tlmgyroscopeevent',['TLMGyroscopeEvent',['../interface_t_l_m_gyroscope_event.html',1,'']]],
  ['tlmhub',['TLMHub',['../interface_t_l_m_hub.html',1,'']]],
  ['tlmlockevent',['TLMLockEvent',['../interface_t_l_m_lock_event.html',1,'']]],
  ['tlmmyo',['TLMMyo',['../interface_t_l_m_myo.html',1,'']]],
  ['tlmorientationevent',['TLMOrientationEvent',['../interface_t_l_m_orientation_event.html',1,'']]],
  ['tlmpose',['TLMPose',['../interface_t_l_m_pose.html',1,'']]],
  ['tlmsettingsviewcontroller',['TLMSettingsViewController',['../interface_t_l_m_settings_view_controller.html',1,'']]],
  ['tlmunlockevent',['TLMUnlockEvent',['../interface_t_l_m_unlock_event.html',1,'']]]
];


text:
#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_INTERFACE_VIDEO_CODEC_INTERFACE_H
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_INTERFACE_VIDEO_CODEC_INTERFACE_H

#include <vector>

#include "webrtc/common_types.h"
#include "webrtc/common_video/interface/i420_video_frame.h"
#include "webrtc/modules/interface/module_common_types.h"
#include "webrtc/modules/video_coding/codecs/interface/video_error_codes.h"
#include "webrtc/typedefs.h"
#include "webrtc/video_decoder.h"
#include "webrtc/video_encoder.h"

namespace webrtc
{

class RTPFragmentationHeader; // forward declaration

// Note: if any pointers are added to this struct, it must be fitted
// with a copy-constructor. See below.
struct CodecSpecificInfoVP8 {
  bool hasReceivedSLI;
  uint8_t pictureIdSLI;
  bool hasReceivedRPSI;
  uint64_t pictureIdRPSI;
  int16_t pictureId;  // Negative value to skip pictureId.
  bool nonReference;
  uint8_t simulcastIdx;
  uint8_t temporalIdx;
  bool layerSync;
  int tl0PicIdx;  // Negative value to skip tl0PicIdx.
  int8_t keyIdx;  // Negative value to skip keyIdx.
};

struct CodecSpecificInfoVP9 {
  bool hasReceivedSLI;
  uint8_t pictureIdSLI;
  bool hasReceivedRPSI;
  uint64_t pictureIdRPSI;
  int16_t pictureId;  // Negative value to skip pictureId.
  bool nonReference;
  uint8_t temporalIdx;
  bool layerSync;
  int tl0PicIdx;  // Negative value to skip tl0PicIdx.
  int8_t keyIdx;  // Negative value to skip keyIdx.
};

struct CodecSpecificInfoGeneric {
  uint8_t simulcast_idx;
};

struct CodecSpecificInfoH264 {};

union CodecSpecificInfoUnion {
  CodecSpecificInfoGeneric generic;
  CodecSpecificInfoVP8 VP8;
  CodecSpecificInfoVP9 VP9;
  CodecSpecificInfoH264 H264;
};

// Note: if any pointers are added to this struct or its sub-structs, it
// must be fitted with a copy-constructor. This is because it is copied
// in the copy-constructor of VCMEncodedFrame.
struct CodecSpecificInfo
{
    VideoCodecType   codecType;
    CodecSpecificInfoUnion codecSpecific;
};

}  // namespace webrtc

#endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_INTERFACE_VIDEO_CODEC_INTERFACE_H


text:
{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables, CPP, PatternGuards #-}
-- | Stuff related to working on top of Cabal.  E.g., configuring a
-- project.
--
-- Some functions are in the 'Worker' monad and can therefore be only
-- run on a worker.  This mainly includes functions that may take a
-- while to run.  Other functions are parameterised over the monad and
-- can therefore be run where wanted.
--
--
module Scion.Cabal where

import Scion.Types.Core
import Scion.Types.Session
import Scion.Types.Worker

import           Data.Maybe ( isJust )
import           Data.Typeable ( Typeable )
import           Control.Monad ( when )
import           Distribution.PackageDescription.Parse
import           Distribution.Simple.Build ( initialBuildSteps )
import           Distribution.Simple.Configure
import qualified Distribution.PackageDescription as PD
import qualified Distribution.PackageDescription.Parse as PD
import qualified Distribution.PackageDescription.Configuration as PD
import           Distribution.Simple.Program
import           Distribution.Simple.Setup ( defaultConfigFlags,
                                             ConfigFlags(..), Flag(..) )
import qualified Distribution.Verbosity as V ( normal, deafening, silent )
import           GHC.Paths ( ghc, ghc_pkg )
import           System.Directory
import           System.Exit ( ExitCode(..) )
import           System.FilePath ( dropFileName, takeBaseName )

#if __GLASGOW_HASKELL__ >= 702
import           Distribution.Simple.LocalBuildInfo hiding ( Component, libdir )
#else
import           Distribution.Simple.LocalBuildInfo hiding ( libdir )
import           Distribution.Simple.PreProcess ( knownSuffixHandlers )
#endif

-- | Something went wrong inside Cabal.
data CabalException = CabalException String
  deriving (Typeable)

instance Show CabalException where
  show (CabalException msg) = "CabalException: " ++ msg

instance Exception CabalException

-- | Set up a Cabal component, (re-)configuring it if necessary.
--
-- Checks whether an existing configuration result exists on disk and
-- configures the project if not.  Similarly, if the existing config
-- is outdated the project is reconfigured.
--
-- Configuration is roughly equivalent to calling "./Setup configure"
-- on the command line.  The difference is that this makes sure to use
-- the same version of Cabal and the GHC API that Scion was built
-- against.  This is important to avoid compatibility problems.
--
configureCabalProject :: SessionConfig -> FilePath
                      -> Worker LocalBuildInfo
configureCabalProject conf@CabalConfig{} build_dir = do
  cabal_exists <- io $ doesFileExist cabal_file
  when (not cabal_exists) $
    io $ throwIO $ CabalException $
      ".cabal file does not exist: " ++ cabal_file
  let setup_config = localBuildInfoFile build_dir
  conf'd <- io $ doesFileExist setup_config
  if not conf'd
   then do
     message verbose $ "Configuring for first time: " ++ cabal_file
     do_configure
   else do
     -- check whether setup_config is up to date
     cabal_time <- io $ getModificationTime cabal_file
     conf_time <- io $ getModificationTime setup_config
     if cabal_time >= conf_time
      then do
        message verbose $ "Reconfiguring because .cabal file is newer: "
                            ++ cabal_file
        do_configure
      else do
        mb_lbi <- io $ maybeGetPersistBuildConfig build_dir
        case mb_lbi of
          Nothing -> do
            message verbose $ "Reconfiguring because Cabal says so: "
                                ++ cabal_file
            do_configure
          Just lbi ->
            return lbi

 where
   cabal_file = sc_cabalFile conf

   do_configure =
     ghandle (\(e :: IOError) ->
                 io $ throwIO $
                   CabalException $ "Failed to configure" ++ show e) $ do
       gen_pkg_descr <- io $ readPackageDescription V.normal cabal_file
       -- TODO: The following only works for build-type simple.  We
       -- should support non-standard Setup.hs as well.

       -- Make sure we configure with the same version of GHC
       let prog_conf =
             userSpecifyPaths [("ghc", ghc), ("ghc-pkg", ghc_pkg)]
               defaultProgramConfiguration
       let config_flags =
             (defaultConfigFlags prog_conf)
               { configDistPref = Flag build_dir
               , configVerbosity = Flag V.deafening
               , configUserInstall = Flag True
               -- TODO: parse flags properly
               }
       let root_dir = dropFileName cabal_file
       io $ do
         setCurrentDirectory root_dir
         lbi <- configure (gen_pkg_descr, (Nothing, []))
                          config_flags
         writePersistBuildConfig build_dir lbi
         initialBuildSteps build_dir (localPkgDescr lbi) lbi V.normal
#if __GLASGOW_HASKELL__ < 702
                           knownSuffixHandlers
#endif
         return lbi
configureCabalProject _ _ = fail "configureCabalProject: invalid config type"

availableComponents :: PD.PackageDescription -> [Component]
availableComponents pd =
  (if isJust (PD.library pd) then [Library] else []) ++
      [ Executable (PD.exeName e)
      | e <- PD.executables pd ]

-- | List all possible components of the @.cabal@ given file.
--
-- Some components might not be available depending on the way the
-- program is configured.
fileComponents :: (ExceptionMonad m, MonadIO m) =>
                  FilePath -> m [Component]
fileComponents cabal_file = do
  ghandle (\(_ :: ExitCode) ->
                io $ throwIO $ CabalException $ "Cannot open Cabal file: "
                     ++ cabal_file) $ do
    gpd <- io $ PD.readPackageDescription V.silent cabal_file
    return (availableComponents (PD.flattenPackageDescription gpd))

-- | List all possible default session configs from a given @.cabal@ file.
cabalSessionConfigs :: (ExceptionMonad m, MonadIO m) => FilePath
                    -> m [SessionConfig]
cabalSessionConfigs cabal_file = do
  comps <- fileComponents cabal_file
  return (map (componentToSessionConfig cabal_file) comps)

-- | Create the default configuration for a Cabal file and component.
componentToSessionConfig :: FilePath -> Component -> SessionConfig
componentToSessionConfig cabal_file comp =
     CabalConfig{ sc_name = nameFromComponent comp
                , sc_cabalFile = cabal_file
                , sc_component = comp
                , sc_configFlags = []
                , sc_buildDir = Nothing
                }
 where
   library_name = takeBaseName cabal_file

   nameFromComponent Library = library_name
   nameFromComponent (Executable exe_name) =
     library_name ++ ":" ++ exe_name


text:
{% extends TEMPLATE_BASE %}
{% load i18n %}
{% block content %}

{% trans "Elections you Administer" %} [{% trans "back to home" %}]

{% for election in elections %}

 {{election.name}} - {{election.num_voters}} voters / {{election.num_cast_votes}} cast votes

{% endfor %}

{% endblock %}


text:
package org.apache.jetspeed.portlets.prm;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import org.apache.jetspeed.om.portlet.PortletApplication;
import org.apache.jetspeed.om.portlet.PortletDefinition;
import org.apache.jetspeed.portlets.JetspeedServiceLocator;
import org.apache.jetspeed.search.ParsedObject;
import org.apache.jetspeed.search.SearchResults;
import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
import org.apache.wicket.markup.repeater.data.IDataProvider;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Provides Data to sortable and detachable list views for Portlet lists
 *
 * @author David Sean Taylor
 * @version $Id: PortletDataProvider.java 1089610 2011-04-06 20:08:17Z woonsan $
 */
public class PortletDataProvider extends SortableDataProvider<PortletDefinitionBean> implements IDataProvider<PortletDefinitionBean>
{
    public enum PortletOrderBy { NAME_ASC, NAME_DESC, DISPLAY_NAME_ASC, DISPLAY_NAME_DESC }
    private JetspeedServiceLocator serviceLocator;
    private boolean searchMode = false;
    private String appName;
    private List<PortletDefinitionBean> portlets = null;
    private List<PortletDefinitionBean> searchResults = null;
    private Locale locale;
    private static final long serialVersionUID = 1L;
    private final static Logger log = LoggerFactory.getLogger(PortletDataProvider.class);
    private PortletOrderBy orderBy = PortletOrderBy.DISPLAY_NAME_ASC;

    public PortletDataProvider(String defaultAppName, Locale locale, JetspeedServiceLocator locator)
    {
        this.serviceLocator = locator;
        this.locale = locale;
        this.appName = defaultAppName;
        setSort("name", true);

        refresh();
    }

    public Iterator<PortletDefinitionBean> iterator(int first, int count)
    {
        int last = first + count;
        if (last > portlets.size())
            last = portlets.size() - 1;
        if (last < 0)
            last = 0;
        return portlets.subList(first, last).iterator();
    }

    public int size()
    {
        if (searchMode)
        {
            if (searchResults == null)
                return 0;
            return searchResults.size();
        }
        else
        {
            if (portlets == null)
                return 0;
            return portlets.size();
        }
    }

    /**
     * @see org.apache.wicket.model.IDetachable#detach()
     */
    public void detach()
    {
        super.detach();
    }

    public void refresh()
    {
        if (searchMode)
        {
            if (searchResults != null)
            {
                portlets = searchResults;
                return;
            }
            searchMode = false;
        }
        else
        {
            if (getAppName() == null) {
                changeAppName("j2-admin");
            }

            portlets = new ArrayList<PortletDefinitionBean>();
            PortletApplication app = serviceLocator.getPortletRegistry().getPortletApplication(getAppName());
            if (app != null)
            {
                for (PortletDefinition def : app.getPortlets())
                {
                    portlets.add(new PortletDefinitionBean(def, getAppName(), locale));
                }
                for (PortletDefinition def : app.getClones())
                {
                    portlets.add(new PortletDefinitionBean(def, getAppName(), locale));
                }
            }
            sort(portlets, this.orderBy);
        }
    }

    public void setSearchMode(boolean mode)
    {
        this.searchMode = mode;
    }

    public boolean getSearchMode()
    {
        return this.searchMode;
    }

    public IModel<PortletDefinitionBean> model(PortletDefinitionBean object)
    {
        return new Model<PortletDefinitionBean>(object);
    }

    public void sort(List<PortletDefinitionBean> list, PortletOrderBy orderBy)
    {
        Collections.sort(list, new PortletComparator(orderBy));
    }

    public class PortletComparator implements Comparator<PortletDefinitionBean>
    {
        PortletOrderBy orderBy;

        public PortletComparator(PortletOrderBy order)
        {
            this.orderBy = order;
        }

        public int compare(PortletDefinitionBean portlet1, PortletDefinitionBean portlet2)
        {
            String p1 = "";
            String p2 = "";
            if (orderBy == PortletOrderBy.NAME_ASC)
            {
                p1 = portlet1.getName();
                p2 = portlet2.getName();
            }
            else if (orderBy == PortletOrderBy.NAME_DESC)
            {
                p2 = portlet1.getName();
                p1 = portlet2.getName();
            }
            else if (orderBy == PortletOrderBy.DISPLAY_NAME_ASC)
            {
                p1 = portlet1.getDisplayName();
                p2 = portlet2.getDisplayName();
            }
            else if (orderBy == PortletOrderBy.DISPLAY_NAME_DESC)
            {
                p2 = portlet1.getDisplayName();
                p1 = portlet2.getDisplayName();
            }
            p1 = (p1 == null) ? "" : p1;
            p2 = (p2 == null) ? "" : p2;
            return p1.compareToIgnoreCase(p2);
        }
    }

    @SuppressWarnings("unchecked")
    public void searchPortlets(String search)
    {
        searchPortlets(search, true, true);
    }

    @SuppressWarnings("unchecked")
    public void searchPortlets(String search, boolean withOriginalPortlets, boolean withClonedPortlets)
    {
        try
        {
            if (search == null)
            {
                searchMode = false;
                return;
            }
            searchResults = new ArrayList<PortletDefinitionBean>();
            SearchResults results = serviceLocator.getSearchEngine().search(search);
            if (results.size() > 0)
            {
                String name = "";
                for (ParsedObject po : results.getResults())
                {
                    Map<String, String> fields = po.getFields();
                    if (fields != null && po.getType().equals(ParsedObject.OBJECT_TYPE_PORTLET))
                    {
                        Object id = fields.get(ParsedObject.ID);
                        Object pa = fields.get(ParsedObject.OBJECT_TYPE_PORTLET_APPLICATION);
                        String paName = "";
                        if(pa != null)
                        {
                            if(id instanceof Collection)
                            {
                                Collection<String> coll = (Collection<String>) id;
                                paName = (String) coll.iterator().next();
                            }
                            else
                            {
                                paName = (String)pa;
                            }
                        }
                        name = paName + "::" + id;
                        PortletDefinition pd = serviceLocator.getPortletRegistry().getPortletDefinitionByUniqueName(name);
                        if (pd != null)
                        {
                            if ((pd.isClone() && withClonedPortlets) || (!pd.isClone() && withOriginalPortlets))
                            {
                                searchResults.add(new PortletDefinitionBean(pd, paName, locale));
                            }
                        }
                    }
                }
            }
            searchMode = true;
            sort(searchResults, this.orderBy);
            refresh();
        }
        catch (Exception e)
        {

        }
    }

    public PortletOrderBy getOrderBy()
    {
        return orderBy;
    }

    public void setOrderBy(PortletOrderBy orderBy)
    {
        this.orderBy = orderBy;
    }

	public void changeAppName(String appName)
	{
		this.appName = appName;

		refresh();
	}

	public String getAppName()
	{
		return appName;
	}

    public void sort()
    {
        this.sort(this.portlets, this.orderBy);
    }

}


text:
import org.junit.*;
import static org.junit.Assert.*;

public class DefinitionsTest {

  @Rule
  public ClearRule clearRule = new ClearRule();

  @Test
  public void defintions_instantiatesCorrectly_true() {
      Definitions myDefinition = new Definitions("favorite toy");
      assertEquals(true, myDefinition instanceof Definitions);
  }

  @Test
  public void definitions_instantiatesWithDescription_true() {
      Definitions myDefinition = new Definitions("favorite toy");
      assertEquals("favorite toy", myDefinition.getInputDef());
  }

  @Test
  public void all_returnsAllInstancesOfDefinitions_true() {
    Definitions firstDefinition = new Definitions("favorite toy");
    Definitions secondDefinition = new Definitions("best toy");
    assertTrue(Definitions.all().contains(firstDefinition));
    assertTrue(Definitions.all().contains(secondDefinition));
  }

  @Test
  public void newId_DefinitionsInstantiateWithAnID_true() {
    Definitions myDefinition = new Definitions("favorite toy");
    assertEquals(Definitions.all().size(), myDefinition.getId());
  }

  @Test
  public void find_returnsDefinitionsWithSameId_secondDefinitions() {
    Definitions firstDefinition = new Definitions("favorite toy");
    Definitions secondDefinition = new Definitions("best toy");
    assertEquals(Definitions.find(secondDefinition.getId()), secondDefinition);
  }

  @Test
  public void find_returnsNullWhenNoDefinitionsFound_null() {
    assertTrue(Definitions.find(999) == null);
  }

  @Test
  public void clear_emptiesAllDefinitionssFromArrayList() {
    Definitions myDefinition = new Definitions("A tasty snack");
    Definitions.clear();
    assertEquals(Definitions.all().size(), 0);
  }

}


text:
package com.tinkerpop.blueprints.impls.sparksee;

import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Element;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.util.ElementHelper;
import com.tinkerpop.blueprints.util.StringFactory;

import java.util.HashSet;
import java.util.Set;

/**
 * {@link Element} implementation for Sparksee.
 *

 * All elements are typed or labeled. The way to get the type or label for an
 * element is retrieving the property {@link StringFactory#LABEL}. This
 * property cannot be set or removed.
 *

 * TODO: When a Float value is set for an attribute, it is stored as a Double
 * value. Thus, when it is retrieved later, it is retrieved as a Double and not
 * as a Float.
 *
 * @author Sparsity
 *         Technologies
 */
class SparkseeElement implements Element {

    private static final int NODE_SCOPE  = com.sparsity.sparksee.gdb.Type.NodesType;
    private static final int EDGE_SCOPE  = com.sparsity.sparksee.gdb.Type.EdgesType;

    /**
     * SparkseeGraph instance.
     */
    protected SparkseeGraph graph = null;
    /**
     * Sparksee OID.
     */
    protected long oid = com.sparsity.sparksee.gdb.Objects.InvalidOID;
    /**
     * Sparksee object type.
     *

     * It is loaded as late as possible (and just if required).
     *
     * @see #getObjectType()
     */
    private int type = com.sparsity.sparksee.gdb.Type.InvalidType;

    /**
     * Gets the Sparksee object type.
     *

     * If it has not been loaded yet, it is retrieved from Sparksee database.
     *
     * @return The element type.
     */
    protected int getObjectType() {
        if (type == com.sparsity.sparksee.gdb.Type.InvalidType) {
            type = graph.getRawGraph().getObjectType(oid);
        }
        return type;
    }

    /**
     * Gets the type or label of the element.
     *

     * The label is the name of the Sparksee object type.
     *
     * @return Type or label of the element.
     */
    protected String getTypeLabel() {
        return graph.getRawGraph().getType(getObjectType()).getName();
    }

    /**
     * Creates a new instance.
     *
     * @param g   SparkseeGraph.
     * @param oid Sparksee OID.
     */
    protected SparkseeElement(final SparkseeGraph g, final long oid) {
        assert g != null;
        assert oid != com.sparsity.sparksee.gdb.Objects.InvalidOID;

        this.graph = g;
        this.oid = oid;
    }

    /*
      * (non-Javadoc)
      *
      * @see com.tinkerpop.blueprints.Element#getProperty(java.lang.String)
      */
    @Override
    public <T> T getProperty(final String key) {
        graph.autoStartTransaction(false);

        if (key.compareTo(StringFactory.LABEL) == 0) {
            com.sparsity.sparksee.gdb.Type tdata = graph.getRawGraph().getType(getObjectType());
            return (T) tdata.getName();
        }

        int attrType = getObjectType();
        if (!graph.typeScope.get())
        {
            if (graph.getRawGraph().getType(getObjectType()).getObjectType() == com.sparsity.sparksee.gdb.ObjectType.Node) {
                attrType = NODE_SCOPE;
            } else {
                attrType = EDGE_SCOPE;
            }
        }

        int attr = graph.getRawGraph().findAttribute(attrType, key);
        if (attr == com.sparsity.sparksee.gdb.Attribute.InvalidAttribute) {
            return null;
        }
        com.sparsity.sparksee.gdb.Attribute adata = graph.getRawGraph().getAttribute(attr);
        assert adata != null;

        com.sparsity.sparksee.gdb.Value v = new com.sparsity.sparksee.gdb.Value();
        graph.getRawGraph().getAttribute(oid, attr, v);
        Object result = null;
        if (!v.isNull()) {
            switch (v.getDataType()) {
                case Boolean:
                    result = v.getBoolean();
                    break;
                case Integer:
                    result = v.getInteger();
                    break;
                case Long:
                    result = v.getLong();
                    break;
                case String:
                    result = v.getString();
                    break;
                case Double:
                    result = v.getDouble();
                    break;
                default:
                    throw new UnsupportedOperationException(SparkseeTokens.TYPE_EXCEPTION_MESSAGE);
            }
        }
        return (T) result;
    }

    /*
      * (non-Javadoc)
      *
      * @see com.tinkerpop.blueprints.Element#getPropertyKeys()
      */
    @Override
    public Set<String> getPropertyKeys() {
        graph.autoStartTransaction(false);

        com.sparsity.sparksee.gdb.AttributeList alist;
        if (graph.typeScope.get()) {
            alist = graph.getRawGraph().getAttributes(oid);
        } else {
            int attrType;
            if (graph.getRawGraph().getType(getObjectType()).getObjectType() == com.sparsity.sparksee.gdb.ObjectType.Node) {
                attrType = NODE_SCOPE;
            } else {
                attrType = EDGE_SCOPE;
            }
            alist = graph.getRawGraph().findAttributes(attrType);
        }
        Set<String> attrKeys = new HashSet<String>();
        com.sparsity.sparksee.gdb.Value v = new com.sparsity.sparksee.gdb.Value();
        for (Integer attr : alist) {
            if (!graph.typeScope.get()) {
                graph.getRawGraph().getAttribute(oid, attr, v);
                if (v.isNull()) {
                    continue;
                }
            }
            String key = graph.getRawGraph().getAttribute(attr).getName();
            attrKeys.add(key);
        }
        alist.delete();
        alist = null;
        return attrKeys;
    }

    /*
      * (non-Javadoc)
      *
      * @see com.tinkerpop.blueprints.Element#setProperty(java.lang.String,
      * java.lang.Object)
      */
    @Override
    public void setProperty(final String key, final Object value) {
        ElementHelper.validateProperty(this, key, value);
        if (key.equals(StringFactory.LABEL)) {
            throw new IllegalArgumentException("Property key is reserved for all vertices and edges: " + StringFactory.LABEL);
        }

        graph.autoStartTransaction(true);

        int attrType = getObjectType();

        if (!graph.typeScope.get())
        {
            if (graph.getRawGraph().getType(attrType).getObjectType() == com.sparsity.sparksee.gdb.ObjectType.Node) {
                attrType = NODE_SCOPE;
            } else {
                attrType = EDGE_SCOPE;
            }
        }

        int attr = graph.getRawGraph().findAttribute(attrType, key);
        com.sparsity.sparksee.gdb.DataType datatype = null;
        if (attr == com.sparsity.sparksee.gdb.Attribute.InvalidAttribute) {
            //
            // First time we set this attribute, let's create it.
            //
            if (value instanceof Boolean) {
                datatype = com.sparsity.sparksee.gdb.DataType.Boolean;
            } else if (value instanceof Integer) {
                datatype = com.sparsity.sparksee.gdb.DataType.Integer;
            } else if (value instanceof Long) {
                datatype = com.sparsity.sparksee.gdb.DataType.Long;
            } else if (value instanceof String) {
                datatype = com.sparsity.sparksee.gdb.DataType.String;
            } else if (value instanceof Double || value instanceof Float) {
                datatype = com.sparsity.sparksee.gdb.DataType.Double;
            } else if (value instanceof com.sparsity.sparksee.gdb.Value) {
                datatype = ((com.sparsity.sparksee.gdb.Value) value).getDataType();
            } else {
                throw new IllegalArgumentException(SparkseeTokens.TYPE_EXCEPTION_MESSAGE);
            }
            assert datatype != null;
            attr = graph.getRawGraph().newAttribute(attrType, key, datatype, com.sparsity.sparksee.gdb.AttributeKind.Basic);
            assert attr != com.sparsity.sparksee.gdb.Attribute.InvalidAttribute;
        } else {
            datatype = graph.getRawGraph().getAttribute(attr).getDataType();
        }
        //
        // Set the Value
        //
        com.sparsity.sparksee.gdb.Value v = new com.sparsity.sparksee.gdb.Value();
        if (value instanceof com.sparsity.sparksee.gdb.Value) {
            v = (com.sparsity.sparksee.gdb.Value) value;
        } else {
            // from Object to Value
            switch (datatype) {
                case Boolean:
                    v.setBooleanVoid((Boolean) value);
                    break;
                case Integer:
                    v.setIntegerVoid((Integer) value);
                    break;
                case Long:
                    if (value instanceof Long) {
                        v.setLongVoid((Long) value);
                    } else if (value instanceof Integer) {
                        v.setLongVoid(((Integer) value).longValue());
                    } else {
                        throw new IllegalArgumentException(SparkseeTokens.TYPE_EXCEPTION_MESSAGE);
                    }
                    break;
                case String:
                    v.setString((String) value);
                    break;
                case Double:
                    if (value instanceof Double) {
                        v.setDouble((Double) value);
                    }
                    if (value instanceof Float) {
                        v.setDouble(((Float) value));
                    }
                    break;
                default:
                    throw new IllegalArgumentException(SparkseeTokens.TYPE_EXCEPTION_MESSAGE);
            }
        }

        this.graph.getRawGraph().setAttribute(oid, attr, v);
    }

    /*
      * (non-Javadoc)
      *
      * @see
      * com.tinkerpop.blueprints.Element#removeProperty(java.lang.String)
      */
    @Override
    public <T> T removeProperty(final String key) {
        graph.autoStartTransaction(true);

        try {
            Object ret = getProperty(key);
            com.sparsity.sparksee.gdb.Value v = new com.sparsity.sparksee.gdb.Value();
            v.setNull();
            setProperty(key, v);
            return (T) ret;
        } catch (RuntimeException e) {
            return null;
        }
    }

    /*
      * (non-Javadoc)
      *
      * @see com.tinkerpop.blueprints.Element#getId()
      */
    @Override
    public Object getId() {
        return oid;
    }

    public void remove() {
        if (this instanceof Vertex) {
            this.graph.removeVertex((Vertex) this);
        } else {
            this.graph.removeEdge((Edge) this);
        }
    }

    public boolean equals(final Object object) {
        graph.autoStartTransaction(false);

        return ElementHelper.areEqual(this, object);
    }

    @Override
    public int hashCode() {
        return (int) oid;
    }
}


text:
import React, { Component } from 'react';
import { Link } from 'react-router';
import styles from './Home.css';
import { ipcRenderer } from 'electron';
import AudioList from './AudioList';
import Editor from './Editor';
import GettingStarted from './GettingStarted';
import cuid from 'cuid';
import Icon from './Icon';
import { version } from '../package.json';
import Header from './Header';
import FilesSavedModal from './FilesSavedModal';
import KeyboardShortcutsModal from './KeyboardShortcutsModal';
import getRandomColor from '../utils/getRandomColor';

class Home extends Component {
  props: {
    addFiles: () => void,
    updateFile: () => void,
    files: Array
  };

  state: {
    currentFileId: string,
    keyboardShortcutsModalOpen: boolean,
    filesSavedNames: array
  };

  constructor(props) {
    super(props);

    this.state = {
      fileName: null,
      sessionLastSaved: null,
      sessionStatus: null,
      currentFileId: '',
      keyboardShortcutsModalOpen: false,
      filesSavedNames: [],
      error: null
    };

    this.updateTime = this.updateTime.bind(this);
    this.closeSavedMessage = this.closeSavedMessage.bind(this);
    this.getCompleteFiles = this.getCompleteFiles.bind(this);
    this.batchExport = this.batchExport.bind(this);
    this.exportToSrt = this.exportToSrt.bind(this);
    this.openDialog = this.openDialog.bind(this);
    this.updateCurrentFileId = this.updateCurrentFileId.bind(this);
    this.setTranscriptText = this.setTranscriptText.bind(this);
    this.updateTiming = this.updateTiming.bind(this);
    this.toggleKeyboardShortcutsModal = this.toggleKeyboardShortcutsModal.bind(
      this
    );
  }

  componentDidMount() {
    window.setTimeout(this.updateTime, 60000); // refresh fuzzy session time
    ipcRenderer.on('mp3-selected', (event, fileNames) => {
      if (fileNames) {
        const files = fileNames.map(filePath => ({
          filePath,
          id: cuid(),
          timing: []
        }));
        this.props.addFiles(files);
      }
    });

    ipcRenderer.on('session-saving', event => {
      const fileName = this.state.fileName;
      event.sender.send(
        'session-data',
        JSON.stringify(this.props.files),
        fileName
      );
      this.setState({ sessionStatus: 'Saving...' });
    });

    ipcRenderer.on('session-loaded', (event, data, fileName) => {
      this.props.addFiles(JSON.parse(data));
      this.setState({
        fileName,
        sessionLastSaved: Date.now(),
        sessionStatus: 'Opened'
      });
    });

    ipcRenderer.on('session-saved', (event, fileName) => {
      const sessionName = fileName.split('\\').pop().replace('.json', '');
      this.setState({
        fileName,
        sessionLastSaved: Date.now(),
        sessionStatus: 'Saved'
      });
    });

    ipcRenderer.on('files-saved', (event, filePath, filesSavedNames) => {
      this.setState({ filesSavedNames });
    });
  }

  componentDidUpdate(prevProps, prevState) {
    if (!prevProps.files.length && this.props.files.length) {
      this.setState({ currentFileId: this.props.files[0].id });
    }
    if (this.state.fileName && prevProps.files !== this.props.files) {
      ipcRenderer.send('session-updated');
    }
  }

  updateTime() {
    this.forceUpdate();
    window.setTimeout(this.updateTime, 60000);
  }

  exportToSrt(files) {
    const data = files.map(file => {
      const { timing, filePath, id } = file;
      return {
        id,
        timing,
        fileName: `${filePath.split('\\').pop().slice(0, -4)}.srt`
      };
    });

    ipcRenderer.send('export-to-srt', data);
  }

  getCompleteFiles() {
    const allBlocksSet = block =>
      block.startTime !== 'not set' && block.endTime !== 'not set';
    const timingComplete = file => {
      if (!file.timing.length) return false;
      return file.timing.every(allBlocksSet);
    };

    return this.props.files.filter(timingComplete);
  }

  batchExport() {
    this.exportToSrt(this.getCompleteFiles());
  }

  openDialog(e) {
    e.target.blur();
    ipcRenderer.send('add-mp3');
  }

  updateCurrentFileId(id: string) {
    this.setState({
      currentFileId: id
    });
  }

  closeSavedMessage() {
    this.setState({ filesSavedNames: [] });
  }

  setTranscriptText({ id, tempTiming }) {
    const colors = tempTiming.map(block => block.color);
    const timing = tempTiming.map(block => {
      if (block.color) return block; // don't set defaults if defaults have already been set
      const color = getRandomColor(colors);
      colors.push(color);
      return Object.assign({}, block, {
        startTime: 'not set',
        endTime: 'not set',
        color
      });
    });
    this.props.updateFile({ id, timing });
  }

  updateTiming({ id, updatedBlock, clear }) {
    const file = this.props.files.find(file => file.id === id);
    let timing;

    if (clear) {
      timing = file.timing.map(block =>
        Object.assign({}, block, {
          startTime: 'not set',
          endTime: 'not set',
          startTimeSeconds: undefined,
          endTimeSeconds: undefined
        })
      );
    } else {
      const index = file.timing.findIndex(
        block => block.id === updatedBlock.id
      );
      timing = [
        ...file.timing.slice(0, index),
        updatedBlock,
        ...file.timing.slice(index + 1)
      ];
    }

    this.props.updateFile({ id, timing });
  }

  toggleKeyboardShortcutsModal() {
    this.setState(prevState => ({
      keyboardShortcutsModalOpen: !prevState.keyboardShortcutsModalOpen
    }));
  }

  render() {
    const { files } = this.props;
    const {
      currentFileId,
      keyboardShortcutsModalOpen,
      filesSavedNames,
      fileName,
      sessionStatus,
      sessionLastSaved
    } = this.state;
    const currentFile = files.find(file => file.id === currentFileId);
    const sessionName = fileName
      ? fileName.split('\\').pop().replace('.json', '')
      : 'Untitled session*';
    const batchExportEnabled = !!this.getCompleteFiles().length;

    return (

                <AudioList
                  files={files}
                  currentFileId={currentFileId}
                  onClick={this.updateCurrentFileId}
                />

              {currentFileId.length
                ? <Editor
                  file={currentFile}
                  setTranscriptText={this.setTranscriptText}
                  updateTiming={this.updateTiming}
                  exportToSrt={this.exportToSrt}
                />
                : <GettingStarted />}

                <button className="btn btn-default" onClick={this.openDialog}>
                  <Icon icon="add" aria-hidden="true" /> Add audio
                </button>
                <button
                  className="btn btn-default"
                  onClick={this.batchExport}
                  disabled={!batchExportEnabled}
                >
                  <Icon icon="export" aria-hidden="true" /> Batch export
                </button>

              <button
                className="btn btn-default"
                onClick={this.toggleKeyboardShortcutsModal}
              >
                <Icon icon="keys" aria-hidden="true" /> Keyboard shortcuts
              </button>

        <FilesSavedModal
          fileNames={filesSavedNames}
          closeHandler={this.closeSavedMessage}
        />

        <KeyboardShortcutsModal
          isOpen={keyboardShortcutsModalOpen}
          closeHandler={this.toggleKeyboardShortcutsModal}
        />

    );
  }
}

export default Home;


text: {-# htermination floor :: (Ratio Int) -> Int #-}


text:
package com.github.ldaniels528.trifecta.modules.etl.io.trigger.impl

import com.github.ldaniels528.trifecta.modules.etl.StoryConfig
import com.github.ldaniels528.trifecta.modules.etl.io.flow.Flow
import com.github.ldaniels528.trifecta.modules.etl.io.trigger.Trigger

import scala.concurrent.ExecutionContext

/**
  * Startup Trigger
  * @author lawrence.daniels@gmail.com
  */
case class StartupTrigger(id: String, flows: Seq[Flow]) extends Trigger {

  override def destroy() = {}

  override def execute(story: StoryConfig)(implicit ec: ExecutionContext) = {
    Trigger.taskPool ! new Runnable {
      override def run() = {
        process(story, flows zip (flows map (createScope(story, _))))
        ()
      }
    }
  }

}


text:
module Gitlab
  module Email
    module Hook
      class DisableEmailInterceptor
        def self.delivering_email(message)
          message.perform_deliveries = false

          Rails.logger.info "Emails disabled! Interceptor prevented sending mail #{message.subject}"
        end
      end
    end
  end
end


text:
package com.uberlogik.pac4j.auth;

import com.google.common.io.BaseEncoding;
import org.pac4j.core.exception.TechnicalException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Arrays;

/**
 * Base64 encoded password hash and salt.
 *
 * @Author Rob Ward
 */
public class SaltedPassword
{
    private static final Logger LOG = LoggerFactory.getLogger(SaltedPassword.class);
    private static final int SALT_SIZE = 16; //16 bytes == 128 bits
    private static final String HASH_ALGORITHM = "SHA-256";
    private static final int ADDITIONAL_HASH_ITERATIONS = 1023;

    private final byte[] passwordHash;
    private final byte[] salt;

    private SaltedPassword(byte[] passwordHash, byte[] salt)
    {
        this.passwordHash = passwordHash;
        this.salt = salt;
    }

    public static SaltedPassword of(String passwordHash, String salt)
    {
        return new SaltedPassword(BaseEncoding.base64().decode(passwordHash), BaseEncoding.base64().decode(salt));
    }

    public static SaltedPassword from(String password)
    {
        byte[] salt = generateSalt();
        byte[] hash = hash(password, salt);
        return new SaltedPassword(hash, salt);
    }

    public String getPasswordHash()
    {
        return BaseEncoding.base64().encode(passwordHash);
    }

    public String getSalt()
    {
        return BaseEncoding.base64().encode(salt);
    }

    boolean matches(String password)
    {
        byte[] hash = hash(password, this.salt);
        return Arrays.equals(hash, passwordHash);
    }

    private static byte[] generateSalt()
    {
        byte[] buffer = new byte[SALT_SIZE];
        new SecureRandom().nextBytes(buffer);
        return buffer;
    }

    private static byte[] hash(String password, byte[] salt)
    {
        try
        {
            MessageDigest digest = MessageDigest.getInstance(HASH_ALGORITHM);
            digest.reset();
            digest.update(salt);
            byte[] hash = digest.digest(password.getBytes());

            for (int i = 0; i < ADDITIONAL_HASH_ITERATIONS; i++)
            {
                digest.reset();
                hash = digest.digest(hash);
            }

            return hash;
        }
        catch (NoSuchAlgorithmException e)
        {
            // should never happen
            String msg = "Unable to instantiate MessageDigest: " + HASH_ALGORITHM;
            LOG.error(msg);
            throw new TechnicalException(msg);
        }
    }
}


text:
package sink

import (
	"context"

	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"

	eventing "knative.dev/eventing-kafka-broker/control-plane/pkg/apis/eventing/v1alpha1"
	eventingv1alpha1 "knative.dev/eventing-kafka-broker/control-plane/pkg/client/clientset/versioned/typed/eventing/v1alpha1"
	"knative.dev/eventing-kafka-broker/test/pkg/addressable"
)

func CreatorV1Alpha1(clientset eventingv1alpha1.EventingV1alpha1Interface, spec eventing.KafkaSinkSpec) addressable.Creator {

	return func(namespacedName types.NamespacedName) (addressable.Addressable, error) {

		ctx := context.Background()
		ks := &eventing.KafkaSink{
			ObjectMeta: metav1.ObjectMeta{
				Namespace: namespacedName.Namespace,
				Name:      namespacedName.Name,
			},
			Spec: spec,
		}

		_, err := clientset.KafkaSinks(namespacedName.Namespace).Create(ctx, ks, metav1.CreateOptions{})
		if err != nil {
			return addressable.Addressable{}, err
		}

		return addressable.Addressable{
			NamespacedName: namespacedName,
			TypeMeta: metav1.TypeMeta{
				Kind:       eventing.Kind("KafkaSink").Kind,
				APIVersion: eventing.SchemeGroupVersion.String(),
			},
		}, nil
	}
}


text:
'use strict';

/**
 * Class representing a PollQuestionLocalization.
 */
class PollQuestionLocalization {
  /**
   * Create a PollQuestionLocalization.
   * @member {string} [title] Title of the question.
   */
  constructor() {
  }

  /**
   * Defines the metadata of PollQuestionLocalization
   *
   * @returns {object} metadata of PollQuestionLocalization
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'PollQuestionLocalization',
      type: {
        name: 'Composite',
        className: 'PollQuestionLocalization',
        modelProperties: {
          title: {
            required: false,
            serializedName: 'title',
            constraints: {
              MaxLength: 256
            },
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = PollQuestionLocalization;


text:
package io.flutter.plugins.videoplayer;

import org.junit.Test;

public class VideoPlayerTest {
  // This is only a placeholder test and doesn't actually initialize the plugin.
  @Test
  public void initPluginDoesNotThrow() {
    final VideoPlayerPlugin plugin = new VideoPlayerPlugin();
  }
}


text:
from openshift_checks import OpenShiftCheck, get_var

class DockerImageAvailability(OpenShiftCheck):
    """Check that required Docker images are available.

    This check attempts to ensure that required docker images are
    either present locally, or able to be pulled down from available
    registries defined in a host machine.
    """

    name = "docker_image_availability"
    tags = ["preflight"]

    dependencies = ["skopeo", "python-docker-py"]

    deployment_image_info = {
        "origin": {
            "namespace": "openshift",
            "name": "origin",
        },
        "openshift-enterprise": {
            "namespace": "openshift3",
            "name": "ose",
        },
    }

    @classmethod
    def is_active(cls, task_vars):
        """Skip hosts with unsupported deployment types."""
        deployment_type = get_var(task_vars, "openshift_deployment_type")
        has_valid_deployment_type = deployment_type in cls.deployment_image_info

        return super(DockerImageAvailability, cls).is_active(task_vars) and has_valid_deployment_type

    def run(self, tmp, task_vars):
        msg, failed, changed = self.ensure_dependencies(task_vars)

        # exit early if Skopeo update fails
        if failed:
            if "No package matching" in msg:
                msg = "Ensure that all required dependencies can be installed via `yum`.\n"
            return {
                "failed": True,
                "changed": changed,
                "msg": (
                    "Unable to update or install required dependency packages on this host;\n"
                    "These are required in order to check Docker image availability:"
                    "\n    {deps}\n{msg}"
                ).format(deps=',\n    '.join(self.dependencies), msg=msg),
            }

        required_images = self.required_images(task_vars)
        missing_images = set(required_images) - set(self.local_images(required_images, task_vars))

        # exit early if all images were found locally
        if not missing_images:
            return {"changed": changed}

        registries = self.known_docker_registries(task_vars)
        if not registries:
            return {"failed": True, "msg": "Unable to retrieve any docker registries.", "changed": changed}

        available_images = self.available_images(missing_images, registries, task_vars)
        unavailable_images = set(missing_images) - set(available_images)

        if unavailable_images:
            return {
                "failed": True,
                "msg": (
                    "One or more required Docker images are not available:\n    {}\n"
                    "Configured registries: {}"
                ).format(",\n    ".join(sorted(unavailable_images)), ", ".join(registries)),
                "changed": changed,
            }

        return {"changed": changed}

    def required_images(self, task_vars):
        deployment_type = get_var(task_vars, "openshift_deployment_type")
        image_info = self.deployment_image_info[deployment_type]

        openshift_release = get_var(task_vars, "openshift_release", default="latest")
        openshift_image_tag = get_var(task_vars, "openshift_image_tag")
        is_containerized = get_var(task_vars, "openshift", "common", "is_containerized")

        images = set(self.required_docker_images(
            image_info["namespace"],
            image_info["name"],
            ["registry-console"] if "enterprise" in deployment_type else [],  # include enterprise-only image names
            openshift_release,
            is_containerized,
        ))

        # append images with qualified image tags to our list of required images.
        # these are images with a (v0.0.0.0) tag, rather than a standard release
        # format tag (v0.0). We want to check this set in both containerized and
        # non-containerized installations.
        images.update(
            self.required_qualified_docker_images(
                image_info["namespace"],
                image_info["name"],
                openshift_image_tag,
            ),
        )

        return images

    @staticmethod
    def required_docker_images(namespace, name, additional_image_names, version, is_containerized):
        if is_containerized:
            return ["{}/{}:{}".format(namespace, name, version)] if name else []

        # include additional non-containerized images specific to the current deployment type
        return ["{}/{}:{}".format(namespace, img_name, version) for img_name in additional_image_names]

    @staticmethod
    def required_qualified_docker_images(namespace, name, version):
        # pylint: disable=invalid-name
        return [
            "{}/{}-{}:{}".format(namespace, name, suffix, version)
            for suffix in ["haproxy-router", "docker-registry", "deployer", "pod"]
        ]

    def local_images(self, images, task_vars):
        """Filter a list of images and return those available locally."""
        return [
            image for image in images
            if self.is_image_local(image, task_vars)
        ]

    def is_image_local(self, image, task_vars):
        result = self.module_executor("docker_image_facts", {"name": image}, task_vars)
        if result.get("failed", False):
            return False

        return bool(result.get("images", []))

    @staticmethod
    def known_docker_registries(task_vars):
        docker_facts = get_var(task_vars, "openshift", "docker")
        regs = set(docker_facts["additional_registries"])

        deployment_type = get_var(task_vars, "openshift_deployment_type")
        if deployment_type == "origin":
            regs.update(["docker.io"])
        elif "enterprise" in deployment_type:
            regs.update(["registry.access.redhat.com"])

        return list(regs)

    def available_images(self, images, registries, task_vars):
        """Inspect existing images using Skopeo and return all images successfully inspected."""
        return [
            image for image in images
            if any(self.is_available_skopeo_image(image, registry, task_vars) for registry in registries)
        ]

    def is_available_skopeo_image(self, image, registry, task_vars):
        """Uses Skopeo to determine if required image exists in a given registry."""

        cmd_str = "skopeo inspect docker://{registry}/{image}".format(
            registry=registry,
            image=image,
        )

        args = {"_raw_params": cmd_str}
        result = self.module_executor("command", args, task_vars)
        return not result.get("failed", False) and result.get("rc", 0) == 0

    # ensures that the skopeo and python-docker-py packages exist
    # check is skipped on atomic installations
    def ensure_dependencies(self, task_vars):
        if get_var(task_vars, "openshift", "common", "is_atomic"):
            return "", False, False

        result = self.module_executor("yum", {"name": self.dependencies, "state": "latest"}, task_vars)
        return result.get("msg", ""), result.get("failed", False) or result.get("rc", 0) != 0, result.get("changed")


text:
            Add Institusi

 Home

Customer

Add Institusi

Form Data Institusi

				  <?php if($this->session->flashdata('pesan')){
					  echo $this->session->flashdata('pesan');
				  } ?>

                <form role="form" action="<?php echo base_url() ?>customer/addInstitusi_act" method="post" enctype="multipart/form-data">

                      ID Institusi
                      <input name="id" type="text" class="form-control" id="exampleInput" placeholder="Nomor ID Institusi" required>

                      Nama Institusi
                      <input name="nama" type="text" class="form-control" id="exampleInput" placeholder="Nama Institusi" required>

                      Alamat
                      <input name="alamat" type="text" class="form-control" id="exampleInput" placeholder="Alamat" required>

                      No.Telephone
                      <input name="hp" type="text" class="form-control" id="exampleInput" placeholder="Nomor Telephone" required>

                      Email
                      <input name="email" type="email" class="form-control" id="exampleInput" placeholder="Email" required>

                    <button type="submit" class="btn btn-primary">Submit</button>

                </form>


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

package org.jboss.el;

import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.MethodExpression;
import javax.el.ValueExpression;

import org.jboss.el.lang.ELSupport;
import org.jboss.el.lang.ExpressionBuilder;
import org.jboss.el.util.MessageFactory;

/**
 * @see javax.el.ExpressionFactory
 *
 * @author Jacob Hookom [jacob@hookom.net]
 * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: markt $
 */
@SuppressWarnings("rawtypes")
public class ExpressionFactoryImpl extends ExpressionFactory {

	/**
	 *
	 */
	public ExpressionFactoryImpl() {
		super();
	}

	public Object coerceToType(Object obj, Class type) {
		return ELSupport.coerceToType(obj, type);
	}

	public MethodExpression createMethodExpression(ELContext context,
			String expression, Class expectedReturnType,
			Class[] expectedParamTypes) {
		if (expectedParamTypes == null) {
			throw new NullPointerException(MessageFactory
					.get("error.method.nullParms"));
		}
		ExpressionBuilder builder = new ExpressionBuilder(expression, context);
		return builder.createMethodExpression(expectedReturnType,
				expectedParamTypes);
	}

	public ValueExpression createValueExpression(ELContext context,
			String expression, Class expectedType) {
		if (expectedType == null) {
			throw new NullPointerException(MessageFactory
					.get("error.value.expectedType"));
		}
		ExpressionBuilder builder = new ExpressionBuilder(expression, context);
		return builder.createValueExpression(expectedType);
	}

	public ValueExpression createValueExpression(Object instance,
			Class expectedType) {
		if (expectedType == null) {
			throw new NullPointerException(MessageFactory
					.get("error.value.expectedType"));
		}
		return new ValueExpressionLiteral(instance, expectedType);
	}
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Statistics of Mood in UD_Portuguese</title>
    <link rel="root" href=""/>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/hint.css"/>

          home

          edit page
          issue tracker

          <gcse:search></gcse:search>

        This page pertains to UD version 2.

            It appears that you have Javascript disabled.
            Please consider enabling Javascript for this page to see the visualizations.

Treebank Statistics: UD_Portuguese: Features: Mood

This feature is universal.
It occurs with 4 different values: Cnd, Imp, Ind, Sub.

15825 tokens (7%) have a non-empty value of Mood.
4084 types (16%) occur at least once with a non-empty value of Mood.
1309 lemmas (7%) occur at least once with a non-empty value of Mood.
The feature is used with 3 part-of-speech tags: <tt>VERB</tt> (10539; 5% instances), <tt>AUX</tt> (5285; 2% instances), <tt>INTJ</tt> (1; 0% instances).

VERB

10539 <tt>VERB</tt> tokens (54% of all VERB tokens) have a non-empty value of Mood.

The most frequent other feature values with which VERB and Mood co-occurred: <tt>VerbForm</tt><tt>=Fin</tt> (10539; 100%), <tt>Gender</tt><tt>=EMPTY</tt> (10538; 100%), <tt>Person</tt><tt>=3</tt> (9824; 93%), <tt>Number</tt><tt>=Sing</tt> (8086; 77%), <tt>Tense</tt><tt>=Pres</tt> (5397; 51%).

VERB tokens may have the following values of Mood:

Cnd (144; 1% of non-empty Mood): gostaria, ficaria, daria, teria, faria, seria, diria, gostariam, tentaria, teriam

Imp (5; 0% of non-empty Mood): move, Olha, chega, vide

Ind (9688; 92% of non-empty Mood): há, disse, tem, diz, é, fez, foi, afirmou, têm, faz

Sub (702; 7% of non-empty Mood): seja, tenha, quiser, leia, recorde, haja, houver, pense, veja, for

EMPTY (8933): fazer, ter, ver, dar, dizer, feito, falar, feita, saber, manter

Paradigm chegar	<tt>Ind</tt>	<tt>Imp</tt>	<tt>Cnd</tt>	<tt>Sub</tt>

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Pres</tt></tt>	chego

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=2</tt></tt>		chega

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Fut</tt></tt>	chegará			chegar

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Imp</tt></tt>	chegava			chegasse

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Past</tt></tt>	chegou

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Pres</tt></tt>	chega			chegue

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=3</tt></tt>			chegaria

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Fut</tt></tt>	chegaremos

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Past</tt></tt>	chegámos

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Pres</tt></tt>	chegamos

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Fut</tt></tt>				chegarem

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Imp</tt></tt>	chegavam			chegassem

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Past</tt></tt>	chegaram

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Pqp</tt></tt>	chegaram

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Pres</tt></tt>	chegam			cheguem

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=3</tt></tt>	chegaram

AUX

5285 <tt>AUX</tt> tokens (84% of all AUX tokens) have a non-empty value of Mood.

The most frequent other feature values with which AUX and Mood co-occurred: <tt>VerbForm</tt><tt>=Fin</tt> (5285; 100%), <tt>Person</tt><tt>=3</tt> (5057; 96%), <tt>Number</tt><tt>=Sing</tt> (3967; 75%), <tt>Tense</tt><tt>=Pres</tt> (3163; 60%).

AUX tokens may have the following values of Mood:

Cnd (198; 4% of non-empty Mood): seria, poderia, teria, deveria, seriam, estaria, iria, teriam, acabaria, deveriam

Imp (3; 0% of non-empty Mood): Sê

Ind (4782; 90% of non-empty Mood): é, foi, está, são, foram, vai, pode, era, estão, tem

Sub (302; 6% of non-empty Mood): seja, for, tenha, fosse, possa, sejam, esteja, estejam, possam, estivesse

EMPTY (1032): ser, ter, sido, estar, sendo, serem, tendo, vir, continuar, terem

Paradigm ser	<tt>Ind</tt>	<tt>Imp</tt>	<tt>Cnd</tt>	<tt>Sub</tt>

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Fut</tt></tt>	serei

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Imp</tt></tt>	era			fosse

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Past</tt></tt>	fui

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Pqp</tt></tt>	fora

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Pres</tt></tt>	sou, sô

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=2</tt></tt>		Sê

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Fut</tt></tt>	será			for, fôr

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Imp</tt></tt>	era			fosse

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Past</tt></tt>	foi, foram

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Pqp</tt></tt>	fora

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Pres</tt></tt>	é, eis, Sou, çe			seja

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Person</tt><tt>=3</tt></tt>			seria

<tt><tt>Number</tt><tt>=Sing</tt>|<tt>Tense</tt><tt>=Imp</tt></tt>	era			fosse

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Fut</tt></tt>	seremos

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Past</tt></tt>	fomos

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Pres</tt></tt>	somos

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Fut</tt></tt>	serão			forem

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Imp</tt></tt>	eram			fossem

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Past</tt></tt>	foram

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Pqp</tt></tt>	foram

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=3</tt>|<tt>Tense</tt><tt>=Pres</tt></tt>	são			sejam

<tt><tt>Number</tt><tt>=Plur</tt>|<tt>Person</tt><tt>=3</tt></tt>	foram		seriam

INTJ

1 <tt>INTJ</tt> tokens (2% of all INTJ tokens) have a non-empty value of Mood.

INTJ tokens may have the following values of Mood:

Ind (1; 100% of non-empty Mood): viu

EMPTY (42): não, Rarará, é, Adeus, Ah, Ai, Alô, BINGO, Deus, Droga

Relations with Agreement in Mood

The 10 most frequent relations where parent and child node agree in Mood:
<tt>VERB –[<tt>conj</tt>]–> VERB</tt> (742; 72%),
<tt>VERB –[<tt>parataxis</tt>]–> VERB</tt> (87; 70%),
<tt>AUX –[<tt>conj</tt>]–> VERB</tt> (1; 100%),
<tt>AUX –[<tt>cop</tt>]–> AUX</tt> (1; 100%).

© 2014–2021
            Universal Dependencies contributors.
            Site powered by Annodoc and brat
.


text:
package com.socrata.datacoordinator.secondary
package sql

import java.sql.{Timestamp, Connection}

import org.joda.time.DateTime
import com.rojoma.simplearm.v2._
import com.socrata.datacoordinator.util.TimingReport

class SqlSecondaryStoresConfig(conn: Connection, timingReport: TimingReport) extends SecondaryStoresConfig {
  private def t = timingReport

  def lookup(storeId: String): Option[SecondaryConfigInfo] = {
    val sql = """
      SELECT store_id, next_run_time, interval_in_seconds, group_name
        FROM secondary_stores_config
       WHERE store_id = ?""".stripMargin

    for {
      stmt <- managed(conn.prepareStatement(sql))
      _ <- unmanaged(stmt.setString(1, storeId))
      rs <- managed(stmt.executeQuery())
    } {
      if(rs.next()) {
        Some(SecondaryConfigInfo(
          rs.getString("store_id"),
          new DateTime(rs.getTimestamp("next_run_time").getTime),
          rs.getInt("interval_in_seconds"),
          Option(rs.getString("group_name")).getOrElse("")))
      } else {
        None
      }
    }
  }

  def create(secondaryInfo: SecondaryConfigInfo): SecondaryConfigInfo =
    using(conn.prepareStatement(
      """INSERT INTO secondary_stores_config (store_id
        |  ,next_run_time
        |  ,interval_in_seconds
        |) VALUES (?, ?, ?)""".stripMargin)) { stmt =>
      stmt.setString(1, secondaryInfo.storeId)
      stmt.setTimestamp(2, new Timestamp(secondaryInfo.nextRunTime.getMillis))
      stmt.setInt(3, secondaryInfo.runIntervalSeconds)
      stmt.execute()
      secondaryInfo
    }

  def updateNextRunTime(storeId: String, newNextRunTime: DateTime) {
    using(conn.prepareStatement(
      """UPDATE secondary_stores_config
        |SET next_run_time = ?
        |WHERE store_id = ?""".stripMargin)) { stmt =>
      stmt.setTimestamp(1, new Timestamp(newNextRunTime.getMillis))
      stmt.setString(2, storeId)
      t("update-next-runtime", "store-id" -> storeId)(stmt.execute())
    }
  }

  def group(storeId: String): Option[String] = {
    val sql = """
      SELECT group_name
        FROM secondary_stores_config
       WHERE store_id = ?""".stripMargin

    for {
      stmt <- managed(conn.prepareStatement(sql))
      _ <- unmanaged(stmt.setString(1, storeId))
      rs <- managed(stmt.executeQuery())
    } {
      if(rs.next()) {
        Option(rs.getString("group_name"))
      } else {
        None
      }
    }
  }
}


text:
<?php
require_once('../util/main.php');
require_once('../util/tags.php');
require_once('../model/database.php');
require_once('../model/product_db.php');
require_once('../model/category_db.php');

if (isset($_POST['action'])) {
    $action = $_POST['action'];
} else if (isset($_GET['action'])) {
    $action = $_GET['action'];
} else {
    $action = 'list_products';
}

switch ($action) {
    case 'list_products':
        // get current category
        $category_id = $_GET['category_id'];
        if (empty($category_id)) {
            $category_id = 1;
        }

        // get categories and products
        $current_category = get_category($category_id);
        $categories = get_categories();
        $products = get_products_by_category($category_id);

        // Display view
        include('product_list.php');
        break;
    case 'view_product':
        $categories = get_categories();

        // Get product data
        $product_id = $_GET['product_id'];
        $product = get_product($product_id);

        // Display product
        include('product_view.php');
        break;
}
?>


text:
namespace google {
namespace protobuf {
namespace compiler {
namespace python {
namespace {

class TestGenerator : public CodeGenerator {
 public:
  TestGenerator() {}
  ~TestGenerator() {}

  virtual bool Generate(const FileDescriptor* file,
                        const string& parameter,
                        GeneratorContext* context,
                        string* error) const {
    TryInsert("test_pb2.py", "imports", context);
    TryInsert("test_pb2.py", "module_scope", context);
    TryInsert("test_pb2.py", "class_scope:foo.Bar", context);
    TryInsert("test_pb2.py", "class_scope:foo.Bar.Baz", context);
    return true;
  }

  void TryInsert(const string& filename, const string& insertion_point,
                 GeneratorContext* context) const {
    google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
        context->OpenForInsert(filename, insertion_point));
    io::Printer printer(output.get(), '$');
    printer.Print("// inserted $name$\n", "name", insertion_point);
  }
};

// This test verifies that all the expected insertion points exist.  It does
// not verify that they are correctly-placed; that would require actually
// compiling the output which is a bit more than I care to do for this test.
TEST(PythonPluginTest, PluginTest) {
  GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/test.proto",
                             "syntax = \"proto2\";\n"
                             "package foo;\n"
                             "message Bar {\n"
                             "  message Baz {}\n"
                             "}\n",
                             true));

  google::protobuf::compiler::CommandLineInterface cli;
  cli.SetInputsAreProtoPathRelative(true);

  python::Generator python_generator;
  TestGenerator test_generator;
  cli.RegisterGenerator("--python_out", &python_generator, "");
  cli.RegisterGenerator("--test_out", &test_generator, "");

  string proto_path = "-I" + TestTempDir();
  string python_out = "--python_out=" + TestTempDir();
  string test_out = "--test_out=" + TestTempDir();

  const char* argv[] = {
    "protoc",
    proto_path.c_str(),
    python_out.c_str(),
    test_out.c_str(),
    "test.proto"
  };

  EXPECT_EQ(0, cli.Run(5, argv));
}

// This test verifies that the generated Python output uses regular imports (as
// opposed to importlib) in the usual case where the .proto file paths do not
// not contain any Python keywords.
TEST(PythonPluginTest, ImportTest) {
  // Create files test1.proto and test2.proto with the former importing the
  // latter.
  GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/test1.proto",
                             "syntax = \"proto3\";\n"
                             "package foo;\n"
                             "import \"test2.proto\";"
                             "message Message1 {\n"
                             "  Message2 message_2 = 1;\n"
                             "}\n",
                             true));
  GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/test2.proto",
                             "syntax = \"proto3\";\n"
                             "package foo;\n"
                             "message Message2 {}\n",
                             true));

  google::protobuf::compiler::CommandLineInterface cli;
  cli.SetInputsAreProtoPathRelative(true);
  python::Generator python_generator;
  cli.RegisterGenerator("--python_out", &python_generator, "");
  string proto_path = "-I" + TestTempDir();
  string python_out = "--python_out=" + TestTempDir();
  const char* argv[] = {"protoc", proto_path.c_str(), "-I.", python_out.c_str(),
                        "test1.proto"};
  ASSERT_EQ(0, cli.Run(5, argv));

  // Loop over the lines of the generated code and verify that we find an
  // ordinary Python import but do not find the string "importlib".
  string output;
  GOOGLE_CHECK_OK(File::GetContents(TestTempDir() + "/test1_pb2.py", &output,
                             true));
  std::vector<string> lines = Split(output, "\n");
  string expected_import = "import test2_pb2";
  bool found_expected_import = false;
  for (int i = 0; i < lines.size(); ++i) {
    if (lines[i].find(expected_import) != string::npos) {
      found_expected_import = true;
    }
    EXPECT_EQ(string::npos, lines[i].find("importlib"));
  }
  EXPECT_TRUE(found_expected_import);
}

}  // namespace
}  // namespace python
}  // namespace compiler
}  // namespace protobuf
}  // namespace google


text:
[![Build Status](https://travis-ci.org/isayme/express-boilerplate.svg?branch=master)](https://travis-ci.org/isayme/express-boilerplate)
[![Coverage Status](https://coveralls.io/repos/github/isayme/express-boilerplate/badge.svg?branch=master)](https://coveralls.io/github/isayme/express-boilerplate?branch=master)

A express application boilerplate.


text:
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using VkNet.Enums;
using VkNet.Enums.SafetyEnums;
using VkNet.Utils;
using VkNet.Utils.JsonConverter;

namespace VkNet.Model;

/// <summary>
///
/// </summary>
[Serializable]
public class OfficeUsersSpecification
{
	/// <summary>
	/// Идентификатор пользователя, добавляемого как администратор/наблюдатель.
	/// </summary>
	[JsonProperty("user_id")]
	public long UserId { get; set; }

	/// <summary>
	/// Тип полномочий.
	/// </summary>
	[JsonProperty("role")]
	[JsonConverter(typeof(SafetyEnumJsonConverter))]
	public AccessRole Role { get; set; }

	/// <summary>
	/// Массив идентификаторов клиента.
	/// </summary>
	[JsonProperty("clients_ids")]
	public int[] ClientsIds { get; set; }

	/// <summary>
	/// Доступ ко всем текущим и новым клиентам этого кабинета.
	/// </summary>
	[JsonProperty("grant_access_to_all_clients")]
	public bool GrantAccessToAllClients { get; set; }

	/// <summary>
	/// Показывать ли бюджет пользователю.
	/// </summary>
	[JsonProperty("view_budget")]
	public bool? ViewBudget { get; set; }

	public OfficeUsersSpecification FromJson(VkResponse response) => new()
	{
		UserId = response["user_id"],
		Role = response["role"],
		ClientsIds = response["client_ids"]
			.ToListOf<int>(x => x)
			.ToArray(),
		GrantAccessToAllClients = response["grant_access_to_all_clients"]
	};
}


text:
// File generated from our OpenAPI spec

declare module 'stripe' {
  namespace Stripe {
    /**
     * A coupon contains information about a percent-off or amount-off discount you
     * might want to apply to a customer. Coupons may be applied to [subscriptions](https://stripe.com/docs/api#subscriptions), [invoices](https://stripe.com/docs/api#invoices),
     * [checkout sessions](https://stripe.com/docs/api/checkout/sessions), [quotes](https://stripe.com/docs/api#quotes), and more. Coupons do not work with conventional one-off [charges](https://stripe.com/docs/api#create_charge) or [payment intents](https://stripe.com/docs/api/payment_intents).
     */
    interface Coupon {
      /**
       * Unique identifier for the object.
       */
      id: string;

      /**
       * String representing the object's type. Objects of the same type share the same value.
       */
      object: 'coupon';

      /**
       * Amount (in the `currency` specified) that will be taken off the subtotal of any invoices for this customer.
       */
      amount_off: number | null;

      applies_to?: Coupon.AppliesTo;

      /**
       * Time at which the object was created. Measured in seconds since the Unix epoch.
       */
      created: number;

      /**
       * If `amount_off` has been set, the three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the amount to take off.
       */
      currency: string | null;

      /**
       * Coupons defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
       */
      currency_options?: {
        [key: string]: Coupon.CurrencyOptions;
      };

      deleted?: void;

      /**
       * One of `forever`, `once`, and `repeating`. Describes how long a customer who applies this coupon will get the discount.
       */
      duration: Coupon.Duration;

      /**
       * If `duration` is `repeating`, the number of months the coupon applies. Null if coupon `duration` is `forever` or `once`.
       */
      duration_in_months: number | null;

      /**
       * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
       */
      livemode: boolean;

      /**
       * Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.
       */
      max_redemptions: number | null;

      /**
       * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
       */
      metadata: Stripe.Metadata | null;

      /**
       * Name of the coupon displayed to customers on for instance invoices or receipts.
       */
      name: string | null;

      /**
       * Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a %s100 invoice %s50 instead.
       */
      percent_off: number | null;

      /**
       * Date after which the coupon can no longer be redeemed.
       */
      redeem_by: number | null;

      /**
       * Number of times this coupon has been applied to a customer.
       */
      times_redeemed: number;

      /**
       * Taking account of the above properties, whether this coupon can still be applied to a customer.
       */
      valid: boolean;
    }

    namespace Coupon {
      interface AppliesTo {
        /**
         * A list of product IDs this coupon applies to
         */
        products: Array<string>;
      }

      interface CurrencyOptions {
        /**
         * Amount (in the `currency` specified) that will be taken off the subtotal of any invoices for this customer.
         */
        amount_off: number;
      }

      type Duration = 'forever' | 'once' | 'repeating';
    }

    /**
     * The DeletedCoupon object.
     */
    interface DeletedCoupon {
      /**
       * Unique identifier for the object.
       */
      id: string;

      /**
       * String representing the object's type. Objects of the same type share the same value.
       */
      object: 'coupon';

      /**
       * Always true for a deleted object
       */
      deleted: true;
    }
  }
}