text:
var mkdirp = require('mkdirp')

module.exports = {

  createDataFolder: function (instance, verbose) {

    //
    // Tries to load the instance.
    //
    try {
      var data_folder = require('../config/' + instance).DataFolder
    }
    catch (err) {
      if (verbose) {
        console.log(err)
      }
      return false
    }

    //
    // Proceeds to create a folder.
    //
    mkdirp(data_folder, function (err) {
      if (err) {
        console.log('Could not create ' + data_folder + ' directory.')
        if (verbose) {
          console.error(err)
        }
        return false
      } else {
        if (verbose) {
          console.log(data_folder + ' directory created successfully.')
        }
      }
    })
  }

}

//
// Invoking function.
//
var main = function(){
    createDataFolder(process.argv[2])
}

if (require.main === module) {
    main()
}

redpajama_set_name: RedPajamaGithub


text:
<title>Invoking GNU Fortran - The GNU Fortran Compiler</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="The GNU Fortran Compiler">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Introduction.html#Introduction" title="Introduction">
<link rel="next" href="Runtime.html#Runtime" title="Runtime">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: Runtime,
Previous: Introduction,
Up: Top

2 GNU Fortran Command Options

The <samp>gfortran</samp> command supports all the options supported by the
<samp>gcc</samp> command.  Only options specific to GNU Fortran are documented
here.

See GCC Command Options, for information
on the non-Fortran-specific aspects of the <samp>gcc</samp> command (and,
therefore, the <samp>gfortran</samp> command).

All GCC and GNU Fortran options
are accepted both by <samp>gfortran</samp> and by <samp>gcc</samp>
(as well as any other drivers built at the same time,
such as <samp>g++</samp>),
since adding GNU Fortran to the GCC distribution
enables acceptance of GNU Fortran options
by all of the relevant drivers.

In some cases, options have positive and negative forms;
the negative form of <samp>-ffoo</samp> would be <samp>-fno-foo</samp>.
This manual documents only one of these two forms, whichever
one is not the default.

Option Summary:       Brief list of all <samp>gfortran</samp> options,
                        without explanations.

Fortran Dialect Options:   Controlling the variant of Fortran language
                             compiled.

Preprocessing Options:   Enable and customize preprocessing.

Error and Warning Options:      How picky should the compiler be?

Debugging Options:    Symbol tables, measurements, and debugging dumps.

Directory Options:    Where to find module files

Link Options :        Influencing the linking step

Runtime Options:      Influencing runtime behavior

Code Gen Options:     Specifying conventions for function calls, data layout
                        and register usage.

Environment Variables:  Environment variables that affect <samp>gfortran</samp>.


text:
package com.netflix.curator.x.discovery.details;

import com.netflix.curator.x.discovery.ServiceInstance;
import java.util.List;

/**
 * Provides a set of available instances for a service so that a strategy can pick one of them
 */
public interface InstanceProvider<T>
{
    /**
     * Return the current available set of instances
     * @return instances
     * @throws Exception any errors
     */
    public List<ServiceInstance<T>>      getInstances() throws Exception;
}


text:
var MongoClient = require('mongodb').MongoClient,
    format = require('util').format;

MongoClient.connect('mongodb://127.0.0.1:27017/test', function(err, db) {
    if (err) throw err;

    var collection = db.collection('test_insert');
    collection.insert({
        a: 2
    }, function(err, docs) {
        collection.count(function(err, count) {
            console.log(format("count = %s", count));
        });
    });

    // Locate all the entries using find
    collection.find().toArray(function(err, results) {
        console.dir(results);
        // Let's close the db
        db.close();
    });
});

var http = require('http');
http.createServer(function(req, res) {
    res.writeHead(200, {
        'Content-Type': 'text/plain'
    });
    res.end('Hello World\n');
}).listen(8080, '198.199.83.108');
console.log('Server running at http://198.199.83.108:8080/');


text:
<?php
    include_once('../Configuration.inc.php');

	$Page->Title = 'Comentario';
	if (!$Page->Prefix)
		$Page->Prefix = '../';

	include_once('./Security.inc.php');
	include_once($Page->Prefix.'ajfwk/GetParameters.inc.php');
	include_once($Page->Prefix.'ajfwk/Database.inc.php');
	include_once($Page->Prefix.'ajfwk/Errors.inc.php');
	include_once($Page->Prefix.'ajfwk/Pages.inc.php');
	include_once($Page->Prefix.'ajfwk/Session.inc.php');
	include_once($Page->Prefix.'ajfwk/Forms.inc.php');
	include_once($Page->Prefix.'ajfwk/Tables.inc.php');
	include_once($Page->Prefix.'ajfwk/Translations.inc.php');

	include_once($Page->Prefix.'includes/Enumerations.inc.php');
	include_once($Page->Prefix.'includes/ComentarioFunctions.inc.php');

	DbConnect();

	SessionPut('ComentarioLink',PageCurrent());

	if (!isset($Id))
		PageExit();

	$rs = ComentarioGetById($Id);
	$Texto = $rs['Texto'];
	$IdPropiedad = $rs['IdPropiedad'];
	$IdUser = $rs['IdUser'];

	$TranslationIdPropiedad = "".TranslateDescription("$Cfg[SqlPrefix]propiedades",$IdPropiedad,"Nombre","Id")."";
	$TranslationIdUser = "".TranslateDescription("$Cfg[SqlPrefix]users",$IdUser,"UserName","Id")."";

	include_once($Page->Prefix.'includes/Header.inc.php');
?>

Comentarios
<a class="btn btn-primary" href="ComentarioForm.php?Id=<?php echo $Id; ?>">Actualiza
<a class="btn btn-danger" href="ComentarioDelete.php?Id=<?php echo $Id; ?>">Elimina

<?php
	TableOpen('', '', 'view');
	FieldStaticMemoGenerate("Texto",$Texto);
	FieldStaticGenerate("Propiedad",$TranslationIdPropiedad);
	FieldStaticGenerate("Usuario",$TranslationIdUser);
	TableClose();
?>

<?php
	DbDisconnect();
	include_once($Page->Prefix.'includes/Footer.inc.php');
?>


text:
namespace client {
namespace performance_test {

// Default number of iterations.
extern const int kDefaultIterations;

// Test name.
#define PERF_TEST_NAME(name) PerfTest##name

// Entry in test array.
#define PERF_TEST_ENTRY_EX(name, iterations) \
    { #name, PERF_TEST_NAME(name), iterations }
#define PERF_TEST_ENTRY(name) PERF_TEST_ENTRY_EX(name, kDefaultIterations)

// Test function declaration.
#define PERF_TEST_RESULT int64
#define PERF_TEST_PARAM_ITERATIONS iterations
#define PERF_TEST_PARAMS int PERF_TEST_PARAM_ITERATIONS
#define PERF_TEST_FUNC(name) \
    PERF_TEST_RESULT PERF_TEST_NAME(name)(PERF_TEST_PARAMS)

// Typedef for test pointers.
typedef PERF_TEST_RESULT(PerfTest(PERF_TEST_PARAMS));

class CefTimer {
 public:
  CefTimer() : running_(false) {
  }

  bool IsRunning() { return running_; }

  void Start() {
    DCHECK(!running_);
    running_ = true;
    start_.Now();
  }

  void Stop() {
    stop_.Now();
    DCHECK(running_);
    running_ = false;
  }

  int64 Delta() {
    DCHECK(!running_);
    return start_.Delta(stop_);
  }

 private:
  bool running_;
  CefTime start_;
  CefTime stop_;

  DISALLOW_COPY_AND_ASSIGN(CefTimer);
};

// Peform test iterations using a user-provided timing result variable.
#define PERF_ITERATIONS_START_EX() \
    { \
      CefTimer _timer; \
      _timer.Start(); \
      for (int _i = 0; _i < PERF_TEST_PARAM_ITERATIONS; ++_i) {

#define PERF_ITERATIONS_END_EX(result) \
      } \
      _timer.Stop(); \
      result = _timer.Delta(); \
    }

// Perform test iterations and return the timing result.
#define PERF_ITERATIONS_START() \
    int64 _result = 0; \
    PERF_ITERATIONS_START_EX()

#define PERF_ITERATIONS_END() \
    PERF_ITERATIONS_END_EX(_result) \
    return _result;

// Perf test entry structure.
struct PerfTestEntry {
  const char* name;
  PerfTest* test;
  int iterations;
};

// Array of perf tests.
extern const PerfTestEntry kPerfTests[];
extern const int kPerfTestsCount;

}  // namespace performance_test
}  // namespace client

#endif  // CEF_TESTS_CEFCLIENT_PERFORMANCE_TEST_H_


text:
using System;
using QuantConnect.Data.Market;

namespace QuantConnect.Indicators.CandlestickPatterns
{
    /// <summary>
    /// Thrusting candlestick pattern indicator
    /// </summary>
    /// <remarks>
    /// Must have:
    /// - first candle: long black candle
    /// - second candle: white candle with open below previous day low and close into previous day body under the midpoint;
    /// to differentiate it from in-neck the close should not be equal to the black candle's close
    /// The meaning of "equal" is specified with SetCandleSettings
    /// The returned value is negative(-1): thrusting pattern is always bearish
    /// The user should consider that the thrusting pattern is significant when it appears in a downtrend and it could be
    /// even bullish "when coming in an uptrend or occurring twice within several days" (Steve Nison says), while this
    /// function does not consider the trend
    /// </remarks>
    public class Thrusting : CandlestickPattern
    {
        private readonly int _equalAveragePeriod;
        private readonly int _bodyLongAveragePeriod;

