text:
package com.cosylab.logging.stats;

import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Point;
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;

import com.cosylab.logging.LoggingClient;

/**
 * Shows statistics from loaded logs
 *
 * @author acaproni
 *
 */
public class StatsDlg extends JDialog implements ActionListener {

	/**
	 * The string shown when it is not possible to get a value
	 * from the system
	 */
	private static final String NotAvailable= "N/A";

	/**
	 * The interval (msec) between iterations while monitoring
	 */
	private static final int MONITORING_INTERVAL = 1000;

	private JLabel totNumOfLogsLbl = new JLabel(NotAvailable);
	private JLabel visibleLogsLbl  = new JLabel(NotAvailable);
	private JLabel hiddenLogsLbl = new JLabel(NotAvailable);
	private JLabel availMemLbl = new JLabel(NotAvailable);
	private JLabel usedMemLbl = new JLabel(NotAvailable);
	private JLabel timeFrameLbl = new JLabel(NotAvailable);
	private JLabel inRateLbl = new JLabel(NotAvailable);
	private JLabel outRateLbl = new JLabel(NotAvailable);

	/**
	 * The number of the cache files (it refers to the cache of jlog
	 * and not to the cache of the engine)
	 */
	private JLabel numOfCacheFiles  = new JLabel(NotAvailable);

	/**
	 * The disk space used by all the files of the cache
	 * (it refers to the cache of jlog and not to the cache of the engine)
	 */
	private JLabel diskSpace = new JLabel(NotAvailable);

	private JButton closeBtn = new JButton("Close");
	private JButton refreshBtn = new JButton("Refresh");

	private JButton monitorBtn = new JButton("Start monitoring");

	// A reference to the LoggingClient
	private LoggingClient logging;

	/**
	 * The timer for monitoring
	 */
	private Timer timer=null;

	/**
	 * Builds and show the dialog
	 *
	 * @param logCache
	 */
	public StatsDlg(LoggingClient mainWin) {
		super();
		if (mainWin==null) {
			throw new IllegalArgumentException("The LoggingClient can't be null");
		}
		logging =mainWin;
		setDefaultCloseOperation(HIDE_ON_CLOSE);

		initialize();
        pack();
	}

	/**
	 * Setup the GUI
	 */
	private void initialize() {
		this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		setTitle("Statistics");
		this.setBounds(50, 35, 100, 100);
		JPanel mainPnl = new JPanel(new BorderLayout());

		JPanel valuesPnl = new JPanel(new GridLayout(10,1));

		// Add the num of logs
		JPanel numOfLogsPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
		numOfLogsPnl.add(new JLabel("Total logs: "));
		numOfLogsPnl.add(totNumOfLogsLbl);
		valuesPnl.add(numOfLogsPnl);

		// Visible logs
		JPanel visibleLogsPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
		visibleLogsPnl.add(new JLabel("Visible logs: "));
		visibleLogsPnl.add(visibleLogsLbl);
		valuesPnl.add(visibleLogsPnl);

		// Hidden logs
		JPanel hiddenLogsPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
		hiddenLogsPnl.add(new JLabel("Hidden logs: "));
		hiddenLogsPnl.add(hiddenLogsLbl);
		valuesPnl.add(hiddenLogsPnl);

		// Add the available memory
		JPanel availMemPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
		availMemPnl.add(new JLabel("Memory available: "));
		availMemPnl.add(availMemLbl);
		valuesPnl.add(availMemPnl);

		// Add the used memory
		JPanel usedMemPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
		usedMemPnl.add(new JLabel("Used memory: "));
		usedMemPnl.add(usedMemLbl);
		valuesPnl.add(usedMemPnl);

		// Add the number of the files of cache
		JPanel usedCacheFiles = new JPanel(new FlowLayout(FlowLayout.LEFT));
		usedCacheFiles.add(new JLabel("Number of files of cache: "));
		usedCacheFiles.add(numOfCacheFiles);
		valuesPnl.add(usedCacheFiles);

		// Add the disk space used by the files of the cache
		JPanel usedDiskSpace = new JPanel(new FlowLayout(FlowLayout.LEFT));
		usedDiskSpace.add(new JLabel("Disk space used by the cache: "));
		usedDiskSpace.add(diskSpace);
		valuesPnl.add(usedDiskSpace);

		// Add the time frame
		JPanel timeFramePnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
		timeFramePnl.add(new JLabel("Time frame: "));
		timeFramePnl.add(timeFrameLbl);
		valuesPnl.add(timeFramePnl);

		// Add the rate from the NC
		JPanel inRatePnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
		inRatePnl.add(new JLabel("Rate of logs from NC: "));
		inRatePnl.add(inRateLbl);
		valuesPnl.add(inRatePnl);

		// Add the rate to the listeners
		JPanel outRatePnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
		outRatePnl.add(new JLabel("Rate of logs sent to table: "));
		outRatePnl.add(outRateLbl);
		valuesPnl.add(outRatePnl);

		mainPnl.add(valuesPnl,BorderLayout.CENTER);

		// Add the refresh and the close buttons
		JPanel buttonPanel = new JPanel(new FlowLayout());
		monitorBtn.addActionListener(this);
		buttonPanel.add(monitorBtn);
		refreshBtn.addActionListener(this);
		buttonPanel.add(refreshBtn);
		closeBtn.addActionListener(this);
		buttonPanel.add(closeBtn);
		mainPnl.add(buttonPanel,BorderLayout.SOUTH);

		setContentPane(mainPnl);

		addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent we) {
				enableMonitoring(false);
			}
		});
	}
	/**
	 * Override setVisible() to move the statistic window
	 * over the logging client and in front of other windows
	 */
	@Override
	public void setVisible(boolean visible) {
		super.setVisible(visible);
		// Move the statistic win on top of jlog
		if (visible && isShowing()) {
			Point loggingPos = logging.getLocationOnScreen();
			setLocation(loggingPos);
			toFront();
			refreshGUI();
		}
		if (!visible) {
			enableMonitoring(false);
		}
	}

	/**
	 * Refresh the values shown in the GUI
	 *
	 */
	private void refreshGUI() {
		/**
		 * A class to refresh the labels of the dialog
		 * The thread is executed inside the swing thread
		 *
		 * @author acaproni
		 *
		 */
		class GuiRefresher implements Runnable {
			long totLogs;
			long visLogs;
			long hidLogs;
			long availMem;
			long totMem;
			String diskSize;
			int totCacheFiles;
			String timeFrameStr;
			String inputRateStr;
			String outputRateStr;
			public void run() {
				totNumOfLogsLbl.setText(Long.valueOf(totLogs).toString());
				visibleLogsLbl.setText(Long.valueOf(visLogs).toString());
				hiddenLogsLbl.setText(Long.valueOf(hidLogs).toString());
				availMemLbl.setText(""+(availMem/1024)+"Kb");
		        usedMemLbl.setText(""+((totMem-availMem)/1024)+"Kb");
		        diskSpace.setText(diskSize);
		        numOfCacheFiles.setText(""+totCacheFiles);
		        timeFrameLbl.setText(timeFrameStr);
		        inRateLbl.setText(inputRateStr);
		        outRateLbl.setText(outputRateStr);
		        pack();
			}
		}

		GuiRefresher refresher = new GuiRefresher();
		refresher.totLogs = logging.getLogEntryTable().getLCModel().totalLogNumber();
		refresher.visLogs = logging.getLogEntryTable().getViewRowCount();
		refresher.hidLogs = refresher.totLogs-refresher.visLogs;
		try {
			refresher.diskSize= ""+logging.getLogEntryTable().getLCModel().usedDiskSpace();
		} catch (Throwable t) {
			System.err.println("Error getting the used disk space: "+t.getMessage());
			t.printStackTrace(System.err);
			refresher.diskSize=NotAvailable;
		}
		refresher.totCacheFiles=logging.getLogEntryTable().getLCModel().numberOfUsedFiles();

		Runtime rt = Runtime.getRuntime();
		refresher.availMem = rt.freeMemory();
		refresher.totMem = rt.totalMemory();
		Calendar timeFrame = logging.getLogEntryTable().getLCModel().getTimeFrame();
        StringBuilder str = new StringBuilder();
        str.append(timeFrame.get(Calendar.DAY_OF_YEAR)-1);
        str.append("days - ");
        str.append(timeFrame.get(Calendar.HOUR_OF_DAY));
        str.append(":");
        str.append(timeFrame.get(Calendar.MINUTE));
        str.append(":");
        str.append(timeFrame.get(Calendar.SECOND));
        str.append(".");
        str.append(timeFrame.get(Calendar.MILLISECOND));
        refresher.timeFrameStr=str.toString();

        StringBuilder in = new StringBuilder();
        in.append(logging.getEngine().getActualInputRate());
        in.append(" (");
        if (logging.getEngine().getMaxInputRate()==Integer.MAX_VALUE) {
        	in.append("unlimited)");
        } else {
        	in.append("limted to ");
        	in.append(logging.getEngine().getMaxInputRate());
        	in.append(')');
        }
        refresher.inputRateStr=in.toString();

        StringBuilder out = new StringBuilder();
        out.append(logging.getEngine().getActualOutputRate());
        out.append(" (");
        if (logging.getEngine().getMaxOutputRate()==Integer.MAX_VALUE) {
        	out.append("unlimited)");
        } else {
        	out.append("limted to ");
        	out.append(logging.getEngine().getMaxOutputRate());
        	out.append(')');
        }
        refresher.outputRateStr=out.toString();

        // Start the swing thread
        SwingUtilities.invokeLater(refresher);
	}

	/**
	 * @see ActionListener<?code>
	 */
	public void actionPerformed(ActionEvent e) {
		if (e.getSource()==closeBtn) {
			setVisible(false);
		} if (e.getSource()==refreshBtn) {
			Thread t = new Thread("Stats dialog updater") {
				public void run() {
					refreshGUI();
				}
			};
			t.setDaemon(true);
			t.start();
		} if (e.getSource()==monitorBtn) {
				enableMonitoring(refreshBtn.isEnabled());
		}
	}

	/**
	 * Start or stop the monitoring
	 *
	 * @param start If true start monitoring
	 */
	private void enableMonitoring(boolean start) {
		if (start) {
			if (timer!=null) {
				throw new IllegalStateException("Timer is already instantiated");
			}
			timer = new Timer("Statistics monitoring");
			TimerTask task = new TimerTask() {
				public void run() {
					refreshGUI();
				}
			};
			timer.schedule(task, 50, MONITORING_INTERVAL);
			refreshBtn.setEnabled(false);
			monitorBtn.setText("Stop monitoring");
		} else {
			if (timer!=null) {
				timer.cancel();
			}
			timer=null;
			refreshBtn.setEnabled(true);
			monitorBtn.setText("Start monitoring");
		}
	}

}


