text:
from __future__ import unicode_literals

from django.core.management.color import no_style
from django.core.management.sql import (sql_create, sql_delete, sql_indexes,
    sql_destroy_indexes, sql_all)
from django.db import connections, DEFAULT_DB_ALIAS, models
from django.test import TestCase
from django.utils import six

# See also initial_sql_regress for 'custom_sql_for_model' tests

class SQLCommandsTestCase(TestCase):
    """Tests for several functions in django/core/management/sql.py"""
    def test_sql_create(self):
        app = models.get_app('commands_sql')
        output = sql_create(app, no_style(), connections[DEFAULT_DB_ALIAS])
        # Lower so that Oracle's upper case tbl names wont break
        sql = output[0].lower()
        six.assertRegex(self, sql, r'^create table .commands_sql_book.*')

    def test_sql_delete(self):
        app = models.get_app('commands_sql')
        output = sql_delete(app, no_style(), connections[DEFAULT_DB_ALIAS])
        # Oracle produces DROP SEQUENCE and DROP TABLE for this command.
        if connections[DEFAULT_DB_ALIAS].vendor == 'oracle':
            sql = output[1].lower()
        else:
            sql = output[0].lower()
        six.assertRegex(self, sql, r'^drop table .commands_sql_book.*')

    def test_sql_indexes(self):
        app = models.get_app('commands_sql')
        output = sql_indexes(app, no_style(), connections[DEFAULT_DB_ALIAS])
        # PostgreSQL creates two indexes
        self.assertIn(len(output), [1, 2])
        self.assertTrue(output[0].startswith("CREATE INDEX"))

    def test_sql_destroy_indexes(self):
        app = models.get_app('commands_sql')
        output = sql_destroy_indexes(app, no_style(), connections[DEFAULT_DB_ALIAS])
        # PostgreSQL creates two indexes
        self.assertIn(len(output), [1, 2])
        self.assertTrue(output[0].startswith("DROP INDEX"))

    def test_sql_all(self):
        app = models.get_app('commands_sql')
        output = sql_all(app, no_style(), connections[DEFAULT_DB_ALIAS])
        # PostgreSQL creates two indexes
        self.assertIn(len(output), [2, 3])
        self.assertTrue(output[0].startswith('CREATE TABLE'))
        self.assertTrue(output[1].startswith('CREATE INDEX'))


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Australasian Lichenology 64: 31 (2009)

#### Original name
Buellia polyxanthonica Elix

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 * Inherited Methods
 * @method void wantToTest($text)
 * @method void wantTo($text)
 * @method void execute($callable)
 * @method void expectTo($prediction)
 * @method void expect($prediction)
 * @method void amGoingTo($argumentation)
 * @method void am($role)
 * @method void lookForwardTo($achieveValue)
 * @method void comment($description)
 * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null)
 *
 * @SuppressWarnings(PHPMD)
 */
class AcceptanceTester extends \Codeception\Actor
{
    use _generated\AcceptanceTesterActions;

    /**
     * Make authorization
     * @param string $user
     * @param string $password
     * @return int
     */
    public function login($user, $password)
    {
        $I = $this;
        $I->amOnPage('/user/login');
        $I->see('Log In', 'h1');
        $I->fillField('FormLogin[login]', $user);
        $I->fillField('FormLogin[password]', $password);
        $I->click('Do Login');
        $I->see('Account');

        $prefix = \Helper\Core::getConfig('database')['prefix'];

        return (int)$I->grabFromDatabase($prefix . 'users', 'id', ['login' => 'test1']);
    }

    /**
     * Make logout
     */
    public function logout()
    {
        $I = $this;
        $I->amOnPage('/user/logout');
    }

    /**
     * Get user id by login
     * @param string $login
     * @return int
     */
    public function getUserIdByLogin($login)
    {
        $prefix = \Helper\Core::getConfig('database')['prefix'];

        return (int)$this->grabFromDatabase($prefix . 'users', 'id', ['login' => $login]);
    }
}


text: docker build . -t mohitsethi/python-scikit-audiolab:latest


text:
#include <libioP.h>
#ifdef _LIBC
# include <dlfcn.h>
# include <wchar.h>
#endif
#include <assert.h>
#include <stdlib.h>
#include <string.h>

#ifdef _LIBC
# include <langinfo.h>
# include <locale/localeinfo.h>
# include <wcsmbs/wcsmbsload.h>
# include <iconv/gconv_int.h>
# include <shlib-compat.h>
# include <sysdep.h>
#endif

/* Prototypes of libio's codecvt functions.  */
static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
				     __mbstate_t *statep,
				     const wchar_t *from_start,
				     const wchar_t *from_end,
				     const wchar_t **from_stop, char *to_start,
				     char *to_end, char **to_stop);
static enum __codecvt_result do_unshift (struct _IO_codecvt *codecvt,
					 __mbstate_t *statep, char *to_start,
					 char *to_end, char **to_stop);
static enum __codecvt_result do_in (struct _IO_codecvt *codecvt,
				    __mbstate_t *statep,
				    const char *from_start,
				    const char *from_end,
				    const char **from_stop, wchar_t *to_start,
				    wchar_t *to_end, wchar_t **to_stop);
static int do_encoding (struct _IO_codecvt *codecvt);
static int do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
		      const char *from_start,
		      const char *from_end, _IO_size_t max);
static int do_max_length (struct _IO_codecvt *codecvt);
static int do_always_noconv (struct _IO_codecvt *codecvt);

/* The functions used in `codecvt' for libio are always the same.  */
const struct _IO_codecvt __libio_codecvt =
{
  .__codecvt_destr = NULL,		/* Destructor, never used.  */
  .__codecvt_do_out = do_out,
  .__codecvt_do_unshift = do_unshift,
  .__codecvt_do_in = do_in,
  .__codecvt_do_encoding = do_encoding,
  .__codecvt_do_always_noconv = do_always_noconv,
  .__codecvt_do_length = do_length,
  .__codecvt_do_max_length = do_max_length
};

