text:
[![godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/op/go-logging) [![build](https://img.shields.io/travis/op/go-logging.svg?style=flat)](https://travis-ci.org/op/go-logging)

Package logging implements a logging infrastructure for Go. Its output format
is customizable and supports different logging backends like syslog, file and
memory. Multiple backends can be utilized with different log levels per backend
and logger.

## Example

Let's have a look at an [example](examples/example.go) which demonstrates most
of the features found in this library.

[![Example Output](examples/example.png)](examples/example.go)

```go
package main

import (
	"os"

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

var log = logging.MustGetLogger("example")

// Example format string. Everything except the message has a custom color
// which is dependent on the log level. Many fields have a custom output
// formatting too, eg. the time returns the hour down to the milli second.
var format = logging.MustStringFormatter(
	"%{color}%{time:15:04:05.000} %{shortfunc} ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}",
)

// Password is just an example type implementing the Redactor interface. Any
// time this is logged, the Redacted() function will be called.
type Password string

func (p Password) Redacted() interface{} {
	return logging.Redact(string(p))
}

func main() {
	// For demo purposes, create two backend for os.Stderr.
	backend1 := logging.NewLogBackend(os.Stderr, "", 0)
	backend2 := logging.NewLogBackend(os.Stderr, "", 0)

	// For messages written to backend2 we want to add some additional
	// information to the output, including the used log level and the name of
	// the function.
	backend2Formatter := logging.NewBackendFormatter(backend2, format)

	// Only errors and more severe messages should be sent to backend1
	backend1Leveled := logging.AddModuleLevel(backend1)
	backend1Leveled.SetLevel(logging.ERROR, "")

	// Set the backends to be used.
	logging.SetBackend(backend1Leveled, backend2Formatter)

	log.Debug("debug %s", Password("secret"))
	log.Info("info")
	log.Notice("notice")
	log.Warning("warning")
	log.Error("err")
	log.Critical("crit")
}
```

## Installing

### Using *go get*

    $ go get github.com/op/go-logging

After this command *go-logging* is ready to use. Its source will be in:

    $GOROOT/src/pkg/github.com/op/go-logging

You can use `go get -u` to update the package.

## Documentation

For docs, see http://godoc.org/github.com/op/go-logging or run:

    $ godoc github.com/op/go-logging

## Additional resources

* [wslog](https://godoc.org/github.com/cryptix/go/logging/wslog) -- exposes log messages through a WebSocket.


text:
from django.apps import AppConfig

class SausageGrinderConfig(AppConfig):
    name = 'sausage_grinder'

redpajama_set_name: RedPajamaGithub


text:
var mongoose = require('mongoose');
var dburl = 'mongodb://localhost:27017/meanhotel';

mongoose.connect(dburl, {
    useMongoClient: true,
});

mongoose.connection.on('connected', function() {
    console.log('Mongoose connected to ' + dburl);
});

mongoose.connection.on('disconnected', function() {
    console.log('Mongoose has disconnected');
});

mongoose.connection.on('error', function(err) {
    console.log('Mongoose connection error: ' + err);
});

// Cleanup
process.on('SIGINT', function() {
    mongoose.connection.close(function() {
        console.log('Mongoose disconnected through app termination (SIGINT)');
        process.exit(0);
    });
});

process.on('SIGTERM', function() {
    mongoose.connection.close(function() {
        console.log('Mongoose disconnected through app termination (SIGTERM)');
        process.exit(0);
    });
});

process.once('SIGUSR2', function() {
    mongoose.connection.close(function() {
        console.log('Mongoose disconnected through app termination (SIGUSR2)');
        process.kill(process.pid, 'SIGUSR2');
    });
});

// Bring in schemas and models
require('./hotels.model.js')


text:
<?php

namespace backend\controllers;

use Yii;
use common\models\Comercio;
use common\models\ComercioSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use backend\Code\Helpers;
use backend\filtros\AdminControl;

/**
 * ComerciosController implements the CRUD actions for Comercio model.
 */
class ComerciosController extends Controller
{
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'delete' => ['post'],
                ],
            ],
			'access' => [
				'class' => AdminControl::className(),
			]
        ];
    }

    /**
     * Lists all Comercio models.
     * @return mixed
     */
    public function actionIndex()
    {
        $searchModel = new ComercioSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }

    /**
     * Displays a single Comercio model.
     * @param integer $id
     * @return mixed
     */
    public function actionView($id)
    {
        return $this->render('view', [
            'model' => $this->findModel($id),
        ]);
    }

    /**
     * Creates a new Comercio model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
    public function actionCreate()
    {
        $model = new Comercio();

        $model->load(Yii::$app->request->post());

        if ($model->load(Yii::$app->request->post()))
        {
            $model->horario_desde = Helpers::FormatHours($model->horario_desde);
            $model->horario_hasta = Helpers::FormatHours($model->horario_hasta);
            if($model->save())
            {
                return $this->redirect(['view', 'id' => $model->id]);
            }
        }
        else
        {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }

    /**
     * Updates an existing Comercio model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id
     * @return mixed
     */
    public function actionUpdate($id)
    {
        $model = $this->findModel($id);

        if ($model->load(Yii::$app->request->post()))
        {
            $model->horario_desde = Helpers::FormatHours($model->horario_desde);
            $model->horario_hasta = Helpers::FormatHours($model->horario_hasta);
            if($model->save())
            {
                return $this->redirect(['view', 'id' => $model->id]);
            }
        }
        else
        {
            return $this->render('update', [
                'model' => $model,
            ]);
        }
    }

    /**
     * Deletes an existing Comercio model.
     * If deletion is successful, the browser will be redirected to the 'index' page.
     * @param integer $id
     * @return mixed
     */
    public function actionDelete($id)
    {
        $this->findModel($id)->delete();

        return $this->redirect(['index']);
    }

    /**
     * Finds the Comercio model based on its primary key value.
     * If the model is not found, a 404 HTTP exception will be thrown.
     * @param integer $id
     * @return Comercio the loaded model
     * @throws NotFoundHttpException if the model cannot be found
     */
    protected function findModel($id)
    {
        if (($model = Comercio::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
}


text:
@implementation animationModal

-(NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext{
    return 0.5;
}

-(void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext{

    UIView *containerView = [transitionContext containerView];
    UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey];
    UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey];
    [containerView insertSubview:toView atIndex:0];

    toView.alpha = 0.6;
    [UIView animateWithDuration:[self transitionDuration:nil]  animations:^{
        fromView.transform = CGAffineTransformMakeTranslation(fromView.bounds.size.width, 0);
        toView.alpha = 1;
    } completion:^(BOOL finished) {
        BOOL success = ![transitionContext transitionWasCancelled];
        [transitionContext completeTransition:success];
    }];
}

@end


text:
require_relative '../lookup'

module Performance
  module SubTasks
    module Lookups
      module WordsWithin
        class Compressed < Performance::SubTasks::Lookups::Lookup
          def initialize iterations = 100_000
            super iterations
          end

          def name
            'lookups:words_within:compressed'
          end

          def description
            'Lookups (compressed trie) - `words_within`'
          end

          def execute reporter_class
            trie = compressed_trie
            reporter = reporter_class.new filename

            reporter.report iterations, params do |word|
              trie.words_within(word).size
            end
          end

          private

          def params
            %w(ifdxawesome45someword3 ifdx45someword3awesome)
          end
        end
      end
    end
  end
end


text:
package source

import (
	"go/ast"
	"go/token"
	"path"
	"strings"
)

// Pkg captures a parsed Go source package
type Pkg struct {
	FileSet *token.FileSet          // File names are relative to SrcDir
	SrcDir  string                  // SrcDir/PkgPath = absolute local path to package directory
	PkgPath string                  // Package import path
	PkgAST  map[string]*ast.Package // Package name to package AST
	FileAST map[string]*ast.File
}

func (p *Pkg) link() {
	p.FileAST = make(map[string]*ast.File)
	for _, pkgAST := range p.PkgAST {
		for n, f := range pkgAST.Files {
			if _, ok := p.FileAST[n]; ok {
				panic("file in two packages")
			}
			p.FileAST[n] = f
		}
	}
}

func (p *Pkg) GetPkg(name string) *ast.Package {
	return p.PkgAST[name]
}

func (p *Pkg) LibPkg() *ast.Package {
	name := p.Name()
	for pkgName, pkg := range p.PkgAST {
		if pkgName == name {
			return pkg
		}
	}
	return nil
}

func (p *Pkg) MainPkg() *ast.Package {
	for pkgName, pkg := range p.PkgAST {
		if pkgName == "main" {
			return pkg
		}
	}
	return nil
}

func (p *Pkg) Name() string {
	_, name := path.Split(p.PkgPath)
	return name
}

func (p *Pkg) AddPkg(name string) *ast.Package {
	pkg, ok := p.PkgAST[name]
	if !ok {
		pkg = &ast.Package{
			Name:  name,
			Files: make(map[string]*ast.File),
		}
		p.PkgAST[name] = pkg
	}
	return pkg
}

func (p *Pkg) AddFile(pkgName, fileName string) *ast.File {
	if strings.Index(fileName, "/") >= 0 {
		panic("not a filename")
	}
	pkg := p.AddPkg(pkgName)

	filePath := path.Join(p.PkgPath, fileName)
	f, ok := pkg.Files[filePath]
	if !ok {
		ff := p.FileSet.AddFile(filePath, p.FileSet.Base(), 1)
		pos := ff.Pos(0)
		f = &ast.File{
			Package: pos,
			Name:    &ast.Ident{Name: pkgName},
		}
		pkg.Files[filePath] = f
	}

	return f
}


text:
        TEST::run_tests();                                                             \

void setUp(void){}

int main(int argc, char **argv)
{
    UNITY_BEGIN();

    RUN_TEST_GROUP(AlarmTest);
    RUN_TEST_GROUP(ButtonControlTest);
    RUN_TEST_GROUP(ServiceTest);

    UNITY_END();

    return 0;
}

#endif


text:
<?php namespace ZN\Request;
/**
 * ZN PHP Web Framework
 *
 * "Simplicity is the ultimate sophistication." ~ Da Vinci
 *
 * @package ZN
 * @license MIT [http://opensource.org/licenses/MIT]
 * @author  Ozan UYKUN [ozan@znframework.com]
 */

interface MethodInterface
{
    /**
     * Post
     *
     * @param string $name
     * @param mixed  $value
     *
     * @return mixed
     */
    public static function post(string $name, $value);

    /**
     * Get
     *
     * @param string $name
     * @param mixed  $value
     *
     * @return mixed
     */
    public static function get(string $name, $value);

    /**
     * Env
     *
     * @param string $name
     * @param mixed  $value
     *
     * @return mixed
     */
    public static function env(string $name, $value);

    /**
     * Server
     *
     * @param string $name
     * @param mixed  $value
     *
     * @return mixed
     */
    public static function server(string $name, $value);

    /**
     * Request
     *
     * @param string $name
     * @param mixed  $value
     *
     * @return mixed
     */
    public static function request(string $name, $value);

    /**
     * Files
     *
     * @param string $fileName
     * @param string $type
     *
     * @return mixed
     */
    public static function files(string $fileName, string $type);

    /**
     * Delete
     *
     * @param string $input
     * @param string $name
     *
     * @return mixed
     */
    public static function delete(string $input, string $name);
}


text:
// ReSharper disable InconsistentNaming
using RabbitMQ.Client.Framing;
using System;
using System.Text;
using System.Threading;
using EasyNetQ.Tests.Mocking;
using Xunit;
using EasyNetQ.NonGeneric;
using FluentAssertions;

namespace EasyNetQ.Tests.NonGeneric
{
    public class NonGenericExtensionsTests : IDisposable
    {
        private MockBuilder mockBuilder;

        public NonGenericExtensionsTests()
        {
            mockBuilder = new MockBuilder();
        }

        public void Dispose()
        {
            mockBuilder.Bus.Dispose();
        }

        [Fact]
        public void Should_be_able_to_subscribe_using_non_generic_extensions()
        {
            var are = new AutoResetEvent(false);
            MyMessage deliveredMessage = null;

            Action<object> onMessage = message =>
                {
                    deliveredMessage = (MyMessage)message;
                    are.Set();
                };

            mockBuilder.Bus.Subscribe(typeof (MyMessage), "subid", onMessage);

            var properties = new BasicProperties
                {
                    Type = "EasyNetQ.Tests.MyMessage, EasyNetQ.Tests"
                };

            var body = Encoding.UTF8.GetBytes("{ Text:\"Hello World\" }");

            mockBuilder.Consumers[0].HandleBasicDeliver(
                "consumer_tag",
                0,
                false,
                "exchange",
                "routing_key",
                properties,
                body);

            are.WaitOne(1000);
            deliveredMessage.Should().NotBeNull();
            deliveredMessage.Text.Should().Be("Hello World");
        }
    }
}

// ReSharper restore InconsistentNaming


text:
from django.contrib import admin
from django.forms.widgets import TextInput

from django_google_maps.widgets import GoogleMapsAddressWidget
from django_google_maps.fields import AddressField, GeoLocationField

from sample import models

class SampleModelAdmin(admin.ModelAdmin):
    formfield_overrides = {
        AddressField: {
            'widget': GoogleMapsAddressWidget
        },
        GeoLocationField: {
            'widget': TextInput(attrs={
                'readonly': 'readonly'
            })
        },
    }

admin.site.register(models.SampleModel, SampleModelAdmin)


text:
/*
 * Ensure CSS inclusion doesn't regress
 * https://github.com/facebook/create-react-app/issues/2677
 */
/*@import '~normalize.css/normalize.css';*/

#feature-css-inclusion {
  background: palevioletred;
  color: papayawhip;
}


text:
'use strict';

const stream = require('stream');

module.exports = class BufferConcatStream extends stream.Writable {
    constructor(callback) {
        super();
        this.data = [];
        this.on('finish', () => {
            callback(Buffer.concat(this.data));
        });
    }

    _write(chunk, encoding, done) {
        this.data.push(chunk);
        done(null, chunk);
    }
};


text:
    {% if comment.author %}
        {% if index %}
        #{{ index }}
        {% endif %}
        {{ comment.author.username }}
    {% else %}
        {% if talk.author == current_user or current_user.is_admin %}
            {% if not comment.approved %}

                 Approve
                 Delete

                 Approved

                 Deleted

            {% endif %}
        {% endif %}
        {% if index %}
        #{{ index }}
        {% endif %}
        {{ comment.author_name }}
        {% if current_user.is_authenticated and (talk.author == current_user or current_user.is_admin) %}
        ({{ comment.author_email }})
        {% endif %}
    {% endif %}
    commented {{ moment(comment.timestamp).fromNow() }}:

    {{ comment.body_html | safe }}


text:
{{campaigns_buttons}}

{{campaigns}}

{{campaigns_buttons}}


text:
/*

Author: Tristan Bepler

*/

#ifndef RANDOM_H
#define RANDOM_H

#include <stdlib.h>
#include <stdio.h>
#include "Arrays.h"

//generates a random double between 0 and 1
inline  double randomDouble( void )
{
	return (double)random( )/(double)RAND_MAX;
}

//courtesy of http://stackoverflow.com/questions/2509679/how-to-generate-a-random-number-from-within-a-range
// Assumes 0 <= range <= RAND_MAX
// Returns in the half-open interval [0, max]
inline long randomRange(long min, long max) {

	max = max - min;

	unsigned long
	// max <= RAND_MAX < ULONG_MAX, so this is okay.
	numBins = (unsigned long) max + 1,
    	numRand = (unsigned long) RAND_MAX + 1,
    	binSize = numRand / numBins,
    	defect   = numRand % numBins;

  	long x;
  	// This is carefully written not to overflow
  	while (numRand - defect <= (unsigned long)(x = random()));

  	// Truncated division is intentional
  	return min + x/binSize;
}

inline  long randomRangeFast( long min, long max )
{
	return max + random() / (RAND_MAX / ( min - max ) + 1);
}

//shuffles arrays of size_ts in place
inline  void shuffleSize_ts( size_t* array, size_t len )
{
    size_t n = len - 1;
    size_t i;
    size_t j;
    for( i = 0 ; i < n ; ++i )
    {
        j = randomRangeFast( i, n );
        swapSize_ts( array + i , array + j );
    }
}

//shuffles arrays of longs in place
inline  void shuffleLongs( long* array, size_t len )
{
	size_t n = len - 1;
	size_t i;
	size_t j;
	for( i = 0 ; i < n ; ++i )
	{
		j = randomRangeFast( i , n );
		//printf( "swapping...\n" );
		swapLongs( array + i, array + j );
	}
}

//shuffles the array in place
inline  void shuffle( void* array, size_t len, size_t size )
{
	char* arr = (char*) array;
	size_t i;
	size_t j;
	size_t n = len - 1;
	for( i = 0 ; i < n ; ++i )
	{
		j = randomRange( i, n );
		//printf( "%d\n", j );
		swap( arr + i*size, arr + j*size, size );
	}
}

#endif /* RANDOM_H */


text:
title: How to scroll to top of the page in JavaScript
tags:
    - JavaScript
    - ES6
    - one-line
    - js
    - DOM
layout: note
---

In this Article we will go through how to scroll to top of the page only using single line of code in JavaScript.
This is a one-line JavaScript code snippet that uses one of the most popular ES6 features => `Arrow Function`.

Let's define this short function:

```js {.wrap}
const goToTop = () => window.scrollTo(0, 0);
```


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">Performance Monitor</string>
    <string name="title_activity_about">About</string>
    <string name="app_about">This JuiceSSH plugin monitors performance statistics on Linux based systems.\n\nIt works by starting a background JuiceSSH session and running various commands on a periodic basis to obtain the metrics required.\n\nCurrently this plugin has been tested with Ubuntu and RedHat Enterprise Linux, however this plugin is open source and freely available on Github. If you\'d like to add support for other operating systems, please take a look at the github page and submit a pull request.\n\nhttps://github.com/sonelli/juicessh-performancemonitor</string>
    <string name="app_url">https://github.com/Sonelli/juicessh-performancemonitor</string>
    <string name="app_package">com.sonelli.juicessh.performancemonitor</string>
    <string name="connect">Connect</string>
    <string name="please_wait">Please wait…</string>
    <string name="disconnect">Disconnect</string>
    <string name="load_average">Load Average</string>
    <string name="unknown">Unknown</string>
    <string name="about">About</string>
    <string name="error">Error</string>
    <string name="cpu_usage">CPU Usage</string>
    <string name="memory_usage">Memory Usage</string>
    <string name="free_memory">Free RAM</string>
    <string name="network">Network</string>
    <string name="disk">Disk Usage</string>
    <string name="connecting">Connecting...</string>
    <string name="disconnecting">Disconnecting...</string>
    <string name="fork_me_on_github">Fork me on GitHub!</string>
    <string name="open_address">Open Address</string>
    <string name="rate_this_plugin">Rate this plugin</string>
    <string name="google_play_not_installed">Error: Google Play Store not installed</string>
    <string name="only_ssh_connections_are_supported">Only SSH connections are supported</string>
    <string name="keep_screen_on">Keep screen on</string>

</resources>


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright 2017 Jiaheng Ge

  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.
  -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        android:elevation="4dp"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v4.widget.SwipeRefreshLayout
            android:id="@+id/swipe_refresh_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <WebView
                android:id="@+id/webview"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        </android.support.v4.widget.SwipeRefreshLayout>

        <ProgressBar
            android:id="@+id/progress_bar"
            style="?android:progressBarStyleHorizontal"
            android:layout_width="match_parent"
            android:layout_height="2dp"
            android:max="100"
            android:maxHeight="2dp"
            android:minHeight="2dp" />
    </FrameLayout>
</LinearLayout>


text:
using System;
using System.Collections.Generic;
using System.Globalization;
using DotJEM.Json.Index.Schema;
using DotJEM.Json.Index.Searching;
using Lucene.Net.QueryParsers;
using Lucene.Net.Search;

namespace DotJEM.Json.Index.Configuration.FieldStrategies.Querying
{
    public interface IFieldQueryBuilder
    {
        Query BuildFieldQuery(CallContext call, string query, int slop);
        Query BuildFuzzyQuery(CallContext call, string query, float similarity);
        Query BuildPrefixQuery(CallContext call, string query);
        Query BuildWildcardQuery(CallContext call, string query);
        Query BuildRangeQuery(CallContext call, string part1, string part2, bool inclusive);
    }

    public class FieldQueryBuilder : IFieldQueryBuilder
    {
        protected IQueryParser Parser { get; }
        protected string Field { get; }
        protected JsonSchemaExtendedType Type { get; }

        public FieldQueryBuilder(IQueryParser parser, string field, JsonSchemaExtendedType type)
        {
            Parser = parser;
            Field = field;
            Type = type;
        }

        public virtual Query BuildFieldQuery(CallContext call, string query, int slop)
        {
            return call.CallDefault();
        }

        public virtual Query BuildFuzzyQuery(CallContext call, string query, float similarity)
        {
            return call.CallDefault();
        }

        public virtual Query BuildPrefixQuery(CallContext call, string query)
        {
            return call.CallDefault();
        }

        public virtual Query BuildWildcardQuery(CallContext call, string query)
        {
            return call.CallDefault();
        }

        public virtual Query BuildRangeQuery(CallContext call, string part1, string part2, bool inclusive)
        {
            //TODO: Try parse and separate type generators.
            IList<BooleanClause> clauses = new List<BooleanClause>();
            //TODO: this is hacky atm.
            if (Field.EndsWith(".@count"))
            {
                try
                {
                    clauses.Add(
                        new BooleanClause(
                            NumericRangeQuery.NewIntRange(Field,
                                part1 == "null" ? (int?)null : int.Parse(part1),
                                part2 == "null" ? (int?)null : int.Parse(part2),
                                inclusive,
                                inclusive), Occur.MUST));
                }
                catch (FormatException ex)
                {
                    throw new ParseException("Invalid format for count.", ex);
                }
                return Parser.BooleanQuery(clauses, true);
            }

            if (Type.HasFlag(JsonSchemaExtendedType.Date))
            {
                try
                {
                    clauses.Add(new BooleanClause(new DateRangeFieldQueryFactory().Create(Field, call, part1, part2, inclusive),
                        Type == JsonSchemaExtendedType.Date ? Occur.MUST : Occur.SHOULD));
                }
                catch (FormatException ex)
                {
                    if (Type == JsonSchemaExtendedType.Date)
                    {
                        throw new ParseException("Invalid DateTime format", ex);
                    }
                }
            }

            if (Type.HasFlag(JsonSchemaExtendedType.Integer))
            {
                try
                {
                    clauses.Add(
                        new BooleanClause(
                            NumericRangeQuery.NewLongRange(Field,
                                part1 == "null" ? (long?)null : long.Parse(part1),
                                part2 == "null" ? (long?)null : long.Parse(part2),
                                inclusive,
                                inclusive), Type == JsonSchemaExtendedType.Integer ? Occur.MUST : Occur.SHOULD));
                }
                catch (FormatException ex)
                {
                    if (Type == JsonSchemaExtendedType.Integer)
                    {
                        throw new ParseException("Invalid Integer format", ex);
                    }
                }
            }

            if (Type != JsonSchemaExtendedType.Date && Type != JsonSchemaExtendedType.Integer)
            {
                clauses.Add(new BooleanClause(call.CallDefault(), Occur.SHOULD));
            }

            return Parser.BooleanQuery(clauses, true);
        }
    }
}


text:
package oap.application;

import oap.util.Result;

import javax.annotation.Nonnull;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;

import static oap.application.ServiceStorage.ErrorStatus.MODULE_NOT_FOUND;
import static oap.application.ServiceStorage.ErrorStatus.SERVICE_NOT_FOUND;

class ModuleItemTree extends AbstractMap<String, ModuleItem> implements ServiceStorage {
    final LinkedHashSet<ModuleItem.ServiceItem> services = new LinkedHashSet<>();
    private final LinkedHashMap<String, ModuleItem> map = new LinkedHashMap<>();

    ModuleItemTree() {
    }

    ModuleItemTree( Map<String, ModuleItem> map ) {
        this.map.putAll( map );

        for( var moduleItem : map.values() ) {
            services.addAll( moduleItem.services.values() );
        }
    }

    public ModuleItem remove( String moduleName ) {
        return map.remove( moduleName );
    }

    @Override
    public ModuleItem put( String moduleName, ModuleItem moduleItem ) {
        return map.put( moduleName, moduleItem );
    }

    @Override
    public Collection<ModuleItem> values() {
        return map.values();
    }

    @Override
    public Set<String> keySet() {
        return map.keySet();
    }

    @Override
    public Set<Map.Entry<String, ModuleItem>> entrySet() {
        return map.entrySet();
    }

    public void set( LinkedHashMap<String, ModuleItem> newMap ) {
        map.clear();
        services.clear();
        map.putAll( newMap );

        for( var moduleItem : map.values() ) {
            services.addAll( moduleItem.services.values() );
        }
    }

    public @Nonnull
    ModuleItem findModule( ModuleItem fromModule, String name ) throws ApplicationException {
        var moduleItem = map.get( name );

        if( moduleItem == null )
            throw new ApplicationException( "[" + fromModule.module.name + "]: dependsOn not found: " + name );

        return moduleItem;
    }

    @Override
    public ModuleItemTree clone() {
        return new ModuleItemTree( map );
    }

    public ModuleItem get( String moduleName ) {
        return map.get( moduleName );
    }

    @Override
    public Result<Object, ErrorStatus> findByName( String moduleName, String serviceName ) {
        var moduleInfo = map.get( moduleName );
        if( moduleInfo == null ) return Result.failure( MODULE_NOT_FOUND );

        var service = moduleInfo.services.get( serviceName );
        if( service == null ) return Result.failure( SERVICE_NOT_FOUND );

        return Result.success( service );
    }

    public void setServices( Collection<ModuleItem.ServiceItem> services ) {
        this.services.clear();
        this.services.addAll( services );
    }
}


text:
<bill session="110" type="h" number="2240" updated="2009-01-08T21:32:10-05:00">
	<status><introduced date="1178683200" datetime="2007-05-09"/></status>

	<introduced date="1178683200" datetime="2007-05-09"/>
	<titles>
		<title type="short" as="introduced">Office for National Capital Region Coordination Restoration Act</title>
		<title type="official" as="introduced">To amend the Homeland Security Act of 2002 to restore the Office for National Capital Region Coordination to the administrative jurisdiction of the Office of the Secretary of Homeland Security, and for other purposes.</title>
	</titles>
	<sponsor id="400098"/>
	<cosponsors>
		<cosponsor id="400295" joined="2007-05-17"/>
		<cosponsor id="400189" joined="2007-05-17"/>
		<cosponsor id="400415" joined="2007-05-09"/>
		<cosponsor id="400283" joined="2007-05-09"/>
		<cosponsor id="400438" joined="2007-05-09"/>
		<cosponsor id="400435" joined="2007-05-09"/>
	</cosponsors>
	<actions>
		<action date="1178683200" datetime="2007-05-09"><text>Referred to the House Committee on Homeland Security.</text></action>
		<action date="1179374400" datetime="2007-05-17"><text>Referred to the Subcommittee on Emergency Communications, Preparedness, and Response.</text></action>
	</actions>
	<committees>

	</committees>
	<relatedbills>

	</relatedbills>
	<subjects>

	</subjects>
	<amendments>

	</amendments>

	5/9/2007--Introduced.
Office for National Capital Region Coordination Restoration Act - Provides that the Office for National Capital Region Coordination shall be administered within the Office of the Secretary of Homeland Security as provided in the Homeland Security Act of 2002. Excepts such Office from the Secretary's reorganization authority.

</bill>


text:
<?php

namespace BoletoSimples;

class BankBilletAccount extends BaseResource {
}


text:
#ifndef _BSM_AUDIT_H
#define _BSM_AUDIT_H

#include <sys/param.h>
#include <sys/types.h>

#define AUDIT_RECORD_MAGIC      0x828a0f1b
#define MAX_AUDIT_RECORDS       20
#define MAXAUDITDATA            (0x8000 - 1)
#define MAX_AUDIT_RECORD_SIZE   MAXAUDITDATA
#define MIN_AUDIT_FILE_SIZE     (512 * 1024)

/*
 * Minimum noumber of free blocks on the filesystem containing the audit
 * log necessary to avoid a hard log rotation. DO NOT SET THIS VALUE TO 0
 * as the kernel does an unsigned compare, plus we want to leave a few blocks
 * free so userspace can terminate the log, etc.
 */
#define AUDIT_HARD_LIMIT_FREE_BLOCKS    4

/*
 * Triggers for the audit daemon.
 */
#define AUDIT_TRIGGER_MIN               1
#define AUDIT_TRIGGER_LOW_SPACE         1       /* Below low watermark. */
#define AUDIT_TRIGGER_ROTATE_KERNEL     2       /* Kernel requests rotate. */
#define AUDIT_TRIGGER_READ_FILE         3       /* Re-read config file. */
#define AUDIT_TRIGGER_CLOSE_AND_DIE     4       /* Terminate audit. */
#define AUDIT_TRIGGER_NO_SPACE          5       /* Below min free space. */
#define AUDIT_TRIGGER_ROTATE_USER       6       /* User requests rotate. */
#define AUDIT_TRIGGER_INITIALIZE        7       /* User initialize of auditd. */
#define AUDIT_TRIGGER_EXPIRE_TRAILS     8       /* User expiration of trails. */
#define AUDIT_TRIGGER_MAX               8

/*
 * The special device filename (FreeBSD).
 */
#define AUDITDEV_FILENAME       "audit"
#define AUDIT_TRIGGER_FILE      ("/dev/" AUDITDEV_FILENAME)

/*
 * Pre-defined audit IDs
 */
#define AU_DEFAUDITID   (uid_t)(-1)
#define AU_DEFAUDITSID   0
#define AU_ASSIGN_ASID  -1

/*
 * IPC types.
 */
#define AT_IPC_MSG      ((unsigned char)1)      /* Message IPC id. */
#define AT_IPC_SEM      ((unsigned char)2)      /* Semaphore IPC id. */
#define AT_IPC_SHM      ((unsigned char)3)      /* Shared mem IPC id. */

/*
 * Audit conditions.
 */
#define AUC_UNSET               0
#define AUC_AUDITING            1
#define AUC_NOAUDIT             2
#define AUC_DISABLED            -1

/*
 * auditon(2) commands.
 */
#define A_OLDGETPOLICY  2
#define A_OLDSETPOLICY  3
#define A_GETKMASK      4
#define A_SETKMASK      5
#define A_OLDGETQCTRL   6
#define A_OLDSETQCTRL   7
#define A_GETCWD        8
#define A_GETCAR        9
#define A_GETSTAT       12
#define A_SETSTAT       13
#define A_SETUMASK      14
#define A_SETSMASK      15
#define A_OLDGETCOND    20
#define A_OLDSETCOND    21
#define A_GETCLASS      22
#define A_SETCLASS      23
#define A_GETPINFO      24
#define A_SETPMASK      25
#define A_SETFSIZE      26
#define A_GETFSIZE      27
#define A_GETPINFO_ADDR 28
#define A_GETKAUDIT     29
#define A_SETKAUDIT     30
#define A_SENDTRIGGER   31
#define A_GETSINFO_ADDR 32
#define A_GETPOLICY     33
#define A_SETPOLICY     34
#define A_GETQCTRL      35
#define A_SETQCTRL      36
#define A_GETCOND       37
#define A_SETCOND       38
#define A_GETSFLAGS     39
#define A_SETSFLAGS     40
#define A_GETCTLMODE    41
#define A_SETCTLMODE    42
#define A_GETEXPAFTER   43
#define A_SETEXPAFTER   44

/*
 * Audit policy controls.
 */
#define AUDIT_CNT       0x0001
#define AUDIT_AHLT      0x0002
#define AUDIT_ARGV      0x0004
#define AUDIT_ARGE      0x0008
#define AUDIT_SEQ       0x0010
#define AUDIT_WINDATA   0x0020
#define AUDIT_USER      0x0040
#define AUDIT_GROUP     0x0080
#define AUDIT_TRAIL     0x0100
#define AUDIT_PATH      0x0200
#define AUDIT_SCNT      0x0400
#define AUDIT_PUBLIC    0x0800
#define AUDIT_ZONENAME  0x1000
#define AUDIT_PERZONE   0x2000

/*
 * Default audit queue control parameters.
 */
#define AQ_HIWATER      100
#define AQ_MAXHIGH      10000
#define AQ_LOWATER      10
#define AQ_BUFSZ        MAXAUDITDATA
#define AQ_MAXBUFSZ     1048576

/*
 * Default minimum percentage free space on file system.
 */
#define AU_FS_MINFREE   20

/*
 * Type definitions used indicating the length of variable length addresses
 * in tokens containing addresses, such as header fields.
 */
#define AU_IPv4         4
#define AU_IPv6         16

/*
 * Reserved audit class mask indicating which classes are unable to have
 * events added or removed by unentitled processes.
 */
#define AU_CLASS_MASK_RESERVED 0x10000000

/*
 * Audit control modes
 */
#define AUDIT_CTLMODE_NORMAL ((unsigned char)1)
#define AUDIT_CTLMODE_EXTERNAL ((unsigned char)2)

/*
 * Audit file expire_after op modes
 */
#define AUDIT_EXPIRE_OP_AND ((unsigned char)0)
#define AUDIT_EXPIRE_OP_OR ((unsigned char)1)

__BEGIN_DECLS

typedef uid_t           au_id_t;
typedef pid_t           au_asid_t;
typedef u_int16_t       au_event_t;
typedef u_int16_t       au_emod_t;
typedef u_int32_t       au_class_t;
typedef u_int64_t       au_asflgs_t __attribute__ ((aligned(8)));
typedef unsigned char   au_ctlmode_t;

struct au_tid {
	dev_t           port;
	u_int32_t       machine;
};
typedef struct au_tid   au_tid_t;

struct au_tid_addr {
	dev_t           at_port;
	u_int32_t       at_type;
	u_int32_t       at_addr[4];
};
typedef struct au_tid_addr      au_tid_addr_t;

struct au_mask {
	unsigned int    am_success;     /* Success bits. */
	unsigned int    am_failure;     /* Failure bits. */
};
typedef struct au_mask  au_mask_t;

struct auditinfo {
	au_id_t         ai_auid;        /* Audit user ID. */
	au_mask_t       ai_mask;        /* Audit masks. */
	au_tid_t        ai_termid;      /* Terminal ID. */
	au_asid_t       ai_asid;        /* Audit session ID. */
};
typedef struct auditinfo        auditinfo_t;

struct auditinfo_addr {
	au_id_t         ai_auid;        /* Audit user ID. */
	au_mask_t       ai_mask;        /* Audit masks. */
	au_tid_addr_t   ai_termid;      /* Terminal ID. */
	au_asid_t       ai_asid;        /* Audit session ID. */
	au_asflgs_t     ai_flags;       /* Audit session flags. */
};
typedef struct auditinfo_addr   auditinfo_addr_t;

struct auditpinfo {
	pid_t           ap_pid;         /* ID of target process. */
	au_id_t         ap_auid;        /* Audit user ID. */
	au_mask_t       ap_mask;        /* Audit masks. */
	au_tid_t        ap_termid;      /* Terminal ID. */
	au_asid_t       ap_asid;        /* Audit session ID. */
};
typedef struct auditpinfo       auditpinfo_t;

struct auditpinfo_addr {
	pid_t           ap_pid;         /* ID of target process. */
	au_id_t         ap_auid;        /* Audit user ID. */
	au_mask_t       ap_mask;        /* Audit masks. */
	au_tid_addr_t   ap_termid;      /* Terminal ID. */
	au_asid_t       ap_asid;        /* Audit session ID. */
	au_asflgs_t     ap_flags;       /* Audit session flags. */
};
typedef struct auditpinfo_addr  auditpinfo_addr_t;

struct au_session {
	auditinfo_addr_t        *as_aia_p;      /* Ptr to full audit info. */
	au_mask_t                as_mask;       /* Process Audit Masks. */
};
typedef struct au_session       au_session_t;

struct au_expire_after {
	time_t age;             /* Age after which trail files should be expired */
	size_t size;    /* Aggregate trail size when files should be expired */
	unsigned char op_type; /* Operator used with the above values to determine when files should be expired */
};
typedef struct au_expire_after au_expire_after_t;

/*
 * Contents of token_t are opaque outside of libbsm.
 */
typedef struct au_token token_t;

/*
 * Kernel audit queue control parameters:
 *                      Default:		Maximum:
 *      aq_hiwater:	AQ_HIWATER (100)	AQ_MAXHIGH (10000)
 *      aq_lowater:	AQ_LOWATER (10)		<aq_hiwater
 *      aq_bufsz:	AQ_BUFSZ (32767)	AQ_MAXBUFSZ (1048576)
 *      aq_delay:	20			20000 (not used)
 */
struct au_qctrl {
	int     aq_hiwater;     /* Max # of audit recs in queue when */
	                        /* threads with new ARs get blocked. */

	int     aq_lowater;     /* # of audit recs in queue when */
	                        /* blocked threads get unblocked. */

	int     aq_bufsz;       /* Max size of audit record for audit(2). */
	int     aq_delay;       /* Queue delay (not used). */
	int     aq_minfree;     /* Minimum filesystem percent free space. */
};
typedef struct au_qctrl au_qctrl_t;

/*
 * Structure for the audit statistics.
 */
struct audit_stat {
	unsigned int    as_version;
	unsigned int    as_numevent;
	int             as_generated;
	int             as_nonattrib;
	int             as_kernel;
	int             as_audit;
	int             as_auditctl;
	int             as_enqueue;
	int             as_written;
	int             as_wblocked;
	int             as_rblocked;
	int             as_dropped;
	int             as_totalsize;
	unsigned int    as_memused;
};
typedef struct audit_stat       au_stat_t;

/*
 * Structure for the audit file statistics.
 */
struct audit_fstat {
	u_int64_t       af_filesz;
	u_int64_t       af_currsz;
};
typedef struct audit_fstat      au_fstat_t;

/*
 * Audit to event class mapping.
 */
struct au_evclass_map {
	au_event_t      ec_number;
	au_class_t      ec_class;
};
typedef struct au_evclass_map   au_evclass_map_t;

/*
 * Audit system calls.
 */
#if !defined(_KERNEL) && !defined(KERNEL)
int     audit(const void *, int);
int     auditon(int, void *, int);
int     auditctl(const char *);
int     getauid(au_id_t *);
int     setauid(const au_id_t *);
int     getaudit_addr(struct auditinfo_addr *, int);
int     setaudit_addr(const struct auditinfo_addr *, int);

#if defined(__APPLE__)
#include <Availability.h>

/*
 * getaudit()/setaudit() are deprecated and have been replaced with
 * wrappers to the getaudit_addr()/setaudit_addr() syscalls above.
 */

int     getaudit(struct auditinfo *)
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8,
    __IPHONE_2_0, __IPHONE_6_0);
int     setaudit(const struct auditinfo *)
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8,
    __IPHONE_2_0, __IPHONE_6_0);
