text:
const program = require('commander');
const packageConfig = require('../package');
const config = require('./modules/config');
const fileOps = require('./modules/file-ops');
const chalk = require('chalk');

function displayError(err) {
  console.log(chalk.red(err.message));
}

function displayInformation(message, verbose) {
  if (verbose) {
    console.log(chalk.yellow(message));
  }
}

program
  .version(packageConfig.version)
  .option('-v, --verbose', 'verbose output')
  .parse(process.argv);

const workingDir = process.cwd();
const cleanupConfig = config(workingDir);

// remove files to be removed
if (cleanupConfig.remove) {
  cleanupConfig.remove.forEach((fileConfig) => {
    if (fileConfig.file) {
      fileOps.remove(`${workingDir}/${fileConfig.file}`, (err) => {
        if (err) {
          displayError(err);
        }
        else {
          displayInformation(`removed ${fileConfig.file}`, program.verbose);
        }
      });
    }
    else if (fileConfig.folder) {
      fileOps.removeFolder(`${workingDir}/${fileConfig.folder}`, (err) => {
        if (err) {
          displayError(err);
        }
        else {
          displayInformation(`removed ${fileConfig.folder}`, program.verbose);
        }
      });
    }
  });
}

// add files to be added
if (cleanupConfig.add) {
  cleanupConfig.add.forEach((fileConfig) => {
    fileOps.add(`${workingDir}/${fileConfig.file}`, (err) => {
      if (err) {
        displayError(err);
      }
      else {
        displayInformation(`added ${fileConfig.file}`, program.verbose);
      }
    });
  });
}

// clean files to be cleaned
if (cleanupConfig.clean) {
  cleanupConfig.clean.forEach((fileConfig) => {
    if (fileConfig.clear) {
      fileOps.clear(`${workingDir}/${fileConfig.file}`, (err) => {
        if (err) {
          displayError(err);
        }
        else {
          displayInformation(`cleared ${fileConfig.file}`, program.verbose);
        }
      });
    }
    else if (fileConfig.pattern) {
      fileOps.deleteLine(
        `${workingDir}/${fileConfig.file}`,
        fileConfig.pattern,
        (err) => {
          if (err) {
            displayError(err);
          }
          else {
            displayInformation(
              `removed line in ${fileConfig.file} matching ${fileConfig.pattern.toString()}`,
              program.verbose);
          }
        });
    }
    else if (fileConfig.deleteRange) {
      fileOps.deleteRange(
        `${workingDir}/${fileConfig.file}`,
        fileConfig.deleteRange,
        (err) => {
          if (err) {
            displayError(err);
          }
          else {
            displayInformation(
              `deleted line range in ${fileConfig.file} for ${fileConfig.deleteRange}`,
              program.verbose
            );
          }
        }
      )
    }
  });
}


text:
"""CAS authentication middleware"""

from urllib import parse as urllib_parse

from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.views import LoginView as login, LogoutView as logout
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils.deprecation import MiddlewareMixin
from django.utils.translation import gettext_lazy as _

from .views import LoginView as cas_login, LogoutView as cas_logout

__all__ = ["CASMiddleware"]

class CASMiddleware(MiddlewareMixin):
    """Middleware that allows CAS authentication on admin pages"""

    def process_request(self, request):
        """Checks that the authentication middleware is installed"""

        error = ("The Django CAS middleware requires authentication "
                 "middleware to be installed. Edit your MIDDLEWARE_CLASSES "
                 "setting to insert 'django.contrib.auth.middleware."
                 "AuthenticationMiddleware'.")
        if not hasattr(request, 'user'):
            raise ImproperlyConfigured(error)

    def process_view(self, request, view_func, view_args, view_kwargs):
        """Forwards unauthenticated requests to the admin page to the CAS
        login URL, as well as calls to django.contrib.auth.views.login and
        logout.
        """

        if view_func == login:
            return cas_login(request, *view_args, **view_kwargs)

        if view_func == logout:
            return cas_logout(request, *view_args, **view_kwargs)

        if view_func in (cas_login, cas_logout):
            return None

        if settings.CAS_ADMIN_REDIRECT:
            if settings.CAS_ADMIN_PREFIX:
                if not request.path.startswith(settings.CAS_ADMIN_PREFIX):
                    return None
            elif not view_func.__module__.startswith('django.contrib.admin.'):
                return None
        else:
            return None

        if view_func.__name__ == 'logout':
            return HttpResponseRedirect(reverse(settings.CAS_LOGOUT_URL_NAME))

        if request.user.is_authenticated:
            if request.user.is_staff:
                return None
            raise PermissionDenied(_('You do not have staff privileges.'))
        params = urllib_parse.urlencode({REDIRECT_FIELD_NAME: request.get_full_path()})
        return HttpResponseRedirect(reverse(settings.CAS_LOGIN_URL_NAME) + '?' + params)

redpajama_set_name: RedPajamaGithub


text:
import { createStyles } from "@material-ui/core";

const cardBodyStyle = createStyles({
  cardBody: {
    padding: "0.9375rem 1.875rem",
    flex: "1 1 auto"
  }
});

export default cardBodyStyle;


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

using GoToInterfaceImplementation.Domain.Contracts.Code;
using GoToInterfaceImplementation.Domain.Contracts.Services;

namespace GoToInterfaceImplementation.Domain
{
    public class ImplementationSelector : IImplementationSelector
    {
        public Task<ISemanticElement> SelectAsync(IEnumerable<ISemanticElement> semanticElementImplementations)
        {
            ISemanticElement firstImplementation = semanticElementImplementations.FirstOrDefault();

            return Task.FromResult(firstImplementation);
        }
    }
}


text:
<?php
defined('C5_EXECUTE') or die("Access Denied.");
/** @var \Concrete\Block\Feature\Controller $controller */
/** @var \Concrete\Core\Form\Service\Form $form */
$bID = $bID ?? 0;
$icon = $icon ?? '';
$title = $title ?? '';
$titleFormat = $titleFormat ?? '';
$internalLinkCID = $internalLinkCID ?? 0;
$externalLink = $externalLink ?? '';
?>

<fieldset>
    <legend><?=t('Display')?></legend>

        <?php echo $form->label('icon', t('Icon'))?>
        <div id="ccm-icon-selector-<?= h($bID) ?>">
            <icon-selector name="icon" selected="<?= h($icon) ?>" title="<?= t('Choose Icon') ?>" empty-option-label="<?= h(tc('Icon', '** None Selected')) ?>" />

        <?php echo $form->label("title", t('Title')); ?>

		    <?php echo $form->text('title', $title); ?>
			<?php echo $form->select('titleFormat', \Concrete\Core\Block\BlockController::$btTitleFormats, $titleFormat, array('style' => 'width:105px;flex-grow:0;', 'class' => 'form-select')); ?>

        <?php echo $form->label('paragraph', t('Paragraph:'));?>
        <?php
            $editor = Core::make('editor');
            echo $editor->outputBlockEditModeEditor('paragraph', $controller->getParagraphEditMode());
        ?>

</fieldset>

<fieldset>
    <legend><?=t('Link')?></legend>

        <select name="linkType" data-select="feature-link-type" class="form-select">
            <option value="0" <?=(empty($externalLink) && empty($internalLinkCID) ? 'selected="selected"' : '')?>><?=t('None')?></option>
            <option value="1" <?=(empty($externalLink) && !empty($internalLinkCID) ? 'selected="selected"' : '')?>><?=t('Another Page')?></option>
            <option value="2" <?=(!empty($externalLink) ? 'selected="selected"' : '')?>><?=t('External URL')?></option>
        </select>

        <?=$form->label('internalLinkCID', t('Choose Page:'))?>
        <?= Loader::helper('form/page_selector')->selectPage('internalLinkCID', $internalLinkCID); ?>

        <?=$form->label('externalLink', t('URL'))?>
        <?= $form->text('externalLink', $externalLink); ?>

</fieldset>


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Myriocephalum hederaecolum De Not.

### Remarks
null


text:
layout: page
title: Murphy Inc. Seminar
date: 2016-05-24
author: Bryan Riley
tags: weekly links, java
status: published
summary: Etiam nec nibh elementum, gravida libero sed, facilisis.
banner: images/banner/office-01.jpg
booking:
  startDate: 09/24/2019
  endDate: 09/25/2019
  ctyhocn: FDRMDHX
  groupCode: MIS
published: true
---
Curabitur at lectus commodo, ullamcorper mi eu, lacinia felis. Sed dapibus metus ac porta congue. Quisque felis ipsum, tempor quis metus sed, interdum varius sapien. Mauris rutrum vehicula sapien, vitae venenatis massa vehicula in. Aenean sit amet efficitur nisl. Morbi maximus justo sed quam pulvinar, id congue turpis cursus. Maecenas molestie lectus et nisi hendrerit, eget dictum neque tincidunt. Vestibulum eget nulla ac libero tempor efficitur. Proin tristique metus ut ipsum bibendum vulputate. Vivamus non massa ex. Pellentesque cursus faucibus urna, sed auctor ipsum aliquam at.

1 Proin mattis velit sed ante laoreet placerat
1 Vivamus ut mauris et purus dictum ultricies
1 Curabitur aliquet magna non libero cursus, at volutpat metus facilisis
1 Donec ultrices lacus in tincidunt venenatis.

Proin commodo, justo eget placerat molestie, purus neque semper quam, non finibus sem ipsum in ligula. Mauris tincidunt cursus dolor vitae iaculis. Donec in massa malesuada lectus dictum blandit vitae eget felis. Donec eget tempor erat. Quisque aliquam est ac risus aliquet, vitae venenatis purus malesuada. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nam vestibulum tortor a orci suscipit, et semper est pretium. Donec interdum tincidunt nisl, et varius arcu vestibulum eu. Nullam id hendrerit diam.


text:
ProphetCheck
============

Easy Angular Project for Validating Prophecy

