text:
/* Generated SBE (Simple Binary Encoding) message codec */
using System;
using System.Text;
using System.Collections.Generic;
using Adaptive.Agrona;

namespace Adaptive.Cluster.Codecs {

public class CanvassPositionDecoder
{
    public const ushort BLOCK_LENGTH = 28;
    public const ushort TEMPLATE_ID = 50;
    public const ushort SCHEMA_ID = 111;
    public const ushort SCHEMA_VERSION = 8;

    private CanvassPositionDecoder _parentMessage;
    private IDirectBuffer _buffer;
    protected int _offset;
    protected int _limit;
    protected int _actingBlockLength;
    protected int _actingVersion;

    public CanvassPositionDecoder()
    {
        _parentMessage = this;
    }

    public ushort SbeBlockLength()
    {
        return BLOCK_LENGTH;
    }

    public ushort SbeTemplateId()
    {
        return TEMPLATE_ID;
    }

    public ushort SbeSchemaId()
    {
        return SCHEMA_ID;
    }

    public ushort SbeSchemaVersion()
    {
        return SCHEMA_VERSION;
    }

    public string SbeSemanticType()
    {
        return "";
    }

    public IDirectBuffer Buffer()
    {
        return _buffer;
    }

    public int Offset()
    {
        return _offset;
    }

    public CanvassPositionDecoder Wrap(
        IDirectBuffer buffer, int offset, int actingBlockLength, int actingVersion)
    {
        this._buffer = buffer;
        this._offset = offset;
        this._actingBlockLength = actingBlockLength;
        this._actingVersion = actingVersion;
        Limit(offset + actingBlockLength);

        return this;
    }

    public int EncodedLength()
    {
        return _limit - _offset;
    }

    public int Limit()
    {
        return _limit;
    }

    public void Limit(int limit)
    {
        this._limit = limit;
    }

    public static int LogLeadershipTermIdId()
    {
        return 1;
    }

    public static int LogLeadershipTermIdSinceVersion()
    {
        return 0;
    }

    public static int LogLeadershipTermIdEncodingOffset()
    {
        return 0;
    }

    public static int LogLeadershipTermIdEncodingLength()
    {
        return 8;
    }

    public static string LogLeadershipTermIdMetaAttribute(MetaAttribute metaAttribute)
    {
        switch (metaAttribute)
        {
            case MetaAttribute.EPOCH: return "unix";
            case MetaAttribute.TIME_UNIT: return "nanosecond";
            case MetaAttribute.SEMANTIC_TYPE: return "";
            case MetaAttribute.PRESENCE: return "required";
        }

        return "";
    }

    public static long LogLeadershipTermIdNullValue()
    {
        return -9223372036854775808L;
    }

    public static long LogLeadershipTermIdMinValue()
    {
        return -9223372036854775807L;
    }

    public static long LogLeadershipTermIdMaxValue()
    {
        return 9223372036854775807L;
    }

    public long LogLeadershipTermId()
    {
        return _buffer.GetLong(_offset + 0, ByteOrder.LittleEndian);
    }

    public static int LogPositionId()
    {
        return 2;
    }

    public static int LogPositionSinceVersion()
    {
        return 0;
    }

    public static int LogPositionEncodingOffset()
    {
        return 8;
    }

    public static int LogPositionEncodingLength()
    {
        return 8;
    }

    public static string LogPositionMetaAttribute(MetaAttribute metaAttribute)
    {
        switch (metaAttribute)
        {
            case MetaAttribute.EPOCH: return "unix";
            case MetaAttribute.TIME_UNIT: return "nanosecond";
            case MetaAttribute.SEMANTIC_TYPE: return "";
            case MetaAttribute.PRESENCE: return "required";
        }

        return "";
    }

    public static long LogPositionNullValue()
    {
        return -9223372036854775808L;
    }

    public static long LogPositionMinValue()
    {
        return -9223372036854775807L;
    }

    public static long LogPositionMaxValue()
    {
        return 9223372036854775807L;
    }

    public long LogPosition()
    {
        return _buffer.GetLong(_offset + 8, ByteOrder.LittleEndian);
    }

    public static int LeadershipTermIdId()
    {
        return 3;
    }

    public static int LeadershipTermIdSinceVersion()
    {
        return 0;
    }

    public static int LeadershipTermIdEncodingOffset()
    {
        return 16;
    }

    public static int LeadershipTermIdEncodingLength()
    {
        return 8;
    }

    public static string LeadershipTermIdMetaAttribute(MetaAttribute metaAttribute)
    {
        switch (metaAttribute)
        {
            case MetaAttribute.EPOCH: return "unix";
            case MetaAttribute.TIME_UNIT: return "nanosecond";
            case MetaAttribute.SEMANTIC_TYPE: return "";
            case MetaAttribute.PRESENCE: return "required";
        }

        return "";
    }

    public static long LeadershipTermIdNullValue()
    {
        return -9223372036854775808L;
    }

    public static long LeadershipTermIdMinValue()
    {
        return -9223372036854775807L;
    }

    public static long LeadershipTermIdMaxValue()
    {
        return 9223372036854775807L;
    }

    public long LeadershipTermId()
    {
        return _buffer.GetLong(_offset + 16, ByteOrder.LittleEndian);
    }

    public static int FollowerMemberIdId()
    {
        return 4;
    }

    public static int FollowerMemberIdSinceVersion()
    {
        return 0;
    }

    public static int FollowerMemberIdEncodingOffset()
    {
        return 24;
    }

    public static int FollowerMemberIdEncodingLength()
    {
        return 4;
    }

    public static string FollowerMemberIdMetaAttribute(MetaAttribute metaAttribute)
    {
        switch (metaAttribute)
        {
            case MetaAttribute.EPOCH: return "unix";
            case MetaAttribute.TIME_UNIT: return "nanosecond";
            case MetaAttribute.SEMANTIC_TYPE: return "";
            case MetaAttribute.PRESENCE: return "required";
        }

        return "";
    }

    public static int FollowerMemberIdNullValue()
    {
        return -2147483648;
    }

    public static int FollowerMemberIdMinValue()
    {
        return -2147483647;
    }

    public static int FollowerMemberIdMaxValue()
    {
        return 2147483647;
    }

    public int FollowerMemberId()
    {
        return _buffer.GetInt(_offset + 24, ByteOrder.LittleEndian);
    }

    public override string ToString()
    {
        return AppendTo(new StringBuilder(100)).ToString();
    }

    public StringBuilder AppendTo(StringBuilder builder)
    {
        int originalLimit = Limit();
        Limit(_offset + _actingBlockLength);
        builder.Append("[CanvassPosition](sbeTemplateId=");
        builder.Append(TEMPLATE_ID);
        builder.Append("|sbeSchemaId=");
        builder.Append(SCHEMA_ID);
        builder.Append("|sbeSchemaVersion=");
        if (_parentMessage._actingVersion != SCHEMA_VERSION)
        {
            builder.Append(_parentMessage._actingVersion);
            builder.Append('/');
        }
        builder.Append(SCHEMA_VERSION);
        builder.Append("|sbeBlockLength=");
        if (_actingBlockLength != BLOCK_LENGTH)
        {
            builder.Append(_actingBlockLength);
            builder.Append('/');
        }
        builder.Append(BLOCK_LENGTH);
        builder.Append("):");
        //Token{signal=BEGIN_FIELD, name='logLeadershipTermId', referencedName='null', description='null', id=1, version=0, deprecated=0, encodedLength=0, offset=0, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
        //Token{signal=ENCODING, name='int64', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=8, offset=0, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=INT64, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
        builder.Append("LogLeadershipTermId=");
        builder.Append(LogLeadershipTermId());
        builder.Append('|');
        //Token{signal=BEGIN_FIELD, name='logPosition', referencedName='null', description='null', id=2, version=0, deprecated=0, encodedLength=0, offset=8, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
        //Token{signal=ENCODING, name='int64', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=8, offset=8, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=INT64, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
        builder.Append("LogPosition=");
        builder.Append(LogPosition());
        builder.Append('|');
        //Token{signal=BEGIN_FIELD, name='leadershipTermId', referencedName='null', description='null', id=3, version=0, deprecated=0, encodedLength=0, offset=16, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
        //Token{signal=ENCODING, name='int64', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=8, offset=16, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=INT64, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
        builder.Append("LeadershipTermId=");
        builder.Append(LeadershipTermId());
        builder.Append('|');
        //Token{signal=BEGIN_FIELD, name='followerMemberId', referencedName='null', description='null', id=4, version=0, deprecated=0, encodedLength=0, offset=24, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
        //Token{signal=ENCODING, name='int32', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=4, offset=24, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=INT32, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}}
        builder.Append("FollowerMemberId=");
        builder.Append(FollowerMemberId());

        Limit(originalLimit);

        return builder;
    }
}
}


text:
var sass = require('node-sass')
var fs = require('fs')
var path = require('path')

function transferSass () {
  sass.render({
    file: path.resolve(__dirname, '../src/index.scss'),
    outputStyle: 'compressed'
  }, function (err, result) {
    if (err) {
      console.log(err)
      return
    }
    fs.writeFile(path.resolve(__dirname, '../src/style.js'), "export default '" + result.css.toString().replace(/\n/g, '') + "'", function (err) {
      if (err) {
        console.error(err)
      }
      console.log('css file has been transformed success')
    })
  })
}

transferSass()

fs.watch(path.resolve(__dirname, '../src/index.scss'), function (event, filename) {
  console.log(event, filename)
  transferSass()
})

redpajama_set_name: RedPajamaGithub


text:
using System.Collections.Generic;
using System.Linq;

namespace Mixins
{
    /// <summary>
    /// Marker interface to specify a "Composite" object or a part of a "Composite" object
    /// </summary>
    public interface IComposite : ICloneable, IMapper { }

    /// <summary>
    /// We can compare composite mixins by value
    /// </summary>
    public static partial class Extensions
    {
        internal static bool EqualsByValueInternal(this IComposite self, IComposite other, IDictionary<IComposite, object> path)
        {
            if (self == null && other == null) return true;
            if (self == null || other == null) return false;

            if (self.GetMembers().Count() != other.GetMembers().Count())
            {
                return false;
            }

            path.Add(self, null);

            foreach (var member in self.GetMembers())
            {
                var value = self.GetProperty(member);
                var otherValue = other.GetProperty(member);

                var composite = value as IComposite;
                if (composite != null && path.ContainsKey(composite)) continue; // prevent circular refs

                var otherComposite = otherValue as IComposite;
                // Composite property
                if (composite != null && otherComposite != null && !composite.EqualsByValueInternal(otherComposite, path))
                {
                    return false;
                }
                var compositeList = value as IEnumerable<IComposite>;
                var otherCompositeList = otherValue as IEnumerable<IComposite>;
                // Composite list
                if (compositeList != null && otherCompositeList != null)
                {
                    if (compositeList.Count() != otherCompositeList.Count())
                    {
                        return false;
                    }
                    for (var i = 0; i < compositeList.Count(); i++)
                    {
                        var item = compositeList.ElementAt(i);
                        if (path.ContainsKey(item)) continue; // prevent circular refs
                        if (!item.EqualsByValueInternal(otherCompositeList.ElementAt(i), path)) return false;
                    }
                }
                // Simple property
                if (composite == null && compositeList == null && !Equals(value, otherValue))
                {
                    return false;
                }
            }
            return true;
        }

        public static bool EqualsByValue(this IComposite self, IComposite other)
        {
            return self.EqualsByValueInternal(other, new Dictionary<IComposite, object>());
        }
    }
}


text:
'use strict';

angular.module('mean.menu').config(['$stateProvider',
  function($stateProvider) {
    $stateProvider.state('menu example page', {
      url: '/menu/example',
      templateUrl: 'menu/views/index.html'
    });
  }
]);


text:
  Taillant est
       un village
       localisé dans le département de Charente-Maritime en Poitou-Charentes. Elle comptait 151 habitants en 2008.

Le parc de logements, à Taillant, était réparti en 2011 en zero appartements et 91 maisons soit
 un marché plutôt équilibré.

Si vous pensez emmenager à Taillant, vous pourrez aisément trouver une maison à acheter.