#else

int     getaudit(struct auditinfo *);
int     setaudit(const struct auditinfo *);
#endif /* !__APPLE__ */

#ifdef __APPLE_API_PRIVATE
#include <mach/port.h>
mach_port_name_t audit_session_self(void);
au_asid_t        audit_session_join(mach_port_name_t port);
int              audit_session_port(au_asid_t asid, mach_port_name_t *portname);
#endif /* __APPLE_API_PRIVATE */

#endif /* defined(_KERNEL) || defined(KERNEL) */

__END_DECLS

#endif /* !_BSM_AUDIT_H */


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.businesslogic.web;
using Umbraco.Core;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
using Umbraco.Core.Publishing;
using Umbraco.Core.Services;
using umbraco.cms.presentation.Trees;
using umbraco.interfaces;
using umbraco.BusinessLogic.Actions;
using umbraco;
using ExportImportDictionaryItems.Actions;

namespace Inetdesign.ExportImportDictionaryItems
{
    public class BootStrapper : IApplicationEventHandler
    {
        public BootStrapper()
        {
            BaseTree.NodeActionsCreated += BaseTree_NodeActionsCreated;
        }

        void BaseTree_NodeActionsCreated(object sender, NodeActionsEventArgs e)
        {
            if (sender is loadDictionary)
            {
                e.AllowedActions.Add(ContextMenuSeperator.Instance);
                e.AllowedActions.Add(DictionaryItemsExportAction.Instance);
                e.AllowedActions.Add(DictionaryItemsImportAction.Instance);
            }
        }