#### References
[Angular Tutorial](http://docs.angularjs.org/tutorial)
[Crypto](https://code.google.com/p/crypto-js/#SHA-3)
[Angular Example](https://github.com/bertschneider/angularjs-webtools)


text:
import React from 'react';

import renderer from 'react-test-renderer';
import SparkOAuth from '.';
import {createMockSpark} from '@ciscospark/react-redux-spark';

describe(`SparkOAuth component`, () => {

  const component = renderer.create(
    <SparkOAuth />
  );

  it(`renders properly`, () => {
    expect(component).toMatchSnapshot();
  });
});

describe(`SparkOAuth functionality`, () => {
  let onAuth, spark, sparkOAuth;
  beforeEach(() => {
    onAuth = jest.fn();
    sparkOAuth = new SparkOAuth({doAuth: false, onAuth});
    spark = createMockSpark();
    sparkOAuth.spark = spark;
  });

  it(`should call spark auth when told`, () => {
    sparkOAuth.props.doAuth = false;
    const props = {doAuth: true};
    sparkOAuth.componentWillReceiveProps(props);
    expect(spark.authenticate).toHaveBeenCalled();
  });

  it(`should call onAuth after a successful authorization`, () => {
    spark.credentials.canAuthorize = true;
    spark.credentials.supertoken = `supertoken`;
    sparkOAuth.checkForOauthToken();
    expect(onAuth).toHaveBeenCalled();
  });

  it(`should not call onAuth when not authorized`, () => {
    spark.credentials.canAuthorize = false;
    spark.credentials.supertoken = `supertoken`;
    sparkOAuth.checkForOauthToken();
    expect(onAuth).not.toHaveBeenCalled();
  });

});


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>LDAPInstruction</title>
<meta name="date" content="2014-03-17">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

controls.protocols.ldap

Class LDAPInstruction

java.lang.Object

shared.AbstractInstruction

controls.protocols.ldap.LDAPInstruction

All Implemented Interfaces:

java.io.Serializable, IInstruction

public class LDAPInstruction
extends AbstractInstruction

Version:

1.0

Author:

David Lecoconnier david.lecoconnier@gmail.com, Jean-Luc Amitousa-Mankoy jeanluc.amitousa.mankoy@gmail.com

See Also:

Serialized Form

Constructor Summary

Constructors

Constructor and Description

LDAPInstruction()

Method Summary

Methods

Modifier and Type
Method and Description

java.lang.String
writeJSONString()

Turns the instruction into a JSON string

Methods inherited from class shared.AbstractInstruction

getBinaryRequest, getBinaryResponse, getName, getReadableRequest, setBinaryRequest, setBinaryResponse, setName, setReadableRequest

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

LDAPInstruction

public LDAPInstruction()

Method Detail

writeJSONString

public java.lang.String writeJSONString()

Description copied from interface: IInstruction

Turns the instruction into a JSON string

Returns:

a JSON string

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
bool indoorio_fs_init();

#endif


text:
namespace chromeos {
namespace system {

// Observes changes in device hierarchy. When a new touchpad/mouse is attached,
// applies the last used touchpad/mouse settings to the system.
class DeviceChangeHandler : public PointerDeviceObserver::Observer {
 public:
  DeviceChangeHandler();
  virtual ~DeviceChangeHandler();

 private:
  // PointerDeviceObserver::Observer implementation.
  virtual void TouchpadExists(bool exists) override;
  virtual void MouseExists(bool exists) override;

  scoped_ptr<PointerDeviceObserver> pointer_device_observer_;
};

}  // namespace system
}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_SYSTEM_DEVICE_CHANGE_HANDLER_H_


text:
package com.mcparland.john;

/*
 * #%L
 * Chapter 2: Controlling Components over CSS Layout
 * %%
 * Copyright (C) 2014 John McParland
 * %%
 * 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.
 * #L%
 */

import com.vaadin.ui.Label;

/**
 * A "tag" on a tag cloud.
 *
 * @author John McParland
 *
 */
@SuppressWarnings("serial")
public class TagLabel extends Label {

    private int fontSize = 0;

    /**
     * Create a TagLabel.
     *
     * @param text
     *            the text to display
     * @param fontSize
     *            the size to display the text.
     */
    public TagLabel(String text, int fontSize) {
        super(text);
        this.fontSize = fontSize;
        this.setSizeUndefined();
    }

    /**
     * Get the fontSize.
     *
     * @return the fontSize.
     */
    public int getFontSize() {
        return fontSize;
    }

    /**
     * Set the fontSize.
     *
     * @param fontSize
     *            the fontSize to set.
     */
    public void setFontSize(int fontSize) {
        this.fontSize = fontSize;
    }
}


text:
class RegularExpression
{
public:

						RegularExpression( string expression, bool lazyCompilation = false );
						~RegularExpression();

	bool				IsMatch( string inputString );

private:

	string				expression;
	bool				lazyCompilation;
	bool				isCompiled;

	void				Compile();
};


text:
import { ConnectableObservable } from '../observable/ConnectableObservable';
import { Subscription } from '../Subscription';
import { MonoTypeOperatorFunction } from '../types';
import { operate } from '../util/lift';
import { createOperatorSubscriber } from './OperatorSubscriber';

/**
 * Make a {@link ConnectableObservable} behave like a ordinary observable and automates the way
 * you can connect to it.
 *
 * Internally it counts the subscriptions to the observable and subscribes (only once) to the source if
 * the number of subscriptions is larger than 0. If the number of subscriptions is smaller than 1, it
 * unsubscribes from the source. This way you can make sure that everything before the *published*
 * refCount has only a single subscription independently of the number of subscribers to the target
 * observable.
 *
 * Note that using the {@link share} operator is exactly the same as using the `multicast(() => new Subject())` operator
 * (making the observable hot) and the *refCount* operator in a sequence.
 *
 * ![](refCount.png)
 *
 * ## Example
 *
 * In the following example there are two intervals turned into connectable observables
 * by using the *publish* operator. The first one uses the *refCount* operator, the
 * second one does not use it. You will notice that a connectable observable does nothing
 * until you call its connect function.
 *
 * ```ts
 * import { interval, tap, publish, refCount } from 'rxjs';
 *
 * // Turn the interval observable into a ConnectableObservable (hot)
 * const refCountInterval = interval(400).pipe(
 *   tap(num => console.log(`refCount ${ num }`)),
 *   publish(),
 *   refCount()
 * );
 *
 * const publishedInterval = interval(400).pipe(
 *   tap(num => console.log(`publish ${ num }`)),
 *   publish()
 * );
 *
 * refCountInterval.subscribe();
 * refCountInterval.subscribe();
 * // 'refCount 0' -----> 'refCount 1' -----> etc
 * // All subscriptions will receive the same value and the tap (and
 * // every other operator) before the `publish` operator will be executed
 * // only once per event independently of the number of subscriptions.
 *
 * publishedInterval.subscribe();
 * // Nothing happens until you call .connect() on the observable.
 * ```
 *
 * @return A function that returns an Observable that automates the connection
 * to ConnectableObservable.
 * @see {@link ConnectableObservable}
 * @see {@link share}
 * @see {@link publish}
 * @deprecated Replaced with the {@link share} operator. How `share` is used
 * will depend on the connectable observable you created just prior to the
 * `refCount` operator.
 * Details: https://rxjs.dev/deprecations/multicasting
 */
export function refCount<T>(): MonoTypeOperatorFunction<T> {
  return operate((source, subscriber) => {
    let connection: Subscription | null = null;

    (source as any)._refCount++;

    const refCounter = createOperatorSubscriber(subscriber, undefined, undefined, undefined, () => {
      if (!source || (source as any)._refCount <= 0 || 0 < --(source as any)._refCount) {
        connection = null;
        return;
      }

      ///
      // Compare the local RefCountSubscriber's connection Subscription to the
      // connection Subscription on the shared ConnectableObservable. In cases
      // where the ConnectableObservable source synchronously emits values, and
      // the RefCountSubscriber's downstream Observers synchronously unsubscribe,
      // execution continues to here before the RefCountOperator has a chance to
      // supply the RefCountSubscriber with the shared connection Subscription.
      // For example:
      // ```
      // range(0, 10).pipe(
      //   publish(),
      //   refCount(),
      //   take(5),
      // )
      // .subscribe();
      // ```
      // In order to account for this case, RefCountSubscriber should only dispose
      // the ConnectableObservable's shared connection Subscription if the
      // connection Subscription exists, *and* either:
      //   a. RefCountSubscriber doesn't have a reference to the shared connection
      //      Subscription yet, or,
      //   b. RefCountSubscriber's connection Subscription reference is identical
      //      to the shared connection Subscription
      ///

      const sharedConnection = (source as any)._connection;
      const conn = connection;
      connection = null;

      if (sharedConnection && (!conn || sharedConnection === conn)) {
        sharedConnection.unsubscribe();
      }

      subscriber.unsubscribe();
    });

    source.subscribe(refCounter);

    if (!refCounter.closed) {
      connection = (source as ConnectableObservable<T>).connect();
    }
  });
}


text:
dEdit.ToolManager = function() {
	var self = this;

	self.tools = [];

	self.selectedType = ko.observable({activeFields:{null_null: "null"}});

	self.isReady = ko.computed(function() {
		var active = self.selectedType().activeFields;

		var vals = model.dEdit.staticVars.getToolFieldValues();

		// Bracket hell
		for	(var fKey in active) {
			if($.isArray(vals[fKey])) {
				for(var i = 0; i < vals[fKey].length; i++) {
					if(!$.isNumeric(vals[fKey][i])) {
						return false;
					}
				}
			}
			else {
				if(!$.isNumeric(vals[fKey])) {
					return false;
				}
			}
		}

		return true;
	});

	self.getApplicable = function() {
		if(self.isReady()) {
			return self.selectedType().getFunction(model.dEdit.staticVars.getToolFieldValues());
		}
		else {
			throw "Tool does not have all necessary fields";
		}
	};
};

console.log("[DirectEdit] Added class: ToolManager");


text:
package krasa.frameswitcher.networking;

import com.intellij.openapi.project.Project;
import krasa.frameswitcher.networking.dto.RemoteProject;
import org.jgroups.Message;

import java.util.UUID;

/**
 * @author Vojtech Krasa
 */
public class DummyRemoteSender implements RemoteSender {
	@Override
	public void sendInstanceStarted() {

	}

	@Override
	public void sendProjectsState() {

	}

	@Override
	public void dispose() {

	}

	@Override
	public void asyncPing() {

	}

	@Override
	public void asyncProjectOpened(Project project) {

	}

	@Override
	public void sendProjectClosed(Project project) {

	}

	@Override
	public void openProject(UUID target, RemoteProject remoteProject) {

	}

	@Override
	public void sendPingResponse(Message msg) {

	}

	@Override
	public void asyncSendRefresh() {

	}
}


text:
namespace OpenTelemetry.Instrumentation.Process;

/// <summary>
/// Options to define the process metrics.
/// </summary>
public class ProcessInstrumentationOptions
{
}


text:
package com.md_5.cascade.entity;

import org.bukkit.entity.Wolf;

public class CascadeWolf extends CascadeTameableAnimal implements Wolf {

    @Override
    public boolean isAngry() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setAngry(boolean angry) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean isSitting() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setSitting(boolean sitting) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
     "http://www.w3.org/TR/html4/transitional.dtd">

  <meta HTTP-EQUIV=CONTENT-TYPE CONTENT="text/html; charset=utf-8">
  <title>Bandwidth Sharing among Users</title>

First page Back Continue Last page Overview Graphics

Bandwidth Sharing among Users

Mobility actually improves the fairness of bandwidth sharing among users


text:
import ko from 'ko';

import { FilterConditionField, FilterConditionType } from 'Common/Enums';
import { pString } from 'Common/Utils';

import { AbstractModel } from 'Knoin/AbstractModel';

class FilterConditionModel extends AbstractModel {
	constructor() {
		super('FilterConditionModel');

		this.field = ko.observable(FilterConditionField.From);
		this.type = ko.observable(FilterConditionType.Contains);
		this.value = ko.observable('');
		this.value.error = ko.observable(false);

		this.valueSecond = ko.observable('');
		this.valueSecond.error = ko.observable(false);

		this.template = ko.computed(() => {
			let template = '';
			switch (this.field()) {
				case FilterConditionField.Size:
					template = 'SettingsFiltersConditionSize';
					break;
				case FilterConditionField.Header:
					template = 'SettingsFiltersConditionMore';
					break;
				default:
					template = 'SettingsFiltersConditionDefault';
					break;
			}

			return template;
		}, this);

		this.field.subscribe(() => {
			this.value('');
			this.valueSecond('');
		});

		this.regDisposables([this.template]);
	}

	verify() {
		if ('' === this.value()) {
			this.value.error(true);
			return false;
		}

		if (FilterConditionField.Header === this.field() && '' === this.valueSecond()) {
			this.valueSecond.error(true);
			return false;
		}

		return true;
	}

	parse(json) {
		if (json && json.Field && json.Type) {
			this.field(pString(json.Field));
			this.type(pString(json.Type));
			this.value(pString(json.Value));
			this.valueSecond(pString(json.ValueSecond));

			return true;
		}

		return false;
	}

	toJson() {
		return {
			Field: this.field(),
			Type: this.type(),
			Value: this.value(),
			ValueSecond: this.valueSecond()
		};
	}

	cloneSelf() {
		const filterCond = new FilterConditionModel();

		filterCond.field(this.field());
		filterCond.type(this.type());
		filterCond.value(this.value());
		filterCond.valueSecond(this.valueSecond());

		return filterCond;
	}
}

export { FilterConditionModel, FilterConditionModel as default };


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

package org.chromium.distiller.webdocument.filters.images;

import com.google.gwt.dom.client.Element;

/**
 * ImageScorer that uses image area (length*width) as its heuristic.
 */
public class AreaScorer extends BaseImageScorer {
    public final int maxScore;
    public final int minArea;
    public final int maxArea;

    /**
     * Initialize this ImageScorer with appropriate info.
     * @param maximumScore The maximum score that should be given to any image.
     * @param minimumArea The smallest area in px an image can consume and still be scored.
     * @param maximumArea The largest area in px an image can consume and still be scored.
     */
    public AreaScorer(int maximumScore, int minimumArea, int maximumArea) {
        maxScore = maximumScore;
        minArea = minimumArea;
        maxArea = maximumArea;
    }

    @Override
    protected int computeScore(Element e) {
        int area = e.getOffsetWidth() * e.getOffsetHeight();
        if (area < minArea) return 0;

        int score = (int) ((float) (area - minArea) / (maxArea - minArea) * maxScore);
        return Math.min(score, maxScore);
    }

    @Override
    public int getMaxScore() {
        return maxScore;
    }
}


text:
require File.join(File.dirname(__FILE__), "/../../spec_helper.rb")

describe Mongoid::Field do

  describe "#default" do

    before do
      @field = Mongoid::Field.new(:score, :default => 0)
    end

    it "returns the default option" do
      @field.default.should == 0
    end

  end

  describe "#name" do

    before do
      @field = Mongoid::Field.new(:score, :default => 0)
    end

    it "returns the name" do
      @field.name.should == :score
    end

  end

  describe "#type" do

    before do
      @field = Mongoid::Field.new(:name)
    end

    it "defaults to String" do
      @field.type.should == String
    end

  end

  describe "#value" do

    before do
      @type = mock
      @field = Mongoid::Field.new(:score, :default => 10, :type => @type)
    end

    context "nil is provided" do

      it "returns the default value" do
        @field.value(nil).should == 10
      end

    end

    context "value is provided" do

      it "casts the value" do
        @type.expects(:cast).with("30").returns(30)
        @field.value("30").should == 30
      end

    end

  end

end


text:
namespace poison {
long double abs(long double, void* = 0);
long double fabs(long double, void* = 0);
long double sin(long double, void* = 0);
long double cos(long double, void* = 0);
long double tan(long double, void* = 0);
long double asin(long double, void* = 0);
long double acos(long double, void* = 0);
long double atan(long double, void* = 0);
long double exp(long double, void* = 0);
long double log(long double, void* = 0);
long double pow(long double, long double, void* = 0);
long double fmod(long double, long double, void* = 0);
long double modf(long double, long double*, void* = 0);
long double cosh(long double, void* = 0);
long double sinh(long double, void* = 0);
long double tanh(long double, void* = 0);
long double frexp(long double, void*);
long double ldexp(long double, short);
long double atan2(long double, long double, void* = 0);
long double ceil(long double, void* = 0);
long double floor(long double, void* = 0);
long double log10(long double, void* = 0);
long double sqrt(long double, void* = 0);
} // namespace poison

#undef BOOST_MATH_STD_USING_CORE
#undef BOOST_MATH_STD_USING

#define BOOST_MATH_STD_USING_CORE \
   using std::abs;                \
   using std::acos;               \
   using std::cos;                \
   using std::fmod;               \
   using std::modf;               \
   using std::tan;                \
   using std::asin;               \
   using std::cosh;               \
   using std::frexp;              \
   using std::pow;                \
   using std::tanh;               \
   using std::atan;               \
   using std::exp;                \
   using std::ldexp;              \
   using std::sin;                \
   using std::atan2;              \
   using std::fabs;               \
   using std::log;                \
   using std::sinh;               \
   using std::ceil;               \
   using std::floor;              \
   using std::log10;              \
   using std::sqrt;                \
   using poison::abs;                \
   using poison::acos;               \
   using poison::cos;                \
   using poison::fmod;               \
   using poison::modf;               \
   using poison::tan;                \
   using poison::asin;               \
   using poison::cosh;               \
   using poison::frexp;              \
   using poison::pow;                \
   using poison::tanh;               \
   using poison::atan;               \
   using poison::exp;                \
   using poison::ldexp;              \
   using poison::sin;                \
   using poison::atan2;              \
   using poison::fabs;               \
   using poison::log;                \
   using poison::sinh;               \
   using poison::ceil;               \
   using poison::floor;              \
   using poison::log10;              \
   using poison::sqrt;

#define BOOST_MATH_STD_USING BOOST_MATH_STD_USING_CORE

#define TEST_GROUP_8
#define TEST_GROUP_9
#include "compile_test/instantiate.hpp"

int main()
{
   //boost::math::foo(0.0L);
   instantiate(0.0);
}


text:
/* SPDX-License-Identifier: BSD-2-Clause */
/*
 * Copyright (c) 2015, Linaro Limited
 */

#ifndef PLATFORM_CONFIG_H
#define PLATFORM_CONFIG_H

#include <mm/generic_ram_layout.h>

/* Make stacks aligned to data cache line length */
#define STACK_ALIGNMENT		64

#ifdef ARM64
#ifdef CFG_WITH_PAGER
#error "Pager not supported for ARM64"
#endif
#endif /*ARM64*/

#if defined(PLATFORM_FLAVOR_mt8173)

#define GIC_BASE		0x10220000
#define GICC_OFFSET		0x2000
#define GICD_OFFSET		0x1000

#define UART0_BASE		0x11002000
#define UART1_BASE		0x11003000
#define UART2_BASE		0x11004000
#define UART3_BASE		0x11005000

#define CONSOLE_UART_BASE	UART0_BASE
#define CONSOLE_BAUDRATE	921600
#define CONSOLE_UART_CLK_IN_HZ	26000000

#define DRAM0_BASE		0x40000000
#define DRAM0_SIZE		0x80000000

#else
#error "Unknown platform flavor"
#endif

#ifdef CFG_WITH_LPAE
#define MAX_XLAT_TABLES		5
#endif

#endif /*PLATFORM_CONFIG_H*/


text:
package org.apache.sqoop.connector.jdbc;

import java.sql.ResultSet;

import junit.framework.TestCase;

import org.apache.sqoop.common.MutableContext;
import org.apache.sqoop.common.MutableMapContext;
import org.apache.sqoop.job.etl.Loader;
import org.apache.sqoop.job.io.DataReader;

public class TestExportLoader extends TestCase {

  private final String tableName;

  private GenericJdbcExecutor executor;

  private static final int START = -50;
  private static final int NUMBER_OF_ROWS = 101;

  public TestExportLoader() {
    tableName = getClass().getSimpleName().toUpperCase();
  }

  @Override
  public void setUp() {
    executor = new GenericJdbcExecutor(GenericJdbcTestConstants.DRIVER,
        GenericJdbcTestConstants.URL, null, null);

    if (!executor.existTable(tableName)) {
      executor.executeUpdate("CREATE TABLE "
          + executor.delimitIdentifier(tableName)
          + "(ICOL INTEGER PRIMARY KEY, DCOL DOUBLE, VCOL VARCHAR(20))");
    }
  }

  @Override
  public void tearDown() {
    executor.close();
  }

  public void testInsert() throws Exception {
    MutableContext context = new MutableMapContext();

    context.setString(
        GenericJdbcConnectorConstants.CONNECTOR_JDBC_DRIVER,
        GenericJdbcTestConstants.DRIVER);
    context.setString(
        GenericJdbcConnectorConstants.CONNECTOR_JDBC_URL,
        GenericJdbcTestConstants.URL);
    context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_DATA_SQL,
        "INSERT INTO " + executor.delimitIdentifier(tableName)
            + " VALUES (?,?,?)");

    Loader loader = new GenericJdbcExportLoader();
    DummyReader reader = new DummyReader();

    loader.load(context, null, null, reader);

    int index = START;
    ResultSet rs = executor.executeQuery("SELECT * FROM "
        + executor.delimitIdentifier(tableName) + " ORDER BY ICOL");
    while (rs.next()) {
      assertEquals(index, rs.getObject(1));
      assertEquals((double) index, rs.getObject(2));
      assertEquals(String.valueOf(index), rs.getObject(3));
      index++;
    }
    assertEquals(NUMBER_OF_ROWS, index-START);
  }

  public class DummyReader extends DataReader {
    int index = 0;

    @Override
    public void setFieldDelimiter(char fieldDelimiter) {
      // do nothing and use default delimiter
    }

    @Override
    public Object[] readArrayRecord() {
      if (index < NUMBER_OF_ROWS) {
        Object[] array = new Object[] {
            START + index,
            (double) (START + index),
            String.valueOf(START+index) };
        index++;
        return array;
      } else {
        return null;
      }
    }

    @Override
    public String readCsvRecord() {
      fail("This method should not be invoked.");
      return null;
    }

    @Override
    public Object readContent(int type) {
      fail("This method should not be invoked.");
      return null;
    }
  }

}


text:
'use strict';

export default class AdminAbstractController {
    constructor() {

    }
}


text:
WorkerThreadTicker::WorkerThreadTicker(int tick_interval)
    : timer_thread_("worker_thread_ticker"),
      is_running_(false),
      tick_interval_(base::TimeDelta::FromMilliseconds(tick_interval)) {
}

WorkerThreadTicker::~WorkerThreadTicker() {
  Stop();
}

bool WorkerThreadTicker::RegisterTickHandler(Callback *tick_handler) {
  DCHECK(tick_handler);
  base::AutoLock lock(lock_);
  // You cannot change the list of handlers when the timer is running.
  // You need to call Stop first.
  if (IsRunning())
    return false;
  tick_handler_list_.push_back(tick_handler);
  return true;
}

bool WorkerThreadTicker::UnregisterTickHandler(Callback *tick_handler) {
  DCHECK(tick_handler);
  base::AutoLock lock(lock_);
  // You cannot change the list of handlers when the timer is running.
  // You need to call Stop first.
  if (IsRunning()) {
    return false;
  }
  TickHandlerListType::iterator index = std::remove(tick_handler_list_.begin(),
                                                    tick_handler_list_.end(),
                                                    tick_handler);
  if (index == tick_handler_list_.end()) {
    return false;
  }
  tick_handler_list_.erase(index, tick_handler_list_.end());
  return true;
}

bool WorkerThreadTicker::Start() {
  // Do this in a lock because we don't want 2 threads to
  // call Start at the same time
  base::AutoLock lock(lock_);
  if (IsRunning())
    return false;
  if (!timer_thread_.Start())
    return false;
  is_running_ = true;
  ScheduleTimerTask();
  return true;
}

bool WorkerThreadTicker::Stop() {
  // Do this in a lock because we don't want 2 threads to
  // call Stop at the same time
  base::AutoLock lock(lock_);
  if (!IsRunning())
    return false;
  is_running_ = false;
  timer_thread_.Stop();
  return true;
}

void WorkerThreadTicker::ScheduleTimerTask() {
  timer_thread_.message_loop()->PostDelayedTask(
      FROM_HERE,
      base::Bind(&WorkerThreadTicker::TimerTask, base::Unretained(this)),
      tick_interval_);
}

void WorkerThreadTicker::TimerTask() {
  // When the ticker is running, the handler list CANNOT be modified.
  // So we can do the enumeration safely without a lock
  const TickHandlerListType& handlers = tick_handler_list_;
  for (TickHandlerListType::const_iterator i = handlers.begin();
       i != handlers.end(); ++i) {
    (*i)->OnTick();
  }

  ScheduleTimerTask();
}


text:
/**
 * @license Licensed under the Apache License, Version 2.0 (the "License"):
 *          http://www.apache.org/licenses/LICENSE-2.0
 */

/**
 * @fileoverview Generating Arduino code for list blocks.
 *
 * TODO: A lot of this can be converted to arrays code by creating functions to
 *       replicate this kind of behavior.
 */
'use strict';

goog.provide('Blockly.Arduino.lists');

goog.require('Blockly.Arduino');

Blockly.Arduino['lists_create_empty'] = Blockly.Arduino.noGeneratorCodeInline;

Blockly.Arduino['lists_create_with'] = Blockly.Arduino.noGeneratorCodeInline;

Blockly.Arduino['lists_repeat'] = Blockly.Arduino.noGeneratorCodeInline;

Blockly.Arduino['lists_length'] = Blockly.Arduino.noGeneratorCodeInline;

Blockly.Arduino['lists_isEmpty'] = Blockly.Arduino.noGeneratorCodeInline;

Blockly.Arduino['lists_indexOf'] = Blockly.Arduino.noGeneratorCodeInline;

Blockly.Arduino['lists_getIndex'] = Blockly.Arduino.noGeneratorCodeInline;

Blockly.Arduino['lists_setIndex'] = Blockly.Arduino.noGeneratorCodeLine;


text:
/*
 * MainWindow.cpp
 *
 * Proyecto Integrador - Universidad Europea de Madrid -
 *
 * Author: María Hortal Gonzalez
 *
 */
#include "mainwindow.hpp"
#include "ui_mainwindow.h"
#include "infonegos.hpp"
#include "infooficinas.hpp"
#include "infoowners.hpp"
#include "negos.hpp"
#include "owners.hpp"
#include "oficinas.hpp"
#include "vector.h"

MainWindow::MainWindow(QWidget *parent) :  //constructor
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    pel::Vector<claseNegos> v;
    pel::Vector<claseOficinas> v2;
    pel::Vector<claseOwners> v3;
}

MainWindow::~MainWindow()
{
    delete ui;
}

/**
 * @brief opens window infonegos.ui
 * @return void
 */
void MainWindow::openNegos()
{
    InfoNegos *n1=new InfoNegos();
    n1->show();
    n1->v = &v;
}

/**
 * @brief opens window infoowners.ui
 * @return void
 */
void MainWindow::openOwners()
{
    infoowners *iow1=new infoowners();
    iow1->show();
    iow1->v3 = &v3;
}

/**
 * @brief opens window infooficinas.ui
 * @return void
 */
void MainWindow::openOficinas()
{
    infoOficinas *iof1=new infoOficinas();
    iof1->show();
    iof1->v2 = &v2;
}


text:
/*
 * File:   Parser.hpp
 * Author: Arthur Lisek-Koper <deathvango@gmail.com>
 *
 * Created on December 30, 2014, 5:54 PM
 */

#ifndef PARSER_HPP
#define	PARSER_HPP

#include "../core/Includes.hpp"

#include "ComList.hpp"

/*
 * Class Description here
 */
class Parser {
public:

    Parser();

    virtual ~Parser() {
    }

    void loadFromFile();

protected:

    void parseObjectData(std::string objectId);

    void handleObjectDataCommand(objComType com, std::string value);

    //Translates the given string into a objComType enum.
    //returns UNKNOWN if translation failed.
    objComType strToCom(std::string command);

    std::string getString( std::string input );

private:

    ComList mCommandList;

    std::string mFilepath; //Abolute path to working directory.

    std::string mODataPath; //Relative path from the given absolute path.

    boost::regex e_mGetCommand;

    boost::regex e_mCheckemptyLine;

    boost::regex e_mGetString;

};

#endif	/* PARSER_HPP */


text:
package com.github.jochenw.afw.core.log;

import com.github.jochenw.afw.core.log.ILog.Level;

/** Default implementation of {@link IMLog}. Internally,
 * this is based on an instance of {@link ILog}, to
 * which most calls are delegated.
 */
public class DefaultMLog implements IMLog {
    private final AbstractLog log;
    private final String method;

    /**
     * Creates a new instance with the given logger, and
     * the given method name.
     * @param pLog The logger, which is being used
     *   internally.
     * @param pMethod The method name, which is being
     *   emitted with every message.
     */
    public DefaultMLog(AbstractLog pLog, String pMethod) {
        log = pLog;
        method = pMethod;
    }

    @Override
    public boolean isTraceEnabled() {
        return log.isTraceEnabled();
    }

    @Override
    public boolean isDebugEnabled() {
        return log.isDebugEnabled();
    }

    @Override
    public boolean isInfoEnabled() {
        return log.isInfoEnabled();
    }

    @Override
    public boolean isWarnEnabled() {
        return log.isWarnEnabled();
    }

    @Override
    public boolean isErrorEnabled() {
        return log.isErrorEnabled();
    }

    @Override
    public boolean isFatalEnabled() {
        return log.isFatalEnabled();
    }

    @Override
    public boolean isEnabledFor(Level pLevel) {
        return log.isEnabledFor(pLevel);
    }

    @Override
    public void trace(String pMessage) {
        if (log.isTraceEnabled()) {
            log.log(Level.TRACE, log.asMessage(method, AbstractLog.SEP_STD, pMessage));
        }
    }

    @Override
    public void debug(String pMessage) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_STD, pMessage));
        }
    }

    @Override
    public void info(String pMessage) {
        if (log.isInfoEnabled()) {
            log.log(Level.INFO, log.asMessage(method, AbstractLog.SEP_STD, pMessage));
        }
    }

    @Override
    public void warn(String pMessage) {
        if (log.isWarnEnabled()) {
            log.log(Level.WARN, log.asMessage(method, AbstractLog.SEP_STD, pMessage));
        }
    }

    @Override
    public void error(String pMessage) {
        if (log.isErrorEnabled()) {
            log.log(Level.ERROR, log.asMessage(method, AbstractLog.SEP_STD, pMessage));
        }
    }

    @Override
    public void fatal(String pMessage) {
        if (log.isFatalEnabled()) {
            log.log(Level.FATAL, log.asMessage(method, AbstractLog.SEP_STD, pMessage));
        }
    }

    @Override
    public void log(Level pLevel, String pMessage) {
        if (log.isEnabledFor(pLevel)) {
            log.log(pLevel, log.asMessage(method, AbstractLog.SEP_STD, pMessage));
        }
    }

    @Override
    public void info(Throwable pTh) {
        if (log.isInfoEnabled()) {
            log.log(Level.INFO, log.asMessage(method, AbstractLog.SEP_STD, (String) null), pTh);
        }
    }

    @Override
    public void info(String pMessage, Throwable pTh) {
        if (log.isInfoEnabled()) {
            log.log(Level.INFO, log.asMessage(method, AbstractLog.SEP_STD, pMessage), pTh);
        }
    }

    @Override
    public void warn(Throwable pTh) {
        if (log.isWarnEnabled()) {
            log.log(Level.WARN, log.asMessage(method, AbstractLog.SEP_STD, (String) null), pTh);
        }
    }

    @Override
    public void warn(String pMessage, Throwable pTh) {
        if (log.isWarnEnabled()) {
            log.log(Level.WARN, log.asMessage(method, AbstractLog.SEP_STD, pMessage), pTh);
        }
    }

    @Override
    public void error(Throwable pTh) {
        if (log.isErrorEnabled()) {
            log.log(Level.ERROR, log.asMessage(method, AbstractLog.SEP_STD, (String) null), pTh);
        }
    }

    @Override
    public void error(String pMessage, Throwable pTh) {
        if (log.isErrorEnabled()) {
            log.log(Level.ERROR, log.asMessage(method, AbstractLog.SEP_STD, pMessage), pTh);
        }
    }

    @Override
    public void fatal(Throwable pTh) {
        if (log.isErrorEnabled()) {
            log.log(Level.FATAL, log.asMessage(method, AbstractLog.SEP_STD, (String) null), pTh);
        }
    }

    @Override
    public void fatal(String pMessage, Throwable pTh) {
        if (log.isFatalEnabled()) {
            log.log(Level.FATAL, log.asMessage(method, AbstractLog.SEP_STD, pMessage), pTh);
        }
    }

    @Override
    public void trace(String pMessage, Object... pArgs) {
        if (log.isTraceEnabled()) {
            log.log(Level.TRACE, log.asMessage(method, AbstractLog.SEP_STD, pMessage, pArgs));
        }
    }

    @Override
    public void debug(String pMessage, Object... pArgs) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_STD, pMessage, pArgs));
        }
    }

    @Override
    public void info(String pMessage, Object... pArgs) {
        if (log.isInfoEnabled()) {
            log.log(Level.INFO, log.asMessage(method, AbstractLog.SEP_STD, pMessage, pArgs));
        }
    }

    @Override
    public void warn(String pMessage, Object... pArgs) {
        if (log.isWarnEnabled()) {
            log.log(Level.WARN, log.asMessage(method, AbstractLog.SEP_STD, pMessage, pArgs));
        }
    }

    @Override
    public void error(String pMessage, Object... pArgs) {
        if (log.isErrorEnabled()) {
            log.log(Level.ERROR, log.asMessage(method, AbstractLog.SEP_STD, pMessage, pArgs));
        }
    }

    @Override
    public void fatal(String pMessage, Object... pArgs) {
        if (log.isFatalEnabled()) {
            log.log(Level.FATAL, log.asMessage(method, AbstractLog.SEP_STD, pMessage, pArgs));
        }
    }

    @Override
    public void log(Level pLevel, String pMessage, Object... pArgs) {
        if (log.isEnabledFor(pLevel)) {
            log.log(pLevel, log.asMessage(method, AbstractLog.SEP_STD, pMessage, pArgs));
        }
    }

    @Override
    public void tracef(String pFormat, Object... pArgs) {
        if (log.isTraceEnabled()) {
            log.log(Level.TRACE, log.asMessageF(method, AbstractLog.SEP_STD, pFormat, pArgs));
        }
    }

    @Override
    public void debugf(String pFormat, Object... pArgs) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessageF(method, AbstractLog.SEP_STD, pFormat, pArgs));
        }
    }

    @Override
    public void infof(String pFormat, Object... pArgs) {
        if (log.isInfoEnabled()) {
            log.log(Level.INFO, log.asMessageF(method, AbstractLog.SEP_STD, pFormat, pArgs));
        }
    }

    @Override
    public void warnf(String pFormat, Object... pArgs) {
        if (log.isWarnEnabled()) {
            log.log(Level.WARN, log.asMessageF(method, AbstractLog.SEP_STD, pFormat, pArgs));
        }
    }

    @Override
    public void errorf(String pFormat, Object... pArgs) {
        if (log.isErrorEnabled()) {
            log.log(Level.ERROR, log.asMessageF(method, AbstractLog.SEP_STD, pFormat, pArgs));
        }
    }

    @Override
    public void fatalf(String pFormat, Object... pArgs) {
        if (log.isFatalEnabled()) {
            log.log(Level.FATAL, log.asMessageF(method, AbstractLog.SEP_STD, pFormat, pArgs));
        }
    }

    @Override
    public void logf(Level pLevel, String pFormat, Object... pArgs) {
        if (log.isEnabledFor(pLevel)) {
            log.log(pLevel, log.asMessageF(method, AbstractLog.SEP_ENT, pFormat, pArgs));
        }
    }

    @Override
    public void entering() {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_ENT, (String) null));
        }
    }

    @Override
    public void entering(String pMessage) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_ENT, pMessage));
        }
    }

    @Override
    public void entering(String pMessage, Object... pArgs) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_ENT, pMessage, pArgs));
        }
    }

    @Override
    public void enteringf(String pFormat, Object... pArgs) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_ENT, pFormat, pArgs));
        }
    }

    @Override
    public void exiting() {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_EXT, (String) null));
        }
    }

    @Override
    public void exiting(String pMessage) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_EXT, pMessage));
        }
    }

    @Override
    public void exiting(String pMessage, int pResult) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_EXT, pMessage, String.valueOf(pResult)));
        }
    }

    @Override
    public void exiting(String pMessage, long pResult) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_EXT, pMessage, String.valueOf(pResult)));
        }
    }

    @Override
    public void exiting(String pMessage, boolean pResult) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_EXT, pMessage, String.valueOf(pResult)));
        }
    }

    @Override
    public void exiting(String pMessage, short pResult) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_EXT, pMessage, String.valueOf(pResult)));
        }
    }

    @Override
    public void exiting(String pMessage, byte pResult) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_EXT, pMessage, String.valueOf(pResult)));
        }
    }

    @Override
    public void exiting(String pMessage, double pResult) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_EXT, pMessage, String.valueOf(pResult)));
        }
    }

    @Override
    public void exiting(String pMessage, float pResult) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_EXT, pMessage, String.valueOf(pResult)));
        }
    }

    @Override
    public void exiting(String pMessage, char pResult) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_EXT, pMessage, String.valueOf(pResult)));
        }
    }

    @Override
    public void exiting(String pMessage, Object pResult) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_EXT, pMessage, pResult));
        }
    }

    @Override
    public void exiting(String pMessage, Object... pArgs) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessage(method, AbstractLog.SEP_EXT, pMessage, pArgs));
        }
    }

    @Override
    public void exitingf(String pFormat, Object... pArgs) {
        if (log.isDebugEnabled()) {
            log.log(Level.DEBUG, log.asMessageF(method, AbstractLog.SEP_EXT, pFormat, pArgs));
        }
    }

}