text:
export default function(){
	this.transition(
    	this.hasClass('sidebar-right'),
    	this.toValue(true),
    	this.use('toLeft',{duration:750}),
    	this.reverse('toRight',{duration:750})
  	);
  	this.transition(
    	this.hasClass('sidebar-right-mobile'),
    	this.toValue(false),
    	this.use('toLeft',{duration:750}),
    	this.reverse('toRight',{duration:750})
  	);
}

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) Jon Thysell <http://jonthysell.com>
// Licensed under the MIT License.

using System;
using System.IO;

using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;

using Chordious.Core.ViewModel.Resources;

namespace Chordious.Core.ViewModel
{
    public class ConfigImportViewModel : ConfigViewModelBase
    {
        public override string Title
        {
            get
            {
                return Strings.ConfigImportTitle;
            }
        }

        public override RelayCommand Accept
        {
            get
            {
                return _accept ??= new RelayCommand(() =>
                {
                    try
                    {
                        IsIdle = false;
                        StrongReferenceMessenger.Default.Send(new ConfirmationMessage(Strings.ConfigImportOverwritePromptMessage, (confirmed) =>
                        {
                            try
                            {
                                if (confirmed)
                                {
                                    TryImport();
                                    OnRequestClose();
                                }
                            }
                            catch (Exception ex)
                            {
                                ExceptionUtils.HandleException(ex);
                            }
                            finally
                            {
                                IsIdle = true;
                            }
                        }));
                    }
                    catch (Exception ex)
                    {
                        ExceptionUtils.HandleException(ex);
                    }
                });
            }
        }
        private RelayCommand _accept;

        private readonly Stream _inputStream;

        public ConfigImportViewModel(Stream inputStream) : base()
        {
            _inputStream = inputStream ?? throw new ArgumentNullException(nameof(inputStream));
        }

        private void TryImport()
        {
            try
            {
                ConfigParts configParts = GetConfigParts();

                ConfigFile importedConfigFile = new ConfigFile("Imported");
                using (_inputStream)
                {
                    importedConfigFile.LoadFile(_inputStream, configParts);
                }
                AppVM.UserConfig.ImportConfig(importedConfigFile, configParts);
            }
            catch (Exception ex)
            {
                ExceptionUtils.HandleException(ex);
            }
        }
    }
}


text:
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Drawing

Imports ESRI.ArcGIS.Mobile
Imports ESRI.ArcGIS.Mobile.FeatureCaching
Imports ESRI.ArcGIS.Mobile.Geometries
Imports ESRI.ArcGIS.Mobile.WinForms

'Custom class for our own graphic layer. This class exposes
'several properties a user might be interested in changing or using
'when creating own graphic layer

Namespace CustomGraphicsLayer
    Structure gpsLoc
        Public _coordinate As Esri.ArcGIS.Mobile.Geometries.Coordinate
        Public _user As String
        Public _date As String
        Public _wo As String

    End Structure

    Class CustomGraphicLayer
        Inherits MapGraphicLayer

        Public Enum DrawType
            Points
            Line
            Area
        End Enum

        'define a symbol instances for point, line, and area
        Private _pointSymbol As Symbol
        Private _lineSymbol As Symbol
        Private _areaSymbol As Symbol

        'attributes of how to draw graphics layer
        Private _transparency As Short
        Private _color As Color
        Private _paintStyle As SimpleMarkerStyle
        Private _lineSize As Short
        Private _pointSize As Short
        Private _drawType As DrawType

        'define custom graphics coordinate collection
        Private _coordinateCollection As New CoordinateCollection()
        Private _locationsList As List(Of gpsLoc)
        'default constructor, sets default style
        Public Sub New()
            Me.New(50, Color.Green, SimpleMarkerStyle.Square, 3, 20, DrawType.Points)
        End Sub

        'constructor with style parameters
        Public Sub New(transparency As Short, c As Color, ps As SimpleMarkerStyle, lineSize As Short, pointSize As Short, drawType As DrawType)
            MyBase.New("CustomGraphicLayer")

            _transparency = transparency
            _color = c
            _paintStyle = ps
            _lineSize = lineSize
            _pointSize = pointSize
            _drawType = drawType
            _locationsList = New List(Of gpsLoc)
            setSymbolAttributes()
        End Sub
        Public Function count() As Integer
            Return _locationsList.Count

        End Function
        Public Sub addGPSLoc(coord As Coordinate, userName As String, dateTimeInfo As String, wo As String)
            If _coordinateCollection.Count > 10 Then
                _coordinateCollection.RemoveAt(0)
            End If
            _coordinateCollection.Add(coord)

            Dim gps As gpsLoc = New gpsLoc
            gps._coordinate = coord
            gps._date = dateTimeInfo
            gps._user = userName
            gps._wo = wo
            _locationsList.Add(gps)

        End Sub
        Public Function getGPSData() As List(Of gpsLoc)
            Return _locationsList
        End Function
        Public Sub clearGPS()
            _locationsList.Clear()
            _coordinateCollection.Clear()

        End Sub
        'This method is called implicitly by the display with which it is contained,
        'This will more than likely be a map control
        Protected Overrides Sub Draw(display As MapSurface)
            'If the display is null or if drawing has been canceled, cancel the drawing
            'of the layer
            If Me.Visible = False Then Return

            If display Is Nothing Then
                Return
            End If

            If display.DrawingCanceled Then
                Return
            End If

            'based on what feature class user wanted to draw, call appropriate function
            'with the layers collection of coordinates
            Select Case _drawType
                Case DrawType.Points
                    _pointSymbol.DrawMultipoint(display, _coordinateCollection)
                    Exit Select
                Case DrawType.Line
                    _lineSymbol.DrawLine(display, _coordinateCollection)
                    Exit Select
                Case DrawType.Area
                    _areaSymbol.DrawArea(display, _coordinateCollection)
                    Exit Select
            End Select

        End Sub

        'Since MapLayer implements the IDisposable interface, we should
        'override the method here to deallocate any resources we don't anymore
        'when the graphic layer is removed
        Protected Overrides Sub Dispose(disposing As Boolean)
            Try
                If disposing Then
                    If _pointSymbol IsNot Nothing Then
                        _pointSymbol.Dispose()
                    End If

                    If _lineSymbol IsNot Nothing Then
                        _lineSymbol.Dispose()
                    End If

                    If _areaSymbol IsNot Nothing Then
                        _areaSymbol.Dispose()
                    End If

                    _pointSymbol = Nothing
                    _lineSymbol = Nothing
                    _areaSymbol = Nothing
                    _coordinateCollection = Nothing
                End If
            Finally
                MyBase.Dispose(disposing)
            End Try
        End Sub

        'define get/set functionality for coordinates
        Public Property Coordinates() As CoordinateCollection
            Get
                Return _coordinateCollection
            End Get
            Set(value As CoordinateCollection)
                _coordinateCollection = value
            End Set
        End Property

        Public Property Transparency() As Short
            Get
                Return _transparency
            End Get
            Set(value As Short)
                _transparency = value
                setSymbolAttributes()
            End Set
        End Property

        Public Property ColorLayer() As Color
            Get
                Return _color
            End Get
            Set(value As Color)
                _color = value
                setSymbolAttributes()
            End Set
        End Property

        Public Property PaintStyle() As SimpleMarkerStyle
            Get
                Return _paintStyle
            End Get
            Set(value As SimpleMarkerStyle)
                _paintStyle = value
                setSymbolAttributes()
            End Set
        End Property

        Public Property LineSize() As Short
            Get
                Return _lineSize
            End Get
            Set(value As Short)
                _lineSize = value
                setSymbolAttributes()
            End Set
        End Property

        Public Property PointSize() As Short
            Get
                Return _pointSize
            End Get
            Set(value As Short)
                _pointSize = value
                setSymbolAttributes()
            End Set
        End Property

        'Creates a new Symbol object with the attributes defined by the set properties
        Private Sub setSymbolAttributes()
            If _pointSymbol IsNot Nothing Then
                _pointSymbol = Nothing
            End If

            If _lineSymbol IsNot Nothing Then
                _lineSymbol = Nothing
            End If

            '          SimpleMarkerSymbol vertex = new SimpleMarkerSymbol(Color.Cyan, 1, Color.Cyan, 6, SimpleMarkerStyle.Circle);
            'Painting each kind of geometry requires a different type of PaintOperation. Here
            'we illustrate this by instantiating three different types of symbols, each of
            'which are rendered differently by a focused paint operation
            _pointSymbol = New SimpleMarkerSymbol(ColorLayer, LineSize, ColorLayer, PointSize, PaintStyle)

            '         new VertexPaintOperation(ColorLayer, LineSize, Transparency,
            '                                 ColorLayer, Transparency, PointSize, PaintStyle));

            _lineSymbol = New LineSymbol(ColorLayer, LineSize)

            'Symbol(
            '       new StrokePaintOperation(ColorLayer, LineSize, Transparency));

            _areaSymbol = New FillSymbol(ColorLayer)

            'Symbol(
            '       new FillPaintOperation(ColorLayer, Transparency));

        End Sub

    End Class