        private decimal _equalPeriodTotal;
        private decimal _bodyLongPeriodTotal;

        /// <summary>
        /// Initializes a new instance of the <see cref="Thrusting"/> class using the specified name.
        /// </summary>
        /// <param name="name">The name of this indicator</param>
        public Thrusting(string name)
            : base(name, Math.Max(CandleSettings.Get(CandleSettingType.Equal).AveragePeriod, CandleSettings.Get(CandleSettingType.BodyLong).AveragePeriod) + 1 + 1)
        {
            _equalAveragePeriod = CandleSettings.Get(CandleSettingType.Equal).AveragePeriod;
            _bodyLongAveragePeriod = CandleSettings.Get(CandleSettingType.BodyLong).AveragePeriod;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Thrusting"/> class.
        /// </summary>
        public Thrusting()
            : this("THRUSTING")
        {
        }

        /// <summary>
        /// Gets a flag indicating when this indicator is ready and fully initialized
        /// </summary>
        public override bool IsReady
        {
            get { return Samples >= Period; }
        }

        /// <summary>
        /// Computes the next value of this indicator from the given state
        /// </summary>
        /// <param name="window">The window of data held in this indicator</param>
        /// <param name="input">The input given to the indicator</param>
        /// <returns>A new value for this indicator</returns>
        protected override decimal ComputeNextValue(IReadOnlyWindow<IBaseDataBar> window, IBaseDataBar input)
        {
            if (!IsReady)
            {
                if (Samples >= Period - _equalAveragePeriod)
                {
                    _equalPeriodTotal += GetCandleRange(CandleSettingType.Equal, window[1]);
                }

                if (Samples >= Period - _bodyLongAveragePeriod)
                {
                    _bodyLongPeriodTotal += GetCandleRange(CandleSettingType.BodyLong, window[1]);
                }

                return 0m;
            }

            decimal value;
            if (
                // 1st: black
                GetCandleColor(window[1]) == CandleColor.Black &&
                //      long
                GetRealBody(window[1]) > GetCandleAverage(CandleSettingType.BodyLong, _bodyLongPeriodTotal, window[1]) &&
                // 2nd: white
                GetCandleColor(input) == CandleColor.White &&
                //      open below prior low
                input.Open < window[1].Low &&
                //      close into prior body
                input.Close > window[1].Close + GetCandleAverage(CandleSettingType.Equal, _equalPeriodTotal, window[1]) &&
                //      under the midpoint
                input.Close <= window[1].Close + GetRealBody(window[1]) * 0.5m
              )
                value = -1m;
            else
                value = 0m;

            // add the current range and subtract the first range: this is done after the pattern recognition
            // when avgPeriod is not 0, that means "compare with the previous candles" (it excludes the current candle)

            _equalPeriodTotal += GetCandleRange(CandleSettingType.Equal, window[1]) -
                                 GetCandleRange(CandleSettingType.Equal, window[_equalAveragePeriod + 1]);

            _bodyLongPeriodTotal += GetCandleRange(CandleSettingType.BodyLong, window[1]) -
                                    GetCandleRange(CandleSettingType.BodyLong, window[_bodyLongAveragePeriod + 1]);

            return value;
        }

        /// <summary>
        /// Resets this indicator to its initial state
        /// </summary>
        public override void Reset()
        {
            _equalPeriodTotal = 0m;
            _bodyLongPeriodTotal = 0m;
            base.Reset();
        }
    }
}


text:
module PollsHelper
  def have_polls?
    Poll.all.size > 0
  end
end


text:
import * as interop from "./interop";

// F#
export async function runFSharpAppAsync() {
    console.log("--- F# assembly output starts here ---");
    const entrypoint: string = "appfs";
    const references: string[] = ["FSharp.Core", "libfs"];
    await interop.StartApplication(entrypoint, references);

    console.log("--- F# <-> JS interop starts here ---");
    const x = await interop.InvokeStaticAsync("libfs", "LibFS", "Library", "Sqr", 5);
    console.log("sqr(5) = " + x);
    console.log("--- F# output ends here ---");
}

// C#
export async function runCSharpAppAsync() {
    console.log("--- C# assembly output starts here ---");
    const entrypoint: string = "appcs";
    const references: string[] = ["libcs"];
    await interop.StartApplication(entrypoint, references);

    console.log("--- C# <-> JS interop starts here ---");
    await interop.InvokeStaticAsync("libcs", "LibCS", "Library", "helloAsync", "Earth");

    const x = await interop.InvokeStaticAsync("libcs", "LibCS", "Library", "Sqr", 5);
    console.log("sqr(5) = " + x);

    const y = await interop.InvokeStaticAsync("libcs", "LibCS", "Library", "Inv", 5);
    console.log("inv(5) = " + y);
    console.log("--- C# output ends here ---");
}

runCSharpAppAsync()
    .then(runFSharpAppAsync)
    .catch((reason) => console.log("Error: %o", reason));


text:
require('babel-core/register');
const app = require('./app');

app.set('port', process.env.PORT || 3000);

const server = app.listen(app.get('port'), function () {
    console.log('Express server listening on port ' + server.address().port);
});


text:
title: Create a Custom Skin
page_title: Create a Custom Skin | RadFileExplorer for ASP.NET AJAX Documentation
description: Create a Custom Skin
slug: fileexplorer/appearance-and-styling/create-a-custom-skin
tags: create,a,custom,skin
published: True
position: 0
---

# Create a Custom Skin

AbstractEach of the controls included in the **Telerik UI for ASP.NET AJAX** suite is styled with two CSS files that are loaded in a certain order. The first one - **ControlName.css,** also called base stylesheet contains CSS properties and values that are common for all skins, i.e it is layout-specific, not skin-specific. These are CSS float, padding, margin, font-size, font-family, etc. In the general case, when creating a custom skin for a control this file should not be edited, unless the custom skin needs different sizes, padding and/or margins.

The second file represents the actual skin of the control, and its name consists of the control name plus the skin name, i.e -**FileExplorer.Default.css**. Upon creating a custom skin for the control, one should edit that particular file, as it contains skin-specific CSS properties, and references to images, colors, borders and backgrounds.

From **Q2 2010**, skin specific style sheet files have been created for all **RadFileExplorer** skins. They contain some skin specific colors and borders, and navigation toolbar buttons.

The navigation toolbar buttons are all place in a sprite image: FileExplorerToolbarSprites.png for all browsers and **FileExplorerToolbarSpritesIE6**.gif for Internet Explorer 6 only. Both images are exactly the same, but because IE6 cannot render PNG files properly we use PNG for other browsers and GIF for IE6. From Q2, 2010, that Sprite image is skin specific for every Telerik Skin, and it is placed in the **FileExplorer** folder related to the skin.

![RadFileExplorer Toolbar's Sprite](images/FileExplorer-ToolbarSprites.png)

The **RadFileExplorer** control consists of several controls from Telerik AJAX UI Suite: **RadToolBar**, **RadGrid**, **RadTreeView**, **RadUpload**, **RadSplitter**. And each of that controls is styled with two CSS files that are loaded in a certain order.

Another change from Q2 2010 is that the Dialog Separator in **RadEditor's** Dialogs has been changed to be specific for each different skin. Until now, it was grey colored for all skins and its CSS selector was placed in Widgets.css. Its width was also increased from 3px to 5px.

````CSS
.DialogSeparator
{
	border-left: solid 1px #222;
	border-right: solid 1px #222;
	background-color: #ececec;
}
````

![Dialog Separator](images/FileExplorer-dialogSepWidget.png)

As of **Q2 2010**, the above CSS code was removed from **Widgets.css** and moved to **FileExplorer** CSS skin specific files in order to have skin specific **DialogSeprator**.

![Dialog Separator new](images/FileExplorer-dialogSepSkinSpecific.png)

![RadFileExplorer's scheme](images/FileExplorer-scheme.png)

The **FileExporer.css** file defines the common values for the control and all skins. It also rewrites some of the styles form **RadToolBar**, **RadGrid**, **RadTreeView**, **RadUpload**, **RadSplitter**. This is needed in order to make the control work properly. In that CSS file there are also skin specific settings for all skins which define some basic styles like colors and border colors of the **FileExplorer's** wrapping elements to match the other controls' skins.

To customize **RadFileExplorer** look and feel you should customize one or more of the skins of the controls that are used for **RadFileExplorer** - **RadToolBar**, **RadGrid**, **RadTreeView**, **RadUpload**, **RadSplitter**.

## See Also

* [Creating Custom RadToolBar Skin]({% slug toolbar/appearance-and-styling/tutorial-creating-a-custom-skin%})

* [Creating Custom RadGrid Skin]({% slug grid/appearance-and-styling/modifying-existing-skins%})

* [Creating Custom RadTreeView Skin]({% slug treeview/appearance-and-styling/tutorial-on-creating-a-custom-skin%})

* [Creating Custom RadUpload Skin]({% slug upload/appearance-and-styling/tutorial-on-creating-custom-skin%})

* [Creating Custom RadSplitter Skin]({% slug splitter/appearance-and-styling/create-a-custom-skin%})


text:
using System;
using System.Collections.Generic;
using System.Linq;
using Accord.Math.Random;
using Accord.Statistics.Distributions.Univariate;
using Newtonsoft.Json;
using QuantSA.Shared.Dates;
using QuantSA.Shared.MarketData;
using QuantSA.Shared.MarketObservables;
using QuantSA.Shared.Primitives;

namespace QuantSA.Valuation.Models.CreditFX
{
    /// <summary>
    /// Provides an FX process and the default event for a single name.
    /// <para/>
    /// Regression variables are FX, defaultedFlag (0,1), 1 year default probability
    /// </summary>
    /// <seealso cref="NumeraireSimulator" />
    public class DeterministicCreditWithFXJump : NumeraireSimulator
    {
        private readonly MarketObservable _currencyPair;
        private readonly IFXSource _fxSource;
        private readonly double _fxVol;
        private readonly double _relJumpSizeInDefault;
        private readonly double _simRecoveryRate;
        private readonly SurvivalProbabilitySource _survivalProbSource;
        private readonly IDiscountingSource _valueCurrencyDiscount;
        [JsonIgnore] private List<Date> _allRequiredDates; // the set of all dates that will be simulated.
        [JsonIgnore] private Date _anchorDate;
        [JsonIgnore] private double _simDefaultTime;
        [JsonIgnore] private Dictionary<int, double> _simulation; // stores the simulated share prices at each required date
        [JsonIgnore] private NormalDistribution _normal;
        [JsonIgnore] private UniformContinuousDistribution _uniform;

        /// <summary>
        /// Initializes a new instance of the <see cref="DeterministicCreditWithFXJump"/> class.
        /// </summary>
        /// <param name="survivalProbSource">A curve that provides survival probabilities.  Usually a hazard curve.</param>
        /// <param name="ccyPair">The other currency required in the simulation.  The valuation currency will
        /// be inferred from the <paramref name="valueCurrencyDiscount"/>.  This value needs to be explicitly set
        /// since <paramref name="fxSource"/> may provide multiple pairs.</param>
        /// <param name="fxSource">The source FX spot and forwards.</param>
        /// <param name="valueCurrencyDiscount">The value currency discount curve.</param>
        /// <param name="fxVol">The FX volatility.</param>
        /// <param name="relJumpSizeInDefault">The relative jump size in default.  For example if the value currency is ZAR and the
        /// other currency is USD then the FX is modeled as ZAR per USD and in default the FX rate will change to:
        /// rate before default * (1 + relJumpSizeInDefault).</param>
        /// <param name="expectedRecoveryRate">The constant recovery rate that will be assumed to apply in default.</param>
        public DeterministicCreditWithFXJump(SurvivalProbabilitySource survivalProbSource,
            CurrencyPair ccyPair, IFXSource fxSource, IDiscountingSource valueCurrencyDiscount,
            double fxVol, double relJumpSizeInDefault, double expectedRecoveryRate)
        {
            _survivalProbSource = survivalProbSource;
            _fxSource = fxSource;
            _valueCurrencyDiscount = valueCurrencyDiscount;
            _fxVol = fxVol;
            _relJumpSizeInDefault = relJumpSizeInDefault;
            _simRecoveryRate = expectedRecoveryRate;
            _currencyPair = ccyPair;
        }

        [JsonIgnore] private ReferenceEntity RefEntity => _survivalProbSource.GetReferenceEntity();

        /// <summary>
        /// Gets the indices.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="requiredTimes">The required times.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentException">
        /// defaultTime must only be queried with a single date.
        /// or
        /// defaultRecovery must only be queried with a single date.
        /// or
        /// </exception>
        public override double[] GetIndices(MarketObservable index, List<Date> requiredTimes)
        {
            if (index == _currencyPair)
            {
                var result = new double[requiredTimes.Count];
                for (var i = 0; i < requiredTimes.Count; i++)
                    if (requiredTimes[i] <= _anchorDate)
                        result[i] = _fxSource.GetRate(requiredTimes[i]);
                    else
                        result[i] = _simulation[requiredTimes[i]];
                return result;
            }

            if (index is DefaultTime defaultTime && defaultTime.RefEntity == RefEntity)
            {
                if (requiredTimes.Count > 1)
                    throw new ArgumentException("defaultTime must only be queried with a single date.");
                return new[] {_simDefaultTime};
            }

            if (index is DefaultRecovery defaultRecovery && defaultRecovery.RefEntity == RefEntity)
            {
                if (requiredTimes.Count > 1)
                    throw new ArgumentException("defaultRecovery must only be queried with a single date.");
                return new[] {_simRecoveryRate};
            }

            throw new ArgumentException(index + " is not simulated by this model.");
        }

        /// <summary>
        /// Indicate whether the required share price is simulated by this model
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public override bool ProvidesIndex(MarketObservable index)
        {
            if (index == _currencyPair)
                return true;
            if (index is DefaultTime defaultTime && defaultTime.RefEntity == RefEntity)
                return true;
            if (index is DefaultRecovery defaultRecovery && defaultRecovery.RefEntity == RefEntity)
                return true;
            return false;
        }

        /// <summary>
        /// Clear the dates that have been set
        /// </summary>
        public override void Reset()
        {
            _allRequiredDates = new List<Date>();
        }

        /// <summary>
        /// Remove duplicate dates and sort the list
        /// </summary>
        public override void Prepare(Date anchorDate)
        {
            _anchorDate = anchorDate;
            _allRequiredDates = _allRequiredDates.Distinct().ToList();
            _allRequiredDates.Sort();
            _normal = new NormalDistribution();
            _uniform = new UniformContinuousDistribution();
            Generator.Seed = -533776581; // This magic number is: "DeterministicCreditWithFXJump".GetHashCode();
        }

        /// <summary>
        /// Run a simulation and store the results for later use by <see cref="GetIndices(MarketObservable, List{Date})"/>
        /// </summary>
        /// <param name="simNumber"></param>
        public override void RunSimulation(int simNumber)
        {
            _simulation = new Dictionary<int, double>();
            var spot = _fxSource.GetRate(_anchorDate);
            var simRate = spot;
            var oldFxFwd = spot;
            double newFXfwd;

            var hazEst = _survivalProbSource.GetSP(_survivalProbSource.GetAnchorDate().AddTenor(Tenor.FromYears(1)));
            hazEst = -Math.Log(hazEst);
            // Simulate the default
            var tau = _uniform.Generate();
            tau = Math.Log(tau) / -hazEst;
            _simDefaultTime = _anchorDate.value + tau * 365;

            for (var timeCounter = 0; timeCounter < _allRequiredDates.Count; timeCounter++)
            {
                double dt = timeCounter > 0
                    ? _allRequiredDates[timeCounter] - _allRequiredDates[timeCounter - 1]
                    : _allRequiredDates[timeCounter] - _anchorDate.value;
                newFXfwd = _fxSource.GetRate(new Date(_anchorDate.value + dt));

                dt = dt / 365.0;
                var sdt = Math.Sqrt(dt);
                var dW = _normal.Generate();
                // TODO: drift needs to be adjusted for default rate * jump size
                simRate = simRate * newFXfwd / oldFxFwd * Math.Exp(-0.5 * _fxVol * _fxVol * dt + _fxVol * sdt * dW);
                if (_simDefaultTime < _allRequiredDates[timeCounter])
                    _simulation[_allRequiredDates[timeCounter]] = simRate * (1 + _relJumpSizeInDefault);
                else
                    _simulation[_allRequiredDates[timeCounter]] = simRate;
            }
        }

        public override void SetRequiredDates(MarketObservable index, List<Date> requiredDates)
        {
            _allRequiredDates.AddRange(requiredDates);
        }

        public override Currency GetNumeraireCurrency()
        {
            return _valueCurrencyDiscount.GetCurrency();
        }

        public override double Numeraire(Date valueDate)
        {
            return 1.0 / _valueCurrencyDiscount.GetDF(valueDate);
        }

        public override void SetNumeraireDates(List<Date> requiredDates)
        {
            // Nothing needs to be done since we are using a deterministic curve.
        }

        public override double[] GetUnderlyingFactors(Date date)
        {
            var regressors = new double[3];
            var fxRate = GetIndices(_currencyPair, new List<Date> {date})[0];
            var defaultIndicator = date < _simDefaultTime ? 0.0 : 1.0;
            var fwdDefaultP = 1.0 - _survivalProbSource.GetSP(date.AddTenor(Tenor.FromYears(1))) /
                              _survivalProbSource.GetSP(date);
            regressors[0] = fxRate;
            regressors[1] = defaultIndicator;
            regressors[2] = fwdDefaultP;
            return regressors;
        }
    }
}


text:
using System;
using Xunit;
using Xunit.Extensions;

namespace Humanizer.Tests.Localisation.tr
{
    public class TimeSpanHumanizeTests : AmbientCulture
    {
        public TimeSpanHumanizeTests() : base("tr") { }

        [Theory]
        [InlineData(14, "2 hafta")]
        [InlineData(7, "1 hafta")]
        public void Weeks(int days, string expected)
        {
            var actual = TimeSpan.FromDays(days).Humanize();
            Assert.Equal(expected, actual);
        }

        [Theory]
        [InlineData(6, "6 gün")]
        [InlineData(2, "2 gün")]
        public void Days(int days, string expected)
        {
            var actual = TimeSpan.FromDays(days).Humanize();
            Assert.Equal(expected, actual);
        }

        [Theory]
        [InlineData(2, "2 saat")]
        [InlineData(1, "1 saat")]
        public void Hours(int hours, string expected)
        {
            var actual = TimeSpan.FromHours(hours).Humanize();
            Assert.Equal(expected, actual);
        }

        [Theory]
        [InlineData(2, "2 dakika")]
        [InlineData(1, "1 dakika")]
        public void Minutes(int minutes, string expected)
        {
            var actual = TimeSpan.FromMinutes(minutes).Humanize();
            Assert.Equal(expected, actual);
        }

        [Theory]
        [InlineData(2, "2 saniye")]
        [InlineData(1, "1 saniye")]
        public void Seconds(int seconds, string expected)
        {
            var actual = TimeSpan.FromSeconds(seconds).Humanize();
            Assert.Equal(expected, actual);
        }

        [Theory]
        [InlineData(2, "2 milisaniye")]
        [InlineData(1, "1 milisaniye")]
        public void Milliseconds(int ms, string expected)
        {
            var actual = TimeSpan.FromMilliseconds(ms).Humanize();
            Assert.Equal(expected, actual);
        }

        [Fact]
        public void NoTime()
        {
            var noTime = TimeSpan.Zero;
            var actual = noTime.Humanize();
            Assert.Equal("zaman farkı yok", actual);
        }
    }
}


text:
package org.apache.logging.log4j.core.jackson;

import java.io.IOException;
import java.util.List;

import org.apache.logging.log4j.spi.MutableThreadContextStack;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;

/**
 *

 * Consider this class private.
 *

 */
final class MutableThreadContextStackDeserializer extends StdDeserializer<MutableThreadContextStack> {

    private static final long serialVersionUID = 1L;

    MutableThreadContextStackDeserializer() {
        super(MutableThreadContextStack.class);
    }

    @Override
    public MutableThreadContextStack deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException,
            JsonProcessingException {
        final List<String> list = jp.readValueAs(new TypeReference<List<String>>() {
            // empty
        });
        return new MutableThreadContextStack(list);
    }
}


text:
package integration;

import org.codehaus.griffon.runtime.core.artifact.AbstractGriffonView;

public class IntegrationView extends AbstractGriffonView implements Invokable {
    private IntegrationController controller;
    private IntegrationModel model;
    private boolean invoked;

    public void setController(IntegrationController controller) {
        this.controller = controller;
    }

    public void setModel(IntegrationModel model) {
        this.model = model;
    }

    @Override
    public void initUI() {
        invoked = true;
    }

    public boolean isInvoked() {
        return invoked;
    }

    public void onRandomEvent() {

    }
}


text:
<?php

namespace PhpOffice\PhpSpreadsheet\Reader;

use DOMDocument;
use DOMElement;
use DOMNode;
use DOMText;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\Border;
use PhpOffice\PhpSpreadsheet\Style\Color;
use PhpOffice\PhpSpreadsheet\Style\Fill;
use PhpOffice\PhpSpreadsheet\Style\Font;
use PhpOffice\PhpSpreadsheet\Style\Style;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use Throwable;

/** PhpSpreadsheet root directory */
class Html extends BaseReader
{
    /**
     * Sample size to read to determine if it's HTML or not.
     */
    const TEST_SAMPLE_SIZE = 2048;

    /**
     * Input encoding.
     *
     * @var string
     */
    protected $inputEncoding = 'ANSI';

    /**
     * Sheet index to read.
     *
     * @var int
     */
    protected $sheetIndex = 0;

    /**
     * Formats.
     *
     * @var array
     */
    protected $formats = [
        'h1' => [
            'font' => [
                'bold' => true,
                'size' => 24,
            ],
        ], //    Bold, 24pt
        'h2' => [
            'font' => [
                'bold' => true,
                'size' => 18,
            ],
        ], //    Bold, 18pt
        'h3' => [
            'font' => [
                'bold' => true,
                'size' => 13.5,
            ],
        ], //    Bold, 13.5pt
        'h4' => [
            'font' => [
                'bold' => true,
                'size' => 12,
            ],
        ], //    Bold, 12pt
        'h5' => [
            'font' => [
                'bold' => true,
                'size' => 10,
            ],
        ], //    Bold, 10pt
        'h6' => [
            'font' => [
                'bold' => true,
                'size' => 7.5,
            ],
        ], //    Bold, 7.5pt
        'a' => [
            'font' => [
                'underline' => true,
                'color' => [
                    'argb' => Color::COLOR_BLUE,
                ],
            ],
        ], //    Blue underlined
        'hr' => [
            'borders' => [
                'bottom' => [
                    'borderStyle' => Border::BORDER_THIN,
                    'color' => [
                        Color::COLOR_BLACK,
                    ],
                ],
            ],
        ], //    Bottom border
        'strong' => [
            'font' => [
                'bold' => true,
            ],
        ], //    Bold
        'b' => [
            'font' => [
                'bold' => true,
            ],
        ], //    Bold
        'i' => [
            'font' => [
                'italic' => true,
            ],
        ], //    Italic
        'em' => [
            'font' => [
                'italic' => true,
            ],
        ], //    Italic
    ];

    protected $rowspan = [];

    /**
     * Create a new HTML Reader instance.
     */
    public function __construct()
    {
        parent::__construct();
        $this->securityScanner = XmlScanner::getInstance($this);
    }

    /**
     * Validate that the current file is an HTML file.
     *
     * @param string $pFilename
     *
     * @return bool
     */
    public function canRead($pFilename)
    {
        // Check if file exists
        try {
            $this->openFile($pFilename);
        } catch (Exception $e) {
            return false;
        }

        $beginning = $this->readBeginning();
        $startWithTag = self::startsWithTag($beginning);
        $containsTags = self::containsTags($beginning);
        $endsWithTag = self::endsWithTag($this->readEnding());

        fclose($this->fileHandle);

        return $startWithTag && $containsTags && $endsWithTag;
    }

    private function readBeginning()
    {
        fseek($this->fileHandle, 0);

        return fread($this->fileHandle, self::TEST_SAMPLE_SIZE);
    }

    private function readEnding()
    {
        $meta = stream_get_meta_data($this->fileHandle);
        $filename = $meta['uri'];

        $size = filesize($filename);
        if ($size === 0) {
            return '';
        }

        $blockSize = self::TEST_SAMPLE_SIZE;
        if ($size < $blockSize) {
            $blockSize = $size;
        }

        fseek($this->fileHandle, $size - $blockSize);

        return fread($this->fileHandle, $blockSize);
    }

    private static function startsWithTag($data)
    {
        return '<' === substr(trim($data), 0, 1);
    }

    private static function endsWithTag($data)
    {
        return '>' === substr(trim($data), -1, 1);
    }

    private static function containsTags($data)
    {
        return strlen($data) !== strlen(strip_tags($data));
    }

    /**
     * Loads Spreadsheet from file.
     *
     * @param string $pFilename
     *
     * @return Spreadsheet
     */
    public function load($pFilename)
    {
        // Create new Spreadsheet
        $spreadsheet = new Spreadsheet();

        // Load into this instance
        return $this->loadIntoExisting($pFilename, $spreadsheet);
    }

    /**
     * Set input encoding.
     *
     * @param string $pValue Input encoding, eg: 'ANSI'
     *
     * @return $this
     *
     * @codeCoverageIgnore
     *
     * @deprecated no use is made of this property
     */
    public function setInputEncoding($pValue)
    {
        $this->inputEncoding = $pValue;

        return $this;
    }

    /**
     * Get input encoding.
     *
     * @return string
     *
     * @codeCoverageIgnore
     *
     * @deprecated no use is made of this property
     */
    public function getInputEncoding()
    {
        return $this->inputEncoding;
    }

    //    Data Array used for testing only, should write to Spreadsheet object on completion of tests
    protected $dataArray = [];

    protected $tableLevel = 0;

    protected $nestedColumn = ['A'];

    protected function setTableStartColumn($column)
    {
        if ($this->tableLevel == 0) {
            $column = 'A';
        }
        ++$this->tableLevel;
        $this->nestedColumn[$this->tableLevel] = $column;

        return $this->nestedColumn[$this->tableLevel];
    }

    protected function getTableStartColumn()
    {
        return $this->nestedColumn[$this->tableLevel];
    }

    protected function releaseTableStartColumn()
    {
        --$this->tableLevel;

        return array_pop($this->nestedColumn);
    }

    protected function flushCell(Worksheet $sheet, $column, $row, &$cellContent): void
    {
        if (is_string($cellContent)) {
            //    Simple String content
            if (trim($cellContent) > '') {
                //    Only actually write it if there's content in the string
                //    Write to worksheet to be done here...
                //    ... we return the cell so we can mess about with styles more easily
                $sheet->setCellValue($column . $row, $cellContent);
                $this->dataArray[$row][$column] = $cellContent;
            }
        } else {
            //    We have a Rich Text run
            //    TODO
            $this->dataArray[$row][$column] = 'RICH TEXT: ' . $cellContent;
        }
        $cellContent = (string) '';
    }

    private function processDomElementBody(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child): void
    {
        $attributeArray = [];
        foreach ($child->attributes as $attribute) {
            $attributeArray[$attribute->name] = $attribute->value;
        }

        if ($child->nodeName === 'body') {
            $row = 1;
            $column = 'A';
            $cellContent = '';
            $this->tableLevel = 0;
            $this->processDomElement($child, $sheet, $row, $column, $cellContent);
        } else {
            $this->processDomElementTitle($sheet, $row, $column, $cellContent, $child, $attributeArray);
        }
    }

    private function processDomElementTitle(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray): void
    {
        if ($child->nodeName === 'title') {
            $this->processDomElement($child, $sheet, $row, $column, $cellContent);
            $sheet->setTitle($cellContent, true, true);
            $cellContent = '';
        } else {
            $this->processDomElementSpanEtc($sheet, $row, $column, $cellContent, $child, $attributeArray);
        }
    }

    private static $spanEtc = ['span', 'div', 'font', 'i', 'em', 'strong', 'b'];

    private function processDomElementSpanEtc(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray): void
    {
        if (in_array($child->nodeName, self::$spanEtc)) {
            if (isset($attributeArray['class']) && $attributeArray['class'] === 'comment') {
                $sheet->getComment($column . $row)
                    ->getText()
                    ->createTextRun($child->textContent);
            }
            $this->processDomElement($child, $sheet, $row, $column, $cellContent);

            if (isset($this->formats[$child->nodeName])) {
                $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]);
            }
        } else {
            $this->processDomElementHr($sheet, $row, $column, $cellContent, $child, $attributeArray);
        }
    }

    private function processDomElementHr(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray): void
    {
        if ($child->nodeName === 'hr') {
            $this->flushCell($sheet, $column, $row, $cellContent);
            ++$row;
            if (isset($this->formats[$child->nodeName])) {
                $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]);
            }
            ++$row;
        }
        // fall through to br
        $this->processDomElementBr($sheet, $row, $column, $cellContent, $child, $attributeArray);
    }

