text:
		                            <img src="<?php echo base_url(); ?>assets/front/demo/slides/8.png" alt="">

Makanan & Minuman

Kantin Sekolah Elektronik

		                               Menyediakan makanan dan minuman sehat,
 Konsumsi makanan sehat melatih disiplin anak
 dan membuat daya serap anak saat belajar makin tinggi.

		                                <img src="<?php echo base_url(); ?>uploads/images/slider1.jpg" alt="">

		                            <img src="<?php echo base_url(); ?>assets/front/demo/slides/8.png" alt="">

Penandatanganan

Prasasti

		                               Tanggal 2 Mei 2015
Gubernur Provinsi Jawa Timur
Dr. H. Soekarwo, S.H, M.Hum.
Meresmikan Kantin Sekolah Elektronik

		                                <img src="<?php echo base_url(); ?>uploads/images/resmi-KSE.jpg" alt="">

		                            <img src="<?php echo base_url(); ?>assets/front/demo/slides/8.png" alt="">

Mendukung

Gerakan Nasional

		                               Kantin Sekolah Elektronik
Turut serta mendukung :
1. Gerakan Nasional Percepatan Perbaikan Gizi
2. Gerakan Memasyarakat Makan Ikan
3. Gerakan Nasional Non tunai
4. Gerakan Sarapan Bersama di Sekolah

		                                <img src="<?php echo base_url(); ?>uploads/images/program-pemerintah.jpg" alt="">

		                            <img src="<?php echo base_url(); ?>assets/front/demo/slides/8.png" alt="">

Prestasi

Kantin Sekolah Elektronik

		                               Tanggal 17 Desember 2015
Juara Kompetisi Iwic 9 Indosat Ooredoo
 Wireless Innovation Contest kategori apps developer

		                                <img src="<?php echo base_url(); ?>uploads/images/piagam-indosat2.jpg" alt="">

    ×

Selamat Datang di Kantin Sekolah Elektronik - KSE

Kantin Sekolah elektronik adalah sistem yang dibangun untuk memudahkan produsen menghasilkan sarapan atau Panganan Jajan Anak Sekolah (PJAS) yang higienis, bergizi, bebas bahan berbahaya bagi tubuh dengan harga yang murah. Sistem PERTAMA dan SATU-SATUNYA di Indonesia yang menjual PJAS secara online. Layanan cepat di gerai kantin, agar semua siswa dapat menikmati sarapan dengan nyaman dalam waktu singkat. Selain itu KSE, memberdayakan UMKM yang sudah ada di sekolah maupun di luar pagar sekolah. Proses pembuatan di dapur mengikuti standard dan prosedur serta diawasi langsung oleh ahli gizi setiap hari.

<a class="btn btn-inverse" href="<?php echo site_url('cara-bergabung')?>">BERGABUNG

Sehat

Semua menu makanan & minuman di supervisi oleh ahli gizi setiap hari.

Cepat

Dengan kartu barcode, tidak perlu antre untuk mengambil pesanan.

Menarik

Terdapat info nutrisi disetiap menu yang dikonsumsi.

Aman

Pembelian tanpa menggunakan uang tunai

Mudah

Pembelian dengan ponsel, unduh melalui playstore (gratis).

Terjamin

Program di dukung oleh pakar dan profesional.

Terjadwal

Menu sarapan dapat di program sampai dengan satu bulan ke depan.

Nyaman

Peserta didik dapat menikmati waktu sarapan / makan siang lebih panjang.

Langsung

Bermanfaat pada kesehatan peserta didik.

Praktis

menu kantin sekolah, langsung di unduh di website.

Menguntungkan

Bagi Pengelola kantin Kepastian pembayaran & omset yang meningkat

Meyakinkan

Bagi orangtua siswa merasa yakin pada kualitas makanan.

Produk Kami

                                <?php foreach ($produk as $list):?>

                                                    <img alt="" src="<?php echo base_url('uploads/images/'.$list->GAMBAR_MENU);?>" class="max-image">

                                                                <a data-animate="elasticInDown" rel="prettyPhoto[portfolio]" class="a0" href="<?php echo site_url('uploads/images/'.$list->GAMBAR_MENU);?>">

<?php echo $list->NAMA_MENU;?> <?php echo $list->NAMA_KATEGORI;?>
ada info nutrisi

Beli

                                <?php endforeach;?>

Tentang Kami

KSE

Visi KSE

Misi KSE

Kantin Sekolah Elektronik

Kantin Sekolah elektronik adalah sistem yang dibangun untuk memudahkan produsen menghasilkan sarapan atau Panganan Jajan Anak Sekolah (PJAS) yang higienis, bergizi, bebas bahan berbahaya bagi tubuh dengan harga yang murah. Layanan cepat di gerai kantin, agar semua siswa dapat menikmati sarapan dengan nyaman dalam waktu singkat. Selain itu KSE, memberdayakan UMKM yang sudah ada di sekolah maupun di luar pagar sekolah. Sistem PERTAMA dan SATU-SATUNYA di Indonesia yang menjual PJAS secara online. Proses pembuatan di dapur mengikuti standard dan prosedur serta diawasi langsung oleh ahli gizi setiap hari.

Visi KSE

Menjadikan generasi muda  Indonesia(khususnya  siswa dan  mahasiswa) memiliki BUDAYA SEHAT setara dengan siswa di negara maju dunia.

Misi KSE

1. Menjadikan sekolah dan kampus sebagai komunitas yang memiliki budaya mengkonsumsi  makanan sehat, aman, higienis dan menghindari mengkonsumsi makanan dan minuman yang bergizi buruk.

2. Menjadikan  sarapan/makan siang di sekolah   sebagai kegiatan yang dilakukan secara rutin dan terstruktur oleh setiap komunitas guru,siswa, mahasiswa di seluruh Indonesia.

3. Mengedukasi produsen Panganan Jajan Anak Sekolah ( PJAS ) / kuliner untuk menyajikan makanan dan minuman yang sesuai standar keamanan dan kesehatan.

                        	<img src="<?php echo base_url(); ?>uploads/images/maskot.png" alt="" width="60%">

Partner Kami

                                            <img alt="" src="<?php echo base_url(); ?>uploads/images/2.jpg">

                                            <img alt="" src="<?php echo base_url(); ?>uploads/images/4.jpg">

                                            <img alt="" src="<?php echo base_url(); ?>uploads/images/7.jpg">

                                            <img alt="" src="<?php echo base_url(); ?>uploads/images/9.jpg">

                                            <img alt="" src="<?php echo base_url(); ?>uploads/images/10.jpg">

                                            <img alt="" src="<?php echo base_url(); ?>uploads/images/8.jpg">

                                            <img alt="" src="<?php echo base_url(); ?>uploads/images/1.jpg">

                                            <img alt="" src="<?php echo base_url(); ?>uploads/images/11.jpg">


text:
package com.facebook.buck.util.autosparse;

import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;

import com.facebook.buck.cli.FakeBuckConfig;
import com.facebook.buck.event.BuckEventBus;
import com.facebook.buck.event.BuckEventBusForTests;
import com.facebook.buck.io.ProjectFilesystemDelegate;
import com.facebook.buck.io.ProjectFilesystemDelegateFactory;
import com.facebook.buck.testutil.integration.TestDataHelper;
import com.facebook.buck.timing.FakeClock;
import com.facebook.buck.util.TestProcessExecutorFactory;
import com.facebook.buck.util.versioncontrol.HgCmdLineInterface;
import com.facebook.buck.util.versioncontrol.SparseSummary;
import com.facebook.buck.util.versioncontrol.VersionControlBuckConfig;
import com.facebook.buck.util.versioncontrol.VersionControlCommandFailedException;
import com.facebook.buck.zip.Unzip;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.eventbus.Subscribe;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import org.junit.After;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

public class AutoSparseIntegrationTest {
  /*
   * Tests against a sparse repository containing the tree:
   *
   * | file1 x
   * | file2
   * | file3 -> file2
   * | not_hidden *
   * | sparse_profile *
   * |
   * + subdir
   * |   |
   * |   + file_in_subdir
   * |
   * * not_hidden_subdir
   *     |
   *     + file_in_subdir_not_hidden
   *
   * All files are hidden by the sparse profile except for files marked with an asterisk. Files with
   * an x behind them are executable.
   *
   * Test requires the hg sparse extension to be available.
   */

  private static final String HG_REPO_ZIP = "hg_repo.zip";
  private static final String REPO_DIR = "sparse_repo";

  private static Path repoPath;

  @SuppressWarnings("javadoc")
  @ClassRule
  public static TemporaryFolder tempFolder = new TemporaryFolder();

  private static HgCmdLineInterface repoCmdline;

  @BeforeClass
  public static void setUpClass() throws IOException, InterruptedException {
    repoPath = explodeRepoZip();
    repoCmdline =
        new HgCmdLineInterface(
            new TestProcessExecutorFactory(),
            repoPath,
            new VersionControlBuckConfig(FakeBuckConfig.builder().build()).getHgCmd(),
            ImmutableMap.of());
  }

  @Before
  public void setUp() throws InterruptedException {
    assumeHgInstalled();
    assumeHgSparseInstalled();
  }

  @After
  public void tearDown() {
    AbstractAutoSparseFactory.perSCRoot.clear();
  }

  @Test
  public void testAutosparseDisabled() throws InterruptedException {
    ProjectFilesystemDelegate delegate = createDelegate(repoPath, false, ImmutableList.of());
    Assume.assumeFalse(delegate instanceof AutoSparseProjectFilesystemDelegate);
  }

  @Test
  public void testAutosparseEnabledHgSubdir() throws InterruptedException {
    ProjectFilesystemDelegate delegate =
        createDelegate(repoPath.resolve("not_hidden_subdir"), true, ImmutableList.of());
    Assume.assumeTrue(delegate instanceof AutoSparseProjectFilesystemDelegate);
  }

  @Test
  public void testAutosparseEnabledNotHgDir() throws InterruptedException {
    ProjectFilesystemDelegate delegate =
        createDelegate(repoPath.getParent(), true, ImmutableList.of());
    Assume.assumeFalse(delegate instanceof AutoSparseProjectFilesystemDelegate);
  }

  @Test
  public void testRelativePath() throws InterruptedException {
    ProjectFilesystemDelegate delegate = createDelegate();
    Path path = delegate.getPathForRelativePath(Paths.get("subdir/file_in_subdir"));
    Assert.assertEquals(path, repoPath.resolve("subdir/file_in_subdir"));
  }

  @Test
  public void testExecutableFile() throws InterruptedException {
    ProjectFilesystemDelegate delegate = createDelegate();
    Assume.assumeTrue(delegate.isExecutable(repoPath.resolve("file1")));
  }

  @Test
  public void testNotExecutableFile() throws InterruptedException {
    ProjectFilesystemDelegate delegate = createDelegate();
    Assume.assumeFalse(delegate.isExecutable(repoPath.resolve("file2")));
  }

  @Test
  public void testExecutableNotExisting() throws InterruptedException {
    ProjectFilesystemDelegate delegate = createDelegate();
    Assume.assumeFalse(delegate.isExecutable(repoPath.resolve("nonsuch")));
  }

  @Test
  public void testSymlink() throws InterruptedException {
    ProjectFilesystemDelegate delegate = createDelegate();
    Assume.assumeTrue(delegate.isSymlink(repoPath.resolve("file3")));
  }