À coté de Taillant sont situées les communes de
Torxé localisée à 5 km, 231 habitants,
Fenioux localisée à 2 km, 120 habitants,
Saint-Savinien à 5 km, 2 384 habitants,
Voissay située à 5 km, 146 habitants,
Les Nouillers située à 4 km, 623 habitants,
Annepont localisée à 6 km, 276 habitants,
 entre autres. De plus, Taillant est située à seulement 17 km de Saintes.


text:
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

using System;
using System.Text;
using System.Threading.Tasks;

namespace CefSharp
{
    public interface IWebBrowser : IDisposable
    {
        /// <summary>
        /// Event handler for receiving Javascript console messages being sent from web pages.
        /// </summary>
        event EventHandler<ConsoleMessageEventArgs> ConsoleMessage;

        /// <summary>
        /// Event handler for changes to the status message.
        /// </summary>
        event EventHandler<StatusMessageEventArgs> StatusMessage;

        /// <summary>
        /// Event handler that will get called when the browser begins loading a frame. Multiple frames may be loading at the same
        /// time. Sub-frames may start or continue loading after the main frame load has ended. This method may not be called for a
        /// particular frame if the load request for that frame fails. For notification of overall browser load status use
        /// OnLoadingStateChange instead.
        /// </summary>
        event EventHandler<FrameLoadStartEventArgs> FrameLoadStart;

        /// <summary>
        /// Event handler that will get called when the browser is done loading a frame. Multiple frames may be loading at the same
        /// time. Sub-frames may start or continue loading after the main frame load has ended. This method will always be called
        /// for all frames irrespective of whether the request completes successfully.
        /// </summary>
        event EventHandler<FrameLoadEndEventArgs> FrameLoadEnd;

        /// <summary>
        /// Event handler that will get called when the resource load for a navigation fails or is canceled.
        /// </summary>
        event EventHandler<LoadErrorEventArgs> LoadError;

        /// <summary>
        /// Event handler that will get called when the Navigation state has changed (Maps to OnLoadingStateChange in Cef).
        /// This event will be fired twice. Once when loading is initiated either programmatically or
        /// by user action, and once when loading is terminated due to completion, cancellation of failure.
        /// </summary>
        event EventHandler<NavStateChangedEventArgs> NavStateChanged;

        /// <summary>
        /// Loads the specified URL.
        /// </summary>
        /// <param name="url">The URL to be loaded.</param>
        void Load(string url);

        /// <summary>
        /// Registers and loads a <see cref="ResourceHandler"/> that represents the HTML content.
        /// </summary>
        /// <remarks>
        /// `Cef` Native `LoadHtml` is unpredictable and only works sometimes, this method wraps
        /// the provided HTML in a <see cref="ResourceHandler"/> and loads the provided url using
        /// the <see cref="Load"/> method.
        /// Defaults to using <see cref="Encoding.UTF8"/> for character encoding
        /// The url must start with a valid schema, other uri's such as about:blank are invalid
        /// A valid example looks like http://test/page
        /// </remarks>
        /// <param name="html">The HTML content.</param>
        /// <param name="url">The URL that will be treated as the address of the content.</param>
        void LoadHtml(string html, string url);

        /// <summary>
        /// Registers and loads a <see cref="ResourceHandler"/> that represents the HTML content.
        /// </summary>
        /// <remarks>
        /// `Cef` Native `LoadHtml` is unpredictable and only works sometimes, this method wraps
        /// the provided HTML in a <see cref="ResourceHandler"/> and loads the provided url using
        /// the <see cref="Load"/> method.
        /// </remarks>
        /// <param name="html">The HTML content.</param>
        /// <param name="url">The URL that will be treated as the address of the content.</param>
        /// <param name="encoding">Character Encoding</param>
        void LoadHtml(string html, string url, Encoding encoding);

        /// <summary>
        /// Registers a Javascript object in this specific browser instance.
        /// </summary>
        /// <param name="name">The name of the object. (e.g. "foo", if you want the object to be accessible as window.foo).</param>
        /// <param name="objectToBind">The object to be made accessible to Javascript.</param>
        void RegisterJsObject(string name, object objectToBind);

        /// <summary>
        /// Execute some Javascript code in the context of this WebBrowser. As the method name implies, the script will be
        /// executed asynchronously, and the method therefore returns before the script has actually been executed.
        /// </summary>
        /// <param name="script">The Javascript code that should be executed.</param>
        void ExecuteScriptAsync(string script);

        /// <summary>
        /// Execute some Javascript code in the context of this WebBrowser, and return the result of the evaluation
        /// in an Async fashion
        /// </summary>
        /// <param name="script">The Javascript code that should be executed.</param>
        /// <param name="timeout">The timeout after which the Javascript code execution should be aborted.</param>
        /// /// <returns>A Task that can be awaited to perform the script execution</returns>
        Task<JavascriptResponse> EvaluateScriptAsync(string script, TimeSpan? timeout = null);

        /// <summary>
        /// Implement <see cref="IDialogHandler"/> and assign to handle dialog events.
        /// </summary>
        IDialogHandler DialogHandler { get; set; }

        /// <summary>
        /// Implement <see cref="IRequestHandler"/> and assign to handle events related to browser requests.
        /// </summary>
        IRequestHandler RequestHandler { get; set; }

        /// <summary>
        /// Implement <see cref="ILifeSpanHandler"/> and assign to handle events related to popups.
        /// </summary>
        ILifeSpanHandler LifeSpanHandler { get; set; }

        /// <summary>
        /// Implement <see cref="IKeyboardHandler"/> and assign to handle events related to key press.
        /// </summary>
        IKeyboardHandler KeyboardHandler { get; set; }

        /// <summary>
        /// Implement <see cref="IJsDialogHandler"/> and assign to handle events related to JavaScript Dialogs.
        /// </summary>
        IJsDialogHandler JsDialogHandler { get; set; }

        /// <summary>
        /// Implement <see cref="IDragHandler"/> and assign to handle events related to dragging.
        /// </summary>
        IDragHandler DragHandler { get; set; }

        /// <summary>
        /// Implement <see cref="IDownloadHandler"/> and assign to handle events related to downloading files.
        /// </summary>
        IDownloadHandler DownloadHandler { get; set; }

        /// <summary>
        /// Implement <see cref="IMenuHandler"/> and assign to handle events related to the browser context menu
        /// </summary>
        IMenuHandler MenuHandler { get; set; }

        /// <summary>
        /// Implement <see cref="IFocusHandler"/> and assign to handle events related to the browser component's focus
        /// </summary>
        IFocusHandler FocusHandler { get; set; }

        /// <summary>
        /// Implement <see cref="IResourceHandler"/> and control the loading of resources
        /// </summary>
        IResourceHandler ResourceHandler { get; set; }

        /// <summary>
        /// Implement <see cref="IGeolocationHandler"/> and assign to handle requests for permission to use geolocation.
        /// </summary>
        IGeolocationHandler GeolocationHandler { get; set; }

        /// <summary>
        /// A flag that indicates whether the WebBrowser is initialized (true) or not (false).
        /// </summary>
        /// <remarks>In the WPF control, this property is implemented as a Dependency Property and fully supports data
        /// binding.</remarks>
        bool IsBrowserInitialized { get; }

        /// <summary>
        /// A flag that indicates whether the control is currently loading one or more web pages (true) or not (false).
        /// </summary>
        /// <remarks>In the WPF control, this property is implemented as a Dependency Property and fully supports data
        /// binding.</remarks>
        bool IsLoading { get; }

        /// <summary>
        /// A flag that indicates whether the state of the control current supports the GoBack action (true) or not (false).
        /// </summary>
        /// <remarks>In the WPF control, this property is implemented as a Dependency Property and fully supports data
        /// binding.</remarks>
        bool CanGoBack { get; }

        /// <summary>
        /// A flag that indicates whether the state of the control currently supports the GoForward action (true) or not (false).
        /// </summary>
        /// <remarks>In the WPF control, this property is implemented as a Dependency Property and fully supports data
        /// binding.</remarks>
        bool CanGoForward { get; }

        /// <summary>
        /// A flag that indicates whether the state of the control currently supports the Reload action (true) or not (false).
        /// </summary>
        /// <remarks>In the WPF control, this property is implemented as a Dependency Property and fully supports data
        /// binding.</remarks>
        bool CanReload { get; }

        /// <summary>
        /// The address (URL) which the browser control is currently displaying.
        /// Will automatically be updated as the user navigates to another page (e.g. by clicking on a link).
        /// </summary>
        /// <remarks>In the WPF control, this property is implemented as a Dependency Property and fully supports data
        /// binding.</remarks>
        string Address { get; }

        /// <summary>
        /// The title of the web page being currently displayed.
        /// </summary>
        /// <remarks>In the WPF control, this property is implemented as a Dependency Property and fully supports data
        /// binding.</remarks>
        string Title { get; }

        /// <summary>
        /// The text that will be displayed as a ToolTip
        /// </summary>
        string TooltipText { get; }

        /// <summary>
        /// The zoom level at which the browser control is currently displaying. Can be set to 0 to clear the zoom level (resets to
        /// default zoom level).
        /// </summary>
        /// <remarks>In the WPF control, this property is implemented as a Dependency Property and fully supports data
        /// binding.</remarks>
        double ZoomLevel { get; set; }

        /// <summary>
        /// Search for text within the current page.
        /// </summary>
        /// <param name="identifier">Can be used in can conjunction with searchText to have multiple
        /// searches running simultaneously.</param>
        /// <param name="searchText">search text</param>
        /// <param name="forward">indicates whether to search forward or backward within the page.</param>
        /// <param name="matchCase">indicates whether the search should be case-sensitive. </param>
        /// <param name="findNext">indicates whether this is the first request or a follow-up.</param>
        void Find(int identifier, string searchText, bool forward, bool matchCase, bool findNext);

        /// <summary>
        /// Cancel all searches that are currently going on.
        /// </summary>
        /// <param name="clearSelection">clear the current search selection</param>
        void StopFinding(bool clearSelection);

        /// <summary>
        /// Navigates back, must check <see cref="CanGoBack"/> before calling this method.
        /// </summary>
        void Back();

        /// <summary>
        /// Navigates forward, must check <see cref="CanGoForward"/> before calling this method.
        /// </summary>
        void Forward();

        /// <summary>
        /// Stops loading the current page.
        /// </summary>
        void Stop();

        /// <summary>
        /// Retrieve the main frame's HTML source using a <see cref="Task{String}"/>.
        /// </summary>
        /// <returns><see cref="Task{String}"/> that when executed returns the frame source as a string</returns>
        Task<string> GetSourceAsync();

        /// <summary>
        /// Retrieve the main frame's display text using a <see cref="Task{String}"/>.
        /// </summary>
        /// <returns><see cref="Task{String}"/> that when executed returns the frame display text as a string.</returns>
        Task<string> GetTextAsync();

        /// <summary>
        /// Opens up a new program window (using the default text editor) where the source code of the currently displayed web
        /// page is shown.
        /// </summary>
        void ViewSource();

        /// <summary>
        /// Attempts to give focus to the IWpfWebBrowser control.
        /// </summary>
        /// <returns><c>true</c> if keyboard focus and logical focus were set to this element; <c>false</c> if only logical focus
        /// was set to this element, or if the call to this method did not force the focus to change.</returns>
        bool Focus();

        /// <summary>
        /// Reloads the page being displayed. This method will use data from the browser's cache, if available.
        /// </summary>
        void Reload();

        /// <summary>
        /// Reloads the page being displayed, optionally ignoring the cache (which means the whole page including all .css, .js
        /// etc. resources will be re-fetched).
        /// </summary>
        /// <param name="ignoreCache"><c>true</c> A reload is performed ignoring browser cache; <c>false</c> A reload is
        /// performed using files from the browser cache, if available.</param>
        void Reload(bool ignoreCache);

        /// <summary>
        /// Opens a Print Dialog which if used (can be user cancelled) will print the browser contents.
        /// </summary>
        void Print();

        /// <summary>
        /// Open developer tools in its own window.
        /// </summary>
        void ShowDevTools();

        /// <summary>
        /// Explicitly close the developer tools window if one exists for this browser instance.
        /// </summary>
        void CloseDevTools();