    private function processDomElementBr(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray): void
    {
        if ($child->nodeName === 'br' || $child->nodeName === 'hr') {
            if ($this->tableLevel > 0) {
                //    If we're inside a table, replace with a \n and set the cell to wrap
                $cellContent .= "\n";
                $sheet->getStyle($column . $row)->getAlignment()->setWrapText(true);
            } else {
                //    Otherwise flush our existing content and move the row cursor on
                $this->flushCell($sheet, $column, $row, $cellContent);
                ++$row;
            }
        } else {
            $this->processDomElementA($sheet, $row, $column, $cellContent, $child, $attributeArray);
        }
    }

    private function processDomElementA(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray): void
    {
        if ($child->nodeName === 'a') {
            foreach ($attributeArray as $attributeName => $attributeValue) {
                switch ($attributeName) {
                    case 'href':
                        $sheet->getCell($column . $row)->getHyperlink()->setUrl($attributeValue);
                        if (isset($this->formats[$child->nodeName])) {
                            $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]);
                        }

                        break;
                    case 'class':
                        if ($attributeValue === 'comment-indicator') {
                            break; // Ignore - it's just a red square.
                        }
                }
            }
            // no idea why this should be needed
            //$cellContent .= ' ';
            $this->processDomElement($child, $sheet, $row, $column, $cellContent);
        } else {
            $this->processDomElementH1Etc($sheet, $row, $column, $cellContent, $child, $attributeArray);
        }
    }

    private static $h1Etc = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'ul', 'p'];

    private function processDomElementH1Etc(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray): void
    {
        if (in_array($child->nodeName, self::$h1Etc)) {
            if ($this->tableLevel > 0) {
                //    If we're inside a table, replace with a \n
                $cellContent .= $cellContent ? "\n" : '';
                $sheet->getStyle($column . $row)->getAlignment()->setWrapText(true);
                $this->processDomElement($child, $sheet, $row, $column, $cellContent);
            } else {
                if ($cellContent > '') {
                    $this->flushCell($sheet, $column, $row, $cellContent);
                    ++$row;
                }
                $this->processDomElement($child, $sheet, $row, $column, $cellContent);
                $this->flushCell($sheet, $column, $row, $cellContent);

                if (isset($this->formats[$child->nodeName])) {
                    $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]);
                }

                ++$row;
                $column = 'A';
            }
        } else {
            $this->processDomElementLi($sheet, $row, $column, $cellContent, $child, $attributeArray);
        }
    }

    private function processDomElementLi(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray): void
    {
        if ($child->nodeName === 'li') {
            if ($this->tableLevel > 0) {
                //    If we're inside a table, replace with a \n
                $cellContent .= $cellContent ? "\n" : '';
                $this->processDomElement($child, $sheet, $row, $column, $cellContent);
            } else {
                if ($cellContent > '') {
                    $this->flushCell($sheet, $column, $row, $cellContent);
                }
                ++$row;
                $this->processDomElement($child, $sheet, $row, $column, $cellContent);
                $this->flushCell($sheet, $column, $row, $cellContent);
                $column = 'A';
            }
        } else {
            $this->processDomElementImg($sheet, $row, $column, $cellContent, $child, $attributeArray);
        }
    }

    private function processDomElementImg(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray): void
    {
        if ($child->nodeName === 'img') {
            $this->insertImage($sheet, $column, $row, $attributeArray);
        } else {
            $this->processDomElementTable($sheet, $row, $column, $cellContent, $child, $attributeArray);
        }
    }

    private function processDomElementTable(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray): void
    {
        if ($child->nodeName === 'table') {
            $this->flushCell($sheet, $column, $row, $cellContent);
            $column = $this->setTableStartColumn($column);
            if ($this->tableLevel > 1 && $row > 1) {
                --$row;
            }
            $this->processDomElement($child, $sheet, $row, $column, $cellContent);
            $column = $this->releaseTableStartColumn();
            if ($this->tableLevel > 1) {
                ++$column;
            } else {
                ++$row;
            }
        } else {
            $this->processDomElementTr($sheet, $row, $column, $cellContent, $child, $attributeArray);
        }
    }

    private function processDomElementTr(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray): void
    {
        if ($child->nodeName === 'tr') {
            $column = $this->getTableStartColumn();
            $cellContent = '';
            $this->processDomElement($child, $sheet, $row, $column, $cellContent);

            if (isset($attributeArray['height'])) {
                $sheet->getRowDimension($row)->setRowHeight($attributeArray['height']);
            }

            ++$row;
        } else {
            $this->processDomElementThTdOther($sheet, $row, $column, $cellContent, $child, $attributeArray);
        }
    }

    private function processDomElementThTdOther(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray): void
    {
        if ($child->nodeName !== 'td' && $child->nodeName !== 'th') {
            $this->processDomElement($child, $sheet, $row, $column, $cellContent);
        } else {
            $this->processDomElementThTd($sheet, $row, $column, $cellContent, $child, $attributeArray);
        }
    }

    private function processDomElementBgcolor(Worksheet $sheet, int $row, string $column, array $attributeArray): void
    {
        if (isset($attributeArray['bgcolor'])) {
            $sheet->getStyle("$column$row")->applyFromArray(
                [
                    'fill' => [
                        'fillType' => Fill::FILL_SOLID,
                        'color' => ['rgb' => $this->getStyleColor($attributeArray['bgcolor'])],
                    ],
                ]
            );
        }
    }

    private function processDomElementWidth(Worksheet $sheet, string $column, array $attributeArray): void
    {
        if (isset($attributeArray['width'])) {
            $sheet->getColumnDimension($column)->setWidth($attributeArray['width']);
        }
    }

    private function processDomElementHeight(Worksheet $sheet, int $row, array $attributeArray): void
    {
        if (isset($attributeArray['height'])) {
            $sheet->getRowDimension($row)->setRowHeight($attributeArray['height']);
        }
    }

    private function processDomElementAlign(Worksheet $sheet, int $row, string $column, array $attributeArray): void
    {
        if (isset($attributeArray['align'])) {
            $sheet->getStyle($column . $row)->getAlignment()->setHorizontal($attributeArray['align']);
        }
    }

    private function processDomElementVAlign(Worksheet $sheet, int $row, string $column, array $attributeArray): void
    {
        if (isset($attributeArray['valign'])) {
            $sheet->getStyle($column . $row)->getAlignment()->setVertical($attributeArray['valign']);
        }
    }

    private function processDomElementDataFormat(Worksheet $sheet, int $row, string $column, array $attributeArray): void
    {
        if (isset($attributeArray['data-format'])) {
            $sheet->getStyle($column . $row)->getNumberFormat()->setFormatCode($attributeArray['data-format']);
        }
    }

    private function processDomElementThTd(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray): void
    {
        while (isset($this->rowspan[$column . $row])) {
            ++$column;
        }
        $this->processDomElement($child, $sheet, $row, $column, $cellContent);

        // apply inline style
        $this->applyInlineStyle($sheet, $row, $column, $attributeArray);

        $this->flushCell($sheet, $column, $row, $cellContent);

        $this->processDomElementBgcolor($sheet, $row, $column, $attributeArray);
        $this->processDomElementWidth($sheet, $column, $attributeArray);
        $this->processDomElementHeight($sheet, $row, $attributeArray);
        $this->processDomElementAlign($sheet, $row, $column, $attributeArray);
        $this->processDomElementVAlign($sheet, $row, $column, $attributeArray);
        $this->processDomElementDataFormat($sheet, $row, $column, $attributeArray);

        if (isset($attributeArray['rowspan'], $attributeArray['colspan'])) {
            //create merging rowspan and colspan
            $columnTo = $column;
            for ($i = 0; $i < (int) $attributeArray['colspan'] - 1; ++$i) {
                ++$columnTo;
            }
            $range = $column . $row . ':' . $columnTo . ($row + (int) $attributeArray['rowspan'] - 1);
            foreach (Coordinate::extractAllCellReferencesInRange($range) as $value) {
                $this->rowspan[$value] = true;
            }
            $sheet->mergeCells($range);
            $column = $columnTo;
        } elseif (isset($attributeArray['rowspan'])) {
            //create merging rowspan
            $range = $column . $row . ':' . $column . ($row + (int) $attributeArray['rowspan'] - 1);
            foreach (Coordinate::extractAllCellReferencesInRange($range) as $value) {
                $this->rowspan[$value] = true;
            }
            $sheet->mergeCells($range);
        } elseif (isset($attributeArray['colspan'])) {
            //create merging colspan
            $columnTo = $column;
            for ($i = 0; $i < (int) $attributeArray['colspan'] - 1; ++$i) {
                ++$columnTo;
            }
            $sheet->mergeCells($column . $row . ':' . $columnTo . $row);
            $column = $columnTo;
        }

        ++$column;
    }

    protected function processDomElement(DOMNode $element, Worksheet $sheet, int &$row, string &$column, string &$cellContent): void
    {
        foreach ($element->childNodes as $child) {
            if ($child instanceof DOMText) {
                $domText = preg_replace('/\s+/u', ' ', trim($child->nodeValue));
                if (is_string($cellContent)) {
                    //    simply append the text if the cell content is a plain text string
                    $cellContent .= $domText;
                }
                //    but if we have a rich text run instead, we need to append it correctly
                //    TODO
            } elseif ($child instanceof DOMElement) {
                $this->processDomElementBody($sheet, $row, $column, $cellContent, $child);
            }
        }
    }

    /**
     * Loads PhpSpreadsheet from file into PhpSpreadsheet instance.
     *
     * @param string $pFilename
     *
     * @return Spreadsheet
     */
    public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet)
    {
        // Validate
        if (!$this->canRead($pFilename)) {
            throw new Exception($pFilename . ' is an Invalid HTML file.');
        }

        // Create a new DOM object
        $dom = new DOMDocument();
        // Reload the HTML file into the DOM object
        try {
            $loaded = $dom->loadHTML(mb_convert_encoding($this->securityScanner->scanFile($pFilename), 'HTML-ENTITIES', 'UTF-8'));
        } catch (Throwable $e) {
            $loaded = false;
        }
        if ($loaded === false) {
            throw new Exception('Failed to load ' . $pFilename . ' as a DOM Document', 0, $e ?? null);
        }

        return $this->loadDocument($dom, $spreadsheet);
    }

    /**
     * Spreadsheet from content.
     *
     * @param string $content
     */
    public function loadFromString($content, ?Spreadsheet $spreadsheet = null): Spreadsheet
    {
        //    Create a new DOM object
        $dom = new DOMDocument();
        //    Reload the HTML file into the DOM object
        try {
            $loaded = $dom->loadHTML(mb_convert_encoding($this->securityScanner->scan($content), 'HTML-ENTITIES', 'UTF-8'));
        } catch (Throwable $e) {
            $loaded = false;
        }
        if ($loaded === false) {
            throw new Exception('Failed to load content as a DOM Document', 0, $e ?? null);
        }

        return $this->loadDocument($dom, $spreadsheet ?? new Spreadsheet());
    }

    /**
     * Loads PhpSpreadsheet from DOMDocument into PhpSpreadsheet instance.
     */
    private function loadDocument(DOMDocument $document, Spreadsheet $spreadsheet): Spreadsheet
    {
        while ($spreadsheet->getSheetCount() <= $this->sheetIndex) {
            $spreadsheet->createSheet();
        }
        $spreadsheet->setActiveSheetIndex($this->sheetIndex);

        // Discard white space
        $document->preserveWhiteSpace = false;

        $row = 0;
        $column = 'A';
        $content = '';
        $this->rowspan = [];
        $this->processDomElement($document, $spreadsheet->getActiveSheet(), $row, $column, $content);

        // Return
        return $spreadsheet;
    }

    /**
     * Get sheet index.
     *
     * @return int
     */
    public function getSheetIndex()
    {
        return $this->sheetIndex;
    }

    /**
     * Set sheet index.
     *
     * @param int $pValue Sheet index
     *
     * @return $this
     */
    public function setSheetIndex($pValue)
    {
        $this->sheetIndex = $pValue;

        return $this;
    }

    /**
     * Apply inline css inline style.
     *
     * NOTES :
     * Currently only intended for td & th element,
     * and only takes 'background-color' and 'color'; property with HEX color
     *
     * TODO :
     * - Implement to other propertie, such as border
     *
     * @param Worksheet $sheet
     * @param int $row
     * @param string $column
     * @param array $attributeArray
     */
    private function applyInlineStyle(&$sheet, $row, $column, $attributeArray): void
    {
        if (!isset($attributeArray['style'])) {
            return;
        }

        if (isset($attributeArray['rowspan'], $attributeArray['colspan'])) {
            $columnTo = $column;
            for ($i = 0; $i < (int) $attributeArray['colspan'] - 1; ++$i) {
                ++$columnTo;
            }
            $range = $column . $row . ':' . $columnTo . ($row + (int) $attributeArray['rowspan'] - 1);
            $cellStyle = $sheet->getStyle($range);
        } elseif (isset($attributeArray['rowspan'])) {
            $range = $column . $row . ':' . $column . ($row + (int) $attributeArray['rowspan'] - 1);
            $cellStyle = $sheet->getStyle($range);
        } elseif (isset($attributeArray['colspan'])) {
            $columnTo = $column;
            for ($i = 0; $i < (int) $attributeArray['colspan'] - 1; ++$i) {
                ++$columnTo;
            }
            $range = $column . $row . ':' . $columnTo . $row;
            $cellStyle = $sheet->getStyle($range);
        } else {
            $cellStyle = $sheet->getStyle($column . $row);
        }

        // add color styles (background & text) from dom element,currently support : td & th, using ONLY inline css style with RGB color
        $styles = explode(';', $attributeArray['style']);
        foreach ($styles as $st) {
            $value = explode(':', $st);
            $styleName = isset($value[0]) ? trim($value[0]) : null;
            $styleValue = isset($value[1]) ? trim($value[1]) : null;

            if (!$styleName) {
                continue;
            }

            switch ($styleName) {
                case 'background':
                case 'background-color':
                    $styleColor = $this->getStyleColor($styleValue);

                    if (!$styleColor) {
                        continue 2;
                    }

                    $cellStyle->applyFromArray(['fill' => ['fillType' => Fill::FILL_SOLID, 'color' => ['rgb' => $styleColor]]]);

                    break;
                case 'color':
                    $styleColor = $this->getStyleColor($styleValue);

                    if (!$styleColor) {
                        continue 2;
                    }

                    $cellStyle->applyFromArray(['font' => ['color' => ['rgb' => $styleColor]]]);

                    break;

                case 'border':
                    $this->setBorderStyle($cellStyle, $styleValue, 'allBorders');

                    break;

                case 'border-top':
                    $this->setBorderStyle($cellStyle, $styleValue, 'top');

                    break;

                case 'border-bottom':
                    $this->setBorderStyle($cellStyle, $styleValue, 'bottom');

                    break;

                case 'border-left':
                    $this->setBorderStyle($cellStyle, $styleValue, 'left');

                    break;

                case 'border-right':
                    $this->setBorderStyle($cellStyle, $styleValue, 'right');

                    break;

                case 'font-size':
                    $cellStyle->getFont()->setSize(
                        (float) $styleValue
                    );

                    break;

                case 'font-weight':
                    if ($styleValue === 'bold' || $styleValue >= 500) {
                        $cellStyle->getFont()->setBold(true);
                    }

                    break;

                case 'font-style':
                    if ($styleValue === 'italic') {
                        $cellStyle->getFont()->setItalic(true);
                    }

                    break;

                case 'font-family':
                    $cellStyle->getFont()->setName(str_replace('\'', '', $styleValue));

                    break;

                case 'text-decoration':
                    switch ($styleValue) {
                        case 'underline':
                            $cellStyle->getFont()->setUnderline(Font::UNDERLINE_SINGLE);

                            break;
                        case 'line-through':
                            $cellStyle->getFont()->setStrikethrough(true);

                            break;
                    }

                    break;

                case 'text-align':
                    $cellStyle->getAlignment()->setHorizontal($styleValue);

                    break;

                case 'vertical-align':
                    $cellStyle->getAlignment()->setVertical($styleValue);

                    break;

                case 'width':
                    $sheet->getColumnDimension($column)->setWidth(
                        (float) str_replace(['px', 'pt'], '', $styleValue)
                    );

                    break;

                case 'height':
                    $sheet->getRowDimension($row)->setRowHeight(
                        (float) str_replace(['px', 'pt'], '', $styleValue)
                    );

                    break;

                case 'word-wrap':
                    $cellStyle->getAlignment()->setWrapText(
                        $styleValue === 'break-word'
                    );

                    break;

                case 'text-indent':
                    $cellStyle->getAlignment()->setIndent(
                        (int) str_replace(['px'], '', $styleValue)
                    );

                    break;
            }
        }
    }

    /**
     * Check if has #, so we can get clean hex.
     *
     * @return null|string
     */
    public function getStyleColor($value)
    {
        if (strpos($value, '#') === 0) {
            return substr($value, 1);
        }

        return \PhpOffice\PhpSpreadsheet\Helper\Html::colourNameLookup((string) $value);
    }

    /**
     * @param string $column
     * @param int $row
     */
    private function insertImage(Worksheet $sheet, $column, $row, array $attributes): void
    {
        if (!isset($attributes['src'])) {
            return;
        }

        $src = urldecode($attributes['src']);
        $width = isset($attributes['width']) ? (float) $attributes['width'] : null;
        $height = isset($attributes['height']) ? (float) $attributes['height'] : null;
        $name = $attributes['alt'] ?? null;

        $drawing = new Drawing();
        $drawing->setPath($src);
        $drawing->setWorksheet($sheet);
        $drawing->setCoordinates($column . $row);
        $drawing->setOffsetX(0);
        $drawing->setOffsetY(10);
        $drawing->setResizeProportional(true);

        if ($name) {
            $drawing->setName($name);
        }

        if ($width) {
            $drawing->setWidth((int) $width);
        }

        if ($height) {
            $drawing->setHeight((int) $height);
        }

        $sheet->getColumnDimension($column)->setWidth(
            $drawing->getWidth() / 6
        );

        $sheet->getRowDimension($row)->setRowHeight(
            $drawing->getHeight() * 0.9
        );
    }

    private static $borderMappings = [
        'dash-dot' => Border::BORDER_DASHDOT,
        'dash-dot-dot' => Border::BORDER_DASHDOTDOT,
        'dashed' => Border::BORDER_DASHED,
        'dotted' => Border::BORDER_DOTTED,
        'double' => Border::BORDER_DOUBLE,
        'hair' => Border::BORDER_HAIR,
        'medium' => Border::BORDER_MEDIUM,
        'medium-dashed' => Border::BORDER_MEDIUMDASHED,
        'medium-dash-dot' => Border::BORDER_MEDIUMDASHDOT,
        'medium-dash-dot-dot' => Border::BORDER_MEDIUMDASHDOTDOT,
        'none' => Border::BORDER_NONE,
        'slant-dash-dot' => Border::BORDER_SLANTDASHDOT,
        'solid' => Border::BORDER_THIN,
        'thick' => Border::BORDER_THICK,
    ];

    public static function getBorderMappings(): array
    {
        return self::$borderMappings;
    }

    /**
     * Map html border style to PhpSpreadsheet border style.
     *
     * @param string $style
     *
     * @return null|string
     */
    public function getBorderStyle($style)
    {
        return (array_key_exists($style, self::$borderMappings)) ? self::$borderMappings[$style] : null;
    }

    /**
     * @param string $styleValue
     * @param string $type
     */
    private function setBorderStyle(Style $cellStyle, $styleValue, $type): void
    {
        if (trim($styleValue) === Border::BORDER_NONE) {
            $borderStyle = Border::BORDER_NONE;
            $color = null;
        } else {
            $borderArray = explode(' ', $styleValue);
            $borderCount = count($borderArray);
            if ($borderCount >= 3) {
                $borderStyle = $borderArray[1];
                $color = $borderArray[2];
            } else {
                $borderStyle = $borderArray[0];
                $color = $borderArray[1] ?? null;
            }
        }

        $cellStyle->applyFromArray([
            'borders' => [
                $type => [
                    'borderStyle' => $this->getBorderStyle($borderStyle),
                    'color' => ['rgb' => $this->getStyleColor($color)],
                ],
            ],
        ]);
    }
}