  @Test
  public void testNotSymLink() throws InterruptedException {
    ProjectFilesystemDelegate delegate = createDelegate();
    Assume.assumeFalse(delegate.isSymlink(repoPath.resolve("file2")));
  }

  @Test
  public void testSymlinkNotExisting() throws InterruptedException {
    ProjectFilesystemDelegate delegate = createDelegate();
    Assume.assumeFalse(delegate.isSymlink(repoPath.resolve("nonsuch")));
  }

  @Test
  public void testExists() throws InterruptedException {
    ProjectFilesystemDelegate delegate = createDelegate();
    Assume.assumeTrue(delegate.exists(repoPath.resolve("file1")));
  }

  @Test
  public void testNotExists() throws InterruptedException {
    ProjectFilesystemDelegate delegate = createDelegate();
    Assume.assumeFalse(delegate.exists(repoPath.resolve("nonsuch")));
  }

  @Test
  public void testExistsUntracked() throws InterruptedException, IOException {
    ProjectFilesystemDelegate delegate = createDelegate();
    File newFile = repoPath.resolve("newFile").toFile();
    new FileOutputStream(newFile).close();
    Assume.assumeTrue(delegate.exists(newFile.toPath()));
  }

  @Test
  public void testMaterialize() throws InterruptedException, IOException {
    ProjectFilesystemDelegate delegate = createDelegate(repoPath, true, ImmutableList.of("subdir"));
    // Touch various files, these should be part of the profile
    delegate.exists(repoPath.resolve("file1"));
    delegate.exists(repoPath.resolve("file2"));
    // Only directly include the file, not the parent dir
    delegate.exists(repoPath.resolve("subdir/file_in_subdir"));
    // Only include the parent directory, not the file
    delegate.exists(repoPath.resolve("not_hidden_subdir/file_in_subdir_not_hidden"));

    BuckEventBus eventBus = BuckEventBusForTests.newInstance(new FakeClock(0));
    AutoSparseIntegrationTest.CapturingAutoSparseStateEventListener listener =
        new AutoSparseIntegrationTest.CapturingAutoSparseStateEventListener();
    eventBus.register(listener);
    delegate.ensureConcreteFilesExist(eventBus);

    List<String> lines =
        Files.readAllLines(
            repoPath.resolve(".hg/sparse"),
            Charset.forName(System.getProperty("file.encoding", "UTF-8")));
    List<String> expected =
        ImmutableList.of(
            "%include sparse_profile",
            "[include]",
            "file1",
            "file2",
            "not_hidden_subdir",
            "subdir/file_in_subdir",
            "[exclude]",
            "" // sparse always writes a newline at the end
            );
    Assert.assertEquals(expected, lines);

    // assert we got events with a matching summary
    List<AutoSparseStateEvents> events = listener.getLoggedEvents();
    Assert.assertEquals(events.size(), 2);
    Assert.assertTrue(events.get(0) instanceof AutoSparseStateEvents.SparseRefreshStarted);
    Assert.assertTrue(events.get(1) instanceof AutoSparseStateEvents.SparseRefreshFinished);
    SparseSummary summary = ((AutoSparseStateEvents.SparseRefreshFinished) events.get(1)).summary;
    Assert.assertEquals(summary.getProfilesAdded(), 0);
    Assert.assertEquals(summary.getIncludeRulesAdded(), 4);
    Assert.assertEquals(summary.getExcludeRulesAdded(), 0);
    Assert.assertEquals(summary.getFilesAdded(), 3);
    Assert.assertEquals(summary.getFilesDropped(), 0);
    Assert.assertEquals(summary.getFilesConflicting(), 0);
  }

  private static void assumeHgInstalled() throws InterruptedException {
    // If Mercurial is not installed on the build box, then skip tests.
    try {
      repoCmdline.currentRevisionId();
    } catch (VersionControlCommandFailedException ex) {
      Assume.assumeNoException(ex);
    }
  }

  private static void assumeHgSparseInstalled() {
    // If hg sparse throws an exception, then skip tests.
    Throwable exception = null;
    try {
      Path exportFile = Files.createTempFile("buck_autosparse_rules", "");
      try (Writer writer = new BufferedWriter(new FileWriter(exportFile.toFile()))) {
        writer.write("[include]\n"); // deliberately mostly empty
      }
      repoCmdline.exportHgSparseRules(exportFile);
    } catch (VersionControlCommandFailedException | InterruptedException | IOException e) {
      exception = e;
    }
    Assume.assumeNoException(exception);
  }

  private static ProjectFilesystemDelegate createDelegate() throws InterruptedException {
    return createDelegate(repoPath, true, ImmutableList.of());
  }

  private static ProjectFilesystemDelegate createDelegate(
      Path root, boolean enableAutosparse, ImmutableList<String> autosparseIgnore)
      throws InterruptedException {
    String hgCmd = new VersionControlBuckConfig(FakeBuckConfig.builder().build()).getHgCmd();
    return ProjectFilesystemDelegateFactory.newInstance(
        root,
        root.resolve("buck-out"),
        hgCmd,
        AutoSparseConfig.of(enableAutosparse, autosparseIgnore));
  }

  private static Path explodeRepoZip() throws InterruptedException, IOException {
    Path testDataDir = TestDataHelper.getTestDataDirectory(AutoSparseIntegrationTest.class);
    // Use a real path to resolve funky symlinks (I'm looking at you, OS X).
    Path destination = tempFolder.getRoot().toPath().toRealPath();
    Path hgRepoZipPath = testDataDir.resolve(HG_REPO_ZIP);
    Path hgRepoZipCopyPath = destination.resolve(HG_REPO_ZIP);

    Path repoPath = destination.resolve(REPO_DIR);
    Files.copy(hgRepoZipPath, hgRepoZipCopyPath, REPLACE_EXISTING);

    Unzip.extractZipFile(
        hgRepoZipCopyPath, repoPath, Unzip.ExistingFileMode.OVERWRITE_AND_CLEAN_DIRECTORIES);

    return repoPath;
  }

  public static class CapturingAutoSparseStateEventListener {
    private final List<AutoSparseStateEvents> logEvents = new ArrayList<>();

    @Subscribe
    public void logEvent(AutoSparseStateEvents event) {
      logEvents.add(event);
    }