End Namespace


text:
[![version](https://img.shields.io/npm/v/simple-pouch.svg) ![download](https://img.shields.io/npm/dm/simple-pouch.svg)](https://www.npmjs.com/package/simple-pouch)

[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)

A simple, lightweight queue using Redis rpush and lrange, ltrim.

## Usage

```javascript
var pouch = require('../lib/pouch').create({
  host: '127.0.0.1',
  port: 6379,
  name: 'test',
  size: 50
})

// put items
pouch.put(['1', '2', '3', '4', '5'])
pouch.put(function (err, len) {
  console.log(len)
}, ['6', '7', '8', '9', '10'])

pouch.count(function (err, count) {
  console.log('count: ' + count)
})

setTimeout(function () {
  pouch.list(function (err, items) {
    console.log('list', items)
  }, 0, 100)

  pouch.pick(function (err, items) {
    console.log(items)

    pouch.count(function (err, count) {
      console.log('count: ' + count)
    })
  }, 8)
}, 500)

```

## Release History

See the [changelog](CHANGELOG.md)

## LICENSE

simple-pouch is licensed under the MIT license.


text:
module Funktional
  module RandomCharacters
    def random_characters
      chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'
      str = ''
      self.times { str << chars[rand(chars.size)] }

      return str
    end
  end
end


text:
#region License(Apache Version 2.0)

#endregion
#region ChangeLog
/******************************************
 * 2017-10-7 OutMan Create
 *
 * ***************************************/
#endregion
using System.Collections.Generic;
using MSRegex = System.Text.RegularExpressions;

namespace WitsWay.Utilities.Regexs
{
    /// <summary>
    /// 正则匹配类信息
    /// <remarks>
    /// 用于存储使用了ParseClassAttribute的类的信息
    /// </remarks>
    /// </summary>
    public class RegexClassInfo
    {

        #region [Property]

        /// <summary>
        /// 协议解析特性
        /// </summary>
        public ParseClassAttribute CustomClassInfo { get; set; }

        private IDictionary<string, ParsePropertyAttribute> _parsePropertyMap;
        /// <summary>
        /// 要解析的所有属性字典
        /// key:属性的名称
        /// value:属性的自定义特性ParsePropertyAttribute
        /// </summary>
        public IDictionary<string, ParsePropertyAttribute> PropertyMap =>
            _parsePropertyMap ?? (_parsePropertyMap = new Dictionary<string, ParsePropertyAttribute>());

        /// <summary>
        /// 给System.Text.RegularExpressions.Regex取别名
        /// </summary>
        public MSRegex.Regex RegexInfo { get; private set; }

        /// <summary>
        /// 正则匹配字符串
        /// </summary>
        public string RegexPattern { get; set; }

        #endregion

        #region [Public Method]
        /// <summary>
        /// 判断是否时协议解析类
        /// [是否有特性头][需要解析的属性大于零]
        /// </summary>
        /// <returns></returns>
        public bool Available()
        {
            if (CustomClassInfo == null || PropertyMap == null) return false;
            return PropertyMap.Count > 0;
        }

        /// <summary>
        /// 创建MS正则Regex类
        /// </summary>
        /// <param name="pattern">正则匹配字符串</param>
        public void CreateRegex(string pattern)
        {
            var option =
                MSRegex.RegexOptions.IgnoreCase |
                MSRegex.RegexOptions.Multiline |
                MSRegex.RegexOptions.IgnorePatternWhitespace |
                MSRegex.RegexOptions.Compiled;
            RegexInfo = new MSRegex.Regex(pattern, option);
            RegexPattern = pattern;
        }
        #endregion

        #region [Internal Method]

        /// <summary>
        /// 设置匹配值
        /// </summary>
        /// <param name="processStr">要处理的字符串</param>
        /// <param name="setObject">要设置值的对象</param>
        /// <param name="deleteMatchString">是否删除匹配的字符</param>
        /// <returns></returns>
        internal bool SetPropertyValue(ref string processStr, object setObject, bool deleteMatchString)
        {
            var match = Match(processStr);
            if (!match.Success) return false;
            for (var i = 0; i < match.Groups.Count; i++)
            {
                var name = RegexInfo.GroupNameFromNumber(i);
                if (SetValue(setObject, name, match.Groups[i]) == false)
                {
                    return false;
                }
            }
            if (deleteMatchString)
            {
                processStr = processStr.Remove(match.Index, match.Length);
            }
            return true;
        }

        /// <summary>
        /// 匹配
        /// </summary>
        /// <param name="processStr">要匹配的字符串</param>
        /// <returns></returns>
        internal MSRegex.Match Match(string processStr)
        {
            return RegexInfo.Match(processStr);
        }
        /// <summary>
        /// 匹配并设置值
        /// </summary>
        /// <param name="matchObject">要匹配的对象</param>
        /// <param name="name">属性名称</param>
        /// <param name="group"></param>
        /// <returns></returns>
        internal bool SetValue(object matchObject, string name, MSRegex.Group group)
        {
            ParsePropertyAttribute propertyAttribute;
            if (PropertyMap.TryGetValue(name, out propertyAttribute) != true) return true;
            return propertyAttribute.SetPropertyValue(matchObject, @group);
        }
        #endregion
    }
}


text:
package aeryk.atweaks.library;

public class LibBlocks {
    public static final String STEEL_BLOCK = "blockSteel";
}


text:
import expect from 'expect';
import React from 'react';
import createHistory from 'history/lib/createMemoryHistory';
import IndexRoute from '../IndexRoute';
import Router from '../Router';
import Route from '../Route';

describe('isActive', function () {

  var node;
  beforeEach(function () {
    node = document.createElement('div');
  });

  afterEach(function () {
    React.unmountComponentAtNode(node);
  });

  describe('a pathname that matches the URL', function () {
    describe('with no query', function () {
      it('is active', function (done) {
        React.render((
          <Router history={createHistory('/home')}>
            <Route path="/home" />
          </Router>
        ), node, function () {
          expect(this.history.isActive('/home')).toBe(true);
          done();
        });
      });
    });

    describe('with a query that also matches', function () {
      it('is active', function (done) {
        React.render((
          <Router history={createHistory('/home?the=query')}>
            <Route path="/home" />
          </Router>
        ), node, function () {
          expect(this.history.isActive('/home', { the: 'query' })).toBe(true);
          done();
        });
      });
    });

    describe('with a query that does not match', function () {
      it('is not active', function (done) {
        React.render((
          <Router history={createHistory('/home?the=query')}>
            <Route path="/home" />
          </Router>
        ), node, function () {
          expect(this.history.isActive('/home', { something: 'else' })).toBe(false);
          done();
        });
      });
    });
  });

  describe('a pathname that matches a parent route, but not the URL directly', function () {
    describe('with no query', function () {
      it('is active', function (done) {
        React.render((
          <Router history={createHistory('/absolute')}>
            <Route path="/home">
              <Route path="/absolute" />
            </Route>
          </Router>
        ), node, function () {
          expect(this.history.isActive('/home')).toBe(true);
          expect(this.history.isActive('/home', null, true)).toBe(false);
          done();
        });
      });
    });

    describe('with a query that also matches', function () {
      it('is active', function (done) {
        React.render((
          <Router history={createHistory('/absolute?the=query')}>
            <Route path="/home">
              <Route path="/absolute" />
            </Route>
          </Router>
        ), node, function () {
          expect(this.history.isActive('/home', { the: 'query' })).toBe(true);
          expect(this.history.isActive('/home', { the: 'query' }, true)).toBe(false);
          done();
        });
      });
    });

    describe('with a query that does not match', function () {
      it('is active', function (done) {
        React.render((
          <Router history={createHistory('/absolute?the=query')}>
            <Route path="/home">
              <Route path="/absolute" />
            </Route>
          </Router>
        ), node, function () {
          expect(this.history.isActive('/home', { something: 'else' })).toBe(false);
          expect(this.history.isActive('/home', { something: 'else' }, true)).toBe(false);
          done();
        });
      });
    });
  });

  describe('a pathname that matches an index URL', function () {
    describe('with no query', function () {
      it('is active', function (done) {
        React.render((
          <Router history={createHistory('/home')}>
            <Route path="/home">
              <IndexRoute />
            </Route>
          </Router>
        ), node, function () {
          expect(this.history.isActive('/home', null)).toBe(true);
          expect(this.history.isActive('/home', null, true)).toBe(true);
          done();
        });
      });
    });

    describe('with a query that also matches', function () {
      it('is active', function (done) {
        React.render((
          <Router history={createHistory('/home?the=query')}>
            <Route path="/home">
              <IndexRoute />
            </Route>
          </Router>
        ), node, function () {
          expect(this.history.isActive('/home', { the: 'query' })).toBe(true);
          expect(this.history.isActive('/home', { the: 'query' }, true)).toBe(true);
          done();
        });
      });
    });

    describe('with a query that does not match', function () {
      it('is not active', function (done) {
        React.render((
          <Router history={createHistory('/home?the=query')}>
            <Route path="/home">
              <IndexRoute />
            </Route>
          </Router>
        ), node, function () {
          expect(this.history.isActive('/home', { something: 'else' })).toBe(false);
          expect(this.history.isActive('/home', { something: 'else' }, true)).toBe(false);
          done();
        });
      });
    });
  });

  describe('a pathname that matches only the beginning of the URL', function () {
    it('is not active', function (done) {
      React.render((
        <Router history={createHistory('/home')}>
          <Route path="/home" />
        </Router>
      ), node, function () {
        expect(this.history.isActive('/h')).toBe(false);
        done();
      });
    });
  });

});


text:
Kustomize 提供了修改 ConfigMapGenerator 和 SecretGenerator 行为的选项,这些选项包括:

 - 不再将基于内容生成的哈希后缀添加到资源名称后
 - 为生成的资源添加 labels
 - 为生成的资源添加 annotations

这个示例将展示如何运用这些选项,首先创建一个工作空间:
```bash
DEMO_HOME=$(mktemp -d)
```

创建 kustomization 并且为其添加一个 ConfigMapGenerator

<!-- @createCMGenerator @test -->
```bash
cat > $DEMO_HOME/kustomization.yaml << EOF
configMapGenerator:
- name: my-configmap
  literals:
  - foo=bar
  - baz=qux
EOF
```

添加如下 generatorOptions
<!-- @addGeneratorOptions @test -->
```bash
cat >> $DEMO_HOME/kustomization.yaml << EOF
generatorOptions:
 disableNameSuffixHash: true
 labels:
   kustomize.generated.resource: somevalue
 annotations:
   annotations.only.for.generated: othervalue
EOF
```
运行 `kustomize build` 并且确定生成的 ConfigMap 。

 - 确定没有名称后缀
    <!-- @verify @test -->
    ```
    test 1 == \
    $(kustomize build $DEMO_HOME | grep "name: my-configmap$" | wc -l); \
    echo $?
    ```
 - 确定 label `kustomize.generated.resource: somevalue`
     ```
     test 1 == \
     $(kustomize build $DEMO_HOME | grep -A 1 "labels" | grep "kustomize.generated.resource" | wc -l); \
     echo $?
     ```
 - 确定 annotation `annotations.only.for.generated: othervalue`
      ```
      test 1 == \
      $(kustomize build $DEMO_HOME | grep -A 1 "annotations" | grep "annotations.only.for.generated" | wc -l); \
      echo $?
      ```


text:
ofxFBXMeshMaterial::ofxFBXMeshMaterial() {
    texture = NULL;
    _name   = "default material";
    enableTextures();
    enableMaterials();
    enable();
}

//--------------------------------------------------------------
void ofxFBXMeshMaterial::setup( const FbxSurfaceMaterial * pMaterial ) {
    ofFloatColor tEmissive = getMaterialProperty( pMaterial, FbxSurfaceMaterial::sEmissive, FbxSurfaceMaterial::sEmissiveFactor );
    ofFloatColor tAmbient = getMaterialProperty( pMaterial, FbxSurfaceMaterial::sAmbient, FbxSurfaceMaterial::sAmbientFactor );
    ofFloatColor tDiffuse = getMaterialProperty( pMaterial, FbxSurfaceMaterial::sDiffuse, FbxSurfaceMaterial::sDiffuseFactor );
    ofFloatColor tSpecular = getMaterialProperty( pMaterial, FbxSurfaceMaterial::sSpecular, FbxSurfaceMaterial::sSpecularFactor );
    float shininess = 0;
    FbxProperty lShininessProperty = pMaterial->FindProperty(FbxSurfaceMaterial::sShininess);
    if (lShininessProperty.IsValid()) {
        double lShininess = lShininessProperty.Get<FbxFloat>();
        shininess = lShininess;
    }

    setEmissiveColor( tEmissive );
    setAmbientColor( tAmbient );
    setDiffuseColor( tDiffuse );
    setSpecularColor( tSpecular );
    setShininess( shininess );

    _name = pMaterial->GetName();

//    cout << "-- " << pMaterial->GetName() << " -- setup -------------------------" << endl;
//    cout << "emissive = " << tEmissive << endl;
//    cout << "ambient = " << tAmbient << endl;
//    cout << "diffuse = " << tDiffuse << endl;
//    cout << "specular = " << tSpecular << endl;
//    cout << "shininess = " << shininess << endl;

    const int lTextureCount = pMaterial->GetSrcObjectCount<FbxFileTexture>();
//    cout << pMaterial->GetName() << " texture count = " << lTextureCount << endl;

    // pMaterial->GetClassId().Is(KFbxSurfacePhong::ClassId)

    // search for a texture based on the material properties :)
    if(!hasTexture()) {
        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sEmissive );
    }
    if(!hasTexture()) {
        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sAmbient );
    }
    if(!hasTexture()) {
        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sDiffuse );
    }
    if(!hasTexture()) {
        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sSpecular );
    }
    if(!hasTexture()) {
        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sNormalMap );
    }
    if(!hasTexture()) {
        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sBump );
    }
    if(!hasTexture()) {
        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sDisplacementColor );
    }
    if(!hasTexture()) {
        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sMultiLayer );
    }
    if(!hasTexture()) {
        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sReflection );
    }
    if(!hasTexture()) {
        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sShadingModel );
    }
    if(!hasTexture()) {
        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sShininess );
    }
    if(!hasTexture()) {
        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sTransparentColor );
    }
    if(!hasTexture()) {
        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sVectorDisplacementColor );
    }
    if(!hasTexture()) {
//        findTextureForProperty( pMaterial, FbxSurfaceMaterial::sMultiLayer );
    }