#ifdef _LIBC
const struct __gconv_trans_data __libio_translit attribute_hidden =
{
  .__trans_fct = __gconv_transliterate
};
#endif

/* Return orientation of stream.  If mode is nonzero try to change
   the orientation first.  */
#undef _IO_fwide
int
_IO_fwide (fp, mode)
     _IO_FILE *fp;
     int mode;
{
  /* Normalize the value.  */
  mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);

#if defined SHARED && defined _LIBC \
    && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
  if (__builtin_expect (&_IO_stdin_used == NULL, 0)
      && (fp == _IO_stdin || fp == _IO_stdout || fp == _IO_stderr))
    /* This is for a stream in the glibc 2.0 format.  */
    return -1;
#endif

  /* The orientation already has been determined.  */
  if (fp->_mode != 0
      /* Or the caller simply wants to know about the current orientation.  */
      || mode == 0)
    return fp->_mode;

  /* Set the orientation appropriately.  */
  if (mode > 0)
    {
      struct _IO_codecvt *cc = fp->_codecvt = &fp->_wide_data->_codecvt;

      fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
      fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_write_base;

      /* Get the character conversion functions based on the currently
	 selected locale for LC_CTYPE.  */
#ifdef _LIBC
      {
	/* Clear the state.  We start all over again.  */
	memset (&fp->_wide_data->_IO_state, '\0', sizeof (__mbstate_t));
	memset (&fp->_wide_data->_IO_last_state, '\0', sizeof (__mbstate_t));

	struct gconv_fcts fcts;
	__wcsmbs_clone_conv (&fcts);
	assert (fcts.towc_nsteps == 1);
	assert (fcts.tomb_nsteps == 1);

	/* The functions are always the same.  */
	*cc = __libio_codecvt;

	cc->__cd_in.__cd.__nsteps = fcts.towc_nsteps;
	cc->__cd_in.__cd.__steps = fcts.towc;

	cc->__cd_in.__cd.__data[0].__invocation_counter = 0;
	cc->__cd_in.__cd.__data[0].__internal_use = 1;
	cc->__cd_in.__cd.__data[0].__flags = __GCONV_IS_LAST;
	cc->__cd_in.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;

	/* XXX For now no transliteration.  */
	cc->__cd_in.__cd.__data[0].__trans = NULL;

	cc->__cd_out.__cd.__nsteps = fcts.tomb_nsteps;
	cc->__cd_out.__cd.__steps = fcts.tomb;

	cc->__cd_out.__cd.__data[0].__invocation_counter = 0;
	cc->__cd_out.__cd.__data[0].__internal_use = 1;
	cc->__cd_out.__cd.__data[0].__flags = __GCONV_IS_LAST;
	cc->__cd_out.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;

	/* And now the transliteration.  */
	cc->__cd_out.__cd.__data[0].__trans
	  = (struct __gconv_trans_data  *) &__libio_translit;
      }
#else
# ifdef _GLIBCPP_USE_WCHAR_T
      {
	/* Determine internal and external character sets.

	   XXX For now we make our life easy: we assume a fixed internal
	   encoding (as most sane systems have; hi HP/UX!).  If somebody
	   cares about systems which changing internal charsets they
	   should come up with a solution for the determination of the
	   currently used internal character set.  */
	const char *internal_ccs = _G_INTERNAL_CCS;
	const char *external_ccs = NULL;

#  ifdef HAVE_NL_LANGINFO
	external_ccs = nl_langinfo (CODESET);
#  endif
	if (external_ccs == NULL)
	  external_ccs = "ISO-8859-1";

	cc->__cd_in = iconv_open (internal_ccs, external_ccs);
	if (cc->__cd_in != (iconv_t) -1)
	  cc->__cd_out = iconv_open (external_ccs, internal_ccs);

	if (cc->__cd_in == (iconv_t) -1 || cc->__cd_out == (iconv_t) -1)
	  {
	    if (cc->__cd_in != (iconv_t) -1)
	      iconv_close (cc->__cd_in);
	    /* XXX */
	    abort ();
	  }
      }
# else
#  error "somehow determine this from LC_CTYPE"
# endif
#endif

      /* From now on use the wide character callback functions.  */
      ((struct _IO_FILE_plus *) fp)->vtable = fp->_wide_data->_wide_vtable;

      /* One last twist: we get the current stream position.  The wide
	 char streams have much more problems with not knowing the
	 current position and so we should disable the optimization
	 which allows the functions without knowing the position.  */
      fp->_offset = _IO_SYSSEEK (fp, 0, _IO_seek_cur);
    }

  /* Set the mode now.  */
  fp->_mode = mode;

  return mode;
}