text:
// WorkspaceMenu.hh for Fluxbox
// Copyright (c) 2004 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

#ifndef WORKSPACEMENU_HH
#define WORKSPACEMENU_HH

#include "FbMenu.hh"
#include "FbTk/Signal.hh"

class BScreen;

/**
 * A menu specific for workspace.
 * Contains some simple workspace commands
 * such as new/delete workspace and edit
 * workspace name.
 * It also contains client menus for all clients.
 */
class WorkspaceMenu: public FbMenu, private FbTk::SignalTracker {
public:
    explicit WorkspaceMenu(BScreen &screen);
    virtual ~WorkspaceMenu() { }

private:
    /// initialize menu for the screen
    void init(BScreen &screen);
    /// Called when workspace info was changed
    /// ( number of workspace, workspace names etc )
    void workspaceInfoChanged(BScreen& screen);
    /// Called when workspace was switched.
    void workspaceChanged(BScreen& screen);
};

#endif //  WORKSPACEMENU_HH


text:
namespace {

const CXFA_Node::PropertyData kCommonPropertyData[] = {
    {XFA_Element::SuppressBanner, 1, 0},
    {XFA_Element::VersionControl, 1, 0},
    {XFA_Element::LocaleSet, 1, 0},
    {XFA_Element::Template, 1, 0},
    {XFA_Element::ValidationMessaging, 1, 0},
    {XFA_Element::Locale, 1, 0},
    {XFA_Element::Data, 1, 0},
    {XFA_Element::Messaging, 1, 0},
};

const CXFA_Node::AttributeData kCommonAttributeData[] = {
    {XFA_Attribute::Desc, XFA_AttributeType::CData, nullptr},
    {XFA_Attribute::Lock, XFA_AttributeType::Integer, (void*)0},
};

}  // namespace

