text:
Super-duper community-powered translations. Used for [Unknown Worlds Community Translations](http://translate.unknownworlds.com/).
Based on Laravel.

## Usage examples
- [Red Hook Studios - Darkest Dungeon](http://www.translate.darkestdungeon.com/)
- [New World Interactive - Insurgency, Day of Infamy](https://translate.newworldinteractive.com/)

## Base workflow example
- Store your source text in English.json file
- When the game is built, upload the source file to the app - it gets processed: strings get added, updated or deleted
- Right after download the latest translations from the app - it's going to be a zip file containing all the data you need
- Check in those files into your repository and proceed with the build process

## Requirements
- PHP >= 8
- OpenSSL PHP Extension
- PDO PHP Extension
- Mbstring PHP Extension
- Tokenizer PHP Extension
- XML PHP Extension
- libxext6 and libxrender1 libraries
- zip/unzip utilities

## Installation instructions
- Point web server's root directory to /public
- Copy .env.testing to .env, fill the configuration
- Run "composer install" from the root directory of the application
- Run "php artisan key:generate" to set unique crypto key

## Development environment
Use [Laravel Homestead](https://laravel.com/docs/master/homestead)

## Testing
./codeception run (works under linux)

## Worth knowing
- You can't use numbers as translation keys

## Meta
Created by [Unknown Worlds Entertainment's](http://unknownworlds.com/) Lukas Nowaczek ([@lnowaczek](https://twitter.com/lnowaczek)).

Distributed under the MIT license. See ``LICENSE`` for more information.


text:
<?xml version='1.0' encoding='UTF-8'?>
<resources xmlns:tools="http://schemas.android.com/tools">
  <!--Activitiy and fragment titles-->
  <string name="app_name">AntennaPod</string>
  <string name="feeds_label">Canales</string>
  <string name="podcasts_label">PODCASTS</string>
  <string name="episodes_label">EPISODIOS</string>
  <string name="new_label">Nuevos</string>
  <string name="waiting_list_label">Lista de espera</string>
  <string name="settings_label">Ajustes</string>
  <string name="downloads_label">Descargas</string>
  <string name="cancel_download_label">Cancelar descarga</string>
  <string name="playback_history_label">Historial de reproducción</string>
  <!--New episodes fragment-->
  <!--Main activity-->
  <!--Webview actions-->
  <string name="open_in_browser_label">Abrir en el navegador</string>
  <string name="copy_url_label">Copiar URL</string>
  <string name="share_url_label">Compartir URL</string>
  <string name="copied_url_msg">URL copiada al portapapeles.</string>
  <!--Playback history-->
  <string name="clear_history_label">Limpiar el historial</string>
  <!--Other-->
  <string name="confirm_label">Confirmar</string>
  <string name="cancel_label">Cancelar</string>
  <string name="author_label">Autor</string>
  <string name="language_label">Idioma</string>
  <string name="error_label">Error</string>
  <string name="error_msg_prefix">Ha ocurrido un error:</string>
  <string name="refresh_label">Actualizar</string>
  <string name="external_storage_error_msg">No se encuentra un almacenamiento externo. Asegúrese de que su almacenamiento externo esté montado para que la aplicación funcione correctamente.</string>
  <string name="chapters_label">Capítulos</string>
  <string name="shownotes_label">Notas del programa</string>
  <string name="episodes_suffix">\u0020episodios</string>
  <string name="length_prefix">Duración:\u0020</string>
  <string name="size_prefix">Tamaño:\u0020</string>
  <string name="processing_label">Procesando</string>
  <string name="loading_label">Cargando...</string>
  <!--'Add Feed' Activity labels-->
  <string name="feedurl_label">URL del canal</string>
  <!--Actions on feeds-->
  <string name="mark_all_read_label">Marcar todo como leído</string>
  <string name="show_info_label">Información del programa</string>
  <string name="share_link_label">Compartir el enlace de la web</string>
  <string name="share_source_label">Compartir el enlace del canal</string>
  <string name="feed_delete_confirmation_msg">Confirme que quiere eliminar este canal y TODOS los episodios descargados del mismo.</string>
  <!--actions on feeditems-->
  <string name="download_label">Descargar</string>
  <string name="play_label">Reproducir</string>
  <string name="pause_label">Pausar</string>
  <string name="stream_label">Transmitir</string>
  <string name="remove_label">Quitar</string>
  <string name="mark_read_label">Marcar como leído</string>
  <string name="mark_unread_label">Marcar como no leído</string>
  <string name="add_to_queue_label">Añadir a la cola</string>
  <string name="remove_from_queue_label">Quitar de la cola</string>
  <string name="visit_website_label">Visitar el sitio web</string>
  <string name="support_label">Añadir a Flattr</string>
  <string name="enqueue_all_new">Ponerlos todos en cola</string>
  <string name="download_all">Descargarlos todos</string>
  <string name="skip_episode_label">Saltar episodio</string>
  <!--Download messages and labels-->
  <string name="download_pending">Descarga pendiente</string>
  <string name="download_running">Descarga en curso</string>
  <string name="download_error_device_not_found">No se ha encontrado un dispositivo de almacenamiento</string>
  <string name="download_error_insufficient_space">Espacio insuficiente</string>
  <string name="download_error_file_error">Error de archivo</string>
  <string name="download_error_http_data_error">Error de datos HTTP</string>
  <string name="download_error_error_unknown">Error desconocido</string>
  <string name="download_error_parser_exception">Excepción del analizador</string>
  <string name="download_error_unsupported_type">Tipo de canal no admitido</string>
  <string name="download_error_connection_error">Error de conexión</string>
  <string name="download_error_unknown_host">Host desconocido</string>
  <string name="cancel_all_downloads_label">Cancelar todas las descargas</string>
  <string name="download_cancelled_msg">Descarga cancelada</string>
  <string name="download_report_title">Descargas completadas</string>
  <string name="download_error_malformed_url">URL malformada</string>
  <string name="download_error_io_error">Error de E/S</string>
  <string name="download_error_request_error">Error de petición</string>
  <string name="downloads_left">\u0020descargas restantes</string>
  <string name="download_notification_title">Descargando datos del podcast</string>
  <string name="download_report_content">%1$d descargas exitosas, %2$d fallidas</string>
  <string name="download_log_title_unknown">Título desconocido</string>
  <string name="download_type_feed">Canal</string>
  <string name="download_type_media">Archivo de medios</string>
  <string name="download_type_image">Imagen</string>
  <string name="download_request_error_dialog_message_prefix">Ha ocurrido un error al intentar descargar el archivo:\u0020</string>
  <!--Mediaplayer messages-->
  <string name="player_error_msg">¡Error!</string>
  <string name="player_stopped_msg">No hay medios en reproducción</string>
  <string name="player_preparing_msg">Preparando</string>
  <string name="player_ready_msg">Listo</string>
  <string name="player_seeking_msg">Buscando</string>
  <string name="playback_error_server_died">El servidor está inactivo</string>
  <string name="playback_error_unknown">Error desconocido</string>
  <string name="no_media_playing_label">No hay medios en reproducción</string>
  <string name="position_default_label">00:00:00</string>
  <string name="player_buffering_msg">Almacenando</string>
  <string name="playbackservice_notification_title">Reproduciendo el podcast</string>
  <!--Queue operations-->
  <string name="clear_queue_label">Limpiar la cola</string>
  <!--Flattr-->
  <string name="flattr_auth_label">Identificarse en Flattr</string>
  <string name="flattr_auth_explanation">Pulse el botón inferior para comenzar la autenticación. Su navegador abrirá la pantalla de identificación de Flattr y le preguntará si quiere conceder permiso a AntennaPod para valorar cosas. Tras concederlo, volverá a esta pantalla automáticamente.</string>
  <string name="authenticate_label">Autenticarse</string>
  <string name="return_home_label">Volver a la pantalla principal</string>
  <string name="flattr_auth_success">Autentificación exitosa. Ya puede valorar cosas en Flattr desde la aplicación.</string>
  <string name="no_flattr_token_title">No se ha encontrado un token de Flattr</string>
  <string name="no_flattr_token_msg">Su cuenta de Flattr no está conectada con AntennaPod. Puede conectarla o puede visitar la página web de cada cosa para valorarla desde allí.</string>
  <string name="authenticate_now_label">Autenticarse</string>
  <string name="action_forbidden_title">Acción prohibida</string>
  <string name="action_forbidden_msg">AntennaPod no tiene permiso para realizar esta acción. La razón puede ser que se haya revocado el token de acceso de AntennaPod para su cuenta. Puede re-autenticarse o visitar la página web de la cosa.</string>
  <string name="access_revoked_title">Acceso revocado</string>
  <string name="access_revoked_info">Ha revocado el token de acceso de AntennaPod a su cuenta. Para completar el proceso debe eliminar esta aplicación de la lista de aplicaciones aprobadas, en los ajustes de Flattr.</string>
  <!--Flattr-->
  <!--Variable Speed-->
  <!--Empty list labels-->
  <string name="no_items_label">Esta lista no tiene elementos.</string>
  <string name="no_feeds_label">No se ha suscrito a ningún canal.</string>
  <!--Preferences-->
  <string name="other_pref">Otros</string>
  <string name="about_pref">Acerca de</string>
  <string name="queue_label">Cola</string>
  <string name="pref_pauseOnHeadsetDisconnect_sum">Pausar la reproducción al desconectar los auriculares</string>
  <string name="pref_followQueue_sum">Saltar al siguiente elemento de la cola al acabar la reproducción</string>
  <string name="playback_pref">Reproducción</string>
  <string name="network_pref">Red</string>
  <string name="pref_autoUpdateIntervall_title">Intervalo de actualización</string>
  <string name="pref_autoUpdateIntervall_sum">Especificar el intervalo en que se actualizarán automáticamente los canales, o desactivarlo</string>
  <string name="pref_downloadMediaOnWifiOnly_sum">Solo descargar los contenidos por WiFi</string>
  <string name="pref_followQueue_title">Reproducción continua</string>
  <string name="pref_downloadMediaOnWifiOnly_title">Descarga de contenidos por WiFi</string>
  <string name="pref_pauseOnHeadsetDisconnect_title">Desconexión de los cascos</string>
  <string name="pref_mobileUpdate_title">Actualizaciones por red móvil</string>
  <string name="pref_mobileUpdate_sum">Permitir actualizaciones por red de datos móvil</string>
  <string name="refreshing_label">Actualizando</string>
  <string name="flattr_settings_label">Ajustes de Flattr</string>
  <string name="pref_flattr_auth_title">Identificación en Flattr</string>
  <string name="pref_flattr_auth_sum">Identifíquese en Flattr para valorar cosas directamente desde la aplicación</string>
  <string name="pref_flattr_this_app_title">Valorar esta aplicación en Flattr</string>
  <string name="pref_flattr_this_app_sum">Apoye el desarrollo de AntennaPod valorándola en Flattr. ¡Gracias!</string>
  <string name="pref_revokeAccess_title">Revocar el acceso</string>
  <string name="pref_revokeAccess_sum">Rescindir el permiso de acceso de esta aplicación a su cuenta de Flattr.</string>
  <string name="user_interface_label">Interfaz de usuario</string>
  <string name="pref_set_theme_title">Elegir un tema</string>
  <string name="pref_set_theme_sum">Cambiar la apariencia de AntennaPod.</string>
  <string name="pref_automatic_download_title">Descarga automática</string>
  <string name="pref_automatic_download_sum">Configurar la descarga automática de episodios.</string>
  <string name="pref_autodl_wifi_filter_title">Activar el filtro WiFi</string>
  <string name="pref_autodl_wifi_filter_sum">Permitir la descarga automática sólo para las redes WiFi marcadas.</string>
  <string name="pref_episode_cache_title">Caché de episodios</string>
  <!--Auto-Flattr dialog-->
  <!--Search-->
  <string name="search_hint">Buscar canales o episodios</string>
  <string name="found_in_shownotes_label">Encontrado en las notas del programa</string>
  <string name="found_in_chapters_label">Encontrado en los capítulos</string>
  <string name="search_status_no_results">No se han encontrado resultados</string>
  <string name="search_label">Buscar</string>
  <string name="found_in_title_label">Encontrado en el título</string>
  <!--OPML import and export-->
  <string name="opml_import_explanation">Para importar un archivo OPML, debe copiarlo al siguiente directorio y pulsar el botón que se muestra abajo.</string>
  <string name="start_import_label">Comenzar la importación</string>
  <string name="opml_import_label">Importación de OPML</string>
  <string name="opml_directory_error">¡ERROR!</string>
  <string name="reading_opml_label">Leyendo el archivo OPML</string>
  <string name="opml_reader_error">Ha ocurrido un error al leer el archivo OPML</string>
  <string name="opml_import_error_dir_empty">El directorio de importación está vacío</string>
  <string name="select_all_label">Seleccionar todo</string>
  <string name="deselect_all_label">Deseleccionar todo</string>
  <string name="choose_file_to_import_label">Elegir qué archivo importar</string>
  <string name="opml_export_label">Exportar a OPML</string>
  <string name="exporting_label">Exportando...</string>
  <string name="export_error_label">Error en la exportación</string>
  <string name="opml_export_success_title">Exportación a OPML exitosa</string>
  <string name="opml_export_success_sum">El archivo OPML se ha escrito en:\u0020</string>
  <!--Sleep timer-->
  <string name="set_sleeptimer_label">Establecer un temporizador</string>
  <string name="disable_sleeptimer_label">Desactivar el temporizador</string>
  <string name="enter_time_here_label">Introducir hora</string>
  <string name="sleep_timer_label">Temporizador</string>
  <string name="time_left_label">Tiempo restante:\u0020</string>
  <string name="time_dialog_invalid_input">Entrada no válida, el tiempo debe ser un entero</string>
  <!--gpodder.net-->
  <!--Directory chooser-->
  <string name="selected_folder_label">Carpeta seleccionada</string>
  <string name="create_folder_label">Crear carpeta</string>
  <string name="choose_data_directory">Elegir carpeta de datos</string>
  <string name="create_folder_msg">¿Crear carpeta con nombre «%1$s»?</string>
  <string name="create_folder_success">Carpeta creada</string>
  <string name="create_folder_error_no_write_access">No se puede escribir a esta carpeta</string>
  <string name="create_folder_error_already_exists">Ya existe la carpeta</string>
  <string name="create_folder_error">No se ha podido crear la carpeta</string>
  <string name="folder_not_empty_dialog_title">La carpeta no está vacía</string>
  <string name="folder_not_empty_dialog_msg">La carpeta elegida no está vacía. Las descargas y otros archivos se copiarán directamente en esta carpeta. ¿Continuar igualmente?</string>
  <string name="set_to_default_folder">Elegir carpeta predeterminada</string>
  <!--Online feed view-->
  <!--Content descriptions for image buttons-->
  <!--Feed information screen-->
  <!--AntennaPodSP-->
</resources>

redpajama_set_name: RedPajamaGithub


text:
class ContextMenuContentTypeWebView : public ContextMenuContentType {
 public:
  virtual ~ContextMenuContentTypeWebView();

  // ContextMenuContentType overrides.
  virtual bool SupportsGroup(int group) OVERRIDE;

 protected:
  ContextMenuContentTypeWebView(content::RenderFrameHost* render_frame_host,
                                const content::ContextMenuParams& params);

 private:
  friend class ContextMenuContentTypeFactory;

  DISALLOW_COPY_AND_ASSIGN(ContextMenuContentTypeWebView);
};

#endif  // CHROME_BROWSER_GUESTVIEW_WEBVIEW_CONTEXT_MENU_CONTENT_TYPE_WEBVIEW_H_


text:
require 'spec_helper'

module NYUDL
  module MDI
    module Message
      describe Base do
        context 'when instantiated' do
          it 'should be the correct class' do
            expect(Base.new).to be_an_instance_of(NYUDL::MDI::Message::Base)
          end
        end
        describe '#to_json' do
          let(:json) { Base.new.to_json }
          it 'should return valid JSON' do
            expect { MultiJson.load(json) }.to_not raise_error
          end
          it 'should return the expected keys' do
            keys = %w(version request_id params).sort
            expect(MultiJson.load(json).keys.sort).to be == keys
          end
        end
        describe '#version' do
          let(:version) { Base.new.version }
          it 'should return the correct version' do
            expect(version).to be == '0.1.0'
          end
          it 'should preserve the version provided to the constructor' do
            expect(Base.new(version: '0.0.0').version).to be == '0.0.0'
          end
        end
        describe '#request_id' do
          let(:request_id) { Base.new.request_id }
          it 'should return an id of the correct form' do
            pattern = '[a-z\d]{8}-[a-z\d]{4}-[a-z\d]{4}-[a-z\d]{4}-[a-z\d]{12}'
            regexp  = /\A#{pattern}\z/
            expect(request_id).to match(regexp)
          end
          context 'when instantiated without a request_id value' do
            it 'returns a unique request_id' do
              expect(Base.new.request_id).to_not be == request_id
            end
          end
          context 'when instantiated with a request_id value' do
            it 'returns the assigned value' do
              expect(Base.new(request_id: request_id).request_id).to be == request_id
            end
          end
        end
        describe '#params' do
          context 'when no params hash provided to constructor' do
            let(:empty) { Base.new.params }
            it 'should return an empty hash' do
              expect(empty).to be_nil
            end
          end
          context 'when a params hash provided to constructor' do
            test_params = { a: 'a', b: 'b' }
            let(:populated) { Base.new(params: test_params).params }
            it 'should return the provided params hash' do
              expect(populated).to be == test_params
            end
          end
        end
        describe '#params=' do
          context 'when assigned a value' do
            test_params = { c: 'c', d: 'd' }
            b = Base.new()
            b.params = test_params
            let(:assigned) { b.params }
            it 'should return the assigned params hash' do
              expect(assigned).to be == test_params
            end
          end
        end
        describe '#valid?' do
          let(:result) { Base.new.valid? }
          it 'should be true' do
            expect(result).to be == true
          end
        end
        describe '#errors' do
          let(:errors) { Base.new.errors }
          it 'should be empty' do
            expect(errors).to be_empty
          end
        end
      end
    end
  end
end


text:
package vm

import (
	"errors"
	"fmt"
	"regexp"

	"github.com/vmware/govmomi"

	"github.com/lymingtonprecision/quorra/config"
	"github.com/lymingtonprecision/quorra/namesgenerator"
	"github.com/lymingtonprecision/quorra/ova"
)

func CreateFromOva(cl *govmomi.Client, c *config.Config, ref *config.References, src *ova.Ova) (*VirtualMachine, error) {
	descriptor, err := src.ReadDescriptor()
	if err != nil {
		return nil, err
	}

	attempts := int64(0)
	maxAttempts := namesgenerator.Possibilities()

begin:
	name := namesgenerator.RandomName(0)

	spec, err := CreateImportSpec(cl, c, ref, descriptor, name)
	if err != nil {
		return nil, err
	}

	lease, err := ref.ResourcePool.ImportVApp(spec.ImportSpec, ref.Folder, ref.Host)
	if err != nil {
		return nil, err
	}

	info, err := lease.Wait()
	if isVMAlreadyExistsError(err) {
		if attempts < maxAttempts {
			attempts++
			goto begin
		} else {
			return nil, errors.New("could not generate a unique VM name")
		}
	}
	if err != nil {
		return nil, err
	}

	fmt.Printf("Creating '%s'...\n\n", name)

	err = uploadVMFiles(cl, lease, info, spec, src)
	if err != nil {
		return nil, err
	}

	err = lease.HttpNfcLeaseComplete()
	if err != nil {
		return nil, err
	}

	m, err := Find(cl, c, name)
	if err != nil {
		return nil, err
	}

	fmt.Printf("* Adding public network interface... ")
	if err := m.AddNetwork(ref.PublicNetwork); err != nil {
		return nil, err
	}
	fmt.Printf("OK\n")

	fmt.Printf("\nVM successfully created!\n")

	return m, nil
}

func isVMAlreadyExistsError(err error) bool {
	if err == nil {
		return false
	}

	re := regexp.MustCompile("(?i)the name '[A-Za-z0-9\\-]+' already exists\\.")
	return re.MatchString(err.Error())
}


text:
/*
 * Open Source Software published under the Apache Licence, Version 2.0.
 */

package io.github.vocabhunter.gui.view;

import io.github.vocabhunter.analysis.core.VocabHunterException;
import io.github.vocabhunter.gui.i18n.I18nKey;
import io.github.vocabhunter.gui.model.FilterFileMode;
import javafx.scene.Node;
import javafx.scene.control.Label;
import org.controlsfx.glyphfont.FontAwesome.Glyph;

import java.util.EnumMap;
import java.util.Map;

import static io.github.vocabhunter.gui.i18n.I18nKey.*;
import static org.controlsfx.glyphfont.FontAwesome.Glyph.*;

public enum FilterFileModeView {
    SESSION_KNOWN(FILTER_MAIN_LISTS_TYPE_KNOWN, null, CHECK_CIRCLE, null, "filterKnownIcon"),
    SESSION_SEEN(FILTER_MAIN_LISTS_TYPE_BOTH, CHECK_CIRCLE, TIMES_CIRCLE, "filterKnownIcon", "filterUnknownIcon"),
    GRID(FILTER_MAIN_LISTS_TYPE_LIST, null, TABLE, null, "filterGridIcon");

    private static final Map<FilterFileMode, FilterFileModeView> VIEW_MAP = buildMap();

    private final I18nKey nameKey;

    private final Glyph firstGlyph;

    private final Glyph secondGlyph;

    private final String firstIconStyle;

    private final String secondIconStyle;

    FilterFileModeView(final I18nKey nameKey, final Glyph firstGlyph, final Glyph secondGlyph, final String firstIconStyle, final String secondIconStyle) {
        this.nameKey = nameKey;
        this.firstGlyph = firstGlyph;
        this.secondGlyph = secondGlyph;
        this.firstIconStyle = firstIconStyle;
        this.secondIconStyle = secondIconStyle;
    }

    public void updateIcons(final Label first, final Label second) {
        updateIcon(first, firstGlyph, firstIconStyle);
        updateIcon(second, secondGlyph, secondIconStyle);
    }

    private void updateIcon(final Label label, final Glyph glyph, final String style) {
        boolean isVisible = style != null;

        label.setVisible(isVisible);
        label.setManaged(isVisible);
        if (isVisible) {
            Node icon = IconTool.icon(glyph);

            icon.getStyleClass().add(style);
            label.setGraphic(icon);
        }
    }

    public I18nKey getNameKey() {
        return nameKey;
    }

    public static FilterFileModeView getView(final FilterFileMode mode) {
        FilterFileModeView view = VIEW_MAP.get(mode);

        if (view == null) {
            throw new VocabHunterException("Unknown mode " + mode);
        } else {
            return view;
        }
    }

    private static Map<FilterFileMode, FilterFileModeView> buildMap() {
        Map<FilterFileMode, FilterFileModeView> map = new EnumMap<>(FilterFileMode.class);

        map.put(FilterFileMode.SESSION_KNOWN, SESSION_KNOWN);
        map.put(FilterFileMode.SESSION_SEEN, SESSION_SEEN);
        map.put(FilterFileMode.DOCUMENT, GRID);
        map.put(FilterFileMode.EXCEL, GRID);

        return map;
    }
}


text:
cask 'path-finder' do
  version :latest
  sha256 :no_check

  url 'http://get.cocoatech.com/PF7.zip'
  name 'Path Finder'
  homepage 'http://www.cocoatech.com/pathfinder/'

  app 'Path Finder.app'

  postflight do
    suppress_move_to_applications key: 'kNTMoveToApplicationsFolderAlertSuppress'
  end

  zap delete: [
                '~/Library/Preferences/com.cocoatech.PathFinder.plist',
                '~/Library/Application Support/Path Finder',
              ]
end


text:
class HomeController < ApplicationController
  def index
    @upcoming_event = Event.upcoming.first
    @previous_event = Event.previous
  end

end


text:
{-# LANGUAGE OverloadedStrings #-}

module FPGrowth.Parser where

import              Control.Monad.Trans.Resource
import              Data.Attoparsec.ByteString.Lazy
import              Data.ByteString (ByteString)
import qualified    Data.Set as Set

import              FPGrowth.Types
import              Data.Conduit
import              Data.Conduit.Attoparsec
import              Prelude hiding (take)

parserConduit :: Conduit ByteString (ResourceT IO) Transaction
parserConduit = do
    conduitParserEither parseTransaction =$= awaitForever go
    where   go (Left s) = error $ show s
            go (Right (_, p)) = yield p

parseWord :: Parser ByteString
parseWord = do
    w <- takeTill (\ c -> c == 0x20 || c == 0xa)
    skipWhile (== 0x20)
    return w

parseTransaction :: Parser Transaction
parseTransaction = do
    _ <- parseWord
    xs <- manyTill parseWord (choice [newLine, endOfInput])
    return (Set.fromList xs)

    where   newLine = word8 0xa >> return ()


text:
package org.zstack.sdk;

public class JsonLabelInventory  {

    public long id;
    public void setId(long id) {
        this.id = id;
    }
    public long getId() {
        return this.id;
    }

    public java.lang.String labelKey;
    public void setLabelKey(java.lang.String labelKey) {
        this.labelKey = labelKey;
    }
    public java.lang.String getLabelKey() {
        return this.labelKey;
    }

    public java.lang.String labelValue;
    public void setLabelValue(java.lang.String labelValue) {
        this.labelValue = labelValue;
    }
    public java.lang.String getLabelValue() {
        return this.labelValue;
    }

    public java.lang.String resourceUuid;
    public void setResourceUuid(java.lang.String resourceUuid) {
        this.resourceUuid = resourceUuid;
    }
    public java.lang.String getResourceUuid() {
        return this.resourceUuid;
    }

    public java.sql.Timestamp createDate;
    public void setCreateDate(java.sql.Timestamp createDate) {
        this.createDate = createDate;
    }
    public java.sql.Timestamp getCreateDate() {
        return this.createDate;
    }

    public java.sql.Timestamp lastOpDate;
    public void setLastOpDate(java.sql.Timestamp lastOpDate) {
        this.lastOpDate = lastOpDate;
    }
    public java.sql.Timestamp getLastOpDate() {
        return this.lastOpDate;
    }

}


text:
package org.openqa.selenium.internal.seleniumemulation;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

public class GetValue extends SeleneseCommand<String> {
  private final ElementFinder finder;

  public GetValue(ElementFinder finder) {
    this.finder = finder;
  }

  @Override
  protected String handleSeleneseCommand(WebDriver driver, String locator, String ignored) {
    WebElement element = finder.findElement(driver, locator);
    // Special-case handling for checkboxes and radio buttons: The Selenium API returns "on" for
    // checked checkboxes and radio buttons and off for unchecked ones. WebDriver will return "null" for
    // the "checked" attribute if the checkbox or the radio button is not-checked, "true" otherwise.
    if (element.getTagName().equals("input")
        && (element.getAttribute("type").equals("checkbox")
            || element.getAttribute("type").equals("radio")))
    {
      if (element.getAttribute("checked") == null) {
        return "off";
      } else {
        return "on";
      }
    }

    return element.getAttribute("value");
  }
}


text:
ACCEPTED

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

#### Published in
Annls mycol. 22(1/2): 126 (1924)

#### Original name
Dimerosporium manihotis Henn., 1904

### Remarks
null


text:
.. _1_techniques/4_ic3:

IC3
---

`IC3/PDR <http://link.springer.com/chapter/10.1007%2F978-3-642-18275-4_7>`_ is a recent technique by Aaron Bradley. IC3 alone can falsify and prove properties. To enable nothing but IC3, run

.. code-block:: none

   kind2 --enable IC3 <file>

The challenge when lifting IC3 to infinite state systems is the pre-image computation. If the input problem is in linear integer arithmetic, Kind 2 performs a fast approximate quantifier elimination. Otherwise, the quantifier elimination is delegated to an SMT solver, which is at this time only possible with Z3.

Options
^^^^^^^

``--ic3_qe {cooper|Z3}`` (default ``cooper``\ ) -- select the quantifier elimination strategy: ``cooper`` (default) for the built-in approximate method, ``Z3`` to delegate to the SMT solver. If the problem is not in linear integer arithmetic, ``cooper`` falls back to ``Z3``.

``--ic3_check_inductive <bool>`` (default ``true``\ ) -- Check if a blocking clause is inductive and communicate it as an invariant to concurrent verification engines.

``--ic3_block_in_future  <bool>`` (default ``true``\ ) -- Block each clause not only in the frame it was discovered, but also in all higher frames.

``--ic3_fwd_prop_non_gen <bool>`` (default ``true``\ ) -- Attempt forward propagation of clauses before inductive generalization.

``--ic3_fwd_prop_ind_gen <bool>`` (default ``true``\ ) -- Inductively generalize clauses after forward propagation.

``--ic3_fwd_prop_subsume <bool>`` (default ``true``\ ) -- Check syntactic subsumption of forward propagated clauses


text:
package com.airbnb.hive;

import static org.junit.Assert.assertEquals;

import com.google.common.collect.Lists;

import com.airbnb.reair.db.DbConnectionFactory;
import com.airbnb.reair.db.EmbeddedMySqlDb;
import com.airbnb.reair.db.StaticDbConnectionFactory;
import com.airbnb.reair.db.TestDbCredentials;
import com.airbnb.reair.hive.hooks.AuditCoreLogModule;
import com.airbnb.reair.hive.hooks.AuditLogHookUtils;
import com.airbnb.reair.hive.hooks.HiveOperation;
import com.airbnb.reair.hive.hooks.MetastoreAuditLogListener;
import com.airbnb.reair.hive.hooks.ObjectLogModule;
import com.airbnb.reair.utils.ReplicationTestUtils;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.HiveMetaStore;
import org.apache.hadoop.hive.metastore.HiveMetaStore.HMSHandler;
import org.apache.hadoop.hive.metastore.api.Database;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.metastore.api.Partition;
import org.apache.hadoop.hive.metastore.api.SerDeInfo;
import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.hadoop.hive.metastore.events.AddPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterTableEvent;
import org.apache.hadoop.hive.metastore.events.CreateDatabaseEvent;
import org.apache.hadoop.hive.metastore.events.CreateTableEvent;
import org.apache.hadoop.hive.metastore.events.DropDatabaseEvent;
import org.apache.hadoop.hive.metastore.events.DropPartitionEvent;
import org.apache.hadoop.hive.metastore.events.DropTableEvent;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MetastoreAuditLogListenerTest {

  private static final Log LOG = LogFactory.getLog(
      MetastoreAuditLogListenerTest.class
  );

  protected static EmbeddedMySqlDb embeddedMySqlDb;

  protected static final String DB_NAME = "audit_log_db";
  protected static final String AUDIT_LOG_TABLE_NAME = "audit_log";
  protected static final String INPUT_OBJECTS_TABLE_NAME = "audit_objects";
  protected static final String OUTPUT_OBJECTS_TABLE_NAME = "audit_objects";
  protected static final String MAP_RED_STATS_TABLE_NAME = "mapred_stats";

  @BeforeClass
  public static void setupClass() {
    embeddedMySqlDb = new EmbeddedMySqlDb();
    embeddedMySqlDb.startDb();
  }

  /**
   * Generates a database connection factory for use in testing.
   *
   * @return The database connection factory
   * @throws SQLException If there's an error insert into the DB
   */
  public static DbConnectionFactory getDbConnectionFactory()
    throws SQLException {
    TestDbCredentials testDbCredentials = new TestDbCredentials();
    return new StaticDbConnectionFactory(
      ReplicationTestUtils.getJdbcUrl(embeddedMySqlDb),
      testDbCredentials.getReadWriteUsername(),
      testDbCredentials.getReadWritePassword()
    );
  }

  /**
   * Resets the testing database.
   *
   * @throws SQLException If there's an error inserting to the DB
   */
  public static void resetState() throws SQLException {
    DbConnectionFactory dbConnectionFactory = getDbConnectionFactory();
    ReplicationTestUtils.dropDatabase(dbConnectionFactory, DB_NAME);
    AuditLogHookUtils.setupAuditLogTables(
        dbConnectionFactory,
        DB_NAME,
        AUDIT_LOG_TABLE_NAME,
        OUTPUT_OBJECTS_TABLE_NAME,
        MAP_RED_STATS_TABLE_NAME
    );
  }

  /**
   * Generates a Hive configuration using the test database credentials.
   *
   * @return The Hive configuration
   */
  public HiveConf getHiveConfig() {
    final TestDbCredentials testDbCredentials = new TestDbCredentials();

    HiveConf hiveConf = new HiveConf();

    hiveConf.set(
        MetastoreAuditLogListener.JDBC_URL_KEY,
        ReplicationTestUtils.getJdbcUrl(embeddedMySqlDb, DB_NAME)
    );

    hiveConf.set(AuditCoreLogModule.TABLE_NAME_KEY, AUDIT_LOG_TABLE_NAME);
    hiveConf.set(ObjectLogModule.TABLE_NAME_KEY, OUTPUT_OBJECTS_TABLE_NAME);

    hiveConf.set(
        MetastoreAuditLogListener.DB_USERNAME,
        testDbCredentials.getReadWriteUsername()
    );

    hiveConf.set(
        MetastoreAuditLogListener.DB_PASSWORD,
        testDbCredentials.getReadWritePassword()
    );

    return hiveConf;
  }

  @Test
  public void testCreateDatabase() throws Exception {

    // Setup the audit log DB.
    resetState();

    final DbConnectionFactory dbConnectionFactory = getDbConnectionFactory();
    final HiveConf hiveConf = getHiveConfig();

    final MetastoreAuditLogListener metastoreAuditLogListener =
        new MetastoreAuditLogListener(hiveConf);

    // Set up the source.
    Map<String, String> parameters = new HashMap<>();
    parameters.put("owner", "root");

    Database database = new Database(
        "test_db",
        "test database",
        "hdfs://dummy",
        parameters
    );

    CreateDatabaseEvent event = new CreateDatabaseEvent(database, true, null);
    metastoreAuditLogListener.onCreateDatabase(event);

    // Check the query audit log.
    List<String> auditCoreLogColumnsToCheck = Lists.newArrayList(
        "command_type",
        "command",
        "inputs",
        "outputs"
    );

    List<String> auditCoreLogRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        AUDIT_LOG_TABLE_NAME,
        auditCoreLogColumnsToCheck,
        null
    );

    List<String> expectedDbRow = Lists.newArrayList(
        HiveOperation.THRIFT_CREATE_DATABASE.name(),
        "THRIFT_API",
        "{}",
        "{\"databases\":[\"test_db\"]}"
    );

    assertEquals(expectedDbRow, auditCoreLogRow);

    // Check the input objects audit log.
    List<String> inputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> inputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        INPUT_OBJECTS_TABLE_NAME,
        inputObjectsColumnsToCheck,
        "category = 'INPUT'"
    );

    assertEquals(null, inputObjectsRow);

    // Check the output objects audit log.
    List<String> outputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> outputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        OUTPUT_OBJECTS_TABLE_NAME,
        outputObjectsColumnsToCheck,
        "category = 'OUTPUT'"
    );

    expectedDbRow = Lists.newArrayList(
        "test_db",
        "DATABASE",
        "{\"1\":{\"str\":\"test_db\"},\"2\":{\"str\":\"test database\"},\"3\":{"
          + "\"str\":\"hdfs://dummy\"},\"4\":{\"map\":[\"str\",\"str\",1,{\"own"
          + "er\":\"root\"}]}}"
    );

    assertEquals(expectedDbRow, outputObjectsRow);
  }

  @Test
  public void testDropDatabase() throws Exception {

    // Setup the audit log DB.
    resetState();

    final DbConnectionFactory dbConnectionFactory = getDbConnectionFactory();
    final HiveConf hiveConf = getHiveConfig();

    final MetastoreAuditLogListener metastoreAuditLogListener =
        new MetastoreAuditLogListener(hiveConf);

    // Set up the source.
    Map<String, String> parameters = new HashMap<>();
    parameters.put("owner", "root");

    Database database = new Database(
        "test_db",
        "test database",
        "hdfs://dummy",
        parameters
    );

    DropDatabaseEvent event = new DropDatabaseEvent(database, true, null);
    metastoreAuditLogListener.onDropDatabase(event);

    // Check the query audit log.
    List<String> auditCoreLogColumnsToCheck = Lists.newArrayList(
        "command_type",
        "command",
        "inputs",
        "outputs"
    );

    List<String> auditCoreLogRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        AUDIT_LOG_TABLE_NAME,
        auditCoreLogColumnsToCheck,
        null
    );

    List<String> expectedDbRow = Lists.newArrayList(
        HiveOperation.THRIFT_DROP_DATABASE.name(),
        "THRIFT_API",
        "{\"databases\":[\"test_db\"]}",
        "{}"
    );

    assertEquals(expectedDbRow, auditCoreLogRow);

    // Check the input objects audit log.
    List<String> inputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> inputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        INPUT_OBJECTS_TABLE_NAME,
        inputObjectsColumnsToCheck,
        "category = 'INPUT'"
    );

    expectedDbRow = Lists.newArrayList(
        "test_db",
        "DATABASE",
        "{\"1\":{\"str\":\"test_db\"},\"2\":{\"str\":\"test database\"},\"3\":{"
          + "\"str\":\"hdfs://dummy\"},\"4\":{\"map\":[\"str\",\"str\",1,{\"own"
          + "er\":\"root\"}]}}"
    );

    assertEquals(expectedDbRow, inputObjectsRow);

    // Check the output objects audit log.
    List<String> outputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> outputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        OUTPUT_OBJECTS_TABLE_NAME,
        outputObjectsColumnsToCheck,
        "category = 'OUTPUT'"
    );

    assertEquals(null, outputObjectsRow);
  }

  @Test
  public void testCreateTable() throws Exception {

    // Setup the audit log DB.
    resetState();

    final DbConnectionFactory dbConnectionFactory = getDbConnectionFactory();
    final HiveConf hiveConf = getHiveConfig();

    final MetastoreAuditLogListener metastoreAuditLogListener =
        new MetastoreAuditLogListener(hiveConf);

    // Set up the source.
    Table table = new Table();
    table.setDbName("test_db");
    table.setTableName("test_table");
    table.setOwner("root");

    Map<String, String> parameters = new HashMap<>();
    parameters.put("contact", "root@airbnb.com");
    table.setParameters(parameters);
    table.setSd(new StorageDescriptor());

    CreateTableEvent event = new CreateTableEvent(table, true, null);
    metastoreAuditLogListener.onCreateTable(event);

    // Check the query audit log.
    List<String> auditCoreLogColumnsToCheck = Lists.newArrayList(
        "command_type",
        "command",
        "inputs",
        "outputs"
    );

    List<String> auditCoreLogRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        AUDIT_LOG_TABLE_NAME,
        auditCoreLogColumnsToCheck,
        null
    );

    List<String> expectedDbRow = Lists.newArrayList(
        HiveOperation.THRIFT_CREATE_TABLE.name(),
        "THRIFT_API",
        "{}",
        "{\"tables\":[\"test_db.test_table\"]}"
    );

    assertEquals(expectedDbRow, auditCoreLogRow);

    // Check the input objects audit log.
    List<String> inputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> inputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        INPUT_OBJECTS_TABLE_NAME,
        inputObjectsColumnsToCheck,
        "category = 'INPUT'"
    );

    assertEquals(null, inputObjectsRow);

    // Check the output objects audit log.
    List<String> outputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> outputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        OUTPUT_OBJECTS_TABLE_NAME,
        outputObjectsColumnsToCheck,
        "category = 'OUTPUT'"
    );

    expectedDbRow = Lists.newArrayList(
        "test_db.test_table",
        "TABLE",
        "{\"1\":{\"str\":\"test_table\"},\"2\":{\"str\":\"test_db\"},\"3\":{\"s"
          + "tr\":\"root\"},\"4\":{\"i32\":0},\"5\":{\"i32\":0},\"6\":{\"i32\":"
          + "0},\"7\":{\"rec\":{\"5\":{\"tf\":0},\"6\":{\"i32\":0}}},\"9\":{\"m"
          + "ap\":[\"str\",\"str\",1,{\"contact\":\"root@airbnb.com\"}]}}"
    );

    assertEquals(expectedDbRow, outputObjectsRow);
  }

  @Test
  public void testDropTable() throws Exception {

    // Setup the audit log DB.
    resetState();

    final DbConnectionFactory dbConnectionFactory = getDbConnectionFactory();
    final HiveConf hiveConf = getHiveConfig();

    final MetastoreAuditLogListener metastoreAuditLogListener =
        new MetastoreAuditLogListener(hiveConf);

    // Set up the source.
    Table table = new Table();
    table.setDbName("test_db");
    table.setTableName("test_table");
    table.setOwner("root");

    Map<String, String> parameters = new HashMap<>();
    parameters.put("contact", "root@airbnb.com");
    table.setParameters(parameters);
    table.setSd(new StorageDescriptor());

    DropTableEvent event = new DropTableEvent(table, true, true, null);
    metastoreAuditLogListener.onDropTable(event);

    // Check the query audit log.
    List<String> auditCoreLogColumnsToCheck = Lists.newArrayList(
        "command_type",
        "command",
        "inputs",
        "outputs"
    );

    List<String> auditCoreLogRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        AUDIT_LOG_TABLE_NAME,
        auditCoreLogColumnsToCheck,
        null
    );

    List<String> expectedDbRow = Lists.newArrayList(
        HiveOperation.THRIFT_DROP_TABLE.name(),
        "THRIFT_API",
        "{\"tables\":[\"test_db.test_table\"]}",
        "{}"
    );

    assertEquals(expectedDbRow, auditCoreLogRow);

    // Check the input objects audit log.
    List<String> inputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> inputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        INPUT_OBJECTS_TABLE_NAME,
        inputObjectsColumnsToCheck,
        "category = 'INPUT'"
    );

    expectedDbRow = Lists.newArrayList(
        "test_db.test_table",
        "TABLE",
        "{\"1\":{\"str\":\"test_table\"},\"2\":{\"str\":\"test_db\"},\"3\":{\"s"
          + "tr\":\"root\"},\"4\":{\"i32\":0},\"5\":{\"i32\":0},\"6\":{\"i32\":"
          + "0},\"7\":{\"rec\":{\"5\":{\"tf\":0},\"6\":{\"i32\":0}}},\"9\":{\"m"
          + "ap\":[\"str\",\"str\",1,{\"contact\":\"root@airbnb.com\"}]}}"
    );

    assertEquals(expectedDbRow, inputObjectsRow);

    // Check the output objects audit log.
    List<String> outputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> outputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        OUTPUT_OBJECTS_TABLE_NAME,
        outputObjectsColumnsToCheck,
        "category = 'OUTPUT'"
    );

    assertEquals(null, outputObjectsRow);
  }

  @Test
  public void testAlterTable() throws Exception {

    // Setup the audit log DB.
    resetState();

    final DbConnectionFactory dbConnectionFactory = getDbConnectionFactory();
    final HiveConf hiveConf = getHiveConfig();

    final MetastoreAuditLogListener metastoreAuditLogListener =
        new MetastoreAuditLogListener(hiveConf);

    // Set up the source.
    Table oldTable = new Table();
    oldTable.setDbName("test_db");
    oldTable.setTableName("test_old_table");
    oldTable.setOwner("foo");
    oldTable.setSd(new StorageDescriptor());

    Map<String, String> oldParameters = new HashMap<>();
    oldParameters.put("contact", "foo@airbnb.com");
    oldTable.setParameters(oldParameters);

    Table newTable = new Table();
    newTable.setDbName("test_db");
    newTable.setTableName("test_new_table");
    newTable.setOwner("bar");
    newTable.setSd(new StorageDescriptor());

    Map<String, String> newParameters = new HashMap<>();
    newParameters.put("contact", "bar@airbnb.com");
    newTable.setParameters(newParameters);

    AlterTableEvent event = new AlterTableEvent(
        oldTable,
        newTable,
        true,
        null
    );

    metastoreAuditLogListener.onAlterTable(event);

    // Check the query audit log.
    List<String> auditCoreLogColumnsToCheck = Lists.newArrayList(
        "command_type",
        "command",
        "inputs",
        "outputs"
    );

    List<String> auditCoreLogRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        AUDIT_LOG_TABLE_NAME,
        auditCoreLogColumnsToCheck,
        null
    );

    List<String> expectedDbRow = Lists.newArrayList(
        HiveOperation.THRIFT_ALTER_TABLE.name(),
        "THRIFT_API",
        "{\"tables\":[\"test_db.test_old_table\"]}",
        "{\"tables\":[\"test_db.test_new_table\"]}"
    );

    assertEquals(expectedDbRow, auditCoreLogRow);

    // Check the input objects audit log.
    List<String> inputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> inputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        INPUT_OBJECTS_TABLE_NAME,
        inputObjectsColumnsToCheck,
        "category = 'INPUT'"
    );

    expectedDbRow = Lists.newArrayList(
        "test_db.test_old_table",
        "TABLE",
        "{\"1\":{\"str\":\"test_old_table\"},\"2\":{\"str\":\"test_db\"},\"3\":"
          + "{\"str\":\"foo\"},\"4\":{\"i32\":0},\"5\":{\"i32\":0},\"6\":{\"i32"
          + "\":0},\"7\":{\"rec\":{\"5\":{\"tf\":0},\"6\":{\"i32\":0}}},\"9\":{"
          + "\"map\":[\"str\",\"str\",1,{\"contact\":\"foo@airbnb.com\"}]}}"
    );

    assertEquals(expectedDbRow, inputObjectsRow);

    // Check the output objects audit log.
    List<String> outputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> outputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        OUTPUT_OBJECTS_TABLE_NAME,
        outputObjectsColumnsToCheck,
        "category = 'OUTPUT'"
    );

    expectedDbRow = Lists.newArrayList(
        "test_db.test_new_table",
        "TABLE",
        "{\"1\":{\"str\":\"test_new_table\"},\"2\":{\"str\":\"test_db\"},\"3\":"
          + "{\"str\":\"bar\"},\"4\":{\"i32\":0},\"5\":{\"i32\":0},\"6\":{\"i32"
          + "\":0},\"7\":{\"rec\":{\"5\":{\"tf\":0},\"6\":{\"i32\":0}}},\"9\":{"
          + "\"map\":[\"str\",\"str\",1,{\"contact\":\"bar@airbnb.com\"}]}}"
    );

    assertEquals(expectedDbRow, outputObjectsRow);
  }

  @Test
  public void testAddPartition() throws Exception {

    // Setup the audit log DB.
    resetState();

    final DbConnectionFactory dbConnectionFactory = getDbConnectionFactory();
    final HiveConf hiveConf = getHiveConfig();

    final MetastoreAuditLogListener metastoreAuditLogListener =
        new MetastoreAuditLogListener(hiveConf);

    // Set up the source.
    StorageDescriptor sd = new StorageDescriptor();
    sd.setSerdeInfo(new SerDeInfo());
    sd.setLocation("hdfs://dummy/");

    Table table = new Table();
    table.setDbName("test_db");
    table.setTableName("test_table");
    table.setTableType("EXTERNAL_TABLE");
    table.setSd(sd);

    List<FieldSchema> partitionCols = new ArrayList<>();
    partitionCols.add(new FieldSchema("ds", "string", "UTC date"));
    table.setPartitionKeys(partitionCols);

    Partition partition = new Partition();
    partition.setDbName("test_db");
    partition.setTableName("test_table");
    partition.setSd(new StorageDescriptor());

    List<String> partitionValues = new ArrayList<>();
    partitionValues.add("2016-01-01");
    partition.setValues(partitionValues);

    AddPartitionEvent event = new AddPartitionEvent(
        table,
        partition,
        false,
        null
    );

    metastoreAuditLogListener.onAddPartition(event);

    // Check the query audit log.
    List<String> auditCoreLogColumnsToCheck = Lists.newArrayList(
        "command_type",
        "command",
        "inputs",
        "outputs"
    );

    List<String> auditCoreLogRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        AUDIT_LOG_TABLE_NAME,
        auditCoreLogColumnsToCheck,
        null
    );

    List<String> expectedDbRow = Lists.newArrayList(
        HiveOperation.THRIFT_ADD_PARTITION.name(),
        "THRIFT_API",
        "{}",
        "{\"partitions\":[\"test_db.test_table/ds=2016-01-01\"]}"
    );

    assertEquals(expectedDbRow, auditCoreLogRow);

    // Check the input objects audit log.
    List<String> inputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> inputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        INPUT_OBJECTS_TABLE_NAME,
        inputObjectsColumnsToCheck,
        "category = 'INPUT'"
    );

    assertEquals(null, inputObjectsRow);

    // Check the output objects audit log.
    List<String> outputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> outputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        OUTPUT_OBJECTS_TABLE_NAME,
        outputObjectsColumnsToCheck,
        "category = 'REFERENCE_TABLE' AND type = 'TABLE'"
    );

    expectedDbRow = Lists.newArrayList(
      "test_db.test_table",
      "TABLE",
      "{\"1\":{\"str\":\"test_table\"},\"2\":{\"str\":\"test_db\"},\"4\":{\"i32"
        + "\":0},\"5\":{\"i32\":0},\"6\":{\"i32\":0},\"7\":{\"rec\":{\"2\":{\"s"
        + "tr\":\"hdfs://dummy/\"},\"5\":{\"tf\":0},\"6\":{\"i32\":0},\"7\":{\""
        + "rec\":{}}}},\"8\":{\"lst\":[\"rec\",1,{\"1\":{\"str\":\"ds\"},\"2\":"
        + "{\"str\":\"string\"},\"3\":{\"str\":\"UTC date\"}}]},\"12\":{\"str\""
        + ":\"EXTERNAL_TABLE\"}}"
    );

    assertEquals(expectedDbRow, outputObjectsRow);

    outputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        OUTPUT_OBJECTS_TABLE_NAME,
        outputObjectsColumnsToCheck,
        "category = 'OUTPUT' AND type = 'PARTITION'"
    );

    expectedDbRow = Lists.newArrayList(
        "test_db.test_table/ds=2016-01-01",
        "PARTITION",
        "{\"1\":{\"lst\":[\"str\",1,\"2016-01-01\"]},\"2\":{\"str\":\"test_db\""
          + "},\"3\":{\"str\":\"test_table\"},\"4\":{\"i32\":0},\"5\":{\"i32\":"
          + "0},\"6\":{\"rec\":{\"2\":{\"str\":\"hdfs://dummy/ds=2016-01-01\"},"
          + "\"5\":{\"tf\":0},\"6\":{\"i32\":0}}}}"
    );

    assertEquals(expectedDbRow, outputObjectsRow);
  }

  @Test
  public void testDropPartition() throws Exception {

    // Setup the audit log DB.
    resetState();

    final DbConnectionFactory dbConnectionFactory = getDbConnectionFactory();
    final HiveConf hiveConf = getHiveConfig();

    final MetastoreAuditLogListener metastoreAuditLogListener =
        new MetastoreAuditLogListener(hiveConf);

    // Set up the source.
    StorageDescriptor sd = new StorageDescriptor();
    sd.setSerdeInfo(new SerDeInfo());
    sd.setLocation("hdfs://dummy/");

    Table table = new Table();
    table.setDbName("test_db");
    table.setTableName("test_table");
    table.setTableType("EXTERNAL_TABLE");
    table.setSd(sd);

    List<FieldSchema> partitionCols = new ArrayList<>();
    partitionCols.add(new FieldSchema("ds", "string", "UTC date"));
    table.setPartitionKeys(partitionCols);

    Partition partition = new Partition();
    partition.setDbName("test_db");
    partition.setTableName("test_table");
    partition.setSd(new StorageDescriptor());

    List<String> partitionValues = new ArrayList<>();
    partitionValues.add("2016-01-01");
    partition.setValues(partitionValues);

    DropPartitionEvent event = new DropPartitionEvent(
        table,
        partition,
        false,
        true,
        null
    );

    metastoreAuditLogListener.onDropPartition(event);

    // Check the query audit log.
    List<String> auditCoreLogColumnsToCheck = Lists.newArrayList(
        "command_type",
        "command",
        "inputs",
        "outputs"
    );

    List<String> auditCoreLogRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        AUDIT_LOG_TABLE_NAME,
        auditCoreLogColumnsToCheck,
        null
    );

    List<String> expectedDbRow = Lists.newArrayList(
        HiveOperation.THRIFT_DROP_PARTITION.name(),
        "THRIFT_API",
        "{\"partitions\":[\"test_db.test_table/ds=2016-01-01\"]}",
        "{}"
    );

    assertEquals(expectedDbRow, auditCoreLogRow);

    // Check the input objects audit log.
    List<String> inputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> inputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        INPUT_OBJECTS_TABLE_NAME,
        inputObjectsColumnsToCheck,
        "category = 'REFERENCE_TABLE' AND type = 'TABLE'"
    );

    expectedDbRow = Lists.newArrayList(
        "test_db.test_table",
        "TABLE",
        "{\"1\":{\"str\":\"test_table\"},\"2\":{\"str\":\"test_db\"},\"4\":{\"i"
          + "32\":0},\"5\":{\"i32\":0},\"6\":{\"i32\":0},\"7\":{\"rec\":{\"2\":"
          + "{\"str\":\"hdfs://dummy/\"},\"5\":{\"tf\":0},\"6\":{\"i32\":0},\"7"
          + "\":{\"rec\":{}}}},\"8\":{\"lst\":[\"rec\",1,{\"1\":{\"str\":\"ds\""
          + "},\"2\":{\"str\":\"string\"},\"3\":{\"str\":\"UTC date\"}}]},\"12"
          + "\":{\"str\":\"EXTERNAL_TABLE\"}}"
    );

    assertEquals(expectedDbRow, inputObjectsRow);

    inputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        INPUT_OBJECTS_TABLE_NAME,
        inputObjectsColumnsToCheck,
        "category = 'INPUT' AND type = 'PARTITION'"
    );

    expectedDbRow = Lists.newArrayList(
        "test_db.test_table/ds=2016-01-01",
        "PARTITION",
        "{\"1\":{\"lst\":[\"str\",1,\"2016-01-01\"]},\"2\":{\"str\":\"test_db\""
          + "},\"3\":{\"str\":\"test_table\"},\"4\":{\"i32\":0},\"5\":{\"i32\":"
          + "0},\"6\":{\"rec\":{\"2\":{\"str\":\"hdfs://dummy/ds=2016-01-01\"},"
          + "\"5\":{\"tf\":0},\"6\":{\"i32\":0}}}}"
    );

    assertEquals(expectedDbRow, inputObjectsRow);

    // Check the output objects audit log.
    List<String> outputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> outputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        OUTPUT_OBJECTS_TABLE_NAME,
        outputObjectsColumnsToCheck,
        "category = 'OUTPUT'"
    );

    assertEquals(null, outputObjectsRow);
  }

  @Test
  public void testAlterPartition() throws Exception {

    // Setup the audit log DB.
    resetState();

    final DbConnectionFactory dbConnectionFactory = getDbConnectionFactory();
    final HiveConf hiveConf = getHiveConfig();

    final MetastoreAuditLogListener metastoreAuditLogListener =
        new MetastoreAuditLogListener(hiveConf);

    // Set up the source.
    StorageDescriptor sd = new StorageDescriptor();
    sd.setSerdeInfo(new SerDeInfo());
    sd.setLocation("hdfs://dummy");

    Table table = new Table();
    table.setDbName("test_db");
    table.setTableName("test_table");
    table.setTableType("EXTERNAL_TABLE");
    table.setSd(sd);

    List<FieldSchema> partitionCols = new ArrayList<>();
    partitionCols.add(new FieldSchema("ds", "string", "UTC date"));
    table.setPartitionKeys(partitionCols);

    Partition oldPartition = new Partition();
    oldPartition.setDbName("test_db");
    oldPartition.setTableName("test_table");
    oldPartition.setSd(sd);

    List<String> oldPartitionValues = new ArrayList<>();
    oldPartitionValues.add("2016-01-01");
    oldPartition.setValues(oldPartitionValues);

    Partition newPartition = new Partition();
    newPartition.setDbName("test_db");
    newPartition.setTableName("test_table");
    newPartition.setSd(sd);

    List<String> newPartitionValues = new ArrayList<>();
    newPartitionValues.add("2016-01-02");
    newPartition.setValues(newPartitionValues);

    HMSHandler handler = Mockito.mock(HMSHandler.class);

    Mockito.when(
        handler.get_table(
            "test_db",
            "test_table"
        )
    ).thenReturn(table);

    AlterPartitionEvent event = new AlterPartitionEvent(
        oldPartition,
        newPartition,
        false,
        handler
    );

    metastoreAuditLogListener.onAlterPartition(event);

    // Check the query audit log.
    List<String> auditCoreLogColumnsToCheck = Lists.newArrayList(
        "command_type",
        "command",
        "inputs",
        "outputs"
    );

    List<String> auditCoreLogRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        AUDIT_LOG_TABLE_NAME,
        auditCoreLogColumnsToCheck,
        null
    );

    List<String> expectedDbRow = Lists.newArrayList(
        HiveOperation.THRIFT_ALTER_PARTITION.name(),
        "THRIFT_API",
        "{\"partitions\":[\"test_db.test_table/ds=2016-01-01\"]}",
        "{\"partitions\":[\"test_db.test_table/ds=2016-01-02\"]}"
    );

    assertEquals(expectedDbRow, auditCoreLogRow);

    // Check the input objects audit log. Note there is no easy way to verify
    // the table for an AlterPartitionEvent since we instantiate this within the
    // event listener where various attributes may be dynamic.
    List<String> inputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> inputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        INPUT_OBJECTS_TABLE_NAME,
        inputObjectsColumnsToCheck,
        "category = 'INPUT' AND type = 'PARTITION'"
    );

    expectedDbRow = Lists.newArrayList(
        "test_db.test_table/ds=2016-01-01",
        "PARTITION",
        "{\"1\":{\"lst\":[\"str\",1,\"2016-01-01\"]},\"2\":{\"str\":\"test_db\""
          + "},\"3\":{\"str\":\"test_table\"},\"4\":{\"i32\":0},\"5\":{\"i32\":"
          + "0},\"6\":{\"rec\":{\"2\":{\"str\":\"hdfs://dummy\"},\"5\":{\"tf\":"
          + "0},\"6\":{\"i32\":0},\"7\":{\"rec\":{}}}}}"
    );

    assertEquals(expectedDbRow, inputObjectsRow);

    // Check the output objects audit log. Note there is no easy way to verify
    // the table for an AlterPartitionEvent since we instantiate this within the
    // event listener where various attributes may be dynamic.
    List<String> outputObjectsColumnsToCheck = Lists.newArrayList(
        "name",
        "type",
        "serialized_object"
    );

    List<String> outputObjectsRow = ReplicationTestUtils.getRow(
        dbConnectionFactory,
        DB_NAME,
        OUTPUT_OBJECTS_TABLE_NAME,
        outputObjectsColumnsToCheck,
        "category = 'OUTPUT' AND type = 'PARTITION'"
    );

    expectedDbRow = Lists.newArrayList(
        "test_db.test_table/ds=2016-01-02",
        "PARTITION",
        "{\"1\":{\"lst\":[\"str\",1,\"2016-01-02\"]},\"2\":{\"str\":\"test_db\""
          + "},\"3\":{\"str\":\"test_table\"},\"4\":{\"i32\":0},\"5\":{\"i32\":"
          + "0},\"6\":{\"rec\":{\"2\":{\"str\":\"hdfs://dummy\"},\"5\":{\"tf\":"
          + "0},\"6\":{\"i32\":0},\"7\":{\"rec\":{}}}}}"
    );

    assertEquals(expectedDbRow, outputObjectsRow);
  }
}


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

	<title>dojox.fx.Shadow - Drop Shadows for DomNodes | The Dojo Toolkit</title>