    public List<AutoSparseStateEvents> getLoggedEvents() {
      return logEvents;
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
/**
 * @file    hal_sdc.h
 * @brief   SDC Driver macros and structures.
 *
 * @addtogroup SDC
 * @{
 */

#ifndef HAL_SDC_H
#define HAL_SDC_H

#if (HAL_USE_SDC == TRUE) || defined(__DOXYGEN__)

/*===========================================================================*/
/* Driver constants.                                                         */
/*===========================================================================*/

/**
 * @name    SD card types
 * @{
 */
#define SDC_MODE_CARDTYPE_MASK              0xFU
#define SDC_MODE_CARDTYPE_SDV11             0U
#define SDC_MODE_CARDTYPE_SDV20             1U
#define SDC_MODE_CARDTYPE_MMC               2U
#define SDC_MODE_HIGH_CAPACITY              0x10U
/** @} */

/**
 * @name    SDC bus error conditions
 * @{
 */
#define SDC_NO_ERROR                        0U
#define SDC_CMD_CRC_ERROR                   1U
#define SDC_DATA_CRC_ERROR                  2U
#define SDC_DATA_TIMEOUT                    4U
#define SDC_COMMAND_TIMEOUT                 8U
#define SDC_TX_UNDERRUN                     16U
#define SDC_RX_OVERRUN                      32U
#define SDC_STARTBIT_ERROR                  64U
#define SDC_OVERFLOW_ERROR                  128U
#define SDC_UNHANDLED_ERROR                 0xFFFFFFFFU
/** @} */

/*===========================================================================*/
/* Driver pre-compile time settings.                                         */
/*===========================================================================*/

/**
 * @name    SDC configuration options
 * @{
 */
/**
 * @brief   Number of initialization attempts before rejecting the card.
 * @note    Attempts are performed at 10mS intervals.
 */
#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
#define SDC_INIT_RETRY                      100
#endif

/**
 * @brief   Include support for MMC cards.
 * @note    MMC support is not yet implemented so this option must be kept
 *          at @p FALSE.
 */
#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
#define SDC_MMC_SUPPORT                     FALSE
#endif

/**
 * @brief   Delays insertions.
 * @details If enabled this options inserts delays into the MMC waiting
 *          routines releasing some extra CPU time for the threads with
 *          lower priority, this may slow down the driver a bit however.
 */
#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
#define SDC_NICE_WAITING                    TRUE
#endif

/**
 * @brief   OCR initialization constant for V20 cards.
 */
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20                    0x50FF8000U
#endif

/**
 * @brief   OCR initialization constant for non-V20 cards.
 */
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR                        0x80100000U
#endif
/** @} */

/*===========================================================================*/
/* Derived constants and error checks.                                       */
/*===========================================================================*/

/*===========================================================================*/
/* Driver data structures and types.                                         */
/*===========================================================================*/

/**
 * @brief   Type of SDIO bus mode.
 */
typedef enum {
  SDC_MODE_1BIT = 0,
  SDC_MODE_4BIT,
  SDC_MODE_8BIT
} sdcbusmode_t;

/**
 * @brief   Max supported clock.
 */
typedef enum {
  SDC_CLK_25MHz = 0,
  SDC_CLK_50MHz
} sdcbusclk_t;

#include "hal_sdc_lld.h"

/*===========================================================================*/
/* Driver macros.                                                            */
/*===========================================================================*/

/**
 * @name    Macro Functions
 * @{
 */
/**
 * @brief   Returns the card insertion status.
 * @note    This macro wraps a low level function named
 *          @p sdc_lld_is_card_inserted(), this function must be
 *          provided by the application because it is not part of the
 *          SDC driver.
 *
 * @param[in] sdcp      pointer to the @p SDCDriver object
 * @return              The card state.
 * @retval FALSE        card not inserted.
 * @retval TRUE         card inserted.
 *
 * @api
 */
#define sdcIsCardInserted(sdcp) (sdc_lld_is_card_inserted(sdcp))

/**
 * @brief   Returns the write protect status.
 * @note    This macro wraps a low level function named
 *          @p sdc_lld_is_write_protected(), this function must be
 *          provided by the application because it is not part of the
 *          SDC driver.
 *
 * @param[in] sdcp      pointer to the @p SDCDriver object
 * @return              The card state.
 * @retval FALSE        not write protected.
 * @retval TRUE         write protected.
 *
 * @api
 */
#define sdcIsWriteProtected(sdcp) (sdc_lld_is_write_protected(sdcp))
/** @} */

/*===========================================================================*/
/* External declarations.                                                    */
/*===========================================================================*/

#ifdef __cplusplus
extern "C" {
#endif
  void sdcInit(void);
  void sdcObjectInit(SDCDriver *sdcp);
  void sdcStart(SDCDriver *sdcp, const SDCConfig *config);
  void sdcStop(SDCDriver *sdcp);
  bool sdcConnect(SDCDriver *sdcp);
  bool sdcDisconnect(SDCDriver *sdcp);
  bool sdcRead(SDCDriver *sdcp, uint32_t startblk,
               uint8_t *buf, uint32_t n);
  bool sdcWrite(SDCDriver *sdcp, uint32_t startblk,
                const uint8_t *buf, uint32_t n);
  sdcflags_t sdcGetAndClearErrors(SDCDriver *sdcp);
  bool sdcSync(SDCDriver *sdcp);
  bool sdcGetInfo(SDCDriver *sdcp, BlockDeviceInfo *bdip);
  bool sdcErase(SDCDriver *sdcp, uint32_t startblk, uint32_t endblk);
  bool _sdc_wait_for_transfer_state(SDCDriver *sdcp);
#ifdef __cplusplus
}
#endif

#endif /* HAL_USE_SDC == TRUE */

#endif /* HAL_SDC_H */

/** @} */


text:
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models

from restapi.models.web_radio import WebRadio

class AlarmClock(models.Model):
    name = models.CharField(max_length=250)
    monday = models.BooleanField(default=False)
    tuesday = models.BooleanField(default=False)
    wednesday = models.BooleanField(default=False)
    thursday = models.BooleanField(default=False)
    friday = models.BooleanField(default=False)
    saturday = models.BooleanField(default=False)
    sunday = models.BooleanField(default=False)
    hour = models.IntegerField(validators=[
        MaxValueValidator(23),
        MinValueValidator(0)
    ])
    minute = models.IntegerField(validators=[
        MaxValueValidator(59),
        MinValueValidator(0)
    ])
    enabled = models.BooleanField(default=True)
    auto_stop_minutes = models.IntegerField(default=0)
    webradio = models.ForeignKey(WebRadio, on_delete=models.CASCADE)

    def get_day_of_week(self):
        """
        get a valid day of week period string usable with crontab
        """

        def add_el(current_string, el):
            if current_string is not None:
                el = ",%s" % el
                current_string += el
            else:
                current_string = el
            return current_string

        returned_period = None
        if self.monday:
            returned_period = add_el(returned_period, "0")
        if self.tuesday:
            returned_period = add_el(returned_period, "1")
        if self.wednesday:
            returned_period = add_el(returned_period, "2")
        if self.thursday:
            returned_period = add_el(returned_period, "3")
        if self.friday:
            returned_period = add_el(returned_period, "4")
        if self.saturday:
            returned_period = add_el(returned_period, "5")
        if self.sunday:
            returned_period = add_el(returned_period, "6")

        return returned_period


text:
using System;
using System.Configuration;

namespace RegTesting.SlimServer
{

	/// <summary>
	/// Configuration for RegTesting
	/// </summary>
	public class RegtestingServerConfiguration
	{
		/// <summary>
		/// The folder where the tests are in
		/// </summary>
		public static string Testsfolder
		{
			get
			{
				return ConfigurationManager.AppSettings["Testsfolder"];
			}
		}

		/// <summary>
		/// The folder where the screenshots are in
		/// </summary>
		public static string Screenshotsfolder
		{
			get
			{
				return ConfigurationManager.AppSettings["Screenshotsfolder"];
			}
		}

		/// <summary>
		/// the Port for the services
		/// </summary>
		public static int Port
		{
			get
			{
				string port = ConfigurationManager.AppSettings["Port"];
				return String.IsNullOrWhiteSpace(port) ? 8005 : int.Parse(port);
			}
		}

	}
}


text:
// Copyright (c) Microsoft Open Technologies, Inc.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.Collections.Immutable;
using System.Diagnostics;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis
{
    /// <summary>
    /// Helper structure to encapsulate/cache various information about metadata name of a type and
    /// name resolution options.
    /// Also, allows us to stop using strings in the APIs that accept only metadata names,
    /// making usage of them less bug prone.
    /// </summary>
    internal partial struct MetadataTypeName
    {
        /// <summary>
        /// Full metadata name of a type, includes namespace name for top level types.
        /// </summary>
        private string fullName;

        /// <summary>
        /// Namespace name for top level types.
        /// </summary>
        private string namespaceName;

        /// <summary>
        /// Name of the type without namespace prefix, but possibly with generic arity mangling present.
        /// </summary>
        private string typeName;

        /// <summary>
        /// Name of the type without namespace prefix and without generic arity mangling.
        /// </summary>
        private string unmangledTypeName;

        /// <summary>
        /// Arity of the type inferred based on the name mangling. It doesn't have to match the actual
        /// arity of the type.
        /// </summary>
        private short inferredArity;

        /// <summary>
        /// While resolving the name, consider only types with this arity.
        /// (-1) means allow any arity.
        /// If forcedArity >= 0 and useCLSCompliantNameArityEncoding, lookup may
        /// fail because forcedArity doesn't match the one encoded in the name.
        /// </summary>
        private short forcedArity;

        /// <summary>
        /// While resolving the name, consider only types following
        /// CLS-compliant generic type names and arity encoding (ECMA-335, section 10.7.2).
        /// I.e. arity is inferred from the name and matching type must have the same
        /// emitted name and arity.
        /// TODO: PERF: Encode this field elsewhere to save 4 bytes
        /// </summary>
        private bool useCLSCompliantNameArityEncoding;

        /// <summary>
        /// Individual parts of qualified namespace name.
        /// </summary>
        private ImmutableArray<string> namespaceSegments;

        public static MetadataTypeName FromFullName(string fullName, bool useCLSCompliantNameArityEncoding = false, int forcedArity = -1)
        {
            Debug.Assert(fullName != null);
            Debug.Assert(forcedArity >= -1 && forcedArity < short.MaxValue);
            Debug.Assert(forcedArity == -1 ||
                         !useCLSCompliantNameArityEncoding ||
                         forcedArity == MetadataHelpers.InferTypeArityFromMetadataName(fullName),
                         "Conflicting metadata type name resolution options!");

            MetadataTypeName name;

            name.fullName = fullName;
            name.namespaceName = null;
            name.typeName = null;
            name.unmangledTypeName = null;
            name.inferredArity = -1;
            name.useCLSCompliantNameArityEncoding = useCLSCompliantNameArityEncoding;
            name.forcedArity = (short)forcedArity;
            name.namespaceSegments = default(ImmutableArray<string>);

            return name;
        }

        public static MetadataTypeName FromNamespaceAndTypeName(
            string namespaceName, string typeName,
            bool useCLSCompliantNameArityEncoding = false, int forcedArity = -1
        )
        {
            Debug.Assert(namespaceName != null);
            Debug.Assert(typeName != null);
            Debug.Assert(forcedArity >= -1 && forcedArity < short.MaxValue);
            Debug.Assert(!typeName.Contains(MetadataHelpers.DotDelimiterString));
            Debug.Assert(forcedArity == -1 ||
                         !useCLSCompliantNameArityEncoding ||
                         forcedArity == MetadataHelpers.InferTypeArityFromMetadataName(typeName),
                         "Conflicting metadata type name resolution options!");

            MetadataTypeName name;

            name.fullName = null;
            name.namespaceName = namespaceName;
            name.typeName = typeName;
            name.unmangledTypeName = null;
            name.inferredArity = -1;
            name.useCLSCompliantNameArityEncoding = useCLSCompliantNameArityEncoding;
            name.forcedArity = (short)forcedArity;
            name.namespaceSegments = default(ImmutableArray<string>);

            return name;
        }

        public static MetadataTypeName FromTypeName(string typeName, bool useCLSCompliantNameArityEncoding = false, int forcedArity = -1)
        {
            Debug.Assert(typeName != null);
            Debug.Assert(!typeName.Contains(MetadataHelpers.DotDelimiterString));
            Debug.Assert(forcedArity >= -1 && forcedArity < short.MaxValue);
            Debug.Assert(forcedArity == -1 ||
                         !useCLSCompliantNameArityEncoding ||
                         forcedArity == MetadataHelpers.InferTypeArityFromMetadataName(typeName),
                         "Conflicting metadata type name resolution options!");

            MetadataTypeName name;

            name.fullName = typeName;
            name.namespaceName = string.Empty;
            name.typeName = typeName;
            name.unmangledTypeName = null;
            name.inferredArity = -1;
            name.useCLSCompliantNameArityEncoding = useCLSCompliantNameArityEncoding;
            name.forcedArity = (short)forcedArity;
            name.namespaceSegments = ImmutableArray<string>.Empty;

            return name;
        }

        /// <summary>
        /// Full metadata name of a type, includes namespace name for top level types.
        /// </summary>
        public string FullName
        {
            get
            {
                if (fullName == null)
                {
                    Debug.Assert(namespaceName != null);
                    Debug.Assert(typeName != null);
                    fullName = MetadataHelpers.BuildQualifiedName(namespaceName, typeName);
                }

                return fullName;
            }
        }

        /// <summary>
        /// Namespace name for top level types, empty string for nested types.
        /// </summary>
        public string NamespaceName
        {
            get
            {
                if (namespaceName == null)
                {
                    Debug.Assert(fullName != null);
                    typeName = MetadataHelpers.SplitQualifiedName(fullName, out namespaceName);
                }

                return namespaceName;
            }
        }

        /// <summary>
        /// Name of the type without namespace prefix, but possibly with generic arity mangling present.
        /// </summary>
        public string TypeName
        {
            get
            {
                if (typeName == null)
                {
                    Debug.Assert(fullName != null);
                    typeName = MetadataHelpers.SplitQualifiedName(fullName, out namespaceName);
                }

                return typeName;
            }
        }

        /// <summary>
        /// Name of the type without namespace prefix and without generic arity mangling.
        /// </summary>
        public string UnmangledTypeName
        {
            get
            {
                if (unmangledTypeName == null)
                {
                    Debug.Assert(inferredArity == -1);
                    unmangledTypeName = MetadataHelpers.InferTypeArityAndUnmangleMetadataName(TypeName, out inferredArity);
                }

                return unmangledTypeName;
            }
        }

        /// <summary>
        /// Arity of the type inferred based on the name mangling. It doesn't have to match the actual
        /// arity of the type.
        /// </summary>
        public int InferredArity
        {
            get
            {
                if (inferredArity == -1)
                {
                    Debug.Assert(unmangledTypeName == null);
                    unmangledTypeName = MetadataHelpers.InferTypeArityAndUnmangleMetadataName(TypeName, out inferredArity);
                }

                return inferredArity;
            }
        }

        /// <summary>
        /// Does name include arity mangling suffix.
        /// </summary>
        public bool IsMangled
        {
            get
            {
                return InferredArity > 0;
            }
        }

        /// <summary>
        /// While resolving the name, consider only types following
        /// CLS-compliant generic type names and arity encoding (ECMA-335, section 10.7.2).
        /// I.e. arity is inferred from the name and matching type must have the same
        /// emitted name and arity.
        /// </summary>
        public bool UseCLSCompliantNameArityEncoding
        {
            get
            {
                return useCLSCompliantNameArityEncoding;
            }
        }

        /// <summary>
        /// While resolving the name, consider only types with this arity.
        /// (-1) means allow any arity.
        /// If ForcedArity >= 0 and UseCLSCompliantNameArityEncoding, lookup may
        /// fail because ForcedArity doesn't match the one encoded in the name.
        /// </summary>
        public int ForcedArity
        {
            get
            {
                return forcedArity;
            }
        }

        /// <summary>
        /// Individual parts of qualified namespace name.
        /// </summary>
        public ImmutableArray<string> NamespaceSegments
        {
            get
            {
                if (namespaceSegments.IsDefault)
                {
                    string nsName = NamespaceName;

                    if (nsName.Length == 0)
                    {
                        namespaceSegments = ImmutableArray<string>.Empty;
                    }
                    else
                    {
                        namespaceSegments = MetadataHelpers.SplitQualifiedName(nsName).AsImmutableOrNull();
                    }
                }

                return namespaceSegments;
            }
        }

        public bool IsNull
        {
            get
            {
                return typeName == null && fullName == null;
            }
        }

        public override string ToString()
        {
            if (IsNull)
            {
                return "{Null}";
            }
            else
            {
                return String.Format("{{{0},{1},{2},{3}}}", NamespaceName, TypeName, UseCLSCompliantNameArityEncoding.ToString(), forcedArity.ToString());
            }
        }
    }
}


text:
This emulator was written with the guidance of [Alexander Dickerson's tutorial](http://blog.alexanderdickson.com/javascript-chip-8-emulator).

It is a simple Chip 8 emulator written in JavaScript.


text:
package com.garyhu.action;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.garyhu.bean.Category;
import com.garyhu.bean.Product;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class ProductAction extends ActionSupport {

	private Product product;
	private List<Product> products;
	private List<Integer> selectedProducts;

	private List<Category> categories;

	private Date date;

	private String name;

	public String getName() {
		return name;
	}

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

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public List<Category> getCategories() {
		return categories;
	}

	public void setCategories(List<Category> categories) {
		this.categories = categories;
	}

	public List<Integer> getSelectedProducts() {
		return selectedProducts;
	}

	public void setSelectedProducts(List<Integer> selectedProducts) {
		this.selectedProducts = selectedProducts;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public List<Product> getProducts() {
		return products;
	}

	public void setProducts(List<Product> products) {
		this.products = products;
	}

	public String show() {
		product  = new Product();
		product.setName("xiaomi");
		return "show";
	}

	public String add() {
		System.out.println("name = "+product.getName());
		Map m = ActionContext.getContext().getSession();
		m.put("name", product.getName());
		return "show";
	}

	public String list() {
		products = new ArrayList<Product>();
		selectedProducts = new ArrayList<Integer>();
		Product p1 = new Product();
		p1.setId(1);
		p1.setName("product1");
		Product p2 =  new Product();
		p2.setId(2);
		p2.setName("product2");
		Product p3 = new Product();
		p3.setId(3);
		p3.setName("product3");
		products.add(p1);
		products.add(p2);
		products.add(p3);

		selectedProducts.add(1);
		selectedProducts.add(2);
		return "list";
	}

	public String showList() {
		categories = new ArrayList<>();
		Category c1 = new Category();
		c1.setId(1);
		c1.setName("category1");
		Category c2 = new Category();
		c2.setId(2);
		c2.setName("category2");

		categories.add(c1);
		categories.add(c2);

		List<Product> products1=new ArrayList();
        Product p1 = new Product();
        p1.setId(1);
        p1.setName("product1");
        Product p2 = new Product();
        p2.setId(2);
        p2.setName("product2");
        Product p3 = new Product();
        p3.setId(3);
        p3.setName("product3");

        products1.add(p1);
        products1.add(p2);
        products1.add(p3);

        List<Product> products2=new ArrayList();
        Product p4 = new Product();
        p4.setId(4);
        p4.setName("product4");
        Product p5 = new Product();
        p5.setId(5);
        p5.setName("product5");
        Product p6 = new Product();
        p6.setId(6);
        p6.setName("product6");

        products2.add(p4);
        products2.add(p5);
        products2.add(p6);

        c1.setProducts(products1);
        c2.setProducts(products2);
		return "showList";
	}

	public String addPage() {
		name="default name";
		return "addPage";
	}

	//也可以采用配置文件来设置
//	public void validate() {
//		if(product.getName().length()==0) {
//			addFieldError("product.name","name can't be empty");
//		}
//	}
}


text:
/**
 *
 */
package edu.incense.android.ui;

import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentFilter.MalformedMimeTypeException;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.nfc.NdefMessage;
import android.nfc.NdefRecord;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.nfc.tech.NfcA;
import android.os.Bundle;
import android.os.Parcelable;
import android.provider.Settings;
import android.util.Log;
import android.widget.TextView;
import edu.incense.android.R;

/**
 * @author mxpxgx
 *
 */
public class NfcPlainActivity extends Activity {
    private static final String TAG = "NfcPlainActivity";
    private NfcAdapter mNfcAdapter;
    private MediaPlayer ring;

    private PendingIntent mNfcPendingIntent;
    private IntentFilter[] mWriteTagFilters;
    private IntentFilter[] mNdefExchangeFilters;

    private TextView nfcText;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mNfcAdapter = NfcAdapter.getDefaultAdapter(this);

        setContentView(R.layout.nfc_plain);

        nfcText = (TextView) findViewById(R.id.textview_nfcmessage);

        // Handle all of our received NFC intents in this activity.
        mNfcPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this,
                getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);

        // Intent filters for reading a note from a tag or exchanging over p2p.
        IntentFilter ndefDetected = new IntentFilter(
                NfcAdapter.ACTION_NDEF_DISCOVERED);
        try {
            ndefDetected.addDataType("application/incense-nfctag");
        } catch (MalformedMimeTypeException e) {
            Log.e(TAG, "Ndef intent filter failed", e);
        }
        IntentFilter techDetected = new IntentFilter(
                NfcAdapter.ACTION_TECH_DISCOVERED);

        mNdefExchangeFilters = new IntentFilter[] { ndefDetected, techDetected };

        // Intent filters for writing to a tag
        IntentFilter tagDetected = new IntentFilter(
                NfcAdapter.ACTION_TAG_DISCOVERED);
        mWriteTagFilters = new IntentFilter[] { tagDetected };

        // Load NFC sound
        ring = MediaPlayer.create(this,
                Settings.System.DEFAULT_NOTIFICATION_URI);

        // Set volume according to user current settings
        AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
        int vol = am.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
        ring.setVolume(vol, vol);
    }

    @Override
    protected void onResume() {
        super.onResume();
        // Sticky notes received from Android
        if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) {
            NdefMessage[] messages = getNdefMessages(getIntent());
            byte[] payload = messages[0].getRecords()[0].getPayload();
            String message = new String(payload);
            setIntent(new Intent()); // Consume this intent.
            sendBroadcast(message);
        }
        mNfcAdapter.enableForegroundDispatch(this, mNfcPendingIntent,
                mNdefExchangeFilters, null);

        (new Thread(runnable)).start();
    }

    @Override
    protected void onPause() {
        super.onPause();
        mNfcAdapter.disableForegroundNdefPush(this);
        if (ring != null) {
            try {
                ring.release();
            } catch (IllegalStateException e) {
                Log.e(TAG, "Could not be released.", e);
            }
        }
        // finish();
    }

    @Override
    protected void onNewIntent(Intent intent) {
        // NDEF exchange mode
        if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
            NdefMessage[] messages = getNdefMessages(intent);
            byte[] payload = messages[0].getRecords()[0].getPayload();
            String message = new String(payload);
            this.setIntent(intent);

            sendBroadcast(message);

            runnable.resetEventTime();
        } else if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction())) {
            String message = getNfcAMessage(intent);
            this.setIntent(intent);
            sendBroadcast(message);

            runnable.resetEventTime();
        }

    }

    private CloseRunnable runnable = new CloseRunnable();

    public class CloseRunnable implements Runnable {
        private final static int TIME_LENGTH_PER_EVENT = 2000;
        volatile private long startTime;
        volatile private long timeLength;

        private synchronized boolean isTimeUp() {
            long currentTime = System.currentTimeMillis();
            long time = currentTime - startTime;
            // Log.d(TAG, currentTime+" - "+startTime+" = "+time);
            return (time >= timeLength);
        }

        public synchronized void resetEventTime() {
            startTime = System.currentTimeMillis();
            if (ring != null) {
                try {
                    ring.start();
                } catch (IllegalStateException e) {
                    Log.e(TAG, "Could not be started.", e);
                }
            }
        }

        private synchronized void setTimeLength(int timeLength) {
            this.timeLength = timeLength;
        }

        public void run() {
            resetEventTime();
            setTimeLength(TIME_LENGTH_PER_EVENT);
            while (!isTimeUp()) {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    Log.e(TAG, "Sleep failed", e);
                }
            }
            NfcPlainActivity.this.finish();
        }
    }

    private NdefMessage[] getNdefMessages(Intent intent) {
        // Parse the intent
        NdefMessage[] msgs = null;
        String action = intent.getAction();
        if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)
                || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
            Parcelable[] rawMsgs = intent
                    .getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
            if (rawMsgs != null) {
                msgs = new NdefMessage[rawMsgs.length];
                for (int i = 0; i < rawMsgs.length; i++) {
                    msgs[i] = (NdefMessage) rawMsgs[i];
                }
            } else {
                // Unknown tag type
                byte[] empty = new byte[] {};
                NdefRecord record = new NdefRecord(NdefRecord.TNF_UNKNOWN,
                        empty, empty, empty);
                NdefMessage msg = new NdefMessage(new NdefRecord[] { record });
                msgs = new NdefMessage[] { msg };
            }
        } else {
            Log.d(TAG, "Unknown intent.");
            finish();
        }
        return msgs;
    }

    private String getNfcAMessage(Intent intent) {
        // Parse the intent
        String msg = null;
        String action = intent.getAction();
        if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) {
            Tag tag = (Tag) intent
                    .getParcelableExtra(NfcAdapter.ACTION_TECH_DISCOVERED);
            if (tag != null) {
                NfcA nfcA = NfcA.get(tag);
                msg = new String(nfcA.getAtqa());
            }
        }
        return msg;
    }

    public final static String NFC_TAG_ACTION = "edu.incense.android.NFC_TAG_ACTION";
    public final static String ACTION_NFC_TAG = "action_nfctag";

    public void sendBroadcast(String message) {
        //Show message in the screen
        nfcText.setText(message);
        // Send broadcast the end of this process
        Intent broadcastIntent = new Intent(NFC_TAG_ACTION);
        broadcastIntent.putExtra(ACTION_NFC_TAG, message);
        sendBroadcast(broadcastIntent);
        Log.d(TAG, "New NFC tag intent was broadcasted");
    }

    // private void toast(String text) {
    // Toast.makeText(this, text, Toast.LENGTH_SHORT).show();
    // }
}


