text:
using System;
using System.ComponentModel;
using System.Globalization;

namespace NGnono.Framework.Extension
{
    /// <summary>
    /// CLR Version: 4.0.30319.239
    /// NameSpace: NGnono.Framework.Extension
    /// FileName: EnumExtension
    ///
    /// Created at 1/12/2012 2:01:49 PM
    /// </summary>
    public static class EnumExtension
    {
        #region fields

        #endregion

        #region .ctor

        #endregion

        #region properties

        #endregion

        #region methods

        /// <summary>
        /// 获取 枚举 上的Description 特性的值
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static string GetEnumDescription(this Enum source)
        {
            var enumInfo = source.GetType().GetField(source.ToString(CultureInfo.InvariantCulture));

            var enumAttributes = (DescriptionAttribute[])enumInfo.GetCustomAttributes(typeof(DescriptionAttribute), false);

            return enumAttributes.Length > 0 ? enumAttributes[0].Description : source.ToString(CultureInfo.InvariantCulture);
        }

        public static string GetEnumName(Type enumType, Object value)
        {
            return Enum.GetName(enumType, value);
        }

        public static string[] GetNames(Type enumType)
        {
            return Enum.GetNames(enumType);
        }

        public static T Parser<T>(string value)
        {
            return (T)Enum.Parse(typeof(T), value);
        }

        public static T Parser<T>(int value)
        {
            return (T)Enum.ToObject(typeof(T), value);
        }

        public static bool IsDefined(Type enumType, object value)
        {
            return Enum.IsDefined(enumType, value);
        }

        #endregion
    }
}


text:
from flask import render_template
from flask.views import MethodView

class View(MethodView):
    """
    View which will dispatch requests based on request method.

    This class inherits from:

    * :py:class:`!flask.views.MethodView`

    For example, a GET request will be dispatched to the ``get`` method, a POST
    request will be dispatched to the ``post`` method. Example usage::

        class MethodView(View):

            def get(self, *args, **kwargs):
                return 'Hello {0}'.format(self.kwargs.get('user'))

    When you have a URL route ``'/<user>/'`` and you GET ``/john/``, it
    will return ``'Hello john'``.

    """
    def dispatch_request(self, *args, **kwargs):
        """
        Dispatch the request based on HTTP method.

        This sets the arguments and keyword-arguments passed by the
        URL route dispatcher to ``self.args`` and ``self.kwargs``, then it will
        dispatch the request to the right method.

        """
        self.args = args
        self.kwargs = kwargs
        return super(View, self).dispatch_request(*args, **kwargs)

class TemplateResponseMixin(object):
    """
    Mixin class for rendering templates.

    This will use the :py:meth:`!flask.render_template` method for rendering
    (Jinja2) templates.

    .. seealso:: http://jinja.pocoo.org/

    """

    template_name = None
    """
    Set this variable to the template you want to render.
    """

    def render_to_response(self, context_data={}):
        """
        Render template with the given context data.

        :param context_data:
            A ``dict`` containing the context data. Optional.

        :return:
            The rendered template as a string.

        """
        return render_template(self.template_name, **context_data)

class TemplateView(TemplateResponseMixin, View):
    """
    View class for rendering templates.

    This class inherits from:

    * :py:class:`.TemplateResponseMixin`
    * :py:class:`.View`

    Example usage::

        class IndexTemplateView(TemplateView):
            template_name = 'index.html'

    """
    def get_context_data(self, **kwargs):
        """
        Get context data for rendering the template.

        :return:
            A ``dict`` containing the following keys:

            ``params``
                A ``dict`` containing the ``kwargs``.

        """
        return {
            'params': kwargs,
        }

    def get(self, *args, **kwargs):
        """
        Render the template on request.

        The keyword-arguments passed by the URL dispatcher are added
        to the context data.

        :return:
            Output of :py:meth:`.TemplateResponseMixin.render_to_response`.

        """
        return self.render_to_response(self.get_context_data(**kwargs))

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using Orchard.Scripting.Ast;

namespace Orchard.Scripting.Compiler {
    public class Interpreter {
        public EvaluationResult Evalutate(EvaluationContext context) {
            return new InterpreterVisitor(context).Evaluate();
        }
    }

    public class EvaluationContext {
        public AbstractSyntaxTree Tree { get; set; }
        public Func<string, IList<object>, object> MethodInvocationCallback { get; set; }
    }
}


text:
using System;
using DamageBot.Users;
using TwitchLib.Extensions.Client;

namespace VanillaModeration {
    /// <summary>
    /// Extension class to add moderation features to the DamageBot
    /// </summary>
    public static class ModeratorExtensions {
        /// <summary>
        /// Basically a temporary ban on a user.
        /// This will also clear the chat messges for given user.
        /// </summary>
        /// <param name="bot"></param>
        /// <param name="user"></param>
        /// <param name="time"></param>
        /// <param name="message"></param>
        public static void TimeoutUser(this DamageBot.DamageBot bot, IUser user, TimeSpan time, string message = "") {
            bot.TwitchIrcClient.TimeoutUser(user.Status.Channel, user.Name, time, message);
        }

        /// <summary>
        /// Perma-ban a user
        /// </summary>
        /// <param name="bot"></param>
        /// <param name="user"></param>
        /// <param name="message"></param>
        public static void BanUser(this DamageBot.DamageBot bot, IUser user, string message = "") {
            bot.TwitchIrcClient.BanUser(user.Status.Channel, user.Name, message);
        }

        /// <summary>
        /// Lift a perma ban or a timeout for the specified user.
        /// </summary>
        /// <param name="bot"></param>
        /// <param name="user"></param>
        public static void UnbanUser(this DamageBot.DamageBot bot, IUser user) {
            bot.TwitchIrcClient.UnbanUser(user.Name);
        }

        /// <summary>
        /// Clear the chat history for the given user
        /// </summary>
        /// <param name="bot"></param>
        /// <param name="user"></param>
        public static void ClearChatForUser(this DamageBot.DamageBot bot, IUser user) {
            // Here's what's happening here:
            // The Timout command will also issue a CLEARCHAT for the timeouted user.
            // Effectively purging the guys chat history.
            // By making the timeout 1 second it's basically like no timeout at all.
            // so effectively, just purge this users messages.
            bot.TwitchIrcClient.TimeoutUser(user.Status.Channel, user.Name, TimeSpan.FromSeconds(1));
        }
    }
}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;