text:
using System;
using System.Runtime.Serialization;

namespace Core.Workspace
{
    [DataContract(Name = "SolutionId", Namespace = "http://davenport.edu")]
    public class SolutionId
    {
        public SolutionId()
        {
            Id = Guid.NewGuid();
        }

        /// <summary>
        /// Create a new SolutionId
        /// </summary>
        /// <param name="path"></param>
        /// <param name="name"></param>
        public SolutionId(string path, string name) : this(Guid.NewGuid(), path, name)
        {

        }

        public SolutionId(Guid id, string path, string name)
        {
            Id = id;
            Path = path;
            Name = name;
        }

        /// <summary>
        /// Identifier
        /// </summary>
        /// <returns>Guid</returns>
        [DataMember]
        public Guid Id { get; set; }

        /// <summary>
        /// The root directory of a solution
        /// </summary>
        /// <returns>string</returns>
        [DataMember]
        public string Path { get; set; }

        /// <summary>
        /// The name of the solution
        /// </summary>
        /// <returns>string</returns>
        [DataMember]
        public string Name { get; set; }
    }
}


text:
module.exports = {
  Model: require('./citation_reference.js'),
  View: require('../resource_reference/resource_reference_view.js')
};


text:
namespace Assertions
{
    using System;
    using System.Diagnostics;