CXFA_Common::CXFA_Common(CXFA_Document* doc, XFA_PacketType packet)
    : CXFA_Node(doc,
                packet,
                XFA_XDPPACKET_Config,
                XFA_ObjectType::Node,
                XFA_Element::Common,
                kCommonPropertyData,
                kCommonAttributeData,
                pdfium::MakeUnique<CJX_Node>(this)) {}

CXFA_Common::~CXFA_Common() = default;


text:
Categories

         <form class="navbar-form" action="<?php echo base_url(); ?>admin/categories/search" method="post">
          <input class="form-control" placeholder="Search" name="search" type="text">
         <button class="btn btn-default" type="submit">Go!</button>
          </form>

<a href="<?php echo base_url();?>admin/dashboard">Home

Categories

Categories

<?php echo $this->session->flashdata('message');?>

 <a href="<?php echo base_url(); ?>admin/categories/create"  class="add_item"><button class="btn btn-primary" type="submit">Add Category</button>

                      S.NO
                      Category
                      Edit
                      Delete

                  <?php if(!empty($categoriesdata)): ?>

                    <?php $i=1;
   foreach($categoriesdata as $categories_data){?>

      <?=$i;?>
      <?php  echo $categories_data->category_name; ?>
      <a href="<?php echo base_url(); ?>admin/categories/edit/<?php  echo $categories_data->category_id; ?>">
      <a href="<?php echo base_url(); ?>admin/categories/delete/<?php  echo $categories_data->category_id; ?>" onclick="return checkDelete('<?php  echo $categories_data->category_name; ?>')">

    <?php $i++; } ?>

                   <?php else: ?>

                No Records Found

              <?php endif; ?>

                <?= $this->pagination->create_links(); ?>


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/bdp_paycenter_top_info_bg_file"
    android:orientation="vertical" >

    <include layout="@layout/bdp_paycenter_layout_accountinfo_nofix_landscape" />

    <View
        android:layout_width="match_parent"
        android:layout_height="2px"
        android:background="@drawable/bdp_paycenter_divider" />

    <include layout="@layout/bdp_paycenter_layout_goodsinfo_landscape" />

    <FrameLayout
        android:id="@+id/bdp_paycenter_layout_activity_area"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
    </FrameLayout>