namespace ServiceStack.OrmLite.Dapper
{
    /// <summary>
    /// Used to pass a IEnumerable<SqlDataRecord> as a SqlDataRecordListTVPParameter
    /// </summary>
    internal sealed class SqlDataRecordListTVPParameter<T> : SqlMapper.ICustomQueryParameter
        where T : IDataRecord
    {
        private readonly IEnumerable<T> data;
        private readonly string typeName;
        /// <summary>
        /// Create a new instance of <see cref="SqlDataRecordListTVPParameter<T>"/>.
        /// </summary>
        /// <param name="data">The data records to convert into TVPs.</param>
        /// <param name="typeName">The parameter type name.</param>
        public SqlDataRecordListTVPParameter(IEnumerable<T> data, string typeName)
        {
            this.data = data;
            this.typeName = typeName;
        }

        void SqlMapper.ICustomQueryParameter.AddParameter(IDbCommand command, string name)
        {
            var param = command.CreateParameter();
            param.ParameterName = name;
            Set(param, data, typeName);
            command.Parameters.Add(param);
        }

        internal static void Set(IDbDataParameter parameter, IEnumerable<T> data, string typeName)
        {
            parameter.Value = data != null && data.Any() ? data : null;
            StructuredHelper.ConfigureTVP(parameter, typeName);
        }
    }
    static class StructuredHelper
    {
        private static readonly Hashtable s_udt = new Hashtable(), s_tvp = new Hashtable();

        private static Action<IDbDataParameter, string> GetUDT(Type type)
            => (Action<IDbDataParameter, string>)s_udt[type] ?? SlowGetHelper(type, s_udt, "UdtTypeName", 29); // 29 = SqlDbType.Udt (avoiding ref)
        private static Action<IDbDataParameter, string> GetTVP(Type type)
            => (Action<IDbDataParameter, string>)s_tvp[type] ?? SlowGetHelper(type, s_tvp, "TypeName", 30); // 30 = SqlDbType.Structured (avoiding ref)

        static Action<IDbDataParameter, string> SlowGetHelper(Type type, Hashtable hashtable, string nameProperty, int sqlDbType)
        {
            lock (hashtable)
            {
                var helper = (Action<IDbDataParameter, string>)hashtable[type];
                if (helper == null)
                {
                    helper = CreateFor(type, nameProperty, sqlDbType);
                    hashtable.Add(type, helper);
                }
                return helper;
            }
        }

        static Action<IDbDataParameter, string> CreateFor(Type type, string nameProperty, int sqlDbType)
        {
            var name = type.GetProperty(nameProperty, BindingFlags.Public | BindingFlags.Instance);
            if (name == null || !name.CanWrite)
            {
                return (p, n) => { };
            }

            var dbType = type.GetProperty("SqlDbType", BindingFlags.Public | BindingFlags.Instance);
            if (dbType != null && !dbType.CanWrite) dbType = null;

            var dm = new DynamicMethod(nameof(CreateFor) + "_" + type.Name, null,
                new[] { typeof(IDbDataParameter), typeof(string) }, true);
            var il = dm.GetILGenerator();
            il.Emit(OpCodes.Ldarg_0);
            il.Emit(OpCodes.Castclass, type);
            il.Emit(OpCodes.Ldarg_1);
            il.EmitCall(OpCodes.Callvirt, name.GetSetMethod(), null);

            if (dbType != null)
            {
                il.Emit(OpCodes.Ldarg_0);
                il.Emit(OpCodes.Castclass, type);
                il.Emit(OpCodes.Ldc_I4, sqlDbType);
                il.EmitCall(OpCodes.Callvirt, dbType.GetSetMethod(), null);
            }

            il.Emit(OpCodes.Ret);
            return (Action<IDbDataParameter, string>)dm.CreateDelegate(typeof(Action<IDbDataParameter, string>));

        }

        // this needs to be done per-provider; "dynamic" doesn't work well on all runtimes, although that
        // would be a fair option otherwise
        internal static void ConfigureUDT(IDbDataParameter parameter, string typeName)
            => GetUDT(parameter.GetType())(parameter, typeName);
        internal static void ConfigureTVP(IDbDataParameter parameter, string typeName)
            => GetTVP(parameter.GetType())(parameter, typeName);
    }
}


text:
<?php

namespace Phperf\Xhprof\Command;

use Phperf\Xhprof\Html\View\Layout;
use Yaoi\Command;
use Yaoi\Command\Definition;
use Yaoi\Command\Option;
use Yaoi\Database;
use Yaoi\DependencyRepository;
use Yaoi\Io\Content\Heading;
use Yaoi\Io\Content\Rows;
use Yaoi\Io\Request;
use Yaoi\Log;
use Yaoi\String\Expression;
use Yaoi\Undefined;
use Yaoi\View\Raw;

class Compare extends BaseFilter
{

    /** @var  Layout */
    protected $layout;

    public function __construct(Request $request = null)
    {
        if (null === $request) {
            $request = Request::createAuto();
        }
        $this->requestRef = DependencyRepository::add($request);

        $undefined = Undefined::get();
        foreach (static::optionsArray() as $option) {
            $this->{$option->name} = $undefined;
        }

        $this->layout = new Layout();
    }

    public function error() {
        $this->layout->pushMain(
            Raw::create(
                Expression::create(func_get_args())
            )
        )->render();
    }

    protected $requestRef;

    /**
     * @return Request
     */
    public function request() {
        return DependencyRepository::get($this->requestRef);
    }

    /**
     * @return $this|\stdClass
     */
    public function getParams() {
        static $keys = null;
        if (null === $keys) {
            $keys = array_keys(static::optionsArray());
        }

        $object = new \stdClass();
        foreach ($keys as $name) {
            if (!$this->$name instanceof Undefined) {
                $object->$name = $this->$name;
            }
        }

        return $object;
    }

    public function getUrl(\stdClass $params) {
        static $propertiesToParams;
        if (null === $propertiesToParams) {
            $propertiesToParams = array();
            foreach (static::optionsArray() as $propertyName => $option) {
                $propertiesToParams[$propertyName] = $option->getPublicName();
            }
        }
        $params = (array)$params;
        $values = array();
        foreach ($params as $propertyName => $value) {
            $values [$propertiesToParams[$propertyName]] = $value;
        }
        return http_build_query($values);
    }

    public function __destruct()
    {
        DependencyRepository::delete($this->requestRef);
    }

    static function setUpDefinition(Command\Definition $definition, $options)
    {
        parent::setUpDefinition($definition, $options);
        $options->run = Option::cast($options->run)
            ->setIsVariadic();
    }