    public class Utils
    {
        public static int FindMinElementIndex<T>(T[] arr, int startIndex, int endIndex)
            where T : IComparable<T>
        {
            Debug.Assert(arr != null, "Array is null!");
            Debug.Assert(arr.Length != 0, "Array is empty!");
            Debug.Assert(startIndex >= 0, "Start index is negative number!");
            Debug.Assert(startIndex <= arr.Length - 1, "Start index is out of range!");
            Debug.Assert(endIndex >= 0, "End index is negative number!");
            Debug.Assert(endIndex <= arr.Length - 1, "End index is out of range!");
            Debug.Assert(startIndex < endIndex, "Start index is bigger than end index!");

            int minElementIndex = startIndex;
            for (int i = startIndex + 1; i <= endIndex; i++)
            {
                if (arr[i].CompareTo(arr[minElementIndex]) < 0)
                {
                    minElementIndex = i;
                }
            }

            Debug.Assert(minElementIndex >= 0 && minElementIndex <= arr.Length - 1, "Result index out of range!");
            return minElementIndex;
        }

        public static void Swap<T>(ref T x, ref T y)
        {
            Debug.Assert(x != null, "First value is null!");
            Debug.Assert(y != null, "Second value is null!");

            T oldX = x;
            x = y;
            y = oldX;
        }
    }
}