</LinearLayout>


text:
package blockset

import (
	"bytes"
	"encoding/binary"
	"errors"
	"strconv"

	"golang.org/x/net/context"

	"github.com/RoaringBitmap/roaring"
	"github.com/coreos/torus"
)

type replicationBlockset struct {
	rep       int
	sub       blockset
	repBlocks [][]torus.BlockRef
	bs        torus.BlockStore
}

var _ blockset = &replicationBlockset{}

const defaultReplication = 2

func init() {
	RegisterBlockset(Replication, func(opt string, bs torus.BlockStore, sub blockset) (blockset, error) {
		if opt == "" {
			return newReplicationBlockset(sub, bs, defaultReplication), nil
		}
		r, err := strconv.Atoi(opt)
		if err != nil {
			clog.Errorf("unknown replication amount %s: %v", opt, err)
			return nil, errors.New("unknown replication amount: " + opt)
		}
		return newReplicationBlockset(sub, bs, r), nil
	})
}

func newReplicationBlockset(sub blockset, bs torus.BlockStore, r int) *replicationBlockset {
	return &replicationBlockset{
		rep:       r,
		sub:       sub,
		bs:        bs,
		repBlocks: make([][]torus.BlockRef, r-1),
	}
}

func (b *replicationBlockset) Length() int {
	return b.sub.Length()
}

func (b *replicationBlockset) Kind() uint32 {
	return uint32(Replication)
}

func (b *replicationBlockset) GetBlock(ctx context.Context, i int) ([]byte, error) {
	if b.rep == 0 {
		return nil, torus.ErrBlockUnavailable
	}
	newctx := context.WithValue(ctx, "replication", b.rep)
	bytes, err := b.sub.GetBlock(newctx, i)
	if err == nil || err == torus.ErrBlockNotExist {
		return bytes, err
	}
	for rep := 0; rep < (b.rep - 1); rep++ {
		bytes, err := b.bs.GetBlock(ctx, b.repBlocks[rep][i])
		if err == nil {
			return bytes, nil
		}
	}
	return nil, torus.ErrBlockUnavailable
}

func (b *replicationBlockset) PutBlock(ctx context.Context, inode torus.INodeRef, i int, data []byte) error {
	if b.rep == 0 {
		return torus.ErrBlockUnavailable
	}
	err := b.sub.PutBlock(ctx, inode, i, data)
	if err != nil {
		return err
	}
	for rep := 0; rep < (b.rep - 1); rep++ {
		newBlockID := b.makeID(inode)
		err := b.bs.WriteBlock(ctx, newBlockID, data)
		if err != nil {
			return err
		}
		if i == len(b.repBlocks[rep]) {
			b.repBlocks[rep] = append(b.repBlocks[rep], newBlockID)
		} else {
			b.repBlocks[rep][i] = newBlockID
		}
	}
	return nil
}