dojox.fx.Shadow tests

with margin:

Lorem

with padding:

Lorem

no padding:

Lorem

position:absolute

Lorem


text:
title: contributing
layout: default
active_menu: installation

---

# Installation

## Analyser

If you just like to use SimpSpector Analyser CLI, installation is as easy as it gets.

```bash
git clone https://github.com/simpspector/analyser.git
# start simpspecting
analyser/bin/simpspector /path/to/your/project
```

## Application

### Clone Project

```bash
git clone https://github.com/simpspector/simpspector.git
```

### Composer

requires composer to be installed

```bash
composer install # composer will ask you for required configuration paramters
```

### Assets

requires npm and bower to be installed

```bash
cd assets
bower install
npm install
gulp styles js
```

### Initialization

```bash
php bin/console doctrine:database:create
php bin/console doctrine:migrations:migrate
# in order to get semantic webfonts loaded
cd web/css && ln -s ../../assets/bower_components/semantic/dist/themes .
```

### phpStorm integration

* download latest version from [https://github.com/zolotov/RemoteCall/downloads](https://github.com/zolotov/RemoteCall/downloads) and place it in phpStorm plugins directory
* open a project and test if [http://localhost:8091/?message=composer.json:11](http://localhost:8091/?message=composer.json:11) works

## Usage

### Adding .simpspector.yml

You will need to put a configuration file `.simpspector.yml` in your projects root directory. You can find a confoguration reference under [configuration](/configuration)


text:
const { test, expect } = require('@playwright/test');

const {EMBLEM_URL} = process.env;

const CAMPAIGN_ID = '59d32e9805fc4d3388db';
const DONATION_ID = 'f5ea984abf29497bbed7';

const assertUrlLoads = async (page, url) => {
  // Any browser errors should cause a test failure
  page.on("console", (message) => {
    if (message.type() === "error") {
      throw message.text();
    }
  })

  // Assert the target page loads successfully
  const response = await page.goto(url, 'networkidle');
  return expect(response.status()).toBe(200)
}

test('Renders homepage', async ({ page }) => {
  await assertUrlLoads(page, EMBLEM_URL);
});

test('Renders login', async ({ page }) => {
  await assertUrlLoads(page, EMBLEM_URL + '/login');
});

test('Renders logout', async ({ page }) => {
  await assertUrlLoads(page, EMBLEM_URL + '/logout');
});

test('Renders donate', async ({ page }) => {
  await assertUrlLoads(page, EMBLEM_URL + `/donate?campaign_id=${CAMPAIGN_ID}`);
});

test('Renders viewCampaign', async ({ page }) => {
  await assertUrlLoads(page, EMBLEM_URL + `/viewCampaign?campaign_id=${CAMPAIGN_ID}`);
});

test('Renders createCampaign', async ({ page }) => {
  await assertUrlLoads(page, EMBLEM_URL + '/createCampaign');
});

test('Renders viewDonation', async ({ page }) => {
  await assertUrlLoads(page, EMBLEM_URL + `/viewDonation?donation_id=${DONATION_ID}`);
});

// robots.txt - not working right now
// See https://github.com/GoogleCloudPlatform/emblem/issues/389
//
// test('Renders robots.txt', async ({ page }) => {
//   await assertUrlLoads(page, EMBLEM_URL + '/robots.txt');
// });


text:
package com.ilivoo.my.utility.classreading.filter;

import org.springframework.core.type.ClassMetadata;
import org.springframework.core.type.filter.AbstractClassTestingTypeFilter;
import org.springframework.util.Assert;

import com.ilivoo.my.utility.ArrayUtils;

public class ClassPackageFilter extends AbstractClassTestingTypeFilter{
	private final String childPackage;

	private final boolean isDeep;

	public ClassPackageFilter(String childPackage){
		this(childPackage, true);
	}

	/**
	 * 因为当我们查找的时候就已经提供了基本的包了, 所以找到的类肯定是基本包中的类
	 * @param childPackage 子包名, 如: "utility", 不能使用 "core.utility"这样的, 并且子包名必须完整
	 * @param isDeep 是否是深层次, 也就是是否是"com.ilivoo.**.utility.**.class"  两个"**"表示是有多层关系的
	 */
	public ClassPackageFilter(String childPackage, boolean isDeep){
		Assert.notNull(childPackage, "子包不能为空");
		if(childPackage.contains(".")){
			/*
			 * 从这里我们可以学习到原来运行时异常是不会要求我们捕获的, 因为运行时的错误是必须停止的, 而不能恢复程序。
			 */
			throw new IllegalArgumentException("子包名必须唯一, 并且使用'utility'这样独立的子包名");
		}
		this.childPackage = childPackage;
		this.isDeep = isDeep;
	}

	@Override
	protected boolean match(ClassMetadata metadata) {
		boolean isPattern = isPatternPackage(metadata.getClassName());
		return isPattern;
	}

	/**
	 * 通过基本的类名判断是否符合规则
	 * @param className 类名
	 * @return
	 */
	private boolean isPatternPackage(String className){
		Assert.notNull(className, "className不能为空");
		String[] names = className.split("\\.");
		/*
		 * com.ilivoo.**.childPackage.**
		 * 这里处理最前面的情况, 假设这个childPackage="com", 那么当然就肯定是符合的
		 * 假设包名和类名设计得不合理, 首字母大小写颠倒会出现问题, 所以这里也要配置
		 *
		 * 一般情况下我们不能直接使用name.length-1作为数组的下标, 因为这样可能会抛出下标-1, 从而报错。 但是前面我们判断了className是否为空
		 */
		if(names[0].equals(childPackage) || names[names.length-1].equals(childPackage)){
			return true;
		}
		if(ArrayUtils.hasInArray(childPackage, names, false)){
			if(isDeep){
				return true;
			}else{
				int classIndex = names.length-1;
				int childPackageIndex = ArrayUtils.indexInArray(childPackage, names, false);
				if(classIndex-childPackageIndex <= 1){
					return true;
				}
			}
		}
		return false;
	}

}


text:
using System;
using System.Data;
using System.Linq;
using MySql.Data.MySqlClient;
using System.Collections.Generic;

namespace StockEstimator.InformationRepository
{
	public abstract class DatabaseAccess
	{
		protected static MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder()
		{
			Server = "192.168.2.60",
			Port = 65501,
			Database = "Stocks",
			UserID = "warren",
			Password = "PASSWORD"
		};

		static DatabaseAccess()
		{
			try
			{
				var cs = new MySqlConnectionStringBuilder(builder.ConnectionString){Database = String.Empty}.ConnectionString;
				using (var connection = new MySqlConnection(cs))
				using (var command = connection.CreateCommand())
				{
				    connection.Open();

					command.CommandText = "CREATE DATABASE IF NOT EXISTS `Stocks`;";
				    command.ExecuteNonQuery();

					command.CommandText = @"CREATE TABLE IF NOT EXISTS Stocks.DayHistory(
												DayHistoryNbr BIGINT PRIMARY KEY NOT NULL AUTO_INCREMENT,
												Symbol VARCHAR(10) NOT NULL,
												Last DECIMAL(20,10) NOT NULL,
												High DECIMAL(20,10),
												Low DECIMAL(20,10),
												Open DECIMAL(20,10),
												Close DECIMAL(20,10),
												Volume DECIMAL(25,2),
												AvgVolume DECIMAL(25,5) NOT NULL DEFAULT 0,
												TradeTime TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
												INDEX IX_StockHistory_Symbol_TradeTime (Symbol, TradeTime),
												CONSTRAINT UNIQUE INDEX UQ_DayHistory_Symbol_Day (Symbol, TradeTime));";
					command.ExecuteNonQuery();

					command.CommandText = @"CREATE TABLE IF NOT EXISTS Stocks.LoggedServerMessages(
									        	LoggedServerMessagesNbr BIGINT PRIMARY KEY NOT NULL AUTO_INCREMENT,
									        	TimeStamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
									        	Message varchar(10000),
									        	INDEX IX_LoggedServerMessages_TimeStamp (TimeStamp));";
					command.ExecuteNonQuery();

					command.CommandText = @"CREATE TABLE IF NOT EXISTS Stocks.ServerCommand(
										        ServerCommand BIGINT PRIMARY KEY NOT NULL AUTO_INCREMENT,
										        Message varchar(2000),
										        TimeStamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
										        INDEX IX_ServerCommand_TimeStamp (TimeStamp));";
					command.ExecuteNonQuery();

					connection.Close();
				}
			}
			catch(MySqlException exception)
			{
				Console.WriteLine(exception.Message);
			}
		}

		public bool Success;

		public void ExecuteNonQuery(String commandText, IList<MySqlParameter> paramaters)
		{
			ExecuteQuery(commandText, paramaters, command => command.ExecuteNonQuery());
		}

		public void ExecuteQuery(String commandText, IList<MySqlParameter> paramaters, Action<MySqlCommand> action)
		{
			try
			{
				using(var connection = new MySqlConnection(builder.ConnectionString))
				{
					connection.Open();
					try
					{
						using(var command = connection.CreateCommand())
						{
							command.CommandText = commandText;
							var parameterText = String.Empty;
							if(paramaters.Count != 0)
							{
								parameterText = paramaters.Select(p => String.Format("{0}={1}", p.ParameterName, p.Value))
									.Aggregate( (seq, next) => String.Format("{0}, {1}", seq, next));
							}
							foreach(var parameter in paramaters)
							{
								command.Parameters.AddWithValue(parameter.ParameterName, parameter.Value);
							}

							try
							{
								action(command);
							}
							finally
							{
								using (var commandLogger = connection.CreateCommand())
								{
									commandLogger.CommandText = "INSERT INTO ServerCommand(Message) VALUES(@Message);";
									commandLogger.Parameters.AddWithValue("@Message", String.Format("{0}: {1}", command.CommandText, parameterText));
							    	commandLogger.ExecuteNonQuery();
								}
							}
						}
					}
					catch(Exception exception)
					{
						Console.WriteLine ("{0}\n{1}",exception.Message, exception.GetType().ToString());
						Console.WriteLine (exception.StackTrace);
					}
					finally
					{
						connection.Close();
					}
				}
			}
			catch(Exception exception)
			{
				Console.WriteLine ("{0}\n{1}",exception.Message, exception.GetType().ToString());
				Console.WriteLine (exception.StackTrace);
			}
		}
	}
}


