text:
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.structuralsearch.plugin.ui;

import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
import com.intellij.codeInsight.template.TemplateContextType;
import com.intellij.codeInsight.template.impl.TemplateEditorUtil;
import com.intellij.icons.AllIcons;
import com.intellij.ide.IdeTooltip;
import com.intellij.ide.IdeTooltipManager;
import com.intellij.lang.Language;
import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.notification.NotificationDisplayType;
import com.intellij.notification.NotificationGroup;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.editor.EditorSettings;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.ToolWindowId;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiFileFactory;
import com.intellij.structuralsearch.*;
import com.intellij.structuralsearch.plugin.StructuralSearchAction;
import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
import com.intellij.ui.EditorTextField;
import com.intellij.ui.TooltipWithClickableLinks;
import com.intellij.util.LocalTimeCounter;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.function.Consumer;
import java.util.function.Supplier;

/**
 * @author Maxim.Mossienko
 */
public class UIUtil {
  @NonNls private static final String SS_GROUP = "structuralsearchgroup";

  public static final NotificationGroup SSR_NOTIFICATION_GROUP =
    new NotificationGroup(SSRBundle.message("structural.search.title"), NotificationDisplayType.STICKY_BALLOON, true, ToolWindowId.FIND);

  @NonNls public static final String TEXT = "TEXT";
  @NonNls public static final String TEXT_HIERARCHY = "TEXT HIERARCHY";
  @NonNls public static final String REFERENCE = "REFERENCE";
  @NonNls public static final String TYPE = "TYPE";
  @NonNls public static final String TYPE_REGEX = "TYPE REGEX";
  @NonNls public static final String EXPECTED_TYPE = "EXPECTED TYPE";
  @NonNls public static final String MINIMUM_ZERO = "MINIMUM ZERO";
  @NonNls public static final String MAXIMUM_UNLIMITED = "MAXIMUM UNLIMITED";

  private UIUtil() {
  }

  @NotNull
  public static Editor createEditor(@NotNull Document doc, Project project, boolean editable, @Nullable TemplateContextType contextType) {
    final Editor editor =
        editable ? EditorFactory.getInstance().createEditor(doc, project) : EditorFactory.getInstance().createViewer(doc, project);

    final EditorSettings editorSettings = editor.getSettings();
    editorSettings.setVirtualSpace(false);
    editorSettings.setLineMarkerAreaShown(false);
    editorSettings.setIndentGuidesShown(false);
    editorSettings.setLineNumbersShown(false);
    editorSettings.setFoldingOutlineShown(false);
    editorSettings.setCaretRowShown(false);

    if (!editable) {
      final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
      Color c = globalScheme.getColor(EditorColors.READONLY_BACKGROUND_COLOR);

      if (c == null) {
        c = globalScheme.getDefaultBackground();
      }

      ((EditorEx)editor).setBackgroundColor(c);
    }
    else {
      ((EditorEx)editor).setEmbeddedIntoDialogWrapper(true);
    }

    TemplateEditorUtil.setHighlighter(editor, contextType);
    return editor;
  }

  public static void setContent(@NotNull final Editor editor, String text) {
    final String value = text != null ? text : "";
    final Document document = editor.getDocument();
    WriteCommandAction.runWriteCommandAction(editor.getProject(), SSRBundle.message("modify.editor.content.command.name"), SS_GROUP,
                                             () -> document.replaceString(0, document.getTextLength(), value));
  }

  public static void setContent(@NotNull EditorTextField editor, String text) {
    final String value = text != null ? text : "";
    final Document document = editor.getDocument();
    WriteCommandAction.runWriteCommandAction(editor.getProject(), SSRBundle.message("modify.editor.content.command.name"), SS_GROUP,
                                             () -> document.replaceString(0, document.getTextLength(), value));
  }

  public static void invokeAction(Configuration config, SearchContext context) {
    StructuralSearchAction.triggerAction(config, context, !(config instanceof SearchConfiguration));
  }

  public static MatchVariableConstraint getOrAddVariableConstraint(String varName, Configuration configuration) {
    final MatchOptions options = configuration.getMatchOptions();
    final MatchVariableConstraint varInfo = options.getVariableConstraint(varName);

    if (varInfo != null) {
      return varInfo;
    }
    return configuration.getMatchOptions().addNewVariableConstraint(varName);
  }

  public static ReplacementVariableDefinition getOrAddReplacementVariable(String varName, Configuration configuration) {
    final ReplaceOptions replaceOptions = configuration.getReplaceOptions();
    ReplacementVariableDefinition definition = replaceOptions.getVariableDefinition(varName);

    if (definition != null) {
      return definition;
    }
    return replaceOptions.addNewVariableDefinition(varName);
  }

  public static boolean isTarget(String varName, MatchOptions matchOptions) {
    if (Configuration.CONTEXT_VAR_NAME.equals(varName)) {
      // Complete Match is default target
      for (String name : matchOptions.getVariableConstraintNames()) {
        if (!name.equals(Configuration.CONTEXT_VAR_NAME)) {
          if (matchOptions.getVariableConstraint(name).isPartOfSearchResults()) {
            return false;
          }
        }
      }
      return true;
    }
    final MatchVariableConstraint constraint = matchOptions.getVariableConstraint(varName);
    if (constraint == null) {
      return false;
    }
    return constraint.isPartOfSearchResults();
  }

  @NotNull
  public static JComponent createCompleteMatchInfo(final Supplier<? extends Configuration> configurationProducer) {
    return installCompleteMatchInfo(new JLabel(AllIcons.Actions.ListFiles), configurationProducer, null);
  }

  @NotNull
  public static JComponent installCompleteMatchInfo(JLabel completeMatchInfo,
                                                    Supplier<? extends Configuration> configurationProducer,
                                                    Consumer<? super String> linkConsumer) {
    completeMatchInfo.putClientProperty(IdeTooltip.TOOLTIP_DISMISS_DELAY_KEY, 20000);
    completeMatchInfo.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseEntered(MouseEvent ignore) {
        if (Registry.is("ssr.use.editor.inlays.instead.of.tool.tips")) {
          return;
        }
        final Configuration configuration = configurationProducer.get();
        if (configuration == null) {
          return;
        }
        final MatchOptions matchOptions = configuration.getMatchOptions();
        if (matchOptions.getSearchPattern().isEmpty()) {
          return;
        }
        final MatchVariableConstraint constraint = getOrAddVariableConstraint(Configuration.CONTEXT_VAR_NAME, configuration);
        if (isTarget(Configuration.CONTEXT_VAR_NAME, matchOptions)) {
          constraint.setPartOfSearchResults(true);
        }
        String filterText = StringUtil.escapeXmlEntities(
          SSRBundle.message("complete.match.variable.tooltip.message",
                            SubstitutionShortInfoHandler.getShortParamString(constraint, linkConsumer == null)));
        if (linkConsumer != null && !Configuration.CONTEXT_VAR_NAME.equals(configuration.getCurrentVariableName())) {
          filterText = SubstitutionShortInfoHandler.appendLinkText(filterText, Configuration.CONTEXT_VAR_NAME);
        }
        final HyperlinkListener listener = e -> {
          if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED && linkConsumer != null) {
            linkConsumer.accept(Configuration.CONTEXT_VAR_NAME);
            IdeTooltipManager.getInstance().hideCurrentNow(true);
          }
        };
        final IdeTooltip tooltip = new TooltipWithClickableLinks(completeMatchInfo, filterText, listener);
        final Rectangle bounds = completeMatchInfo.getBounds();
        tooltip.setHint(true)
          .setExplicitClose(true)
          .setPreferredPosition(Balloon.Position.below)
          .setPoint(new Point(bounds.x + (bounds.width / 2) , bounds.y + bounds.height));
        IdeTooltipManager.getInstance().show(tooltip, true);
        if (linkConsumer == null) {
          configuration.setCurrentVariableName(Configuration.CONTEXT_VAR_NAME);
        }
      }
    });
    return completeMatchInfo;
  }

  public static EditorTextField createTextComponent(String text, Project project) {
    return createEditorComponent(text, "1.txt", project);
  }

  public static EditorTextField createRegexComponent(String text, Project project) {
    return createEditorComponent(text, "1.regexp", project);
  }

  public static EditorTextField createScriptComponent(String text, Project project) {
    return createEditorComponent(text, "1.groovy", project);
  }

  @NotNull
  public static EditorTextField createEditorComponent(String text, String fileName, Project project) {
    return new EditorTextField(text, project, getFileType(fileName));
  }

  private static FileType getFileType(final String fileName) {
    FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(fileName);
    if (fileType == FileTypes.UNKNOWN) fileType = FileTypes.PLAIN_TEXT;
    return fileType;
  }

  public static LanguageFileType detectFileType(@NotNull SearchContext searchContext) {
    final PsiFile file = searchContext.getFile();
    PsiElement context = null;

    final Editor editor = searchContext.getEditor();
    if (editor != null && file != null) {
      final int offset = editor.getCaretModel().getOffset();
      context = InjectedLanguageManager.getInstance(searchContext.getProject()).findInjectedElementAt(file, offset);
      if (context == null) {
        context = file.findElementAt(offset);
      }
      if (context != null) {
        context = context.getParent();
      }
      if (context == null) {
        context = file;
      }
    }
    if (context != null) {
      final Language language = context.getLanguage();
      final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByLanguage(language);
      if (profile != null) {
        final LanguageFileType fileType = profile.detectFileType(context);
        return fileType != null ? fileType : language.getAssociatedFileType();
      }
    }
    return StructuralSearchUtil.getDefaultFileType();
  }

  @NotNull
  public static Document createDocument(@NotNull Project project, @NotNull LanguageFileType fileType, Language dialect,
                                        PatternContext patternContext, @NotNull String text, @NotNull StructuralSearchProfile profile) {
    final String contextId = (patternContext == null) ? null : patternContext.getId();
    PsiFile codeFragment = profile.createCodeFragment(project, text, contextId);
    if (codeFragment == null) {
      codeFragment = createFileFragment(project, fileType, dialect, text);
    }

    if (codeFragment != null) {
      final Document doc = PsiDocumentManager.getInstance(project).getDocument(codeFragment);
      assert doc != null : "code fragment element should be physical";
      return doc;
    }

    return EditorFactory.getInstance().createDocument(text);
  }

  @NotNull
  public static Editor createEditor(@NotNull Project project, @NotNull LanguageFileType fileType, Language dialect, @NotNull String text,
                                    boolean editable, @NotNull StructuralSearchProfile profile) {
    PsiFile codeFragment = profile.createCodeFragment(project, text, null);
    if (codeFragment == null) {
      codeFragment = createFileFragment(project, fileType, dialect, text);
    }

    final Document doc;
    if (codeFragment != null) {
      doc = PsiDocumentManager.getInstance(project).getDocument(codeFragment);
      assert doc != null : "code fragment element should be physical";
      DaemonCodeAnalyzer.getInstance(project).setHighlightingEnabled(codeFragment, false);
    }
    else {
      doc = EditorFactory.getInstance().createDocument("");
    }
    return createEditor(doc, project, editable, getTemplateContextType(profile));
  }

  private static PsiFile createFileFragment(@NotNull Project project, @NotNull LanguageFileType fileType, Language dialect, @NotNull String text) {
    final String name = "__dummy." + fileType.getDefaultExtension();
    final PsiFileFactory factory = PsiFileFactory.getInstance(project);

    return dialect == null
           ? factory.createFileFromText(name, fileType, text, LocalTimeCounter.currentTime(), true, true)
           : factory.createFileFromText(name, dialect, text, true, true);
  }

  public static TemplateContextType getTemplateContextType(StructuralSearchProfile profile) {
    final Class<? extends TemplateContextType> clazz = profile.getTemplateContextTypeClass();
    return ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), clazz);
  }
}