func (b *replicationBlockset) makeID(i torus.INodeRef) torus.BlockRef {
	return b.sub.makeID(i)
}

func (b *replicationBlockset) setStore(s torus.BlockStore) {
	b.bs = s
	b.sub.setStore(s)
}

func (b *replicationBlockset) getStore() torus.BlockStore {
	return b.bs
}

func (b *replicationBlockset) Marshal() ([]byte, error) {
	buf := new(bytes.Buffer)
	err := binary.Write(buf, binary.LittleEndian, int32(b.rep))
	if err != nil {
		return nil, err
	}
	for rep := 0; rep < (b.rep - 1); rep++ {
		err := binary.Write(buf, binary.LittleEndian, int32(len(b.repBlocks[rep])))
		if err != nil {
			return nil, err
		}
		for _, x := range b.repBlocks[rep] {
			_, err := buf.Write(x.ToBytes())
			if err != nil {
				return nil, err
			}
		}
	}
	return buf.Bytes(), nil
}

func (b *replicationBlockset) Unmarshal(data []byte) error {
	r := bytes.NewReader(data)
	var rep int32
	err := binary.Read(r, binary.LittleEndian, &rep)
	if err != nil {
		return err
	}
	b.rep = int(rep)
	b.repBlocks = make([][]torus.BlockRef, rep)
	for rep := 0; rep < (b.rep - 1); rep++ {
		var l int32
		err := binary.Read(r, binary.LittleEndian, &l)
		if err != nil {
			return err
		}
		out := make([]torus.BlockRef, l)
		for i := 0; i < int(l); i++ {
			buf := make([]byte, torus.BlockRefByteSize)
			_, err := r.Read(buf)
			if err != nil {
				return err
			}
			out[i] = torus.BlockRefFromBytes(buf)
		}
		b.repBlocks[rep] = out
	}
	return nil
}

func (b *replicationBlockset) GetSubBlockset() torus.Blockset { return b.sub }

func (b *replicationBlockset) GetLiveINodes() *roaring.Bitmap {
	return b.sub.GetLiveINodes()
}

func (b *replicationBlockset) Truncate(lastIndex int, blocksize uint64) error {
	err := b.sub.Truncate(lastIndex, blocksize)
	if err != nil {
		return err
	}
	if lastIndex <= len(b.repBlocks[0]) {
		for i := range b.repBlocks {
			b.repBlocks[i] = b.repBlocks[i][:lastIndex]
		}
		return nil
	}
	for i := range b.repBlocks {
		toadd := lastIndex - len(b.repBlocks[0])
		for toadd != 0 {
			b.repBlocks[i] = append(b.repBlocks[i], torus.ZeroBlock())
			toadd--
		}
	}
	return nil
}

func (b *replicationBlockset) Trim(from, to int) error {
	err := b.sub.Trim(from, to)
	if err != nil {
		return err
	}
	if from >= len(b.repBlocks[0]) {
		return nil
	}
	if to > len(b.repBlocks[0]) {
		to = len(b.repBlocks[0])
	}
	for i := from; i < to; i++ {
		for _, blist := range b.repBlocks {
			if len(blist) == 0 {
				continue
			}
			blist[i] = torus.ZeroBlock()
		}
	}
	return nil
}

func (b *replicationBlockset) GetAllBlockRefs() []torus.BlockRef {
	sub := b.sub.GetAllBlockRefs()
	out := make([]torus.BlockRef, len(b.repBlocks[0])*len(b.repBlocks))
	nblocks := len(b.repBlocks[0])
	for i, list := range b.repBlocks {
		copy(out[i*nblocks:], list)
	}
	return append(sub, out...)
}

func (b *replicationBlockset) String() string {
	return "rep\n" + b.sub.String()
}


text:
package org.apache.gobblin.service.modules.scheduler;

import java.net.URI;
import java.util.Collection;
import java.util.Map;
import java.util.Properties;

import java.util.UUID;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.helix.HelixManager;
import org.apache.helix.InstanceType;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.InterruptableJob;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.UnableToInterruptJobException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.base.Optional;
import com.google.common.collect.Maps;
import com.typesafe.config.Config;

import org.apache.gobblin.annotation.Alpha;
import org.apache.gobblin.configuration.ConfigurationKeys;
import org.apache.gobblin.runtime.JobException;
import org.apache.gobblin.runtime.api.FlowSpec;
import org.apache.gobblin.runtime.api.Spec;
import org.apache.gobblin.runtime.api.SpecCatalogListener;
import org.apache.gobblin.runtime.listeners.JobListener;
import org.apache.gobblin.runtime.spec_catalog.FlowCatalog;
import org.apache.gobblin.runtime.spec_catalog.TopologyCatalog;
import org.apache.gobblin.scheduler.BaseGobblinJob;
import org.apache.gobblin.scheduler.JobScheduler;
import org.apache.gobblin.scheduler.SchedulerService;
import org.apache.gobblin.service.HelixUtils;
import org.apache.gobblin.service.ServiceConfigKeys;
import org.apache.gobblin.service.modules.orchestration.Orchestrator;
import org.apache.gobblin.util.ConfigUtils;

/**
 * An extension to {@link JobScheduler} that is also a {@link SpecCatalogListener}.
 * {@link GobblinServiceJobScheduler} listens for new / updated {@link FlowSpec} and schedules
 * and runs them via {@link Orchestrator}.
 */
@Alpha
public class GobblinServiceJobScheduler extends JobScheduler implements SpecCatalogListener {
  protected final Logger _log;

  protected final Optional<FlowCatalog> flowCatalog;
  protected final Optional<HelixManager> helixManager;
  protected final Orchestrator orchestrator;
  @Getter
  protected final Map<String, Spec> scheduledFlowSpecs;

  @Getter
  protected volatile boolean isActive;

  public GobblinServiceJobScheduler(Config config, Optional<HelixManager> helixManager, Optional<FlowCatalog> flowCatalog,
      Optional<TopologyCatalog> topologyCatalog, Orchestrator orchestrator, SchedulerService schedulerService,
      Optional<Logger> log) throws Exception {
    super(ConfigUtils.configToProperties(config), schedulerService);

    _log = log.isPresent() ? log.get() : LoggerFactory.getLogger(getClass());

    this.flowCatalog = flowCatalog;
    this.helixManager = helixManager;
    this.orchestrator = orchestrator;
    this.scheduledFlowSpecs = Maps.newHashMap();
  }

  public GobblinServiceJobScheduler(Config config, Optional<HelixManager> helixManager, Optional<FlowCatalog> flowCatalog,
      Optional<TopologyCatalog> topologyCatalog, SchedulerService schedulerService, Optional<Logger> log) throws Exception {
    this(config, helixManager, flowCatalog, topologyCatalog, new Orchestrator(config, topologyCatalog, log),
        schedulerService, log);
  }

  public synchronized void setActive(boolean isActive) {
    if (this.isActive == isActive) {
      // No-op if already in correct state
      return;
    }

    // Since we are going to change status to isActive=true, schedule all flows
    if (isActive) {
      if (this.flowCatalog.isPresent()) {
        Collection<Spec> specs = this.flowCatalog.get().getSpecs();
        for (Spec spec : specs) {
          onAddSpec(spec);
        }
      }
    }
    // Since we are going to change status to isActive=false, unschedule all flows
    else {
      for (Spec spec : this.scheduledFlowSpecs.values()) {
        onDeleteSpec(spec.getUri(), spec.getVersion());
      }
    }

    // Change status after invoking addition / removal of specs, or else they will use isActive
    // .. to exhibit behavior for updated iActive value
    this.isActive = isActive;
  }

  @Override
  protected void startUp() throws Exception {
    super.startUp();
  }

  @Override
  public void scheduleJob(Properties jobProps, JobListener jobListener) throws JobException {
    Map<String, Object> additionalJobDataMap = Maps.newHashMap();
    additionalJobDataMap.put(ServiceConfigKeys.GOBBLIN_SERVICE_FLOWSPEC,
        this.scheduledFlowSpecs.get(jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY)));

    try {
      scheduleJob(jobProps, jobListener, additionalJobDataMap, GobblinServiceJob.class);
    } catch (Exception e) {
      throw new JobException("Failed to schedule job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e);
    }
  }