//    cout << "Do we have a texture for this material? " << hasTexture() << endl;

    if( hasTexture() ) enableTextures();
}

//--------------------------------------------------------------
void ofxFBXMeshMaterial::begin() {
    if( !isEnabled() ) return;
    if( areMaterialsEnabled() ) ofMaterial::begin();
    if( hasTexture() && areTexturesEnabled() ) {
        glEnable( GL_TEXTURE_2D );
        glBindTexture(GL_TEXTURE_2D, texture->getTextureData().textureID);
    }
}

//--------------------------------------------------------------
void ofxFBXMeshMaterial::end() {
    if( !isEnabled() ) return;
    if( areMaterialsEnabled() ) ofMaterial::end();
    if( hasTexture() && areTexturesEnabled() ) {
        glBindTexture( GL_TEXTURE_2D, 0);
        glDisable( GL_TEXTURE_2D );
    }
}

//--------------------------------------------------------------
bool ofxFBXMeshMaterial::hasTexture() {
    return texture != NULL;
}

//--------------------------------------------------------------
ofTexture* ofxFBXMeshMaterial::getTexturePtr() {
    return texture;
}

//--------------------------------------------------------------
void ofxFBXMeshMaterial::enableTextures() {
    _bTexturesEnabled = true;
}

//--------------------------------------------------------------
void ofxFBXMeshMaterial::disableTextures() {
    _bTexturesEnabled = false;
}

//--------------------------------------------------------------
bool ofxFBXMeshMaterial::areTexturesEnabled() {
    return _bTexturesEnabled;
}

//--------------------------------------------------------------
void ofxFBXMeshMaterial::enableMaterials() {
    _bMaterialsEnabled = true;
}

//--------------------------------------------------------------
void ofxFBXMeshMaterial::disableMaterials() {
    _bMaterialsEnabled = false;
}

//--------------------------------------------------------------
bool ofxFBXMeshMaterial::areMaterialsEnabled() {
    return _bMaterialsEnabled;
}

//--------------------------------------------------------------
void ofxFBXMeshMaterial::enable() {
    _bEnabled = true;
}

//--------------------------------------------------------------
void ofxFBXMeshMaterial::disable() {
    _bEnabled = false;
}

//--------------------------------------------------------------
bool ofxFBXMeshMaterial::isEnabled() {
    return _bEnabled;
}

//--------------------------------------------------------------
string ofxFBXMeshMaterial::getName() {
    return _name;
}

//--------------------------------------------------------------
string ofxFBXMeshMaterial::getInfoAsString() {
    stringstream ss;
    ss << "-- " << getName() << " Material ----------------------" << endl;
    ss << "emissive = " << getEmissiveColor() << endl;
    ss << "ambient = " << getAmbientColor() << endl;
    ss << "diffuse = " << getDiffuseColor() << endl;
    ss << "specular = " << getSpecularColor() << endl;
    ss << "shininess = " << getShininess() << endl;

    return ss.str();
}

//--------------------------------------------------------------
ofFloatColor ofxFBXMeshMaterial::getMaterialProperty(const FbxSurfaceMaterial * pMaterial,
                                 const char * pPropertyName,
                                 const char * pFactorPropertyName ) {
    FbxDouble3 lResult(0, 0, 0);
    const FbxProperty lProperty = pMaterial->FindProperty(pPropertyName);
    const FbxProperty lFactorProperty = pMaterial->FindProperty(pFactorPropertyName);
    if (lProperty.IsValid() && lFactorProperty.IsValid()) {
        lResult = lProperty.Get<FbxDouble3>();
        double lFactor = lFactorProperty.Get<FbxDouble>();
        if (lFactor != 1) {
            lResult[0] *= lFactor;
            lResult[1] *= lFactor;
            lResult[2] *= lFactor;
        }
    }
    ofFloatColor tcolor;
    tcolor.set( lResult[0], lResult[1], lResult[2] );
    return tcolor;
}