text:
{% extends "registration/base.html" %}

{% load crispy_forms_tags %}
{% load i18n %}

{% block title %}{% trans "Password Change" %}{% endblock title %}

{% block page_main_title %}{% trans "Password Change" %}{% endblock page_main_title %}

{% block content %}

{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}

    {% block form %}
        <form class="{% block form_class %}{% endblock form_class %}" action="" method="post">
            {% csrf_token %}

            {% block form_inner %}
                {{ form|crispy }}
            {% endblock %}

            {% block form_actions %}

                    {% block form_actions_inner %}
                        <input type="submit" class="button" value="{% trans "Change my password" %}">
                    {% endblock form_actions_inner %}

            {% endblock form_actions %}
        </form>
    {% endblock %}
{% endblock content %}


text:
/* --- AUTOGENERATED FILE -----------------------------
* If you make changes to this file delete this comment.
* Otherwise the file may be overwritten in the future.
* --------------------------------------------------- */

const yaobuPattern = require('./yaobuPattern');
const { assertAllExamplesMatch, assertNoneMatch } = require('../lib/testUtils');

test('matches all examples', async () => {
  await assertAllExamplesMatch(yaobuPattern);
});

// TODO: Add more tests

test("doesn't match negative examples", async () => {
  await assertNoneMatch(
    yaobuPattern,
    [
      // TODO: add negative examples here
    ]
  );
});