        public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {

        }

        public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {

        }

        public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {

        }
    }
}


text:
package com.smart.cloud.fire.mvp.fragment.CallAlarmFragment;

import com.smart.cloud.fire.mvp.fragment.MapFragment.Smoke;

import java.util.List;

/**
 * Created by Administrator on 2016/10/13.
 */
public interface CallAlarmFragmentView {
    void getCurrentTime(String time);
    void stopCountDown(String msg);
    void sendAlarmMessage(String result);
    void getDataResult(String result);
    void getDataSuccess(List<Smoke> list);
}


text:
<?php

defined('JPATH_PLATFORM') or die;

jimport('joomla.filesystem.file');

/**
 * A Unified Diff Format Patcher class
 *
 * @package     Joomla.Platform
 * @subpackage  FileSystem
 *
 * @link        http://sourceforge.net/projects/phppatcher/ This has been derived from the PhpPatcher version 0.1.1 written by Giuseppe Mazzotta
 * @since       12.1
 */
class JFilesystemPatcher
{
	/**
	 * Regular expression for searching source files
	 */
	const SRC_FILE = '/^---\\s+(\\S+)\s+\\d{1,4}-\\d{1,2}-\\d{1,2}\\s+\\d{1,2}:\\d{1,2}:\\d{1,2}(\\.\\d+)?\\s+(\+|-)\\d{4}/A';