        /// <summary>
        /// If a misspelled word is currently selected in an editable node calling
        /// this method will replace it with the specified word.
        /// </summary>
        /// <param name="word">The new word that will replace the currently selected word.</param>
        void ReplaceMisspelling(string word);

        /// <summary>
        /// Add the specified word to the spelling dictionary.
        /// </summary>
        /// <param name="word">The new word that will be added to the dictionary.</param>
        void AddWordToDictionary(string word);

        /// <summary>
        /// Send a mouse wheel event to the browser.
        /// </summary>
        /// <param name="x">X-Axis coordinate relative to the upper-left corner of the view.</param>
        /// <param name="y">Y-Axis coordinate relative to the upper-left corner of the view.</param>
        /// <param name="deltaX">Movement delta for X direction.</param>
        /// <param name="deltaY">movement delta for Y direction.</param>
        void SendMouseWheelEvent(int x, int y, int deltaX, int deltaY);
    }
}


text:
	{% for device in gadget.gadgetsubdevice.all %}
		{% with device.subdevice as device %}

{% include device.model.include_template %}

		{% endwith %}
	{% endfor %}


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

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>RuleSetNotFoundException xref</title>
<link type="text/css" rel="stylesheet" href="../../../stylesheet.css" />

View Javadoc

1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd;
5
6   public class RuleSetNotFoundException extends Exception {
7       public RuleSetNotFoundException(String msg) {
8           super(msg);
9       }
10  }

This page was automatically generated by Maven


text:
<?php

namespace ImageOptim\Result;

use ImageOptim\Exception\ExceptionInvalidFile;

class FileResult {

    /**
     * File information object
     * @var \SplFileInfo
     */
    public $fileInfo;
    /**
     * Full image path: /tmp/logo.jpg
     * @var string
     */
    public $filePath;
    /**
     * Performed optimizations
     * @var OptimizationResult[]
     */
    public $optimizations = array();
    /**
     * @var int
     */
    public $exifImageType = false;
    /**
     * @var string
     */
    public $exifImageTypeExtension = "";
    /**
     * @var int
     */
    public $originalSize = 0;
    /**
     * @var int
     */
    public $optimizedSize = 0;
    /**
     * @var int
     */
    public $bytesOptimized = 0;
    /**
     * @var float
     */
    public $percentOptimized = 0.0;
    /**
     * Was optimized successfully?
     * @var bool
     */
    public $success;
    /**
     * Was the file ignored? (because not being an image)
     * @var bool
     */
    public $ignored;
    /**
     * Optimizer exception
     * @var \Exception
     */
    public $exception = null;

    public function __construct($filePath) {
        $this->filePath = $filePath;
        $this->fileInfo = new \SplFileInfo($this->filePath);
        if (!$this->fileInfo->isReadable() || !$this->fileInfo->isFile()) {
            $this->exception = new ExceptionInvalidFile("Path " . $filePath . " doesn't exists, it cannot be read or it's not a file");
        } elseif (!$this->fileInfo->isWritable()) {
            $this->exception = new ExceptionInvalidFile("Path " . $filePath . " is not writable");
        }
        $this->filePath = $this->fileInfo->getRealPath(); // Use realpath
    }

    /**
     * Is the file an image?
     * @return bool
     */
    public function isImage() {
        return $this->exifImageType > 0;
    }

}


text:
using System;
using System.Linq;
using System.Reflection;
using Autofac;
using NEasyMessaging.Contracts.Endpoint.Aop;
using NEasyMessaging.Contracts.Messaging;

namespace NEasyMessaging.Endpoint.Processing
{
    public class AopMethodExecution
    {
        private readonly HandlerAspectAttribute _handlerAspectAttribute;

        public AopMethodExecution(MemberInfo methodInfo, IComponentContext dependencyScope)
        {
            var handlerAspect = methodInfo.GetCustomAttributes().FirstOrDefault(attribute => attribute.GetType().IsSubclassOf(typeof(HandlerAspectAttribute)));

            if (handlerAspect != null)
            {
                _handlerAspectAttribute = (HandlerAspectAttribute)dependencyScope.Resolve(handlerAspect.GetType());
            }
        }

        public HandlerAspectExecution BeforeExecution(IMessage message, HandlerAspectExecution execution)
        {
            if (_handlerAspectAttribute != null)
            {
                _handlerAspectAttribute.BeforeExecution(message, execution);
            }

            return execution;
        }

        public void AfterSuccessfulExecution(IMessage message, object instance)
        {
            if (_handlerAspectAttribute != null)
            {
                _handlerAspectAttribute.AfterSuccessfulExecution(message, instance);
            }
        }

        public void AfterFailedExecution(IMessage message, object instance, Exception ex)
        {
            if (_handlerAspectAttribute != null)
            {
                _handlerAspectAttribute.AfterFailedExecution(message, instance, ex);
            }
        }
    }
}


text:
'''
util.py: frequently used terminal and text processing utilities
copyright (c) 2016 ~endorphant (endorphant@tilde.town)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'''
import random
import time
from six.moves import input
import os

import colorama
import inflect

## misc globals
BACKS = ['back', 'b', 'q', '<q>']
NAVS = ['u', 'd']

## color stuff
colorama.init()
textcolors = [ colorama.Fore.RED, colorama.Fore.GREEN, colorama.Fore.YELLOW, colorama.Fore.BLUE, colorama.Fore.MAGENTA, colorama.Fore.WHITE, colorama.Fore.CYAN]
lastcolor = colorama.Fore.RESET

p = inflect.engine()

def set_rainbow():
    '''
    prints a random terminal color code
    '''

    global lastcolor

    color = lastcolor
    while color == lastcolor:
        color = random.choice(textcolors)

    lastcolor = color

    print(color)

def reset_color():
    '''
    prints terminal color code reset
    '''

    print(colorama.Fore.RESET)

def attach_rainbow():
    '''
    returns a random terminal color code, presumably to be 'attached' to a string
    '''

    global lastcolor

    color = lastcolor
    while color == lastcolor:
        color = random.choice(textcolors)

    lastcolor = color
    return color

def attach_reset():
    '''
    returns terminal color code reset, presumably to be 'attached' to a string
    '''

    return colorama.Style.RESET_ALL

def hilight(text):
    '''
    takes a string and highlights it on return
    '''

    return colorama.Style.BRIGHT+text+colorama.Style.NORMAL

def rainbow(txt):
    '''
    Takes a string and makes every letter a different color.
    '''

    rainbow = ""
    for letter in txt:
        rainbow += attach_rainbow() + letter

    rainbow += attach_reset()

    return rainbow

def pretty_time(time):
    '''
    human-friendly time formatter

    takes an integer number of seconds and returns a phrase that describes it,
    using the largest possible figure, rounded down (ie, time=604 returns '10
    minutes', not '10 minutes, 4 seconds' or '604 seconds')
    '''

    m, s = divmod(time, 60)
    if m > 0:
        h, m = divmod(m, 60)
        if h > 0:
            d, h = divmod(h, 24)
            if d > 0:
                w, d = divmod(d, 7)
                if w > 0:
                    mo, w = divmod(w, 4)
                    if mo > 0:
                        return p.no("month", mo)
                    else:
                        return p.no("week", w)
                else:
                    return p.no("day", d)
            else:
                return p.no("hour", h)
        else:
            return p.no("minute", m)
    else:
        return p.no("second", s)

def genID(digits=5):
    '''
    returns a string-friendly string of digits, which can start with 0
    '''

    id = ""
    x  = 0
    while x < digits:
        id += str(random.randint(0,9))
        x += 1

    return id

def print_menu(menu, rainbow=False):
    '''
    A pretty menu handler that takes an incoming lists of
    options and prints them nicely.

    Set rainbow=True for colorized menus.
    '''

    i = 0
    for x in menu:
        line = []
        if rainbow is not False:
            line.append(attach_rainbow())
        line.append("\t[ ")
        if i < 10:
            line.append(" ")
        line.append(str(i)+" ] "+x)
        line.append(attach_reset())
        print("".join(line))
        i += 1

def list_select(options, prompt):
    '''
    Given a list and query prompt, returns either False as an
    eject flag, or an integer index of the list Catches cancel
    option from list defined by BACKS; otherwise, retries on
    ValueError or IndexError.
    '''

    ans = ""
    invalid = True

    choice = input("\n"+prompt)

    if choice in BACKS:
        return False

    if choice in NAVS:
        return choice

    try:
        ans = int(choice)
    except ValueError:
        return list_select(options, prompt)

    try:
        options[ans]
    except IndexError:
        return list_select(options, prompt)

    return ans

def input_yn(query):
    '''
    Given a query, returns boolean True or False by processing y/n input
    '''

    try:
        ans = input(query+" [y/n] ")
    except KeyboardInterrupt:
        input_yn(query)

    while ans not in ["y", "n"]:
        ans = input("'y' or 'n' please: ")

    return ans == "y"

def parse_date(file):
    '''
    parses date out of pre-validated filename

    * assumes a filename of YYYYMMDD.txt
    * returns a list:
      [0] 'YYYY'
      [1] 'MM'
      [2] 'DD'
    '''

    rawdate = os.path.splitext(os.path.basename(file))[0]

    date = [rawdate[0:4], rawdate[4:6], rawdate[6:]]

    return date


text:
package com.novicehacks.autobot.executor.ssh;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.io.IOException;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.ExpectedException;
import org.mockito.Mockito;

import ch.ethz.ssh2.Connection;
import ch.ethz.ssh2.ConnectionInfo;
import ch.ethz.ssh2.Session;

import com.novicehacks.autobot.categories.FunctionalTest;
import com.novicehacks.autobot.categories.UnitTest;
import com.novicehacks.autobot.executor.ssh.DefaultSSHConnection;
import com.novicehacks.autobot.executor.ssh.SSHConnection;
import com.novicehacks.autobot.executor.ssh.SSHSession;

public class DefaultSSHConnectionTest {

	private Session session;
	private Connection connection;
	private ConnectionInfo connectionInfo;
	private SSHConnection sshConnection;
	private DefaultSSHConnection.ConnectionFactory connectionFactory;

	private final String username = "abc";
	private final String password = "def";

	@Rule
	public ExpectedException exception = ExpectedException.none ();

	@Before
	public void setup() throws IOException {
		this.connection = mock (Connection.class);
		this.session = mock (Session.class);
		this.connectionInfo = mock (ConnectionInfo.class);
		this.connectionFactory = mock (DefaultSSHConnection.ConnectionFactory.class);
		this.sshConnection = new DefaultSSHConnection ("127.0.0.1", this.connectionFactory);
		when (this.connection.connect ()).thenReturn (this.connectionInfo);
		when (this.connection.connect (null, 0, 0)).thenReturn (this.connectionInfo);
		when (this.connection.openSession ()).thenReturn (this.session);
		when (this.connection.authenticateWithPassword (this.username, this.password)).thenReturn (
				true);
		when (this.connectionFactory.createConnection (Mockito.anyString ())).thenReturn (
				this.connection);
	}

	@Test
	@Category (UnitTest.class)
	public void invalidIPAddressWithDomainNameFormat() throws Exception {
		// when
		String ipAddress = "sf";
		// then Connection requested throws exception
		this.exception.expect (IllegalArgumentException.class);
		this.sshConnection = DefaultSSHConnection.getNewInstance (ipAddress);
	}

	@Test
	@Category (UnitTest.class)
	public void invalidIPAddressWitIPV6Format() throws Exception {
		// when
		String ipAddress = "1924.123.1.1";
		// then Connection requested throws exception
		this.exception.expect (IllegalArgumentException.class);
		this.sshConnection = DefaultSSHConnection.getNewInstance (ipAddress);
	}

	@Test
	@Category (UnitTest.class)
	public void invalidIPAddressWitIPV6Format2() throws Exception {
		// when
		String ipAddress = "192.123.1.1234";
		// then Connection requested throws exception
		this.exception.expect (IllegalArgumentException.class);
		this.sshConnection = DefaultSSHConnection.getNewInstance (ipAddress);
	}

	@Test
	@Category ({ UnitTest.class, FunctionalTest.class })
	public void connectTest() throws Exception {
		// when
		this.sshConnection.connect ();
		// then
		verify (this.connection).connect (null, 0, 0);
	}