text:
/* main.c - this program is a 'hotfix' that uses the shared Xlib Desktop/Root Window hack library - by StephaneAG - 2013  */

/* 	this short program is a 'hotfix' in the sense that it should be executable
*	from a shell command, a bash script, or even from Java/Python programs
*	when ran as a shell command.
*
*	It should not throw any dependencies errors as it has already been linked against
*	the right libraries during compiling.
*
*	Internally, it uses the 'desktopwindow' C shared library,
*	wich may be a little bit 'overkill' since it doesn't ( and won't )
*	contain some much stuff after all (...)
*
*	Still, for a wip impl, it may indeed help in the resolution of the original 'problem'
*/

/* std libs */
#include <stdio.h>
#include <stdlib.h>

/* custom shared C libray: libdesktopwindow */
#include "desktopwindow.h" // we include our library

//int main(void)
int main(int argc, char **argv)
{
	/* check the number of arguments */
	if (argc < 3)
	{
		fprintf(stderr, "DESKTOPWINDOWHACK_HOTFIX: Error: invalid number of argmuments\n");
		fprintf(stderr,"Usage: ./desktopwindowhack_hotfix <program_window_id> <desktop_window_id>\n");
		exit (1);
	}

	/* parse the arguments */
	char *progwinid = argv[1];
	char *deskwinid = argv[2];
	fprintf(stdout, "DESKTOPWINDOWHACK_HOTFIX: Received: %s as Program Window Id and %s as Desktop Window Id\n");

	puts("DESKTOPWINDOWHACK_HOTFIX: Shared Library test below for: libdesktopwindow");
	/* custom shared C libray: libdesktopwindow */
	foo(); // call the library test fcn

	return 0;
}