text:
import pandas as pd
from unittest import TestCase  # or `from unittest import ...` if on Python 3.4+
import tests.helpers as th
import numpy as np

import category_encoders as encoders

np_X = th.create_array(n_rows=100)
np_X_t = th.create_array(n_rows=50, extras=True)
np_y = np.random.randn(np_X.shape[0]) > 0.5
np_y_t = np.random.randn(np_X_t.shape[0]) > 0.5
X = th.create_dataset(n_rows=100)
X_t = th.create_dataset(n_rows=50, extras=True)
y = pd.DataFrame(np_y)
y_t = pd.DataFrame(np_y_t)

class TestWeightOfEvidenceEncoder(TestCase):
    def test_woe(self):
        cols = ['unique_str', 'underscore', 'extra', 'none', 'invariant', 321, 'categorical', 'na_categorical', 'categorical_int']

        # balanced label with balanced features
        X_balanced = pd.DataFrame(data=['1', '1', '1', '2', '2', '2'], columns=['col1'])
        y_balanced = [True, False, True, False, True, False]
        enc = encoders.WOEEncoder()
        enc.fit(X_balanced, y_balanced)
        X1 = enc.transform(X_balanced)
        self.assertTrue(all(X1.sum() < 0.001),
                        "When the class label is balanced, WoE should sum to 0 in each transformed column")

        enc = encoders.WOEEncoder(cols=cols)
        enc.fit(X, np_y)
        X1 = enc.transform(X_t)
        th.verify_numeric(X1[cols])
        self.assertTrue(np.isfinite(X1[cols].values).all(),
                        'There must not be any NaN, inf or -inf in the transformed columns')
        self.assertEqual(len(list(X_t)), len(list(X1)), 'The count of attributes must not change')
        self.assertEqual(len(X_t), len(X1), 'The count of rows must not change')
        X2 = enc.transform(X_t, np_y_t)
        th.verify_numeric(X2)
        self.assertTrue(np.isfinite(X2[cols].values).all(),
                        'There must not be any NaN, inf or -inf in the transformed columns')
        self.assertEqual(len(list(X_t)), len(list(X2)), 'The count of attributes must not change')
        self.assertEqual(len(X_t), len(X2), 'The count of rows must not change')
        X3 = enc.transform(X, np_y)
        th.verify_numeric(X3)
        self.assertTrue(np.isfinite(X3[cols].values).all(),
                        'There must not be any NaN, inf or -inf in the transformed columns')
        self.assertEqual(len(list(X)), len(list(X3)), 'The count of attributes must not change')
        self.assertEqual(len(X), len(X3), 'The count of rows must not change')
        self.assertTrue(X3['unique_str'].var() < 0.001, 'The unique string column must not be predictive of the label')
        X4 = enc.fit_transform(X, np_y)
        th.verify_numeric(X4)
        self.assertTrue(np.isfinite(X4[cols].values).all(),
                        'There must not be any NaN, inf or -inf in the transformed columns')
        self.assertEqual(len(list(X)), len(list(X4)), 'The count of attributes must not change')
        self.assertEqual(len(X), len(X4), 'The count of rows must not change')
        self.assertTrue(X4['unique_str'].var() < 0.001, 'The unique string column must not be predictive of the label')

        enc = encoders.WOEEncoder()
        enc.fit(X, np_y)
        X1 = enc.transform(X_t)
        self.assertEqual(len(list(X_t)), len(list(X1)), 'The count of attributes must not change')
        self.assertEqual(len(X_t), len(X1), 'The count of rows must not change')
        th.verify_numeric(X1)
        X2 = enc.transform(X_t, np_y_t)
        th.verify_numeric(X2)
        self.assertEqual(len(list(X_t)), len(list(X2)), 'The count of attributes must not change')
        self.assertEqual(len(X_t), len(X2), 'The count of rows must not change')

        # seed
        enc = encoders.WOEEncoder(cols=cols, random_state=2001, randomized=True)
        enc.fit(X, np_y)
        X1 = enc.transform(X_t, np_y_t)
        X2 = enc.transform(X_t, np_y_t)
        self.assertTrue(X1.equals(X2), "When the seed is given, the results must be identical")
        th.verify_numeric(X1)
        th.verify_numeric(X2)

        # invariant target
        y_invariant = [True, True, True, True, True, True]
        enc = encoders.WOEEncoder()
        with self.assertRaises(ValueError):
            enc.fit(X_balanced, y_invariant)

        # branch coverage unit tests - no cols
        enc = encoders.WOEEncoder(cols=[])
        enc.fit(X, np_y)
        self.assertTrue(enc.transform(X_t).equals(X_t))

        # missing values in the target
        y_missing = [True, True, None, True, True, True]
        enc = encoders.WOEEncoder()
        with self.assertRaises(ValueError):
            enc.fit(X_balanced, y_missing)

        # impute missing
        enc = encoders.WOEEncoder(handle_missing='return_nan')
        enc.fit(X, np_y)
        X1 = enc.transform(X_t)
        th.verify_numeric(X1)
        self.assertTrue(X1.isnull().values.any())
        self.assertEqual(len(list(X_t)), len(list(X1)), 'The count of attributes must not change')
        self.assertEqual(len(X_t), len(X1), 'The count of rows must not change')

        X2 = enc.transform(X_t, np_y_t)
        th.verify_numeric(X2)
        self.assertTrue(X1.isnull().values.any())
        self.assertEqual(len(list(X_t)), len(list(X2)), 'The count of attributes must not change')
        self.assertEqual(len(X_t), len(X2), 'The count of rows must not change')

    def test_HaveArrays_ExpectCalculatedProperly(self):
        X = ['a', 'a', 'b', 'b']
        y = [1, 0, 0, 0]
        enc = encoders.WOEEncoder()

        result = enc.fit_transform(X, y)

        expected = pd.Series([0.5108256237659906, .5108256237659906, -0.587786664902119, -0.587786664902119], name=0)
        pd.testing.assert_series_equal(expected, result[0])

    def test_HandleMissingValue_HaveMissingInTrain_ExpectEncoded(self):
        X = ['a', 'a', np.nan, np.nan]
        y = [1, 0, 0, 0]
        enc = encoders.WOEEncoder(handle_missing='value')

        result = enc.fit_transform(X, y)

        expected = pd.Series([0.5108256237659906, .5108256237659906, -0.587786664902119, -0.587786664902119], name=0)
        pd.testing.assert_series_equal(expected, result[0])

    def test_HandleMissingValue_HaveMissingInTest_ExpectEncodedWithZero(self):
        X = ['a', 'a', 'b', 'b']
        y = [1, 0, 0, 0]
        test = ['a', np.nan]
        enc = encoders.WOEEncoder(handle_missing='value')

        enc.fit(X, y)
        result = enc.transform(test)

        expected = pd.Series([0.5108256237659906, 0], name=0)
        pd.testing.assert_series_equal(expected, result[0])

    def test_HandleUnknownValue_HaveUnknown_ExpectEncodedWithZero(self):
        X = ['a', 'a', 'b', 'b']
        y = [1, 0, 0, 0]
        test = ['a', 'c']
        enc = encoders.WOEEncoder(handle_unknown='value')

        enc.fit(X, y)
        result = enc.transform(test)

        expected = pd.Series([0.5108256237659906, 0], name=0)
        pd.testing.assert_series_equal(expected, result[0])