    public function performAction()
    {
        //Console::getInstance()->set(Console::FG_BLUE)->printF('AI AM HIARE')->set(Console::RESET)->eol();

        if ($this->isInclusive instanceof Undefined) {
            $this->isInclusive = 0;
        }

        $expr = \Phperf\Xhprof\Query\Compare::create();
        if (!$this->limit instanceof Undefined) {
            $expr->limit = $this->limit;
        }

        $expr->isInclusive = $this->isInclusive;
        foreach ($this->run as $runName) {
            $expr->addRun($runName);
        }
        //echo $expr->build(), PHP_EOL;
        if ($this->symbol instanceof Undefined) {
            $res = $expr->build($expr->topSymbolsExpr())->query();
            $this->response->addContent(new Rows($res));
        }
        else {
            $expr->setSymbol($this->symbol);

            $this->response->addContent(new Heading($this->symbol));
            $res = $expr->build($expr->topSymbolsExpr())->query();
            $this->response->addContent(new Rows($res));

            $this->response->addContent(new Heading('Parents'));
            $res = $expr->build($expr->topParentsExpr())->query();
            $this->response->addContent(new Rows($res));

            $this->response->addContent(new Heading('Children'));
            $res = $expr->build($expr->topChildrenExpr())->query();
            $this->response->addContent(new Rows($res));
        }
    }
}


text:
from __future__ import print_function, unicode_literals

from django.conf import settings
from django.core.exceptions import MiddlewareNotUsed
from django.http import Http404

pudb = None  # Silence pyflakes

class PudbMiddleware(object):
    def __init__(self):
        if not getattr(settings, 'DEBUG', False):
            raise MiddlewareNotUsed

        # Hack alert :)
        import traceback
        if '/threading.py' in traceback.extract_stack()[0][0]:
            print('PudbMiddleware: Threading not (yet) supported, unloading myself.')
            raise MiddlewareNotUsed

        try:
            global pudb
            import pudb
            assert pudb  # Silence pyflakes
        except ImportError:
            print('PudbMiddleware: Could not import pudb, unloading myself.')
            raise MiddlewareNotUsed

        print('PudbMiddleware: DEBUG enabled and pudb found, intercepting all uncaught exceptions.')

    def process_exception(self, request, exception):
        if isinstance(exception, Http404):
            return
        print('PudbMiddleware: activating on "{0}"'.format(repr(exception)))
        pudb.post_mortem()


text:
module.exports = function (plop) {
	'use strict';

	// helpers are passed through to handlebars and made
	// available for use in the generator templates

	// adds 4 dashes around some text
	plop.addHelper('dashAround', function (text) {
		return '---- ' + text + ' ----';
	});

	// formats an array of options like you would write
	// it if you were speaking (one, two, and three)
	plop.addHelper('wordJoin', function (words) {
		return words.join(', ').replace(/(:?.*),/, '$1, and');
	});

	// setGenerator creates a generator that can be run with "plop generatorName"
	plop.setGenerator('test', {
		description: 'this is a test',
		prompts: [
			{
				type: 'input',
				name: 'name',
				message: 'What is your name?',
				validate: function (value) {
					if ((/.+/).test(value)) { return true; }
					return 'name is required';
				}
			}, {
				type: 'input',
				name: 'age',
				message: 'How old are you?',
				validate: function (value) {
					var digitsOnly = /\d+/;
					if (digitsOnly.test(value)) { return true; }
					return 'Invalid age! Must be a number genius!'
				}
			}, {
				type: 'checkbox',
				name: 'toppings',
				message: 'What pizza toppings to you like?',
				choices: [
					{name: 'Cheese', value: 'cheese', checked: true},
					{name: 'Peperonni', value: 'peperonni'},
					{name: 'Pineapple', value: 'pineapple'},
					{name: 'Mushroom', value: 'mushroom'},
					{name: 'Bacon', value: 'bacon'}
				]
			}
		],
		actions: [
			{
				type: 'add',
				path: 'folder/{{dashCase name}}.txt',
				templateFile: 'templates/temp.txt',
				abortOnFail: true
			},{
				type: 'modify',
				path: 'change-me.txt',
				pattern: /(-- APPEND ITEMS HERE --)/gi,
				template: '$1\r\n{{name}}: {{age}}'
			},{
				type: 'modify',
				path: 'change-me.txt',
				pattern: /(-- PREPEND ITEMS HERE --)/gi,
				templateFile: 'templates/part.txt'
			},{
				type: 'modify',
				path: 'change-me.txt',
				pattern: /## replace name here ##/gi,
				template: 'replaced => {{dashCase name}}'
			}
		]
	});
};


text:
const char* const HTML_BEGIN = "
Simple http server

";
const char* const HTML_END = "
\r\n";
const char* const HTML_TABLE_BEGIN = "
";
const char* const HTML_TABLE_END = "
";
const char* const HTML_LINK_BEGIN = "";
const char* const HTML_LINK_END = "";

#endif


text:
declare module "type-is" {
    import * as http from "http";

    namespace TypeIs {
        function hasBody(request: http.IncomingMessage): boolean;
        function is(mediaType: string, mediaTypes: Array<string>): string;
    }

    function TypeIs(request: http.IncomingMessage, types: Array<string>): any;
    export = TypeIs;
}


text:
namespace MassTransit
{
    using System;

    [Serializable]
    public class NotAcceptedStateMachineException :
        SagaException
    {
        public NotAcceptedStateMachineException(Type sagaType, Type messageType, Guid correlationId, string currentState, Exception exception)
            : base($"Not accepted in state {currentState}", sagaType, messageType, correlationId, exception)
        {
        }
    }
}


text:
Sequence trace files (or chomatograms) contain the raw data output from sequencers employing automated Sanger-based sequencing.

## Overview ##
Sequence trace files (or chomatograms) contain the raw data output from sequencers employing automated Sanger-based sequencing.  This sequencing methodology and file format have largely been replaced by next-generation sequencing and BAM or FASTQ formatted data.  This file type can be found in the GDC Legacy Archive.

## References ##
1. N/A

## External Links ##
* N/A

Categories: General


text:
import { app, BrowserWindow, Menu, shell } from 'electron';

let menu;
let template;
let mainWindow = null;

if (process.env.NODE_ENV === 'development') {
  require('electron-debug')(); // eslint-disable-line global-require
}

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') app.quit();
});

const installExtensions = async () => {
  if (process.env.NODE_ENV === 'development') {
    const installer = require('electron-devtools-installer'); // eslint-disable-line global-require

    const extensions = [
      'REACT_DEVELOPER_TOOLS',
      'REDUX_DEVTOOLS'
    ];
    const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
    for (const name of extensions) {
      try {
        await installer.default(installer[name], forceDownload);
      } catch (e) {} // eslint-disable-line
    }
  }
};