	/**
	 * Regular expression for searching destination files
	 */
	const DST_FILE = '/^\\+\\+\\+\\s+(\\S+)\s+\\d{1,4}-\\d{1,2}-\\d{1,2}\\s+\\d{1,2}:\\d{1,2}:\\d{1,2}(\\.\\d+)?\\s+(\+|-)\\d{4}/A';

	/**
	 * Regular expression for searching hunks of differences
	 */
	const HUNK = '/@@ -(\\d+)(,(\\d+))?\\s+\\+(\\d+)(,(\\d+))?\\s+@@($)/A';

	/**
	 * Regular expression for splitting lines
	 */
	const SPLIT = '/(\r\n)|(\r)|(\n)/';

	/**
	 * @var    array  sources files
	 * @since  12.1
	 */
	protected $sources = array();

	/**
	 * @var    array  destination files
	 * @since  12.1
	 */
	protected $destinations = array();

	/**
	 * @var    array  removal files
	 * @since  12.1
	 */
	protected $removals = array();

	/**
	 * @var    array  patches
	 * @since  12.1
	 */
	protected $patches = array();

	/**
	 * @var    array  instance of this class
	 * @since  12.1
	 */
	protected static $instance;

	/**
	 * Constructor
	 *
	 * The constructor is protected to force the use of JFilesystemPatcher::getInstance()
	 *
	 * @since   12.1
	 */
	protected function __construct()
	{
	}

	/**
	 * Method to get a patcher
	 *
	 * @return  JFilesystemPatcher  an instance of the patcher
	 *
	 * @since   12.1
	 */
	public static function getInstance()
	{
		if (!isset(static::$instance))
		{
			static::$instance = new static;
		}

		return static::$instance;
	}

	/**
	 * Reset the pacher
	 *
	 * @return  JFilesystemPatcher  This object for chaining
	 *
	 * @since   12.1
	 */
	public function reset()
	{
		$this->sources = array();
		$this->destinations = array();
		$this->removals = array();
		$this->patches = array();

		return $this;
	}

	/**
	 * Apply the patches
	 *
	 * @return  integer  The number of files patched
	 *
	 * @since   12.1
	 * @throws  RuntimeException
	 */
	public function apply()
	{
		foreach ($this->patches as $patch)
		{
			// Separate the input into lines
			$lines = self::splitLines($patch['udiff']);

			// Loop for each header
			while (self::findHeader($lines, $src, $dst))
			{
				$done = false;

				if ($patch['strip'] === null)
				{
					$src = $patch['root'] . preg_replace('#^([^/]*/)*#', '', $src);
					$dst = $patch['root'] . preg_replace('#^([^/]*/)*#', '', $dst);
				}
				else
				{
					$src = $patch['root'] . preg_replace('#^([^/]*/){' . (int) $patch['strip'] . '}#', '', $src);
					$dst = $patch['root'] . preg_replace('#^([^/]*/){' . (int) $patch['strip'] . '}#', '', $dst);
				}

				// Loop for each hunk of differences
				while (self::findHunk($lines, $src_line, $src_size, $dst_line, $dst_size))
				{
					$done = true;

					// Apply the hunk of differences
					$this->applyHunk($lines, $src, $dst, $src_line, $src_size, $dst_line, $dst_size);
				}

				// If no modifications were found, throw an exception
				if (!$done)
				{
					throw new RuntimeException('Invalid Diff');
				}
			}
		}

		// Initialize the counter
		$done = 0;

		// Patch each destination file
		foreach ($this->destinations as $file => $content)
		{
			if (JFile::write($file, implode("\n", $content)))
			{
				if (isset($this->sources[$file]))
				{
					$this->sources[$file] = $content;
				}

				$done++;
			}
		}

		// Remove each removed file
		foreach ($this->removals as $file)
		{
			if (JFile::delete($file))
			{
				if (isset($this->sources[$file]))
				{
					unset($this->sources[$file]);
				}

				$done++;
			}
		}

		// Clear the destinations cache
		$this->destinations = array();

		// Clear the removals
		$this->removals = array();

		// Clear the patches
		$this->patches = array();

		return $done;
	}

	/**
	 * Add a unified diff file to the patcher
	 *
	 * @param   string  $filename  Path to the unified diff file
	 * @param   string  $root      The files root path
	 * @param   string  $strip     The number of '/' to strip
	 *
	 * @return	JFilesystemPatch $this for chaining
	 *
	 * @since   12.1
	 */
	public function addFile($filename, $root = JPATH_BASE, $strip = 0)
	{
		return $this->add(file_get_contents($filename), $root, $strip);
	}