	@Test
	@Category (UnitTest.class)
	public void connectWithTimeoutTest() throws Exception {
		// when
		this.sshConnection.connect (500, 500);
		// then
		verify (this.connection).connect (null, 500, 500);
	}

	@Test
	@Category (UnitTest.class)
	public void connectWhenRemoteExceptionTest() throws Exception {
		// given
		when (this.connection.connect (null, 0, 0)).thenThrow (new IOException ());
		// then
		this.exception.expect (IOException.class);
		this.sshConnection.connect ();
		verify (this.connection).connect (null, 0, 0);
	}

	@Test
	@Category ({ UnitTest.class, FunctionalTest.class })
	public void authenticateTest() throws Exception {
		// given
		this.sshConnection.connect ();
		verify (this.connection).connect (null, 0, 0);
		// when
		this.sshConnection.authenticateConnectionWithUsernameAndPassword (this.username,
				this.password);
		// then
		verify (this.connection).authenticateWithPassword (this.username, this.password);
	}

	@Test
	@Category (UnitTest.class)
	public void authenticateThrowsRemoteExceptionTest() throws Exception {
		// given
		this.sshConnection.connect ();
		when (this.connection.authenticateWithPassword (this.username, this.password)).thenThrow (
				new IOException ());
		// when connection available
		assertTrue ("Connection Should Not Exist", this.sshConnection.isConnectionAvailable ());
		// then
		this.exception.expect (IOException.class);
		this.sshConnection.authenticateConnectionWithUsernameAndPassword (this.username,
				this.password);
		verify (this.connection).authenticateWithPassword (this.username, this.password);
	}

	@Test
	@Category (UnitTest.class)
	public void authenticateBeforeConnectTest() throws Exception {
		// given
		verify (this.connection, never ()).connect (null, 0, 0);
		// when not connected,
		assertFalse ("Connection Should Not Exist", this.sshConnection.isConnectionAvailable ());
		// then authentication throws exception
		this.exception.expect (IllegalStateException.class);
		this.sshConnection.authenticateConnectionWithUsernameAndPassword (this.username,
				this.password);
	}

	@Test
	@Category (UnitTest.class)
	public void authenticateAfterDisconnectTest() throws Exception {
		// given
		this.sshConnection.connect ();
		this.sshConnection.disconnect ();
		// when
		verify (this.connection).connect (null, 0, 0);
		verify (this.connection).close ();
		assertFalse ("Connection Should Not Exist", this.sshConnection.isConnectionAvailable ());
		// then
		this.exception.expect (IllegalStateException.class);
		this.sshConnection.authenticateConnectionWithUsernameAndPassword (this.username,
				this.password);
		verify (this.connection, never ()).authenticateWithPassword (this.username, this.password);
	}

	@Test
	@Category ({ UnitTest.class, FunctionalTest.class })
	public void openSessionTest() throws Exception {
		SSHSession session;
		// given
		this.sshConnection.connect ();
		this.sshConnection.authenticateConnectionWithUsernameAndPassword (this.username,
				this.password);
		// when
		assertTrue ("Connection should have been available",
				this.sshConnection.isConnectionAvailable ());
		assertTrue ("Connection should have been available", this.sshConnection.isAuthenticated ());
		session = this.sshConnection.openSession ();
		// then
		verify (this.connection).openSession ();
		assertNotNull (session);
	}

	@Test
	@Category (UnitTest.class)
	public void openSessionBeforeConnectTest() throws Exception {
		SSHSession session;
		// when not connected
		verify (this.connection, never ()).connect (null, 0, 0);
		assertFalse ("Connection should have been available",
				this.sshConnection.isConnectionAvailable ());
		// then
		this.exception.expect (IllegalStateException.class);
		session = this.sshConnection.openSession ();
		verify (this.connection, never ()).openSession ();
		assertNull (session);
	}

	@Test
	@Category (UnitTest.class)
	public void openSessionBeforeAuthenticateTest() throws Exception {
		SSHSession session;
		// given
		// when not connected
		verify (this.connection, never ()).authenticateWithPassword (this.username, this.password);
		// then
		this.exception.expect (IllegalStateException.class);
		session = this.sshConnection.openSession ();
		verify (this.connection).openSession ();
		assertNotNull (session);
	}

	@Test
	@Category (UnitTest.class)
	public void openSessionWhenRemoteExceptionTest() throws Exception {

		// given
		SSHSession session;
		when (this.connection.openSession ()).thenThrow (new IOException ());
		// when not connected
		this.sshConnection.connect ();
		this.sshConnection.authenticateConnectionWithUsernameAndPassword (this.username,
				this.password);
		verify (this.connection).connect (null, 0, 0);
		verify (this.connection).authenticateWithPassword (this.username, this.password);
		// then
		this.exception.expect (IOException.class);
		session = this.sshConnection.openSession ();
		verify (this.connection).openSession ();
		assertNotNull (session);
	}

	@Test
	@Category ({ UnitTest.class, FunctionalTest.class })
	public void disconnectTest() throws Exception {
		// given
		this.sshConnection.connect ();
		assertTrue ("Connection Should Not Exist", this.sshConnection.isConnectionAvailable ());
		// when
		this.sshConnection.disconnect ();
		// then
		verify (this.connection).connect (null, 0, 0);
		verify (this.connection).close ();
	}

	@Test
	@Category (UnitTest.class)
	public void disconnectBeforeConnect() throws Exception {
		// when not connected,
		verify (this.connection, never ()).connect (null, 0, 0);
		assertFalse ("Connection Should Not Exist", this.sshConnection.isConnectionAvailable ());
		// then disconnect throws exception
		this.exception.expect (IllegalStateException.class);
		this.sshConnection.disconnect ();
		verify (this.connection, never ()).close ();
	}

}


text:
"""CoolMasterNet platform to control of CoolMasterNet Climate Devices."""
import logging
from typing import Any