//--------------------------------------------------------------
bool ofxFBXMeshMaterial::findTextureForProperty(const FbxSurfaceMaterial * pMaterial,
                                                const char * pPropertyName ) {

    const FbxProperty lProperty = pMaterial->FindProperty(pPropertyName);

    if (lProperty.IsValid()) {
        const int lTextureCount     = lProperty.GetSrcObjectCount<FbxFileTexture>();
        const int lLTextureCount    = lProperty.GetSrcObjectCount<FbxLayeredTexture>();
//        cout << pPropertyName << " is a valid property with texture count of " << lTextureCount << " layered texture = " << lLTextureCount << endl;
        if (lTextureCount) {
            const FbxFileTexture* lTexture = lProperty.GetSrcObject<FbxFileTexture>();
            if (lTexture && lTexture->GetUserDataPtr()) {
                texture = static_cast<ofTexture *>( lTexture->GetUserDataPtr() );
                return true;
            }
        }

        if (lLTextureCount) {
            const FbxLayeredTexture* lLTexture = lProperty.GetSrcObject<FbxLayeredTexture>();
            if( lLTexture ) {
                const FbxFileTexture* lTexture = lLTexture->GetSrcObject<FbxFileTexture>();
//                cout << "-------> Layered " << pPropertyName << " layered texture = " << lLTextureCount << endl;
                if (lTexture && lTexture->GetUserDataPtr()) {
                    texture = static_cast<ofTexture *>( lTexture->GetUserDataPtr() );
                    return true;
                }
            }
        }

    } else {
//        cout << pPropertyName << " is NOT a valid property " << endl;
    }

    return false;
}


text:
namespace views {
class Widget;

// A simple WidgetObserver that can be probed for the life of a widget.
class VIEWS_EXPORT WidgetDeletionObserver : public WidgetObserver {
 public:
  explicit WidgetDeletionObserver(Widget* widget);
  virtual ~WidgetDeletionObserver();

  // Returns true if the widget passed in the constructor is still alive.
  bool IsWidgetAlive() { return widget_ != NULL; }

  // Overridden from WidgetObserver.
  virtual void OnWidgetDestroying(Widget* widget) OVERRIDE;

 private:
  void CleanupWidget();

  Widget* widget_;

  DISALLOW_COPY_AND_ASSIGN(WidgetDeletionObserver);
};

}  // namespace views

#endif  // UI_VIEWS_WIDGET_WIDGET_DELETION_OBSERVER_H_


text:
package org.apache.expreval.expr.calculation;

import org.apache.expreval.client.NullColumnValueException;
import org.apache.expreval.client.ResultMissingColumnException;
import org.apache.expreval.expr.ExpressionType;
import org.apache.expreval.expr.Operator;
import org.apache.expreval.expr.node.DateValue;
import org.apache.expreval.expr.node.GenericValue;
import org.apache.hadoop.hbase.hbql.client.HBqlException;
import org.apache.hadoop.hbase.hbql.impl.HConnectionImpl;

public class DateCalculation extends GenericCalculation implements DateValue {

    public DateCalculation(final GenericValue arg0, final Operator operator, final GenericValue arg1) {
        super(ExpressionType.DATECALCULATION, arg0, operator, arg1);
    }

    public Long getValue(final HConnectionImpl conn, final Object object) throws HBqlException,
                                                                                ResultMissingColumnException,
                                                                                NullColumnValueException {

        final long val0 = (Long)this.getExprArg(0).getValue(conn, object);
        final long val1 = (Long)this.getExprArg(1).getValue(conn, object);

        switch (this.getOperator()) {
            case PLUS:
                return val0 + val1;
            case MINUS:
                return val0 - val1;
        }

        throw new HBqlException("Invalid operator:" + this.getOperator());
    }
}


text:
package scm

import (
	"bytes"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"testing"

	exec "github.com/codeship/go-exec"
)

const (
	testBananaCommitID        = "d1f47a7c9c618dd338cf1ef9ba83639005b02127"
	testSmartystreetsCommitID = "a40e854c17df0b1a98c90c250dc20e6cb2474dfa"
	testHgGitChangesetID      = "4538981d2c3f3fcb594ad7f2ae7622380929e226"
	testGitHead               = "ref: refs/heads/master"
	testRomanNumeralsCommitID = "831870f24f4e2930ec71948ce2097c80777eb3d1"
	testCrawlerCommitID       = "c773cc80ea5e17735b5eec2c05144830eea3e1c9"
)

func TestGitWithoutCommitID(t *testing.T) {
	t.Parallel()
	tempDir := getTempDir(t)
	if err := Checkout(
		&GitCheckoutOptions{
			User:     "git",
			Host:     "github.com",
			Path:     "/codeship/documentation.git",
			Branch:   "master",
			CommitID: "",
		},
		tempDir,
	); err != nil {
		t.Fatal(err)
	}
	testCheckoutContainsReadme(t, tempDir)
}

func testCheckoutContainsReadme(t *testing.T, tempDir string) {
	if _, err := os.Stat(filepath.Join(tempDir, "README.md")); err != nil {
		t.Error(err)
	}
	file, err := os.Open(filepath.Join(tempDir, ".git/HEAD"))
	if err != nil {
		t.Fatal(err)
	}
	defer func() {
		if err := file.Close(); err != nil {
			t.Error(err)
		}
	}()
	data, err := ioutil.ReadAll(file)
	if err != nil {
		t.Fatal(err)
	}
	commitID := strings.TrimSpace(string(data))
	if testGitHead != commitID {
		t.Errorf("expected %s, got %s", testGitHead, commitID)
	}
}

func TestGit(t *testing.T) {
	t.Parallel()
	tempDir := getTempDir(t)
	if err := Checkout(
		&GitCheckoutOptions{
			User:     "git",
			Host:     "github.com",
			Path:     "/peter-edge/smartystreets_ruby.git",
			Branch:   "master",
			CommitID: testSmartystreetsCommitID,
		},
		tempDir,
	); err != nil {
		t.Fatal(err)
	}
	testSmartystreetsCheckoutTarball(t, tempDir)
}

func TestGithub(t *testing.T) {
	t.Parallel()
	tempDir := getTempDir(t)
	if err := Checkout(
		&GithubCheckoutOptions{
			User:       "peter-edge",
			Host:       "github.com",
			Repository: "smartystreets_ruby",
			Branch:     "master",
			CommitID:   testSmartystreetsCommitID,
			//SecurityOptions: NewGithubSecurityOptionsSSH(getSSHOptions()),
		},
		tempDir,
	); err != nil {
		t.Fatal(err)
	}
	testSmartystreetsCheckoutTarball(t, tempDir)
}

func TestGithubWithoutCommitID(t *testing.T) {
	t.Parallel()
	tempDir := getTempDir(t)
	if err := Checkout(
		&GithubCheckoutOptions{
			User:       "codeship",
			Host:       "github.com",
			Repository: "documentation",
			Branch:     "master",
			CommitID:   "",
		},
		tempDir,
	); err != nil {
		t.Fatal(err)
	}
	testCheckoutContainsReadme(t, tempDir)
}

func testCrawlerCheckoutTarball(t *testing.T, tempDir string) {
	if _, err := os.Stat(filepath.Join(tempDir, "crawler.go")); err != nil {
		t.Error(err)
	}
	file, err := os.Open(filepath.Join(tempDir, ".git/HEAD"))
	if err != nil {
		t.Fatal(err)
	}
	defer func() {
		if err := file.Close(); err != nil {
			t.Error(err)
		}
	}()
	data, err := ioutil.ReadAll(file)
	if err != nil {
		t.Fatal(err)
	}
	commitID := strings.TrimSpace(string(data))
	if testCrawlerCommitID != commitID {
		t.Errorf("expected %s, got %s", testCrawlerCommitID, commitID)
	}
}

func testSmartystreetsCheckoutTarball(t *testing.T, tempDir string) {
	if _, err := os.Stat(filepath.Join(tempDir, "smartystreets.gemspec")); err != nil {
		t.Error(err)
	}
	file, err := os.Open(filepath.Join(tempDir, ".git/HEAD"))
	if err != nil {
		t.Fatal(err)
	}
	defer func() {
		if err := file.Close(); err != nil {
			t.Error(err)
		}
	}()
	data, err := ioutil.ReadAll(file)
	if err != nil {
		t.Fatal(err)
	}
	commitID := strings.TrimSpace(string(data))
	if testSmartystreetsCommitID != commitID {
		t.Errorf("expected %s, got %s", testSmartystreetsCommitID, commitID)
	}
}

func TestHg(t *testing.T) {
	t.Parallel()
	tempDir := getTempDir(t)
	if err := Checkout(
		&HgCheckoutOptions{
			User:        "hg",
			Host:        "bitbucket.org",
			Path:        "/durin42/hg-git",
			ChangesetID: testHgGitChangesetID,
			//SecurityOptions: NewHgSecurityOptionsSSH(getSSHOptions()),
		},
		tempDir,
	); err != nil {
		t.Fatal(err)
	}
	testHgGitCheckoutTarball(t, tempDir)
}

func testHgMasterCheckoutTarball(t *testing.T, tempDir string) {
	if _, err := os.Stat(filepath.Join(tempDir, "README.md")); err != nil {
		t.Error(err)
	}
	executor, err := exec.NewOsExecutor(tempDir)
	if err != nil {
		t.Fatal(err)
	}
	var buffer bytes.Buffer
	if err := executor.Execute(
		&exec.Cmd{
			Args:   []string{"hg", "parent"},
			Stdout: &buffer,
		},
	)(); err != nil {
		t.Fatal(err)
	}
	output := buffer.String()
	if !strings.Contains(output, "master") {
		t.Errorf("expected %v, got %v", "master", output)
	}
}