	/**
	 * Add a unified diff string to the patcher
	 *
	 * @param   string  $udiff  Unified diff input string
	 * @param   string  $root   The files root path
	 * @param   string  $strip  The number of '/' to strip
	 *
	 * @return	JFilesystemPatch $this for chaining
	 *
	 * @since   12.1
	 */
	public function add($udiff, $root = JPATH_BASE, $strip = 0)
	{
		$this->patches[] = array(
			'udiff' => $udiff,
			'root' => isset($root) ? rtrim($root, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : '',
			'strip' => $strip
		);

		return $this;
	}

	/**
	 * Separate CR or CRLF lines
	 *
	 * @param   string  $data  Input string
	 *
	 * @return  array  The lines of the inputdestination file
	 *
	 * @since   12.1
	 */
	protected static function splitLines($data)
	{
		return preg_split(self::SPLIT, $data);
	}

	/**
	 * Find the diff header
	 *
	 * The internal array pointer of $lines is on the next line after the finding
	 *
	 * @param   array   &$lines  The udiff array of lines
	 * @param   string  &$src    The source file
	 * @param   string  &$dst    The destination file
	 *
	 * @return  boolean  TRUE in case of success, FALSE in case of failure
	 *
	 * @since   12.1
	 * @throws  RuntimeException
	 */
	protected static function findHeader(&$lines, &$src, &$dst)
	{
		// Get the current line
		$line = current($lines);

		// Search for the header
		while ($line !== false && !preg_match(self::SRC_FILE, $line, $m))
		{
			$line = next($lines);
		}
		if ($line === false)
		{
			// No header found, return false
			return false;
		}
		else
		{
			// Set the source file
			$src = $m[1];

			// Advance to the next line
			$line = next($lines);

			if ($line === false)
			{
				throw new RuntimeException('Unexpected EOF');
			}

			// Search the destination file
			if (!preg_match(self::DST_FILE, $line, $m))
			{
				throw new RuntimeException('Invalid Diff file');
			}

			// Set the destination file
			$dst = $m[1];

			// Advance to the next line
			if (next($lines) === false)
			{
				throw new RuntimeException('Unexpected EOF');
			}
			return true;
		}
	}

	/**
	 * Find the next hunk of difference
	 *
	 * The internal array pointer of $lines is on the next line after the finding
	 *
	 * @param   array   &$lines     The udiff array of lines
	 * @param   string  &$src_line  The beginning of the patch for the source file
	 * @param   string  &$src_size  The size of the patch for the source file
	 * @param   string  &$dst_line  The beginning of the patch for the destination file
	 * @param   string  &$dst_size  The size of the patch for the destination file
	 *
	 * @return  boolean  TRUE in case of success, false in case of failure
	 *
	 * @since   12.1
	 * @throws  RuntimeException
	 */
	protected static function findHunk(&$lines, &$src_line, &$src_size, &$dst_line, &$dst_size)
	{
		$line = current($lines);

		if (preg_match(self::HUNK, $line, $m))
		{
			$src_line = (int) $m[1];

			if ($m[3] === '')
			{
				$src_size = 1;
			}
			else
			{
				$src_size = (int) $m[3];
			}

			$dst_line = (int) $m[4];

			if ($m[6] === '')
			{
				$dst_size = 1;
			}
			else
			{
				$dst_size = (int) $m[6];
			}

			if (next($lines) === false)
			{
				throw new RuntimeException('Unexpected EOF');
			}

			return true;
		}
		else
		{
			return false;
		}
	}

	/**
	 * Apply the patch
	 *
	 * @param   array   &$lines    The udiff array of lines
	 * @param   string  $src       The source file
	 * @param   string  $dst       The destination file
	 * @param   string  $src_line  The beginning of the patch for the source file
	 * @param   string  $src_size  The size of the patch for the source file
	 * @param   string  $dst_line  The beginning of the patch for the destination file
	 * @param   string  $dst_size  The size of the patch for the destination file
	 *
	 * @return  void
	 *
	 * @since   12.1
	 * @throws  RuntimeException
	 */
	protected function applyHunk(&$lines, $src, $dst, $src_line, $src_size, $dst_line, $dst_size)
	{
		$src_line--;
		$dst_line--;
		$line = current($lines);

		// Source lines (old file)
		$source = array();

		// New lines (new file)
		$destin = array();
		$src_left = $src_size;
		$dst_left = $dst_size;

		do
		{
			if (!isset($line[0]))
			{
				$source[] = '';
				$destin[] = '';
				$src_left--;
				$dst_left--;
			}
			elseif ($line[0] == '-')
			{
				if ($src_left == 0)
				{
					throw new RuntimeException(JText::sprintf('JLIB_FILESYSTEM_PATCHER_REMOVE_LINE', key($lines)));
				}

				$source[] = substr($line, 1);
				$src_left--;
			}
			elseif ($line[0] == '+')
			{
				if ($dst_left == 0)
				{
					throw new RuntimeException(JText::sprintf('JLIB_FILESYSTEM_PATCHER_ADD_LINE', key($lines)));
				}

				$destin[] = substr($line, 1);
				$dst_left--;
			}
			elseif ($line != '\\ No newline at end of file')
			{
				$line = substr($line, 1);
				$source[] = $line;
				$destin[] = $line;
				$src_left--;
				$dst_left--;
			}

			if ($src_left == 0 && $dst_left == 0)
			{
				// Now apply the patch, finally!
				if ($src_size > 0)
				{
					$src_lines = & $this->getSource($src);

					if (!isset($src_lines))
					{
						throw new RuntimeException(JText::sprintf('JLIB_FILESYSTEM_PATCHER_UNEXISING_SOURCE', $src));
					}
				}

				if ($dst_size > 0)
				{
					if ($src_size > 0)
					{
						$dst_lines = & $this->getDestination($dst, $src);
						$src_bottom = $src_line + count($source);

						for ($l = $src_line;$l < $src_bottom;$l++)
						{
							if ($src_lines[$l] != $source[$l - $src_line])
							{
								throw new RuntimeException(JText::sprintf('JLIB_FILESYSTEM_PATCHER_FAILED_VERIFY', $src, $l));
							}
						}

						array_splice($dst_lines, $dst_line, count($source), $destin);
					}
					else
					{
						$this->destinations[$dst] = $destin;
					}
				}
				else
				{
					$this->removals[] = $src;
				}

				next($lines);

				return;
			}

			$line = next($lines);
		}

		while ($line !== false);
		throw new RuntimeException('Unexpected EOF');
	}

	/**
	 * Get the lines of a source file
	 *
	 * @param   string  $src  The path of a file
	 *
	 * @return  array  The lines of the source file
	 *
	 * @since   12.1
	 */
	protected function &getSource($src)
	{
		if (!isset($this->sources[$src]))
		{
			if (is_readable($src))
			{
				$this->sources[$src] = self::splitLines(file_get_contents($src));
			}
			else
			{
				$this->sources[$src] = null;
			}
		}

		return $this->sources[$src];
	}

	/**
	 * Get the lines of a destination file
	 *
	 * @param   string  $dst  The path of a destination file
	 * @param   string  $src  The path of a source file
	 *
	 * @return  array  The lines of the destination file
	 *
	 * @since   12.1
	 */
	protected function &getDestination($dst, $src)
	{
		if (!isset($this->destinations[$dst]))
		{
			$this->destinations[$dst] = $this->getSource($src);
		}

		return $this->destinations[$dst];
	}
}


text:
#ifndef AUDIO_TO_TACTILE_SRC_DSP_IIR_DESIGN_H_
#define AUDIO_TO_TACTILE_SRC_DSP_IIR_DESIGN_H_

#include "dsp/biquad_filter.h"
#include "dsp/complex.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Max number of zeros or poles in Zpk. We limit to 30, enough for up to order
 * 30 lowpass and highpass designs and up to order 15 bandpass and bandstop
 * designs. This keeps Zpk's inline size tolerable at about 1 kilobyte, yet
 * should be high enough for most practical use (see "general tips" above if you
 * need more than order 15 IIR filters). Compared to heap allocation, this
 * allows for a simpler API and implementation.
 */
#define kZpkMaxDegree 30

/* Zero-pole-gain ("ZPK") struct, representing a filter by its s-plane (or
 * z-plane, if discretized) zero and pole locations and a scalar gain.
 *
 * NOTE: Instead of manipulating this struct directly, use the functions
 * ZpkInit(), ZpkEval(), etc. defined below.
 */
typedef struct {
  ComplexDouble zeros[kZpkMaxDegree];  /* Array of zeros.             */
  ComplexDouble poles[kZpkMaxDegree];  /* Array of poles.             */
  int num_zeros;                       /* Number of zeros in `zeros`. */
  int num_poles;                       /* Number of poles in `poles`. */
  double gain;                         /* Scalar gain.                */
} Zpk;

/* ------------------------ Butterworth filter designs -------------------------
 *
 * These functions design Butterworth filters, aka maximally flat magnitude
 * filters [https://en.wikipedia.org/wiki/Butterworth_filter]. The are optimal
 * in the sense that the response is as flat as possible in the passband. We
 * recommend Butterworth designs as a starting point when making a filter since
 * they are simpler and more predictable than Chebyshev and elliptic designs.
 *
 * `DesignButterworthLowpass()` [Number of biquads: `ceil(0.5 * order)`]
 * designs a Butterworth lowpass filter of order up to `kZpkMaxDegree` as a
 * cascade of biquads (second-order seconds). The gain is 1/sqrt(2) (half-power)
 * at frequency `cutoff_hz`, which must satisfy
 *
 *   0 <= cutoff_hz < sample_rate_hz / 2.
 *
 * The designed filter always has `ceil(0.5 * order)` biquads, which are written
 * to the output `coeffs` array. `max_biquads` tells the capacity of `coeffs` as
 * a safety measure. If `max_biquads < ceil(0.5 * order)`, error is reported.
 *
 * On success, the return value is the number of biquads written
 * [`ceil(0.5 * order)`]. On failure, the return value is 0 and an error message
 * is logged to stderr.
 */
int DesignButterworthLowpass(int order,
                             double cutoff_hz,
                             double sample_rate_hz,
                             BiquadFilterCoeffs* coeffs,
                             int max_biquads);

/* Butterworth highpass filter. [Number of biquads: `ceil(0.5 * order)`] */
int DesignButterworthHighpass(int order,
                              double cutoff_hz,
                              double sample_rate_hz,
                              BiquadFilterCoeffs* coeffs,
                              int max_biquads);

/* Designs a Butterworth bandpass filter. [Number of biquads: `order`]
 * `low_edge_hz` and `high_edge_hz` are the half-power edges, which must satisfy
 *
 *   0 <= low_edge_hz <= high_edge_hz < sample_rate_hz / 2.
 */
int DesignButterworthBandpass(int order,
                              double low_edge_hz,
                              double high_edge_hz,
                              double sample_rate_hz,
                              BiquadFilterCoeffs* coeffs,
                              int max_biquads);

/* Butterworth bandstop filter. [Number of biquads: `order`] */
int DesignButterworthBandstop(int order,
                              double low_edge_hz,
                              double high_edge_hz,
                              double sample_rate_hz,
                              BiquadFilterCoeffs* coeffs,
                              int max_biquads);

/* ---------------------- Chebyshev type 1 filter designs ----------------------
 *
 * These functions design Chebyshev type 1 filters
 * [https://en.wikipedia.org/wiki/Chebyshev_filter]. They have steeper roll-off
 * than Butterworth filters of the same order, but have ripples in the passband.
 * The `passband_ripple_db` specifies the magnitude of the ripples in decibels.
 *
 * `DesignChebyshev1Lowpass()` [Number of biquads: `ceil(0.5 * order)`]
 * designs a Chebyshev type 1 lowpass filter, where `cutoff_hz` specifies the
 * frequency at which the gain first drops below `-passband_ripple_db`.
 */
int DesignChebyshev1Lowpass(int order,
                            double passband_ripple_db,
                            double cutoff_hz,
                            double sample_rate_hz,
                            BiquadFilterCoeffs* coeffs,
                            int max_biquads);

/* Chebyshev type 1 highpass filter. [Number of biquads: `ceil(0.5 * order)`] */
int DesignChebyshev1Highpass(int order,
                             double passband_ripple_db,
                             double cutoff_hz,
                             double sample_rate_hz,
                             BiquadFilterCoeffs* coeffs,
                             int max_biquads);

/* Chebyshev type 1 bandpass filter. [Number of biquads: `order`] */
int DesignChebyshev1Bandpass(int order,
                             double passband_ripple_db,
                             double low_edge_hz,
                             double high_edge_hz,
                             double sample_rate_hz,
                             BiquadFilterCoeffs* coeffs,
                             int max_biquads);

/* Chebyshev type 1 bandstop filter. [Number of biquads: `order`] */
int DesignChebyshev1Bandstop(int order,
                             double passband_ripple_db,
                             double low_edge_hz,
                             double high_edge_hz,
                             double sample_rate_hz,
                             BiquadFilterCoeffs* coeffs,
                             int max_biquads);

/* ---------------------- Chebyshev type 2 filter designs ----------------------
 *
 * These functions design Chebyshev type 2 filters, also known as inverse
 * Chebyshev filters [https://en.wikipedia.org/wiki/Chebyshev_filter]. They have
 * steeper roll-off than Butterworth filters of the same order, but have ripples
 * in the stopband. The `stopband_ripple_db` specifies the magnitude of the
 * ripples in decibels.
 *
 * `DesignChebyshev2Lowpass()` [Number of biquads: `ceil(0.5 * order)`]
 * designs a Chebyshev type 2 lowpass filter, where `cutoff_hz` specifies the
 * frequency at which the gain first reaches `-stopband_ripple_db`.
 */
int DesignChebyshev2Lowpass(int order,
                            double stopband_ripple_db,
                            double cutoff_hz,
                            double sample_rate_hz,
                            BiquadFilterCoeffs* coeffs,
                            int max_biquads);

/* Chebyshev type 2 highpass filter. [Number of biquads: `ceil(0.5 * order)`] */
int DesignChebyshev2Highpass(int order,
                             double stopband_ripple_db,
                             double cutoff_hz,
                             double sample_rate_hz,
                             BiquadFilterCoeffs* coeffs,
                             int max_biquads);

/* Chebyshev type 2 bandpass filter. [Number of biquads: `order`] */
int DesignChebyshev2Bandpass(int order,
                             double stopband_ripple_db,
                             double low_edge_hz,
                             double high_edge_hz,
                             double sample_rate_hz,
                             BiquadFilterCoeffs* coeffs,
                             int max_biquads);

/* Chebyshev type 2 bandstop filter. [Number of biquads: `order`] */
int DesignChebyshev2Bandstop(int order,
                             double stopband_ripple_db,
                             double low_edge_hz,
                             double high_edge_hz,
                             double sample_rate_hz,
                             BiquadFilterCoeffs* coeffs,
                             int max_biquads);

/* -------------------------- Elliptic filter designs --------------------------
 *
 * These functions design elliptic filters, also known as Cauer filters or
 * Zolotarev filters [https://en.wikipedia.org/wiki/Elliptic_filter]. They have
 * the fastest transition in gain between passband and stopband for filters of
 * a given order.
 *
 * Elliptic filters have ripples in the passband and stopband, and they are
 * independently adjustable with `passband_ripple_db` and `stopband_ripple_db`.
 *
 * `DesignEllipticLowpass()` [Number of biquads: `ceil(0.5 * order)`]
 * designs an elliptic lowpass filter, where `cutoff_hz` specifies the
 * frequency at which the gain first drops below `-passband_ripple_db`.
 */
int DesignEllipticLowpass(int order,
                          double passband_ripple_db,
                          double stopband_ripple_db,
                          double cutoff_hz,
                          double sample_rate_hz,
                          BiquadFilterCoeffs* coeffs,
                          int max_biquads);

/* Elliptic highpass filter. [Number of biquads: `ceil(0.5 * order)`] */
int DesignEllipticHighpass(int order,
                           double passband_ripple_db,
                           double stopband_ripple_db,
                           double cutoff_hz,
                           double sample_rate_hz,
                           BiquadFilterCoeffs* coeffs,
                           int max_biquads);

/* Elliptic bandpass filter. [Number of biquads: `order`] */
int DesignEllipticBandpass(int order,
                           double passband_ripple_db,
                           double stopband_ripple_db,
                           double low_edge_hz,
                           double high_edge_hz,
                           double sample_rate_hz,
                           BiquadFilterCoeffs* coeffs,
                           int max_biquads);

/* Elliptic bandstop filter. [Number of biquads: `order`] */
int DesignEllipticBandstop(int order,
                           double passband_ripple_db,
                           double stopband_ripple_db,
                           double low_edge_hz,
                           double high_edge_hz,
                           double sample_rate_hz,
                           BiquadFilterCoeffs* coeffs,
                           int max_biquads);

/* -------------------------- `Zpk` utility functions --------------------------
 *
 * The following are utilities for zero-pole-gain filter representations. These
 * functions are used internally to make Butterworth, etc. filters as follows:
 *
 * 1. First, make a Zpk struct describing an "analog prototype", a
 *    continuous-time lowpass filter with cutoff of 1 rad/s.
 *    [See e.g. ButterworthAnalogPrototype() in the .c file.]
 *
 * 2. Convert the analog prototype to the desired response with one of
 *    ZpkAnalogPrototypeToLowpass(&zpk, cutoff_rad_s)
 *    ZpkAnalogPrototypeToHighpass(&zpk, cutoff_rad_s)
 *    ZpkAnalogPrototypeToBandpass(&zpk, low_edge_rad_s, high_edge_rad_s)
 *    ZpkAnalogPrototypeToBandstop(&zpk, low_edge_rad_s, high_edge_rad_s)
 *
 * 3. Discretize the filter with ZpkBilinearTransform(&zpk, sample_rate_hz).
 *
 * 4. Convert to biquads with ZpkToBiquads(&zpk, coeffs, max_biquads).
 */

/* Initializes Zpk to identity (num_zeros = num_poles = 0, gain = 1.0). */
void ZpkInit(Zpk* zpk);

/* Evaluates transfer function at `complex_freq`. For an analog design,
 * complex_freq = s, for discrete complex_freq = z.
 */
ComplexDouble ZpkEval(const Zpk* zpk, ComplexDouble complex_freq);

/* Sorts and pairs complex-conjugate pairs of zeros and poles by increasing real
 * part. The sorted results have purely real-valued roots followed by complex
 * conjugate pairs. Complex conjugate pairs are required to be exact conjugates.
 *
 * Returns 1 on success, or 0 if roots can't be paired.
 */
int /*bool*/ ZpkSort(Zpk* zpk);

/* Discretizes an analog design for `sample_rate_hz` using the bilinear
 * transform [https://en.wikipedia.org/wiki/Bilinear_transform]. No prewarping
 * is done in this function. Returns 1 on success, 0 on failure.
 */
int /*bool*/ ZpkBilinearTransform(Zpk* zpk, double sample_rate_hz);

/* Converts an analog prototype lowpass filter with cutoff 1 rad/s to a lowpass
 * filter with cutoff `cutoff_rad_s` of the same degree.
 */
void ZpkAnalogPrototypeToLowpass(Zpk* zpk, double cutoff_rad_s);

/* Like ZpkAnalogPrototypeToLowpass(), but results in a highpass filter. */
void ZpkAnalogPrototypeToHighpass(Zpk* zpk, double cutoff_rad_s);

/* Converts an analog prototype lowpass filter with cutoff 1 rad/s to a bandpass
 * filter with band edges `low_edge_rad_s` and `high_edge_rad_s`. Note that the
 * resulting filter has double the order. Returns 1 on success, or 0 on failure
 * (i.e. if the result would exceed kZpkMaxDegree).
 */
int /*bool*/ ZpkAnalogPrototypeToBandpass(Zpk* zpk,
                                          double low_edge_rad_s,
                                          double high_edge_rad_s);

/* Like ZpkAnalogPrototypeToBandpass(), but results in a bandstop filter. */
int /*bool*/ ZpkAnalogPrototypeToBandstop(Zpk* zpk,
                                          double low_edge_rad_s,
                                          double high_edge_rad_s);

/* Converts from zero-pole-gain representation to biquads. Biquads are written
 * to the output `coeffs` array, and `max_biquads` tells the capacity of the
 * `coeffs`. Returns the number of biquads written.
 */
int ZpkToBiquads(Zpk* zpk, BiquadFilterCoeffs* coeffs, int max_biquads);

#ifdef __cplusplus
}  /* extern "C" */
#endif
#endif /* AUDIO_TO_TACTILE_SRC_DSP_IIR_DESIGN_H_ */