app.on('ready', async () => {
  await installExtensions();

  mainWindow = new BrowserWindow({
    show: false,
    width: 1024,
    height: 728
  });

  mainWindow.loadURL(`file://${__dirname}/app/app.html`);

  mainWindow.webContents.on('did-finish-load', () => {
    mainWindow.show();
    mainWindow.focus();
  });

  mainWindow.on('closed', () => {
    mainWindow = null;
  });

  if (process.env.NODE_ENV === 'development') {
    mainWindow.openDevTools();
    mainWindow.webContents.on('context-menu', (e, props) => {
      const { x, y } = props;

      Menu.buildFromTemplate([{
        label: 'Inspect element',
        click() {
          mainWindow.inspectElement(x, y);
        }
      }]).popup(mainWindow);
    });
  }

  if (process.platform === 'darwin') {
    template = [{
      label: 'Electron',
      submenu: [{
        label: 'About ElectronReact',
        selector: 'orderFrontStandardAboutPanel:'
      }, {
        type: 'separator'
      }, {
        label: 'Services',
        submenu: []
      }, {
        type: 'separator'
      }, {
        label: 'Hide ElectronReact',
        accelerator: 'Command+H',
        selector: 'hide:'
      }, {
        label: 'Hide Others',
        accelerator: 'Command+Shift+H',
        selector: 'hideOtherApplications:'
      }, {
        label: 'Show All',
        selector: 'unhideAllApplications:'
      }, {
        type: 'separator'
      }, {
        label: 'Quit',
        accelerator: 'Command+Q',
        click() {
          app.quit();
        }
      }]
    }, {
      label: 'Edit',
      submenu: [{
        label: 'Undo',
        accelerator: 'Command+Z',
        selector: 'undo:'
      }, {
        label: 'Redo',
        accelerator: 'Shift+Command+Z',
        selector: 'redo:'
      }, {
        type: 'separator'
      }, {
        label: 'Cut',
        accelerator: 'Command+X',
        selector: 'cut:'
      }, {
        label: 'Copy',
        accelerator: 'Command+C',
        selector: 'copy:'
      }, {
        label: 'Paste',
        accelerator: 'Command+V',
        selector: 'paste:'
      }, {
        label: 'Select All',
        accelerator: 'Command+A',
        selector: 'selectAll:'
      }]
    }, {
      label: 'View',
      submenu: (process.env.NODE_ENV === 'development') ? [{
        label: 'Reload',
        accelerator: 'Command+R',
        click() {
          mainWindow.webContents.reload();
        }
      }, {
        label: 'Toggle Full Screen',
        accelerator: 'Ctrl+Command+F',
        click() {
          mainWindow.setFullScreen(!mainWindow.isFullScreen());
        }
      }, {
        label: 'Toggle Developer Tools',
        accelerator: 'Alt+Command+I',
        click() {
          mainWindow.toggleDevTools();
        }
      }] : [{
        label: 'Toggle Full Screen',
        accelerator: 'Ctrl+Command+F',
        click() {
          mainWindow.setFullScreen(!mainWindow.isFullScreen());
        }
      }]
    }, {
      label: 'Window',
      submenu: [{
        label: 'Minimize',
        accelerator: 'Command+M',
        selector: 'performMiniaturize:'
      }, {
        label: 'Close',
        accelerator: 'Command+W',
        selector: 'performClose:'
      }, {
        type: 'separator'
      }, {
        label: 'Bring All to Front',
        selector: 'arrangeInFront:'
      }]
    }, {
      label: 'Help',
      submenu: [{
        label: 'Learn More',
        click() {
          shell.openExternal('http://electron.atom.io');
        }
      }, {
        label: 'Documentation',
        click() {
          shell.openExternal('https://github.com/atom/electron/tree/master/docs#readme');
        }
      }, {
        label: 'Community Discussions',
        click() {
          shell.openExternal('https://discuss.atom.io/c/electron');
        }
      }, {
        label: 'Search Issues',
        click() {
          shell.openExternal('https://github.com/atom/electron/issues');
        }
      }]
    }];

    menu = Menu.buildFromTemplate(template);
    Menu.setApplicationMenu(menu);
  } else {
    template = [{
      label: '&File',
      submenu: [{
        label: '&Open',
        accelerator: 'Ctrl+O'
      }, {
        label: '&Close',
        accelerator: 'Ctrl+W',
        click() {
          mainWindow.close();
        }
      }]
    }, {
      label: '&View',
      submenu: (process.env.NODE_ENV === 'development') ? [{
        label: '&Reload',
        accelerator: 'Ctrl+R',
        click() {
          mainWindow.webContents.reload();
        }
      }, {
        label: 'Toggle &Full Screen',
        accelerator: 'F11',
        click() {
          mainWindow.setFullScreen(!mainWindow.isFullScreen());
        }
      }, {
        label: 'Toggle &Developer Tools',
        accelerator: 'Alt+Ctrl+I',
        click() {
          mainWindow.toggleDevTools();
        }
      }] : [{
        label: 'Toggle &Full Screen',
        accelerator: 'F11',
        click() {
          mainWindow.setFullScreen(!mainWindow.isFullScreen());
        }
      }]
    }, {
      label: 'Help',
      submenu: [{
        label: 'Learn More',
        click() {
          shell.openExternal('http://electron.atom.io');
        }
      }, {
        label: 'Documentation',
        click() {
          shell.openExternal('https://github.com/atom/electron/tree/master/docs#readme');
        }
      }, {
        label: 'Community Discussions',
        click() {
          shell.openExternal('https://discuss.atom.io/c/electron');
        }
      }, {
        label: 'Search Issues',
        click() {
          shell.openExternal('https://github.com/atom/electron/issues');
        }
      }]
    }];
    menu = Menu.buildFromTemplate(template);
    mainWindow.setMenu(menu);
  }
});


text:
class AddPhoneNumberToUser < ActiveRecord::Migration[5.0]
  def change
    add_column :users, :phone_number, :string, null: false, default: "000-000-0000"
    change_column_default :users, :phone_number, nil
  end
end


text:
module RailsHashFromXmlCompatibilityFix
   Hash.class_eval do
     def self.unrename_keys(params)
       case params.class.to_s
         when "Hash"
           params.inject({}) do |h,(k,v)|
             h[k.to_s.underscore.tr("-", "_")] = unrename_keys(v)
             h
           end
         when "Array"
           params.map { |v| unrename_keys(v) }
         else
           params
         end
     end
   end
end


text:
require 'formula'

class Hive < Formula
  homepage 'http://hive.apache.org'
  url 'http://www.apache.org/dyn/closer.cgi?path=hive/hive-0.13.1/apache-hive-0.13.1-bin.tar.gz'
  sha1 'f9d96e3942ce93a409379f86632e80dd0a75848c'

  depends_on 'hadoop'

  def install
    rm_f Dir["bin/*.bat"]
    libexec.install %w[bin conf examples hcatalog lib scripts]
    bin.write_exec_script Dir["#{libexec}/bin/*"]
  end

  def caveats; <<-EOS.undent
    Hadoop must be in your path for hive executable to work.
    After installation, set $HIVE_HOME in your profile:
      export HIVE_HOME=#{libexec}

    If you want to use HCatalog with Pig, set $HCAT_HOME in your profile:
      export HCAT_HOME=#{libexec}/hcatalog

    You may need to set JAVA_HOME:
      export JAVA_HOME="$(/usr/libexec/java_home)"
    EOS
  end