text:
define(['datamodels/user.model', 'services/contexthelper'],
    function (model, contextHelper) {

        //#region Public api.
        var datacontext = {
            createItem: createItem,
            getItem: getItem,
            getItems: getItems,
            saveNewItem: saveNewItem,
            saveChangedItem: saveChangedItem,
            deleteItem: deleteItem,
        };

        return datacontext;
        //#endregion

        //#region Publicly accessible methods.
        function createItem(data) {
            return new model.Item(data);
        }

        function getItem(id, itemObservable, errorObservable) {
            return contextHelper.ajaxRequest('get', itemApi('getbyid', id))
                .done(getSucceeded)
                .fail(getFailed);

            function getSucceeded(result) {
                itemObservable(new createItem(result));
            }

            function getFailed(result) {
                itemObservable(undefined);
                errorObservable('An error occurred during your request: '
                    + result.statusText);
            }
        }

        function getItems(itemObservableArray, errorObservable, action, data, successFunctions) {
            return $.getJSON(itemApi(action), data)
                .done(getSucceeded)
                .fail(getFailed);

            function getSucceeded(result) {
                var mappedItems = $.map(result, function (item) {
                    return new createItem(item);
                });
                itemObservableArray(mappedItems);

                $.each(successFunctions || [], function (index, value) {
                    if (typeof value === "function") {
                        value(mappedItems);
                    }
                });
            }

            function getFailed(result) {
                itemObservableArray(undefined);
                errorObservable('An error occurred during your request: '
                    + result.statusText);
            }
        }

        function saveNewItem(data, successFunctions) {
            contextHelper.clearErrorMessage(data);
            return contextHelper.ajaxRequest('post', itemApi('post'), data)
                .done(getSucceeded)
                .fail(getFailed);

            function getSucceeded(result) {
                $.each(successFunctions || [], function (index, value) {
                    if (typeof value === "function") {
                        value(result);
                    }
                });
            }

            function getFailed(result) {
                var errorText = 'Error adding the new item: ' +
                    result.statusText + '.';
                data.errorMessage(contextHelper.getModelStateErrors(JSON.parse(result.responseText || '{}'), errorText));
            }
        }

        function saveChangedItem(data, successFunctions) {
            contextHelper.clearErrorMessage(data);
            return contextHelper.ajaxRequest('put', itemApi('put', data.Id), data)
                .done(getSucceeded)
                .fail(getFailed);

            function getSucceeded(result) {
                $.each(successFunctions || [], function (index, value) {
                    if (typeof value === "function") {
                        value(result);
                    }
                });
            }

            function getFailed(result) {
                var errorText = 'Error adding the new item: ' +
                    result.statusText + '.';
                data.errorMessage(contextHelper.getModelStateErrors(JSON.parse(result.responseText || '{}'), errorText));
            }
        }

        function deleteItem(data, successFunctions) {
            contextHelper.clearErrorMessage(data);
            return contextHelper.ajaxRequest('delete', itemApi('delete', data.Id))
                .done(getSucceeded)
                .fail(getFailed);

            function getSucceeded() {
                $.each(successFunctions || [], function (index, value) {
                    if (typeof value === "function") {
                        value(data);
                    }
                });
            }

            function getFailed(result) {
                data.errorMessage('Error deleting the item: ' +
                    result.statusText);
            }
        }
        //#endregion

        //#region Private properties.
        // Routes.
        function itemApi(action, id) { return "/api/user/" + action + "/" + (id || ""); }
        //#endregion
    });