text:
from __future__ import unicode_literals

from django.db import models, migrations
from django.conf import settings
import jsonfield.fields

class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='EmailNotification',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('sent', models.BooleanField(default=False)),
                ('account', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('name', models.TextField()),
                ('context', jsonfield.fields.JSONField()),
            ],
        ),
        migrations.CreateModel(
            name='SiteNotification',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('read', models.BooleanField(default=False)),
                ('account', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
                ('event', models.ForeignKey(to='event.Event')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='emailnotification',
            name='event',
            field=models.ForeignKey(to='event.Event'),
        ),
    ]


text:
package java.util;
public class NoSuchElementException extends java.lang.RuntimeException {
	public NoSuchElementException() { }
	public NoSuchElementException(java.lang.String var0) { }
}


text:
/**
 * JAX-RS JSON Provider.
 *
 * @author Richard Lucas
 */
package org.projectomakase.omakase.rest.provider;


text:
#include <string>
using std::string;

#include <cstddef>
using std::size_t;

// forward declaration of unscoped enum named intValues
enum intValues : unsigned long long; // unscoped, must specify a type
enum class open_modes;  // scoped enums can use int by default

enum class open_modes {input, output, append};

// input is an enumerator of open_modes
open_modes om = open_modes::input;

enum class intTypes {
	charTyp = 8, shortTyp = 16, intTyp = 16,
	longTyp = 32, long_longTyp = 64
};

constexpr intTypes charbits = intTypes::charTyp;

enum intValues : unsigned long long {
	charTyp = 255, shortTyp = 65535, intTyp = 65535,
	longTyp = 4294967295UL,
	long_longTyp = 18446744073709551615ULL
};

int main()
{
	enum color {red, yellow, green};      // unscoped enumeration
	enum class peppers {red, yellow, green}; // enumerators are hidden

	// unnamed, unscoped enum
	enum {floatPrec = 6, doublePrec = 10, double_doublePrec = 10};

	// enumerators are in scope for an unscoped enumeration
	color eyes = green;

	color hair = color::red;   // we can explicitly access the enumerators
	peppers p2 = peppers::red; // using red from peppers

	int i = color::red;   // unscoped enumerator implicitly converted to int

	// point2d is 2, point2w is 3, point3d is 3, point3w is 4
	enum class Points { point2d = 2, point2w,
	                    point3d = 3, point3w };

	return 0;
}


text:
namespace SLogLib {
;

// The NullFormatter class simply returns the user message and ignores all other fields in the
// message.
// By default NullFormatter doest insert new line after the message. To insert new lines after
// each message pass true to the constructor.
class NullFormatter : public AbstractFormatter
{
public:

	explicit NullFormatter(NewLine newLine = NewLine::No) noexcept
		: AbstractFormatter(newLine)
	{
	}

	inline std::string formatMessage(const Message& msg) const override
	{
		if(mNewLine == NewLine::Yes)
		{
			std::ostringstream _stream;
			_stream << msg.mUserMessage << std::endl;
			return _stream.str();
		}
		else
		{
			return msg.mUserMessage;
		}
	}
};

};	// End namespace SLogLib.

#endif // _SLOGLIB_NULLFORMATTER_H_


text:
<?php
  require('includes/application_top.php');
    $categories_string = '';
      $tree = array();

      $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
      while ($categories = tep_db_fetch_array($categories_query))  {
        $tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
                                                    'parent' => $categories['parent_id'],
                                                    'level' => 0,
                                                    'path' => $categories['categories_id'],
                                                    'next_id' => false);

        if (isset($parent_id)) {
          $tree[$parent_id]['next_id'] = $categories['categories_id'];
        }

        $parent_id = $categories['categories_id'];

        if (!isset($first_element)) {
          $first_element = $categories['categories_id'];
        }
      }

      if (tep_not_null($cPath)) {
        $new_path = '';
        reset($cPath_array);
        while (list($key, $value) = each($cPath_array)) {
          unset($parent_id);
          unset($first_id);
          $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
          if (tep_db_num_rows($categories_query)) {
            $new_path .= $value;
            while ($row = tep_db_fetch_array($categories_query)) {
              $tree[$row['categories_id']] = array('name' => $row['categories_name'],
                                                   'parent' => $row['parent_id'],
                                                   'level' => $key+1,
                                                   'path' => $new_path . '_' . $row['categories_id'],
                                                   'next_id' => false);

              if (isset($parent_id)) {
                $tree[$parent_id]['next_id'] = $row['categories_id'];
              }

              $parent_id = $row['categories_id'];

              if (!isset($first_id)) {
                $first_id = $row['categories_id'];
              }

              $last_id = $row['categories_id'];
            }
            $tree[$last_id]['next_id'] = $tree[$value]['next_id'];
            $tree[$value]['next_id'] = $first_id;
            $new_path .= '_';
          } else {
            break;
          }
        }
      }

      echo $categories_string;