text:
xf86-input-cmt
==============

X11 ChromiumOS touchpad driver ported to Linux

This driver depends on libgestures: https://github.com/hugegreenbug/libgestures and libevdevc: https://github.com/hugegreenbug/libevdevc

Compiling
==============
./configure --prefix=/usr
make
make install
Configuring
=============
You will need to copy over the config files for the driver to the appropriate locations.  The config files are in the xorg-conf directory in this repo.  For a trackpad, copy over the 20-mouse.conf, 40-touchpad-cmt.conf, and a 50-touchpad-cmt file that matches your device to the xorg.conf.d directory for your system (/usr/share/X11/xorg.conf.d on Ubuntu Saucy).

If you use the Ubuntu package, the config files are installed in /usr/share/xf86-input-cmt.

You will also need to move your old config file out of the way or remove the previous driver.  If you were using the synaptics driver, move the synaptics.conf (/usr/share/X11/xorg.conf.d/50-synaptics.conf on Ubuntu) to something other than .conf or remove the synaptics driver.

Options can be modified with xinput.  You can list all the properties available to change:

xinput --list-props 12

Where 12 is the id of your trackpad. It may or may not be 12.  You can list all of your devices to find which one is your trackpad:

xinput

Place the options you wish to change in the touchpad config file that you copied over to /usr/share/X11/xorg.conf.d.

Packages
============
There is an ubuntu ppa with the latest releases here: https://launchpad.net/~hugegreenbug/+archive/cmt .

redpajama_set_name: RedPajamaGithub


text:
<?php declare(strict_types=1);

namespace DavidBadura\OrangeDb\Test\Fixture;

use DavidBadura\OrangeDb\Annotation as DB;

/**
 * @DB\Document("value_object")
 */
class ValueObjectOwner
{
    /**
     * @var ValueObject
     *
     * @DB\EmbedOne("DavidBadura\OrangeDb\Test\Fixture\ValueObject", mapping="name")
     */
    public $type;
}


text:
// Copyright (c) 2012 Ecma International.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es5id: 15.4.4.20-1-6
description: Array.prototype.filter applied to Number object
---*/

        function callbackfn(val, idx, obj) {
            return obj instanceof Number;
        }

        var obj = new Number(-128);
        obj.length = 2;
        obj[0] = 11;
        obj[1] = 12;

        var newArr = Array.prototype.filter.call(obj, callbackfn);

assert.sameValue(newArr[0], 11, 'newArr[0]');
assert.sameValue(newArr[1], 12, 'newArr[1]');


text:
package com.android.fuel;

import android.content.Intent;
import android.graphics.Color;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import control.Control;
import dev.android.combustivel.R;

public class SecondActivity extends ActionBarActivity {

    private TextView text_theBest;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.second_activity);

        setTitle("Fuel");

        text_theBest = (TextView) findViewById(R.id.textView_best);

        Control control = MainActivity.getControl();

        Control.FUEL fuel = control.getBest();

        if(fuel == Control.FUEL.GAS) {
            text_theBest.setText("Gas");
            text_theBest.setTextColor(Color.parseColor("#ffbc6000"));
        } else {
            text_theBest.setText("Alcool");
            text_theBest.setTextColor(Color.parseColor("#ff208e00"));
        }

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.

        //Inative
    	//getMenuInflater().inflate(R.menu.my, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //Inative
        /*if (id == R.id.action_settings) {
            Intent intent = new Intent(this, SettingsActivity.class);
            this.startActivity(intent);
            return true;
        } else if (id == R.id.action_feedback) {
            // Open ovelapping message
            return true;
        }*/
        return super.onOptionsItemSelected(item);
    }
}


text:
(function() {
  'use strict'

  angular.module('app')
    .component('identify', {
      require: {
        layout: '^app'
      },
      templateUrl: '/js/identify/identify.template.html',
      controller: controller
    })
    function controller() {
    }

}());


text:
@echo off

@call gem install bundler
@call bundle install


text:
package org.java_websocket.server;
import java.io.IOException;
import java.net.Socket;
import java.nio.channels.ByteChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;

import org.java_websocket.SSLSocketChannel2;
import org.java_websocket.WebSocketAdapter;
import org.java_websocket.WebSocketImpl;
import org.java_websocket.drafts.Draft;

public class DefaultSSLWebSocketServerFactory implements WebSocketServer.WebSocketServerFactory {
	protected SSLContext sslcontext;
	protected ExecutorService exec;

	public DefaultSSLWebSocketServerFactory( SSLContext sslContext ) {
		this( sslContext, Executors.newSingleThreadScheduledExecutor() );
	}

	public DefaultSSLWebSocketServerFactory( SSLContext sslContext , ExecutorService exec ) {
		if( sslContext == null || exec == null )
			throw new IllegalArgumentException();
		this.sslcontext = sslContext;
		this.exec = exec;
	}

	@Override
	public ByteChannel wrapChannel( SocketChannel channel, SelectionKey key ) throws IOException {
		SSLEngine e = sslcontext.createSSLEngine();
		e.setUseClientMode( false );
		return new SSLSocketChannel2( channel, e, exec, key );
	}

	@Override
	public WebSocketImpl createWebSocket( WebSocketAdapter a, Draft d, Socket c ) {
		return new WebSocketImpl( a, d, c );
	}

	@Override
	public WebSocketImpl createWebSocket( WebSocketAdapter a, List<Draft> d, Socket s ) {
		return new WebSocketImpl( a, d, s );
	}
}


text:
require 'test_helper'

class CompanyHelperTest < ActionView::TestCase
end


text:
using System;
using NetFusion.Common.Extensions.Reflection;