  @Override
  public void runJob(Properties jobProps, JobListener jobListener) throws JobException {
    try {
      Spec flowSpec = this.scheduledFlowSpecs.get(jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY));
      this.orchestrator.orchestrate(flowSpec);
    } catch (Exception e) {
      throw new JobException("Failed to run Spec: " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e);
    }
  }

  /** {@inheritDoc} */
  @Override
  public void onAddSpec(Spec addedSpec) {
    if (this.helixManager.isPresent() && !this.helixManager.get().isConnected()) {
      // Specs in store will be notified when Scheduler is added as listener to FlowCatalog, so ignore
      // .. Specs if in cluster mode and Helix is not yet initialized
      _log.info("System not yet initialized. Skipping Spec Addition: " + addedSpec);
      return;
    }

    _log.info("New Spec detected: " + addedSpec);

    if (addedSpec instanceof FlowSpec) {
      if (!isActive && helixManager.isPresent()) {
        _log.info("Scheduler running in slave mode, forward Spec add via Helix message to master: " + addedSpec);
        HelixUtils.sendUserDefinedMessage(ServiceConfigKeys.HELIX_FLOWSPEC_ADD, addedSpec.getUri().toString(),
            UUID.randomUUID().toString(), InstanceType.CONTROLLER, helixManager.get(), _log);
        return;
      }

      try {
        Properties jobConfig = new Properties();
        Properties flowSpecProperties = ((FlowSpec) addedSpec).getConfigAsProperties();
        jobConfig.putAll(this.properties);
        jobConfig.setProperty(ConfigurationKeys.JOB_NAME_KEY, addedSpec.getUri().toString());
        if (flowSpecProperties.containsKey(ConfigurationKeys.JOB_SCHEDULE_KEY)
            && StringUtils.isNotBlank(flowSpecProperties.getProperty(ConfigurationKeys.JOB_SCHEDULE_KEY))) {
          jobConfig.setProperty(ConfigurationKeys.JOB_SCHEDULE_KEY, flowSpecProperties.getProperty(ConfigurationKeys.JOB_SCHEDULE_KEY));
        }

        this.scheduledFlowSpecs.put(addedSpec.getUri().toString(), addedSpec);

        if (jobConfig.containsKey(ConfigurationKeys.JOB_SCHEDULE_KEY)) {
          _log.info("Scheduling flow spec: " + addedSpec);
          scheduleJob(jobConfig, null);
          if (jobConfig.containsKey(ConfigurationKeys.FLOW_RUN_IMMEDIATELY)) {
            _log.info("RunImmediately requested, hence executing FlowSpec: " + addedSpec);
            this.jobExecutor.execute(new NonScheduledJobRunner(jobConfig, null));
          }
        } else {
          _log.info("No FlowSpec schedule found, so running FlowSpec: " + addedSpec);
          this.jobExecutor.execute(new NonScheduledJobRunner(jobConfig, null));
        }
      } catch (JobException je) {
        _log.error("Failed to schedule or run FlowSpec " + addedSpec, je);
      }
    }
  }

  /** {@inheritDoc} */
  @Override
  public void onDeleteSpec(URI deletedSpecURI, String deletedSpecVersion) {
    if (this.helixManager.isPresent() && !this.helixManager.get().isConnected()) {
      // Specs in store will be notified when Scheduler is added as listener to FlowCatalog, so ignore
      // .. Specs if in cluster mode and Helix is not yet initialized
      _log.info("System not yet initialized. Skipping Spec Deletion: " + deletedSpecURI);
      return;
    }
    _log.info("Spec deletion detected: " + deletedSpecURI + "/" + deletedSpecVersion);

    if (!isActive && helixManager.isPresent()) {
      _log.info("Scheduler running in slave mode, forward Spec delete via Helix message to master: " + deletedSpecURI);
      HelixUtils.sendUserDefinedMessage(ServiceConfigKeys.HELIX_FLOWSPEC_REMOVE, deletedSpecURI.toString() + ":" +
              deletedSpecVersion, UUID.randomUUID().toString(), InstanceType.CONTROLLER, helixManager.get(), _log);
      return;
    }

    try {
      this.scheduledFlowSpecs.remove(deletedSpecURI.toString());
      unscheduleJob(deletedSpecURI.toString());
    } catch (JobException e) {
      _log.warn(String.format("Spec with URI: %s was not unscheduled cleaning",
          deletedSpecURI), e);
    }
  }

  /** {@inheritDoc} */
  @Override
  public void onUpdateSpec(Spec updatedSpec) {
    if (this.helixManager.isPresent() && !this.helixManager.get().isConnected()) {
      // Specs in store will be notified when Scheduler is added as listener to FlowCatalog, so ignore
      // .. Specs if in cluster mode and Helix is not yet initialized
      _log.info("System not yet initialized. Skipping Spec Update: " + updatedSpec);
      return;
    }

    _log.info("Spec changed: " + updatedSpec);

    if (!(updatedSpec instanceof FlowSpec)) {
      return;
    }

    if (!isActive && helixManager.isPresent()) {
      _log.info("Scheduler running in slave mode, forward Spec update via Helix message to master: " + updatedSpec);
      HelixUtils.sendUserDefinedMessage(ServiceConfigKeys.HELIX_FLOWSPEC_UPDATE, updatedSpec.getUri().toString(),
          UUID.randomUUID().toString(), InstanceType.CONTROLLER, helixManager.get(), _log);
      return;
    }

    try {
      onDeleteSpec(updatedSpec.getUri(), updatedSpec.getVersion());
    } catch (Exception e) {
      _log.error("Failed to update Spec: " + updatedSpec, e);
    }
    try {
      onAddSpec(updatedSpec);
    } catch (Exception e) {
      _log.error("Failed to update Spec: " + updatedSpec, e);
    }
  }

  /**
   * A Gobblin job to be scheduled.
   */
  @DisallowConcurrentExecution
  @Slf4j
  public static class GobblinServiceJob extends BaseGobblinJob implements InterruptableJob {
    private static final Logger _log = LoggerFactory.getLogger(GobblinServiceJob.class);

    @Override
    public void executeImpl(JobExecutionContext context)
        throws JobExecutionException {
      _log.info("Starting FlowSpec " + context.getJobDetail().getKey());

      JobDataMap dataMap = context.getJobDetail().getJobDataMap();
      JobScheduler jobScheduler = (JobScheduler) dataMap.get(JOB_SCHEDULER_KEY);
      Properties jobProps = (Properties) dataMap.get(PROPERTIES_KEY);
      JobListener jobListener = (JobListener) dataMap.get(JOB_LISTENER_KEY);

      try {
        jobScheduler.runJob(jobProps, jobListener);
      } catch (Throwable t) {
        throw new JobExecutionException(t);
      }
    }

    @Override
    public void interrupt()
        throws UnableToInterruptJobException {
      log.info("Job was interrupted");
    }
  }

  /**
   * This class is responsible for running non-scheduled jobs.
   */
  class NonScheduledJobRunner implements Runnable {

    private final Properties jobConfig;
    private final JobListener jobListener;

    public NonScheduledJobRunner(Properties jobConfig, JobListener jobListener) {
      this.jobConfig = jobConfig;
      this.jobListener = jobListener;
    }

    @Override
    public void run() {
      try {
        GobblinServiceJobScheduler.this.runJob(this.jobConfig, this.jobListener);
      } catch (JobException je) {
        _log.error("Failed to run job " + this.jobConfig.getProperty(ConfigurationKeys.JOB_NAME_KEY), je);
      }
    }
  }
}


text:
var moment = require('moment');
module.exports = {
  unixtimeSec: function unixtimeSec(oldfield) {
  return moment.unix(oldfield).toISOString();
  },
  unixtimeMsec: function unixtimeMsec(oldfield) {
  return moment.unix(oldfield/1000).toISOString();
  }
};


text:
#ifndef CORE_MEMORYSTREAM_H_
#define CORE_MEMORYSTREAM_H_

#include <Core/NonCopyable.h>
#include <Core/IO/Streams.h>

namespace Core
{
/**
 * Cette classe permet de traiter le contenu d'une zone mémoire comme s'il s'agissait
 * d'une stream.
 *
 * La zone n'est accessible qu'en lecture est définie à la création de la stream,
 * sans pouvoir être modifiée. L'idée est d'utiliser cette stream pour interfacer
 * une zone mémoire déjà existante. Si vous voulez gérer une stream comme un tampon
 * dans lequel on peut lire et écrire il faut plutôt créer un Core::BufferStream.
 * \ingroup IO
 */
class LM_API_COR MemoryInputStream : public Object, public SeekableInputStream, public NonCopyable
{
public:
    /**
     * Crée une stream qui référence les données à l'adresse \a pData
     * de la taille de \a size octets. Si \a ownData est à true, la mémoire
     * est libérée avec l'opérateur delete []. Dans le cas contraire c'est à
     * l'appelant de gérer la mémoire.
     */
    MemoryInputStream(const void * pData, int32 size, bool ownData=false);
    ~MemoryInputStream();

    virtual void readData(void * buffer, int32 size);
    virtual int32 readUpTo(void * buffer, int32 size);
    virtual bool eof() const;
    virtual void close();

    virtual int64 getPosition() const;
    virtual int64 getLength() const;
    virtual void setPosition(int64 offset, ESeekOrigin origin);
    virtual void rewind();
protected:
    const byte * _pDataStart;
    const byte * _pDataEnd;
    const byte * _pCurData;
    bool         _ownData;
};
}

#endif /*CORE_MEMORYSTREAM_H_*/


text:
import { Route } from '@angular/router';
import { TablesComponent } from './tables.component';

export const TablesRoutes: Route[] = [
  	{
    	path: 'table',
    	component: TablesComponent

  	}
];


text:
include Makefile.inc

CIAOC=ciaoc -s
SWIOPTS=--stand-alone --goal=main -L8m -G16m
SWIPL=swipl

all: tempdir bta/bta.sav
	$(SWIPL) $(SWIOPTS) -o show_annotated -c show_annotated.pl
	$(SWIPL) $(SWIOPTS) -o highlight -c highlight.pl
	$(CIAOC) manual_annotate.pl
	$(CIAOC) collect_anns.pl
	./create_menus.sh

clean:
	-rm show_annotated highlight tempdir manual_annotate

bta/bta.sav: bta/path.pl bta/sicstus_prolog_to_xml.pl bta/bta.pl
	if [ x$(ENABLE_BTA) == xtrue ]; \
	then \
		cd bta; /Users/leuschel/bin/bin/sicstus -l bta.pl; \
	fi

tempdir: tempdir.c
	gcc -o tempdir tempdir.c


text:
isArticle: true
title: "Unsere Fahrzeuge"
short: "About"
menuOrder: 1
---
<img src="/fahrzeuge/images/cover.png"/>

This is a book on the functional paradigm in general. We'll use the world's most popular functional programming language: JavaScript. Some may feel this is a poor choice as it's against the grain of the current culture which, at the moment, feels predominately imperative. However, I believe it is the best way to learn FP for several reasons:

 * You likely use it every day at work.

    This makes it possible to practice and apply your acquired knowledge each day on real world programs rather than pet projects on nights and weekends in an esoteric FP language.

 * We don't have to learn everything up front to start writing programs.

    In a pure functional language, you cannot log a variable or read a DOM node without using monads. Here we can cheat a little as we learn to purify our codebase. It's also easier to get started in this language since it's mixed paradigm and you can fall back on your current practices while there are gaps in your knowledge.

 * The language is fully capable of writing top notch functional code.

    We have all the features we need to mimic a language like Scala or Haskell with the help of a tiny library or two. Object-oriented programming currently dominates the industry, but it's clearly awkward in JavaScript. It's akin to camping off of a highway or tap dancing in galoshes. We have to `bind` all over the place lest `this` change out from under us, we don't have classes[^Yet], we have various work arounds for the quirky behavior when the `new` keyword is forgotten, private members are only available via closures. To a lot of us, FP feels more natural anyways.

That said, typed functional languages will, without a doubt, be the best place to code in the style presented by this book. JavaScript will be our means of learning a paradigm, where you apply it is up to you. Luckily, the interfaces are mathematical and, as such, ubiquitous. You'll find yourself at home with swiftz, scalaz, haskell, purescript, and other mathematically inclined environments.

# Table of Contents

## Part 1