?>


text:
ROOT = ../../../..

DIR = Pegasus/Server/ProviderRegistrationManager

include $(ROOT)/mak/config.mak

EXTRA_INCLUDES = $(SYS_INCLUDES)

LOCAL_DEFINES = -DPEGASUS_PRM_INTERNAL -DPEGASUS_INTERNALONLY

LIBRARY = pegprm

LIBRARIES = \
    pegcommon \
    pegprovider \
    pegrepository

SOURCES = \
    ProviderRegistrationTable.cpp \
    ProviderRegistrationManager.cpp

OBJECTS = $(SOURCES:.cpp=$(OBJ))

ifeq ($(PEGASUS_PLATFORM),WIN32_IX86_MSVC)
  SYS_LIBS = ws2_32.lib advapi32.lib
endif

include $(ROOT)/mak/library.mak


text:
struct logger_t {
	logger_config_t	    conf;
    std::mutex          lock;
    int			        last_err {0};
	string		        last_msg;
    dcs::logfile_t      logfile;
    dcs::logfile_t      errfile;
    bool                errfilt {false};
};

logger_config_t::logger_config_t() :max_roll(20),
max_msg_size(1024 * 1024), max_file_size(1024 * 1024 * 10) {
    lv = LOG_LVL_TRACE;
}
static	logger_t * g_default_logger = nullptr;
struct LoggerWriteTls {};
dcs::thread_local_storage<LoggerWriteTls, int>  thread_is_writing_log;
int    tls_flag_is_writing = 0; //dummy just for address is a flag
int    tls_flag_is_not_writing = 0; //dummy just for address is a flag