func TestBitbucketGit(t *testing.T) {
	t.Parallel()
	tempDir := getTempDir(t)
	if err := Checkout(
		&BitbucketGitCheckoutOptions{
			User:       "krames2425",
			Host:       "bitbucket.org",
			Repository: "crawler",
			Branch:     "master",
			CommitID:   testCrawlerCommitID,
			//SecurityOptions: NewGithubSecurityOptionsSSH(getSSHOptions()),
		},
		tempDir,
	); err != nil {
		t.Fatal(err)
	}

	testCrawlerCheckoutTarball(t, tempDir)
}

func TestBitbucketGitWithoutCommitID(t *testing.T) {
	t.Parallel()
	tempDir := getTempDir(t)
	if err := Checkout(
		&BitbucketGitCheckoutOptions{
			User:       "cod",
			Host:       "bitbucket.codeship.com",
			Repository: "public-project",
			Branch:     "master",
			CommitID:   "",
		},
		tempDir,
	); err != nil {
		t.Fatal(err)
	}
	testCheckoutContainsReadme(t, tempDir)
}

func TestBitbucketHg(t *testing.T) {
	t.Parallel()
	tempDir := getTempDir(t)
	if err := Checkout(
		&BitbucketHgCheckoutOptions{
			User:        "durin42",
			Host:        "bitbucket.org",
			Repository:  "hg-git",
			ChangesetID: testHgGitChangesetID,
			//SecurityOptions: NewHgSecurityOptionsSSH(getSSHOptions()),
		},
		tempDir,
	); err != nil {
		t.Fatal(err)
	}
	testHgGitCheckoutTarball(t, tempDir)
}

func TestBitbucketHgWithoutCommitID(t *testing.T) {
	t.Parallel()
	tempDir := getTempDir(t)
	if err := Checkout(
		&BitbucketHgCheckoutOptions{
			User:        "durin42",
			Host:        "bitbucket.org",
			Repository:  "hg-git",
			ChangesetID: "",
		},
		tempDir,
	); err != nil {
		t.Fatal(err)
	}
	testHgMasterCheckoutTarball(t, tempDir)
}

func testHgGitCheckoutTarball(t *testing.T, tempDir string) {
	if _, err := os.Stat(filepath.Join(tempDir, "hggit/overlay.py")); err != nil {
		t.Error(err)
	}
	executor, err := exec.NewOsExecutor(tempDir)
	if err != nil {
		t.Fatal(err)
	}
	var buffer bytes.Buffer
	if err := executor.Execute(
		&exec.Cmd{
			Args:   []string{"hg", "parent"},
			Stdout: &buffer,
		},
	)(); err != nil {
		t.Fatal(err)
	}
	output := buffer.String()
	if !strings.Contains(output, testHgGitChangesetID[0:12]) {
		t.Errorf("expected %v, got %v", testHgGitChangesetID, output)
	}
}

func TestHgWithoutCommitID(t *testing.T) {
	t.Parallel()
	tempDir := getTempDir(t)
	if err := Checkout(
		&HgCheckoutOptions{
			User:        "hg",
			Host:        "bitbucket.org",
			Path:        "/durin42/hg-git",
			ChangesetID: "",
			//SecurityOptions: NewHgSecurityOptionsSSH(getSSHOptions()),
		},
		tempDir,
	); err != nil {
		t.Fatal(err)
	}
	testHgMasterCheckoutTarball(t, tempDir)
}

func TestGitlab(t *testing.T) {
	t.Parallel()
	tempDir := getTempDir(t)
	if err := Checkout(
		&GitlabCheckoutOptions{
			User:       "codeship",
			Host:       "gitlab.com",
			Repository: "banana",
			Branch:     "master",
			CommitID:   testBananaCommitID,
		},
		tempDir,
	); err != nil {
		t.Fatal(err)
	}
	testBananaCheckoutTarball(t, tempDir)
}

func TestGitlabWithoutCommitID(t *testing.T) {
	t.Parallel()
	tempDir := getTempDir(t)
	if err := Checkout(
		&GitlabCheckoutOptions{
			User:       "codeship",
			Host:       "gitlab.com",
			Repository: "banana",
			Branch:     "master",
			CommitID:   "",
		},
		tempDir,
	); err != nil {
		t.Fatal(err)
	}
	testBananaMasterCheckoutTarball(t, tempDir)
}

func testBananaCheckoutTarball(t *testing.T, tempDir string) {
	if _, err := os.Stat(filepath.Join(tempDir, "README.md")); err != nil {
		t.Error(err)
	}
	file, err := os.Open(filepath.Join(tempDir, ".git/HEAD"))
	if err != nil {
		t.Fatal(err)
	}
	defer func() {
		if err := file.Close(); err != nil {
			t.Error(err)
		}
	}()
	data, err := ioutil.ReadAll(file)
	if err != nil {
		t.Fatal(err)
	}
	commitID := strings.TrimSpace(string(data))
	if testBananaCommitID != commitID {
		t.Errorf("expected %s, got %s", testBananaCommitID, commitID)
	}
}

func testBananaMasterCheckoutTarball(t *testing.T, tempDir string) {
	if _, err := os.Stat(filepath.Join(tempDir, "README.md")); err != nil {
		t.Error(err)
	}
	file, err := os.Open(filepath.Join(tempDir, ".git/HEAD"))
	if err != nil {
		t.Fatal(err)
	}
	defer func() {
		if err := file.Close(); err != nil {
			t.Error(err)
		}
	}()
	data, err := ioutil.ReadAll(file)
	if err != nil {
		t.Fatal(err)
	}
	commitID := strings.TrimSpace(string(data))
	if testGitHead != commitID {
		t.Errorf("expected %s, got %s", testGitHead, commitID)
	}
}

func getSSHOptions(t *testing.T) *SSHSecurityOptions {
	privateKeyReader, err := os.Open(os.Getenv("HOME") + "/.ssh/id_rsa")
	if err != nil {
		t.Fatal(err)
	}
	defer func() {
		if err := privateKeyReader.Close(); err != nil {
			t.Fatal(err)
		}
	}()
	data, err := ioutil.ReadAll(privateKeyReader)
	if err != nil {
		t.Fatal(err)
	}
	var buffer bytes.Buffer
	if _, err := buffer.Write(data); err != nil {
		t.Fatal(err)
	}
	return &SSHSecurityOptions{
		StrictHostKeyChecking: false,
		PrivateKey:            &buffer,
	}
}

func getTempDir(t *testing.T) string {
	tempDir, err := ioutil.TempDir("", "go-scm-test")
	if err != nil {
		t.Error(err)
	}
	return tempDir
}


text:
local utils = require "utils"

ngx.header["Cache-Control"] = "no-cache"
local args = ngx.req.get_query_args()
args = utils:normalizeKeys(args)
args["action"] = ngx.var.action

for i = 1, #request_metadata_parameters_plugins do
  _plugin = require (request_metadata_parameters_plugins[i])
  _plugin:AddtoArgsFromNginx(args)
end

local cjson = require "cjson"
local args_json = cjson.encode(args)
local red = utils:initRedis()

ok, err = red:evalsha(ngx.var.redis_counter_hash, 1, "args", args_json)
if not ok then utils:logErrorAndExit("Error evaluating redis script: ".. err) end

