text:
import logging
import re

from fabric.api import execute, hide, sudo

RING_TYPES = ['account', 'container', 'object']

_host_lshw_output = {}

LOG = logging.getLogger(__name__)

def _parse_lshw_output(output, blockdev):
    disks = re.split('\s*\*', output.strip())
    alldisks = []
    for disk in disks:
        d = {}
        for line in disk.split('\n'):
            match = re.match('^-(\w+)', line)
            if match:
                d['class'] = match.group(1)
            else:
                match = re.match('^\s+([\w\s]+):\s+(.*)$', line)
                if match:
                    key = re.sub('\s', '_', match.group(1))
                    val = match.group(2)
                    d[key] = val
        if 'class' in d:
            alldisks.append(d)

    for d in alldisks:
        if d['logical_name'] == blockdev:
            serial = d['serial']
            match = re.match('\s*(\d+)[MG]iB.*', d['size'])
            if not match:
                raise Exception("Could not find size of disk %s" % disk)
            size = int(match.group(1))
            return size, serial

def _fab_get_disk_size_serial(ip, blockdev):
    with hide('running', 'stdout', 'stderr'):
        global _host_lshw_output
        output = None
        if ip in _host_lshw_output:
            output = _host_lshw_output[ip]
        else:
            output = sudo('lshw -C disk', pty=False, shell=False)
            _host_lshw_output[ip] = output
        return _parse_lshw_output(output, blockdev)

def get_disk_size_serial(ip, blockdev):
    with hide('running', 'stdout', 'stderr'):
        out = execute(_fab_get_disk_size_serial, ip, blockdev, hosts=[ip])
        return out[ip]

def get_devices(zones, metadata=None):
    devices = {}
    for builder in RING_TYPES:
        devices[builder] = {}
        for zone, nodes in zones.iteritems():
            devices[builder][zone] = []
            for node, disks in nodes.iteritems():
                ringdisks = []
                # Add all disks designated for ringtype
                if isinstance(disks['disks'], dict):
                    if builder in disks['disks']:
                        ringdisks += disks['disks'][builder]
                elif isinstance(disks['disks'], list):
                    ringdisks = disks['disks']
            for ringdisk in ringdisks:
                device = {}
                device['weight'] = None
                device['metadata'] = metadata
                device['device'] = None
                device['ip'] = node
                if not isinstance(ringdisk, dict):
                    device['device'] = ringdisk
                    match = re.match('(.*)\d+$', ringdisk)
                    blockdev = '/dev/%s' % match.group(1)
                    # treat size as weight and serial as metadata
                    weight, serial = get_disk_size_serial(node, blockdev)
                    device['weight'] = weight
                    if not metadata:
                        device['metadata'] = serial
                else:
                    device['device'] = ringdisk['blockdev']
                    device['weight'] = ringdisk['weight']
                    if 'metadata' in ringdisk:
                        device['metadata'] = ringdisk['metadata']
                devices[builder][zone].append(device)
    return devices


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