from homeassistant.components.climate import (
    ClimateEntity,
    ClimateEntityFeature,
    HVACMode,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity

from .const import CONF_SUPPORTED_MODES, DATA_COORDINATOR, DATA_INFO, DOMAIN

CM_TO_HA_STATE = {
    "heat": HVACMode.HEAT,
    "cool": HVACMode.COOL,
    "auto": HVACMode.HEAT_COOL,
    "dry": HVACMode.DRY,
    "fan": HVACMode.FAN_ONLY,
}

HA_STATE_TO_CM = {value: key for key, value in CM_TO_HA_STATE.items()}

FAN_MODES = ["low", "med", "high", "auto"]

_LOGGER = logging.getLogger(__name__)

def _build_entity(coordinator, unit_id, unit, supported_modes, info):
    _LOGGER.debug("Found device %s", unit_id)
    return CoolmasterClimate(coordinator, unit_id, unit, supported_modes, info)

async def async_setup_entry(
    hass: HomeAssistant,
    config_entry: ConfigEntry,
    async_add_devices: AddEntitiesCallback,
) -> None:
    """Set up the CoolMasterNet climate platform."""
    supported_modes = config_entry.data.get(CONF_SUPPORTED_MODES)
    info = hass.data[DOMAIN][config_entry.entry_id][DATA_INFO]

    coordinator = hass.data[DOMAIN][config_entry.entry_id][DATA_COORDINATOR]

    all_devices = [
        _build_entity(coordinator, unit_id, unit, supported_modes, info)
        for (unit_id, unit) in coordinator.data.items()
    ]

    async_add_devices(all_devices)

class CoolmasterClimate(CoordinatorEntity, ClimateEntity):
    """Representation of a coolmaster climate device."""

    _attr_supported_features = (
        ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE
    )

    def __init__(self, coordinator, unit_id, unit, supported_modes, info):
        """Initialize the climate device."""
        super().__init__(coordinator)
        self._unit_id = unit_id
        self._unit = unit
        self._hvac_modes = supported_modes
        self._info = info

    @callback
    def _handle_coordinator_update(self):
        self._unit = self.coordinator.data[self._unit_id]
        super()._handle_coordinator_update()

    @property
    def device_info(self) -> DeviceInfo:
        """Return device info for this device."""
        return DeviceInfo(
            identifiers={(DOMAIN, self.unique_id)},
            manufacturer="CoolAutomation",
            model="CoolMasterNet",
            name=self.name,
            sw_version=self._info["version"],
        )

    @property
    def unique_id(self):
        """Return unique ID for this device."""
        return self._unit_id

    @property
    def name(self):
        """Return the name of the climate device."""
        return self.unique_id

    @property
    def temperature_unit(self) -> str:
        """Return the unit of measurement."""
        if self._unit.temperature_unit == "celsius":
            return TEMP_CELSIUS

        return TEMP_FAHRENHEIT

    @property
    def current_temperature(self):
        """Return the current temperature."""
        return self._unit.temperature

    @property
    def target_temperature(self):
        """Return the temperature we are trying to reach."""
        return self._unit.thermostat

    @property
    def hvac_mode(self):
        """Return hvac target hvac state."""
        mode = self._unit.mode
        if not self._unit.is_on:
            return HVACMode.OFF

        return CM_TO_HA_STATE[mode]

    @property
    def hvac_modes(self):
        """Return the list of available operation modes."""
        return self._hvac_modes

    @property
    def fan_mode(self):
        """Return the fan setting."""
        return self._unit.fan_speed

    @property
    def fan_modes(self):
        """Return the list of available fan modes."""
        return FAN_MODES

    async def async_set_temperature(self, **kwargs: Any) -> None:
        """Set new target temperatures."""
        if (temp := kwargs.get(ATTR_TEMPERATURE)) is not None:
            _LOGGER.debug("Setting temp of %s to %s", self.unique_id, str(temp))
            self._unit = await self._unit.set_thermostat(temp)
            self.async_write_ha_state()

    async def async_set_fan_mode(self, fan_mode: str) -> None:
        """Set new fan mode."""
        _LOGGER.debug("Setting fan mode of %s to %s", self.unique_id, fan_mode)
        self._unit = await self._unit.set_fan_speed(fan_mode)
        self.async_write_ha_state()

    async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
        """Set new operation mode."""
        _LOGGER.debug("Setting operation mode of %s to %s", self.unique_id, hvac_mode)

        if hvac_mode == HVACMode.OFF:
            await self.async_turn_off()
        else:
            self._unit = await self._unit.set_mode(HA_STATE_TO_CM[hvac_mode])
            await self.async_turn_on()

    async def async_turn_on(self) -> None:
        """Turn on."""
        _LOGGER.debug("Turning %s on", self.unique_id)
        self._unit = await self._unit.turn_on()
        self.async_write_ha_state()

    async def async_turn_off(self) -> None:
        """Turn off."""
        _LOGGER.debug("Turning %s off", self.unique_id)
        self._unit = await self._unit.turn_off()
        self.async_write_ha_state()


text:
ORWTPP ; SLC/STAFF Personal Preference - Personal ; 3/11/08 6:34am
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**85,149,243**;Oct 24, 2000;Build 242
 ;
NEWLIST(VAL,LISTNAME,ORVIZ) ; RPC
 ; set current user's new personal list
 D NEWLIST^ORWTPL(.VAL,LISTNAME,DUZ,$G(ORVIZ))
 Q
 ;
DELLIST(OK,LISTNUM) ; RPC
 ; delete current user's personal list
 D DELLIST^ORWTPL(.OK,LISTNUM,DUZ)
 Q
 ;
SAVELIST(OK,PLIST,LISTNUM,ORVIZ) ; RPC
 ; save current user's personal list changes
 D SAVELIST^ORWTPL(.OK,.PLIST,LISTNUM,DUZ,$G(ORVIZ))
 Q
 ;
LSDEF(INFO) ; RPC
 ; get current user's list sources
 D LSDEF^ORWTPL(.INFO,DUZ)
 Q
 ;
SORTDEF(VALUE) ; RPC
 ; get current user's sort order
 D SORTDEF^ORWTPL(.VALUE,DUZ)
 Q
 ;
CLDAYS(INFO) ; RPC
 ; get current user's clinic defaults
 D CLDAYS^ORWTPL(.INFO,DUZ)
 Q
 ;
CLRANGE(INFO) ; RPC
 ; get current user's default clinic start, stop dates
 D CLRANGE^ORWTPL(.INFO,DUZ)
 Q
 ;
SAVECD(OK,INFO) ; RPC
 ; save current user's clinic defaults
 D SAVECD^ORWTPL(.OK,INFO,DUZ)
 Q
 ;
SAVEPLD(OK,INFO) ; RPC
 ; save current user's list selection defaults
 D SAVEPLD^ORWTPL(.OK,INFO,DUZ)
 Q
 ;
CSLAB(INFO) ; RPC
 ; get lab date range defaults
 D CSLAB^ORWTPO(.INFO,DUZ)
 Q
 ;
CSARNG(INFO) ; RPC
 ; get current user's start, stop defaults
 D CSARNG^ORWTPO(.INFO,DUZ)
 Q
 ;
SAVECS(OK,INFO) ; RPC
 ; save current user's date range defaults
 D SAVECS^ORWTPO(.OK,INFO,DUZ)
 Q
 ;
GETIMG(INFO) ; RPC
 ; get current user's image report defaults
 D GETIMG^ORWTPO(.INFO,DUZ)
 Q
 ;
SETIMG(OK,MAX,START,STOP) ; RPC
 ; save current user's image report defaults
 D SETIMG^ORWTPO(.OK,MAX,START,STOP,DUZ)
 Q
 ;
GETREM(VALUES) ; RPC
 ; get current user's reminders
 D GETREM^ORWTPR(.VALUES,DUZ)
 Q
 ;
SETREM(OK,VALUES) ; RPC
 ; set current user's reminders
 D SETREM^ORWTPR(.OK,.VALUES,DUZ)
 Q
 ;
GETOC(VALUES) ; RPC
 ; get current user's order checks
 D GETOC^ORWTPR(.VALUES,DUZ)
 Q
 ;
SAVEOC(OK,VALUES) ; RPC
 ; save current user's order checks
 D SAVEOC^ORWTPR(.OK,.VALUES,DUZ)
 Q
 ;
GETNOT(VALUES) ; RPC
 ; get current user's notifications
 D GETNOT^ORWTPR(.VALUES,DUZ)
 Q
 ;
SAVENOT(OK,VALUES) ; RPC
 ; save current user's notifications
 D SAVENOT^ORWTPR(.OK,.VALUES,DUZ)
 Q
 ;
CLEARNOT(OK) ; RPC
 ; clear current user's notifications
 D CLEARNOT^ORWTPR(.OK,DUZ)
 Q
 ;
GETNOTO(INFO) ; RPC
 ; get current user's other info for notifications
 D GETNOTO^ORWTPR(.INFO,DUZ)
 Q
 ;
CHKSURR(OK,SURR) ; RPC
 ; check if current user's surrogate is valid
 S OK=$$CHKSURR^ORWTPUA(DUZ,SURR)
 Q
 ;
GETSURR(INFO) ; RPC
 ; get current user's surrogate info
 D GETSURR^ORWTPR(.INFO,DUZ)
 Q
 ;
SAVESURR(OK,INFO) ; RPC
 ; save current user's surrogate info
 D SAVESURR^ORWTPR(.OK,INFO,DUZ)
 Q
 ;
SAVENOTO(OK,INFO) ; RPC
 ; save current user's notification info
 D SAVENOTO^ORWTPR(.OK,INFO,DUZ)
 Q
 ;
GETOTHER(INFO) ; RPC
 ; get user's other parameter settings
 D GETOTHER^ORWTPO(.INFO,DUZ)
 Q
 ;
SETOTHER(OK,INFO) ; RPC
 ; set current user's other parameter settings
 D SETOTHER^ORWTPO(.OK,INFO,DUZ)
 Q
 ;
GETSUB(VALUE) ; RPC
 ; get Ask for Subject on notes for current user
 D GETSUB^ORWTPN(.VALUE,DUZ)
 Q
 ;
GETCOS(VALUES,FROM,DIR,VISITORS) ; RPC
 ; get elgible cosigners for current user
 I '$G(VISITORS) S VISITORS=""
 D GETCOS^ORWTPN(.VALUES,DUZ,FROM,DIR,VISITORS)
 Q
 ;
GETDCOS(VALUE) ; RPC
 ; get default cosigner for current user
 D GETDCOS^ORWTPN(.VALUE,DUZ)
 Q
 ;
SETDCOS(OK,VALUE) ; RPC
 ; set default cosigner for current user
 D SETDCOS^ORWTPN(.OK,VALUE,DUZ)
 Q
 ;
SETSUB(OK,VALUE) ; RPC
 ; set Ask for Subject on note for current user
 D SETSUB^ORWTPN(.OK,VALUE,DUZ)
 Q
 ;
GETTU(VALUES,CLASS) ; RPC
 ; get titles for current user
 D GETTU^ORWTPN(.VALUES,CLASS,DUZ)
 Q
 ;
GETTD(VALUE,CLASS) ; RPC
 ; get default title for current user
 D GETTD^ORWTPN(.VALUE,CLASS,DUZ)
 Q
 ;
SAVET(OK,CLASS,DEFAULT,VALUES) ; RPC
 ; save titles for current user
 D SAVET^ORWTPN(.OK,CLASS,DEFAULT,.VALUES,DUZ)
 Q
 ;
PLISTS(VALUES) ; RPC
 ; get current user's personal lists
 D PLISTS^ORWTPT(.VALUES,DUZ)
 Q
 ;
PLTEAMS(VALUES) ; RPC
 ; get current user's teams and personal lists
 D PLTEAMS^ORWTPT(.VALUES,DUZ)
 Q
 ;
TEAMS(VALUES) ; RPC
 ; get teams for current user
 D TEAMS^ORWTPT(.VALUES,DUZ)
 Q
 ;
ADDLIST(OK,VALUE) ; RPC
 ; adds current user to a team
 D ADDLIST^ORWTPT(.OK,VALUE,DUZ)
 Q
 ;
REMLIST(OK,VALUE) ; RPC
 ; removes current user from a team
 D REMLIST^ORWTPT(.OK,VALUE,DUZ)
 Q
 ;
GETCOMBO(VALUES) ; RPC
 ; get current user's combo list definition
 D GETCOMBO^ORWTPT(.VALUES,DUZ)
 Q
 ;
SETCOMBO(OK,VALUES) ; RPC
 ; set current user's combo list definition
 D SETCOMBO^ORWTPT(.OK,.VALUES,DUZ)
 Q


text:
package org.blueoxygen.cimande.core;

import javax.persistence.Embedded;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import org.hibernate.annotations.GenericGenerator;
import org.meruvian.yama.core.DefaultPersistence;

@MappedSuperclass
public class CimandeJpaPersistence implements DefaultPersistence {
	protected String id;
	protected CimandeJpaLogInformation logInformation = new CimandeJpaLogInformation();

	@Id()
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid2")
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Embedded
	public CimandeJpaLogInformation getLogInformation() {
		return logInformation;
	}

	public void setLogInformation(CimandeJpaLogInformation logInformation) {
		this.logInformation = logInformation;
	}
}


text:
// Copyright 2018 The Bazel Authors. All rights reserved.
//
// 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.

package com.google.devtools.build.skydoc.rendering;

import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.syntax.BaseFunction;
import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.RuleInfo;

/** Stores information about a skylark rule definition. */
public class RuleInfoWrapper {

  private final BaseFunction identifierFunction;
  private final Location location;
  // Only the Builder is passed to RuleInfoWrapper as the rule name is not yet available.
  private final RuleInfo.Builder ruleInfo;

  public RuleInfoWrapper(
      BaseFunction identifierFunction, Location location, RuleInfo.Builder ruleInfo) {
    this.identifierFunction = identifierFunction;
    this.location = location;
    this.ruleInfo = ruleInfo;
  }

  public BaseFunction getIdentifierFunction() {
    return identifierFunction;
  }

  public Location getLocation() {
    return location;
  }

  public RuleInfo.Builder getRuleInfo() {
    return ruleInfo;
  }
}


text:
<?php
class Noticias extends CActiveRecord
{
    private $connection;
    public $titulo;
    public $des;

    public function __construct()
    {
        //Yii::app()->db->connectionString
        $this->connection=new CDbConnection(Yii::app()->db->connectionString,Yii::app()->db->username,Yii::app()->db->password);
        $this->connection->active=true;
    }
    public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
    public function getNoticias()
    {
        $sql="select id,titulo,descripcion,fecha from noticias;";
        //$dataReader=$this->connection->createCommand($sql)->query();

        $rows=$this->connection->createCommand($sql)->queryAll();
        return $rows;
    }
    public function rules()
    {
        return array
        (
            array("titulo","ext.NoticiasValidation","valor"=>'Título'),
            array("des","required")
        );
    }
    public function insert()
    {
        $sql="INSERT INTO noticias (titulo, descripcion,fecha) VALUES(?,?,now())";
        $command=$this->connection->createCommand($sql);
        // reemplaza el marcador de posición ":username" con el valor real de username
        $command-> bindValue(1,$_POST["Noticias"]["titulo"],PDO::PARAM_STR);
        // reemplaza el marcador de posición ":email" con el valor real de email
        $command-> bindValue(2,$_POST["Noticias"]["des"],PDO::PARAM_STR);

        $command->execute();
        return true;
    }
}


text:
Active Admin

        Documentation
        Try It Now!
        Get the Code


text:
/**
 * Generated by Agitar build: AgitarOne Version 6.0.0.000018 (Build date: Sep 06, 2013) [6.0.0.000018]
 * JDK Version: 1.6.0_14
 *
 * Generated on 2014-3-11 13:31:10
 * Time to generate: 00:11.422 seconds
 *
 *
 * agitar.src.md5=com.huawei.ism.openapi.nas.filesystem.FileSystemQuery:e0ea423cca6cb81f2cfefcc2f58c91b4
 * agitar.src.md5=com.huawei.ism.openapi.common.batchquery.QueryBase:f63d4febf06763dd4c3d64f304793100
 *
 */

package com.huawei.ism.openapi.nas.filesystem;

import com.agitar.lib.junit.AgitarTestCase;
import com.huawei.ism.openapi.common.model.MO;
import org.json.JSONObject;

public class FileSystemQueryAgitarTest extends AgitarTestCase {

    public Class getTargetClass()  {
        return FileSystemQuery.class;
    }

    public void testConstructor() throws Throwable {
        FileSystemMO mo = new FileSystemMO();
        FileSystemQuery fileSystemQuery = new FileSystemQuery(mo, 100L, 1000L);
        assertEquals("fileSystemQuery.getCount()", 1000L, fileSystemQuery.getCount());
        assertEquals("fileSystemQuery.getBeginIndex()", 100L, fileSystemQuery.getBeginIndex());
        assertSame("fileSystemQuery.mo", mo, getPrivateField(fileSystemQuery, "mo"));
    }

    public void testGetFileSystemMO() throws Throwable {
        FileSystemMO result = new FileSystemQuery(null, 100L, 1000L).getFileSystemMO();
        assertNull("result", result);
    }

    public void testGetFileSystemMO1() throws Throwable {
        FileSystemMO mo = new FileSystemMO(new MO(new JSONObject()));
        FileSystemMO result = new FileSystemQuery(mo, 100L, 1000L).getFileSystemMO();
        assertSame("result", mo, result);
    }

    public void testSetQueryFileSystemMO() throws Throwable {
        FileSystemMO mo = new FileSystemMO();
        FileSystemQuery fileSystemQuery = new FileSystemQuery(mo, 100L, 1000L);
        fileSystemQuery.setQueryFileSystemMO(mo);
        assertSame("fileSystemQuery.mo", mo, getPrivateField(fileSystemQuery, "mo"));
    }
}


text:
package net.tridentsdk.server.packets.play.in;

import io.netty.buffer.ByteBuf;
import net.tridentsdk.event.player.PlayerCloseWindowEvent;
import net.tridentsdk.registry.Registered;
import net.tridentsdk.server.inventory.TridentInventory;
import net.tridentsdk.server.netty.ClientConnection;
import net.tridentsdk.server.netty.packet.InPacket;
import net.tridentsdk.server.netty.packet.Packet;
import net.tridentsdk.server.player.PlayerConnection;

/**
 * Packet sent by the client when closed a Inventory
 */
public class PacketPlayInPlayerCloseWindow extends InPacket {

    /**
     * Id of the inventory, 0 if player inventory
     */
    protected int id;

    @Override
    public int id() {
        return 0x0D;
    }

    @Override
    public Packet decode(ByteBuf buf) {
        this.id = (int) buf.readByte();

        return this;
    }

    public int getWindowId() {
        return this.id;
    }

    @Override
    public void handleReceived(ClientConnection connection) {
        TridentInventory window = (TridentInventory) Registered.inventories().fromId(id);
        PlayerCloseWindowEvent event = new PlayerCloseWindowEvent(window);

        Registered.events().fire(event);

        if (event.isIgnored()) {
            return;
        }

        if (window != null) {
            window.close(((PlayerConnection) connection).player(), false);
        }
    }
}


text:
/// <reference path='fourslash.ts' />

// @Filename: foo.ts
//// [|export function /*1*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}bar|]() { return "bar"; }|]

//// var x = import("./foo");
//// x.then(foo => {
////     foo./*2*/[|bar|]();
//// })

verify.baselineFindAllReferences('1', '2');
verify.rangesWithSameTextAreRenameLocations("bar");


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Xml.Serialization;

namespace Maileon.AddressCheck
{
    public enum Syntax
    {
        [XmlEnum("0")]
        Invalid = 0,
        [XmlEnum("1")]
        Valid = 1,
        [XmlEnum("2")]
        Decoded = 2
    }
}


text:
#include <assert.h>
#include <iostream>
#include "GIMPACT/gim_trimesh.h"

GUINT32 gim_trimesh_get_triangle_count(GIM_TRIMESH * trimesh)
{
    return trimesh->m_tri_index_buffer.m_element_count/3;
}

//! Creates the aabb set and the triangles cache
/*!

\param trimesh
\param vertex_array
\param triindex_array
\param transformed_reply If 1, then the m_transformed_vertices is a reply of the source vertices. Else it just be a reference to the original array.
\post it copies the arrays by reference, and creates the auxiliary data (m_aabbset,m_planes_cache_buffer)
*/
void gim_trimesh_create_from_arrays(GBUFFER_MANAGER_DATA buffer_managers[],
  GIM_TRIMESH * trimesh, GBUFFER_ARRAY * vertex_array, GBUFFER_ARRAY * triindex_array,char transformed_reply)
{
    assert(trimesh);
    assert(vertex_array);
    assert(triindex_array);
    gim_buffer_array_copy_ref(vertex_array,&trimesh->m_source_vertex_buffer);
    gim_buffer_array_copy_ref(triindex_array,&trimesh->m_tri_index_buffer);

    trimesh->m_mask = GIM_TRIMESH_NEED_UPDATE;//needs update
    //Create the transformed vertices
    if(transformed_reply==1)
    {
        trimesh->m_mask |= GIM_TRIMESH_TRANSFORMED_REPLY;
        gim_buffer_array_copy_value(vertex_array,
      buffer_managers,&trimesh->m_transformed_vertex_buffer,G_BUFFER_MANAGER_SYSTEM,G_MU_DYNAMIC_READ_WRITE);
    }
    else
    {
        gim_buffer_array_copy_ref(vertex_array,&trimesh->m_transformed_vertex_buffer);
    }
    //create the box set
    GUINT32 facecount = gim_trimesh_get_triangle_count(trimesh);

    gim_aabbset_alloc(&trimesh->m_aabbset,facecount);
    //create the planes cache
    GIM_DYNARRAY_CREATE_SIZED(GIM_TRIPLANES_CACHE,trimesh->m_planes_cache_buffer,facecount);
    //Create the bitset
    GIM_BITSET_CREATE_SIZED(trimesh->m_planes_cache_bitset,facecount);
    //Callback is 0
    trimesh->m_update_callback = 0;
    //set to identity
    IDENTIFY_MATRIX_4X4(trimesh->m_transform);
}

//! Create a trimesh from vertex array and an index array
/*!

\param trimesh An uninitialized GIM_TRIMESH  structure
\param vertex_array A buffer to a vec3f array
\param vertex_count
\param triindex_array
\param index_count
\param copy_vertices If 1, it copies the source vertices in another buffer. Else (0) it constructs a reference to the data.
\param copy_indices If 1, it copies the source vertices in another buffer. Else (0) it constructs a reference to the data.
\param transformed_reply If , then the m_transformed_vertices is a reply of the source vertices. Else it just be a reference to the original array.
*/
void gim_trimesh_create_from_data(GBUFFER_MANAGER_DATA buffer_managers[],
  GIM_TRIMESH * trimesh, vec3f * vertex_array, GUINT32 vertex_count,char copy_vertices,
  GUINT32 * triindex_array, GUINT32 index_count,char copy_indices,char transformed_reply)
{
    GBUFFER_ARRAY buffer_vertex_array;
    GBUFFER_ARRAY buffer_triindex_array;

    //Create vertices
    if(copy_vertices == 1)
    {
        gim_create_common_buffer_from_data(buffer_managers,
      vertex_array, vertex_count*sizeof(vec3f), &buffer_vertex_array.m_buffer_id);
    }
    else//Create a shared buffer
    {
        gim_create_shared_buffer_from_data(buffer_managers,
      vertex_array, vertex_count*sizeof(vec3f), &buffer_vertex_array.m_buffer_id);
    }
    GIM_BUFFER_ARRAY_INIT_TYPE(vec3f,buffer_vertex_array,buffer_vertex_array.m_buffer_id,vertex_count);

    //Create vertices
    if(copy_indices == 1)
    {
        gim_create_common_buffer_from_data(buffer_managers,
      triindex_array, index_count*sizeof(GUINT32), &buffer_triindex_array.m_buffer_id);
    }
    else//Create a shared buffer
    {
        gim_create_shared_buffer_from_data(buffer_managers,
      triindex_array, index_count*sizeof(GUINT32), &buffer_triindex_array.m_buffer_id);
    }
    GIM_BUFFER_ARRAY_INIT_TYPE(GUINT32,buffer_triindex_array,buffer_triindex_array.m_buffer_id,index_count);

    gim_trimesh_create_from_arrays(buffer_managers, trimesh,
    &buffer_vertex_array, &buffer_triindex_array,transformed_reply);

    ///always call this after create a buffer_array
    GIM_BUFFER_ARRAY_DESTROY(buffer_vertex_array);
    GIM_BUFFER_ARRAY_DESTROY(buffer_triindex_array);
}

//! Clears auxiliary data and releases buffer arrays
void gim_trimesh_destroy(GIM_TRIMESH * trimesh)
{
    gim_aabbset_destroy(&trimesh->m_aabbset);

    GIM_DYNARRAY_DESTROY(trimesh->m_planes_cache_buffer);
    GIM_DYNARRAY_DESTROY(trimesh->m_planes_cache_bitset);

    GIM_BUFFER_ARRAY_DESTROY(trimesh->m_transformed_vertex_buffer);
    GIM_BUFFER_ARRAY_DESTROY(trimesh->m_source_vertex_buffer);
    GIM_BUFFER_ARRAY_DESTROY(trimesh->m_tri_index_buffer);
}

//! Copies two meshes
/*!
\pre dest_trimesh shouldn't be created
\post dest_trimesh will be created
\param source_trimesh
\param dest_trimesh
\param copy_by_reference If 1, it attach a reference to the source vertices, else it copies the vertices
\param transformed_reply IF 1, then it forces the m_trasnformed_vertices to be  a reply of the source vertices
*/
void gim_trimesh_copy(GIM_TRIMESH * source_trimesh,
  GBUFFER_MANAGER_DATA dest_buffer_managers[], GIM_TRIMESH * dest_trimesh,
  char /*copy_by_reference*/, char transformed_reply)
{
/* -- trimesh can not be copied by reference until GBUFFER_MANAGER_DATA is rewritten
  to be thread safe and until it is moved back to global variables.
    if(copy_by_reference==1)
    {
        gim_trimesh_create_from_arrays(dest_trimesh, &source_trimesh->m_source_vertex_buffer, &source_trimesh->m_tri_index_buffer,transformed_reply);
    }
    else
*/
    {
        GBUFFER_ARRAY buffer_vertex_array;
        GBUFFER_ARRAY buffer_triindex_array;

        gim_buffer_array_copy_value(&source_trimesh->m_source_vertex_buffer,
      dest_buffer_managers,&buffer_vertex_array,G_BUFFER_MANAGER_SYSTEM,G_MU_DYNAMIC_READ_WRITE);

        gim_buffer_array_copy_value(&source_trimesh->m_tri_index_buffer,
      dest_buffer_managers,&buffer_triindex_array,G_BUFFER_MANAGER_SYSTEM,G_MU_DYNAMIC_READ_WRITE);

        gim_trimesh_create_from_arrays(dest_buffer_managers, dest_trimesh,
      &buffer_vertex_array, &buffer_triindex_array,transformed_reply);

        ///always call this after create a buffer_array
        GIM_BUFFER_ARRAY_DESTROY(buffer_vertex_array);
        GIM_BUFFER_ARRAY_DESTROY(buffer_triindex_array);
    }
}
//! Locks the trimesh for working with it
/*!
\post locks m_tri_index_buffer and m_transformed_vertex_buffer.
\param trimesh
*/
void gim_trimesh_locks_work_data(GIM_TRIMESH * trimesh)
{
    GINT32 res = 0;
    res=gim_buffer_array_lock(&trimesh->m_tri_index_buffer,G_MA_READ_ONLY);
    if (res != G_BUFFER_OP_SUCCESS)
      std::cerr << "Inavalid lock\n";
    assert(res==G_BUFFER_OP_SUCCESS);
    res=gim_buffer_array_lock(&trimesh->m_transformed_vertex_buffer,G_MA_READ_ONLY);
    if (res != G_BUFFER_OP_SUCCESS)
      std::cerr << "Inavalid lock\n";
    assert(res==G_BUFFER_OP_SUCCESS);
}

//! unlocks the trimesh
/*!
\post unlocks m_tri_index_buffer and m_transformed_vertex_buffer.
\param trimesh
*/
void gim_trimesh_unlocks_work_data(GIM_TRIMESH * trimesh)
{
    gim_buffer_array_unlock(&trimesh->m_tri_index_buffer);
    gim_buffer_array_unlock(&trimesh->m_transformed_vertex_buffer);
}

//! Returns 1 if the m_transformed_vertex_buffer is a reply of m_source_vertex_buffer
char gim_trimesh_has_tranformed_reply(GIM_TRIMESH * trimesh)
{
    if(trimesh->m_mask&GIM_TRIMESH_TRANSFORMED_REPLY) return 1;
    return 0;
}

//! Returns 1 if the trimesh needs to update their aabbset and the planes cache.
char gim_trimesh_needs_update(GIM_TRIMESH * trimesh)
{
    if(trimesh->m_mask&GIM_TRIMESH_NEED_UPDATE) return 1;
    return 0;
}

//! Change the state of the trimesh for force it to update
/*!
Call it after made changes to the trimesh.
\post gim_trimesh_need_update(trimesh) will return 1
*/
void gim_trimesh_post_update(GIM_TRIMESH * trimesh)
{
    trimesh->m_mask |= GIM_TRIMESH_NEED_UPDATE;
}

//kernel
#define MULT_MAT_VEC4_KERNEL(_mat,_src,_dst) MAT_DOT_VEC_3X4((_dst),(_mat),(_src))

//! Updates m_transformed_vertex_buffer
/*!
\pre m_transformed_vertex_buffer must be unlocked
*/
void gim_trimesh_update_vertices(GIM_TRIMESH * trimesh)
{
    if(gim_trimesh_has_tranformed_reply(trimesh) == 0) return; //Don't perform transformation

    //Vertices
    GBUFFER_ARRAY * psource_vertex_buffer = &trimesh->m_source_vertex_buffer;
    GBUFFER_ARRAY * ptransformed_vertex_buffer = &trimesh->m_transformed_vertex_buffer;
    //Temp transform
    mat4f transform;
    COPY_MATRIX_4X4(transform,trimesh->m_transform);

    GIM_PROCESS_BUFFER_ARRAY(transform,(*psource_vertex_buffer),(*ptransformed_vertex_buffer),MULT_MAT_VEC4_KERNEL,vec3f,vec3f);
}

//! Updates m_aabbset and m_planes_cache_bitset
/*!
\pre gim_trimesh_locks_work_data must be called before
*/
void gim_trimesh_update_aabbset(GIM_TRIMESH * trimesh)
{
    vec3f * transformed_vertices = GIM_BUFFER_ARRAY_POINTER(vec3f,trimesh->m_transformed_vertex_buffer,0);
    assert(transformed_vertices);

    GUINT32 * triangle_indices = GIM_BUFFER_ARRAY_POINTER(GUINT32,trimesh->m_tri_index_buffer,0);
    assert(triangle_indices);
    // box set
    aabb3f * paabb = trimesh->m_aabbset.m_boxes;
    GUINT32 triangle_count = gim_trimesh_get_triangle_count(trimesh);
    float * v1,*v2,*v3;
    GUINT32 i;
    for (i=0; i<triangle_count;i++)
    {
        v1 = &transformed_vertices[triangle_indices[0]][0];
        v2 = &transformed_vertices[triangle_indices[1]][0];
        v3 = &transformed_vertices[triangle_indices[2]][0];
        COMPUTEAABB_FOR_TRIANGLE((*paabb),v1,v2,v3);
        triangle_indices+=3;
        paabb++;
    }
    //Clear planes cache
    GIM_BITSET_CLEAR_ALL(trimesh->m_planes_cache_bitset);
    //Sorts set
    gim_aabbset_update(&trimesh->m_aabbset);
}

//! Updates the trimesh if needed
/*!
\post If gim_trimesh_needs_update returns 1, then it calls  gim_trimesh_update_vertices and gim_trimesh_update_aabbset
*/
void gim_trimesh_update(GIM_TRIMESH * trimesh)
{
    if(gim_trimesh_needs_update(trimesh)==0) return;
    gim_trimesh_update_vertices(trimesh);
    gim_trimesh_locks_work_data(trimesh);
    gim_trimesh_update_aabbset(trimesh);
    gim_trimesh_unlocks_work_data(trimesh);

    //Clear update flag
     trimesh->m_mask &= ~GIM_TRIMESH_NEED_UPDATE;
}

void gim_trimesh_set_tranform(GIM_TRIMESH * trimesh, mat4f transform)
{
    GREAL diff = 0.0f;
    float * originaltrans = &trimesh->m_transform[0][0];
    float * newtrans = &transform[0][0];
    GUINT32 i;
    for (i=0;i<16;i++)
    {
      diff += fabs(originaltrans[i]-newtrans[i]);
    }

//    if(IS_ZERO(diff)) return ;///don't need to update
    if(diff< 0.00001f) return ;///don't need to update

    COPY_MATRIX_4X4(trimesh->m_transform,transform);

    gim_trimesh_post_update(trimesh);
}

void gim_trimesh_get_triangle_data(GIM_TRIMESH * trimesh, GUINT32 triangle_index, GIM_TRIANGLE_DATA * tri_data)
{
    vec3f * transformed_vertices = GIM_BUFFER_ARRAY_POINTER(vec3f,trimesh->m_transformed_vertex_buffer,0);

    GUINT32 * triangle_indices = GIM_BUFFER_ARRAY_POINTER(GUINT32,trimesh->m_tri_index_buffer,triangle_index*3);

    //Copy the vertices
    VEC_COPY(tri_data->m_vertices[0],transformed_vertices[triangle_indices[0]]);
    VEC_COPY(tri_data->m_vertices[1],transformed_vertices[triangle_indices[1]]);
    VEC_COPY(tri_data->m_vertices[2],transformed_vertices[triangle_indices[2]]);

    //Get the planes
    GIM_TRIPLANES_CACHE * planes = GIM_DYNARRAY_POINTER(GIM_TRIPLANES_CACHE,trimesh->m_planes_cache_buffer);
    planes += triangle_index;

    //verify planes cache
    GUINT32 bit_eval;
    GIM_BITSET_GET(trimesh->m_planes_cache_bitset,triangle_index,bit_eval);
    if(bit_eval == 0)// Needs to calc the planes
    {
        //Calc the face plane
        TRIANGLE_PLANE(tri_data->m_vertices[0],tri_data->m_vertices[1],tri_data->m_vertices[2],planes->m_planes[0]);
        //Calc the edge 1
        EDGE_PLANE(tri_data->m_vertices[0],tri_data->m_vertices[1],(planes->m_planes[0]),(planes->m_planes[1]));

        //Calc the edge 2
        EDGE_PLANE(tri_data->m_vertices[1],tri_data->m_vertices[2],(planes->m_planes[0]),(planes->m_planes[2]));

        //Calc the edge 3
        EDGE_PLANE(tri_data->m_vertices[2],tri_data->m_vertices[0],(planes->m_planes[0]), (planes->m_planes[3]));

        //mark
        GIM_BITSET_SET(trimesh->m_planes_cache_bitset,triangle_index);
    }

    VEC_COPY_4((tri_data->m_planes.m_planes[0]),(planes->m_planes[0]));//face plane
    VEC_COPY_4((tri_data->m_planes.m_planes[1]),(planes->m_planes[1]));//edge1
    VEC_COPY_4((tri_data->m_planes.m_planes[2]),(planes->m_planes[2]));//edge2
    VEC_COPY_4((tri_data->m_planes.m_planes[3]),(planes->m_planes[3]));//edge3
}

void gim_trimesh_get_triangle_vertices(GIM_TRIMESH * trimesh, GUINT32 triangle_index, vec3f v1,vec3f v2,vec3f v3)
{
    vec3f * transformed_vertices = GIM_BUFFER_ARRAY_POINTER(vec3f,trimesh->m_transformed_vertex_buffer,0);

    GUINT32 * triangle_indices = GIM_BUFFER_ARRAY_POINTER(GUINT32,trimesh->m_tri_index_buffer,triangle_index*3);

    //Copy the vertices
    VEC_COPY(v1,transformed_vertices[triangle_indices[0]]);
    VEC_COPY(v2,transformed_vertices[triangle_indices[1]]);
    VEC_COPY(v3,transformed_vertices[triangle_indices[2]]);
}


text:
=======
History
=======
0.5.5
------------------

* fix for integer reverse picklist lookups
* fix for invoice markup
* fix for picklists that do not have parents

0.5.3
------------------

* support API version 1.6 with addition of connect params (defaults to v1.5)

0.5.2
------------------

* removed picklist module and documentation references updated to us picklists

0.5.0 (2017-10-24)
------------------

* bugfixes

0.4.9 (2017-05-08)
------------------

* url lookup using get_zone_info is now completed using the requests transport

0.4.1 (2016-12-18)
------------------

* currency symbol picklist on currency entity was causing create_picklist_module
  to fail to complete.  Currency entity is now excluded from default entity set.

0.4.0 (2016-11-04)
------------------

* at.picklists module added
* picklists module with child field picklists
* support files debug feature (saves XML sent and received)
* query now builds XML closer to the API example documentation
* query supports special chars like @ in condition values

0.3.4 (2016-07-07)
------------------

* Py3 marshallable no longer failing due to unicode conversion

0.3.3 (2016-07-07)
------------------

* Py3 marshallable no longer failing due to basestring comparison

0.3.2 (2016-07-07)
------------------

* Py3 queries no longer failing due to encoding with BOM

0.3.0 (2016-07-06)
------------------

* PyPI install missing requirements "future" fixed

0.2.0 (2016-07-01)
------------------

* Python 3 support

0.1.8 (2016-06-28)
------------------

* First proper release on PyPI.


text:
<?php

use app\func\Proc;
use kartik\file\FileInput;
use yii\bootstrap\ActiveForm;
use kartik\dynagrid\DynaGrid;
use yii\helpers\Url;

\Yii::$app->getView()->registerJsFile('@web/js/docfiles.js' . Proc::appendTimestampUrlParam(Yii::$app->basePath . '/web/js/docfiles.js'));

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

$this->title = 'Загруженные файлы';
$this->params['breadcrumbs'] = Proc::Breadcrumbs($this);
?>

    <?php $form = ActiveForm::begin(); ?>

    <?=
    $form->field($model, 'docFile')->widget(FileInput::classname(), [
        'pluginOptions' => [
            'uploadUrl' => Url::to(['Fregat/docfiles/create']),
            'dropZoneEnabled' => false,
            'previewZoomSettings' => [
                'image' => [
                    'width' => 'auto',
                    'height' => '100%',
                ],
            ],
        ],
        'pluginEvents' => [
            "fileuploaded" => 'function(event, data, previewId, index) { UploadedFiles("docfilesgrid", event, data); }'
        ]
    ]);
    ?>

    <?php ActiveForm::end(); ?>

    <?php
    $result = Proc::GetLastBreadcrumbsFromSession();
    $foreign = isset($result['dopparams']['foreign']) ? $result['dopparams']['foreign'] : '';

    echo DynaGrid::widget(Proc::DGopts([
        'options' => ['id' => 'docfilesgrid'],
        'columns' => Proc::DGcols([
            'columns' => [
                [
                    'attribute' => 'docfiles_ext',
                    'format' => 'raw',
                    'value' => 'docfiles_iconshow',
                    'contentOptions' => ['style' => 'width: 40px; text-align: center;'], // <-- right here
                    'filter' => false,
                ],
                [
                    'attribute' => 'docfiles_name',
                    'format' => 'raw',
                    'value' => 'docfiles_name_html',
                ],
                [
                    'attribute' => 'docfiles_hash',
                    'visible' => false,
                ],
            ],
            'buttons' => array_merge(
                empty($foreign) ? [] : [
                    'chooseajax' => ['Fregat/docfiles/assign-to-grid']
                ], Yii::$app->user->can('DocfilesEdit') ? [
                'deleteajax' => ['Fregat/docfiles/delete'],
            ] : []
            ),
        ]),
        'gridOptions' => [
            'dataProvider' => $dataProvider,
            'filterModel' => $searchModel,
            'panel' => [
                'heading' => ' ' . $this->title,
            ],
        ]
    ])); ?>


text:
#include "pugixml.hpp"

#include <iostream>

int main()
{
    pugi::xml_document doc;

    // get a test document
    doc.load("<project><name>test</name><version>1.1</version><public>yes</public></project>");

    pugi::xml_node project = doc.child("project");

    //[code_text_access
    std::cout << "Project name: " << project.child("name").text().get() << std::endl;
    std::cout << "Project version: " << project.child("version").text().as_double() << std::endl;
    std::cout << "Project visibility: " << (project.child("public").text().as_bool(/* def= */ true) ? "public" : "private") << std::endl;
    std::cout << "Project description: " << project.child("description").text().get() << std::endl;
    //]

    std::cout << std::endl;

    //[code_text_modify
    // change project version
    project.child("version").text() = 1.2;

    // add description element and set the contents
    // note that we do not have to explicitly add the node_pcdata child
    project.append_child("description").text().set("a test project");
    //]

    doc.save(std::cout);
}

// vim:et


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center">

    <ListView android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:drawSelectorOnTop="false"
        android:divider="@android:drawable/divider_horizontal_bright"
        android:fadingEdgeLength="16dip"/>
</LinearLayout>


text:
//	**************************************************************************************
//	File:			LeashProperties.cpp
//	By:				Arthur David Leather
//	Created:		12/02/98
//	Copyright		@1998 Massachusetts Institute of Technology - All rights reserved.
//	Description:	CPP file for LeashProperties.h. Contains variables and functions
//					for the Leash Properties Dialog Box
//
//	History:
//
//	MM/DD/YY	Inits	Description of Change
//	12/02/98	ADL		Original
//	**************************************************************************************

#include "stdafx.h"
#include "leash.h"
#include "LeashProperties.h"
#include "LeashMessageBox.h"
#include <leashinfo.h>
#include "lglobals.h"
#include "reminder.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CLeashProperties dialog

char CLeashProperties::timeServer[255] = {NULL};

CLeashProperties::CLeashProperties(CWnd* pParent /*=NULL*/)
	: CDialog(CLeashProperties::IDD, pParent)
{
    m_initMissingFiles = m_newMissingFiles = 0;
    dw_initMslsaImport = dw_newMslsaImport = 0;

	//{{AFX_DATA_INIT(CLeashProperties)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}

void CLeashProperties::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CLeashProperties)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CLeashProperties, CDialog)
	//{{AFX_MSG_MAP(CLeashProperties)
	ON_BN_CLICKED(IDC_BUTTON_LEASHINI_HELP2, OnHelp)
    ON_BN_CLICKED(IDC_CHECK_CREATE_MISSING_CFG, OnCheckMissingCfg)
    ON_BN_CLICKED(IDC_RESET_DEFAULTS, OnButtonResetDefaults)
    ON_BN_CLICKED(IDC_RADIO_MSLSA_IMPORT_OFF, OnRadioMslsaNever)
    ON_BN_CLICKED(IDC_RADIO_MSLSA_IMPORT_ON,  OnRadioMslsaAlways)
    ON_BN_CLICKED(IDC_RADIO_MSLSA_IMPORT_MATCH, OnRadioMslsaMatchingRealm)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLeashProperties message handlers