namespace NetFusion.Rest.Resources
{
    public static class ResourceExtensions
    {
        /// <summary>
        /// Returns the resource name associated with a model type.  The resource name
        /// of the model is exposed from the RestApi and becomes part of the contract.
        /// </summary>
        /// <param name="modelType">The model type.</param>
        /// <returns>The resource name specified by ResourceAttribute.
        /// If the attribute is not present, the class name of the model is returned.</returns>
        public static string GetResourceName(this Type modelType)
        {
            if (modelType == null) throw new ArgumentNullException(nameof(modelType),
                "Model Type cannot be null.");

            return modelType.GetAttribute<ResourceAttribute>()?.ResourceName ?? modelType.Name;
        }
    }
}


text:
@extends('emails/layout_plain')

@yield('title', "Récapitulatif Organisateur")

@section('content')
    Bonjour {{ $organizerName }},

    Merci d'avoir organisé votre évènement en utilisant {{ config('app.name') }}.

    Afin de surveiller si tous les participants ont bien reçu leur email ou modifier une adresse en cas d'erreur, rendez vous sur votre interface personnalisée : {{ $panelLink }}

    Cette interface ne sera plus disponible à compter du {{ $expirationDate }}, à cette date vous recevrez un email contenant un fichier récapitulatif des participants ainsi que des exclusions que vous avez définies pour cet évènement. Ce fichier pourra être réutilisé sur SecretSanta.fr pour gagner du temps lors de l'organisation de votre prochain évènement.

    Amusez-vous bien !
@endsection


text:
#ifndef _IAS_PowerOfTwoMemoryManager_H_
#define _IAS_PowerOfTwoMemoryManager_H_

#include "../ma/Allocator.h"
#include "MemoryManager.h"
#include "commonlib/threads/Mutex.h"

namespace IAS {

/*************************************************************************/
/** The PowerOfTwoMemoryManager class.
 *
 */
class PowerOfTwoMemoryManager : public Allocator {
public:

	virtual ~PowerOfTwoMemoryManager()throw();

	virtual void* allocate(size_t n);
	virtual void  free(const void* p);
	virtual bool  check(const void* p);

	static void Initialize(void *pStart, size_t iSize, int iLgBaseSize=6);

	virtual void printToStream(std::ostream& os);

	void dump(std::ostream& os);
protected:

	PowerOfTwoMemoryManager(void *pStart, size_t iSize);
	PowerOfTwoMemoryManager(void *pStart);

	friend class Factory<PowerOfTwoMemoryManager>;

	typedef int32_t ListIndex;

	typedef unsigned char Byte;

	class List{
	public:
		inline List():prev(0),next(0){};

		inline bool empty()const {
			return prev==0;
		}

		inline void link(List* pList){

			ListIndex diff=this-pList;

			next=-diff;
			prev=-diff+pList->prev;

			(this+prev)->next=-prev;
			pList->prev=-next;
		}

		inline void unlink(){
			(this+next)->prev=prev-next;;
			(this+prev)->next=next-prev;
			prev=0;
			next=0;
		}

		inline List* head(){
			return this+next;
		}

		void _print(std::ostream& os, List* pBase){
			List *c=this;
			do{
				os<<" "<<(c-pBase)<<":["<<c->prev<<","<<c->next<<"]";
				c=c+c->next;
			}while(c!=this);
		}

	protected:
		ListIndex prev;
		ListIndex next;

	};

	class Segment {

	public:

		Segment();

		static const unsigned short C_LgBitMapSize=10;

		unsigned int allocateBlock();
		void freeBlock(unsigned int    iBlock);
		bool isUsed(unsigned int    iBlock);

		void setBucket(Byte iBucket);
		Byte getBucket()const {return iBucket;};

		inline unsigned int getSize()const{
			return 1L<<(C_LgBitMapSize-iBucket);
		};

		inline unsigned int getAllocated()const {  return iNumAllocated; };

		inline bool isFull()const {  return iNumAllocated == getSize(); };
		inline bool isEmpty()const { return !iNumAllocated; };

	protected:

		short          iLgBlockSize;
		Byte		   iBucket;

		unsigned int   iNumAllocated;
		Byte tBitMap[1L<<C_LgBitMapSize/sizeof(Byte)];
	};

	struct Info{

		static const int   C_TagSize=4;
		static const char  C_Tag[C_TagSize+1];

		Info();

		char sTag[4];

		size_t      iSpaceSize;
		size_t      iAllocated;
		size_t      iWaterMark;

		List		*pFreeList;
		List	    *pAllocatedBySizeList;
		List	    *pSegmentList;
		Segment     *pSegments;

		Byte		*pData;

		int			iLgBaseSize;
		int			iSegments;
		int			iSegmentSize;
		int			iBuckets;

		Mutex mutex;

		TimeSamplesResults  tsrMutexWaits;
		TimeSamplesResults  tsrAllocations;

		void* allocate(size_t n);
		void  free(const void* p);
		bool  check(const void* p);

		void *encodeAddress(unsigned int iSegment, unsigned int iBlock);
		void  decodeAddress(const void *pAddress, unsigned int& iSegment, unsigned int& iBlock);

		unsigned int getSegment(List* pList);
	};

	Info*      pInfo;
};

/*************************************************************************/
}

#endif /* _IAS_PowerOfTwoMemoryManager_H_ */


text:
#include <pcl/pcl_config.h>
#include <pcl/io/pcd_grabber.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/tar.h>

#ifdef _WIN32
# include <io.h>
# include <windows.h>
# define pcl_open                    _open
# define pcl_close(fd)               _close(fd)
# define pcl_lseek(fd,offset,origin) _lseek(fd,offset,origin)
#else
# include <sys/mman.h>
# define pcl_open                    open
# define pcl_close(fd)               close(fd)
# define pcl_lseek(fd,offset,origin) lseek(fd,offset,origin)
#endif

///////////////////////////////////////////////////////////////////////////////////////////
//////////////////////// GrabberImplementation //////////////////////
struct pcl::PCDGrabberBase::PCDGrabberImpl
{
  PCDGrabberImpl (pcl::PCDGrabberBase& grabber, const std::string& pcd_path, float frames_per_second, bool repeat);
  PCDGrabberImpl (pcl::PCDGrabberBase& grabber, const std::vector<std::string>& pcd_files, float frames_per_second, bool repeat);
  void trigger ();
  void readAhead ();

  // TAR reading I/O
  int openTARFile (const std::string &file_name);
  void closeTARFile ();
  bool readTARHeader ();

  //! Initialize (find the locations of all clouds, if we haven't yet)
  void
  scrapeForClouds (bool force=false);

  //! Get cloud at a particular location
  bool
  getCloudAt (size_t idx,
              pcl::PCLPointCloud2 &blob,
              Eigen::Vector4f &origin,
              Eigen::Quaternionf &orientation);

  //! Returns the size
  size_t
  numFrames ();

  pcl::PCDGrabberBase& grabber_;
  float frames_per_second_;
  bool repeat_;
  bool running_;
  std::vector<std::string> pcd_files_;
  std::vector<std::string>::iterator pcd_iterator_;
  TimeTrigger time_trigger_;

  pcl::PCLPointCloud2 next_cloud_;
  Eigen::Vector4f origin_;
  Eigen::Quaternionf orientation_;
  bool valid_;

  // TAR reading I/O
  int tar_fd_;
  int tar_offset_;
  std::string tar_file_;
  pcl::io::TARHeader tar_header_;

  // True if we have already found the location of all clouds (for tar only)
  bool scraped_;
  std::vector<int> tar_offsets_;
  std::vector<size_t> cloud_idx_to_file_idx_;

  // Mutex to ensure that two quick consecutive triggers do not cause
  // simultaneous asynchronous read-aheads
  boost::mutex read_ahead_mutex_;

  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};

///////////////////////////////////////////////////////////////////////////////////////////
pcl::PCDGrabberBase::PCDGrabberImpl::PCDGrabberImpl (pcl::PCDGrabberBase& grabber, const std::string& pcd_path, float frames_per_second, bool repeat)
  : grabber_ (grabber)
  , frames_per_second_ (frames_per_second)
  , repeat_ (repeat)
  , running_ (false)
  , pcd_files_ ()
  , pcd_iterator_ ()
  , time_trigger_ (1.0 / static_cast<double> (std::max (frames_per_second, 0.001f)), boost::bind (&PCDGrabberImpl::trigger, this))
  , next_cloud_ ()
  , origin_ ()
  , orientation_ ()
  , valid_ (false)
  , tar_fd_ (-1)
  , tar_offset_ (0)
  , tar_file_ ()
  , tar_header_ ()
  , scraped_ (false)
{
  pcd_files_.push_back (pcd_path);
  pcd_iterator_ = pcd_files_.begin ();
  readAhead ();
}