* [Chapter 1: What ever are we doing?](/fahrzeuge/ch1)
  * [Introductions](/fahrzeuge/ch1#introductions)
  * [A brief encounter](/fahrzeuge/ch1#a-brief-encounter)
* [Chapter 2: First Class Functions](/fahrzeuge/ch2)
  * [A quick review](/fahrzeuge/ch2#a-quick-review)
  * [Why favor first class?](/fahrzeuge/ch2#why-favor-first-class)
* [Chapter 3: Pure Happiness with Pure Functions](/fahrzeuge/ch3)
  * [Oh to be pure again](/fahrzeuge/ch3#oh-to-be-pure-again)
  * [Side effects may include...](/fahrzeuge/ch3#side-effects-may-include)
  * [8th grade math](/fahrzeuge/ch3#8th-grade-math)
  * [The case for purity](/fahrzeuge/ch3#the-case-for-purity)
  * [In Summary](/fahrzeuge/ch3#in-summary)
* [Chapter 4: Currying](/fahrzeuge/ch4)
  * [Can't live if livin' is without you](/fahrzeuge/ch4#cant-live-if-livin-is-without-you)
  * [More than a pun / Special sauce](/fahrzeuge/ch4#more-than-a-pun--special-sauce)
  * [In Summary](/fahrzeuge/ch4#in-summary)
* [Chapter 5: Coding by Composing](/fahrzeuge/ch5)
  * [Functional Husbandry](/fahrzeuge/ch5#functional-husbandry)
  * [Pointfree](/fahrzeuge/ch5#pointfree)
  * [Debugging](/fahrzeuge/ch5#debugging)
  * [Category Theory](/fahrzeuge/ch5#category-theory)
  * [In Summary](/fahrzeuge/ch5#in-summary)
* [Chapter 6: Example Application](/fahrzeuge/ch6)
  * [Declarative Coding](/fahrzeuge/ch6#declarative-coding)
  * [A flickr of functional programming](/fahrzeuge/ch6#a-flickr-of-functional-programming)
  * [A Principled Refactor](/fahrzeuge/ch6#a-principled-refactor)
  * [In Summary](/fahrzeuge/ch6#in-summary)

## Part 2

* [Chapter 7: Hindley-Milner and Me](/fahrzeuge/ch7)
  * [What's your type?](/fahrzeuge/ch7#whats-your-type)
  * [Tales from the cryptic](/fahrzeuge/ch7#tales-from-cryptic)
  * [Narrowing the possibility](/fahrzeuge/ch7#narrowing-the-possibility)
  * [Free as in theorem](/fahrzeuge/ch7#free-as-in-theorem)
  * [In Summary](/fahrzeuge/ch7#in-summary)
* [Chapter 8: Tupperware](/fahrzeuge/ch8)
  * [The Mighty Container](/fahrzeuge/ch8#the-mighty-container)
  * [My First Functor](/fahrzeuge/ch8#my-first-functor)
  * [Schrödinger's Maybe](/fahrzeuge/ch8#schrodingers-maybe)
  * [Pure Error Handling](/fahrzeuge/ch8#pure-error-handling)
  * [Old McDonald had Effects…](/fahrzeuge/ch8#old-mcdonald-had-effects)
  * [Asynchronous Tasks](/fahrzeuge/ch8#asynchronous-tasks)
  * [A Spot of Theory](/fahrzeuge/ch8#a-spot-of-theory)
  * [In Summary](/fahrzeuge/ch8#in-summary)
* [Chapter 9: Monadic Onions](/fahrzeuge/ch9)
  * [Pointy Functor Factory](/fahrzeuge/ch9#pointy-functor-factory)
  * [Mixing Metaphors](/fahrzeuge/ch9#mixing-metaphors)
  * [My chain hits my chest](/fahrzeuge/ch9#my-chain-hits-my-chest)
  * [Theory](/fahrzeuge/ch9#theory)
  * [In Summary](/fahrzeuge/ch9#in-summary)

# Plans for the future

* Part 1 is a guide to the basics. I'm updating as I find errors since this is the initial draft. Feel free to help!
* Part 2 will address type classes like functors and monads all the way through to traversable. I hope to squeeze in transformers and a pure application.
* Part 3 will start to dance the fine line between practical programming and academic absurdity. We'll look at comonads, f-algebras, free monads, yoneda, and other categorical constructs.


text:
/*

Colours documented here:
https://developer.mozilla.org/en-US/docs/Tools/DevToolsColors

*/

#content {
	background-color: var(--theme-body-background);
	color: var(--theme-body-color);
}

#extension-title {
    font-size: 200%;
    font-weight: bold;
    margin-bottom: 1em;
}

#extension-greeting {
    font-size: 150%;
    font-weight: bold;
    color: var(--theme-body-color-alt);
}


text:
package com.marklogic.entityservices.tests;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.marklogic.client.io.JacksonHandle;
import com.marklogic.client.semantics.SPARQLQueryManager;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class TestEntityTypeSPARQL extends EntityServicesTestBase {

    private static SPARQLQueryManager queryMgr;

    @BeforeClass
    public static void setup() {
        setupClients();
        TestSetup.getInstance().loadEntityTypes("/json-models", "SchemaCompleteEntityType-0.0.1.json");
        queryMgr = client.newSPARQLQueryManager();
    }
    @Test
    public void sampleSPARQLQueries() throws JsonGenerationException, JsonMappingException, IOException {
        String docHasTypeHasPropertyHasDatatype =
                     "PREFIX t: <http://marklogic.com/testing-entity-type#> "
                    +"PREFIX es: <http://marklogic.com/entity-services#> "
                    + "ASK where { t:SchemaCompleteEntityType-0.0.1 a es:Model ; "
                    + "   es:definitions ?types ."
                    + "?types es:property ?property ."
                    + "?property es:datatype ?datatype "
                    + "}";

        assertTrue(queryMgr.executeAsk(queryMgr.newQueryDefinition(docHasTypeHasPropertyHasDatatype)));

        String assertTypeHasProperties =  "PREFIX t: <http://marklogic.com/testing-entity-type/SchemaCompleteEntityType-0.0.1/> "
                +"PREFIX es: <http://marklogic.com/entity-services#> "
                +"SELECT ?version where {"
                + "t:SchemaCompleteEntityType ?version \"0.0.1\" ."
                + "}";

        JacksonHandle handle = queryMgr.executeSelect(queryMgr.newQueryDefinition(assertTypeHasProperties), new JacksonHandle());
        JsonNode results = handle.get();

        // to see on System.out
        // new ObjectMapper().writerWithDefaultPrettyPrinter().writeValue(System.out, results);

        ArrayNode bindings = (ArrayNode) results.get("results").get("bindings");
        assertEquals(1, bindings.size());
        assertEquals("http://marklogic.com/entity-services#version", bindings.get(0).get("version").get("value").asText());

    }

}


text:
void getNanoSeconds(ASIOTimeStamp *time);

static const double twoRaisedTo32 = 4294967296.;

void getNanoSeconds(ASIOTimeStamp *time)
{
	UnsignedWide ys;
	Microseconds(&ys);
	double r = 1000. * ((double)ys.hi * twoRaisedTo32 + (double)ys.lo);
	time->hi = (unsigned long)(r / twoRaisedTo32);
	time->lo = (unsigned long)(r - (double)time->hi * twoRaisedTo32);
}


text: This contains rendered .json and .svg


text:
package event_test

import (
	"testing"

	. "github.com/onsi/gomega"

	"istio.io/istio/galley/pkg/config/event"
	"istio.io/istio/galley/pkg/config/testing/data"
	"istio.io/istio/galley/pkg/config/testing/fixtures"
)

func TestRouter_Empty(t *testing.T) {
	s := event.NewRouter()
	// No crash
	s.Handle(data.Event1Col1AddItem1)
	s.Broadcast(data.Event1Col1DeleteItem1)
}

func TestRouter_Single_Handle(t *testing.T) {
	g := NewGomegaWithT(t)

	s := event.NewRouter()
	acc := &fixtures.Accumulator{}
	s = event.AddToRouter(s, data.Collection1, acc)
	s.Handle(data.Event1Col1AddItem1)

	g.Expect(acc.Events()).To(HaveLen(1))
}

func TestRouter_Single_Handle_AddToNil(t *testing.T) {
	g := NewGomegaWithT(t)

	var s event.Router
	acc := &fixtures.Accumulator{}
	s = event.AddToRouter(s, data.Collection1, acc)
	s.Handle(data.Event1Col1AddItem1)

	g.Expect(acc.Events()).To(HaveLen(1))
}

func TestRouter_Single_Handle_NoMatch(t *testing.T) {
	g := NewGomegaWithT(t)

	s := event.NewRouter()
	acc := &fixtures.Accumulator{}
	s = event.AddToRouter(s, data.Collection2, acc)
	s.Handle(data.Event1Col1AddItem1)

	g.Expect(acc.Events()).To(HaveLen(0))
}

func TestRouter_Single_MultiListener(t *testing.T) {
	g := NewGomegaWithT(t)

	s := event.NewRouter()
	acc1 := &fixtures.Accumulator{}
	acc2 := &fixtures.Accumulator{}
	s = event.AddToRouter(s, data.Collection1, acc1)
	s = event.AddToRouter(s, data.Collection1, acc2)
	s.Handle(data.Event1Col1AddItem1)

	g.Expect(acc1.Events()).To(HaveLen(1))
	g.Expect(acc2.Events()).To(HaveLen(1))
}

func TestRouter_Single_Broadcast(t *testing.T) {
	g := NewGomegaWithT(t)

	s := event.NewRouter()
	acc := &fixtures.Accumulator{}
	s = event.AddToRouter(s, data.Collection1, acc)
	s.Broadcast(event.Event{Kind: event.Reset})

	g.Expect(acc.Events()).To(HaveLen(1))
}

func TestRouter_Multi_Handle(t *testing.T) {
	g := NewGomegaWithT(t)

	s := event.NewRouter()
	acc1 := &fixtures.Accumulator{}
	acc2 := &fixtures.Accumulator{}
	acc3 := &fixtures.Accumulator{}
	s = event.AddToRouter(s, data.Collection1, acc1)
	s = event.AddToRouter(s, data.Collection2, acc2)
	s = event.AddToRouter(s, data.Collection3, acc3)
	s.Handle(data.Event1Col1AddItem1)
	s.Handle(data.Event3Col2AddItem1)

	g.Expect(acc1.Events()).To(HaveLen(1))
	g.Expect(acc2.Events()).To(HaveLen(1))
	g.Expect(acc3.Events()).To(HaveLen(0))
}

func TestRouter_Multi_NoTarget(t *testing.T) {
	g := NewGomegaWithT(t)

	s := event.NewRouter()
	acc1 := &fixtures.Accumulator{}
	acc2 := &fixtures.Accumulator{}
	s = event.AddToRouter(s, data.Collection1, acc1)
	s = event.AddToRouter(s, data.Collection3, acc2)
	s.Handle(data.Event3Col2AddItem1)

	g.Expect(acc1.Events()).To(HaveLen(0))
	g.Expect(acc2.Events()).To(HaveLen(0))
}

func TestRouter_Multi_Broadcast(t *testing.T) {
	g := NewGomegaWithT(t)

	s := event.NewRouter()
	acc1 := &fixtures.Accumulator{}
	acc2 := &fixtures.Accumulator{}
	acc3 := &fixtures.Accumulator{}
	s = event.AddToRouter(s, data.Collection1, acc1)
	s = event.AddToRouter(s, data.Collection2, acc2)
	s = event.AddToRouter(s, data.Collection3, acc3)
	s.Broadcast(event.Event{Kind: event.Reset})

	g.Expect(acc1.Events()).To(HaveLen(1))
	g.Expect(acc2.Events()).To(HaveLen(1))
	g.Expect(acc3.Events()).To(HaveLen(1))
}

func TestRouter_Multi_Unknown_Panic(t *testing.T) {
	g := NewGomegaWithT(t)

	defer func() {
		r := recover()
		g.Expect(r).ToNot(BeNil())
	}()
	_ = event.AddToRouter(&unknownSelector{}, data.Collection3, &fixtures.Accumulator{})
}

type unknownSelector struct{}

var _ event.Router = &unknownSelector{}

func (u *unknownSelector) Handle(e event.Event)    {}
func (u *unknownSelector) Broadcast(e event.Event) {}