static enum __codecvt_result
do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
	const wchar_t *from_start, const wchar_t *from_end,
	const wchar_t **from_stop, char *to_start, char *to_end,
	char **to_stop)
{
  enum __codecvt_result result;

#ifdef _LIBC
  struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
  int status;
  size_t dummy;
  const unsigned char *from_start_copy = (unsigned char *) from_start;

  codecvt->__cd_out.__cd.__data[0].__outbuf = (unsigned char *) to_start;
  codecvt->__cd_out.__cd.__data[0].__outbufend = (unsigned char *) to_end;
  codecvt->__cd_out.__cd.__data[0].__statep = statep;

  __gconv_fct fct = gs->__fct;
#ifdef PTR_DEMANGLE
  if (gs->__shlib_handle != NULL)
    PTR_DEMANGLE (fct);
#endif

  status = DL_CALL_FCT (fct,
			(gs, codecvt->__cd_out.__cd.__data, &from_start_copy,
			 (const unsigned char *) from_end, NULL,
			 &dummy, 0, 0));

  *from_stop = (wchar_t *) from_start_copy;
  *to_stop = (char *) codecvt->__cd_out.__cd.__data[0].__outbuf;

  switch (status)
    {
    case __GCONV_OK:
    case __GCONV_EMPTY_INPUT:
      result = __codecvt_ok;
      break;

    case __GCONV_FULL_OUTPUT:
    case __GCONV_INCOMPLETE_INPUT:
      result = __codecvt_partial;
      break;

    default:
      result = __codecvt_error;
      break;
    }
#else
# ifdef _GLIBCPP_USE_WCHAR_T
  size_t res;
  const char *from_start_copy = (const char *) from_start;
  size_t from_len = from_end - from_start;
  char *to_start_copy = to_start;
  size_t to_len = to_end - to_start;
  res = iconv (codecvt->__cd_out, &from_start_copy, &from_len,
	       &to_start_copy, &to_len);

  if (res == 0 || from_len == 0)
    result = __codecvt_ok;
  else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
    result = __codecvt_partial;
  else
    result = __codecvt_error;

# else
  /* Decide what to do.  */
  result = __codecvt_error;
# endif
#endif

  return result;
}

static enum __codecvt_result
do_unshift (struct _IO_codecvt *codecvt, __mbstate_t *statep,
	    char *to_start, char *to_end, char **to_stop)
{
  enum __codecvt_result result;

#ifdef _LIBC
  struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
  int status;
  size_t dummy;

  codecvt->__cd_out.__cd.__data[0].__outbuf = (unsigned char *) to_start;
  codecvt->__cd_out.__cd.__data[0].__outbufend = (unsigned char *) to_end;
  codecvt->__cd_out.__cd.__data[0].__statep = statep;

  __gconv_fct fct = gs->__fct;
#ifdef PTR_DEMANGLE
  if (gs->__shlib_handle != NULL)
    PTR_DEMANGLE (fct);
#endif

  status = DL_CALL_FCT (fct,
			(gs, codecvt->__cd_out.__cd.__data, NULL, NULL,
			 NULL, &dummy, 1, 0));

  *to_stop = (char *) codecvt->__cd_out.__cd.__data[0].__outbuf;

  switch (status)
    {
    case __GCONV_OK:
    case __GCONV_EMPTY_INPUT:
      result = __codecvt_ok;
      break;

    case __GCONV_FULL_OUTPUT:
    case __GCONV_INCOMPLETE_INPUT:
      result = __codecvt_partial;
      break;

    default:
      result = __codecvt_error;
      break;
    }
#else
# ifdef _GLIBCPP_USE_WCHAR_T
  size_t res;
  char *to_start_copy = (char *) to_start;
  size_t to_len = to_end - to_start;

  res = iconv (codecvt->__cd_out, NULL, NULL, &to_start_copy, &to_len);

  if (res == 0)
    result = __codecvt_ok;
  else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
    result = __codecvt_partial;
  else
    result = __codecvt_error;
# else
  /* Decide what to do.  */
  result = __codecvt_error;
# endif
#endif

  return result;
}

static enum __codecvt_result
do_in (struct _IO_codecvt *codecvt, __mbstate_t *statep,
       const char *from_start, const char *from_end, const char **from_stop,
       wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop)
{
  enum __codecvt_result result;

#ifdef _LIBC
  struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
  int status;
  size_t dummy;
  const unsigned char *from_start_copy = (unsigned char *) from_start;

  codecvt->__cd_in.__cd.__data[0].__outbuf = (unsigned char *) to_start;
  codecvt->__cd_in.__cd.__data[0].__outbufend = (unsigned char *) to_end;
  codecvt->__cd_in.__cd.__data[0].__statep = statep;

  __gconv_fct fct = gs->__fct;
#ifdef PTR_DEMANGLE
  if (gs->__shlib_handle != NULL)
    PTR_DEMANGLE (fct);
#endif

  status = DL_CALL_FCT (fct,
			(gs, codecvt->__cd_in.__cd.__data, &from_start_copy,
			 (const unsigned char *) from_end, NULL,
			 &dummy, 0, 0));

  *from_stop = (const char *) from_start_copy;
  *to_stop = (wchar_t *) codecvt->__cd_in.__cd.__data[0].__outbuf;

  switch (status)
    {
    case __GCONV_OK:
    case __GCONV_EMPTY_INPUT:
      result = __codecvt_ok;
      break;

    case __GCONV_FULL_OUTPUT:
    case __GCONV_INCOMPLETE_INPUT:
      result = __codecvt_partial;
      break;

    default:
      result = __codecvt_error;
      break;
    }
#else
# ifdef _GLIBCPP_USE_WCHAR_T
  size_t res;
  const char *from_start_copy = (const char *) from_start;
  size_t from_len = from_end - from_start;
  char *to_start_copy = (char *) from_start;
  size_t to_len = to_end - to_start;

  res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
	       &to_start_copy, &to_len);

  if (res == 0)
    result = __codecvt_ok;
  else if (to_len == 0)
    result = __codecvt_partial;
  else if (from_len < codecvt->__codecvt_do_max_length (codecvt))
    result = __codecvt_partial;
  else
    result = __codecvt_error;
# else
  /* Decide what to do.  */
  result = __codecvt_error;
# endif
#endif

  return result;
}

static int
do_encoding (struct _IO_codecvt *codecvt)
{
#ifdef _LIBC
  /* See whether the encoding is stateful.  */
  if (codecvt->__cd_in.__cd.__steps[0].__stateful)
    return -1;
  /* Fortunately not.  Now determine the input bytes for the conversion
     necessary for each wide character.  */
  if (codecvt->__cd_in.__cd.__steps[0].__min_needed_from
      != codecvt->__cd_in.__cd.__steps[0].__max_needed_from)
    /* Not a constant value.  */
    return 0;

  return codecvt->__cd_in.__cd.__steps[0].__min_needed_from;
#else
  /* Worst case scenario.  */
  return -1;
#endif
}