///////////////////////////////////////////////////////////////////////////////////////////
pcl::PCDGrabberBase::PCDGrabberImpl::PCDGrabberImpl (pcl::PCDGrabberBase& grabber, const std::vector<std::string>& pcd_files, float frames_per_second, bool repeat)
  : grabber_ (grabber)
  , frames_per_second_ (frames_per_second)
  , repeat_ (repeat)
  , running_ (false)
  , pcd_files_ ()
  , pcd_iterator_ ()
  , time_trigger_ (1.0 / static_cast<double> (std::max (frames_per_second, 0.001f)), boost::bind (&PCDGrabberImpl::trigger, this))
  , next_cloud_ ()
  , origin_ ()
  , orientation_ ()
  , valid_ (false)
  , tar_fd_ (-1)
  , tar_offset_ (0)
  , tar_file_ ()
  , tar_header_ ()
  , scraped_ (false)
{
  pcd_files_ = pcd_files;
  pcd_iterator_ = pcd_files_.begin ();
  readAhead ();
}

///////////////////////////////////////////////////////////////////////////////////////////
void
pcl::PCDGrabberBase::PCDGrabberImpl::readAhead ()
{
  PCDReader reader;
  int pcd_version;

  // Check if we're still reading files from a TAR file
  if (tar_fd_ != -1)
  {
    if (!readTARHeader ())
      return;
    valid_ = (reader.read (tar_file_, next_cloud_, origin_, orientation_, pcd_version, tar_offset_) == 0);
    if (!valid_)
      closeTARFile ();
    else
    {
      tar_offset_ += (tar_header_.getFileSize ()) + (512 - tar_header_.getFileSize () % 512);
      int result = static_cast<int> (pcl_lseek (tar_fd_, tar_offset_, SEEK_SET));
      if (result < 0)
        closeTARFile ();
    }
  }
  // We're not still reading from a TAR file, so check if there are other PCD/TAR files in the list
  else
  {
    if (pcd_iterator_ != pcd_files_.end ())
    {
      // Try to read in the file as a PCD first
      valid_ = (reader.read (*pcd_iterator_, next_cloud_, origin_, orientation_, pcd_version) == 0);

      // Has an error occured? Check if we can interpret the file as a TAR file first before going onto the next
      if (!valid_ && openTARFile (*pcd_iterator_) >= 0 && readTARHeader ())
      {
        tar_file_ = *pcd_iterator_;
        valid_ = (reader.read (tar_file_, next_cloud_, origin_, orientation_, pcd_version, tar_offset_) == 0);
        if (!valid_)
          closeTARFile ();
        else
        {
          tar_offset_ += (tar_header_.getFileSize ()) + (512 - tar_header_.getFileSize () % 512);
          int result = static_cast<int> (pcl_lseek (tar_fd_, tar_offset_, SEEK_SET));
          if (result < 0)
            closeTARFile ();
        }
      }

      if (++pcd_iterator_ == pcd_files_.end () && repeat_)
        pcd_iterator_ = pcd_files_.begin ();
    }
    else
      valid_ = false;
  }
}

///////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::PCDGrabberBase::PCDGrabberImpl::readTARHeader ()
{
  // Read in the header
#if WIN32
  int result = static_cast<int> (_read (tar_fd_, reinterpret_cast<char*> (&tar_header_), 512));
#else
  int result = static_cast<int> (::read (tar_fd_, reinterpret_cast<char*> (&tar_header_), 512));
#endif
  if (result == -1)
  {
    closeTARFile ();
    return (false);
  }

  // We only support regular files for now.
  // Addional file types in TAR include: hard links, symbolic links, device/special files, block devices,
  // directories, and named pipes.
  if (tar_header_.file_type[0] != '0' && tar_header_.file_type[0] != '\0')
  {
    closeTARFile ();
    return (false);
  }

  // We only support USTAR version 0 files for now
  if (std::string (tar_header_.ustar).substr (0, 5) != "ustar")
  {
    closeTARFile ();
    return (false);
  }

  if (tar_header_.getFileSize () == 0)
  {
    closeTARFile ();
    return (false);
  }

  tar_offset_ += 512;

  return (true);
}

///////////////////////////////////////////////////////////////////////////////////////////
void
pcl::PCDGrabberBase::PCDGrabberImpl::closeTARFile ()
{
  pcl_close (tar_fd_);
  tar_fd_ = -1;
  tar_offset_ = 0;
  memset (&tar_header_.file_name[0], 0, 512);
}

///////////////////////////////////////////////////////////////////////////////////////////
int
pcl::PCDGrabberBase::PCDGrabberImpl::openTARFile (const std::string &file_name)
{
  tar_fd_ = pcl_open (file_name.c_str (), O_RDONLY);
  if (tar_fd_ == -1)
    return (-1);

  return (0);
}

///////////////////////////////////////////////////////////////////////////////////////////
void
pcl::PCDGrabberBase::PCDGrabberImpl::trigger ()
{
  boost::mutex::scoped_lock read_ahead_lock(read_ahead_mutex_);
  if (valid_)
    grabber_.publish (next_cloud_,origin_,orientation_);

  // use remaining time, if there is time left!
  readAhead ();
}

///////////////////////////////////////////////////////////////////////////////////////////
void
pcl::PCDGrabberBase::PCDGrabberImpl::scrapeForClouds (bool force)
{
  // Do nothing if we've already scraped (unless force is set)
  if (scraped_ && !force)
    return;
  // Store temporary information
  int tmp_fd = tar_fd_;
  int tmp_offset = tar_offset_;
  pcl::io::TARHeader tmp_header = tar_header_;
  tar_fd_ = -1;
  tar_offset_ = 0;

  // Go through and index the clouds
  PCDReader reader;
  pcl::PCLPointCloud2 blob;
  for (size_t i = 0; i < pcd_files_.size (); ++i)
  {
    std::string pcd_file = pcd_files_[i];
    // Try to read the file header (TODO this is a huge waste just to make sure it's PCD...is extension enough?)
    if (reader.readHeader (pcd_file, blob) == 0)
    {
      tar_offsets_.push_back (0);
      cloud_idx_to_file_idx_.push_back (i);
    }
    else if (openTARFile (pcd_file) >= 0)
    {
      while (readTARHeader () && (reader.readHeader (pcd_file, blob, tar_offset_) == 0))
      {
        tar_offsets_.push_back (tar_offset_);
        cloud_idx_to_file_idx_.push_back (i);
        // Update offset
        tar_offset_ += (tar_header_.getFileSize ()) + (512 - tar_header_.getFileSize () % 512);
        int result = static_cast<int> (pcl_lseek (tar_fd_, tar_offset_, SEEK_SET));
        if (result < 0)
          break;
        if (tar_fd_ == -1)
          break;
      }
      closeTARFile ();
    }
  }

  // Re-save temporary information
  tar_fd_ = tmp_fd;
  tar_offset_ = tmp_offset;
  tar_header_ = tmp_header;
  // Flag scraped
  scraped_ = true;
}

///////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::PCDGrabberBase::PCDGrabberImpl::getCloudAt (size_t idx,
                                                 pcl::PCLPointCloud2 &blob,
                                                 Eigen::Vector4f &origin,
                                                 Eigen::Quaternionf &orientation)
{
  scrapeForClouds (); // Make sure we've scraped
  if (idx >= numFrames ())
    return false;

  PCDReader reader;
  int pcd_version;
  std::string filename = pcd_files_[cloud_idx_to_file_idx_[idx]];
  return (reader.read (filename, blob, origin, orientation, pcd_version, tar_offsets_[idx]));
}

///////////////////////////////////////////////////////////////////////////////////////////
size_t
pcl::PCDGrabberBase::PCDGrabberImpl::numFrames ()
{
  scrapeForClouds (); // Make sure we've scraped
  return (cloud_idx_to_file_idx_.size ());
}

///////////////////////////////////////////////////////////////////////////////////////////
//////////////////////// GrabberBase //////////////////////
pcl::PCDGrabberBase::PCDGrabberBase (const std::string& pcd_path, float frames_per_second, bool repeat)
: impl_ (new PCDGrabberImpl (*this, pcd_path, frames_per_second, repeat))
{
}

///////////////////////////////////////////////////////////////////////////////////////////
pcl::PCDGrabberBase::PCDGrabberBase (const std::vector<std::string>& pcd_files, float frames_per_second, bool repeat)
: impl_ (new PCDGrabberImpl (*this, pcd_files, frames_per_second, repeat))
{
}

///////////////////////////////////////////////////////////////////////////////////////////
pcl::PCDGrabberBase::~PCDGrabberBase () throw ()
{
  delete impl_;
}

///////////////////////////////////////////////////////////////////////////////////////////
void
pcl::PCDGrabberBase::start ()
{
  if (impl_->frames_per_second_ > 0)
  {
    impl_->running_ = true;
    impl_->time_trigger_.start ();
  }
  else // manual trigger
  {
    boost::thread non_blocking_call (boost::bind (&PCDGrabberBase::PCDGrabberImpl::trigger, impl_));
  }
}