ok, err = red:set_keepalive(10000, 1000)
if not ok then utils:logErrorAndExit("Error setting redis keep alive ".. err) end
utils:emptyGif()


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>ba-dal</artifactId>
        <groupId>name.marmac.bankanalizer</groupId>
        <version>1.0.0.BUILD-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>ba-dal-impl-jpa-nosql</artifactId>
    <packaging>jar</packaging>

    <name>BA :: BANK ANALYZER HE :: DAL :: IMPL JPA NOSQL</name>
    <description>DATA ACCESS LAYER IMPLEMENTATION module with Eclipse Link JPA NOSQL</description>
    <url>${project.distributionManagement.site.url}/bankanalyzer-he/ba-dal/ba-dal-impl-jpa-nosql</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <finalName>${project.artifactId}-${project.version}</finalName>

        <filters>
            <filter>profiles/${build.profile.id}/config.properties</filter>
        </filters>

        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                  <include>**/*</include>
                </includes>
            </resource>
            <resource>
                <directory>${project.basedir}/src/main/scripts</directory>
                <filtering>true</filtering>
                <includes>
                  <include>**/*</include>
                </includes>
            </resource>
        </resources>

        <testResources>
            <testResource>
                <directory>${project.basedir}/src/test/resources</directory>
                <filtering>true</filtering>
                <includes>
                  <include>**/*</include>
                </includes>
            </testResource>
            <testResource>
                <directory>${project.basedir}/src/integration-test/resources</directory>
                <filtering>true</filtering>
                <includes>
                  <include>**/*</include>
                </includes>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <showDeprecation>true</showDeprecation>
                    <showWarnings>true</showWarnings>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>${build-helper-maven-plugin.version}</version>
                <executions>
                    <!-- States that the plugin's add-test-source goal is executed at generate-test-sources phase. -->
                    <execution>
                        <id>add-integration-test-sources</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <!-- Configures the source directory of integration tests. -->
                            <sources>
                                <source>src/integration-test/java</source>
                            </sources>

                        </configuration>
                    </execution>
                    <execution>
                        <id>add-integration-test-resources</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>add-test-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>src/integration-test/resources</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <!-- Skips unit tests if the value of skip.unit.tests property is true -->
                    <skipTests>${skip.unit.tests}</skipTests>
                    <!-- Excludes integration tests when unit tests are run. ß-->
                    <excludes>
                        <exclude>**/IT*.java</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${maven-failsafe-plugin.version}</version>
                <executions>
                    <!-- States that both integration-test and verify goals of the Failsafe Maven plugin are executed. -->
                    <execution>
                        <id>integration-tests</id>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <!-- Skips integration tests if the value of skip.integration.tests property is true -->
                            <skipTests>${skip.integration.tests}</skipTests>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>

    </build>

    <dependencies>
        <!-- INTERNAL dependencies - START -->
        <dependency>
            <groupId>name.marmac.bankanalizer</groupId>
            <artifactId>ba-dal-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <!-- INTERNAL dependencies - END -->

        <!-- EXTERNAL dependencies - START -->
        <!-- Springframework Dependencies  - START -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- Springframework Dependencies  - END -->

        <!-- EclipseLink Dependencies  - START -->
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>javax.persistence</artifactId>
            <version>${javax-persistence.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>${eclipselink.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.jpa</artifactId>
            <version>${eclipselink.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.nosql</artifactId>
            <version>${eclipselink.version}</version>
        </dependency>
        <!-- EclipseLink Dependencies  - END -->

        <!-- MongoDB Driver - START -->
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongo-java-driver</artifactId>
            <version>2.14.1</version>
            <!--
            <version>3.2.2</version>

            -->
        </dependency>
        <!-- MongoDB Driver - END -->

        <dependency>
            <groupId>com.lordofthejars</groupId>
            <artifactId>nosqlunit-mongodb</artifactId>
            <version>0.8.1</version>
        </dependency>

    </dependencies>

</project>


text:
using System;
using System.Runtime.InteropServices;

// ReSharper disable once CheckNamespace
namespace DlibDotNet
{

    internal sealed partial class NativeMethods
    {

        #region decision_function

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern void decision_function_delete(SvmKernelType kernelType,
                                                           MatrixElementType type,
                                                           int templateRows,
                                                           int templateColumns,
                                                           IntPtr function);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType serialize_decision_function(SvmKernelType kernelType,
                                                                   MatrixElementType type,
                                                                   int templateRows,
                                                                   int templateColumns,
                                                                   IntPtr function,
                                                                   byte[] fileName,
                                                                   int fileNameLength,
                                                                   out IntPtr errorMessage);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType deserialize_decision_function(byte[] fileName,
                                                                     int fileNameLength,
                                                                     SvmKernelType kernelType,
                                                                     MatrixElementType matrixElementType,
                                                                     int templateRows,
                                                                     int templateColumns,
                                                                     out IntPtr function,
                                                                     out IntPtr errorMessage);

        #region double

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType decision_function_operator_double(SvmKernelType kernelType,
                                                                         MatrixElementType type,
                                                                         int templateRows,
                                                                         int templateColumns,
                                                                         IntPtr function,
                                                                         IntPtr sample,
                                                                         out double ret);

        #endregion

        #region float

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType decision_function_operator_float(SvmKernelType kernelType,
                                                                        MatrixElementType type,
                                                                        int templateRows,
                                                                        int templateColumns,
                                                                        IntPtr function,
                                                                        IntPtr sample,
                                                                        out float ret);

        #endregion

        #endregion

        #region probabilistic_decision_function

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern void probabilistic_decision_function_delete(SvmKernelType kernelType,
                                                                         MatrixElementType type,
                                                                         int templateRows,
                                                                         int templateColumns,
                                                                         IntPtr function);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType serialize_probabilistic_decision_function(SvmKernelType kernelType,
                                                                                MatrixElementType type,
                                                                                int templateRows,
                                                                                int templateColumns,
                                                                                IntPtr function,
                                                                                byte[] fileName,
                                                                                int fileNameLength,
                                                                                out IntPtr errorMessage);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType deserialize_probabilistic_decision_function(byte[] fileName,
                                                                                int fileNameLength,
                                                                                SvmKernelType kernelType,
                                                                                MatrixElementType matrixElementType,
                                                                                int templateRows,
                                                                                int templateColumns,
                                                                                out IntPtr function,
                                                                                out IntPtr errorMessage);

        #endregion

        #region projection_function

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern void projection_function_delete(SvmKernelType kernelType,
                                                             MatrixElementType type,
                                                             int templateRows,
                                                             int templateColumns,
                                                             IntPtr function);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType serialize_projection_function(SvmKernelType kernelType,
                                                                     MatrixElementType type,
                                                                     int templateRows,
                                                                     int templateColumns,
                                                                     IntPtr function,
                                                                     byte[] fileName,
                                                                     int fileNameLength,
                                                                     out IntPtr errorMessage);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType deserialize_projection_function(byte[] fileName,
                                                                       int fileNameLength,
                                                                       SvmKernelType kernelType,
                                                                       MatrixElementType matrixElementType,
                                                                       int templateRows,
                                                                       int templateColumns,
                                                                       out IntPtr function,
                                                                       out IntPtr errorMessage);

        #endregion

        #region normalized_function

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern IntPtr normalized_function_new(SvmKernelType kernelType,
                                                            MatrixElementType type,
                                                            int templateRows,
                                                            int templateColumns,
                                                            SvmFunctionType functionType);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern void normalized_function_delete(SvmKernelType kernelType,
                                                             MatrixElementType type,
                                                             int templateRows,
                                                             int templateColumns,
                                                             SvmFunctionType functionType,
                                                             IntPtr function);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType normalized_function_get_normalizer(SvmKernelType kernelType,
                                                                          MatrixElementType type,
                                                                          int templateRows,
                                                                          int templateColumns,
                                                                          SvmFunctionType function_type,
                                                                          IntPtr function,
                                                                          out IntPtr ret);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType normalized_function_set_normalizer(SvmKernelType kernelType,
                                                                          MatrixElementType type,
                                                                          int templateRows,
                                                                          int templateColumns,
                                                                          SvmFunctionType function_type,
                                                                          IntPtr function,
                                                                          NormalizerType normalizer_type,
                                                                          IntPtr normalizer);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType normalized_function_get_function(SvmKernelType kernelType,
                                                                        MatrixElementType type,
                                                                        int templateRows,
                                                                        int templateColumns,
                                                                        SvmFunctionType function_type,
                                                                        IntPtr function,
                                                                        out IntPtr ret);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType normalized_function_set_function(SvmKernelType kernelType,
                                                                        MatrixElementType type,
                                                                        int templateRows,
                                                                        int templateColumns,
                                                                        SvmFunctionType function_type,
                                                                        IntPtr function,
                                                                        IntPtr sub_function);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType normalized_function_deserialize(SvmKernelType kernel_type,
                                                                       MatrixElementType type,
                                                                       int templateRows,
                                                                       int templateColumns,
                                                                       SvmFunctionType function_type,
                                                                       byte[] file_name,
                                                                       int file_name_length,
                                                                       out IntPtr ret,
                                                                       out IntPtr error_message);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType normalized_function_serialize(SvmKernelType kernel_type,
                                                                     MatrixElementType type,
                                                                     int templateRows,
                                                                     int templateColumns,
                                                                     SvmFunctionType function_type,
                                                                     IntPtr function,
                                                                     byte[] file_name,
                                                                     int file_name_length,
                                                                     out IntPtr error_message);

        #region operator

        // [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        // public static extern ErrorType normalized_function_operator_int8_t(SvmKernelType kernel_type,
        //                                                                    MatrixElementType type,
        //                                                                    int templateRows,
        //                                                                    int templateColumns,
        //                                                                    SvmFunctionType function_type,
        //                                                                    IntPtr function,
        //                                                                    IntPtr sample,
        //                                                                    out sbyte ret);

        // [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        // public static extern ErrorType normalized_function_operator_uint8_t(SvmKernelType kernel_type,
        //                                                                     MatrixElementType type,
        //                                                                     int templateRows,
        //                                                                     int templateColumns,
        //                                                                     SvmFunctionType function_type,
        //                                                                     IntPtr function,
        //                                                                     IntPtr sample,
        //                                                                     out byte ret);

        // [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        // public static extern ErrorType normalized_function_operator_int16_t(SvmKernelType kernel_type,
        //                                                                     MatrixElementType type,
        //                                                                     int templateRows,
        //                                                                     int templateColumns,
        //                                                                     SvmFunctionType function_type,
        //                                                                     IntPtr function,
        //                                                                     IntPtr sample,
        //                                                                     out short ret);

        // [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        // public static extern ErrorType normalized_function_operator_uint16_t(SvmKernelType kernel_type,
        //                                                                      MatrixElementType type,
        //                                                                      int templateRows,
        //                                                                      int templateColumns,
        //                                                                      SvmFunctionType function_type,
        //                                                                      IntPtr function,
        //                                                                      IntPtr sample,
        //                                                                      out ushort ret);

        // [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        // public static extern ErrorType normalized_function_operator_int32_t(SvmKernelType kernel_type,
        //                                                                     MatrixElementType type,
        //                                                                     int templateRows,
        //                                                                     int templateColumns,
        //                                                                     SvmFunctionType function_type,
        //                                                                     IntPtr function,
        //                                                                     IntPtr sample,
        //                                                                     out int ret);

        // [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        // public static extern ErrorType normalized_function_operator_uint32_t(SvmKernelType kernel_type,
        //                                                                      MatrixElementType type,
        //                                                                      int templateRows,
        //                                                                      int templateColumns,
        //                                                                      SvmFunctionType function_type,
        //                                                                      IntPtr function,
        //                                                                      IntPtr sample,
        //                                                                      out uint ret);

        // [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        // public static extern ErrorType normalized_function_operator_int64_t(SvmKernelType kernel_type,
        //                                                                     MatrixElementType type,
        //                                                                     int templateRows,
        //                                                                     int templateColumns,
        //                                                                     SvmFunctionType function_type,
        //                                                                     IntPtr function,
        //                                                                     IntPtr sample,
        //                                                                     out long ret);

        // [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        // public static extern ErrorType normalized_function_operator_uint64_t(SvmKernelType kernel_type,
        //                                                                      MatrixElementType type,
        //                                                                      int templateRows,
        //                                                                      int templateColumns,
        //                                                                      SvmFunctionType function_type,
        //                                                                      IntPtr function,
        //                                                                      IntPtr sample,
        //                                                                      out ulong ret);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType normalized_function_operator_double(SvmKernelType kernel_type,
                                                                           MatrixElementType type,
                                                                           int templateRows,
                                                                           int templateColumns,
                                                                           SvmFunctionType function_type,
                                                                           IntPtr function,
                                                                           IntPtr sample,
                                                                           out double ret);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType normalized_function_operator_float(SvmKernelType kernel_type,
                                                                          MatrixElementType type,
                                                                          int templateRows,
                                                                          int templateColumns,
                                                                          SvmFunctionType function_type,
                                                                          IntPtr function,
                                                                          IntPtr sample,
                                                                          out float ret);

        #endregion

        #endregion

    }

}


text:
module.exports = concat;

function concat(files, destination) {
  var fs = require('fs');
  var buffers = [];
  for (var i in files) {
    var buffer = fs.readFileSync(files[i]);
    if (i == (files.length - 1)) {
      buffers.push(buffer);
    } else {
      buffers.push(Buffer.concat([buffer, new Buffer('\n')]));
    }
  }
  fs.writeFileSync(destination, Buffer.concat(buffers));
}


text:
package log

import (
	"os"

	"github.com/op/go-logging"
)

// FileLogger outputs logs to a given file.
type FileLogger struct {
	logger
}

var _ Logger = (*FileLogger)(nil)

func NewFileLogger(module, logFilePath, logLevel, format string) (*FileLogger, error) {
	baseLogger := newLogger(module)

	levelInt, err := logging.LogLevel(logLevel)
	if err != nil {
		return nil, err
	}
	logFile, err := os.OpenFile(logFilePath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
	if err != nil {
		return nil, err
	}
	backend, err := baseLogger.setupFormattedBackend(logFile, format)
	if err != nil {
		return nil, err
	}

	leveledBackend := logging.SetBackend(backend)
	leveledBackend.SetLevel(levelInt, module)
	logger := &FileLogger{baseLogger}
	logger.SetBackend(leveledBackend)

	return logger, nil
}


text:
using System;
using System.Collections.Generic;
using Hub.Domain.Base;
using Hub.Domain.FileAntModule.Aggregate;

namespace Hub.Domain.WeightModule.Aggregate
{
    public class WeightAggregate : FileFitData, IAggregate, IFileFitData
    {
        public DateTime Date { get; set; }

        public float? Weight { get; set; }

        public float? WaterPercentage { get; set; }

        public float? FatPercentage { get; set; }

        public float? MuscleMass { get; set ; }

        public float? BodyMassIndex { get; set; }

        public float? BoneMass { get; set; }
        public float? VisceralFatLevel { get; set; }
        public int? EnergyExpenditure { get; set; }
        public byte? MetabolicAge { get; set; }

        public List<Composition> BodyParts { get; set; }

        public override string GetTypeName()
        {
            return "Weight";
        }
    }
}


text:
<?php

namespace Sise\Bundle\CoreBundle\Form\nomenclature;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class NomenclatureAnneenaissanceType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('codeannenais','text',array('label' => 'Code','translation_domain' => 'SiseCoreBundle'))
            ->add('libeannenaisar','text',array('label' => 'Libear','translation_domain' => 'SiseCoreBundle'))
            ->add('libeannenaisfr','text',array('label' => 'Libefr','translation_domain' => 'SiseCoreBundle'))
            ->add('annenais','integer',array('label' => 'annenais','translation_domain' => 'SiseCoreBundle'))
            ->add('ordraffi','integer',array('label' => 'ordraffi','translation_domain' => 'SiseCoreBundle'))
            ->add('acti','checkbox',array('label' => 'acti','translation_domain' => 'SiseCoreBundle'))
            ->add('codeannescol', 'entity', array(
                'class' => 'Sise\Bundle\CoreBundle\Entity\ParametreAnneescolaire',
                'property' => 'libeannescolar',
                'label' => 'codeannescol',
                'translation_domain' => 'SiseCoreBundle',
                'expanded' => false,
                'multiple' => false,
                'required' => true,
            ))
            ->add('codecyclense', 'entity', array(
                'class' => 'Sise\Bundle\CoreBundle\Entity\NomenclatureCycleenseignement',
                'property' => 'libecyclensear',
                'label' => 'Codecycl',
                'translation_domain' => 'SiseCoreBundle',
                'expanded' => false,
                'multiple' => false,
                'required' => true,
            ))
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Sise\Bundle\CoreBundle\Entity\NomenclatureAnneenaissance'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'nomenclature_sise';
    }
}


text:
// UI ATTRIBUTE DATA . JAVA

package cat.calidos.morfeu.webapp.ui;

import com.codeborne.selenide.SelenideElement;

/**
* @author daniel giribet
*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public class UIAttributeData extends UIWidget<UIAttributeData> {

private UICellData parent;

public UIAttributeData(SelenideElement element, UICellData parent) {

	super(element);

	this.parent = parent;
}

/** @return the normalised name, without any UI embellishments or clarifications */
public String name() {

	String name = name_();
	name = name.endsWith(":") ? name.substring(0, name.length()-1) : name;	// the UI has a colon after the name
	name = name.endsWith("*") ? name.substring(0, name.length()-1) : name;	// if the attribute is mandatory

	return name;

}

/** @return is this an optional attribute? */
public boolean isOptional() {
	return !isMandatory();
}

/** @return is this a mandatory attribute? */
public boolean isMandatory() {
	return name_().endsWith("*:");	// non-present attributes cannot be mandatory, just saying
}

/** @return true if this is an editable attribute */
public boolean isEditable() {
	return class_().contains("attribute-data-editor");
}

/** @return true if it's present (as opposed to not there) */
public boolean isPresent() {
	return !isNotPresent();
}

/** @return true it it's not there and can be created */
public boolean isNotPresent() {
	return class_().contains("attribute-not-present");

}

private String name_() {

	return element.$(".attribute-data-name").text();
}

public String value() {
	return isEditable()? element.$(".attribute-data-value").getValue() : element.$(".attribute-data-value").text();
}

public boolean hasValue() {
	return element.$(".attribute-data-value").exists();	// this is brittle?
}

public UIAttributeData enterTextDirect(String value) {

	if (!isEditable()) {
		throw new UnsupportedOperationException("Cannot set the value of a non-editable field");
	}

	int attributeIndex = Integer.parseInt(element.attr("_index"));
	for (int i=0; i<attributeIndex; i++) {	// it seems that we have the cursor on the first data field for some reason
		pressKey("\t");
	}

	// this only works if called in order, selenide is not happy about the setValue so we're hacking it
	pressKey(value);

	//element.$(".attribute-data-value").setValue(value);
	//element.setValue(value);

	return this;

}

public UIAttributeData enterTextNext(String value) {

	if (!isEditable()) {
		throw new UnsupportedOperationException("Cannot set the value of a non-editable field");
	}
	pressKey("\t");
	pressKey(value);

	return this;

}

/** Erase the attribute text in the field, we assume our cursor is in the field  */
public UIAttributeData eraseValueInField() {

	if (!isEditable()) {
		throw new UnsupportedOperationException("Cannot erase the value of a non-editable field");
	}

	int length = value().length();
	for (int i=0;i<length;i++) {
		pressBackspace();
	}

	return this;

}

public UIAttributeData clickOnCreate() {

	if (!isNotPresent()) {
		throw new UnsupportedOperationException("Cannot create an attribute unless it's not present");
	}

	element.$(".attribute-data-add").click();	// we click on the add button

	return parent.attribute(this.name());		// and we now have new element, so we recreate ourselves

}

}

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