text:
<?php
/**
 * Vainyl
 *
 * PHP Version 7
 *
 * @package   Core
 * @license   https://opensource.org/licenses/MIT MIT License
 * @link      https://vainyl.com
 */
declare(strict_types=1);

namespace Vainyl\Core\Exception;

use Symfony\Component\DependencyInjection\Container;

/**
 * Class MissingTagFieldException
 *
 * @author Taras P. Girnyk <taras.p.gyrnik@gmail.com>
 */
class MissingRequiredFieldException extends AbstractContainerException
{
    private $service;

    private $section;

    private $field;

    /**
     * MissingTagFieldException constructor.
     *
     * @param Container $container
     * @param string    $node
     * @param array     $section
     * @param string    $field
     */
    public function __construct(Container $container, $node, array $section, string $field)
    {
        $this->service = $node;
        $this->section = $section;
        $this->field = $field;
        parent::__construct(
            $container,
            sprintf(
                'Section %s for node %s does not contain required field %s',
                json_encode($section),
                $node,
                $field
            )
        );
    }

    /**
     * @inheritDoc
     */
    public function toArray(): array
    {
        return array_merge(
            ['service' => $this->service, 'section' => $this->section, 'field' => $this->field],
            parent::toArray()
        );
    }
}


text:
package com.topie.internal.template.persistence.manager;

import com.topie.core.hibernate.HibernateEntityDao;

import com.topie.internal.template.persistence.domain.TemplateInfo;

import org.springframework.stereotype.Service;

@Service
public class TemplateInfoManager extends HibernateEntityDao<TemplateInfo> {
}


text:
import React from 'react';
import PropTypes from 'prop-types';
import { makeStyles } from '@material-ui/styles';
import AppBar from '@material-ui/core/AppBar';
import Tabs from '@material-ui/core/Tabs';
import Tab from '@material-ui/core/Tab';
import PhoneIcon from '@material-ui/icons/Phone';
import FavoriteIcon from '@material-ui/icons/Favorite';
import PersonPinIcon from '@material-ui/icons/PersonPin';
import HelpIcon from '@material-ui/icons/Help';
import ShoppingBasket from '@material-ui/icons/ShoppingBasket';
import ThumbDown from '@material-ui/icons/ThumbDown';
import ThumbUp from '@material-ui/icons/ThumbUp';
import Typography from '@material-ui/core/Typography';

function TabContainer(props) {
  return (
    <Typography component="div" style={{ padding: 8 * 3 }}>
      {props.children}
    </Typography>
  );
}

TabContainer.propTypes = {
  children: PropTypes.node.isRequired,
};

const useStyles = makeStyles(theme => ({
  root: {
    flexGrow: 1,
    width: '100%',
    backgroundColor: theme.palette.background.paper,
  },
}));

function ScrollableTabsButtonPrevent() {
  const classes = useStyles();
  const [value, setValue] = React.useState(0);

  function handleChange(event, newValue) {
    setValue(newValue);
  }

  return (
    <div className={classes.root}>
      <AppBar position="static">
        <Tabs value={value} onChange={handleChange} variant="scrollable" scrollButtons="off">
          <Tab icon={<PhoneIcon />} />
          <Tab icon={<FavoriteIcon />} />
          <Tab icon={<PersonPinIcon />} />
          <Tab icon={<HelpIcon />} />
          <Tab icon={<ShoppingBasket />} />
          <Tab icon={<ThumbDown />} />
          <Tab icon={<ThumbUp />} />
        </Tabs>
      </AppBar>
      {value === 0 && <TabContainer>Item One</TabContainer>}
      {value === 1 && <TabContainer>Item Two</TabContainer>}
      {value === 2 && <TabContainer>Item Three</TabContainer>}
      {value === 3 && <TabContainer>Item Four</TabContainer>}
      {value === 4 && <TabContainer>Item Five</TabContainer>}
      {value === 5 && <TabContainer>Item Six</TabContainer>}
      {value === 6 && <TabContainer>Item Seven</TabContainer>}
    </div>
  );
}

export default ScrollableTabsButtonPrevent;


text:
'use strict';

angular.module('component2', [
  'component2.table',
  'component2.insert'
 ]);


text:
#ifndef ZBE_ARCHETYPES_IMPLEMENTATIONS_SIMPLEACTIVEPHYSICALOBJECT_H
#define ZBE_ARCHETYPES_IMPLEMENTATIONS_SIMPLEACTIVEPHYSICALOBJECT_H

#include <cstdint>

#include "ZBE/archetypes/ActivePhysicalObject.h"
#include "ZBE/archetypes/implementations/SimplePhysicalObject.h"