///////////////////////////////////////////////////////////////////////////////////////////
void
pcl::PCDGrabberBase::stop ()
{
  if (impl_->frames_per_second_ > 0)
  {
    impl_->time_trigger_.stop ();
    impl_->running_ = false;
  }
}

///////////////////////////////////////////////////////////////////////////////////////////
void
pcl::PCDGrabberBase::trigger ()
{
  if (impl_->frames_per_second_ > 0)
    return;
  boost::thread non_blocking_call (boost::bind (&PCDGrabberBase::PCDGrabberImpl::trigger, impl_));

//  impl_->trigger ();
}

///////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::PCDGrabberBase::isRunning () const
{
  return (impl_->running_ && (impl_->pcd_iterator_ != impl_->pcd_files_.end()));
}

///////////////////////////////////////////////////////////////////////////////////////////
std::string
pcl::PCDGrabberBase::getName () const
{
  return ("PCDGrabber");
}

///////////////////////////////////////////////////////////////////////////////////////////
void
pcl::PCDGrabberBase::rewind ()
{
  impl_->pcd_iterator_ = impl_->pcd_files_.begin ();
}

///////////////////////////////////////////////////////////////////////////////////////////
float
pcl::PCDGrabberBase::getFramesPerSecond () const
{
  return (impl_->frames_per_second_);
}

///////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::PCDGrabberBase::isRepeatOn () const
{
  return (impl_->repeat_);
}

///////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::PCDGrabberBase::getCloudAt (size_t idx,
                                 pcl::PCLPointCloud2 &blob,
                                 Eigen::Vector4f &origin,
                                 Eigen::Quaternionf &orientation) const
{
  return (impl_->getCloudAt (idx, blob, origin, orientation));
}

///////////////////////////////////////////////////////////////////////////////////////////
size_t
pcl::PCDGrabberBase::numFrames () const
{
  return (impl_->numFrames ());
}


text:
<?php

namespace PHPExiftool\Driver\Tag\XMPCrs;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class PaintCorrectionMoire extends AbstractTag
{

    protected $Id = 'PaintBasedCorrectionsLocalMoire';

    protected $Name = 'PaintCorrectionMoire';

    protected $FullName = 'XMP::crs';

    protected $GroupName = 'XMP-crs';

    protected $g0 = 'XMP';

    protected $g1 = 'XMP-crs';

    protected $g2 = 'Image';

    protected $Type = 'real';

    protected $Writable = true;

    protected $Description = 'Paint Correction Moire';

}


text:
#ifndef Vca_VBSConsumerDevice__Interface
#define Vca_VBSConsumerDevice__Interface

/*********************
 *****  Library  *****
 *********************/

#include "Vca.h"

/************************
 *****  Components  *****
 ************************/

#include "Vca_VDevice_.h"

/**************************
 *****  Declarations  *****
 **************************/

/*************************
 *****  Definitions  *****
 *************************/

namespace Vca {
    template <class Implementation> class VBSConsumerDevice_
	: public VDevice_<Implementation>, private VDevice::BSWriteFace
    {
	DECLARE_CONCRETE_RTTLITE (VBSConsumerDevice_<Implementation>, VDevice_<Implementation>);

    //  Aliases
    public:
	typedef typename Implementation::Data ImplementationData;
	typedef typename BaseClass::Put Put;
	typedef typename BaseClass::WritePoll WritePoll;

    //  Construction
    public:
	VBSConsumerDevice_(ImplementationData &rDeviceData) : BaseClass (rDeviceData), VDevice::BSWriteFace (this) {
	}

    //  Destruction
    private:
	~VBSConsumerDevice_() {
	}

    //  Face Implementation
    private:
	VDevice *device_() {
	    return this;
	}
	bool getName_(VkStatus &rStatus, VString &rName) {
	    return static_cast<BaseClass*>(this)->getName (rStatus, rName);
	}
	bool start_(
	    VkStatus &rStatus, VDeviceBSWriter *pUser, VDeviceBSWriteArea const &rArea
	) {
	    VReference<Put> pUse (new Put (this));
	    return pUse->start (rStatus, pUser, rArea);
	}
        bool start_(
	    VkStatus &rStatus, VDeviceBSWriter *pUser
        ) {
	    VReference<WritePoll> pUse (new WritePoll (this));
	    return pUse->start (rStatus, pUser);
        }

    //  Face Access
    public:
        operator BSWriteFace* () { return this; }

    //  User Accounting
    private:
	void onFirstUser_(VDevice::BSWriteFace *pFace) {
	    static_cast<Implementation*>(this)->onFirstWriter ();
	}
	void onFinalUser_(VDevice::BSWriteFace *pFace) {
	    static_cast<Implementation*>(this)->onFinalWriter ();
	}

    //  User Creation
    private:
	bool supplyConnection_(VReference<VConnection>&rpUser) {
	    return static_cast<VDevice::BSWriteFace*>(this)->supply (rpUser);
	}
	bool supplyBSConsumer_(VReference<VBSConsumer>&rpUser) {
	    return static_cast<VDevice::BSWriteFace*>(this)->supply (rpUser);
	}
    };
}

#endif


text:
@implementation NSString (Size)

- (CGSize)ceiledSize:(CGSize)size
{
	size.height = ceilf(size.height);
	size.width = ceilf(size.width);

	return size;
}

- (CGSize)sizeWithAFont:(UIFont *)font
{
	NSDictionary* attrd = @{
                            NSFontAttributeName : font
                            };
    CGSize sz = [self sizeWithAttributes:attrd];
	return [self ceiledSize:sz];
}

@end


text:
require 'spec_helper'