end


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

  <title>Jcrop: the jQuery Image Cropping Plugin</title>
  <link rel="stylesheet" href="demos/demo_files/demos.css" type="text/css" />
  <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />

Jcrop Image Cropping Plugin

<big>
	Jcrop
	is the image cropping plugin for
	jQuery.

	You've successfully unpacked Jcrop.
</big>

Static Demos

Hello World
		— default behavior

Basic Handler
		— basic form integration

Aspect Ratio w/ Preview Pane
		— nice visual example

Animation/Transitions
		— animation/fading demo

API Interface
		— real-time API example

Live Demo

PHP Cropping Demo
		— requires PHP/gd support

Jcrop Links

Jcrop Home

Jcrop Manual

	© 2008-2011 Kelly Hallman

	Free software released under
	MIT License


text:
+ Julia Furst Morgado (2022), **Get paid to write technical articles** → https://dev.to/juliafmorgado/get-paid-to-write-technical-articles-16cl
  - A list of 84 websites that pay technical writers a good amount of money

## \[series\] Consumer driven contract testing with Pact

Contract testing is bigger topic than I'd been aware.

Search for more about it → https://duckduckgo.com/?q=consumer+driven+contract+testing

1. Alex Pruss (2018), **Introduction to Consumer-Driven Contract Testing** → https://medium.com/kreuzwerker-gmbh/introduction-to-consumer-driven-contract-testing-3a130c8c2ea0
2. Kristine Jetzke (2018), **Writing Contract Tests with Pact in Spring Boot** → https://medium.com/kreuzwerker-gmbh/writing-contract-tests-with-pact-in-spring-boot-97dbd60eeeac
3. Kristine Jetzke (2018), **Integrating Contract Tests into Build Pipelines with Pact Broker and Jenkins** → https://medium.com/kreuzwerker-gmbh/integrating-contract-tests-into-build-pipelines-with-pact-broker-and-jenkins-674d21c3f44b
4. Kristine Jetzke (2018), **Consumer-Driven Contract Tests: Lessons Learned** → https://medium.com/kreuzwerker-gmbh/consumer-driven-contract-tests-lessons-learned-b4e1ac471d0c

## Tools

+ css2xpath (2016), **CSS to XPath converter** → https://css2xpath.github.io/
  - Handy for complex selector-to-xpath, or for learning better xpath.
+ Guilherme Oderdenge (2022), **superstate** → https://superstate.dev/
    > *__superstate__ is a micro state management library for JavaScript apps that is compact enough for prototypes and scales well as your project grows.*
+ Craig Kierstiens (2022), **Learn Postgres at the Playground** → https://www.crunchydata.com/blog/learn-postgres-at-the-playground
  - Online playground for using Postgres *in the browser*!

## Tutorials

+ Obinna Okoro (2022), **Recognizing Speech with vanilla JavaScript** → https://blog.openreplay.com/recognizing-speech-with-vanilla-javascript
  - Title says it all...
+ Jen Simmons (2022), **Using :has() as a CSS Parent Selector and much more** → https://webkit.org/blog/13096/css-has-pseudo-class/
  - long-time coming, the `:has()` pseudo-classs has arrived, and Jen shows how to use it.
+ Abiodun Olowode (2022), **An Introduction to Ractors in Ruby** → https://blog.appsignal.com/2022/08/24/an-introduction-to-ractors-in-ruby.html
  - Actor model in Ruby.
+ Austin Morlan (2019), **A Simple Entity Component System** → https://austinmorlan.com/posts/entity_component_system/
  - Game programming approach to manageable components and compact memory layout for entity lookup.
+ Jon Mendez (2018), **javascript proxy – Querying arrays with more readable methods** → http://www.jomendez.com/2018/12/29/querying-arrays-with-more-readable-methods-using-javascript-proxy/
  - Nice pattern for dynamic query construction using a proxy over a data store/source...


text:
package org.apereo.cas.ws.idp.web;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.cxf.ws.security.tokenstore.SecurityToken;
import org.apache.http.client.utils.URIBuilder;
import org.apereo.cas.CasProtocolConstants;
import org.apereo.cas.authentication.AuthenticationServiceSelectionStrategy;
import org.apereo.cas.authentication.principal.Service;
import org.apereo.cas.authentication.principal.ServiceFactory;
import org.apereo.cas.authentication.principal.WebApplicationService;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.configuration.model.support.wsfed.WsFederationProperties;
import org.apereo.cas.services.RegexRegisteredService;
import org.apereo.cas.services.RegisteredServiceAccessStrategyUtils;
import org.apereo.cas.services.ServicesManager;
import org.apereo.cas.services.UnauthorizedServiceException;
import org.apereo.cas.support.saml.SamlException;
import org.apereo.cas.ticket.SecurityTokenTicket;
import org.apereo.cas.ticket.SecurityTokenTicketFactory;
import org.apereo.cas.ticket.TicketGrantingTicket;
import org.apereo.cas.ticket.registry.TicketRegistry;
import org.apereo.cas.ticket.registry.TicketRegistrySupport;
import org.apereo.cas.util.RandomUtils;
import org.apereo.cas.util.http.HttpClient;
import org.apereo.cas.web.support.CookieRetrievingCookieGenerator;
import org.apereo.cas.web.support.WebUtils;
import org.apereo.cas.ws.idp.WSFederationConstants;
import org.apereo.cas.ws.idp.services.WSFederationRegisteredService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

import java.net.URI;
import java.time.Instant;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * This is {@link BaseWSFederationRequestController}.
 *
 * @author Misagh Moayyed
 * @since 5.1.0
 */
@Controller
public abstract class BaseWSFederationRequestController {
    private static final Logger LOGGER = LoggerFactory.getLogger(BaseWSFederationRequestController.class);

    /**
     * The Services manager.
     */
    protected final ServicesManager servicesManager;

    /**
     * The Web application service factory.
     */
    protected final ServiceFactory<WebApplicationService> webApplicationServiceFactory;

    /**
     * The Callback service.
     */
    protected final Service callbackService;

    /**
     * The Cas properties.
     */
    protected final CasConfigurationProperties casProperties;

    /**
     * The Service selection strategy.
     */
    protected final AuthenticationServiceSelectionStrategy serviceSelectionStrategy;

    /**
     * The Http client.
     */
    protected final HttpClient httpClient;