BOOL CLeashProperties::OnInitDialog()
{
	CDialog::OnInitDialog();

    pLeashGetTimeServerName(timeServer, TIMEHOST);
    SetDlgItemText(IDC_EDIT_TIME_SERVER, timeServer);

	if (getenv(TIMEHOST))
        GetDlgItem(IDC_EDIT_TIME_SERVER)->EnableWindow(FALSE);
    else
        GetDlgItem(IDC_STATIC_TIMEHOST)->ShowWindow(FALSE);

    CWinApp * pApp = AfxGetApp();
    if (pApp)
        m_initMissingFiles = m_newMissingFiles =
            pApp->GetProfileInt("Settings", "CreateMissingConfig", FALSE_FLAG);
    CheckDlgButton(IDC_CHECK_CREATE_MISSING_CFG, m_initMissingFiles);

    dw_initMslsaImport = dw_newMslsaImport = pLeash_get_default_mslsa_import();
    switch ( dw_initMslsaImport ) {
    case 0:
        CheckDlgButton(IDC_RADIO_MSLSA_IMPORT_OFF,TRUE);
        break;
    case 1:
        CheckDlgButton(IDC_RADIO_MSLSA_IMPORT_ON,TRUE);
        break;
    case 2:
        CheckDlgButton(IDC_RADIO_MSLSA_IMPORT_MATCH,TRUE);
        break;
    }

    return TRUE;
}