RSpec.describe Projects::DestroyService, :aggregate_failures do
  include ProjectForksHelper

  let_it_be(:user) { create(:user) }
  let!(:project) { create(:project, :repository, namespace: user.namespace) }
  let(:path) { project.repository.disk_path }
  let(:remove_path) { removal_path(path) }
  let(:async) { false } # execute or async_execute

  before do
    stub_container_registry_config(enabled: true)
    stub_container_registry_tags(repository: :any, tags: [])
  end

  shared_examples 'deleting the project' do
    before do
      # Run sidekiq immediately to check that renamed repository will be removed
      destroy_project(project, user, {})
    end

    it 'deletes the project', :sidekiq_inline do
      expect(Project.unscoped.all).not_to include(project)

      expect(project.gitlab_shell.repository_exists?(project.repository_storage, path + '.git')).to be_falsey
      expect(project.gitlab_shell.repository_exists?(project.repository_storage, remove_path + '.git')).to be_falsey
    end
  end

  shared_examples 'deleting the project with pipeline and build' do
    context 'with pipeline and build', :sidekiq_inline do # which has optimistic locking
      let!(:pipeline) { create(:ci_pipeline, project: project) }
      let!(:build) { create(:ci_build, :artifacts, pipeline: pipeline) }

      it_behaves_like 'deleting the project'
    end
  end

  shared_examples 'handles errors thrown during async destroy' do |error_message|
    it 'does not allow the error to bubble up' do
      expect do
        destroy_project(project, user, {})
      end.not_to raise_error
    end

    it 'unmarks the project as "pending deletion"' do
      destroy_project(project, user, {})

      expect(project.reload.pending_delete).to be(false)
    end

    it 'stores an error message in `projects.delete_error`' do
      destroy_project(project, user, {})

      expect(project.reload.delete_error).to be_present
      expect(project.delete_error).to include(error_message)
    end
  end

  shared_examples 'project destroy' do
    it_behaves_like 'deleting the project'

    it 'invalidates personal_project_count cache' do
      expect(user).to receive(:invalidate_personal_projects_count)

      destroy_project(project, user, {})
    end

    context 'when project has remote mirrors' do
      let!(:project) do
        create(:project, :repository, namespace: user.namespace).tap do |project|
          project.remote_mirrors.create(url: 'http://test.com')
        end
      end

      it 'destroys them' do
        expect(RemoteMirror.count).to eq(1)

        destroy_project(project, user, {})

        expect(RemoteMirror.count).to eq(0)
      end
    end

    context 'when project has exports' do
      let!(:project_with_export) do
        create(:project, :repository, namespace: user.namespace).tap do |project|
          create(:import_export_upload,
                 project: project,
                 export_file: fixture_file_upload('spec/fixtures/project_export.tar.gz'))
        end
      end

      it 'destroys project and export' do
        expect do
          destroy_project(project_with_export, user, {})
        end.to change(ImportExportUpload, :count).by(-1)

        expect(Project.all).not_to include(project_with_export)
      end
    end

    context 'Sidekiq fake' do
      before do
        # Dont run sidekiq to check if renamed repository exists
        Sidekiq::Testing.fake! { destroy_project(project, user, {}) }
      end

      it { expect(Project.all).not_to include(project) }

      it do
        expect(project.gitlab_shell.repository_exists?(project.repository_storage, path + '.git')).to be_falsey
      end

      it do
        expect(project.gitlab_shell.repository_exists?(project.repository_storage, remove_path + '.git')).to be_truthy
      end
    end

    context 'when flushing caches fail due to Git errors' do
      before do
        allow(project.repository).to receive(:before_delete).and_raise(::Gitlab::Git::CommandError)
        allow(Gitlab::GitLogger).to receive(:warn).with(
          class: Repositories::DestroyService.name,
          container_id: project.id,
          disk_path: project.disk_path,
          message: 'Gitlab::Git::CommandError').and_call_original
      end

      it_behaves_like 'deleting the project'
    end

    context 'when flushing caches fail due to Redis' do
      before do
        new_user = create(:user)
        project.team.add_user(new_user, Gitlab::Access::DEVELOPER)
        allow_any_instance_of(described_class).to receive(:flush_caches).and_raise(::Redis::CannotConnectError)
      end

      it 'keeps project team intact upon an error' do
        perform_enqueued_jobs do
          destroy_project(project, user, {})
        rescue ::Redis::CannotConnectError
        end

        expect(project.team.members.count).to eq 2
      end
    end

    context 'with async_execute', :sidekiq_inline do
      let(:async) { true }

      context 'async delete of project with private issue visibility' do
        before do
          project.project_feature.update_attribute("issues_access_level", ProjectFeature::PRIVATE)
        end

        it_behaves_like 'deleting the project'
      end

      it_behaves_like 'deleting the project with pipeline and build'

      context 'errors' do
        context 'when `remove_legacy_registry_tags` fails' do
          before do
            expect_any_instance_of(described_class)
              .to receive(:remove_legacy_registry_tags).and_return(false)
          end

          it_behaves_like 'handles errors thrown during async destroy', "Failed to remove some tags"
        end

        context 'when `remove_repository` fails' do
          before do
            expect_any_instance_of(described_class)
              .to receive(:remove_repository).and_return(false)
          end

          it_behaves_like 'handles errors thrown during async destroy', "Failed to remove project repository"
        end

        context 'when `execute` raises expected error' do
          before do
            expect_any_instance_of(Project)
              .to receive(:destroy!).and_raise(StandardError.new("Other error message"))
          end

          it_behaves_like 'handles errors thrown during async destroy', "Other error message"
        end

        context 'when `execute` raises unexpected error' do
          before do
            expect_any_instance_of(Project)
              .to receive(:destroy!).and_raise(Exception.new('Other error message'))
          end

          it 'allows error to bubble up and rolls back project deletion' do
            expect do
              destroy_project(project, user, {})
            end.to raise_error(Exception, 'Other error message')

            expect(project.reload.pending_delete).to be(false)
            expect(project.delete_error).to include("Other error message")
          end
        end
      end
    end

    describe 'container registry' do
      context 'when there are regular container repositories' do
        let(:container_repository) { create(:container_repository) }

        before do
          stub_container_registry_tags(repository: project.full_path + '/image',
                                       tags: ['tag'])
          project.container_repositories << container_repository
        end

        context 'when image repository deletion succeeds' do
          it 'removes tags' do
            expect_any_instance_of(ContainerRepository)
              .to receive(:delete_tags!).and_return(true)

            destroy_project(project, user)
          end
        end

        context 'when image repository deletion fails' do
          it 'raises an exception' do
            expect_any_instance_of(ContainerRepository)
              .to receive(:delete_tags!).and_raise(RuntimeError)

            expect(destroy_project(project, user)).to be false
          end
        end

        context 'when registry is disabled' do
          before do
            stub_container_registry_config(enabled: false)
          end

          it 'does not attempting to remove any tags' do
            expect(Projects::ContainerRepository::DestroyService).not_to receive(:new)

            destroy_project(project, user)
          end
        end
      end

      context 'when there are tags for legacy root repository' do
        before do
          stub_container_registry_tags(repository: project.full_path,
                                       tags: ['tag'])
        end

        context 'when image repository tags deletion succeeds' do
          it 'removes tags' do
            expect_any_instance_of(ContainerRepository)
              .to receive(:delete_tags!).and_return(true)

            destroy_project(project, user)
          end
        end

        context 'when image repository tags deletion fails' do
          it 'raises an exception' do
            expect_any_instance_of(ContainerRepository)
              .to receive(:delete_tags!).and_return(false)

            expect(destroy_project(project, user)).to be false
          end
        end
      end
    end

    context 'for a forked project with LFS objects' do
      let(:forked_project) { fork_project(project, user) }

      before do
        project.lfs_objects << create(:lfs_object)
        forked_project.reload
      end

      it 'destroys the fork' do
        expect { destroy_project(forked_project, user) }
          .not_to raise_error
      end
    end

    context 'as the root of a fork network' do
      let!(:fork_1) { fork_project(project, user) }
      let!(:fork_2) { fork_project(project, user) }

      it 'updates the fork network with the project name' do
        fork_network = project.fork_network

        destroy_project(project, user)

        fork_network.reload

        expect(fork_network.deleted_root_project_name).to eq(project.full_name)
        expect(fork_network.root_project).to be_nil
      end
    end

    context 'repository +deleted path removal' do
      context 'regular phase' do
        it 'schedules +deleted removal of existing repos' do
          service = described_class.new(project, user, {})
          allow(service).to receive(:schedule_stale_repos_removal)

          expect(Repositories::ShellDestroyService).to receive(:new).and_call_original
          expect(GitlabShellWorker).to receive(:perform_in)
            .with(5.minutes, :remove_repository, project.repository_storage, removal_path(project.disk_path))

          service.execute
        end
      end

      context 'stale cleanup' do
        let(:async) { true }

        it 'schedules +deleted wiki and repo removal' do
          allow(ProjectDestroyWorker).to receive(:perform_async)

          expect(Repositories::ShellDestroyService).to receive(:new).with(project.repository).and_call_original
          expect(GitlabShellWorker).to receive(:perform_in)
            .with(10.minutes, :remove_repository, project.repository_storage, removal_path(project.disk_path))

          expect(Repositories::ShellDestroyService).to receive(:new).with(project.wiki.repository).and_call_original
          expect(GitlabShellWorker).to receive(:perform_in)
            .with(10.minutes, :remove_repository, project.repository_storage, removal_path(project.wiki.disk_path))

          destroy_project(project, user, {})
        end
      end
    end

    context 'snippets' do
      let!(:snippet1) { create(:project_snippet, project: project, author: user) }
      let!(:snippet2) { create(:project_snippet, project: project, author: user) }

      it 'does not include snippets when deleting in batches' do
        expect(project).to receive(:destroy_dependent_associations_in_batches).with({ exclude: [:container_repositories, :snippets] })

        destroy_project(project, user)
      end

      it 'calls the bulk snippet destroy service' do
        expect(project.snippets.count).to eq 2

        expect(Snippets::BulkDestroyService).to receive(:new)
          .with(user, project.snippets).and_call_original

        expect do
          destroy_project(project, user)
        end.to change(Snippet, :count).by(-2)
      end

      context 'when an error is raised deleting snippets' do
        it 'does not delete project' do
          allow_next_instance_of(Snippets::BulkDestroyService) do |instance|
            allow(instance).to receive(:execute).and_return(ServiceResponse.error(message: 'foo'))
          end

          expect(destroy_project(project, user)).to be_falsey
          expect(project.gitlab_shell.repository_exists?(project.repository_storage, path + '.git')).to be_truthy
        end
      end
    end

    context 'error while destroying', :sidekiq_inline do
      let!(:pipeline) { create(:ci_pipeline, project: project) }
      let!(:builds) { create_list(:ci_build, 2, :artifacts, pipeline: pipeline) }
      let!(:build_trace) { create(:ci_build_trace_chunk, build: builds[0]) }

      it 'deletes on retry' do
        # We can expect this to timeout for very large projects
        # TODO: remove allow_next_instance_of: https://gitlab.com/gitlab-org/gitlab/-/issues/220440
        allow_any_instance_of(Ci::Build).to receive(:destroy).and_raise('boom')
        destroy_project(project, user, {})

        allow_any_instance_of(Ci::Build).to receive(:destroy).and_call_original
        destroy_project(project, user, {})

        expect(Project.unscoped.all).not_to include(project)
        expect(project.gitlab_shell.repository_exists?(project.repository_storage, path + '.git')).to be_falsey
        expect(project.gitlab_shell.repository_exists?(project.repository_storage, remove_path + '.git')).to be_falsey
        expect(project.all_pipelines).to be_empty
        expect(project.builds).to be_empty
      end
    end
  end

  context 'when project_transactionless_destroy enabled' do
    it_behaves_like 'project destroy'
  end

  context 'when project_transactionless_destroy disabled', :sidekiq_inline do
    before do
      stub_feature_flags(project_transactionless_destroy: false)
    end

    it_behaves_like 'project destroy'
  end

  def destroy_project(project, user, params = {})
    described_class.new(project, user, params).public_send(async ? :async_execute : :execute)
  end

  def removal_path(path)
    "#{path}+#{project.id}#{Repositories::DestroyService::DELETED_FLAG}"
  end