static int
do_always_noconv (struct _IO_codecvt *codecvt)
{
  return 0;
}

static int
do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
	   const char *from_start, const char *from_end, _IO_size_t max)
{
  int result;
#ifdef _LIBC
  const unsigned char *cp = (const unsigned char *) from_start;
  wchar_t to_buf[max];
  struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
  size_t dummy;

  codecvt->__cd_in.__cd.__data[0].__outbuf = (unsigned char *) to_buf;
  codecvt->__cd_in.__cd.__data[0].__outbufend = (unsigned char *) &to_buf[max];
  codecvt->__cd_in.__cd.__data[0].__statep = statep;

  __gconv_fct fct = gs->__fct;
#ifdef PTR_DEMANGLE
  if (gs->__shlib_handle != NULL)
    PTR_DEMANGLE (fct);
#endif

  DL_CALL_FCT (fct,
	       (gs, codecvt->__cd_in.__cd.__data, &cp,
		(const unsigned char *) from_end, NULL,
		&dummy, 0, 0));

  result = cp - (const unsigned char *) from_start;
#else
# ifdef _GLIBCPP_USE_WCHAR_T
  const char *from_start_copy = (const char *) from_start;
  size_t from_len = from_end - from_start;
  wchar_t to_buf[max];
  size_t res;
  char *to_start = (char *) to_buf;

  res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
	       &to_start, &max);

  result = from_start_copy - (char *) from_start;
# else
  /* Decide what to do.  */
  result = 0;
# endif
#endif

  return result;
}