#include "ZBE/core/system/system.h"

namespace zbe {

/** \brief Implements the interface of an object that interacts actively with other objects.
 *  Please, if inherit from this class, use APO for naming.
 */
class SimpleActivePhysicalObject : virtual public ActivePhysicalObject, public SimplePhysicalObject {
public:
  /** \brief Creates an Active physical object with two lists, his actuators and the collisionables.
   *  \param actuatorsList Index of a list of actuators. This actuators will be called when this object collide.
   *  \param collisionableList Index of a list of collisionables. The interaction generator look for a collision between this object and any of his collisionables.
   */
  SimpleActivePhysicalObject(uint64_t actuatorsList, uint64_t collisionablesList) : SimplePhysicalObject(actuatorsList), cl(collisionablesList) {}

  /** \brief Virtual destructor.
   */
  virtual ~SimpleActivePhysicalObject() {}

  /** \brief Set the collisionables list.
   *  \param collisionablesList The collisionables list index.
   *  \sa getColliionablesList
   */
  void setCollisionablesList(uint64_t collisionablesList) {cl = collisionablesList;}

  /** \brief Return the collisionables list index.
   *  \return The collisionables list index.
   *  \sa setColliionablesList
   */
  uint64_t getCollisionablesList() {return (cl);}

private:
  uint64_t cl;
};

}  // namespace zbe

#endif //ZBE_ARCHETYPES_IMPLEMENTATIONS_SIMPLEACTIVEPHYSICALOBJECT_H


text:
require 'spec_helper'
require_relative '../../../files/default/vendor/chef-server/fetcher'

describe ChefServer::Fetcher do
  let(:mynode) { Chef::Node.new }
  let(:myprofile) { 'compliance://foobazz' }
  let(:profile_hash) do
    {
      name: 'linux-baseline',
      compliance: 'user/linux-baseline',
      version: '2.1.0',
    }
  end
  let(:profile_hash_target) do
    '/organizations/org/owners/user/compliance/linux-baseline/version/2.1.0/tar'
  end
  let(:non_profile_url) do
    'http://127.0.0.1:8889/organizations/org/owners/user/compliance/linux-baseline/version/2.1.0/tar'
  end

  context 'when target is a string' do
    before :each do
      allow(Chef).to receive(:node).and_return(mynode)
      allow(ChefServer::Fetcher).to receive(:construct_url).and_return(URI(myprofile))
      allow(ChefServer::Fetcher).to receive(:chef_server_visibility?).and_return(true)
    end

    it 'should resolve a target' do
      mynode.default['audit']['fetcher'] = nil
      res = ChefServer::Fetcher.resolve(myprofile)
      expect(res.target).to eq(myprofile)
    end

    it 'should add /compliance URL prefix if needed' do
      mynode.default['audit']['fetcher'] = 'chef-server'
      expect(ChefServer::Fetcher.url_prefix).to eq('/compliance')
    end

    it 'should omit /compliance if not' do
      mynode.default['audit']['fetcher'] = nil
      expect(ChefServer::Fetcher.url_prefix).to eq('')
    end
  end

  context 'when target is a hash' do
    before :each do
      Chef::Config[:chef_server_url] = 'http://127.0.0.1:8889/organizations/org'
      allow(Chef).to receive(:node).and_return(mynode)
    end

    it 'should resolve a target with a version' do
      mynode.default['audit']['fetcher'] = nil
      res = ChefServer::Fetcher.resolve(profile_hash)
      expect(res.target).to eq("http://127.0.0.1:8889#{profile_hash_target}")
    end
  end

  context 'when profile not found' do
    before :each do
      Chef::Config[:verify_api_cert] = false
      Chef::Config[:ssl_verify_mode] = :verify_none
      allow(Chef).to receive(:node).and_return(mynode)
    end

    it 'should raise error' do
      myproc = proc {
        config = {
          'server_type' => 'automate',
          'automate' => {
            'ent' => 'my_ent',
            'token_type' => 'dctoken',
          },
          'profile' => ['admin', 'linux-baseline', '2.0'],
        }
        mynode.default['audit']['reporter'] = 'chef-server'
        ChefServer::Fetcher.target_url('non_profile_url', config).read
      }
      expect { myproc.call }.to raise_error(Errno::ECONNREFUSED)
    end
  end
end


text: module.exports = require('./lib/chi-square');


text:
package org.genyris.test.io;

import java.io.StringReader;
import java.io.StringWriter;
import junit.framework.TestCase;

import org.genyris.exception.GenyrisException;
import org.genyris.interp.Interpreter;
import org.genyris.load.SourceLoader;

public class SourceLoaderTest extends TestCase {

    protected void setUp() throws Exception {
        super.setUp();
    }

    private void excerciseSourceLoader(String input, String expected)
            throws GenyrisException {
        Interpreter interp = new Interpreter();
        interp.init(false);
        StringReader in = new StringReader(input);
        StringWriter out = new StringWriter();
        SourceLoader.executeScript(interp.getGlobalEnv(), ".g",
                interp.getSymbolTable(), in, out);
        assertEquals(expected, out.toString());

    }

    public void testSourceLoader1() throws GenyrisException {
        excerciseSourceLoader("list 1\n list 2\n ~22\n\nlist 3 4", "");
        excerciseSourceLoader(
                "list 1\n list 2\n ~22\n\ndef f (x) \n      cons x x", "");
        excerciseSourceLoader(
                "list 22\n  list\n      the 333\n\nlist ^f ^(x)\n    cons 1 2\n",
                "");

    }

    public void testSourceLoader2() throws GenyrisException {
        Interpreter interp = new Interpreter();
        interp.init(false);
        StringWriter out = new StringWriter();
        SourceLoader.loadScriptFromClasspath(interp.getGlobalEnv(),
                interp.getSymbolTable(), "org/genyris/load/boot/init.g", out);
    }

    public void testSourceLoader3() throws GenyrisException {
        Interpreter interp = new Interpreter();
        interp.init(false);
        StringWriter out = new StringWriter();
        SourceLoader.loadScriptFromClasspath(interp.getGlobalEnv(),
                interp.getSymbolTable(), "test/fixtures/factorial.g", out);
    }

    public void testSourceLoaderLisp() throws GenyrisException {
        Interpreter interp = new Interpreter();
        interp.init(false);
        StringWriter out = new StringWriter();
        SourceLoader.loadScriptFromClasspath(interp.getGlobalEnv(),
                interp.getSymbolTable(), "test/fixtures/factorial.lsp", out);
    }
}


text:
function simpleController($scope)
{
	$scope.user = {name:"Israel"}
}


text:
{{ define "footer" }}

		<script type="text/javascript" src="/assets/js/scripts.js"></script>
	</body>
</html>

{{ end }}


text:
void Launcher::displayJNIError(std::string prefix, int error)
{
    switch(error)
    {
        case JNI_OK: std::cout << prefix << ": success" << std::endl; return;
        case JNI_ERR: std::cerr << prefix << ": unknown error" << std::endl; return;
        case JNI_EDETACHED: std::cerr << prefix << ": thread detached from the VM" << std::endl; return;
        case JNI_EVERSION : std::cerr << prefix << ": JNI version error" << std::endl; return;
        case JNI_ENOMEM : std::cerr << prefix << ": not enough memory" << std::endl; return;
        case JNI_EEXIST : std::cerr << prefix << ": VM already created" << std::endl; return;
        case JNI_EINVAL : std::cerr << prefix << ": invalid arguments" << std::endl; return;
    }
}

JNIEnv* Launcher::getEnv()
{
    JNIEnv* ret;

    if(!jvm)
    {
        std::cerr << "JVM not started" << std::endl;
        return nullptr;
    }
    jvm->GetEnv((void**) &ret, JNI_VERSION_1_6);
    if(!ret)
    {
        std::cerr << "Cannot get env" << std::endl;
        return nullptr;
    }

    return ret;
}

void Launcher::attachCurrentThread()
{
    if(!jvm)
    {
        std::cerr << "JVM not started" << std::endl;
        return;
    }

    JNIEnv* tmp;
    jvm->AttachCurrentThread((void**)&tmp, 0);
}

void Launcher::detachCurrentThread()
{
    if(!jvm)
    {
        std::cerr << "JVM not started" << std::endl;
        return;
    }

    jvm->DetachCurrentThread();
}

bool Launcher::callBooleanMethod(JavaMethod *method, jobject obj, ...)
{
    JNIEnv* env = getEnv();
    if(!env) return false;

    bool returnValue = false;
    if(env->IsInstanceOf(obj, method->clazz))
    {
        va_list arglist;
        va_start(arglist, obj);
        returnValue = env->CallBooleanMethodV(obj, method->methodID, arglist);
        va_end(arglist);
    }
    else
    {
        std::cerr << __PRETTY_FUNCTION__ << ": Unexpected object type" << std::endl;
    }

    return returnValue;
}

void Launcher::call(JavaMethod *method, jobject obj, ...)
{
    JNIEnv* env = getEnv();
    if(!env) return;

    if(env->IsInstanceOf(obj, method->clazz))
    {
        va_list arglist;
        va_start(arglist, obj);
        env->CallVoidMethodV(obj, method->methodID, arglist);
        va_end(arglist);
    }
    else
    {
        std::cerr << __PRETTY_FUNCTION__ << ": Unexpected object type" << std::endl;
    }
}

void Launcher::call(StaticJavaMethod *method, ...)
{
    JNIEnv* env = getEnv();
    if(!env) return;

    va_list arglist;
    va_start(arglist, method);
    env->CallStaticVoidMethodV(method->clazz, method->methodID, arglist);
    va_end(arglist);
}

Launcher::Launcher(std::string vmOptions)
{
    vmArguments.version = JNI_VERSION_1_6;

    std::istringstream vmOptionsTokens(vmOptions);

    std::vector<std::string> options;
    while(!vmOptionsTokens.eof())
    {
        std::string option;
        std::getline(vmOptionsTokens, option, ' ');
        options.push_back(option);
    }

    JavaVMOption* javaOptions = new JavaVMOption[options.size()];
    for(uint i = 0; i < options.size(); i++)
    {
        javaOptions[i].optionString = new char[options.at(i).length() + 1];
        std::strcpy (javaOptions[i].optionString, options.at(i).c_str());
    }

    vmArguments.nOptions = (jint) options.size();
    vmArguments.options = javaOptions;
    vmArguments.ignoreUnrecognized = JNI_TRUE;
}

bool Launcher::startVM(std::string workingDirectory)
{

    DIR* currentDirectory = opendir(".");
    if(workingDirectory != "." && workingDirectory != "")
    {
        if(chdir(workingDirectory.c_str()) == -1)
        {
            std::cerr << "Cannot change directory to " << workingDirectory << std::endl;
            closedir(currentDirectory);
            return false;
        }

    }

    char temp [PATH_MAX];
    if(getcwd(temp, PATH_MAX) == 0); // Ignore return type
    std::cout << "Starting Java VM from path  " << temp << std::endl;

    JNIEnv* env;
    jint res = JNI_CreateJavaVM(&jvm, (void**) &env, &vmArguments);
    displayJNIError("Started Java VM", res);

    if(workingDirectory != ".")
    {
        if(fchdir(dirfd(currentDirectory)) != 0)
        {
            std::cerr << "Cannot return to previous working directory" << std::endl;
        }
    }
    closedir(currentDirectory);
    if(res == JNI_OK)
    {
        return true;
    }
    else
    {
        jvm = nullptr;
        return false;
    }
}

jclass Launcher::getClass(std::string className)
{
    JNIEnv* env = getEnv();
    if(!env) return nullptr;

    std::string classNameCopy(className);
    std::replace (classNameCopy.begin(), classNameCopy.end(), '.', '/');

    jclass cls = env->FindClass(classNameCopy.c_str());
    if(!cls)
    {
        std::cerr << "Cannot find class " << classNameCopy << std::endl;
        return nullptr;
    }
    return cls;
}