text:
package tests

import (
	"testing"
)

const nonEmptyString = "hello world"

var allStrings = []string{
	"",
	nonEmptyString,
	"\\0",
}

func TestString(t *testing.T) {
	runTestCases(t, false, "plain", flatten(allStrings))
	runTestCases(t, false, "pointers", pointersTo(flatten(allStrings)))
	runTestCases(t, false, "interfaces", interfacesTo(flatten(allStrings)))
	runTestCases(t, false, "interfacesToPointers", interfacesTo(pointersTo(flatten(allStrings))))
}


text:
class CreateComentarios < ActiveRecord::Migration
  def change
    create_table :comentarios do |t|
      t.integer :id_post
      t.string :conteudo
      t.integer :id_usuario
      t.string :data

      t.timestamps
    end
  end
end


text:
layout: page
title: >-
  Foundation training in Mindfulness-based Approaches (MBCT/MBSR) Application
  form - External
main_image_path:
permalink: /train-to-teach-mindfulness/mbct/application-external/
style: train
main_nav: false
sidebar:
jotformid: 222343432715348
_inputs:
  jotformid:
    type: number
    label: Jotform ID
    comment: Add the unique string of numbers that identifies your form on Jotform
---

For people who are not employed by Sussex Partnership or for SPFT employees who are self-funding the training in their own time.

Before completing this form, please read the 2023 Handbook for Foundation Training in Mindfulness-based Approaches.

For any queries, please email smc@spft.nhs.uk

Interviews will be on 5th, 6th and 7th December 2022, online. Applicants who are external to Sussex Partnership NHS Foundation Trust (SPFT) are welcome to submit their applications early and to request an earlier interview date.

{% if page.jotformid %}

{% endif %}


text:
namespace base {
class Thread;
}

namespace content {

class GamepadDataFetcher;
struct GamepadHardwareBuffer;

class CONTENT_EXPORT GamepadProvider :
  public base::RefCountedThreadSafe<GamepadProvider>,
  public base::SystemMonitor::DevicesChangedObserver {
 public:
  explicit GamepadProvider(GamepadDataFetcher* fetcher);

  base::SharedMemoryHandle GetRendererSharedMemoryHandle(
      base::ProcessHandle renderer_process);

  // Pause and resume the background polling thread. Can be called from any
  // thread.
  void Pause();
  void Resume();

  // base::SystemMonitor::DevicesChangedObserver implementation.
  virtual void OnDevicesChanged() OVERRIDE;

 private:
  friend class base::RefCountedThreadSafe<GamepadProvider>;

  virtual ~GamepadProvider();

  // Method for starting the polling, runs on polling_thread_.
  void DoInitializePollingThread();

  // Method for polling a GamepadDataFetcher. Runs on the polling_thread_.
  void DoPoll();
  void ScheduleDoPoll();

  GamepadHardwareBuffer* SharedMemoryAsHardwareBuffer();

  enum { kDesiredSamplingIntervalMs = 16 };

  // Keeps track of when the background thread is paused. Access to is_paused_
  // must be guarded by is_paused_lock_.
  base::Lock is_paused_lock_;
  bool is_paused_;

  // Updated based on notification from SystemMonitor when the system devices
  // have been updated, and this notification is passed on to the data fetcher
  // to enable it to avoid redundant (and possibly expensive) is-connected
  // tests. Access to devices_changed_ must be guarded by
  // devices_changed_lock_.
  base::Lock devices_changed_lock_;
  bool devices_changed_;

  // The Message Loop on which this object was created.
  // Typically the I/O loop, but may be something else during testing.
  scoped_ptr<GamepadDataFetcher> provided_fetcher_;

  // When polling_thread_ is running, members below are only to be used
  // from that thread.
  scoped_ptr<GamepadDataFetcher> data_fetcher_;
  base::SharedMemory gamepad_shared_memory_;

  // Polling is done on this background thread.
  scoped_ptr<base::Thread> polling_thread_;

  static GamepadProvider* instance_;
  base::WeakPtrFactory<GamepadProvider> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(GamepadProvider);
};

}  // namespace content

#endif  // CONTENT_BROWSER_GAMEPAD_GAMEPAD_PROVIDER_H_


text:
This application will allow a project team to play planning poker while
planning tasks to include in a forthcoming sprint.