    /**
     * The Security token ticket factory.
     */
    protected final SecurityTokenTicketFactory securityTokenTicketFactory;

    /**
     * The Ticket registry.
     */
    protected final TicketRegistry ticketRegistry;

    /**
     * The Ticket granting ticket cookie generator.
     */
    protected final CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator;

    /**
     * The Ticket registry support.
     */
    protected final TicketRegistrySupport ticketRegistrySupport;

    /**
     * Instantiates a new Base ws federation request controller.
     *
     * @param servicesManager                     the services manager
     * @param webApplicationServiceFactory        the web application service factory
     * @param casProperties                       the cas properties
     * @param serviceSelectionStrategy            the service selection strategy
     * @param httpClient                          the http client
     * @param securityTokenTicketFactory          the security token ticket factory
     * @param ticketRegistry                      the ticket registry
     * @param ticketGrantingTicketCookieGenerator the ticket granting ticket cookie generator
     * @param ticketRegistrySupport               the ticket registry support
     */
    public BaseWSFederationRequestController(
            final ServicesManager servicesManager,
            final ServiceFactory<WebApplicationService> webApplicationServiceFactory,
            final CasConfigurationProperties casProperties,
            final AuthenticationServiceSelectionStrategy serviceSelectionStrategy,
            final HttpClient httpClient,
            final SecurityTokenTicketFactory securityTokenTicketFactory,
            final TicketRegistry ticketRegistry,
            final CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator,
            final TicketRegistrySupport ticketRegistrySupport) {
        this.servicesManager = servicesManager;
        this.webApplicationServiceFactory = webApplicationServiceFactory;
        this.casProperties = casProperties;
        this.serviceSelectionStrategy = serviceSelectionStrategy;
        this.httpClient = httpClient;
        this.securityTokenTicketFactory = securityTokenTicketFactory;
        this.ticketRegistry = ticketRegistry;
        this.ticketGrantingTicketCookieGenerator = ticketGrantingTicketCookieGenerator;
        this.ticketRegistrySupport = ticketRegistrySupport;
        this.callbackService = registerCallback(WSFederationConstants.ENDPOINT_FEDERATION_REQUEST_CALLBACK);
    }

    /**
     * Register callback service.
     *
     * @param callbackUrl the callback url
     * @return the service
     */
    private Service registerCallback(final String callbackUrl) {
        final Service callbackService = this.webApplicationServiceFactory.createService(callbackUrl);
        if (!this.servicesManager.matchesExistingService(callbackService)) {
            LOGGER.debug("Initializing callback service [{}]", callbackService);

            final RegexRegisteredService service = new RegexRegisteredService();
            service.setId(Math.abs(RandomUtils.getInstanceNative().nextLong()));
            service.setEvaluationOrder(0);
            service.setName(service.getClass().getSimpleName());
            service.setDescription("WS-Federation Authentication Request");
            service.setServiceId(callbackService.getId().concat(".+"));

            LOGGER.debug("Saving callback service [{}] into the registry", service);
            this.servicesManager.save(service);
            this.servicesManager.load();
        }
        return callbackService;
    }

    /**
     * Construct service url string.
     *
     * @param request      the request
     * @param response     the response
     * @param wsfedRequest the ws federation request
     * @return the service url
     */
    protected String constructServiceUrl(final HttpServletRequest request, final HttpServletResponse response,
                                         final WSFederationRequest wsfedRequest) {
        try {
            final URIBuilder builder = new URIBuilder(this.callbackService.getId());

            builder.addParameter(WSFederationConstants.WA, wsfedRequest.getWa());
            builder.addParameter(WSFederationConstants.WREPLY, wsfedRequest.getWreply());
            builder.addParameter(WSFederationConstants.WTREALM, wsfedRequest.getWtrealm());

            if (StringUtils.isNotBlank(wsfedRequest.getWctx())) {
                builder.addParameter(WSFederationConstants.WCTX, wsfedRequest.getWctx());
            }
            if (StringUtils.isNotBlank(wsfedRequest.getWfresh())) {
                builder.addParameter(WSFederationConstants.WREFRESH, wsfedRequest.getWfresh());
            }
            if (StringUtils.isNotBlank(wsfedRequest.getWhr())) {
                builder.addParameter(WSFederationConstants.WHR, wsfedRequest.getWhr());
            }
            if (StringUtils.isNotBlank(wsfedRequest.getWreq())) {
                builder.addParameter(WSFederationConstants.WREQ, wsfedRequest.getWreq());
            }

            final URI url = builder.build();

            LOGGER.trace("Built service callback url [{}]", url);
            return org.jasig.cas.client.util.CommonUtils.constructServiceUrl(request, response,
                    url.toString(), casProperties.getServer().getName(),
                    CasProtocolConstants.PARAMETER_SERVICE,
                    CasProtocolConstants.PARAMETER_TICKET, false);
        } catch (final Exception e) {
            throw new SamlException(e.getMessage(), e);
        }
    }

    /**
     * Gets security token from request.
     *
     * @param request the request
     * @return the security token from request
     */
    protected SecurityToken getSecurityTokenFromRequest(final HttpServletRequest request) {
        final String cookieValue = this.ticketGrantingTicketCookieGenerator.retrieveCookieValue(request);
        if (StringUtils.isNotBlank(cookieValue)) {
            final TicketGrantingTicket tgt = this.ticketRegistry.getTicket(cookieValue, TicketGrantingTicket.class);
            if (tgt != null) {
                final String sts = tgt.getDescendantTickets().stream()
                        .filter(t -> t.startsWith(SecurityTokenTicket.PREFIX))
                        .findFirst()
                        .orElse(null);
                if (StringUtils.isNotBlank(sts)) {
                    final SecurityTokenTicket stt = ticketRegistry.getTicket(sts, SecurityTokenTicket.class);
                    if (stt == null || stt.isExpired()) {
                        LOGGER.warn("Security token ticket [{}] is not found or has expired", sts);
                        return null;
                    }
                    if (stt.getSecurityToken().isExpired()) {
                        LOGGER.warn("Security token linked to ticket [{}] has expired", sts);
                        return null;
                    }
                    return stt.getSecurityToken();
                }
            }
        }
        return null;
    }