text:
package fr.exp.databases.mongodb;

public class RunPackage {

	public static void main(String[] args) {
		MongoDBTest run = new MongoDBTest();

	}

}


text:
function() {
    var $$this = $$(this);

    var filters = $$this.filters;

    var items = [];
    $$this.filterInfo.forEach(function(info) {
        if (info.id in filters)
            items.push({
                id: info.id,
                title: typeof info.title == "function"? info.title(): info.title,
                checked: API.filterState[info.id],
                disabled: filters[info.id].disabled,
                list: filters[info.id].list? {id: info.id + "-list", type: filters[info.id].list}: false
            });
    });

    var members = $$this.lists.members().map(function(member) {
        var person = API.profile(member);
        return person? {
            id: person.id,
            nickname: person.nickname,
            avatar: API.avatarUrl(member)
        }: {
            id: member,
            nickname: member,
            avatar: API.avatarUrl(member)
        };
    });

    return {
        show: items.length > 0,
        filters: items,
        members: members,
        id_rand: Math.floor(Math.random()*10000),
        search: API.filterState.search || ""
    }
}


text:
CREATE TABLE `admin_group_change_set` (
  `id_admin_group_change_set` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `id_admin` int(11) unsigned DEFAULT NULL,
  `id_admin_group_change` int(10) unsigned DEFAULT NULL,
  `id_group` int(10) unsigned DEFAULT NULL,
  `id_author` int(11) unsigned DEFAULT NULL,
  PRIMARY KEY (`id_admin_group_change_set`),
  KEY `id_admin` (`id_admin`),
  KEY `id_group` (`id_group`),
  KEY `id_author` (`id_author`),
  CONSTRAINT `admin_group_change_set_ibfk_6` FOREIGN KEY (`id_author`) REFERENCES `admin` (`id_admin_author`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `admin_group_change_set_ibfk_3` FOREIGN KEY (`id_admin_group_change_set`) REFERENCES `admin_group` (`id_group`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `admin_group_change_set_ibfk_4` FOREIGN KEY (`id_group`) REFERENCES `admin_group` (`id_group`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `admin_group_change_set_ibfk_5` FOREIGN KEY (`id_author`) REFERENCES `admin` (`id_admin`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `admin_group_change` (
  `id_admin_group_change` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `field` varchar(255) DEFAULT NULL,
  `old_value` varchar(255) DEFAULT NULL,
  `new_value` varchar(255) DEFAULT NULL,
  `id_admin_group_change_set` int(11) unsigned DEFAULT NULL,
  PRIMARY KEY (`id_admin_group_change`),
  KEY `id_admin_group_change_set` (`id_admin_group_change_set`),
  CONSTRAINT `admin_group_change_ibfk_1` FOREIGN KEY (`id_admin_group_change_set`) REFERENCES `admin_group_change_set` (`id_admin_group_change_set`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


text:
class ResumeController < ApplicationController
	TEMPLFILE = Rails.root.join("app","views","resume","resume.erb.rb")
	OUTFILE = Rails.public_path.join("resume.html")

	def index
		@title = "- Résumé"
# setup template data
		if !File.exists?(OUTFILE) || File.mtime(Resume.json_file_location) > File.mtime(OUTFILE) ||
				File.mtime(TEMPLFILE) > File.mtime(OUTFILE)
			resume = Resume.new(JsonParser.new(Resume.json_file_location))
			File.open(OUTFILE, "w") do |file|
				file.write(resume.build(ERB.new(File.read(TEMPLFILE), nil, '-')))
			end
		end
		render file: OUTFILE, layout: true
	end
end


text:
<?php

/**
 * ProductorActividadProductiva form.
 *
 * @package    symfony1-baseproject
 * @subpackage form
 * @author     mppfiles
 */
class ProductorActividadProductivaForm extends BaseProductorActividadProductivaForm
{
  public function configure()
  {
  }
}


text:
layout: post
title: I Published a Thing in Code Words!
category: programming
tags: [R, ggplot]

---

The [Recurse Center](https://www.recurse.com/) puts out a quarterly
publication called Code Words, which publishes articles that try to
capture the fun of digging into
a problem and learning about programming. I wrote a piece on the
grammar of graphics, and how it can provide a language for exploring
and talking about data visualization. It uses examples from R's
`ggplot` package, but the ideas are more general. Check out my
article, and other great articles from RC alums, in the
[sixth issue of Code Words](https://codewords.recurse.com/issues/six)!


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

#include "ash/system/progress_indicator/progress_indicator.h"

#include "ash/system/progress_indicator/progress_indicator_animation_registry.h"
#include "ash/test/ash_test_base.h"
#include "base/test/bind.h"
#include "base/test/repeating_test_future.h"

namespace ash {
namespace {

// TestProgressIndicator -------------------------------------------------------

class TestProgressIndicator : public ProgressIndicator {
 public:
  TestProgressIndicator()
      : ProgressIndicator(/*animation_registry=*/nullptr,
                          /*animation_key=*/this) {}

  void SetProgress(const absl::optional<float>& progress) {
    progress_ = progress;
    static_cast<ui::LayerDelegate*>(this)->UpdateVisualState();
  }

 private:
  // ProgressIndicator:
  absl::optional<float> CalculateProgress() const override { return progress_; }
  absl::optional<float> progress_;
};

}  // namespace

// ProgressIndicatorTest -------------------------------------------------------

using ProgressIndicatorTest = AshTestBase;

// Verifies that `ProgressIndicator::CreateDefaultInstance()` works as intended.
// It should delegate progress calculation to a constructor provided callback
// and manage progress animations as needed.
TEST_F(ProgressIndicatorTest, CreateDefaultInstance) {
  absl::optional<float> progress;

  // Create a default instance of `ProgressIndicator` that paints `progress`
  // whenever visual state is updated.
  auto progress_indicator = ProgressIndicator::CreateDefaultInstance(
      base::BindLambdaForTesting([&]() { return progress; }));

  // Cache `layer_delegate` associate with `progress_indicator` to manually
  // trigger update of visual state.
  auto* layer_delegate =
      static_cast<ui::LayerDelegate*>(progress_indicator.get());

  // Cache animation `key` and `registry` associated with `progress_indicator`.
  auto* key = progress_indicator.get();
  auto* registry = progress_indicator->animation_registry();

  // Verify initial progress and animation states.
  EXPECT_EQ(progress_indicator->progress(), progress);
  EXPECT_FALSE(registry->GetProgressIconAnimationForKey(key));
  EXPECT_FALSE(registry->GetProgressRingAnimationForKey(key));

  // Update `progress` to 0%. Verify progress and animation states.
  progress = 0.f;
  layer_delegate->UpdateVisualState();
  EXPECT_EQ(progress_indicator->progress(), progress);
  ASSERT_TRUE(registry->GetProgressIconAnimationForKey(key));
  EXPECT_TRUE(registry->GetProgressIconAnimationForKey(key)->HasAnimated());
  EXPECT_FALSE(registry->GetProgressRingAnimationForKey(key));

  // Update `progress` to 50%. Verify progress and animation states.
  progress = 0.5f;
  layer_delegate->UpdateVisualState();
  EXPECT_EQ(progress_indicator->progress(), progress);
  ASSERT_TRUE(registry->GetProgressIconAnimationForKey(key));
  EXPECT_TRUE(registry->GetProgressIconAnimationForKey(key)->HasAnimated());
  EXPECT_FALSE(registry->GetProgressRingAnimationForKey(key));

  // Update `progress` to indeterminate. Verify progress and animation states.
  progress = absl::nullopt;
  layer_delegate->UpdateVisualState();
  EXPECT_EQ(progress_indicator->progress(), progress);
  ASSERT_TRUE(registry->GetProgressIconAnimationForKey(key));
  EXPECT_TRUE(registry->GetProgressIconAnimationForKey(key)->HasAnimated());
  ASSERT_TRUE(registry->GetProgressRingAnimationForKey(key));
  EXPECT_EQ(registry->GetProgressRingAnimationForKey(key)->type(),
            ProgressRingAnimation::Type::kIndeterminate);

  // Update `progress` to 75%. Verify progress and animation states.
  progress = 0.75f;
  layer_delegate->UpdateVisualState();
  EXPECT_EQ(progress_indicator->progress(), progress);
  ASSERT_TRUE(registry->GetProgressIconAnimationForKey(key));
  EXPECT_TRUE(registry->GetProgressIconAnimationForKey(key)->HasAnimated());
  EXPECT_FALSE(registry->GetProgressRingAnimationForKey(key));

  // Update `progress` to 100%. Verify progress an animation states.
  progress = ProgressIndicator::kProgressComplete;
  layer_delegate->UpdateVisualState();
  EXPECT_EQ(progress_indicator->progress(), progress);
  EXPECT_FALSE(registry->GetProgressIconAnimationForKey(key));
  ASSERT_TRUE(registry->GetProgressRingAnimationForKey(key));
  EXPECT_EQ(registry->GetProgressRingAnimationForKey(key)->type(),
            ProgressRingAnimation::Type::kPulse);

  // The pulse animation that runs on progress completion should be removed
  // automatically on animation completion.
  base::test::RepeatingTestFuture<ProgressRingAnimation*> future;
  auto subscription = registry->AddProgressRingAnimationChangedCallbackForKey(
      key, future.GetCallback());
  EXPECT_EQ(future.Take(), nullptr);
}

// Verifies that `ProgressIndicator::AddProgressChangedCallback()` works as
// intended.
TEST_F(ProgressIndicatorTest, AddProgressChangedCallback) {
  // Create a test `progress_indicator`.
  TestProgressIndicator progress_indicator;
  progress_indicator.SetProgress(0.5f);

  // Add a callback to be notified of progress changed events. The callback
  // should be invoked on progress changes so long as the returned subscription
  // continues to exist.
  int callback_call_count = 0;
  auto subscription =
      std::make_unique<base::RepeatingClosureList::Subscription>(
          progress_indicator.AddProgressChangedCallback(
              base::BindLambdaForTesting([&]() { ++callback_call_count; })));

  // Change the underlying progress.
  progress_indicator.SetProgress(0.75f);
  EXPECT_EQ(callback_call_count, 1);

  // Attempt to change the underlying progress to the same value.
  progress_indicator.SetProgress(0.75f);
  EXPECT_EQ(callback_call_count, 1);

  // Reset the subscription and change the underlying progress.
  subscription.reset();
  progress_indicator.SetProgress(1.f);
  EXPECT_EQ(callback_call_count, 1);
}

}  // namespace ash