##Technologies Used
* [CoffeeScript](http://jashkenas.github.com/coffee-script/)
* [Node.js](http://nodejs.org)
* [Express](http://expressjs.com/)
* [Jade Templating](http://jade-lang.com/)
* [Stylus
  Stylesheets](http://learnboost.github.com/stylus/docs/middleware.html)
* [Socket.io](http://socket.io)

##Setup & Run Project

```
#Assuming both Node and NPM are installed
#Install CoffeeScript globally so that you can run the project
npm install -g coffee-script
npm install -d
coffee server.coffee
```

##License
This project is licensed under the MIT license. Please see the license for more details.


text:
package query;

import java.util.Arrays;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import query.domain.Wrapper;
import query.model.Feature;
import query.model.Key;

public class QueryCache {

	final static Logger logger = LoggerFactory.getLogger(QueryCache.class);

	private Object result;
	private final Wrapper wrapper;
	private Object key;
	private Class<?>[] listenerClasses;

	public QueryCache(Wrapper wrapper) {
		this.wrapper = wrapper;
	}

	private boolean enabled() {
		return wrapper.enabled(Feature.CACHE_MODE);
	}

	public void put(Object result) {
		if (!enabled()) return;
		Cache
			.newBuilder()
			.key(getKey())
			.listen(getListenerClasses())
			.value(result)
			.build();
		this.result = result;
	}

	private void lookCache() {
		logger.debug("{} Looking at cache", wrapper);
		result = Cache.get(getKey());
	}

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}

	public boolean inCache() {
		if (enabled()){
			lookCache();
		}
		return result != null;
	}

	private Class<?>[] getListenerClasses(){
		if (listenerClasses == null) {
			listenerClasses = new Class<?>[]{wrapper.getEntityClass()};
		}
		return listenerClasses;
	}

	private Object getKey() {
		if (key == null) {
			key = new Key(wrapper);
		}
		return key;
	}

	public void setKey(Object... keys) {
		if (keys.length == 1) {
			key = keys[0];
		}else {
			key = Arrays.asList(keys).toString();
		}
	}

	public void setListenerClasses(Class<?>[] listenerClasses) {
		this.listenerClasses = listenerClasses;
	}

}


text:
#include "input/input_stdneb.h"
#include "input/base/inputgamepadbase.h"

namespace Input
{
__ImplementClass(Input::InputGamePadBase, 'IGPB', Input::InputHandler);

using namespace Input;
using namespace Util;

//------------------------------------------------------------------------------
/**
*/
InputGamePadBase::InputGamePadBase() :
    playerIndex(0),
    isConnected(false),
    buttonStates(NumButtons),
    axisValues(NumAxes, 0.0f),
    vibratorsDirty(false),
    lowFreqVibrator(0.0f),
    highFreqVibrator(0.0f),
    creatorThreadId(Threading::Thread::GetMyThreadId())
{
    // empty
}

//------------------------------------------------------------------------------
/**
*/
InputGamePadBase::~InputGamePadBase()
{
    // empty
}

//------------------------------------------------------------------------------
/**
*/
void
InputGamePadBase::OnAttach(const GPtr<InputServerBase>& inputServer )
{
    InputHandler::OnAttach(inputServer);

    // need to reset our state
    ButtonState initialButtonState;
    this->buttonStates.Fill(initialButtonState);
    this->axisValues.Fill(0.0f);
}

//------------------------------------------------------------------------------
/**
*/
void
InputGamePadBase::OnReset()
{
    InputHandler::OnReset();

    // reset button states (should behave as if the player
    // suddenly released all buttons and triggers)
    IndexT i;
    for (i = 0; i < this->buttonStates.Size(); i++)
    {
        ButtonState& btnState = this->buttonStates[i];
        if (btnState.pressed)
        {
            btnState.up = true;
        }
        else
        {
            btnState.up = false;
        }
        btnState.down = false;
        btnState.pressed = false;
    }
    this->axisValues.Fill(0.0f);
}

//------------------------------------------------------------------------------
/**
*/
String
InputGamePadBase::ButtonAsString(Button btn)
{
    switch (btn)
    {
        case DPadUpButton:          return "DPadUpButton";
        case DPadDownButton:        return "DPadDownButton";
        case DPadLeftButton:        return "DPadLeftButton";
        case DPadRightButton:       return "DPadRightButton";
        case StartButton:           return "StartButton";
        case BackButton:            return "BackButton";
        case LeftThumbButton:       return "LeftThumbButton";
        case RightThumbButton:      return "RightThumbButton";
        case LeftShoulderButton:    return "LeftShoulderButton";
        case RightShoulderButton:   return "RightShoulderButton";
        case AButton:               return "AButton";
        case BButton:               return "BButton";
        case XButton:               return "XButton";
        case YButton:               return "YButton";
        case HomeButton:            return "HomeButton";
        case PlusButton:            return "PlusButton";
        case MinusButton:           return "MinusButton";
        case OneButton:             return "OneButton";
        case TwoButton:             return "TwoButton";
        case ZButton:               return "ZButton";
        case CButton:               return "CButton";
		case SelectButton:			return "SelectButton";
        default:
            n_error("GamePadBase::ButtonAsString(): invalid button code!\n");
            return "";
    }
}

//------------------------------------------------------------------------------
/**
*/
String
InputGamePadBase::AxisAsString(Axis axis)
{
    switch (axis)
    {
        case LeftTriggerAxis:   return "LeftTriggerAxis";
        case RightTriggerAxis:  return "RightTriggerAxis";
        case LeftThumbXAxis:    return "LeftThumbXAxis";
        case LeftThumbYAxis:    return "LeftThumbYAxis";
        case RightThumbXAxis:   return "RightThumbXAxis";
        case RightThumbYAxis:   return "RightThumbYAxis";
        default:
            n_error("GamePadBase::AxisAsString(): invalid axis code!\n");
            return "";
    }
}

//------------------------------------------------------------------------------
/**
    This method should return the current state of the game pad
    as input events. It is up to a specific subclass to implement
    this method.
*/
Array<InputEvent>
InputGamePadBase::GetStateAsInputEvents() const
{
    Array<InputEvent> emptyArray;
    return emptyArray;
}

} // namespace Input


text:
package models.pfa;

import com.google.common.base.MoreObjects;
import com.google.common.collect.Multiset;

import java.util.Objects;

/**
 * SPAN - Stochastic Protocol Analyzer
 * <p>
 * Created: 1/4/18
 *
 * @author Matthew S. Bauer
 * @version 1.0
 */
public class SymbolicTransition {

    private final Multiset<StateProb> stateProbSet;

    public SymbolicTransition(Multiset<StateProb> stateProbSet) {
        this.stateProbSet = stateProbSet;
    }

    public Multiset<StateProb> getStateProbSet() {
        return stateProbSet;
    }

    @Override
    public boolean equals(Object o) {

        if (!(o instanceof SymbolicTransition)) {
            return false;
        }

        if (!stateProbSet.equals(((SymbolicTransition) o).stateProbSet)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return Objects.hash(stateProbSet);
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("state prob set", stateProbSet)
                .toString();
    }
}


text:
A [guard](https://github.com/guard/guard) plugin for automatically running tests with Play Framework.

## Installation

Add this line to your application's Gemfile:

    gem 'guard-play'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install guard-play

## Usage

Then run:

    $ guard init play

This will setup your `Guardfile` with the basics you need to watch tests. To run guard, simply run:

    $ guard

Once guard is running, anytime one of the 'watched' files is changed, the specified test will be run.

The next steps are to add additional files to watch, with accompanied tests to run. For example:

```ruby
guard 'play' do
  watch(/test\/([^\/]+)\.java$/) {|m| "#{m[1]}"}
  watch(/test\/(.+)\/(.+)\.java/) {|m| "#{m[1]}.#{m[2]}"} # watch tests in sub-packages
  watch("app/controllers/PostsController.java") { "PostsTest" }
end
```

I found it helpful to add a few helper methods for watching models and controllers:

```ruby
guard 'play' do
  def model(name, test)
    self.watch("app/models/#{name}") { test }
  end
  def controller(name, test)
    self.watch("app/controllers/#{name}") {test}
  end
  model "User.java", "UserTest" # => watch("app/models/User.java") { "UserTest" }
  controller "Auth.java", "AuthTest"
end
```

Hopefully you find it helpful!

##Todo

* support for selenium tests


text:
namespace urde {

CGunMotion::CGunMotion(CAssetId ancsId, const zeus::CVector3f& scale)
: x0_modelData(CAnimRes(ancsId, 0, scale, 0, false), 1), x4c_gunController(x0_modelData) {
  xb8_24_animPlaying = false;
  LoadAnimations();
}

void CGunMotion::LoadAnimations() {
  NWeaponTypes::get_token_vector(*x0_modelData.GetAnimationData(), 0, 14, xa8_anims, true);
}

bool CGunMotion::PlayPasAnim(SamusGun::EAnimationState state, CStateManager& mgr, float angle, bool bigStrike) {
  const CPASDatabase& pas = x0_modelData.GetAnimationData()->GetCharacterInfo().GetPASDatabase();

  s32 animId = -1;
  bool loop = true;
  switch (state) {
  case SamusGun::EAnimationState::Wander: {
    CPASAnimParmData parms((s32(state)));
    auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
    animId = anim.second;
    break;
  }
  case SamusGun::EAnimationState::Idle: {
    CPASAnimParmData parms(s32(state), CPASAnimParm::FromEnum(0));
    auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
    animId = anim.second;
    break;
  }
  case SamusGun::EAnimationState::Struck: {
    CPASAnimParmData parms(s32(state), CPASAnimParm::FromInt32(0), CPASAnimParm::FromReal32(angle),
                           CPASAnimParm::FromBool(bigStrike), CPASAnimParm::FromBool(false));
    auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
    animId = anim.second;
    loop = false;
    break;
  }
  case SamusGun::EAnimationState::FreeLook:
    x4c_gunController.EnterFreeLook(mgr, 0, -1);
    break;
  case SamusGun::EAnimationState::ComboFire:
    x4c_gunController.EnterComboFire(mgr, 0);
    break;
  default:
    break;
  }

  if (animId != -1) {
    x0_modelData.GetAnimationData()->EnableLooping(loop);
    CAnimPlaybackParms aparms(animId, -1, 1.f, true);
    x0_modelData.GetAnimationData()->SetAnimation(aparms, false);
  }

  return loop;
}

void CGunMotion::ReturnToDefault(CStateManager& mgr, bool setState) {
  x4c_gunController.ReturnToDefault(mgr, 0.f, setState);
}

void CGunMotion::BasePosition(bool bigStrikeReset) {
  x0_modelData.GetAnimationData()->EnableLooping(false);
  CAnimPlaybackParms aparms(bigStrikeReset ? 6 : 0, -1, 1.f, true);
  x0_modelData.GetAnimationData()->SetAnimation(aparms, false);
}

void CGunMotion::EnterFidget(CStateManager& mgr, SamusGun::EFidgetType type, s32 parm2) {
  xb8_24_animPlaying = true;
  x4c_gunController.EnterFidget(mgr, s32(type), 0, parm2);
}

void CGunMotion::Update(float dt, CStateManager& mgr) {
  x0_modelData.AdvanceAnimation(dt, mgr, kInvalidAreaId, true);
  if (x4c_gunController.Update(dt, mgr))
    xb8_24_animPlaying = false;
}

void CGunMotion::Draw(const CStateManager& mgr, const zeus::CTransform& xf) const {
  CModelFlags flags(0, 0, 3, zeus::skWhite);
  x0_modelData.Render(mgr, xf, nullptr, flags);
}

} // namespace urde


text:
		{{ property.access }}
		{{ property.name }}
		:
		{{ property.type.names | join(", ") }}

		{% if property.inherited %}

Inherited from {{ property.inherits }}

		{% endif %}

Default: {{ property.defaultvalue }}

{{ property.description }}

		{% if property.properties %}
			{% for subProperty in property.properties -%}
				{% include "partials/sub-property.html" %}
			{%- endfor %}
		{% endif %}
		{% if property.see %}
		{% set see = property.see %}
		{% include "partials/see.html" %}
		{% endif %}

			From
			{{ property.source }}
			:{{ property.sourceLine }}


text:
import PropTypes from 'prop-types';

export default PropTypes.shape({
  metric_name: PropTypes.string.isRequired,
  expression: PropTypes.string.isRequired,
});


text:
"""Command which bans users who ask to be banned."""
from bot.commands.abstract.command import Command
from bot.utilities.permission import Permission

class BanMe(Command):
    """Ban me part in normal messages."""

    perm = Permission.User

    def match(self, bot, user, msg, tag_info):
        """Ban if mentioning bot and contains 'ban me'."""
        return bot.config.nickname in msg.lower() and "ban me" in msg.lower()

    def run(self, bot, user, msg, tag_info):
        """Ban a user. And unban him again."""
        bot.antispeech = True
        responses = bot.config.responses["BanMe"]
        if bot.get_permission(user) in [Permission.User, Permission.Subscriber]:
            bot.ban(user)
            bot.unban(user)
            bot.write("@" + user + " " + responses["success"]["msg"])
        else:
            """A mod want to get banned/unmodded, but monkalot can't unmod them anyway"""
            bot.write("@" + user + " " + responses["fail"]["msg"])


text:
Web Starter Kit
===============

Web Starter Kit BEdita frontend from https://developers.google.com/web/starter-kit/

Setup
=====

a. Clone frontend web-starter-kit into local bedita frontend path, normally this is the __frontends__ folder inside bedita (like */var/www/bedita/frontends*), so:

```
      cd /var/www/bedita/frontends
      git clone git@github.com:bedita/web-starter-kit.git
```

b. Copy *web-starter-kit/webroot/index.php.sample* to *web-starter-kit/webroot/index.php*.

c. Copy *web-starter-kit/config/core.php.sample* to *web-starter-kit/config/core.php* and modify it, if necessary...

d. Set write permissions for temporary folder *web-starter-kit/tmp*.
    For example, in a unix shell, assuming 'john' is the username and current path is *frontends* folder:

```
      sudo chown -R john:www-data web-starter-kit/tmp
      sudo chmod -R g+w web-starter-kit/tmp
```

If something goes wrong take a look at log files (for example in *web-starter-kit/tmp/logs*) and tune your core.php file, changing debug level as needed (*web-starter-kit/config/core.php*).

Also read this article: http://docs.bedita.com/setup/if-something-goes-wrong-in-bedita


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;

using Nether.Data.Leaderboard;
using Nether.Integration.Analytics;
using Nether.Web.Features.Leaderboard.Configuration;
using Nether.Web.Utilities;
using System.Net;
using Microsoft.Extensions.Logging;
using Nether.Analytics.GameEvents;
using Nether.Web.Features.Leaderboard.Models.Leaderboard;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

namespace Nether.Web.Features.Leaderboard
{
    /// <summary>
    /// Leaderboard management
    /// </summary>
    [Route("leaderboards")]
    public class LeaderboardController : Controller
    {
        private readonly ILeaderboardStore _store;
        private readonly ILogger<LeaderboardController> _logger;
        private readonly ILeaderboardConfiguration _leaderboardConfiguration;

        public LeaderboardController(
            ILeaderboardStore store,
            ILogger<LeaderboardController> logger,
            ILeaderboardConfiguration leaderboardConfiguration
            )
        {
            _store = store;
            _logger = logger;
            _leaderboardConfiguration = leaderboardConfiguration;
        }

        /// <summary>
        /// Gets leaderboard by leaderboard configured name
        /// </summary>
        /// <returns>List of scores and gametags</returns>
        [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(LeaderboardListResponseModel))]
        [ProducesResponseType((int)HttpStatusCode.Forbidden)]
        [Authorize(Roles = RoleNames.PlayerOrAdmin)]
        [HttpGet("")]
        public IActionResult GetAll()
        {
            var gamerTag = User.GetGamerTag();

            var leaderboards = _leaderboardConfiguration.GetAll();

            return Ok(new LeaderboardListResponseModel
            {
                Leaderboards = leaderboards
                                .Select(l => new LeaderboardListResponseModel.LeaderboardSummaryModel
                                {
                                    Name = l.Name,
                                    _Link = Url.RouteUrl(nameof(Get), new { name = l.Name })
                                })
                                .ToList()
            });
        }

        /// <summary>
        /// Gets leaderboard by leaderboard configured name
        /// </summary>
        /// <param name="name">Name of the leaderboard</param>
        /// <returns>List of scores and gametags</returns>
        [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(LeaderboardGetResponseModel))]
        [ProducesResponseType((int)HttpStatusCode.Forbidden)]
        [ProducesResponseType((int)HttpStatusCode.NotFound)]
        [Authorize(Roles = RoleNames.PlayerOrAdmin)]
        [HttpGet("{name}", Name = nameof(Get))]
        public async Task<IActionResult> Get(string name)
        {
            var gamertag = User.GetGamerTag();

            LeaderboardConfig config = _leaderboardConfiguration.GetByName(name);
            if (config == null)
            {
                return NotFound();
            }
            LeaderboardType type = config.Type;
            List<GameScore> scores;
            switch (type)
            {
                case LeaderboardType.AroundMe:
                    if (gamertag == null)
                    {
                        return BadRequest(); // need a gamertag to get scores!
                    }
                    scores = await _store.GetScoresAroundMeAsync(gamertag, config.Radius);
                    break;
                case LeaderboardType.Top:
                    scores = await _store.GetTopHighScoresAsync(config.Top);
                    break;
                default:
                    scores = await _store.GetAllHighScoresAsync();
                    break;
            }

            GameScore currentPlayer = null;
            if (config.IncludeCurrentPlayer && gamertag != null)
            {
                currentPlayer = (await _store.GetScoresAroundMeAsync(gamertag, 0)).FirstOrDefault();
            }

            // Format response model
            var resultModel = new LeaderboardGetResponseModel
            {
                Entries = scores
                            ?.Select(s => LeaderboardGetResponseModel.LeaderboardEntry.Map(s, gamertag))
                            ?.ToList(),
                CurrentPlayer = LeaderboardGetResponseModel.LeaderboardEntry.Map(currentPlayer, null)
            };

            // Return result
            return Ok(resultModel);
        }
    }
}


text:
package com.sach.reflections.loading;

import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;

public class ExternalClassLoader extends URLClassLoader {

	public ExternalClassLoader(URL[] urls) throws MalformedURLException {
		super(urls);
	}

	@Override
	public Class<?> loadClass(String name) throws ClassNotFoundException {
		return super.loadClass(name);
	}

	@Override
	protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
		return super.loadClass(name, resolve);
	}

}


text:
package fr.johann_web.ARSample;

import android.location.Location;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

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

import fr.johann_web.easyar.core.ARFragment;
import fr.johann_web.easyar.core.ARMarker;
import fr.johann_web.easyar.core.ARView;

/**
 * Created by Johann on 12/02/2015.
 */
public class SampleFragment extends ARFragment implements ARView.OnChangeListener {
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle saved) {
        View view =  super.onCreateView(inflater, container, saved);

        setOnChangeListener(this);

        List<String> a = new ArrayList<>();

        addMarker(new ARMarker("", 48.557856, 7.683909, R.layout.sample_overlay));
        addMarker(new ARMarker("", 48.487694, 7.719058, R.layout.sample_overlay));
        addMarker(new ARMarker("", 48.564092, 7.705154, R.layout.sample_overlay, a));

        return view;
    }

    @Override
    protected void onTapMarker(ARMarker marker) {
        Log.i("i", marker.getLocation().toString());

    }

    @Override
    public void onLoaded() {

    }

    @Override
    public void onLocationChange(Location location) {

    }

    @Override
    public void onBearingChange(float bearing) {

    }

    @Override
    public void onOrientationChange(int orientation) {

    }
}


text:
package com.amazonaws.services.simpleworkflow.model.transform;

import java.util.Map;
import java.util.Map.Entry;
import java.math.*;
import java.nio.ByteBuffer;

import com.amazonaws.services.simpleworkflow.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * WorkflowType JSON Unmarshaller
 */
public class WorkflowTypeJsonUnmarshaller implements
        Unmarshaller<WorkflowType, JsonUnmarshallerContext> {

    public WorkflowType unmarshall(JsonUnmarshallerContext context)
            throws Exception {
        WorkflowType workflowType = new WorkflowType();

        int originalDepth = context.getCurrentDepth();
        String currentParentElement = context.getCurrentParentElement();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.getCurrentToken();
        if (token == null)
            token = context.nextToken();
        if (token == VALUE_NULL)
            return null;

        while (true) {
            if (token == null)
                break;

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("name", targetDepth)) {
                    context.nextToken();
                    workflowType.setName(context.getUnmarshaller(String.class)
                            .unmarshall(context));
                }
                if (context.testExpression("version", targetDepth)) {
                    context.nextToken();
                    workflowType.setVersion(context.getUnmarshaller(
                            String.class).unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null
                        || context.getLastParsedParentElement().equals(
                                currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth)
                        break;
                }
            }
            token = context.nextToken();
        }

        return workflowType;
    }

    private static WorkflowTypeJsonUnmarshaller instance;

    public static WorkflowTypeJsonUnmarshaller getInstance() {
        if (instance == null)
            instance = new WorkflowTypeJsonUnmarshaller();
        return instance;
    }
}


text:
package com.orcchg.dev.maxa.rxmusic.presentation.ui.util;

public interface ValueEmitter<Value> {
    void emit(Value value);
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2014, Apptentive, Inc. All Rights Reserved.
  ~ Please refer to the LICENSE file for the terms and conditions
  ~ under which redistribution and use of this file is permitted.
  -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.apptentive.android.testapp"
          android:versionCode="4"
          android:versionName="2.0">
    <application android:label="@string/app_name" android:icon="@drawable/icon">
        <activity android:name=".MainActivity"
                  android:label="@string/app_name"
                  android:launchMode="singleTop">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>


text:
![Map Legend App](maplegend.png)

THe Map Legend samples shows how to create a custom legend displaying the layers and feature displays

## Features
* ArcGISDynamicMapServiceLayer
* ArcGISLayerInfo
* Legend

## Sample Design
The ```MainActivity``` displays an ```ArcGISDynamicMapServiceLayer``` with 3 layers and one of which has a renderer. The ```ActionBar``` information button opens up a ```LegendDialogFragment`` displaying the 3 layers and the class breaks renderer on the Cities layer.


text:
Chef Server Bootstrap is a short script to configure
the superuser on the chef server by inserting data directly into postgreSQL
erchef and bifrost databases. This solves the chicken and egg problem of
no user existing to be able to create a superuser via the API.

#### Script Usage

Note that these steps should probably never be called manually anymore.
`opscode-omnibus` should be calling this script.

`bundle install`
`./bin/bootstrap-platform CONFIG_FILE USER_CONFIG_FILE`

where `CONFIG_FILE` and `USER_CONFIG_FILE` are paths.
See the `bootstrapper-config` directory for examples of configs to pass
(or the actual configs in the `opscode-omnibus` recipe `bootstrap`).

#### Script Overview

The script is fairly simple conceptually, it is basically:

1. Read the bootstrap-configs and set up a connection to postgreSQL.
2. Create the superuser bifrost object.
  + POST to `<bifrost_url_and_port>/actors`
  using the bifrost_superuser_id as the requestor_id (should be in the config).
  + This will return the new superuser's (pivotal's) authz id to be used in the next step.
3. Create the superuser in postgreSQL.
  + Simply populate a valid hash with all the relevant fields (mostly taken from the user config).
    - Various data finagling to ensure that your hash fields match the `users` table fields in postgreSQL.
    - Use the database connection established earlier to post to postgreSQL,
    with the requestor_id being the bifrost_superuser_id, since that is the only thing that makes remote sense.
4. Create the users and organizations global containers authz objects.
  + POST to `<bifrost_url_and_port>/containers`
  + Use the superuser_authz_id (pivotal's authz_id) as the requestor_id.
  + Return the created authz_id for step 5.
5. Create the users and organizations global containers.
  + These are pretty simple objects (just a map to authz).
  + Insert simple object using the authz_id created in step 4 as the
  erchef id and authz_id, a placeholder org_id (currently 00000000000000000000000000000000)
  and last_updated_by being the superuser_authz_id (pivotal's authz_id).

You now have a functioning superuser in your chef server, enjoy :)

## License

All files in the repository are licensed under the Apache 2.0 license. If any
file is missing the License header it should assume the following is attached;

```
Copyright 2014 Chef Software Inc

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.
```


text:
FactoryGirl.define do
  factory :absence do
    ignore do
      time_type :work
    end

    user
    start_date { Date.today }
    end_date { start_date }

    after(:build) do |entry, evaluator|
      entry.time_type = TEST_TIME_TYPES[evaluator.time_type]
    end

    factory :invalid_absence do
      end_date { start_date - 1.day }
    end
  end
end


text:
package ru.job4j.loop;

public class Paint {
    public String piramid(int h) {
        StringBuilder builder = new StringBuilder();
        for (int i = 1; i <= h; i++) {
            for (int j = i; j < h; j++) {
                builder.append(' ');
            }
            for (int k = 1; k < (i * 2); k++) {
                builder.append('^');
            }
            builder.append(System.getProperty("line.separator"));
        }
        String piramid = builder.toString();
        return piramid;
    }
}


text:
QUnit.module("Walidation", function () {
	QUnit.test( "object added to element on init", function( assert ) {
	  $('#walidation-form').walidation();
	  assert.ok(typeof $('#walidation-form').data('walidation') == 'object' );
	});

	QUnit.test( "object removed from element on destroy", function( assert ) {
	  $('#walidation-form').walidation();
	  var walidation = $('#walidation-form').data('walidation');

	  walidation.destroy();
	  assert.ok(typeof $('#walidation-form').data('walidation') == 'undefined');
	});

	QUnit.test("default options are set correctly", function( assert ) {
	  var defaultOptions = {
		debug         : false,
		exclude       : ['input[type=hidden]', 'input[type=submit]', 'input[type=image]', 'button[type=submit]'],
		rules         : {},
		submitSelector: 'input[type=submit], button[type=submit]',
		dataPrefix    : 'wal',
		errorMessage  : null,
		notifyFieldValueChangedDebounce : 150,
		notifyFieldStateChangedDebounce : 50,
		eventHandler: null,
		fieldUpdateEvents: 'change keyup',
		focusOnError: true,
		submitHandler: function(e, form) {
			e.preventDefault();

			if (this.validate()) {
				this.el.submit();
			}
		}
	  };
	  $('#walidation-form').walidation();
	  var walidation = $('#walidation-form').data('walidation');
	  assert.propEqual(walidation.options, defaultOptions);
	});

	QUnit.test("defined options override default options correctly", function( assert ) {
	  var options = {
		debug         : true,
		exclude       : ['select'],
		rules         : {field: {rule : ''}},
		submitSelector: 'input[type=submit]',
		dataPrefix    : 'test',
		errorMessage  : 'test',
		notifyFieldValueChangedDebounce : 200,
		notifyFieldStateChangedDebounce : 200,
		eventHandler: 'test',
		fieldUpdateEvents: 'test',
		focusOnError: false,
		submitHandler: function(e, form) {

		}
	  };
	  $('#walidation-form').walidation(options);
	  var walidation = $('#walidation-form').data('walidation');
	  assert.propEqual(walidation.options, options);
	});

	QUnit.test("disable submit buttons", function( assert ) {
	  var walidation = $('#walidation-form').walidation().data('walidation');
	  walidation.disableSubmitButtons();

	  assert.ok($('#walidation-form-submit').attr('disabled'));
	});

	QUnit.test("enable submit buttons", function( assert ) {
	  var walidation = $('#walidation-form').walidation().data('walidation');
	  walidation.disableSubmitButtons();
	  walidation.enableSubmitButtons();
	  assert.ok(!$('#walidation-form-submit').attr('disabled'));
	});

	QUnit.test("add field", function( assert ) {
	  var field      = $('<input type="text" />');
	  var walidation = $('#walidation-form').walidation().data('walidation');
	  var fieldCount = walidation.fields.length;

	  field.appendTo('#walidation-form');
	  walidation.updateFields();

	  var newFieldCount = walidation.fields.length;

	  assert.ok(newFieldCount == (fieldCount + 1));
	});

	QUnit.test("remove field", function( assert ) {
	  var field      = $('<input type="text" />');
	  field.appendTo('#walidation-form');
	  var walidation = $('#walidation-form').walidation().data('walidation');
	  var fieldCount = walidation.fields.length;

	  field.remove();
	  walidation.updateFields();
	  var newFieldCount = walidation.fields.length;

	  assert.ok(newFieldCount == (fieldCount - 1));
	});

	QUnit.test("excluding fields correctly", function( assert ) {
	  var submit     = $('#walidation-form-submit')
	  var walidation = $('#walidation-form').walidation().data('walidation');

	  assert.ok(typeof submit.data('walidationField') === 'undefined');

	  walidation.options.exclude = ['input[type=text]'];
	  walidation.updateFields();

	  assert.ok(typeof submit.data('walidationField') !== 'undefined');

	});

	QUnit.test( "init is called correctly", function( assert ) {
	  assert.expect(1);
	  $('#walidation-form').walidation({
	  	onInitialized: function() {
	  		assert.ok(true);
	  	}
	  });
	});

	QUnit.test( "destroy is called correctly", function( assert ) {
	  assert.expect(1);
	  $('#walidation-form').walidation({
	  	onDestroyed: function() {
	  		assert.ok(true);
	  	}
	  }).data('walidation').destroy();

	});

	QUnit.test("validation hooks are called correctly", function( assert ) {
	  assert.expect(2);

	  var beforeExecuted = false;
	  $('#walidation-form').walidation({
	  	beforeValidate: function() {
	  		assert.notOk(beforeExecuted);
	  		beforeExecuted = true;
	  	},
	  	afterValidate: function() {
	  		assert.ok(beforeExecuted);
	  	}
	  }).data('walidation').validate();

	});

	QUnit.test("field hooks are called correctly", function( assert ) {
	  assert.expect(2);

	  $('#walidation-form').walidation({
	  	beforeFieldValidate: function(field) {
	  		assert.ok(true, field.el.name);
	  	},
	  	afterFieldValidate: function(field) {
	  		assert.ok(true, field.el.name);
	  	}
	  }).data('walidation').validate();

	});

	QUnit.test("field init and destroy are called correctly", function( assert ) {
	  assert.expect(2);

	  $('#walidation-form').walidation({
	  	onFieldInitialized: function(field) {
	  		assert.ok(true, field.el.name);
	  	},
	  	onFieldDestroyed: function(field) {
	  		assert.ok(true, field.el.name);
	  	}
	  }).data('walidation').destroy();

	});
});

QUnit.module("WalidationField", function () {
	QUnit.test( "object added to element on init", function( assert ) {
	  $('#walidation-form').walidation();

	  assert.ok(typeof $('#walidation-form-input').data('walidationField') === 'object');
	});
	QUnit.test( "object removed from element on destroy", function( assert ) {
	  $('#walidation-form').walidation();
	  var field = $('#walidation-form-input').data('walidationField');
	  field.destroy();
	  assert.ok(typeof $('#walidation-form-input').data('walidationField') === 'undefined');
	});

	QUnit.test("validation is called", function( assert ) {
	  $('#walidation-form').walidation();
	  var field = $('#walidation-form-input').data('walidationField');
	  assert.expect(1);
	  field.addRule('test', {
	     rule: function (f) {
	     	assert.equal(f, field);
	     }
	  });
	  field.validate();
	});

	QUnit.test("validation fails on false", function( assert ) {
	  $('#walidation-form').walidation();
	  var field = $('#walidation-form-input').data('walidationField');
	  field.addRule('test', {
	     rule: function (f) {
	     	return false
	     }
	  });
	  assert.notOk(field.validate());
	});

	QUnit.test("validation succeeds on true", function( assert ) {
	  $('#walidation-form').walidation();
	  var field = $('#walidation-form-input').data('walidationField');
	  field.addRule('test', {
	     rule: function (f) {
	     	return true
	     }
	  });
	  assert.ok(field.validate());
	});

	QUnit.test("message is set correctly on error", function( assert ) {
	  $('#walidation-form').walidation();
	  var field = $('#walidation-form-input').data('walidationField');
	  field.addRule('test', {
	     rule: function (f) {
	     	return {
	     		valid: false,
	     		message: 'test'
	     	}
	     }
	  });
	  assert.notOk(field.validate());
	  assert.equal(field.errorMessage, 'test');
	});

	QUnit.test("state is set correctly on error", function( assert ) {
	  $('#walidation-form').walidation();
	  var field = $('#walidation-form-input').data('walidationField');
	  field.addRule('test', {
	     rule: function (f) {
	     	return false;
	     }
	  });
	  field.validate();
	  assert.ok(field.isInvalid());
	});

	QUnit.test("state is set correctly on success", function( assert ) {
	  $('#walidation-form').walidation();
	  var field = $('#walidation-form-input').data('walidationField');
	  field.addRule('test', {
	     rule: function (f) {
	     	return true;
	     }
	  });
	  field.validate();
	  assert.ok(field.isValid());
	});

	QUnit.test("declarative rules are defined correctly", function( assert ) {
	  var field      = $('<input type="text" data-wal-ok="true" />');
	  field.appendTo('#walidation-form');
	  $('#walidation-form').walidation();

	  var walidationField = field.data('walidationField');
	  walidationField.addRule('test', {
	     rule: function (f) {
	     	return true;
	     }
	  });
	  assert.ok(walidationField.rules.ok);
	});

	QUnit.test("option rules are defined correctly", function( assert ) {
	  var testValidation = {
	  	  a: 'test',
	  	  b: 'test'
	  };

	  var field      = $('<input type="text" name="test" />');
	  field.appendTo('#walidation-form');

	  $('#walidation-form').walidation({
	  		rules: {
	  			test: testValidation
	  		}
	  });

	  var walidationField = field.data('walidationField');

	  assert.propEqual(walidationField.rules, testValidation);
	});

	QUnit.test("option are mixed correctly", function( assert ) {
	  var testValidation = {
	  	  a: 'test',
	  	  b: 'test'
	  };
	  var expectedValidation = {
	  	  a: 'test',
	  	  b: 'test',
	  	  c: "ok"
	  };

	  var field      = $('<input type="text" name="test" data-wal-c="ok"/>');
	  field.appendTo('#walidation-form');

	  $('#walidation-form').walidation({
	  		rules: {
	  			test: testValidation
	  		}
	  });

	  var walidationField = field.data('walidationField');

	  assert.propEqual(walidationField.rules, expectedValidation);
	});

});


text:
package org.caffinitas.ohc.tables;

import java.util.Arrays;

final class LongArrayList
{
    private long[] array;
    private int size;

    public LongArrayList()
    {
        array = new long[10];
    }

    public long getLong(int i)
    {
        if (i < 0 || i >= size)
            throw new ArrayIndexOutOfBoundsException();
        return array[i];
    }

    public int size()
    {
        return size;
    }

    public void add(long value)
    {
        if (size == array.length)
            array = Arrays.copyOf(array, array.length + 10);
        array[size++] = value;
    }
}