    /**
     * Is authentication required?
     *
     * @param fedRequest the fed request
     * @param request    the request
     * @return the boolean
     */
    protected boolean shouldRenewAuthentication(final WSFederationRequest fedRequest,
                                                final HttpServletRequest request) {
        if (StringUtils.isBlank(fedRequest.getWfresh()) || NumberUtils.isCreatable(fedRequest.getWfresh())) {
            return false;
        }
        final long ttl = Long.parseLong(fedRequest.getWfresh().trim());
        if (ttl == 0) {
            return false;
        }

        final SecurityToken idpToken = getSecurityTokenFromRequest(request);
        if (idpToken == null) {
            return true;
        }

        final long ttlMs = ttl * 60L * 1000L;
        if (ttlMs > 0) {
            final Instant createdDate = idpToken.getCreated();
            if (createdDate != null) {
                final Date expiryDate = new Date();
                expiryDate.setTime(createdDate.toEpochMilli() + ttlMs);
                if (expiryDate.before(new Date())) {
                    return true;
                }
            }
        }
        return false;
    }

    /**
     * Gets ws federation registered service.
     *
     * @param response   the response
     * @param request    the request
     * @param fedRequest the fed request
     * @return the ws federation registered service
     */
    protected WSFederationRegisteredService findAndValidateFederationRequestForRegisteredService(final HttpServletResponse response,
                                                                                final HttpServletRequest request,
                                                                                final WSFederationRequest fedRequest) {
        final String serviceUrl = constructServiceUrl(request, response, fedRequest);
        final Service targetService = this.serviceSelectionStrategy.resolveServiceFrom(this.webApplicationServiceFactory.createService(serviceUrl));
        final WSFederationRegisteredService svc = getWsFederationRegisteredService(targetService);

        final WsFederationProperties.IdentityProvider idp = casProperties.getAuthn().getWsfedIdp().getIdp();
        if (StringUtils.isBlank(fedRequest.getWtrealm()) || !StringUtils.equals(fedRequest.getWtrealm(), svc.getRealm())) {
            LOGGER.warn("Realm [{}] is not authorized for matching service [{}]", fedRequest.getWtrealm(), svc);
            throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY);
        }
        if (!StringUtils.equals(idp.getRealm(), svc.getRealm())) {
            LOGGER.warn("Realm [{}] is not authorized for the identity provider realm [{}]", fedRequest.getWtrealm(), idp.getRealm());
            throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY);
        }

        return svc;
    }

    /**
     * Gets ws federation registered service.
     *
     * @param targetService the target service
     * @return the ws federation registered service
     */
    protected WSFederationRegisteredService getWsFederationRegisteredService(final Service targetService) {
        final WSFederationRegisteredService svc = this.servicesManager.findServiceBy(targetService, WSFederationRegisteredService.class);
        RegisteredServiceAccessStrategyUtils.ensureServiceAccessIsAllowed(targetService, svc);
        return svc;
    }

    /**
     * Handle unauthorized service exception.
     *
     * @param req the req
     * @param ex  the ex
     * @return the model and view
     */
    @ExceptionHandler(Exception.class)
    public ModelAndView handleUnauthorizedServiceException(final HttpServletRequest req, final Exception ex) {
        return WebUtils.produceUnauthorizedErrorView();
    }
}


text:
#pragma once

#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct world_mutex {
  pthread_mutex_t handle;
};

static inline void world_mutex_init(struct world_mutex *mtx)
{
  int err;

  pthread_mutexattr_t attr;

  if ((err = pthread_mutexattr_init(&attr))) {
    fprintf(stderr, "FATAL: pthread_mutexattr_init: %s\n", strerror(err));
    abort();
  }

  if ((err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK))) {
    fprintf(stderr, "FATAL: pthread_mutexattr_settype: %s\n", strerror(err));
    abort();
  }

  if ((err = pthread_mutex_init(&mtx->handle, &attr))) {
    fprintf(stderr, "FATAL: pthread_mutex_init: %s\n", strerror(err));
    abort();
  }

  if ((err = pthread_mutexattr_destroy(&attr))) {
    fprintf(stderr, "FATAL: pthread_mutexattr_destroy: %s\n", strerror(err));
    abort();
  }
}

static inline void world_mutex_destroy(struct world_mutex *mtx)
{
  int err;

  if ((err = pthread_mutex_destroy(&mtx->handle))) {
    fprintf(stderr, "FATAL: pthread_mutex_destroy: %s\n", strerror(err));
    abort();
  }
}

static inline void world_mutex_lock(struct world_mutex *mtx)
{
  int err;

  if ((err = pthread_mutex_lock(&mtx->handle))) {
    fprintf(stderr, "FATAL: pthread_mutex_lock: %s\n", strerror(err));
    abort();
  }
}

static inline void world_mutex_unlock(struct world_mutex *mtx)
{
  int err;

  if ((err = pthread_mutex_unlock(&mtx->handle))) {
    fprintf(stderr, "FATAL: pthread_mutex_unlock: %s\n", strerror(err));
    abort();
  }
}


text:
var _fs = require('fs');
var _fsx = require('fs-extra');
var _fw = require('filewalker');

_fw(process.cwd() + '/views')
    .on('file', function(file, detail) {
        var _temp = file.split('/');
        var file_name = _temp.pop();
        file_name = file_name.replace('.ejs','.html');
        _temp.push(file_name);
        var result = _temp.join('/');
        _fsx.copy(process.cwd()+'/views/'+file,process.cwd()+'/html/'+result,function(err){
            if(err) {console.log(err);return;}
            console.log(file);
            console.log(result);
        });
    })
    .on('done', function() {
        console.log('OK');
    })
    .walk();