end


text:
// Distrubuted under the MIT license
// ===================================================
// SharpMC uses the permissive MIT license.
//
// 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.
//
// ©Copyright Kenny van Vulpen - 2015

using SharpMC.Core.Utils;

namespace SharpMC.Core.Networking.Packages
{
	internal class Ping : Package<Ping>
	{
		public long Time = 0;
		public Ping(ClientWrapper client) : base(client)
		{
			ReadId = 0x01;
			SendId = 0x01;
		}

		public Ping(ClientWrapper client, DataBuffer buffer) : base(client, buffer)
		{
			ReadId = 0x01;
			SendId = 0x01;
		}

		public override void Read()
		{
			if (Buffer != null)
			{
				if (Client.Player != null)
				{
					Client.UpdatePing();
				}

				long d = Buffer.ReadLong();
				new Ping(Client){Time = d}.Write();
			}
		}

		public override void Write()
		{
			if (Buffer != null)
			{
				Buffer.WriteVarInt(SendId);
				Buffer.WriteLong(Time);
				Buffer.FlushData();
			}
		}
	}
}


text:
German dictionary in terminal, powered by [Wiktionary](https://de.wiktionary.org/wiki/Wiktionary:Hauptseite).

## Installation
```
$ [sudo] npm install dict-de -g
```

## Usage
```
$ dict-de fahren
```

![Demo](./screenshot.png)

## License
MIT.


text:
using System.Collections.Generic;

namespace DevelopersSite.Models
{
    public class SiteConfig
    {
        public Dictionary<string, string> Products { get; set; }

        public string WordPressApiUrl { get; set; }

        public string CdnUrl { get; set; }

        public string Version { get; set; }

        private double _cacheExpirationHours;

        public double CacheExpirationHours
        {
            get
            {
                return _cacheExpirationHours;
            }
            set
            {
                _cacheExpirationHours = value < 0 ? 0 : value;
            }
        }

        public string ApiBaseEndpoint { get; set; }

        public string ApiSecret { get; set; }
    }
}


text:
namespace media {

// Simple class for calculating a moving average of fixed size.
class MEDIA_EXPORT MovingAverage {
 public:
  // Creates a MovingAverage instance with space for |depth| samples.
  explicit MovingAverage(size_t depth);
  ~MovingAverage();

  // Adds a new sample to the average; replaces the oldest sample if |depth_|
  // has been exceeded.  Updates |total_| to the new sum of values.
  void AddSample(base::TimeDelta sample);

  // Returns the current average of all held samples.
  base::TimeDelta Average() const;

  // Resets the state of the class to its initial post-construction state.
  void Reset();

  size_t count() const { return count_; }

 private:
  // Maximum number of elements allowed in the average.
  const size_t depth_;

  // Number of elements seen thus far.
  uint64_t count_;

  std::vector<base::TimeDelta> samples_;
  base::TimeDelta total_;

  DISALLOW_COPY_AND_ASSIGN(MovingAverage);
};

}  // namespace media

#endif  // MEDIA_BASE_MOVING_AVERAGE_H_


text:
<?php

namespace Flightzilla\Model\Ticket;

/**
 * Abstract for Tickets
 *
 * @author Hans-Peter Buniat <hpbuniat@googlemail.com>
 * @copyright 2012-2013 Hans-Peter Buniat <hpbuniat@googlemail.com>
 * @license http://opensource.org/licenses/BSD-3-Clause
 * @version Release: @package_version@
 * @link https://github.com/hpbuniat/flightzilla
 */
abstract class AbstractType {

    /**
     * Whether it is on the watchlist or not.
     *
     * @var bool
     */
    protected $_bOnWatchlist = false;

    /**
     * Timestamp when the ticket starts.
     *
     * @var int
     */
    protected $_iStartDate = 0;

    /**
     * Timestamp for ticket's estimated end date.
     *
     * @var int
     */
    protected $_iEndDate = 0;

    /**
     * The ticket-id
     *
     * @var int
     */
    protected $_iId;

    /**
     * The setter function for the property $_bOnWatchlist.
     *
     * @param  boolean $bOnWatchlist
     *
     * @return $this Returns the instance of this class.
     */
    public function setOnWatchlist($bOnWatchlist) {

        $this->_bOnWatchlist = $bOnWatchlist;
        return $this;
    }

    /**
     * The getter function for the property $_bWatched.
     *
     * @return boolean
     */
    public function isOnWatchlist() {

        return $this->_bOnWatchlist;
    }
}


text:
package ble

import "golang.org/x/net/context"

// Device ...
type Device interface {
	// AddService adds a service to database.
	AddService(svc *Service) error

	// RemoveAllServices removes all services that are currently in the database.
	RemoveAllServices() error

	// SetServices set the specified service to the database.
	// It removes all currently added services, if any.
	SetServices(svcs []*Service) error

	// Stop detatch the GATT server from a peripheral device.
	Stop() error

	// AdvertiseNameAndServices advertises device name, and specified service UUIDs.
	// It tres to fit the UUIDs in the advertising packet as much as possi
	// If name doesn't fit in the advertising packet, it will be put in scan response.
	AdvertiseNameAndServices(ctx context.Context, name string, uuids ...UUID) error

	// AdvertiseMfgData avertises the given manufacturer data.
	AdvertiseMfgData(ctx context.Context, id uint16, b []byte) error

	// AdvertiseServiceData16 advertises data associated with a 16bit service uuid
	AdvertiseServiceData16(ctx context.Context, id uint16, b []byte) error

	// AdvertiseIBeaconData advertise iBeacon with given manufacturer data.
	AdvertiseIBeaconData(ctx context.Context, b []byte) error

	// AdvertiseIBeacon advertises iBeacon with specified parameters.
	AdvertiseIBeacon(ctx context.Context, u UUID, major, minor uint16, pwr int8) error

	// Scan starts scanning. Duplicated advertisements will be filtered out if allowDup is set to false.
	Scan(ctx context.Context, allowDup bool, h AdvHandler) error

	// Dial ...
	Dial(ctx context.Context, a Addr) (Client, error)
}


text:
package ar.edu.utn.frre.ia.planning.model.data.metric;

import ar.edu.utn.frre.ia.planning.model.planning.MetricState;
import ar.edu.utn.frre.ia.planning.model.scheduling.MatrixSTN;

import java.math.BigDecimal;
import java.util.Map;

public class BinaryFunction implements Function {

	public Function first, second;
	public int type;

	protected BinaryFunction() {
	}

	public BinaryFunction(String s, Function f1, Function f2) {
		type = MetricSymbolStore.getType(s);
		first = f1;
		second = f2;
	}

	public BinaryFunction(int t, Function f1, Function f2) {
		type = t;
		first = f1;
		second = f2;
	}

	public boolean effectedBy(ResourceOperator ro) {
		return (first.effectedBy(ro) || second.effectedBy(ro));
	}

	public Function replace(ResourceOperator ro) {
		return new BinaryFunction(type, first.replace(ro), second.replace(ro));
	}

	public boolean isStatic() {
		return (first.isStatic() && second.isStatic());
	}

	@SuppressWarnings("rawtypes")
	public Function staticify(Map fValues) {
		first = first.staticify(fValues);
		second = second.staticify(fValues);
		if (isStatic()) {
			return new NumberFunction(getValue(null));
		} else
			return this;
	}

	public Function makeOnlyDurationDependent(MetricState s) {
		BinaryFunction bf = new BinaryFunction(type,
				first.makeOnlyDurationDependent(s),
				second.makeOnlyDurationDependent(s));
		Function f = null;
		if (bf.first instanceof NumberFunction
				&& bf.second instanceof NumberFunction) {
			f = new NumberFunction(bf.getValue(s));
		} else
			f = bf;
		return f;
	}

	public Function ground(Map varMap) {
		return new BinaryFunction(type, first.ground(varMap),
				second.ground(varMap));
	}

	public boolean equals(Object obj) {
		if (obj instanceof BinaryFunction) {
			BinaryFunction bf = (BinaryFunction) obj;
			if (bf.type == this.type && first.equals(bf.first)
					&& second.equals(bf.second))
				return true;
			else if (((bf.type == MetricSymbolStore.PLUS && this.type == MetricSymbolStore.PLUS) || (this.type == MetricSymbolStore.MULTIPLY && bf.type == MetricSymbolStore.MULTIPLY))
					&& (first.equals(bf.second) && second.equals(bf.first)))
				return true;
			else
				return false;
		} else
			return false;
	}

	public String toString() {
		return "(" + MetricSymbolStore.getSymbol(type) + " " + first.toString()
				+ " " + second.toString() + ")";
	}

	public String toStringTyped() {
		return "(" + MetricSymbolStore.getSymbol(type) + " "
				+ first.toStringTyped() + " " + second.toStringTyped() + ")";
	}

	public BigDecimal getValue(MetricState s) {
		BigDecimal fbd = first.getValue(s);
		BigDecimal sbd = second.getValue(s);
		if (type == MetricSymbolStore.PLUS)
			return fbd.add(sbd);
		else if (type == MetricSymbolStore.MINUS)
			return fbd.subtract(sbd);
		else if (type == MetricSymbolStore.MULTIPLY)
			return fbd.multiply(sbd);
		else if (type == MetricSymbolStore.DIVIDE)
			return fbd.divide(sbd, MetricSymbolStore.SCALE,
					MetricSymbolStore.ROUND);
		else
			return null;
	}

	public BigDecimal getMaxValue(MatrixSTN stn) {
		if (type == MetricSymbolStore.PLUS)
			return first.getMaxValue(stn).add(second.getMaxValue(stn));
		else if (type == MetricSymbolStore.MINUS)
			return first.getMaxValue(stn).subtract(second.getMinValue(stn));
		else if (type == MetricSymbolStore.MULTIPLY)
			return first.getMaxValue(stn).multiply(second.getMaxValue(stn));
		else if (type == MetricSymbolStore.DIVIDE)
			return first.getMaxValue(stn).divide(second.getMinValue(stn),
					MetricSymbolStore.SCALE, MetricSymbolStore.ROUND);
		else
			return null;
	}

	public BigDecimal getMinValue(MatrixSTN stn) {
		if (type == MetricSymbolStore.PLUS)
			return first.getMinValue(stn).add(second.getMinValue(stn));
		else if (type == MetricSymbolStore.MINUS)
			return first.getMinValue(stn).subtract(second.getMaxValue(stn));
		else if (type == MetricSymbolStore.MULTIPLY)
			return first.getMinValue(stn).multiply(second.getMinValue(stn));
		else if (type == MetricSymbolStore.DIVIDE)
			return first.getMinValue(stn).divide(second.getMaxValue(stn),
					MetricSymbolStore.SCALE, MetricSymbolStore.ROUND);
		else
			return null;
	}
}


text:
package org.apache.xalan.templates;

public class ElemText
  extends ElemTemplateElement{
  // Constructors

  public ElemText(){
    super();
  }
  // Methods

  public java.lang.String getNodeName(){
    return (java.lang.String) null;
  }
  public int getXSLToken(){
    return 0;
  }
  public ElemTemplateElement appendChild(ElemTemplateElement arg1){
    return (ElemTemplateElement) null;
  }
  public boolean getDisableOutputEscaping(){
    return false;
  }
  public void setDisableOutputEscaping(boolean arg1){
  }
}


text:
CREATE ROLE test_def_superuser;
SELECT * FROM pg_authid WHERE rolname = 'test_def_superuser';
CREATE ROLE test_superuser WITH SUPERUSER;
SELECT * FROM pg_authid WHERE rolname = 'test_superuser';
ALTER ROLE test_superuser WITH NOSUPERUSER;
SELECT * FROM pg_authid WHERE rolname = 'test_superuser';
ALTER ROLE test_superuser WITH SUPERUSER;
SELECT * FROM pg_authid WHERE rolname = 'test_superuser';

-- default for inherit is true
CREATE ROLE test_def_inherit;
SELECT * FROM pg_authid WHERE rolname = 'test_def_inherit';
CREATE ROLE test_inherit WITH NOINHERIT;
SELECT * FROM pg_authid WHERE rolname = 'test_inherit';
ALTER ROLE test_inherit WITH INHERIT;
SELECT * FROM pg_authid WHERE rolname = 'test_inherit';
ALTER ROLE test_inherit WITH NOINHERIT;
SELECT * FROM pg_authid WHERE rolname = 'test_inherit';

-- default for create role is false
CREATE ROLE test_def_createrole;
SELECT * FROM pg_authid WHERE rolname = 'test_def_createrole';
CREATE ROLE test_createrole WITH CREATEROLE;
SELECT * FROM pg_authid WHERE rolname = 'test_createrole';
ALTER ROLE test_createrole WITH NOCREATEROLE;
SELECT * FROM pg_authid WHERE rolname = 'test_createrole';
ALTER ROLE test_createrole WITH CREATEROLE;
SELECT * FROM pg_authid WHERE rolname = 'test_createrole';

-- default for create database is false
CREATE ROLE test_def_createdb;
SELECT * FROM pg_authid WHERE rolname = 'test_def_createdb';
CREATE ROLE test_createdb WITH CREATEDB;
SELECT * FROM pg_authid WHERE rolname = 'test_createdb';
ALTER ROLE test_createdb WITH NOCREATEDB;
SELECT * FROM pg_authid WHERE rolname = 'test_createdb';
ALTER ROLE test_createdb WITH CREATEDB;
SELECT * FROM pg_authid WHERE rolname = 'test_createdb';

-- default for can login is false for role
CREATE ROLE test_def_role_canlogin;
SELECT * FROM pg_authid WHERE rolname = 'test_def_role_canlogin';
CREATE ROLE test_role_canlogin WITH LOGIN;
SELECT * FROM pg_authid WHERE rolname = 'test_role_canlogin';
ALTER ROLE test_role_canlogin WITH NOLOGIN;
SELECT * FROM pg_authid WHERE rolname = 'test_role_canlogin';
ALTER ROLE test_role_canlogin WITH LOGIN;
SELECT * FROM pg_authid WHERE rolname = 'test_role_canlogin';

-- default for can login is true for user
CREATE USER test_def_user_canlogin;
SELECT * FROM pg_authid WHERE rolname = 'test_def_user_canlogin';
CREATE USER test_user_canlogin WITH NOLOGIN;
SELECT * FROM pg_authid WHERE rolname = 'test_user_canlogin';
ALTER USER test_user_canlogin WITH LOGIN;
SELECT * FROM pg_authid WHERE rolname = 'test_user_canlogin';
ALTER USER test_user_canlogin WITH NOLOGIN;
SELECT * FROM pg_authid WHERE rolname = 'test_user_canlogin';

-- default for replication is false
CREATE ROLE test_def_replication;
SELECT * FROM pg_authid WHERE rolname = 'test_def_replication';
CREATE ROLE test_replication WITH REPLICATION;
SELECT * FROM pg_authid WHERE rolname = 'test_replication';
ALTER ROLE test_replication WITH NOREPLICATION;
SELECT * FROM pg_authid WHERE rolname = 'test_replication';
ALTER ROLE test_replication WITH REPLICATION;
SELECT * FROM pg_authid WHERE rolname = 'test_replication';

-- default for bypassrls is false
CREATE ROLE test_def_bypassrls;
SELECT * FROM pg_authid WHERE rolname = 'test_def_bypassrls';
CREATE ROLE test_bypassrls WITH BYPASSRLS;
SELECT * FROM pg_authid WHERE rolname = 'test_bypassrls';
ALTER ROLE test_bypassrls WITH NOBYPASSRLS;
SELECT * FROM pg_authid WHERE rolname = 'test_bypassrls';
ALTER ROLE test_bypassrls WITH BYPASSRLS;
SELECT * FROM pg_authid WHERE rolname = 'test_bypassrls';

-- clean up roles
DROP ROLE test_def_superuser;
DROP ROLE test_superuser;
DROP ROLE test_def_inherit;
DROP ROLE test_inherit;
DROP ROLE test_def_createrole;
DROP ROLE test_createrole;
DROP ROLE test_def_createdb;
DROP ROLE test_createdb;
DROP ROLE test_def_role_canlogin;
DROP ROLE test_role_canlogin;
DROP USER test_def_user_canlogin;
DROP USER test_user_canlogin;
DROP ROLE test_def_replication;
DROP ROLE test_replication;
DROP ROLE test_def_bypassrls;
DROP ROLE test_bypassrls;


text:
package net.automatalib.modelcheckers.m3c.formula.ctl;

import java.io.IOException;

import net.automatalib.modelcheckers.m3c.formula.AbstractUnaryFormulaNode;
import net.automatalib.modelcheckers.m3c.formula.FormulaNode;
import net.automatalib.modelcheckers.m3c.formula.visitor.FormulaNodeVisitor;

/**
 * Java representation of a "EF" (sub-)formula.
 *
 * @param <L>
 *         label type
 * @param <AP>
 *         atomic proposition type
 *
 * @author murtovi
 */
public class EFNode<L, AP> extends AbstractUnaryFormulaNode<L, AP> {

    public EFNode(FormulaNode<L, AP> node) {
        super(node);
    }

    @Override
    public void print(Appendable a) throws IOException {
        printUnaryFormulaNode(a, "EF");
    }

    @Override
    public <T> T accept(FormulaNodeVisitor<T, L, AP> visitor) {
        return visitor.visit(this);
    }

}