namespace NHibernateHbmToFluent.Converter
{
	[Serializable]
#pragma warning disable 661,660
	public class NamedConstant<T>
#pragma warning restore 661,660
		where T : class
	{
		private static readonly Dictionary<string, T> NamedConstants = new Dictionary<string, T>();

		protected void Add(string key, T item)
		{
			NamedConstants.Add(key, item);
		}

		protected static T Get(string key)
		{
			if (key == null)
			{
				return null;
			}
			T t;
			NamedConstants.TryGetValue(key, out t);
			return t;
		}

		public static bool operator ==(NamedConstant<T> a, NamedConstant<T> b)
		{
			if (ReferenceEquals(a, b))
			{
				return true;
			}

			if (((object) a == null) || ((object) b == null))
			{
				return false;
			}

			return a.Equals(b);
		}

		public static bool operator !=(NamedConstant<T> a, NamedConstant<T> b)
		{
			return !(a == b);
		}

		public static IEnumerable<T> AllValues
		{
			get { return NamedConstants.Values; }
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
namespace te
{
	class TE_EXPORT PointLightComponent : public Component
	{
	public:

		PointLightComponent() : light(nullptr) {}
		PointLightComponent(PointLight* pl);

		void start() override;

		PointLight* light;

	public:
		static Component* getNewInstance()
		{
			return new PointLightComponent();
		}

		virtual const string& PointLightComponent::getTypeName() const override
		{
			return TypeParseTraits<PointLightComponent>::name();
		}

		void serialize() override;
		void deserialize() override;
	};
}


text:
package com.fastmodel.commons.event;

/**
 * Utilities and base implementations for Event Service implementations.
 *
 * @author Ben Schreiber
 * @version 1.0
 */
public abstract class AbstractEventService< Event extends IEvent > implements IEventService<Event> {
    /**
     * Check if the event is a cancellable event which has been cancelled.
     *
     * @param ev The event object to check
     * @return {@code true} if the event is cancellable and has been cancelled.
     */
    protected static <Event> boolean isCanceled( Event ev ) {
        return ev instanceof ICancelableEvent && ( (ICancelableEvent) ev ).isCancelled();
    }

    /**
     *
Invoked prior to invoking any handlers on this Service.
     *
     *
Override this method to provide pre-handling for event firing, eg.
     * to propagate the event prior to invoking handlers in this service.
     * Handlers in this service will not be invoked if the event is cancelled
     * by this method.
     *
     * @param event The original event object
     * @return {@code true} if any handlers were invoked and the event was not cancelled.
     */
    protected boolean preFire( Event event ) {
        return false;
    }

    /**
     *
Invoked after all handlers for this event (if any) have been invoked (unless
     * the event {@link #isCanceled}).
     *
     *
Override this method to provide post-handling, eg. to propagate an event
     * up the model hierarchy.
     *
     * @param event   The original event object
     * @param handled {@code true} if at least one handler has been invoked already.
     *
     * @return {@code true} if at least one handler has been invoked and the event
     *                      was not cancelled.
     */
    protected boolean postFire( Event event, boolean handled ) {
        return handled;
    }

    /**
     * Prepare the event object to be passed to a listener: if the event
     * object implements {@link com.fastmodel.commons.event.IClonableEvent}, the event is cloned.
     *
     * @param event The fired event object
     * @return The instance of the event object to pass to the listener, or {@code null} if
     *          cloning failed.  {@code null} may also be returned to suppress handler invocation.
     */
    protected Event prepEvent( Event event ) {
        if ( event instanceof IClonableEvent ) {
            try {
                //noinspection unchecked
                return (Event) ( (IClonableEvent) event ).clone();
            } catch ( CloneNotSupportedException e ) {
                return null;
            }
        } else {
            return event;
        }
    }
}


text:
#import <Foundation/NSKeyValueFastMutableOrderedSet.h>

@class NSKeyValueNonmutatingOrderedSetMethodSet;

// Not exported
@interface NSKeyValueFastMutableOrderedSet1 : NSKeyValueFastMutableOrderedSet
{
    NSKeyValueNonmutatingOrderedSetMethodSet *_nonmutatingMethods;
}

+ (CDStruct_7c9a8e9f *)_proxyNonGCPoolPointer;
- (id)objectsAtIndexes:(id)arg1;
- (id)objectAtIndex:(unsigned long long)arg1;
- (unsigned long long)indexOfObject:(id)arg1;
- (void)getObjects:(id *)arg1 range:(struct _NSRange)arg2;
- (unsigned long long)count;
- (void)_proxyNonGCFinalize;
- (id)_proxyInitWithContainer:(id)arg1 getter:(id)arg2;

@end


text:
package com.google.cloud.storage.storagetransfer.samples.test;

import static com.google.common.truth.Truth.assertThat;

import com.google.cloud.storage.storagetransfer.samples.AwsRequester;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

@RunWith(JUnit4.class)
public class AwsRequesterTest {

  /**
   * Tests whether AwsRequester executes a request to create a TransferJob.
   */
  @Test
  public void testRun() throws Exception {
    ByteArrayOutputStream outBytes = new ByteArrayOutputStream();
    PrintStream outStream = new PrintStream(outBytes);
    System.setProperty("projectId", "cloud-samples-tests");
    System.setProperty("jobDescription", "Sample transfer job from S3 to GCS.");
    System.setProperty("awsSourceBucket", "cloud-samples-tests");
    System.setProperty("gcsSinkBucket", "cloud-samples-tests-storagetransfer");
    System.setProperty("startDate", "2000-01-01");
    System.setProperty("startTime", "00:00:00");

    AwsRequester.run(outStream);
    String out = outBytes.toString();

    assertThat(out).contains("\"description\" : \"Sample transfer job from S3 to GCS.\"");
  }
}


text:
FOUNDATION_EXPORT double AtlasOSXVersionNumber;

//! Project version string for AtlasOSX.
FOUNDATION_EXPORT const unsigned char AtlasOSXVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <AtlasOSX/PublicHeader.h>


text:
#ifndef FontResource_h
#define FontResource_h

#include "core/fetch/Resource.h"
#include "core/fetch/ResourceClient.h"
#include "platform/Timer.h"
#include "platform/fonts/FontOrientation.h"
#include "wtf/OwnPtr.h"

namespace blink {

class FetchRequest;
class ResourceFetcher;
class FontPlatformData;
class FontCustomPlatformData;
class FontResourceClient;

class FontResource final : public Resource {
public:
    using ClientType = FontResourceClient;

    static FontResource* fetch(FetchRequest&, ResourceFetcher*);
    ~FontResource() override;

    void didAddClient(ResourceClient*) override;

    void setRevalidatingRequest(const ResourceRequest&) override;

    void allClientsAndObserversRemoved() override;
    void startLoadLimitTimersIfNeeded();

    void setCORSFailed() override { m_corsFailed = true; }
    bool isCORSFailed() const { return m_corsFailed; }
    String otsParsingMessage() const { return m_otsParsingMessage; }

    bool ensureCustomFontData();
    FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = FontOrientation::Horizontal);

protected:
    bool isSafeToUnlock() const override;

private:
    class FontResourceFactory : public ResourceFactory {
    public:
        FontResourceFactory()
            : ResourceFactory(Resource::Font) { }

        Resource* create(const ResourceRequest& request, const ResourceLoaderOptions& options, const String& charset) const override
        {
            return new FontResource(request, options);
        }
    };
    FontResource(const ResourceRequest&, const ResourceLoaderOptions&);

    void checkNotify() override;
    void fontLoadShortLimitCallback(Timer<FontResource>*);
    void fontLoadLongLimitCallback(Timer<FontResource>*);

    enum LoadLimitState { UnderLimit, ShortLimitExceeded, LongLimitExceeded };

    OwnPtr<FontCustomPlatformData> m_fontData;
    String m_otsParsingMessage;
    LoadLimitState m_loadLimitState;
    bool m_corsFailed;
    Timer<FontResource> m_fontLoadShortLimitTimer;
    Timer<FontResource> m_fontLoadLongLimitTimer;

    friend class MemoryCache;
};

DEFINE_RESOURCE_TYPE_CASTS(Font);

class FontResourceClient : public ResourceClient {
public:
    ~FontResourceClient() override {}
    static bool isExpectedType(ResourceClient* client) { return client->getResourceClientType() == FontType; }
    ResourceClientType getResourceClientType() const final { return FontType; }
    virtual void fontLoadShortLimitExceeded(FontResource*) {}
    virtual void fontLoadLongLimitExceeded(FontResource*) {}
};

} // namespace blink

#endif


text:
      <mat-form-field>
        <mat-select placeholder="Knjiga" [(value)]="checkout.bookTitle" [formControl]="knjigaControl" required>
          <mat-option *ngFor="let book of books" [value]="book">
            {{ book }}
          </mat-option>
        </mat-select>
        <mat-error *ngIf="knjigaControl.hasError('required')">Odaberite knjigu</mat-error>
      </mat-form-field>

      <mat-form-field>
        <mat-select placeholder="Član" [(value)]="checkout.memberId" [formControl]="memberControl">
          <mat-option *ngFor="let member of members" [value]="member.id">
            {{ member.firstName }} {{ member.lastName}}
          </mat-option>
        </mat-select>
        <mat-error *ngIf="memberControl.hasError('required')">Odaberite člana</mat-error>
      </mat-form-field>

      <mat-form-field>
        <mat-select placeholder="Knjižničar" [(value)]="checkout.librarianUsername" [formControl]="librarianControl">
          <mat-option *ngFor="let librarian of librarians" [value]="librarian.username">
            {{ librarian.firstName }} {{librarian.lastName}}
          </mat-option>
        </mat-select>
        <mat-error *ngIf="librarianControl.hasError('required')">Odaberite knjižničara</mat-error>
      </mat-form-field>

<button mat-fab type="submit" (click)="submitCheckout()">Ckeckout</button>

 0">

      Član
      Knjiga
      Autor
      Knjiznicar
      Posuđeno
      Vračeno

      {{check.memberName}}
      {{check.bookTitle}}
      {{check.authorName}}
      {{check.librarianName}}
      {{check.checkoutFormatted}}
      {{check.checkInFormatted}} <button mat-raised-button *ngIf="check.checkInFormatted == null" (click)="checkIn(check)">Checkin</button>
      <button mat-raised-button (click)="delete(check)">Delete</button>

  <app-checkout-table [dataSource]="dataSource"></app-checkout-table>


text:
import {IframeMessagingClient} from '../../../3p/iframe-messaging-client';
import {serializeMessage} from '../../../src/3p-frame-messaging';

describes.realWin('iframe-messaging-client', {}, env => {

  let win;
  let client;
  let postMessageStub;
  let hostWindow;

  beforeEach(() => {
    win = env.win;
    postMessageStub = sandbox.stub();
    hostWindow = {postMessage: postMessageStub};
    client = new IframeMessagingClient(win);
    client.setHostWindow(hostWindow);
    client.setSentinel('sentinel-123');
  });

  describe('makeRequest', () => {
    it('should send the request via postMessage', () => {
      const callbackSpy = sandbox.spy();
      client.makeRequest('request-type', 'response-type', callbackSpy);
      expect(postMessageStub).to.be.calledWith(serializeMessage(
          'request-type', 'sentinel-123', {}, '$internalRuntimeVersion$'));

      postAmpMessage(
          {type: 'response-type', sentinel: 'sentinel-123'}, hostWindow);
      expect(callbackSpy).to.be.calledOnce;
    });
  });

  describe('registerCallback', () => {
    it('should invoke callback on receiving a message of' +
        ' expected response type', () => {
      const callbackSpy = sandbox.spy();
      client.registerCallback('response-type', callbackSpy);

      postAmpMessage({
        type: 'response-type',
        sentinel: 'sentinel-123',
        x: 1,
        y: 'abc',
      }, hostWindow);
      expect(callbackSpy).to.be.calledWith({
        type: 'response-type',
        sentinel: 'sentinel-123',
        x: 1,
        y: 'abc',
      });
    });

    it('should not invoke callback on receiving a message of' +
        ' irrelevant response type', () => {
      const callbackSpy = sandbox.spy();
      client.registerCallback('response-type', callbackSpy);

      postAmpMessage(
          {type: 'response-type-2', sentinel: 'sentinel-123'}, hostWindow);
      expect(callbackSpy).to.not.be.called;
    });

    it('should not invoke callback on receiving a non-AMP message', () => {
      const callbackSpy = sandbox.spy();
      client.registerCallback('response-type', callbackSpy);

      win.eventListeners.fire({
        type: 'message',
        source: hostWindow,
        origin: 'http://www.example.com',
        data: 'nonamp-' + JSON.stringify({
          type: 'response-type',
          sentinel: 'sentinel-123',
        }),
      });
      expect(callbackSpy).to.not.be.called;
    });

    it('should not invoke callback on receiving a message ' +
        'not from host window', () => {
      const callbackSpy = sandbox.spy();
      client.registerCallback('response-type', callbackSpy);
      const randomWindow = {};

      postAmpMessage(
          {type: 'response-type', sentinel: 'sentinel-123'}, randomWindow);
      expect(callbackSpy).to.not.be.called;
    });

    it('should not invoke callback on receiving a message ' +
        'containing no sentinel', () => {
      const callbackSpy = sandbox.spy();
      client.registerCallback('response-type', callbackSpy);

      postAmpMessage({type: 'response-type'}, hostWindow);
      expect(callbackSpy).to.not.be.called;
    });

    it('should not invoke callback on receiving a message ' +
        'containing wrong sentinel', () => {
      const callbackSpy = sandbox.spy();
      client.registerCallback('response-type', callbackSpy);

      postAmpMessage(
          {type: 'response-type', sentinel: 'sentinel-123-1'}, hostWindow);
      expect(callbackSpy).to.not.be.called;
    });
  });

  describe('sendMessage', () => {
    it('should send postMessage to host window', () => {
      client.sendMessage('request-type', {x: 1, y: 'abc'});
      expect(postMessageStub).to.be.calledWith(serializeMessage(
          'request-type',
          'sentinel-123',
          {x: 1, y: 'abc'},
          '$internalRuntimeVersion$'));
    });
  });

  function postAmpMessage(data, source) {
    win.eventListeners.fire({
      type: 'message',
      source,
      origin: 'http://www.example.com',
      data: 'amp-' + JSON.stringify(data),
    });
  }
});


text:
<?php

namespace Google\Service\CloudSearch;

class RequestFileScope extends \Google\Model
{
  /**
   * @var string
   */
  public $itemId;

  /**
   * @param string
   */
  public function setItemId($itemId)
  {
    $this->itemId = $itemId;
  }
  /**
   * @return string
   */
  public function getItemId()
  {
    return $this->itemId;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(RequestFileScope::class, 'Google_Service_CloudSearch_RequestFileScope');


text: hello settings


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Globalization;
using System.Linq;
using System.Reflection;
using OpenTelemetry;

namespace Azure.Monitor.OpenTelemetry.Exporter
{
    internal static class SdkVersionUtils
    {
        internal static string SdkVersion = GetSdkVersion();

        private static string GetSdkVersion()
        {
            try
            {
                string dotnetSdkVersion = GetVersion(typeof(object));
                string otelSdkVersion = GetVersion(typeof(Sdk));
                string extensionVersion = GetVersion(typeof(AzureMonitorTraceExporter));

                return string.Format(CultureInfo.InvariantCulture, $"dotnet{dotnetSdkVersion}:otel{otelSdkVersion}:ext{extensionVersion}");
            }
            catch (Exception ex)
            {
                AzureMonitorExporterEventSource.Log.Write($"SdkVersionCreateFailed{EventLevelSuffix.Warning}", ex);
                return null;
            }
        }

        private static string GetVersion(Type type)
        {
            try
            {
                string versionString = type
                .Assembly
                .GetCustomAttributes<AssemblyInformationalVersionAttribute>()
                .First()
                .InformationalVersion;

                // Informational version will be something like 1.1.0-beta2+a25741030f05c60c85be102ce7c33f3899290d49.
                // Ignoring part after '+' if it is present.
                string shortVersion = versionString?.Split('+')[0];

                return shortVersion;
            }
            catch (Exception ex)
            {
                AzureMonitorExporterEventSource.Log.Write($"ErrorInitializingPartOfSdkVersion{EventLevelSuffix.Error}", $"{ex.ToInvariantString()}");
                return null;
            }
        }
    }
}


text:
package org.bitcoinj.core.listeners;

import org.bitcoinj.core.Block;
import org.bitcoinj.core.FilteredBlock;
import org.bitcoinj.core.Peer;
import org.bitcoinj.core.Utils;
import org.bitcoinj.utils.ListenableCompletableFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.Nullable;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

/**
 *
An implementation of {@link BlockchainDownloadEventListener} that listens to chain download events and tracks progress
 * as a percentage. The default implementation prints progress to stdout, but you can subclass it and override the
 * progress method to update a GUI instead.

 */
public class DownloadProgressTracker implements BlockchainDownloadEventListener {
    private static final Logger log = LoggerFactory.getLogger(DownloadProgressTracker.class);
    private int originalBlocksLeft = -1;
    private int lastPercent = 0;
    private final CompletableFuture<Long> future = new CompletableFuture<>();
    private boolean caughtUp = false;

    @Override
    public void onChainDownloadStarted(Peer peer, int blocksLeft) {
        if (blocksLeft > 0 && originalBlocksLeft == -1)
            startDownload(blocksLeft);
        // Only mark this the first time, because this method can be called more than once during a chain download
        // if we switch peers during it.
        if (originalBlocksLeft == -1)
            originalBlocksLeft = blocksLeft;
        else
            log.info("Chain download switched to {}", peer);
        if (blocksLeft == 0) {
            doneDownload();
            future.complete(peer.getBestHeight());
        }
    }

    @Override
    public void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft) {
        if (caughtUp)
            return;

        if (blocksLeft == 0) {
            caughtUp = true;
            if (lastPercent != 100) {
                lastPercent = 100;
                progress(lastPercent, blocksLeft, new Date(block.getTimeSeconds() * 1000));
            }
            doneDownload();
            future.complete(peer.getBestHeight());
            return;
        }

        if (blocksLeft < 0 || originalBlocksLeft <= 0)
            return;

        double pct = 100.0 - (100.0 * (blocksLeft / (double) originalBlocksLeft));
        if ((int) pct != lastPercent) {
            progress(pct, blocksLeft, new Date(block.getTimeSeconds() * 1000));
            lastPercent = (int) pct;
        }
    }

    /**
     * Called when download progress is made.
     *
     * @param pct  the percentage of chain downloaded, estimated
     * @param date the date of the last block downloaded
     */
    protected void progress(double pct, int blocksSoFar, Date date) {
        log.info(String.format(Locale.US, "Chain download %d%% done with %d blocks to go, block date %s", (int) pct, blocksSoFar,
                Utils.dateTimeFormat(date)));
    }

    /**
     * Called when download is initiated.
     *
     * @param blocks the number of blocks to download, estimated
     */
    protected void startDownload(int blocks) {
        log.info("Downloading block chain of size " + blocks + ". " +
                (blocks > 1000 ? "This may take a while." : ""));
    }

    /**
     * Called when we are done downloading the block chain.
     */
    protected void doneDownload() {
    }

    /**
     * Wait for the chain to be downloaded.
     */
    public void await() throws InterruptedException {
        try {
            future.get();
        } catch (ExecutionException e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * Returns a listenable future that completes with the height of the best chain (as reported by the peer) once chain
     * download seems to be finished.
     */
    public ListenableCompletableFuture<Long> getFuture() {
        return ListenableCompletableFuture.of(future);
    }
}


text:
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

REM ##
REM # Configure these variables to match your environment
REM # If you have system-wide variables for FELIX_HOME and M2_REPO then you
REM # should not have to make any changes to this file.
REM ##

REM ## NOTA BENE:
REM ## Those programmers who, like me, are unfamiliar with the batch programming
REM ## constructs, may be shocked of the use of a 'for' loop when it does not
REM ## seem necessary. For them, I would like to clarify that there is other way
REM ## (but using a for loop) to assign the output of a command to a variable.

REM ## Try to guess the latest Java JDK location, if not already set
if not defined JAVA_HOME (
   REM ## Search java directory
   if exist "%PROGRAMFILES%\Java" (
      set search_dir=%PROGRAMFILES%\Java
   ) else (
      set search_dir=%PROGRAMFILES%
   )

   REM ## Chooses the directory starting with jdk with the highest alphabetical order (= latest version)
   for /f "delims=" %%f in ('dir "%search_dir%\jdk*" /b /o-n') do (
      set JAVA_HOME=%search_dir%\%%f
      REM ## Exits after the first coincidence
      goto break_javahome
   )

   :break_javahome
   REM ## If we get to here and JAVA_HOME is still not defined, exit with an error
   if not defined JAVA_HOME (
      echo JAVA_HOME is not defined!!! >&2
      exit /b 1
   )
)

REM ## Try to guess the latest Maven installation, if not already set
if not defined M2_HOME (
   REM ## Searches a directory under Program Files, starting by "apache-maven"
   for /f "delims=" %%f in ('dir "%PROGRAMFILES%\apache-maven*" /b /ad /s /o-n') do (
      set M2_HOME=%%f
      goto break_m2home
   )

   :break_m2home
   REM ## If we get to here and M2_HOME is still not defined, exit with an error
   if not defined M2_HOME (
      echo M2_HOME is not defined!!! >&2
      exit /b 1
   )
)

REM ## Assumes the Maven repository is in its default location
if not defined M2_REPO set M2_REPO=%USERPROFILE%\.m2\repository

REM ## Try to guess the latest Felix installation
if not defined FELIX_HOME (
   REM ## Searches a directory named felix-framework-* under the home drive
   for /f "delims=" %%f in ('dir "%HOMEDRIVE%\felix-framework-*" /b /s /ad /o-n') do (
      set FELIX_HOME=%%f
      goto break_felixhome
   )

   :break_felixhome
   if not defined FELIX_HOME (
      echo FELIX_HOME is not defined!!! >&2
      exit /b 1
   )
)

SET OPENCAST_LOGDIR=%FELIX_HOME%\logs

REM # To enable the debugger on the vm, enable all of the following options
SET DEBUG_PORT=8000
SET DEBUG_SUSPEND=n
REM SET DEBUG_OPTS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=%DEBUG_PORT%,server=y,suspend=%DEBUG_SUSPEND%

REM ##
REM # Only change the lines below if you know what you are doing
REM ##

SET FELIX_WORK_DIR=%FELIX_HOME%\work
SET FELIX_CONFIG_DIR=%FELIX_HOME%\etc
SET FELIX_OPTS=-Dfelix.home=%FELIX_HOME% -Dfelix.work=%FELIX_WORK_DIR%
SET FELIX_CONFIG_OPTS=-Dfelix.config.properties="file:%FELIX_CONFIG_DIR%/config.properties" -Dfelix.system.properties="file:%FELIX_CONFIG_DIR%/system.properties"
SET MAVEN_ARG=-DM2_REPO="%M2_REPO%"
SET FELIX_FILEINSTALL_OPTS=-Dfelix.fileinstall.dir="%FELIX_CONFIG_DIR%\load"
SET PAX_CONFMAN_OPTS=-Dbundles.configuration.location="%FELIX_CONFIG_DIR%"
SET PAX_LOGGING_OPTS=-Dorg.ops4j.pax.logging.DefaultServiceLog.level=WARN -Dopencast.logdir="%OPENCAST_LOGDIR%"
SET ECLIPSELINK_LOGGING_OPTS=-Declipselink.logging.level=SEVERE
SET UTIL_LOGGING_OPTS=-Djava.util.logging.config.file="%FELIX_CONFIG_DIR%\services\java.util.logging.properties"
SET FELIX_CACHE=%FELIX_WORK_DIR%\felix-cache
SET GRAPHICS_OPTS=-Djava.awt.headless=true -Dawt.toolkit=sun.awt.HeadlessToolkit

REM # Make sure matterhorn bundles are reloaded
if exist "%FELIX_CACHE%" (
   rmdir /s /q "%FELIX_CACHE%"
   if not exist "%FELIX_CACHE%" mkdir "%FELIX_CACHE%"
)

REM # Finally start felix

pushd "%FELIX_HOME%"
java %DEBUG_OPTS% %FELIX_OPTS% %FELIX_CONFIG_OPTS% %GRAPHICS_OPTS% %MAVEN_ARG% %FELIX_FILEINSTALL_OPTS% %PAX_CONFMAN_OPTS% %PAX_LOGGING_OPTS% %ECLIPSELINK_LOGGING_OPTS% %UTIL_LOGGING_OPTS% -jar "%FELIX_HOME%\bin\felix.jar" "%FELIX_CACHE%"
popd

ENDLOCAL


text:
// The MIT License (MIT)
//
// Copyright (c) 2015-2016 Rasmus Mikkelsen
// Copyright (c) 2015-2016 eBay Software Foundation
// https://github.com/rasmus/EventFlow
//
// 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.

using System;
using System.Linq;
using System.Reflection;
using EventFlow.Configuration;
using EventFlow.Extensions;

namespace EventFlow.Core.IoC.Factories
{
    internal class GenericFactory : IFactory
    {
        private readonly Type _serviceType;

        public GenericFactory(Type serviceType)
        {
            var constructorInfos = serviceType
                .GetTypeInfo()
                .GetConstructors();

            if (constructorInfos.Length > 1)
            {
                throw new Exception($"Type {serviceType.PrettyPrint()} has more than one constructor");
            }

            _serviceType = serviceType;
        }

        public object Create(IResolverContext resolverContext, Type[] genericTypeArguments)
        {
            var genericType = _serviceType.MakeGenericType(genericTypeArguments);
            var constructorInfo = genericType.GetTypeInfo().GetConstructors().Single();
            var parameterInfos = constructorInfo.GetParameters();

            var parameters = new object[parameterInfos.Length];
            foreach (var parameterInfo in parameterInfos)
            {
                parameters[parameterInfo.Position] = resolverContext.Resolver.Resolve(parameterInfo.ParameterType);
            }

            return constructorInfo.Invoke(parameters);
        }
    }
}


text:
<?php

namespace AppBundle\Repository\Infoprodukt;

use AppBundle\Entity\Assignments\ArticleArticleCategoryAssignment;
use AppBundle\Entity\Assignments\ArticleCategoryAssignment;
use AppBundle\Entity\Main\Article;
use AppBundle\Entity\Main\Category;
use AppBundle\Entity\Main\User;
use AppBundle\Filter\Base\Filter;
use AppBundle\Filter\Infomarket\Main\ArticleFilter;
use AppBundle\Repository\Common\ArticleRepository as BaseArticleRepository;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;

class ArticleRepository extends BaseArticleRepository {

	protected function buildJoins(QueryBuilder &$builder, Filter $filter) {
		/** @var ArticleFilter $filter */
		if (count($filter->getContextCategories()) > 0) {
			$builder->innerJoin(ArticleCategoryAssignment::class, 'aca', Join::WITH, 'e.id = aca.article');
		}

		if (count($filter->getArticleCategories()) > 0) {
			$builder->innerJoin(ArticleArticleCategoryAssignment::class, 'aaca', Join::WITH,
					'e.id = aaca.article');
		}

		$builder->leftJoin(User::class, 'u', Join::WITH, 'u.id = e.author');
	}

	protected function buildOrderBy(QueryBuilder &$builder, Filter $filter) {
		$builder->addOrderBy('e.date', 'DESC');
		$builder->addOrderBy('e.name', 'ASC');
		$builder->addOrderBy('e.subname', 'ASC');
	}

	protected function getSelectFields(QueryBuilder &$builder, Filter $filter) {
		$fields = parent::getSelectFields($builder, $filter);

		$fields[] = 'e.name';
		$fields[] = 'e.subname';
		$fields[] = 'e.image';
		$fields[] = 'e.vertical';
		$fields[] = 'e.date';
		$fields[] = 'e.intro';
		$fields[] = 'u.pseudonym AS authorPseudonym';

		return $fields;
	}

	protected function getWhere(QueryBuilder &$builder, Filter $filter) {
		$where = parent::getWhere($builder, $filter);
		/** @var ArticleFilter $filter */

		$expr = $builder->expr();

		$where->add($expr->eq('e.infoprodukt', 1));
		$where->add($expr->eq('e.archived', 0));
		$where->add('e.parent IS NULL');

		$date = new \DateTime();

		$where->add('e.date IS NULL OR e.date <= \'' . $date->format('Y-m-d H:i') . "\'");
		$where->add('e.endDate IS NULL OR e.endDate >= \'' . $date->format('Y-m-d H:i') . "\'");

		$this->addArrayWhere($builder, $where, 'aca.category', $filter->getContextCategories());
		$this->addArrayWhere($builder, $where, 'aaca.articleCategory', $filter->getArticleCategories());

		return $where;
	}

	protected function queryItemsIds($categories) {
		$date = new \DateTime();

		$builder = new QueryBuilder($this->getEntityManager());

		$builder->select("e.id");
		$builder->distinct();
		$builder->from($this->getEntityType(), "e");

		if (count($categories) > 0) {
			$builder->innerJoin(ArticleCategoryAssignment::class, 'aca', Join::WITH, 'e.id = aca.article');
		}

		$where = $builder->expr()->andX();
		$where->add($builder->expr()->eq('e.infoprodukt', 1));
		$where->add($builder->expr()->eq('e.archived', 0));
		$where->add('e.parent IS NULL');

		$where->add('e.date IS NULL OR e.date <= \'' . $date->format('Y-m-d H:i') . "\'");
		$where->add('e.endDate IS NULL OR e.endDate >= \'' . $date->format('Y-m-d H:i') . "\'");

		if (count($categories) > 0) {
			$where->add($builder->expr()->in('aca.category', $categories));
		}

		$builder->where($where);

		$builder->orderBy('e.date', 'DESC');
		$builder->groupBy('e.id');

		return $builder->getQuery();
	}

	public function findCategoryItems($categoriesIds, $articleCategory, $limit) {
		return $this->queryCategoryItems($categoriesIds, $articleCategory, $limit)->getScalarResult();
	}

	protected function queryCategoryItems($categoriesIds, $articleCategory, $limit) {
		$date = new \DateTime();

		$builder = new QueryBuilder($this->getEntityManager());

		$builder->select(
				"e.id, e.name, e.subname, e.image, e.mimeType, e.vertical, e.forcedWidth, e.forcedHeight");
		$builder->distinct();
		$builder->from($this->getEntityType(), "e");

		$builder->innerJoin(ArticleCategoryAssignment::class, 'aca', Join::WITH, 'e.id = aca.article');

		if ($articleCategory) {
			$builder->innerJoin(ArticleArticleCategoryAssignment::class, 'aaca', Join::WITH,
					'e.id = aaca.article');
		}

		$expr = $builder->expr();

		$where = $builder->expr()->andX();
		$where->add($builder->expr()->eq('e.infoprodukt', 1));
		$where->add($builder->expr()->eq('e.archived', 0));
		$where->add('e.parent IS NULL');

		$where->add('e.date IS NULL OR e.date <= \'' . $date->format('Y-m-d H:i') . "\'");
		$where->add('e.endDate IS NULL OR e.endDate >= \'' . $date->format('Y-m-d H:i') . "\'");

		if ($articleCategory) {
			$where->add($expr->eq('aaca.articleCategory', $articleCategory));
		}

		if (count($categoriesIds) > 0) {
			$where->add($expr->in('aca.category', $categoriesIds));
		}

		$builder->where($where);

		$builder->orderBy('e.date', 'DESC');
		$builder->groupBy('e.id');

		$builder->setMaxResults($limit);

		return $builder->getQuery();
	}

	protected function getEntityType() {
		return Article::class;
	}
}


text:
using NetDimension.NanUI.Logging;
using Xilium.CefGlue;

namespace NetDimension.NanUI.Browser.ResourceHandler;

public abstract class ResourceHandlerBase
    : CefResourceHandler
{
    private const string ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin";
    private const string ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers";
    private const string ACCESS_CONTROL_ALLOW_METHODS = "Access-Control-Allow-Methods";
    private const string ACCESS_CONTROL_MAX_AGE = "Access-Control-Max-Age";
    private const string X_FRAME_OPTIONS = "X-Frame-Options";
    private const string X_POWERED_BY = "X-Powered-By";

    protected virtual bool DisableCORS
    {
        get
        {
            return false;
        }
    }

    private GCHandle _gcHandle;
    private int _readStreamOffset;
    private int? _buffStartPostition = null;
    private int? _buffEndPostition = null;
    private bool _isPartContent = false;
    private readonly CancellationTokenSource _cancellationTokenSource;

    private ResourceResponse _resourceResponse;

    internal static ILogger Logger => WinFormium.GetLogger();

    abstract protected ResourceResponse GetResourceResponse(ResourceRequest request);

    protected ResourceSchemeOption SchemeOptions { get; }

    private readonly List<string> Infos = new();

    protected static string GetMimeType(string fileName)
    {
        var ext = Path.GetExtension(fileName)?.Trim('.');

        if (string.IsNullOrEmpty(ext))
        {
            return "application/octet-stream";
        }

        return CefRuntime.GetMimeType(ext);

    }

    public ResourceHandlerBase()
    {

        var options = WinFormium.Runtime.Container.GetInstance<ResourceSchemeOption>();

        if (options == null)
        {
            options = new ResourceSchemeOption();
        }

        SchemeOptions = options;

        _gcHandle = GCHandle.Alloc(this);

        _cancellationTokenSource = new CancellationTokenSource();

    }

    protected override bool Skip(long bytesToSkip, out long bytesSkipped, CefResourceSkipCallback callback)
    {
        bytesSkipped = bytesToSkip;
        return true;
    }

    protected override void GetResponseHeaders(CefResponse response, out long responseLength, out string redirectUrl)
    {
        var statusCode = _resourceResponse?.HttpStatus ?? System.Net.HttpStatusCode.BadRequest;

        if (_resourceResponse != null)
        {
            response.SetHeaderMap(_resourceResponse.Headers);
        }

        response.Status = (int)statusCode;

        redirectUrl = null;

        if (statusCode == System.Net.HttpStatusCode.OK)
        {

            responseLength = _resourceResponse.Length;
            response.MimeType = _resourceResponse.MimeType;

            if (_isPartContent)
            {
                response.SetHeaderByName("Accept-Ranges", "bytes", true);

                var startPos = 0;
                var endPos = _resourceResponse.Length - 1;

                if (_buffStartPostition.HasValue && _buffEndPostition.HasValue)
                {
                    startPos = _buffStartPostition.Value;
                    endPos = _buffStartPostition.Value;
                }
                else if (!_buffEndPostition.HasValue && _buffStartPostition.HasValue)
                {
                    startPos = _buffStartPostition.Value;
                }

                response.SetHeaderByName("Content-Range", $"bytes {startPos}-{endPos}/{_resourceResponse.Length}", true);
                response.SetHeaderByName("Content-Length", $"{endPos - startPos + 1}", true);

                response.Status = 206;

                ResourceHandlerBase.Logger.Verbose($"[Content-Range]: {startPos}-{endPos}/{_resourceResponse.Length}");
            }

            response.SetHeaderByName("Content-Type", response.MimeType, true);

            response.SetHeaderByName(X_POWERED_BY, $"NanUI/{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}", true);
        }
        else
        {
            responseLength = 0;
        }
    }

    protected override bool Open(CefRequest request, out bool handleRequest, CefCallback callback)
    {
        var uri = new Uri(request.Url);
        var headers = request.GetHeaderMap();

        if (!string.IsNullOrEmpty(headers.Get("range")))
        {
            var rangeString = headers.Get("range");
            var group = System.Text.RegularExpressions.Regex.Match(rangeString, @"(?<start>\d+)-(?<end>\d*)")?.Groups;
            if (group != null)
            {
                if (!string.IsNullOrEmpty(group["start"].Value) && int.TryParse(group["start"].Value, out var startPos))
                {
                    _buffStartPostition = startPos;
                }

                if (!string.IsNullOrEmpty(group["end"].Value) && int.TryParse(group["end"].Value, out var endPos))
                {
                    _buffEndPostition = endPos;
                }
            }
            _isPartContent = true;
        }

        _readStreamOffset = 0;

        if (_buffStartPostition.HasValue)
        {
            _readStreamOffset = _buffStartPostition.Value;
        }

        byte[] postData = null;
        var uploadFiles = new List<string>();

        if (request.PostData != null)
        {
            var items = request.PostData.GetElements();

            if (items != null && items.Length > 0)
            {
                var bytes = new List<byte>();
                foreach (var item in items)
                {

                    var buffer = item.GetBytes();

                    //var size = (int)item.BytesCount;

                    switch (item.ElementType)
                    {
                        case CefPostDataElementType.Bytes:
                            bytes.AddRange(buffer);
                            break;
                        case CefPostDataElementType.File:
                            uploadFiles.Add(item.GetFile());
                            break;
                    }

                }

                postData = bytes.ToArray();
                bytes = null;
            }
        }

        var method = request.Method;

        var resourceRequest = new ResourceRequest(uri, method, headers, postData, uploadFiles.ToArray(), request);

        handleRequest = false;

        Task.Run(() =>
        {
            try
            {
                Infos.Add($"[{request.Method}]");
                Infos.Add($"{resourceRequest.RequestUrl}");

                _resourceResponse = GetResourceResponse(resourceRequest);

                if (_resourceResponse == null)
                {
                        //callback.Cancel();
                        //return;

                        throw new NullReferenceException($"ResourceResponse should not be null.");
                }

                if (DisableCORS)
                {
                    _resourceResponse.Headers.Set(ACCESS_CONTROL_ALLOW_HEADERS, "*");
                    _resourceResponse.Headers.Set(ACCESS_CONTROL_ALLOW_METHODS, "*");
                    _resourceResponse.Headers.Set(X_FRAME_OPTIONS, "ALLOWALL");

                    if (!string.IsNullOrEmpty(request.GetHeaderByName("origin")))
                    {
                        _resourceResponse.Headers.Set(ACCESS_CONTROL_ALLOW_ORIGIN, request.GetHeaderByName("origin"));
                        _resourceResponse.Headers.Set(ACCESS_CONTROL_MAX_AGE, "3600");
                    }
                    else
                    {
                        _resourceResponse.Headers.Set(ACCESS_CONTROL_ALLOW_ORIGIN, "*");

                    }
                }

                Infos.Add($"{(int)_resourceResponse.HttpStatus} {_resourceResponse.HttpStatus}");

            }
            catch (Exception ex)
            {
                ResourceHandlerBase.Logger.Error(ex, "ResourceHandler");
                callback.Cancel();
            }

        }, _cancellationTokenSource.Token).ContinueWith(t => callback.Continue());

        return true;

    }

    protected override void Cancel()
    {

    }

    protected override bool Read(IntPtr dataOut, int bytesToRead, out int bytesRead, CefResourceReadCallback callback)
    {
        var total = _resourceResponse?.Length ?? 0;

        var bytesToCopy = (int)(total - _readStreamOffset);

        if (total == 0 || bytesToCopy <= 0)
        {
            bytesRead = 0;
            return false;
        }

        bytesToCopy = Math.Min(bytesToCopy, bytesToRead);

        var buff = new byte[bytesToCopy];

        _resourceResponse.ContentStream.Position = _readStreamOffset;
        _resourceResponse.ContentStream.Read(buff, 0, bytesToCopy);

        Marshal.Copy(buff, 0, dataOut, bytesToCopy);

        _readStreamOffset += bytesToCopy;

        bytesRead = bytesToCopy;

        if (_readStreamOffset == _resourceResponse.Length)
        {

            if (WinFormium.Runtime.IsDebuggingMode)
            {
                lock (ResourceHandlerBase.Logger)
                {
                    ResourceHandlerBase.Logger.Debug($"[{this.GetType().Namespace}]:");
                    ResourceHandlerBase.Logger.Verbose($" -> {string.Join(" ", Infos)}");
                }

            }
            _resourceResponse.Dispose();

            _gcHandle.Free();

        }

        return true;

    }

}


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Boost.Locale: boost::locale::util Namespace Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Boost.Locale

Main Page

Related Pages

Modules

Namespaces

Classes

Files

Examples

Namespace List

Namespace Members

Classes |
Functions

boost::locale::util Namespace Reference

This namespace provides various utility function useful for Boost.Locale backends implementations.
More...

Classes

class  	base_converter

 	This class represent a simple stateless converter from UCS-4 and to UCS-4 for each single code point.  More...

Functions

std::string 	get_system_locale (bool use_utf8_on_windows=false)

 	Return default system locale name in POSIX format.  More...

std::locale 	create_info (std::locale const &in, std::string const &name)

 	Installs information facet to locale in based on locale name name.  More...

std::auto_ptr< base_converter > 	create_utf8_converter ()

std::auto_ptr< base_converter > 	create_simple_converter (std::string const &encoding)

std::locale 	create_codecvt (std::locale const &in, std::auto_ptr< base_converter > cvt, character_facet_type type)

std::locale 	create_utf8_codecvt (std::locale const &in, character_facet_type type)

std::locale 	create_simple_codecvt (std::locale const &in, std::string const &encoding, character_facet_type type)

Detailed Description

This namespace provides various utility function useful for Boost.Locale backends implementations.

Function Documentation

          std::locale boost::locale::util::create_codecvt
          (
          std::locale const &
          in,

          std::auto_ptr< base_converter >
          cvt,

          character_facet_type
          type

          )

Install codecvt facet into locale in and return new locale that is based on in and uses new facet.

codecvt facet would convert between narrow and wide/char16_t/char32_t encodings using cvt converter. If cvt is null pointer, always failure conversion would be used that fails on every first input or output.

Note: the codecvt facet handles both UTF-16 and UTF-32 wide encodings, it knows to break and join Unicode code-points above 0xFFFF to and from surrogate pairs correctly. cvt should be unaware of wide encoding type

          std::locale boost::locale::util::create_info
          (
          std::locale const &
          in,

          std::string const &
          name

          )

Installs information facet to locale in based on locale name name.

This function installs boost::locale::info facet into the locale in and returns newly created locale.

Note: all information is based only on parsing of string name;

The name has following format: language[_COUNTRY][.encoding][@variant] Where language is ISO-639 language code like "en" or "ru", COUNTRY is ISO-3166 country identifier like "US" or "RU". the Encoding is a charracter set name like UTF-8 or ISO-8859-1. Variant is backend specific variant like euro or calendar=hebrew.

If some parameters are missing they are specified as blanks, default encoding is assumed to be US-ASCII and missing language is assumed to be "C"

          std::locale boost::locale::util::create_simple_codecvt
          (
          std::locale const &
          in,

          std::string const &
          encoding,

          character_facet_type
          type

          )

This function installs codecvt that can be used for conversion between single byte character encodings like ISO-8859-1, koi8-r, windows-1255 and Unicode code points,

Throws boost::locale::conv::invalid_charset_error if the chacater set is not supported or isn't single byte character set

          std::auto_ptr<base_converter> boost::locale::util::create_simple_converter
          (
          std::string const &
          encoding	)

This function creates a base_converter that can be used for conversion between single byte character encodings like ISO-8859-1, koi8-r, windows-1255 and Unicode code points,

If encoding is not supported, empty pointer is returned. You should check if std::auto_ptr<base_converter>::get() != 0

          std::locale boost::locale::util::create_utf8_codecvt
          (
          std::locale const &
          in,

          character_facet_type
          type

          )

Install utf8 codecvt to UTF-16 or UTF-32 into locale in and return new locale that is based on in and uses new facet.

          std::auto_ptr<base_converter> boost::locale::util::create_utf8_converter
          (
          	)

This function creates a base_converter that can be used for conversion between UTF-8 and unicode code points

          std::string boost::locale::util::get_system_locale
          (
          bool
          use_utf8_on_windows = false	)

Return default system locale name in POSIX format.

This function tries to detect the locale using, LC_CTYPE, LC_ALL and LANG environment variables in this order and if all of them unset, in POSIX platforms it returns "C"

On Windows additionally to check the above environment variables, this function tries to creates locale name from ISO-339 and ISO-3199 country codes defined for user default locale. If use_utf8_on_windows is true it sets the encoding to UTF-8, otherwise, if system locale supports ANSI code-page it defines the ANSI encoding like windows-1252, otherwise it fall-backs to UTF-8 encoding if ANSI code-page is not available.

© Copyright 2009-2012 Artyom Beilis,  Distributed under the Boost Software License, Version 1.0.


text:
(function ($) {

    if (!$) {
        return;
    }

    $.validator.addMethod("customUsername", function (value, element) {
        if (value === $('input[name="EmailAddress"]').val()) {
            return true;
        }

        return !$.validator.methods.email.apply(this, arguments);
    }, abp.localization.localize("RegisterFormUserNameInvalidMessage", "AbpModuleZero"));

    $(document).ready(function () {
        $('.register-form').validate({
            errorElement: 'span', //default input error message container
            errorClass: 'text-danger', // default input error message class
            focusInvalid: false, // do not focus the last invalid input
            ignore: "",
            rules: {
                UserName: {
                    required: true,
                    customUsername: true
                }
            },

            highlight: function (element) {
                $(element).closest('.form-group').addClass('has-error');
            },

            success: function (label) {
                label.closest('.form-group').removeClass('has-error');
                label.remove();
            },

            submitHandler: function (form) {
                form.submit();
            }
        });
    });

})(jQuery);


text:
namespace MCAdmin
{
    partial class frmCmdLevels
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
            this.btnCancel = new System.Windows.Forms.Button();
            this.btnSave = new System.Windows.Forms.Button();
            this.panelCommands = new System.Windows.Forms.Panel();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.SuspendLayout();
            //
            // splitContainer1
            //
            this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.splitContainer1.Location = new System.Drawing.Point(12, 340);
            this.splitContainer1.Name = "splitContainer1";
            //
            // splitContainer1.Panel1
            //
            this.splitContainer1.Panel1.Controls.Add(this.btnCancel);
            //
            // splitContainer1.Panel2
            //
            this.splitContainer1.Panel2.Controls.Add(this.btnSave);
            this.splitContainer1.Size = new System.Drawing.Size(415, 35);
            this.splitContainer1.SplitterDistance = 205;
            this.splitContainer1.TabIndex = 11;
            //
            // btnCancel
            //
            this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.btnCancel.Location = new System.Drawing.Point(3, 3);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new System.Drawing.Size(199, 27);
            this.btnCancel.TabIndex = 9;
            this.btnCancel.Text = "Cancel";
            this.btnCancel.UseVisualStyleBackColor = true;
            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
            //
            // btnSave
            //
            this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.btnSave.Location = new System.Drawing.Point(5, 3);
            this.btnSave.Name = "btnSave";
            this.btnSave.Size = new System.Drawing.Size(198, 27);
            this.btnSave.TabIndex = 8;
            this.btnSave.Text = "Save";
            this.btnSave.UseVisualStyleBackColor = true;
            this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
            //
            // panelCommands
            //
            this.panelCommands.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.panelCommands.AutoScroll = true;
            this.panelCommands.Location = new System.Drawing.Point(12, 12);
            this.panelCommands.Name = "panelCommands";
            this.panelCommands.Size = new System.Drawing.Size(415, 322);
            this.panelCommands.TabIndex = 12;
            //
            // frmCmdLevels
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(439, 387);
            this.Controls.Add(this.panelCommands);
            this.Controls.Add(this.splitContainer1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
            this.Name = "frmCmdLevels";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Command level management";
            this.Load += new System.EventHandler(this.frmCmdLevels_Load);
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.Panel2.ResumeLayout(false);
            this.splitContainer1.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.SplitContainer splitContainer1;
        private System.Windows.Forms.Button btnCancel;
        private System.Windows.Forms.Button btnSave;
        private System.Windows.Forms.Panel panelCommands;
    }
}