text:
package com.sktutilities.sandhi;

import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class Launcher3 extends JFrame implements ActionListener {
	JLabel l1;
	JLabel l2;
	JTextField tf1;
	JButton b1,b2,b3,b4;
	JPanel p1,p2,p3,p4;
	File src_file;
	String prog_name= "My Sandhi";
	public Launcher3()
		{
			super("Sandhi Program Installation Complete");
			setSize( 450,250);
			//super("Sandhi Program Installation Complete");
			JLabel l1 = new JLabel("Congratulations!!! You have successfully installed " + prog_name);
			b1 = new JButton("Finish");
			b1.setActionCommand("finish");
			b1.addActionListener(this) ;

			Container contentPane = getContentPane();
			contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
			p1 = new JPanel();
			p2 = new JPanel();
			p1.add(l1);
			p2.add(b1);

			contentPane.add(p1);
			contentPane.add(p2);
			this.setVisible(true);
		}

	public void actionPerformed(ActionEvent e)
	{
	if( (e.getActionCommand()).equals("finish") )
		{
			System.exit(0);
		} // end of if( (e.getActionCommand()).equals("Enter") )
	}

}


text:
'use strict';

import { Component, PropTypes } from 'react'
import SelectTagItem from './select-tag-item'

class SelectTagBlock extends Component {

  constructor (props) {
    super(props)
  }

  render () {
    let [tags, refreshState] = [
      this.props.tags,
      this.props.refreshState
    ]
    return (
      <ul className="nav nav-pills" role="tag-input">
        {
          tags.map((name, i) => {
            return (
              <SelectTagItem key={i}
                             name={name}
                             refreshState={refreshState.bind(this, name)} />
            );
          })
        }
      </ul>
    )
  }
}

SelectTagBlock.propTypes = {
  tags: PropTypes.array,
  refreshState: PropTypes.func
}

SelectTagBlock.defaultProps = {
  tags: [],
  refreshState: () => null
}

export default SelectTagBlock