void CLeashProperties::OnOK()
{
	CString timeServer_;
	GetDlgItemText(IDC_EDIT_TIME_SERVER, timeServer_);

	if (getenv(TIMEHOST))
    {
        // Check system for TIMEHOST, just in case it gets set (somehow)
        MessageBox("Can't change the time host unless you remove it from the environment!",
                   "Error", MB_OK);
        return;
    }

    if( getenv("USEKRB4") !=  NULL)
    {
        MessageBox("Kerberos 4 ticket requests are being controlled by the environment"
                   "variable USEKRB4 instead of the registry. Leash cannot modify"
                   "the environment. Use the System control panel instead.",
                    "Leash", MB_OK);
        return;
    }

    if (SetRegistryVariable(TIMEHOST, timeServer_))
	{
		MessageBox("There was an error putting your entry into the Registry!",
                   "Error", MB_OK);
    }

    if ( m_initMissingFiles != m_newMissingFiles ) {
        CWinApp * pApp = AfxGetApp();
        if (pApp)
            pApp->WriteProfileInt("Settings", "CreateMissingConfig",
                                m_newMissingFiles ? TRUE_FLAG : FALSE_FLAG);

        if ( m_newMissingFiles )
            CLeashApp::ValidateConfigFiles();
    }

    if ( dw_initMslsaImport != dw_newMslsaImport ) {
		pLeash_set_default_mslsa_import(dw_newMslsaImport);
	}

	CDialog::OnOK();
}