logger_t *		default_logger(){
    if (!g_default_logger){
        int ret = default_logger_init(logger_config_t());
        if(ret){
            fprintf(stderr, "default logger init error:%d", ret);
            return nullptr;
        }
    }
	return g_default_logger;
}
int				default_logger_init(const logger_config_t & conf){
	if (g_default_logger){
		default_logger_destroy();
		g_default_logger = nullptr;
	}
	g_default_logger = logger_create(conf);
	return g_default_logger ? 0 : -1;
}
void			default_logger_destroy(){
	if (!g_default_logger){
		return;
	}
	logger_destroy(g_default_logger);
	g_default_logger = nullptr;
}

logger_t *	logger_create(const logger_config_t & conf){
	logger_t * em = new logger_t();
    if (!em) {return nullptr;}
	em->last_msg.reserve(conf.max_msg_size);
	em->conf = conf;
    if(conf.path.empty() || conf.path == "stdout"){
        return em;
    }

    string log_all_filepath =  conf.path;
    if (log_all_filepath.find(".all.log") == string::npos) {
        log_all_filepath += ".all.log";
    }
    string log_err_filepath = log_all_filepath;
    log_err_filepath.replace(log_err_filepath.find(".all.log"), 8, ".err.log");

    //all log
    int ret = em->logfile.init(log_all_filepath.c_str(), conf.max_roll, conf.max_file_size);
    if (ret) {
        fprintf(stderr, "warn: init all log path:%s error:%d", log_all_filepath.c_str(), ret);
    }

    //error log
    if(log_all_filepath.find("://") == std::string::npos && !log_err_filepath.empty()){
        em->errfilt = true;
        ret = em->errfile.init(log_err_filepath.c_str(), conf.max_roll, conf.max_file_size);
        if (ret) {
            fprintf(stderr, "warn: init error log path:%s error:%d", log_err_filepath.c_str(), ret);
        }
    }
	return em;
}
bool            logger_try_lock(logger_t * logger){
    if (!logger) {
        return default_logger()->lock.try_lock();
    }
    return logger->lock.try_lock();
}
void            logger_lock(logger_t * logger){
    if (!logger){
        return default_logger()->lock.lock();
    }
    return logger->lock.lock();
}
void            logger_unlock(logger_t * logger){
    if (!logger){
        return default_logger()->lock.unlock();
    }
    return logger->lock.unlock();
}

void			logger_destroy(logger_t * logger){
	if (logger) {
		delete logger;
	}
}
void			logger_set_level(logger_t * logger, log_msg_level_type level){
	if (logger == nullptr){
		logger = default_logger();
	}
    if(logger){logger->conf.lv = level;}
}
int				logger_level(logger_t * logger){
	if (logger == nullptr){
		logger = default_logger();
	}
    if (logger) {return logger->conf.lv;}
	return LOG_LVL_INVALID;
}

//last msg
const char*		logger_msg(logger_t * logger){
	if (logger == nullptr){
		logger = default_logger();
	}
	return logger->last_msg.c_str();
}
//last err
int				logger_errno(logger_t * logger){
	if (logger == nullptr){
		logger = default_logger();
	}
    if(logger){
        return logger->last_err;
    }
    return 0;
}

int				logger_write(logger_t * logger, int loglv, int  sys_err_, const char* fmt, ...){
	if (logger == nullptr){
		logger = default_logger();
	}
    if(!logger){
        fprintf(stderr, "logger is null !");
        return -1;
    }
	if (loglv < logger->conf.lv){
		return 0;
	}
    int * writingp = thread_is_writing_log.get();
    if(writingp && writingp == &tls_flag_is_writing){
        fprintf(stderr, "doing logging but logging recursive logger:%p lv:%d pserr:%d fmt:[%s]!", logger, loglv, sys_err_, fmt);
        return -1;
    }
    thread_is_writing_log.set(&tls_flag_is_writing);//is writing
    logger_lock(logger);
	va_list ap;
	va_start(ap, fmt);
	int n = 0;
	logger->last_err = errno;
	char * msg_start = (char*)logger->last_msg.data();
	n = vsnprintf(msg_start, logger->last_msg.capacity() - 1, fmt, ap);
	va_end(ap);
	int available_size = logger->last_msg.capacity() - (n + 2);
	char errorno_msg_buff[128];
    if (sys_err_ != 0 && available_size > 64 && errno != 0){
		if (msg_start[n-1] == '\n'){
			--n;
		}
		n += snprintf(&msg_start[n], available_size, " [system errno:%d(%s)]\n", errno,
			strerror_r(errno, errorno_msg_buff, sizeof(errorno_msg_buff)-1));
		available_size = logger->last_msg.capacity() - (n + 2);
	}
	if (loglv == LOG_LVL_FATAL && available_size > 192){
		//append stack frame info
		string strstack;
		n += snprintf(&msg_start[n], available_size, "%s\n",
			dcs::stacktrace(strstack, 2, 16, nullptr, "\n"));
        available_size = logger->last_msg.capacity() - (n + 2);
	}
    msg_start[n] = 0;
    if (logger->logfile.write(msg_start, loglv)) {
        fputs(msg_start, stderr);
    }
    if(logger->errfilt){
        if (loglv == LOG_LVL_ERROR || loglv == LOG_LVL_FATAL) {
            logger->errfile.write(msg_start, loglv);
        }
    }
    ///////////////////////////////////////////////////////////////////////
    thread_is_writing_log.set(&tls_flag_is_not_writing);
    logger_unlock(logger);
	return n;
}


text:
package com.zimbra.soap.admin.message;

import com.google.common.base.Objects;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

import com.zimbra.common.soap.LDAPUtilsConstants;
import com.zimbra.soap.admin.type.AdminAttrsImpl;

/**
 * @zm-api-command-auth-required true
 * @zm-api-command-admin-auth-required true
 * @zm-api-command-description Modify an LDAP Entry
 */
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name=LDAPUtilsConstants.E_MODIFY_LDAP_ENTRIY_REQUEST)
public class ModifyLDAPEntryRequest extends AdminAttrsImpl {

    /**
     * @zm-api-field-tag ldap-DN-string
     * @zm-api-field-description a valid LDAP DN String (RFC 2253) that identifies the LDAP object
     */
    @XmlAttribute(name=LDAPUtilsConstants.E_DN /* dn */, required=true)
    private final String dn;

    /**
     * no-argument constructor wanted by JAXB
     */
    @SuppressWarnings("unused")
    private ModifyLDAPEntryRequest() {
        this((String) null);
    }

    public ModifyLDAPEntryRequest(String dn) {
        this.dn = dn;
    }

    public String getDn() { return dn; }

    public Objects.ToStringHelper addToStringInfo(
                Objects.ToStringHelper helper) {
        helper = super.addToStringInfo(helper);
        return helper
            .add("dn", dn);
    }

    @Override
    public String toString() {
        return addToStringInfo(Objects.toStringHelper(this))
                .toString();
    }
}


text:
<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\AdministratorSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Администраторы';
$this->params['breadcrumbs'][] = $this->title;
?>

<?= Html::encode($this->title) ?>

        <?= Html::a('Новый администратор', ['create'], ['class' => 'btn btn-success']) ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            'name',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>


text:
{% extends "templated_forms/enclosure/default.html" %}

{% block form_widget_content %}

{{ field.label }} {{ field.is_required }} {{ field.field.is_required }}
{% if static %}

email@example.com

{% else %}
<input type="{{ widget.type }}" name="{{ field.html_name }}" class="form-control" style="{{ widget.style }}"
       id="id_{{ field.name }}" placeholder="{% if field.initial %}{{ field.initial }}{% endif %}"
       {% if disabled %} disabled{% endif %}
       value="{% if field.value %}{{ field.value }}{% endif %}">

    {% if field.help_text %}{{ field.help_text }}{% endif %}
    {% for message in field.errors %}

{{ message }}

    {% endfor %}
{% endif %}
{% endblock %}