text:
Checkout the experiment at [jzaefferer.github.io/spacevr/](http://jzaefferer.github.io/spacevr/). Should work in Chrome on Android, with a Google Cardboard-like setup. Use the trigger to accelerate in the direction you're looking.

## Local setup

    npm install && npm start
    open http://localhost:3000/

## License

This program is free software and is distributed under an [MIT License](LICENSE).

Sky map by NASA/Goddard Space Flight Center Scientific Visualization Studio. Constellation figures based on those developed for the IAU by Alan MacRobert of Sky and Telescope magazine (Roger Sinnott and Rick Fienberg). [(source)](https://svs.gsfc.nasa.gov/cgi-bin/details.cgi?aid=3895)


text:
package at.fhj.swd14.pse.community;

import at.fhj.swd14.pse.person.Status;
import at.fhj.swd14.pse.person.StatusConverter;
import at.fhj.swd14.pse.person.StatusDto;
import at.fhj.swd14.pse.user.User;
import at.fhj.swd14.pse.user.UserDto;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.sql.Date;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class CommunityConverterTest {

    Community community;
    CommunityDto communityDto;
    UserDto userDao;
    User user;
    boolean state;
    User user_author;
    UserDto userdto_author;
    Date date = new Date(0);
    String description = "Communitytest";
    String name = "Test Name";

    @Before
    public void setup() {
        this.userdto_author = this.createUserDto((long) 1, "author@test.cu", "password_author", "salt");
        this.user_author = this.createUser((long) 1, "author@test.cu", "password_author", "salt");

        this.createCommunity();
        this.createCommunityDto();
    }

	@Test
	public void testCommunityToCommunityDto(){
		CommunityDto c = CommunityConverter.convert(this.community);
		CommunityAssert.assertEquals(this.communityDto, c);
	}

	@Test
    public void testDtoListNull() {
        Collection<Community> values = CommunityConverter.convertToDoList(null);
        Assert.assertNull(values);
    }
	@Test
    public void testDoListNull() {
        Collection<CommunityDto> values = CommunityConverter.convertToDtoList(null);
        Assert.assertNull(values);
    }
    private void createCommunityDto() {
        this.communityDto = new CommunityDto((long) 1);
        this.communityDto.setActiveState(this.state);
        this.communityDto.setAllowedUsers(this.getUserDtoList());
        this.communityDto.setAuthor(this.userdto_author);
        this.communityDto.setCreateTime(this.date);
        this.communityDto.setDescription(this.description);
        this.communityDto.setName(this.name);
        this.communityDto.setPendingUsers(this.getUserDtoList());
        this.communityDto.setPublicState(this.state);

    }

    private void createCommunity() {
        this.community = new Community();
        this.community.setId((long) 1);
        this.community.setAllowedUsers(this.getUser());
        this.community.setAuthor(this.user_author);
        this.community.setName(this.name);
        this.community.setPublicState(this.state);

    }

    private List<User> getUserList() {

        List<User> user = new ArrayList<>();
        user.add(this.createUser((long) 1, "mail_1@test.cu", "password_1", "salt"));
        user.add(this.createUser((long) 2, "mail_2@test.cu", "password_2", "salt"));

        return user;
    }

    private List<User> getUser() {

        List<User> userDto = new ArrayList<>();
        userDto.add(this.createUse((long) 1, "mail_1@test.cu", "password_1", "salt"));
        userDto.add(this.createUse((long) 2, "mail_2@test.cu", "password_2", "salt"));

        return userDto;
    }

    private List<UserDto> getUserDtoList() {

        List<UserDto> userDto = new ArrayList<>();
        userDto.add(this.createUserDto((long) 1, "mail_1@test.cu", "password_1", "salt"));
        userDto.add(this.createUserDto((long) 2, "mail_2@test.cu", "password_2", "salt"));

        return userDto;
    }

    private User createUse(long id, String mail, String password, String salt) {
        User u = new User();
        u.setId(id);
        u.setMail(mail);
        u.setPassword(password);
        u.setSalt(salt);

        return u;
    }

    private UserDto createUserDto(long id, String mail, String password, String salt) {
        UserDto u = new UserDto();
        u.setId(id);
        u.setMail(mail);
        u.setPassword(password);
        u.setSalt(salt);
        return u;
    }

    private User createUser(long id, String mail, String password, String salt) {
        User u = new User(id);
        u.setMail(mail);
        u.setPassword(password);
        u.setSalt(salt);

        return u;
    }
}


text:
namespace System.Reflection
{

[Flags]
public enum CallingConventions
{
	Standard             = 0x00000001,
	VarArgs              = 0x00000002,
	Any                  = 0x00000003,
	HasThis              = 0x00000020,
	ExplicitThis         = 0x00000040,

}; // enum CallingConventions

}; // namespace System.Reflection


text:
typedef long unsigned int __darwin_size_t;
typedef __darwin_size_t size_t;

typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
typedef float __v4sf __attribute__ ((__vector_size__ (16)));
extern inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_mul_ps (__m128 __A, __m128 __B) {
    return (__m128) __builtin_ia32_mulps ((__v4sf)__A, (__v4sf)__B);
}
extern inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_set1_ps (float __F) {
    return __extension__ (__m128)(__v4sf){
	__F, __F, __F, __F };
}
extern inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_setr_ps (float __Z, float __Y, float __X, float __W) {
}
typedef float real;
template <typename T, int N> struct vectorX {
};
template<> struct vectorX<float, 3> {
    union {
	__m128 s;
	struct {
	};
    };
    vectorX(__m128 s) : s(s) {
    }

}
__attribute__((aligned));
template<> struct vectorX<float, 4> {
    typedef float T;
    typedef vectorX<float, 4> V;
    union {
	__m128 s;
	struct {
	    T r, g, b, a;
	};
    };
    vectorX(T a_, T b, T c, T d = 1) : s(_mm_setr_ps(a_,b,c,d)) {
    }
    vectorX(__m128 s) : s(s) {
    }
    vectorX(const V &t) : s(t.s) {
    }
    V &operator *=(const T t) {
	s = _mm_mul_ps(s, _mm_set1_ps(t));
	return *this;
    }
    inline V operator *(const T t) const __attribute__((always_inline)) {
	return V(*this) *= t;
    };
}
__attribute__((aligned));
typedef vectorX<real, 3> color3;
typedef vectorX<real, 4> color4;
typedef color3 color;
static inline color4 c3to4(color c) {
    color4 res(c.s);
    res.a=1;
    return res;
}
static inline color c4to3(color4 c) {
    return color(c.s);
}
static inline color4 to_premultiplied(color c, real a) {
    color4 res = c3to4(c);
    return res * a;
}
static inline color4 to_premultiplied(color4 cs) {
    return to_premultiplied(c4to3(cs), cs.a);
}
struct texture {
};
struct flat_texture : public texture {
    color4 c;
    flat_texture(const color4 &c) : c(to_premultiplied(c)) {
    }
};
struct checkerboard_texture : public texture {
    color4 even, odd;
    checkerboard_texture(const color4 &even, const color4 &odd) : even(to_premultiplied(even)), odd(to_premultiplied(odd)) {
    }
};
struct texture_placement {
    texture *tex;
};
struct surface {
    texture_placement textures[16];
    size_t texcount;
};
struct primitive {
    surface mat;
};
static void set_color(primitive *p, color4 c) {
    p->mat.textures[0].tex = new flat_texture(c);
}
static primitive **checkerboard_scene(int *pi) {
    primitive **prims = new primitive*[6];
    set_color(prims[0], color4(.7,.7,.7));
    prims[1]->mat.textures[prims[1]->mat.texcount++].tex = new checkerboard_texture(color4(1,.1,.1),color4(.1,.15,1));
    set_color(prims[2], color4(.7,.9,.7));
}
int main (int argc, char * const argv[]) {
    int primi;
    primitive **prims = checkerboard_scene(&primi);
}


text:
package ro.sci.gms.service;

import java.util.Arrays;

public class ValidationException extends Exception {
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private String[] causes;

	public ValidationException(String... causes) {
		super();
		this.causes = causes;
	}

	@Override
	public String getMessage() {

		return causes != null ? Arrays.toString(causes) : "Could not identify cause. No CAUSE!";
	}

}