void CLeashProperties::OnCheckMissingCfg()
{
    m_newMissingFiles = (BOOL)IsDlgButtonChecked(IDC_CHECK_CREATE_MISSING_CFG);
}

void CLeashProperties::OnRadioMslsaNever()
{
    dw_newMslsaImport = 0;
}

void CLeashProperties::OnRadioMslsaAlways()
{
    dw_newMslsaImport = 1;
}

void CLeashProperties::OnRadioMslsaMatchingRealm()
{
    dw_newMslsaImport = 2;
}

void CLeashProperties::OnHelp()
{
#ifdef CALL_HTMLHELP
    AfxGetApp()->HtmlHelp(HID_LEASH_PROPERTIES_COMMAND);
#else
    AfxGetApp()->WinHelp(HID_LEASH_PROPERTIES_COMMAND);
#endif
}

void CLeashProperties::OnButtonResetDefaults()
{
    if (IDYES != AfxMessageBox("You are about to reset all Leash settings to their default values!\n\nContinue?",
                                MB_YESNO))
        return;

    pLeash_reset_defaults();

    HKEY hKey;
    LONG rc;

    rc = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE\\MIT\\Leash32\\Settings",
                      0, KEY_WRITE, &hKey);
    if (rc)
        return;

    rc = RegDeleteValue(hKey, "AutoRenewTickets");
    rc = RegDeleteValue(hKey, "CreateMissingConfig");
    rc = RegDeleteValue(hKey, "DebugWindow");
    rc = RegDeleteValue(hKey, "LargeIcons");
    rc = RegDeleteValue(hKey, "TIMEHOST");
    rc = RegDeleteValue(hKey, "AfsStatus");
    rc = RegDeleteValue(hKey, "LowTicketAlarm");

    RegCloseKey(hKey);
}


text:
. /etc/include.properties
. $RDK_PATH/utils.sh
. /etc/device.properties
. /etc/env_setup.sh
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
logsFile=$LOG_PATH/ipSetupLogs.txt
wifi_interface=`getWiFiInterface`
interface=`getMoCAInterface`
ret=`checkWiFiModule`
if [ $ret == 1 ]; then
	echo "`/bin/timestamp` WIFI is enabled" >> $logsFile
	interface=$wifi_interface
fi

#:>$logsFile

#if [ -f $PERSISTENT_PATH/moca_interface ] ; then
#    interface=`cat $PERSISTENT_PATH/moca_interface`
#else
#    interface=eth1
#fi

while true;
do
#	echo "`/bin/timestamp` starting the ipsetup and gateway setup "   >> $logsFile
#	sh $RDK_PATH/ipSetup.sh
	sleep 15
	if [ ! -f /etc/os-release ]; then
		# We dont need this script in yocto since by the
		# time this script is done, moca ip is acquired.
		sleep 1
	fi
	process=`ps | grep gwConnNotify.sh  | grep -v grep `
	if [ "$process" != "" ]; then
		ps  | grep gwConnNotify.sh | grep -v grep | awk '{print $1}'| xargs kill -9
	fi
	if [ -f /tmp/gatewayConnected ] && [ -f /usr/local/bin/IARM_event_sender ]; then
		echo "`/bin/timestamp` sending gateway disconnected event" >> $logsFile
		if [ ! -f /etc/os-release ]; then
		    /usr/local/bin/IARM_event_sender GatewayConnEvent 0
		    /usr/local/bin/IARM_event_sender MocaStatusEvent 1
		else
		    /usr/bin/IARM_event_sender GatewayConnEvent 0
		    /usr/bin/IARM_event_sender MocaStatusEvent 1
		fi
		rm /tmp/gatewayConnected
	fi
        if [ -f /tmp/estb_ipv4 ]; then
            gatewayIP=`route -n | grep $interface | grep 'UG[ \t]' | awk '{print $2}'`
            gatewayIP=`route -n | grep 'UG[ \t]' | grep $interface | awk '{print $2}' | grep 169.254`
            gatewayIP=`echo $gatewayIP | head -n1 | awk '{print $1;}'`
            if [ "$KICKSTART" = "yes" ]; then
                    gatewayIP=`route -n | grep 'UG[ \t]' | awk '{print $2}'`
                    touch /tmp/gatewayConnected
            fi
            if [ "$gatewayIP" = "" ]; then
    #                echo "`/bin/timestamp` No gateway IP going to ipsetup "  >> $logsFile
                    echo "`/bin/timestamp` No gateway IP going to ipsetup "
            else
                    dnsmasq=`cat /etc/resolv.dnsmasq`
                    if [ "$dnsmasq" == "" ]; then
                            echo "`/bin/timestamp` DNS masq is not set Please check output.json for dns config ****  " >> $logsFile
                    fi
    #               sh /test.sh
                    ping -c 3 $gatewayIP   > /dev/null 2>/dev/null
                    while [  $? -eq 0 ];
                    do
                            if [ ! -f /tmp/gatewayConnected ]; then
                                    process=`ps | grep gwConnNotify  | grep -v grep `
                                    if [ "$process" = "" ]; then
                                            sh $RDK_PATH/gwConnNotify.sh &
                                            echo "`/bin/timestamp` Connected to Gateway  $gatewayIP  "  >> $logsFile
                                    fi
                            fi
                            sleep 15
                            ping -c 3 $gatewayIP    > /dev/null 2>/dev/null
                    done;

            fi
         elif [ -f /tmp/estb_ipv6 ]; then
            gatewayIP=`ip -6 route | grep $interface | awk '/default/ { print $3 }'`
            if [ "$KICKSTART" = "yes" ]; then
                    gatewayIP=`ip -6 route | awk '/default/ { print $3 }'`
                    touch /tmp/gatewayConnected
            fi
            if [ "$gatewayIP" = "" ]; then
                    sleep 5
            else
                    dnsmasq=`cat /etc/resolv.dnsmasq`
                    if [ "$dnsmasq" == "" ]; then
                            echo "`/bin/timestamp` DNS masq is not set Please check output.json for dns config ****  " >> $logsFile
                    fi
    #               sh /test.sh
                    ping6 -c 3 $gatewayIP   > /dev/null 2>/dev/null
                    while [  $? -eq 0 ];
                    do
                            if [ ! -f /tmp/gatewayConnected ]; then
                                    process=`ps | grep gwConnNotify  | grep -v grep `
                                    if [ "$process" = "" ]; then
                                            sh $RDK_PATH/gwConnNotify.sh &
                                            echo "`/bin/timestamp` Connected to Gateway  $gatewayIP  "  >> $logsFile
                                    fi
                            fi
                            sleep 15
                            ping6 -c 3 $gatewayIP    > /dev/null 2>/dev/null
                    done;

            fi
         else
            echo "`/bin/timestamp` Box is not configured in IPv4 or IPv6 mode yet..Wait & Retry..!" >> $logsFile
         fi

        if [ ! -f /tmp/rstXdiscovery ]; then
	    process=`ps | grep rstXdiscovery  | grep -v grep `
    	    if [ "$process" = "" ]; then
            	sh $RDK_PATH/rstXdiscovery.sh &
            fi
        fi
done


text:
package nl.tno.idsa.framework.semantics_impl.locations;

import nl.tno.idsa.framework.world.IGeometry;
import nl.tno.idsa.framework.world.Time;

// TODO Document class.

public class LocationAndTime {

    private IGeometry location;

    public static long UNDEFINED_TIME = -1;
    private long timeNanos;

    public LocationAndTime(IGeometry location) {
        this(location, UNDEFINED_TIME);
    }

    public LocationAndTime(IGeometry location, long timeNanos) {
        this.location = location;
        this.timeNanos = timeNanos;
    }

    public IGeometry getLocation() {
        return location;
    }

    public void setLocation(IGeometry location) {
        this.location = location;
    }

    public boolean isTimeDefined() {
        return timeNanos != UNDEFINED_TIME;
    }

    public long getTimeNanos() {
        return timeNanos;
    }

    public void setTimeNanos(long timeNanos) {
        this.timeNanos = timeNanos;
    }

    @Override
    public String toString() {
        if (timeNanos != UNDEFINED_TIME) {
            return String.format("@%s at %s", location, new Time(timeNanos));
        } else {
            return String.format("@%s", location);
        }

    }
}