jobject Launcher::createObject(JavaMethod *constructor, ...)
{
    JNIEnv* env = getEnv();
    if(!env) return nullptr;

    va_list arglist;
    va_start(arglist, constructor);
    jobject newObject = env->NewObjectV(constructor->clazz, constructor->methodID, arglist);
    va_end(arglist);
    if(newObject)
    {
        return env->NewGlobalRef(newObject);
    }
    else
    {
        return nullptr;
    }

}

void Launcher::release(jobject object)
{
    JNIEnv* env = getEnv();
    if(!env) return;

    env->DeleteGlobalRef(object);
}

StaticJavaMethod* Launcher::getStaticJavaMethod(std::string className, std::string methodName, std::string signature)
{

    JNIEnv* env = getEnv();
    if(!env) return nullptr;

    jclass cls = getClass(className);
    if(!cls) return nullptr;

    jmethodID mid = env->GetStaticMethodID(cls, methodName.c_str(), signature.c_str());
    if(!mid)
    {
        std::cerr << "Cannot find method " << methodName << signature << std::endl;
        return nullptr;
    }

    StaticJavaMethod* method = new StaticJavaMethod();
    method->clazz = (jclass) env->NewGlobalRef(cls);
    method->methodID = mid;

    return method;
}

void Launcher::release(StaticJavaMethod *method)
{
    release(method->clazz);
    delete method;
}

void Launcher::release(JavaMethod *method)
{
    release(method->clazz);
    delete method;
}

JavaMethod* Launcher::getJavaMethod(std::string className, std::string methodName, std::string signature)
{

    JNIEnv* env = getEnv();
    if(!env) return nullptr;

    jclass cls = getClass(className);
    if(!cls) return nullptr;

    jmethodID mid = env->GetMethodID(cls, methodName.c_str(), signature.c_str());
    if(!mid)
    {
        std::cerr << "Cannot find method " << methodName << "()" << std::endl;
        return nullptr;
    }

    JavaMethod* method = new JavaMethod();
    method->clazz = (jclass) env->NewGlobalRef(cls);
    method->methodID = mid;

    return method;
}

bool Launcher::registerNativeMethod(std::string className, std::string methodName, std::string signature, void *functionPointer)
{
    JNIEnv* env = getEnv();
    if(!env) return false;

    jclass cls = getClass(className);
    if(!cls) return false;

    JNINativeMethod *method = new JNINativeMethod[1];
    method[0].name = new char[methodName.length() + 1];
    method[0].signature = new char[signature.length() + 1];

    std::strcpy(method[0].name, methodName.c_str());
    std::strcpy(method[0].signature, signature.c_str());

    method[0].fnPtr = functionPointer;

    int res = env->RegisterNatives(cls, method, 1);
    if(res != JNI_OK)
    {
        displayJNIError("Cannot register native method", res);
        return false;
    }
    else
    {
        return true;
    }
}

bool Launcher::stopVM()
{
    if(!jvm)
    {
        std::cerr << "Cannot stop JVM, JVM is not started yet" << std::endl;
        return false;
    }
    jint res = jvm->DestroyJavaVM();
    displayJNIError("Stopping Java VM", res);

    if(res == JNI_OK)
    {
        jvm = nullptr;
        return true;
    }
    else
    {
        return false;
    }

}

bool Launcher::isAssignableFrom(std::string subclass, std::string superclass)
{
    JNIEnv* env = getEnv();
    if(!env) return false;

    jclass sub = getClass(subclass);
    jclass sup = getClass(superclass);

    if(sub && sup)
    {
        return env->IsAssignableFrom(sub, sup);
    }
    else
    {
        return false;
    }
}

Launcher::~Launcher()
{
//    if(jvm)
//        stopVM();

    delete vmArguments.options;
}


text:
package br.com.caelum.tubaina.parser.html.desktop;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import br.com.caelum.tubaina.parser.pygments.CodeCache;
import br.com.caelum.tubaina.parser.pygments.CodeOutputType;
import br.com.caelum.tubaina.util.CommandExecutor;

import com.google.inject.Inject;

public class SyntaxHighlighter {

    private final CommandExecutor commandExecutor;
    private CodeOutputType output;

    public static final String HTML_OUTPUT = "html";
    public static final String LATEX_OUTPUT = "latex";

    private CodeCache codeCache;

    @Inject
    public SyntaxHighlighter(CommandExecutor commandExecutor, CodeOutputType outputType, CodeCache codeCache) {
        this.commandExecutor = commandExecutor;
        this.output = outputType;
        this.codeCache = codeCache;
    }

    public String highlight(String code, String language, boolean numbered, List<Integer> lines, String pygmentsOptions) {
        String codeAndOptions = code + numbered;
		if (codeCache.exists(codeAndOptions)) {
            return codeCache.find(codeAndOptions);
        }
        ArrayList<String> commandWithArgs = buildCommand(language, numbered, lines, pygmentsOptions);
        String codeHighlighted = commandExecutor.execute(commandWithArgs, code);

        codeCache.write(codeAndOptions, codeHighlighted);
        return codeHighlighted;
    }

    public String highlight(String code, String language, boolean numbered, String pygmentsOptions) {
    	List<Integer> list = Collections.emptyList();
    	return highlight(code, language, numbered, list, pygmentsOptions);
    }

    private ArrayList<String> buildCommand(String language, boolean numbered, List<Integer> lines, String pygmentsOptions) {
        StringBuilder options = new StringBuilder();
        pygmentsOptions = pygmentsOptions.isEmpty() ? "" : "," + pygmentsOptions;
        options.append(pygmentsOptions);
        if (numbered || output.equals(CodeOutputType.KINDLE_HTML)) { // for kindle output all lines are numbered
            appendLineNumberingOption(options);
        }

        addLineHighlightOption(lines, options);

        String encoding = System.getProperty("file.encoding");

        ArrayList<String> commands = new ArrayList<String>();
        commands.add("pygmentize");
        commands.add("-O");
        commands.add("encoding=" + encoding + ",outencoding=UTF-8" + options);
        if (output.equals(CodeOutputType.LATEX)) {
            commands.add("-P");
            commands.add("verboptions=numbersep=5pt");
        }
        commands.add("-f");
        commands.add(output.pygmentsFormatterName());
        commands.add("-l");
        commands.add(language);
        return commands;
    }

    private void appendLineNumberingOption(StringBuilder options) {
        if (output.equals(CodeOutputType.HTML) || output.equals(CodeOutputType.KINDLE_HTML)) {
            options.append(",linenos=inline");
        } else {
            options.append(",linenos=yes");
        }

    }

    private void addLineHighlightOption(List<Integer> lines, StringBuilder options) {
        if (!lines.isEmpty()) {
            options.append(",hl_lines=");
            for (Integer line : lines) {
                options.append(line.toString());
                options.append(" ");
            }
            options.deleteCharAt(options.length() - 1);
            options.append("");
        }
    }

}


text:
using System;
using Vevo.WebUI.BaseControls;

public partial class Blog_Themes_BlogTheme_LayoutControls_Right : BaseLayoutControl
{
    protected void Page_Load( object sender, EventArgs e )
    {

    }
}


text:
cask 'bookmacster' do
  version '2.10.17'
  sha256 '8de7102d5cc599569f0172b6bb96bfbc93b286713984931fbf0fc0341cdf1ab7'

  url 'https://sheepsystems.com/bookmacster/BookMacster.zip'
  appcast 'https://sheepsystems.com/bookmacster/appcast.xml'
  name 'BookMacster'
  homepage 'https://sheepsystems.com/products/bookmacster.html'

  auto_updates true
  depends_on macos: '>= :yosemite'

  app 'BookMacster.app'

  zap trash: [
               '~/Library/Application Support/BookMacster',
               '~/Library/Caches/com.sheepsystems.BookMacster',
               '~/Library/Preferences/com.sheepsystems.BookMacster.plist',
               '~/Library/Saved Application State/com.sheepsystems.BookMacster.savedState',
             ]
end


text:
<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textSize="20sp"
    android:gravity="left"
    android:padding="5dip"
    android:id="@+id/dropdown_selection"
    />


text:
package com.helicalinsight.externalauth.jwt;

import com.helicalinsight.admin.model.User;

import com.helicalinsight.datasource.managed.JsonUtils;
import com.helicalinsight.efw.utility.ConfigurationFileReader;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.Map;

/**
 * @author Rajesh
 *         Created by author on 17/7/2019.
 */

@CrossOrigin(origins = "*", maxAge = 3600)
@RestController
@RequestMapping("/rest")
public class AuthenticationController {

    Map<String, String> mapFromClasspathPropertiesFile = ConfigurationFileReader.mapFromClasspathPropertiesFile
            ("project.properties");
    @Autowired
    private AuthenticationManager authenticationManager;
    @Autowired
    private TokenProvider jwtTokenUtil;
    @Autowired
    private TokenProvider tokenProvider;

    @RequestMapping(value = "/authToken", method = RequestMethod.POST)
    public ResponseEntity<?> register(@RequestBody User loginUser) throws AuthenticationException {
        String TOKEN_PREFIX = mapFromClasspathPropertiesFile.get("token_prefix");
        final Authentication authentication;
        try {
            authentication = authenticationManager.authenticate(
                    new UsernamePasswordAuthenticationToken(
                            loginUser.getUsername(),
                            loginUser.getPassword()
                    )
            );
        } catch (Exception e) {
            return JsonUtils.get500ErrorResponse(e);
        }
        //todo need to send 500 error type if authentication fails.
        SecurityContextHolder.getContext().setAuthentication(authentication);
        final String token = jwtTokenUtil.generateToken(authentication);
        Date issueDateFromToken = tokenProvider.getIssueDateFromToken(token);
        Date expirationDateFromToken = tokenProvider.getExpirationDateFromToken(token);
        return ResponseEntity.ok()
                .header("token-issue", issueDateFromToken.toString())
                .header("token-expiration", expirationDateFromToken.toString())
                .header("token", TOKEN_PREFIX + token)
                .body(new AuthToken(TOKEN_PREFIX + token, issueDateFromToken, expirationDateFromToken));
    }

}


text:
#ifndef tomvizModuleOrthogonalSlice_h
#define tomvizModuleOrthogonalSlice_h

#include "Module.h"
#include "vtkWeakPointer.h"

class vtkSMProxy;
class vtkSMSourceProxy;

namespace tomviz
{
class ModuleOrthogonalSlice : public Module
{
  Q_OBJECT
  typedef Module Superclass;
public:
  ModuleOrthogonalSlice(QObject* parent=NULL);
  virtual ~ModuleOrthogonalSlice();

  virtual QString label() const { return  "Orthogonal Slice"; }
  virtual QIcon icon() const;
  virtual bool initialize(DataSource* dataSource, vtkSMViewProxy* view);
  virtual bool finalize();
  virtual bool setVisibility(bool val);
  virtual bool visibility() const;
  virtual void addToPanel(pqProxiesWidget*);
  virtual bool serialize(pugi::xml_node& ns) const;
  virtual bool deserialize(const pugi::xml_node& ns);
  virtual bool isColorMapNeeded() const { return true; }

protected:
  virtual void updateColorMap();

private:
  Q_DISABLE_COPY(ModuleOrthogonalSlice)
  vtkWeakPointer<vtkSMSourceProxy> PassThrough;
  vtkWeakPointer<vtkSMProxy> Representation;
};

}
#endif


text:
import cmd

class HelloWorld(cmd.Cmd):
    """Simple command processor example."""

    prompt = 'prompt: '
    intro = "Simple command processor example."

    doc_header = 'doc_header'
    misc_header = 'misc_header'
    undoc_header = 'undoc_header'

    ruler = '-'

    def do_prompt(self, line):
        "Change the interactive prompt"
        self.prompt = line + ': '

    def do_greet(self, person):
        """greet [person]
        Greet the named person"""
        if person:
            print("type(arg) = {},  arg={}".format(type(person), person))
            print("hi, {}".format(person))
        else:
            print('hi')

    def do_EOF(self, line):
        """ Called when <Ctrl>-d is pressed to exit """
        return True

    def postloop(self):
        """ Called at end just to ensure final newline when exiting """
        print()

if __name__ == '__main__':
    HelloWorld().cmdloop()