static int
do_max_length (struct _IO_codecvt *codecvt)
{
#ifdef _LIBC
  return codecvt->__cd_in.__cd.__steps[0].__max_needed_from;
#else
  return MB_CUR_MAX;
#endif
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.streamanalytics.generated;

import com.azure.core.util.Context;

/** Samples for Functions Test. */
public final class FunctionsTestSamples {
    /*
     * x-ms-original-file: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/stable/2020-03-01/examples/Function_Test_AzureML.json
     */
    /**
     * Sample code: Test the connection for an Azure ML function.
     *
     * @param manager Entry point to StreamAnalyticsManager.
     */
    public static void testTheConnectionForAnAzureMLFunction(
        com.azure.resourcemanager.streamanalytics.StreamAnalyticsManager manager) {
        manager.functions().test("sjrg7", "sj9093", "function588", null, Context.NONE);
    }

    /*
     * x-ms-original-file: specification/streamanalytics/resource-manager/Microsoft.StreamAnalytics/stable/2020-03-01/examples/Function_Test_JavaScript.json
     */
    /**
     * Sample code: Test the connection for a JavaScript function.
     *
     * @param manager Entry point to StreamAnalyticsManager.
     */
    public static void testTheConnectionForAJavaScriptFunction(
        com.azure.resourcemanager.streamanalytics.StreamAnalyticsManager manager) {
        manager.functions().test("sjrg1637", "sj8653", "function8197", null, Context.NONE);
    }
}


text:
// Requires:
//      utils/logger

(function (app) { 'use strict';

    // Controller for the text options side-slider
    // Constructor arguments:
    //      options: {
    //          root:   - slideout element ID
    //          text:   - full text selector
    //      }
    //      services: {             - get/set services
    //          userName (string)
    //          texts (array of pages texts)
    //          textID (index)
    //          hideText (bool)
    //          textAlign (0..1)
    //          textSpacing (0..4)
    //          showPointer (bool)
    //          highlightWord (bool)
    //          syllabificationEnabled (bool)
    //          syllabificationThreshold (number)
    //          speechEnabled (bool)
    //          speechThreshold (number)
    //          path {
    //              colorMetric (index)
    //              mapping (index)
    //              showIDs (bool)
    //              showConnections (bool)
    //              showSaccades (bool)
    //              showFixations (bool)
    //              showOriginalFixLocation (bool)
    //          }
    //          wordGazing {
    //              colorMetric (index)
    //              showFixations (bool)
    //              uniteSpacings (bool)
    //              showRegressions (bool)
    //          }
    //      }
    //      utils: {
    //          editText
    //          getTextTitle
    //      }
    function Options (options, services, utils) {

        const root = options.root || '#options';

        this._slideout = document.querySelector( root );

        const logError = app.Logger.moduleErrorPrinter( 'Options' );

        _services = services;

        _services.userName = _services.userName || logError( 'userName' );
        _services.modifiedTexts = _services.modifiedTexts || logError( 'modifiedTexts' );
        _services.textID = _services.textID || logError( 'textID' );
        _services.hideText = _services.hideText || logError( 'hideText' );
        _services.textAlign = _services.textAlign || logError( 'textAlign' );
        _services.textSpacing = _services.textSpacing || logError( 'textSpacing' );

        _services.showPointer = _services.showPointer || logError( 'showPointer' );
        _services.highlightWord = _services.highlightWord || logError( 'highlightWord' );
        _services.syllabificationEnabled = _services.syllabificationEnabled || logError( 'syllabificationEnabled' );
        _services.speechEnabled = _services.speechEnabled || logError( 'speechEnabled' );

        _services.path = _services.path || {};
        _services.path.colorMetric = _services.path.colorMetric || logError( 'path.colorMetric"' );
        _services.path.mapping = _services.path.mapping || logError( 'path.mapping"' );
        _services.path.showConnections = _services.path.showConnections || logError( 'path.showConnections' );
        _services.path.showSaccades = _services.path.showSaccades || logError( 'path.showSaccades' );
        _services.path.showFixations = _services.path.showFixations || logError( 'path.showFixations' );
        _services.path.showOriginalFixLocation = _services.path.showOriginalFixLocation || logError( 'path.showOriginalFixLocation' );

        _services.wordGazing = _services.wordGazing || {};
        _services.wordGazing.colorMetric = _services.wordGazing.colorMetric || logError( 'wordGazing.colorMetric' );
        _services.wordGazing.showFixations = _services.wordGazing.showFixations || logError( 'wordGazing.showFixations' );
        _services.wordGazing.uniteSpacings = _services.wordGazing.uniteSpacings || logError( 'wordGazing.uniteSpacings' );
        _services.wordGazing.showRegressions = _services.wordGazing.showRegressions || logError( 'wordGazing.showRegressions' );

        _utils = utils;

        const cssRules = [
            /*{
                name:        rule CSS name
                type:        the type of control to represent the rule
                selector:    rule selector
                id:          control ID
                prefix:      the rule value prefix not to be shown in the control
                suffix:      the rule value suffix not to be shown in the control
                value:     [auto-filled] rule value
                initial:   [auto-filled] initial rule value
                editor:    [auto-filled] rule control
            }*/
            { name: 'color', type: 'color', selector: options.text, id: 'text', prefix: '#', suffix: '' },
            { name: 'color', type: 'color', selector: options.text + ' .currentWord', id: 'currentWord', prefix: '#', suffix: '' },
            { name: 'font-size', type: 'string', selector: options.text, id: 'fontSize', prefix: '', suffix: '' },
            //{ name: 'line-height', type: 'string', selector: options.text, id: 'lineHeight', prefix: '', suffix: '' },
        ];

        this._style = document.createElement( 'style' );
        document.body.appendChild( this._style );

        const texts = this._slideout.querySelector( '#textID' );
        _utils.textTitles().forEach( (title, id) => {
            let option = document.createElement( 'option' );
            option.value = id;
            option.textContent = title;
            texts.appendChild( option );
        });

        const editText = this._slideout.querySelector( '.editText' );
        editText.addEventListener( 'click', () => {
            _utils.editText();
        });

        const apply = this._slideout.querySelector( '.save' );
        apply.addEventListener( 'click', () => {
            getRulesFromEditors( this._style, cssRules );
            this._slideout.classList.remove( 'expanded' );

            saveSettings( cssRules );
        });

        const close = this._slideout.querySelector( '.close' );
        close.addEventListener( 'click', () => {
            this._slideout.classList.remove( 'expanded' );
        });

        const reset = this._slideout.querySelector( '.reset' );
        reset.addEventListener( 'click', () => {
            localStorage.removeItem( OPIONS_NAME );
            location.reload();
        });

        const slideoutTitle = this._slideout.querySelector( '.title');
        slideoutTitle.addEventListener( 'click', () => {
            this._slideout.classList.toggle( 'expanded' );
            setRulesToEditors( cssRules );
        });

        window.addEventListener( 'load', () => {
            loadSettings( cssRules );
            this._style.innerHTML = cssRules.reduce( function (css, rule) {
                return css + rule.selector + ' { ' + rule.name + ': ' + rule.initial + rule.suffix + ' !important; } ';
            }, '');

            obtainInitialRules( cssRules );

            bindSettingsToEditors( this._slideout );
            bindRulesToEditors( cssRules, this._slideout );
        });
    }

    // Disables editing
    Options.prototype.lock = function () {
        this._slideout.classList.add( 'locked' );
    };

    // Enables editing
    Options.prototype.unlock = function () {
        this._slideout.classList.remove( 'locked' );
    };

    // private

    var _services;
    var _utils;

    const OPIONS_NAME = 'options';

    function loadSettings(cssRules) {
        var options = JSON.parse( localStorage.getItem( OPIONS_NAME ) );
        if (!options) {
            return;
        }

        var services = _services;

        var pop = function (storage, srv) {
            for (var name in storage) {
                if (name === 'css') {
                    continue;
                }
                else if (Array.isArray( storage[ name ] )) {
                    srv[ name ]( storage[ name ] );
                }
                else if (typeof storage[ name ] === 'object') {
                    pop( storage[ name ], srv[ name ] );
                }
                else if (srv[ name ]) {
                    srv[ name ]( storage[ name ] );
                }
            }
        };

        pop( options, services );

        // for (var name in options) {
        //     if (_services[ name ]) {
        //         _services[ name ]( options[name] );
        //     }
        // }

        if (options.css) {
            var ruleInitilization = (rule) => {
                if (rule.selector === parts[0] && rule.name === parts[1]) {
                    rule.initial = options.css[ savedRule ];
                }
            };
            for (var savedRule in options.css) {
                var parts = savedRule.split( '____' );
                cssRules.forEach( ruleInitilization );
            }
        }
    }

    function saveSettings(cssRules) {
        var options = {};
        var services = _services;

        var push = function (storage, srv) {
            for (var name in srv) {
                if (typeof srv[ name ] === 'function') {
                    storage[ name ] = srv[ name ]();
                }
                else if (typeof srv[ name ] === 'object') {
                    storage[ name ] = { };
                    push( storage[ name ], srv[ name ] );
                }
            }
        };

        push( options, services );

        options.css = {};
        cssRules.forEach( function (rule) {
            options.css[ rule.selector + '____' + rule.name ] = rule.value;
        });

        localStorage.setItem( OPIONS_NAME, JSON.stringify( options) );
    }

    function componentToHex( c ) {
        var hex = c.toString(16);
        return hex.length == 1 ? "0" + hex : hex;
    }

    function rgbToHex( r, g, b ) {
        return '#' + componentToHex( r ) + componentToHex( g ) + componentToHex( b );
    }

    function cssColorToHex( cssColor ) {

        var colorRegex = /^\D+(\d+)\D+(\d+)\D+(\d+)\D+$/gim;
        var colorComps = colorRegex.exec( cssColor );

        return rgbToHex(
            parseInt( colorComps[ 1 ] ),
            parseInt( colorComps[ 2 ] ),
            parseInt( colorComps[ 3 ] ) );
    }

    function cssToJS( cssName ) {

        var dashIndex = cssName.indexOf( '-' );
        while (dashIndex >= 0) {
            var char = cssName.charAt( dashIndex + 1);
            cssName = cssName.replace( '-' + char,  char.toUpperCase() );
            dashIndex = cssName.indexOf( '-' );
        }
        return cssName;
    }

    function obtainInitialRules( rules ) {

        for (var s = 0; s < document.styleSheets.length; s++) {
            var sheet = document.styleSheets[ s ];
            for (var r = 0; r < sheet.cssRules.length; r++) {
                var rule = sheet.cssRules[ r ];
                for (var c = 0; c < rules.length; c++) {
                    var customRule = rules[ c ];
                    if (rule.selectorText === customRule.selector) {
                        if (customRule.initial === undefined) {
                            if (customRule.type === 'color') {
                                customRule.initial = cssColorToHex( rule.style.color );
                            }
                            else if (customRule.type === 'string') {
                                customRule.initial = rule.style[ cssToJS( customRule.name ) ];
                            }
                        }
                        customRule.value = customRule.initial;
                    }
                }
            }
        }
    }

    function bindRulesToEditors( rules, root ) {

        for (var i = 0; i < rules.length; i++) {
            var rule = rules[ i ];
            rule.editor = root.querySelector( '#' + rule.id );

            if (rule.type === 'color') {
                rule.editor.value = rule.initial;  //color.fromString( rule.initial );
            }
            else if (rule.type === 'string') {
                rule.editor.value = rule.initial;
            }
        }
    }

    function getRulesFromEditors( style, rules ) {

        var styleText = '';
        for (var i = 0; i < rules.length; i++) {
            var rule = rules[ i ];
            if (rule.type === 'color') {
                rule.value = rule.editor.value; //'#' + rule.editor.color;
            }
            else if (rule.type === 'string') {
                rule.value = rule.editor.value;
            }
            styleText += rule.selector + ' { ' + rule.name + ': ' + rule.value + rule.suffix + ' !important; } ';
        }
        style.innerHTML = styleText;
    }

    function setRulesToEditors( rules ) {

        for (var i = 0; i < rules.length; i++) {
            var rule = rules[ i ];
            if (rule.type === 'color') {
                rule.editor.value = rule.value;//color.fromString( rules.value );
            }
            else if (rule.type === 'string') {
                rule.editor.value = rule.value;
            }
        }
    }

    function bindSettingsToEditors( root ) {
        var bindCheckbox = (id, service) => {
            var flag = root.querySelector( '#' + id );
            flag.checked = service();
            flag.addEventListener( 'click', function () {
                service( this.checked );
            });
        };

        var bindSelect = (id, service) => {
            var select = root.querySelector( '#' + id );
            select.selectedIndex = service();
            select.addEventListener( 'change', function () {
                service( this.selectedIndex );
            });
        };

        var bindValue = (id, service) => {
            var text = root.querySelector( '#' + id );
            text.value = service();
            text.addEventListener( 'change', function () {
                service( this.value );
            });
        };

        var bindRadios = (name, service) => {
            var radioButtons = Array.from( root.querySelectorAll( `input[name=${name}]` ) );
            radioButtons.forEach( (radio, index) => {
                radio.checked = service() === index;
                radio.addEventListener( 'change', function () {
                    service( this.value );
                });
            });
        };

        bindValue( 'userName', _services.userName );
        bindSelect( 'textID', _services.textID );
        bindCheckbox( 'hiddenText', _services.hideText );
        bindRadios( 'textAlign', _services.textAlign );
        bindRadios( 'lineSpacing', _services.textSpacing );

        bindCheckbox( 'showPointer', _services.showPointer );
        bindCheckbox( 'syllabificationEnabled', _services.syllabificationEnabled );
        bindValue( 'syllabificationThreshold', _services.syllabificationThreshold );
        bindCheckbox( 'syllabificationSmartThreshold', _services.syllabificationSmartThreshold );
        bindValue( 'syllabificationSmartThresholdMin', _services.syllabificationSmartThresholdMin );
        bindValue( 'syllabificationSmartThresholdMax', _services.syllabificationSmartThresholdMax );
        bindValue( 'syllabificationSmartThresholdFactor', _services.syllabificationSmartThresholdFactor );
        bindCheckbox( 'speechEnabled', _services.speechEnabled );
        bindValue( 'speechThreshold', _services.speechThreshold );
        bindCheckbox( 'highlightWord', _services.highlightWord );

        /*
        bindSelect( 'path_mapping', _services.path.mapping );

        bindSelect( 'path_colorMetric', _services.path.colorMetric );
        bindCheckbox( 'path_showIDs', _services.path.showIDs );
        bindCheckbox( 'path_showConnections', _services.path.showConnections );
        bindCheckbox( 'path_showSaccades', _services.path.showSaccades );
        bindCheckbox( 'path_showFixations', _services.path.showFixations );
        bindCheckbox( 'path_showOriginalFixLocation', _services.path.showOriginalFixLocation );

        bindSelect( 'wordGazing_colorMetric', _services.wordGazing.colorMetric );
        bindCheckbox( 'wordGazing_showFixations', _services.wordGazing.showFixations );
        bindCheckbox( 'wordGazing_uniteSpacings', _services.wordGazing.uniteSpacings );
        bindCheckbox( 'wordGazing_showRegressions', _services.wordGazing.showRegressions );
        */
    }

    app.Options = Options;

})( this.Reading || module.this.exports );


text:
date: 2011-06-08 17:50:42+00:00
layout: post
image:
  thumbnail: /images/blog/20110608-195030.jpg
slug: aficion-retomada-la-lectura
title: 'Afición retomada: La lectura'
categories: day-by-day
---

Desde que me compré el Kindle, bueno ya un poco antes, he vuelto a retomar una de mis aficiones favoritas. Música y a leer sentado en alguna esquina de la casa. Un día para olvidar en el trabajo... Hay que cambiar todavía más. Trabajar más en asertividad, productividad y empatía.

[![20110608-195030.jpg](/images/blog/20110608-195030.jpg)](/images/blog/20110608-195030.jpg)


text:
extern "rust-intrinsic" {
    fn float_to_int_unchecked<Float: Copy, Int: Copy>(value: Float) -> Int;
}

fn main() {
    unsafe {
        float_to_int_unchecked::<f64, u128>(u128::MAX as f64); //~ ERROR: cannot be represented in target type `u128`
    }
}


text:
<?php
/*
 * REQUIRES KIRJASTODB-class
 *
 * This is the class for making multi-lingual-sites possible.
 * The class will fetch different languages from the database, including submit-buttons and other elements
 */

class Languages {
    private $DB;
    private $texts = array();
    private $generalTexts = array();
    private $page;
    private $localeVariables;
    private $countryCodes;
    private $country = "";

    function __construct(mysqli $DB, $country="eng", $page="") {
        $this->countryCodes = array(
            "longTag"=>(array(
                "eng"=>"en_EN",
                "fin"=>"fi_FI")
            ),
            "shortTag"=>(array(
                "eng"=>"EN",
                "fin"=>"FI")
            ),
            "countryName"=>(array(
                "eng"=>"England",
                "fin"=>"Finland")
            ));

        $this->country = $country;
        $this->setPage($page);
        $this->setDB($DB);
        $this->setLocaleVars($country);

        $haku = $DB->query("SELECT place, text, page FROM languages WHERE (page = '".$this->DB->filterVariable($page)."' OR page = 'generalTexts') AND language = '".$this->DB->filterVariable($country)."' ORDER BY page");
        while($tiedot = $haku->fetch_row()) {
            if($tiedot[2] == "generalTexts") {
                $this->generalTexts[$tiedot[0]] = $tiedot[1];
            } else {
                $this->texts[$tiedot[0]] = $tiedot[1];
            }
        }
    }

    // This function will make different countryTags possible, like: "eng" AND "EN" AND "en_EN":

    function getText ($place) {
        if(!isset($this->texts[$place]))
            return "[text Missing:".$place."]";
        else
            return $this->texts[$place];
    }
    function setText ($place, $value) {
        $this->texts[$place] = $value;
    }
    function getGeneralText ($place) {
        return $this->generalTexts[$place];
    }
    function getShortCountryTag () {
        return $this->countryCodes["shortTag"][$this->country];
    }
    function getLongCountryTag () {
        return $this->countryCodes["longTag"][$this->country];
    }
    function getLocaleVariable ($what) {
        return $this->localeVariables[$what];
    }
    function setLocaleVars ($country) {
        $this->country= $country;
        setlocale(LC_ALL, $this->getLongCountryTag());
        $this->localeVariables = localeconv();
    }
    function setDB (mysqli $DB) {
        $this->DB = $DB;
    }
    function setPage ($page) {
        $this->page = $page;
    }
    function dumpGenTexts () {
    var_dump($this->generalTexts);
    }
}
?>


text:
'use strict';

/**
 * Inject css/js files in index.html
 */

var gulp = require('gulp');
var inject = require('gulp-inject');
var filesToInject = require('./config/filesToInject');

module.exports = function() {
  return gulp.src('styles/app.scss', {cwd: 'client'})
    .pipe(inject(gulp.src(filesToInject.clientScss, {read: false, cwd: 'client'}), {
      relative: 'true'
    }))
    .pipe(gulp.dest('client/styles'));
};


text:
<archimate:ImplementationEvent
    xmlns:archimate="http://www.archimatetool.com/archimate"
    name="Implementation Event"
    id="3599dc9f-d13a-4b42-876d-c1281b0c2994"/>


text:
using System;
using System.Collections.Generic;
using Assets.Code.Bon;
using Assets.Code.Bon.Nodes;
using Assets.Code.Bon.Socket;
using UnityEngine;

[Serializable]
[GraphContextMenuItem("Geometry", "Model")]
public class ModelNode : Node
{
	private InputSocket _inputSocketPosition;
	private InputSocket _inputSocketRotation;
	private InputSocket _inputSocketScale;
	private InputSocket _inputSocketModelName;

	private Rect _tmpRect;

	public ModelNode(int id, Graph parent) : base(id, parent)
	{
		_inputSocketPosition = new InputSocket(this, typeof(AbstractVector3Node));
		_inputSocketRotation = new InputSocket(this, typeof(AbstractVector3Node));
		_inputSocketScale = new InputSocket(this, typeof(AbstractVector3Node));
		_inputSocketModelName = new InputSocket(this, typeof(AbstractStringNode));

		Sockets.Add(_inputSocketModelName);
		Sockets.Add(_inputSocketPosition);
		Sockets.Add(_inputSocketRotation);
		Sockets.Add(_inputSocketScale);

		Height = 100;
		_tmpRect = new Rect();
	}

	public override void OnGUI()
	{
		GUI.skin.label.alignment = TextAnchor.MiddleLeft;
		_tmpRect.Set(3, 0, 50, 20);
		GUI.Label(_tmpRect, "file");

		_tmpRect.Set(3, 20, 50, 20);
		GUI.Label(_tmpRect, "position");

		_tmpRect.Set(3, 40, 50, 20);
		GUI.Label(_tmpRect, "rotation");

		_tmpRect.Set(3, 60, 50, 20);
		GUI.Label(_tmpRect, "scale");

	}

	public string GetModelFileName()
	{
		if (!_inputSocketModelName.CanGetResult()) return null;
		return ((AbstractStringNode) _inputSocketModelName.GetConnectedSocket().Parent).GetString(_inputSocketModelName.GetConnectedSocket());
	}

	public List<Vector3> GetPositions(float x, float y, float z, float sizeX, float sizeY, float sizeZ, float seed)
	{
		if (!_inputSocketPosition.CanGetResult()) return null;
		return AbstractVector3Node.GetInputVector3List(_inputSocketPosition, x, y, z, sizeX, sizeY, sizeZ, seed);
	}

	public override void Update()
	{

	}
}


text:
etcd is a distributed key-value store designed to reliably and quickly preserve and provide access to critical data. It enables reliable distributed coordination through distributed locking, leader elections, and write barriers. An etcd cluster is intended for high availability and permanent data storage and retrieval.

## Getting started

New etcd users and developers should get started by [downloading and building][download_build] etcd. After getting etcd, follow this [quick demo][demo] to see the basics of creating and working with an etcd cluster.

## Developing with etcd

The easiest way to get started using etcd as a distributed key-value store is to [set up a local cluster][local_cluster].

 - [Setting up local clusters][local_cluster]
 - [Interacting with etcd][interacting]
 - [API references][api_ref]
 - [gRPC gateway][api_grpc_gateway]
 - [gRPC naming and discovery][grpc_naming]
 - [Embedding etcd][embed_etcd]
 - [Experimental features and APIs][experimental]
 - [System limits][system-limit]

## Operating etcd clusters

Administrators who need to create reliable and scalable key-value stores for the developers they support should begin with a [cluster on multiple machines][clustering].

 - [Setting up etcd clusters][clustering]
 - [Setting up etcd gateways][gateway]
 - [Setting up etcd gRPC proxy (pre-alpha)][grpc_proxy]
 - [Run etcd clusters inside containers][container]
 - [Hardware recommendations][hardware]
 - [Configuration][conf]
 - [Security][security]
 - [Monitoring][monitoring]
 - [Maintenance][maintenance]
 - [Understand failures][failures]
 - [Disaster recovery][recovery]
 - [Performance][performance]
 - [Versioning][versioning]
 - [Supported platform][supported_platform]

## Learning

To learn more about the concepts and internals behind etcd, read the following pages:

 - Why etcd (TODO)
 - [Understand data model][data_model]
 - [Understand APIs][understand_apis]
 - [Glossary][glossary]
 - Internals (TODO)

## Upgrading and compatibility

 - [Migrate applications from using API v2 to API v3][v2_migration]
 - [Updating v2.3 to v3.0][v3_upgrade]

## Frequently Asked Questions (FAQ)

Answers to [common questions] about etcd.

[api_ref]: dev-guide/api_reference_v3.md
[api_grpc_gateway]: dev-guide/api_grpc_gateway.md
[clustering]: op-guide/clustering.md
[conf]: op-guide/configuration.md
[system-limit]: dev-guide/limit.md
[common questions]: faq.md
[data_model]: learning/data_model.md
[demo]: demo.md
[download_build]: dl_build.md
[embed_etcd]: https://godoc.org/github.com/coreos/etcd/embed
[grpc_naming]: dev-guide/grpc_naming.md
[failures]: op-guide/failures.md
[gateway]: op-guide/gateway.md
[glossary]: learning/glossary.md
[grpc_proxy]: op-guide/grpc_proxy.md
[hardware]: op-guide/hardware.md
[interacting]: dev-guide/interacting_v3.md
[local_cluster]: dev-guide/local_cluster.md
[performance]: op-guide/performance.md
[recovery]: op-guide/recovery.md
[maintenance]: op-guide/maintenance.md
[security]: op-guide/security.md
[monitoring]: op-guide/monitoring.md
[v2_migration]: op-guide/v2-migration.md
[container]: op-guide/container.md
[understand_apis]: learning/api.md
[versioning]: op-guide/versioning.md
[supported_platform]: op-guide/supported-platform.md
[experimental]: dev-guide/experimental_apis.md
[v3_upgrade]: upgrades/upgrade_3_0.md


text:
module Aerospike

  module ParticleType

    # Server particle types. Unsupported types are commented out.
    NULL = 0
    INTEGER = 1
    DOUBLE = 2
    STRING = 3
    BLOB = 4
    RUBY_BLOB = 10
    BOOL = 17
    HLL = 18
    MAP = 19
    LIST = 20
    GEOJSON = 23

  end # module

end # module


text:
<?xml version="1.0"?>
<!--
/**
 * @category   Kendesign
 * @package    Kendesign_LowerPriceForm
 * @author     ModuleCreator
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
 -->
<config>
    <modules>
        <Kendesign_Lowerpriceform>
            <active>true</active>
            <codePool>local</codePool>
        </Kendesign_Lowerpriceform>
    </modules>
</config>


text:
angular.module( 'gizmos.filters' ).filter( 'ordinalWord', [
  function() {
    return function( number ) {
      var baseWords, decaWords
      var decaOrdinalWord, nonDecaOrdinalWord, ordinalWord

      number = Math.abs( +number ) || 0

      baseWords = [ 'zeroth','first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelvth', 'thirteenth', 'fourteenth', 'fifteenth', 'sixteenth', 'seventeenth', 'eighteenth', 'nineteenth' ]

      decaWords = [ 'twent', 'thirt', 'fourt', 'fift', 'sixt', 'sevent', 'eight', 'ninet' ]

      decaOrdinalWord = function( number ) {
        return decaWords[ Math.floor( number / 10 ) - 2 ] + 'ieth'
      }

      nonDecaOrdinalWord = function( number ) {
        return decaWords[ Math.floor( number / 10 ) - 2 ] + 'y-' + baseWords[ number % 10 ]
      }

      ordinalWord = function( number ) {
        if ( number < 20 ) {
          return baseWords[ number ]
        }

        if ( number % 10 === 0 ) {
          return decaOrdinalWord( number )
        }

        return nonDecaOrdinalWord( number )
      }

      return ordinalWord( number )
    }
  }
]);