text:
package android.app;

import android.Manifest;
import android.annotation.RequiresPermission;
import android.app.trust.ITrustManager;
import android.content.Context;
import android.content.Intent;
import android.os.Binder;
import android.os.RemoteException;
import android.os.IBinder;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.view.IWindowManager;
import android.view.IOnKeyguardExitResult;
import android.view.WindowManagerGlobal;

/**
 * Class that can be used to lock and unlock the keyboard. Get an instance of this
 * class by calling {@link android.content.Context#getSystemService(java.lang.String)}
 * with argument {@link android.content.Context#KEYGUARD_SERVICE}. The
 * actual class to control the keyboard locking is
 * {@link android.app.KeyguardManager.KeyguardLock}.
 */
public class KeyguardManager {
    private IWindowManager mWM;
    private ITrustManager mTrustManager;

    /**
     * Intent used to prompt user for device credentials.
     * @hide
     */
    public static final String ACTION_CONFIRM_DEVICE_CREDENTIAL =
            "android.app.action.CONFIRM_DEVICE_CREDENTIAL";

    /**
     * A CharSequence dialog title to show to the user when used with a
     * {@link #ACTION_CONFIRM_DEVICE_CREDENTIAL}.
     * @hide
     */
    public static final String EXTRA_TITLE = "android.app.extra.TITLE";

    /**
     * A CharSequence description to show to the user when used with
     * {@link #ACTION_CONFIRM_DEVICE_CREDENTIAL}.
     * @hide
     */
    public static final String EXTRA_DESCRIPTION = "android.app.extra.DESCRIPTION";

    /**
     * Get an intent to prompt the user to confirm credentials (pin, pattern or password)
     * for the current user of the device. The caller is expected to launch this activity using
     * {@link android.app.Activity#startActivityForResult(Intent, int)} and check for
     * {@link android.app.Activity#RESULT_OK} if the user successfully completes the challenge.
     *
     * @return the intent for launching the activity or null if no password is required.
     **/
    public Intent createConfirmDeviceCredentialIntent(CharSequence title, CharSequence description) {
        if (!isKeyguardSecure()) return null;
        Intent intent = new Intent(ACTION_CONFIRM_DEVICE_CREDENTIAL);
        intent.putExtra(EXTRA_TITLE, title);
        intent.putExtra(EXTRA_DESCRIPTION, description);
        // For security reasons, only allow this to come from system settings.
        intent.setPackage("com.android.settings");
        return intent;
    }

    /**
     * @deprecated Use {@link android.view.WindowManager.LayoutParams#FLAG_DISMISS_KEYGUARD}
     * and/or {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED}
     * instead; this allows you to seamlessly hide the keyguard as your application
     * moves in and out of the foreground and does not require that any special
     * permissions be requested.
     *
     * Handle returned by {@link KeyguardManager#newKeyguardLock} that allows
     * you to disable / reenable the keyguard.
     */
    public class KeyguardLock {
        private final IBinder mToken = new Binder();
        private final String mTag;

        KeyguardLock(String tag) {
            mTag = tag;
        }

        /**
         * Disable the keyguard from showing.  If the keyguard is currently
         * showing, hide it.  The keyguard will be prevented from showing again
         * until {@link #reenableKeyguard()} is called.
         *
         * A good place to call this is from {@link android.app.Activity#onResume()}
         *
         * Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager}
         * is enabled that requires a password.
         *
         *
This method requires the caller to hold the permission
         * {@link android.Manifest.permission#DISABLE_KEYGUARD}.
         *
         * @see #reenableKeyguard()
         */
        @RequiresPermission(Manifest.permission.DISABLE_KEYGUARD)
        public void disableKeyguard() {
            try {
                mWM.disableKeyguard(mToken, mTag);
            } catch (RemoteException ex) {
            }
        }

        /**
         * Reenable the keyguard.  The keyguard will reappear if the previous
         * call to {@link #disableKeyguard()} caused it to be hidden.
         *
         * A good place to call this is from {@link android.app.Activity#onPause()}
         *
         * Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager}
         * is enabled that requires a password.
         *
         *
This method requires the caller to hold the permission
         * {@link android.Manifest.permission#DISABLE_KEYGUARD}.
         *
         * @see #disableKeyguard()
         */
        @RequiresPermission(Manifest.permission.DISABLE_KEYGUARD)
        public void reenableKeyguard() {
            try {
                mWM.reenableKeyguard(mToken);
            } catch (RemoteException ex) {
            }
        }
    }

    /**
     * Callback passed to {@link KeyguardManager#exitKeyguardSecurely} to notify
     * caller of result.
     */
    public interface OnKeyguardExitResult {

        /**
         * @param success True if the user was able to authenticate, false if
         *   not.
         */
        void onKeyguardExitResult(boolean success);
    }

    KeyguardManager() {
        mWM = WindowManagerGlobal.getWindowManagerService();
        mTrustManager = ITrustManager.Stub.asInterface(
                ServiceManager.getService(Context.TRUST_SERVICE));
    }

    /**
     * @deprecated Use {@link android.view.WindowManager.LayoutParams#FLAG_DISMISS_KEYGUARD}
     * and/or {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED}
     * instead; this allows you to seamlessly hide the keyguard as your application
     * moves in and out of the foreground and does not require that any special
     * permissions be requested.
     *
     * Enables you to lock or unlock the keyboard. Get an instance of this class by
     * calling {@link android.content.Context#getSystemService(java.lang.String) Context.getSystemService()}.
     * This class is wrapped by {@link android.app.KeyguardManager KeyguardManager}.
     * @param tag A tag that informally identifies who you are (for debugging who
     *   is disabling he keyguard).
     *
     * @return A {@link KeyguardLock} handle to use to disable and reenable the
     *   keyguard.
     */
    @Deprecated
    public KeyguardLock newKeyguardLock(String tag) {
        return new KeyguardLock(tag);
    }

    /**
     * Return whether the keyguard is currently locked.
     *
     * @return true if keyguard is locked.
     */
    public boolean isKeyguardLocked() {
        try {
            return mWM.isKeyguardLocked();
        } catch (RemoteException ex) {
            return false;
        }
    }

    /**
     * Return whether the keyguard is secured by a PIN, pattern or password or a SIM card
     * is currently locked.
     *
     *
See also {@link #isDeviceSecure()} which ignores SIM locked states.
     *
     * @return true if a PIN, pattern or password is set or a SIM card is locked.
     */
    public boolean isKeyguardSecure() {
        try {
            return mWM.isKeyguardSecure();
        } catch (RemoteException ex) {
            return false;
        }
    }

    /**
     * If keyguard screen is showing or in restricted key input mode (i.e. in
     * keyguard password emergency screen). When in such mode, certain keys,
     * such as the Home key and the right soft keys, don't work.
     *
     * @return true if in keyguard restricted input mode.
     *
     * @see android.view.WindowManagerPolicy#inKeyguardRestrictedKeyInputMode
     */
    public boolean inKeyguardRestrictedInputMode() {
        try {
            return mWM.inKeyguardRestrictedInputMode();
        } catch (RemoteException ex) {
            return false;
        }
    }

    /**
     * Returns whether the device is currently locked and requires a PIN, pattern or
     * password to unlock.
     *
     * @return true if unlocking the device currently requires a PIN, pattern or
     * password.
     */
    public boolean isDeviceLocked() {
        return isDeviceLocked(UserHandle.getCallingUserId());
    }

    /**
     * Per-user version of {@link #isDeviceLocked()}.
     *
     * @hide
     */
    public boolean isDeviceLocked(int userId) {
        try {
            return mTrustManager.isDeviceLocked(userId);
        } catch (RemoteException e) {
            return false;
        }
    }

    /**
     * Returns whether the device is secured with a PIN, pattern or
     * password.
     *
     *
See also {@link #isKeyguardSecure} which treats SIM locked states as secure.
     *
     * @return true if a PIN, pattern or password was set.
     */
    public boolean isDeviceSecure() {
        return isDeviceSecure(UserHandle.getCallingUserId());
    }

    /**
     * Per-user version of {@link #isDeviceSecure()}.
     *
     * @hide
     */
    public boolean isDeviceSecure(int userId) {
        try {
            return mTrustManager.isDeviceSecure(userId);
        } catch (RemoteException e) {
            return false;
        }
    }

    /**
     * @deprecated Use {@link android.view.WindowManager.LayoutParams#FLAG_DISMISS_KEYGUARD}
     * and/or {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED}
     * instead; this allows you to seamlessly hide the keyguard as your application
     * moves in and out of the foreground and does not require that any special
     * permissions be requested.
     *
     * Exit the keyguard securely.  The use case for this api is that, after
     * disabling the keyguard, your app, which was granted permission to
     * disable the keyguard and show a limited amount of information deemed
     * safe without the user getting past the keyguard, needs to navigate to
     * something that is not safe to view without getting past the keyguard.
     *
     * This will, if the keyguard is secure, bring up the unlock screen of
     * the keyguard.
     *
     *
This method requires the caller to hold the permission
     * {@link android.Manifest.permission#DISABLE_KEYGUARD}.
     *
     * @param callback Let's you know whether the operation was succesful and
     *   it is safe to launch anything that would normally be considered safe
     *   once the user has gotten past the keyguard.
     */
    @Deprecated
    @RequiresPermission(Manifest.permission.DISABLE_KEYGUARD)
    public void exitKeyguardSecurely(final OnKeyguardExitResult callback) {
        try {
            mWM.exitKeyguardSecurely(new IOnKeyguardExitResult.Stub() {
                public void onKeyguardExitResult(boolean success) throws RemoteException {
                    if (callback != null) {
                        callback.onKeyguardExitResult(success);
                    }
                }
            });
        } catch (RemoteException e) {

        }
    }
}


text:
export const BROWSER_ALIASES_MAP = {
  'Amazon Silk': 'amazon_silk',
  'Android Browser': 'android',
  Bada: 'bada',
  BlackBerry: 'blackberry',
  Chrome: 'chrome',
  Chromium: 'chromium',
  Epiphany: 'epiphany',
  Firefox: 'firefox',
  Focus: 'focus',
  Generic: 'generic',
  Googlebot: 'googlebot',
  'Internet Explorer': 'ie',
  'K-Meleon': 'k_meleon',
  Maxthon: 'maxthon',
  'Microsoft Edge': 'edge',
  'MZ Browser': 'mz',
  'NAVER Whale Browser': 'naver',
  Opera: 'opera',
  'Opera Coast': 'opera_coast',
  PhantomJS: 'phantomjs',
  Puffin: 'puffin',
  QupZilla: 'qupzilla',
  Safari: 'safari',
  Sailfish: 'sailfish',
  'Samsung Internet for Android': 'samsung_internet',
  SeaMonkey: 'seamonkey',
  Sleipnir: 'sleipnir',
  Swing: 'swing',
  Tizen: 'tizen',
  'UC Browser': 'uc',
  Vivaldi: 'vivaldi',
  'WebOS Browser': 'webos',
  WeChat: 'wechat',
  'Yandex Browser': 'yandex',
  Roku: 'roku',
};

export const BROWSER_MAP = {
  amazon_silk: 'Amazon Silk',
  android: 'Android Browser',
  bada: 'Bada',
  blackberry: 'BlackBerry',
  chrome: 'Chrome',
  chromium: 'Chromium',
  epiphany: 'Epiphany',
  firefox: 'Firefox',
  focus: 'Focus',
  generic: 'Generic',
  googlebot: 'Googlebot',
  ie: 'Internet Explorer',
  k_meleon: 'K-Meleon',
  maxthon: 'Maxthon',
  edge: 'Microsoft Edge',
  mz: 'MZ Browser',
  naver: 'NAVER Whale Browser',
  opera: 'Opera',
  opera_coast: 'Opera Coast',
  phantomjs: 'PhantomJS',
  puffin: 'Puffin',
  qupzilla: 'QupZilla',
  safari: 'Safari',
  sailfish: 'Sailfish',
  samsung_internet: 'Samsung Internet for Android',
  seamonkey: 'SeaMonkey',
  sleipnir: 'Sleipnir',
  swing: 'Swing',
  tizen: 'Tizen',
  uc: 'UC Browser',
  vivaldi: 'Vivaldi',
  webos: 'WebOS Browser',
  wechat: 'WeChat',
  yandex: 'Yandex Browser',
};

export const PLATFORMS_MAP = {
  tablet: 'tablet',
  mobile: 'mobile',
  desktop: 'desktop',
  tv: 'tv',
};

export const OS_MAP = {
  WindowsPhone: 'Windows Phone',
  Windows: 'Windows',
  MacOS: 'macOS',
  iOS: 'iOS',
  Android: 'Android',
  WebOS: 'WebOS',
  BlackBerry: 'BlackBerry',
  Bada: 'Bada',
  Tizen: 'Tizen',
  Linux: 'Linux',
  ChromeOS: 'Chrome OS',
  PlayStation4: 'PlayStation 4',
  Roku: 'Roku',
};

export const ENGINE_MAP = {
  EdgeHTML: 'EdgeHTML',
  Blink: 'Blink',
  Trident: 'Trident',
  Presto: 'Presto',
  Gecko: 'Gecko',
  WebKit: 'WebKit',
};

redpajama_set_name: RedPajamaGithub


text:
using System.Collections.Generic;
using System.ComponentModel.Design.Serialization;
using System.Globalization;
using System.Linq;
using System.Reflection;
using Xunit;

namespace System.ComponentModel.Tests
{
    public class CultureInfoConverterTests : TypeConverterTestBase
    {
        public override TypeConverter Converter => new CultureInfoConverter();

        public override bool StandardValuesSupported => true;

        public override IEnumerable<ConvertTest> ConvertFromTestData()
        {
            yield return ConvertTest.Valid(string.Empty, CultureInfo.InvariantCulture, CultureInfo.InvariantCulture);
            yield return ConvertTest.Valid("nl-BE", new CultureInfo("nl-BE"), CultureInfo.InvariantCulture);
            yield return ConvertTest.Valid("(Default)", CultureInfo.InvariantCulture, CultureInfo.InvariantCulture);
            CultureInfo culture = null;
            try
            {
                culture = new CultureInfo("nl--B");
            }
            catch { }

            if (culture != null)
            {
                yield return ConvertTest.Valid("nl-B", new CultureInfo("nl--B"), CultureInfo.InvariantCulture);
                yield return ConvertTest.Valid("nl-B", new CultureInfo("nl--B"), new CultureInfo("en-US"));
            }

            yield return ConvertTest.Valid("Afrikaans", new CultureInfo("af"));

            yield return ConvertTest.CantConvertFrom(CultureInfo.CurrentCulture);
            yield return ConvertTest.CantConvertFrom(1);
            yield return ConvertTest.CantConvertFrom(new object());
        }

        public override IEnumerable<ConvertTest> ConvertToTestData()
        {
            yield return ConvertTest.Valid(new CustomCultureInfo(), "nl-BE");
            yield return ConvertTest.Valid(null, "(Default)");
            yield return ConvertTest.Valid(CultureInfo.InvariantCulture, "(Default)");
            yield return ConvertTest.Valid(CultureInfo.InvariantCulture, "(Default)", CultureInfo.InvariantCulture);
            yield return ConvertTest.Valid(new CultureInfo("nl-BE"), "nl-BE");
            yield return ConvertTest.Valid(1, "1");

            yield return ConvertTest.CantConvertTo(CultureInfo.InvariantCulture, typeof(object));
            yield return ConvertTest.CantConvertTo(CultureInfo.InvariantCulture, typeof(CultureInfo));
            yield return ConvertTest.CantConvertTo(CultureInfo.InvariantCulture, typeof(int));
        }

        [Theory]
        [InlineData("Dutch (Bel")]
        [InlineData("(default)")]
        [InlineData(" ")]
        [InlineData("\r\n")]
        public void ConvertFrom_String_InvalidCulture(string cultureName)
        {
            try
            {
                // Linux may be able to create these cultures.
                new CultureInfo(cultureName);
            }
            catch (CultureNotFoundException)
            {
                // If we cannot create the cultures we should get exception from the Converter too.
                AssertExtensions.Throws<ArgumentException>("value", () => Converter.ConvertFrom(null, CultureInfo.InvariantCulture, cultureName));
            }
        }

        [Fact]
        public void ConvertTo_InstanceDescriptor_ReturnsExpected()
        {
            var culture = new CultureInfo("en-US");
            Assert.True(Converter.CanConvertTo(typeof(InstanceDescriptor)));

            InstanceDescriptor instanceDescriptor = Assert.IsType<InstanceDescriptor>(Converter.ConvertTo(culture, typeof(InstanceDescriptor)));
            Assert.Equal(new Type[] { typeof(string) }, Assert.IsAssignableFrom<ConstructorInfo>(instanceDescriptor.MemberInfo).GetParameters().Select(p => p.ParameterType));
            Assert.Equal(new object[] { culture.Name }, instanceDescriptor.Arguments);
        }

        [Theory]
        [InlineData(typeof(InstanceDescriptor))]
        [InlineData(typeof(int))]
        public void ConvertTo_InvalidValue_ThrowsNotSupportedException(Type destinationType)
        {
            Assert.Throws<NotSupportedException>(() => Converter.ConvertTo(new object(), destinationType));
        }

        [Theory]
        [InlineData(typeof(InstanceDescriptor))]
        [InlineData(typeof(int))]
        public void ConvertTo_InstanceAndNullCulture_ThrowsNotSupportedException(Type destinationType)
        {
            Assert.Throws<NotSupportedException>(() => Converter.ConvertTo(null, destinationType));
        }

        public static IEnumerable<object[]> GetCultureName_TestData()
        {
            yield return new object[] { new CultureInfo("fr-FR"), new CultureInfo("fr-FR").Name };
            yield return new object[] { new CultureInfo("es-MX"), new CultureInfo("es-MX").Name };
        }

        [Theory]
        [MemberData(nameof(GetCultureName_TestData))]
        public void GetCultureName_Invoke_ReturnsExpected(CultureInfo culture, string expected)
        {
            var converter = new SubCultureInfoConverter();
            Assert.Equal(expected, converter.GetCultureName(culture));
        }

        [Fact]
        public void GetCultureName_NullCulture_ThrowsArgumentNullException()
        {
            var converter = new SubCultureInfoConverter();
            Assert.Throws<ArgumentNullException>("culture", () => converter.GetCultureName(null));
        }

        public static IEnumerable<object[]> ConvertFrom_OverridenGetCultureName_TestData()
        {
            yield return new object[] { "Fixed", "Fixed", CultureInfo.InvariantCulture };
            yield return new object[] { "None", "en-US", new CultureInfo("en-US") };
        }

        [Theory]
        [MemberData(nameof(ConvertFrom_OverridenGetCultureName_TestData))]
        public void ConvertFrom_OverridenGetCultureName_ReturnsExpected(string fixedValue, string text, CultureInfo expected)
        {
            var converter = new FixedCultureInfoConverter
            {
                FixedValue = fixedValue
            };
            Assert.Equal(expected, converter.ConvertFromString(text));
        }

        [Fact]
        public void GetCultureName_Overriden_ConversionsReturnsExpected()
        {
            var converter = new FixedCultureInfoConverter
            {
                FixedValue = "Fixed"
            };
            Assert.Equal("(Default)", converter.ConvertTo(CultureInfo.InvariantCulture, typeof(string)));
            Assert.Equal("Fixed", converter.ConvertTo(new CultureInfo("en-US"), typeof(string)));
        }

        private class SubCultureInfoConverter : CultureInfoConverter
        {
            public new string GetCultureName(CultureInfo culture)
            {
                return base.GetCultureName(culture);
            }
        }

        private class FixedCultureInfoConverter : CultureInfoConverter
        {
            public string FixedValue { get; set; }

            protected override string GetCultureName(CultureInfo culture) => FixedValue;
        }

        [Serializable]
        private sealed class CustomCultureInfo : CultureInfo
        {
            public CustomCultureInfo() : base("nl-BE")
            {
            }

            public override string DisplayName => "display";

            public override string EnglishName => "english";
        }
    }
}


text:
<?php
namespace ad\ExtraBundle\Controller;

use Symfony\Component\HttpKernel\EventListener\RouterListener;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use ad\ExtraBundle\Form\FileType;
use ad\ExtraBundle\Entity\File;
use JMS\SecurityExtraBundle\Annotation\Secure;

class FileController extends Controller
{
	/**
	 * @Route("/file/add/", name="ad_add_file")
	 * @Route("/file/add/{catslug}", name="ad_add_file_sluged")
	 * @Template()
	 */
	public function newAction(Request $request, $catslug = null)
	{
		$em = $this->getDoctrine()->getManager();

		$file = new File();

		if ($catslug != null)
		{
			$category = $em->getRepository('adExtraBundle:Category')->findCatBySlug($catslug);

			$file->setCategoryId($category);
		}

		$form = $this->createForm(new FileType(), $file);

		$formView = $form->createView();

		$form->handleRequest($request);

		$validator = $this->get('validator');
		$errorList = $validator->validate($file);

		if (count($errorList) > 0) {
			return $this->render('adExtraBundle:File:new.html.twig', array ('form' => $formView,
																			'errors' => $errorList));
		}

	    if ($form->isValid())
		{
			$em = $this->getDoctrine()->getManager();

			$file->uploadFile();
			$file->setDate(new \DateTime('now'));
			$file->setUserId($this->getUser());

			$em->persist($file);
			$em->flush();

			return $this->redirect($this->generateUrl('ad_index', array('new')));
		}

		return $this->render('adExtraBundle:File:new.html.twig', array ('form' => $form->createView()));
	}

	/**
	 * @Route("/file/delete/{id}", name="ad_delete_file")
	 */
	public function deleteFileAction($id)
	{
		$em = $this->getDoctrine()->getManager();

		$file = $em->getRepository("adExtraBundle:File")->findOneBy(array('id' => $id));

		if ($this->get('security.context')->isGranted('ROLE_ADMIN'))
		{
			if (!$file)
			{
				throw $this->createNotFoundException('Ce fichier n\'existe pas en BDD.');
			}

			if (!file_exists('uploads/files/'.$file->getName()))
			{
				$em->remove($file);
				$em->flush();

				throw $this->createNotFoundException('Ce fichier n\'existe pas sur le disque.');
			}

			unlink('uploads/files/'.$file->getName());

			$em->remove($file);
			$em->flush();

			return $this->redirect($this->generateUrl('ad_index', array('delete')));

		}
		else
		{
			throw new AccessDeniedHttpException('Vous n\'avez pas les droits nécessaire à la suppression du fichier.');
		}
	}

	/**
	 * @Route("/file/donwload/{filename}", name="ad_download_file")
	 */
	public function downloadAction($filename)
	{
		$request = $this->get('request');
		$path = $this->get('kernel')->getRootDir(). "/../web/uploads/files/";
		$content = file_get_contents($path.$filename);

		$response = new Response();

		$response->headers->set('Content-Type', 'mime/type');
		$response->headers->set('Content-Disposition', 'attachment;filename="'.$filename);

		$response->setContent($content);

		return $response;
	}

	/**
	 * @Route("/file/category/{id}", name="ad_category_file")
	 */
	public function fileCategoryAction($id, Request $request)
	{
		$em = $this->getDoctrine()->getManager();
		$repo = $em->getRepository('adExtraBundle:Category');

		$results = $repo->hasFile($id);

		return $this->container->get('templating')->renderResponse('adExtraBundle:File:listajax.html.twig', array(
				'files' => $results,
				'user' => $this->getUser()
		));
	}
}


text:
@echo off

:: Use the %0 variable modifier to change to the same logical drive as this
:: batch file
%~d0

set MSB=%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
if not exist %MSB% goto MSBuild_not_found

:: ======= NuGet settings
:: Get the nuget tools from nuget.org. There is also one coming with the NuGet plug-on from Visual Studio.
set nuget_exe=..\.nuget\NuGet.exe
if not exist %nuget_exe% goto Nuget_not_found

:: Section on NuGet.config for nuget update (NOT YET USED - CAME ACCROSS ISSUE WITH NUGET 2.8)
:: To limit machine specific issues, we will require an explicit nuget config file.
:: Usually you will have a config file %AppData%\NuGet\NuGet.config.
:: A gotcha is that even if you have configured your package feed from visual studio, you may need to also add a key to the activePackageSource
::  <activePackageSource>
::    <add key="per202 nuget tests" value="\\path\to\work\per202\nuget" />
::    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
::  </activePackageSource>
set nuget_conf_file=%AppData%\NuGet\NuGet.config
:: You can also adapt from the sample NuGet.config.sample in the same directory as this file
:: set nuget_conf_file=%~d0%~p0\NuGet.config
:: if not exist %nuget_exe% goto Nuget_config_not_found

:: =======
:: The command to use to delete whole directories, so that we force the update of packages over the build process
:: the DOS rmdir does not work on wildcard. At least, have not found a way to make it work.
:: set rm_cmd=rmdir /S /Q
:: Instead, using for the time being the 'rm' from MinGW that comes with the RTools
:: toolchain, used to build R and R packages on Windows. Any MinGW setup should to.
set rm_cmd=rm -rf

:: The target where we will put the resulting nuget packages.
set repo_dir=%~d0%~p0
if not exist %repo_dir% mkdir %repo_dir%

:: ================== Location of the source code ========================

:: https://hg.codeplex.com/rdotnet branch jperraud
set rdotnet_dir=%~d0%~p0..\
:: The xcopy options for the nuget packages (and some other build outputs)
set COPYOPTIONS=/Y /R /D

:: ================== code compilation settings
if not "%BuildConfiguration%"=="Release" if not "%BuildConfiguration%"=="Debug" set BuildConfiguration=Release

:: Setting the variable named 'Platform' seems to interfere with the nuget pack command, so
:: we deliberately set a variable BuildPlatform for use with MSBuild.exe
set BuildPlatform="Any CPU"
:: set Mode=Rebuild
set Mode=Build

:: ================== Start build process ========================
:: EVERYTHING else below this line should use paths relative to the lines above, or environment variables

set build_options=/t:%Mode% /p:Configuration=%BuildConfiguration% /p:Platform=%BuildPlatform%
set common_ng_pack_options=-Verbosity normal -Properties Configuration=%BuildConfiguration%

:: ================== R.NET ========================
:r_dot_net
:: package R.NET
:: TODO - could not get the F# build script to work.
:: @if "%VS120COMNTOOLS%"=="" echo "WARNING - env var VS120COMNTOOLS not found - fsharp interactive may not be found!"
:: if not "%VS120COMNTOOLS%" == "" (
:: call "%VS120COMNTOOLS%VsDevCmd.bat"
:: )
:: fsi.exe %rdotnet_dir%tools\build.fsx --debug
:: error FS0193: internal error: Value cannot be null.
:: Parameter name: con

set SLN=%rdotnet_dir%RDotNet.Release.sln
%MSB% %SLN% %build_options%

set pack_options=-OutputDirectory %rdotnet_dir%build %common_ng_pack_options%
if exist %repo_dir%R.NET.1.5.*.nupkg del %repo_dir%R.NET.1.5.*.nupkg
if "%BuildConfiguration%"=="Release" set nuspec_file=RDotNet.nuspec
if "%BuildConfiguration%"=="Debug" set nuspec_file=RDotNet_debug.nuspec
%nuget_exe% pack %rdotnet_dir%%nuspec_file% %pack_options%
%nuget_exe% pack %rdotnet_dir%RDotNet.FSharp.nuspec %pack_options%
%nuget_exe% pack %rdotnet_dir%RDotNet.Graphics.nuspec %pack_options%
:: %repo_dir%RDotNet.FSharp.0.*.nupkg
xcopy %rdotnet_dir%build\*.nupkg %repo_dir% %COPYOPTIONS%
goto completed

:MSBuild_not_found
echo "ERROR: MSBuild.exe not found at the location given"
pause
exit /b 1

:Nuget_not_found
echo "ERROR: NuGet.exe not found at the location given"
pause
exit /b 1

:Nuget_config_not_found
echo "ERROR: NuGet.config not found at the location given"
pause
exit /b 1

:completed
echo "INFO: Batch build completed with no known error"


text:
[![Build Status](https://travis-ci.org/rsim/oracle-enhanced.svg?branch=master)](https://travis-ci.org/rsim/oracle-enhanced)

# When and Which tests need to be executed

When you are creating a fix and/or some new features for Oracle enhanced adapter,
It is recommended to execute Oracle enhanced adapter unit tests and ActiveRecord unit tests.

* Oracle enhanced adapter unit test
* ActiveRecord unit test

This document explains how to prepare and execute Oracle enhanced adapter unit test.
For ActiveRecord unit test, please refer [Contributing to Ruby on Rails](http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html) .

This document talks about developing Oracle enhanced adapter itself, does NOT talk about developing Rails applications using Oracle enhanced adapter.

# Building development and test environment

You can create Oracle enhanced adapter development and test environment by following one of them.  If you are first to create this environment
[rails-dev-box runs_oracle branch](https://github.com/yahonda/rails-dev-box/tree/runs_oracle) is recommended.

## [rails-dev-box runs_oracle branch](https://github.com/yahonda/rails-dev-box/tree/runs_oracle)
* Please follow the [README](https://github.com/yahonda/rails-dev-box/tree/runs_oracle#a-virtual-machine-for-ruby-on-rails-core-development-with-oracle-database) .

## [rails-dev-box runs_oracle_on_docker branch](https://github.com/yahonda/rails-dev-box/tree/runs_oracle_on_docker)
* Please follow the [README](https://github.com/yahonda/rails-dev-box/blob/runs_oracle_on_docker/README.md#a-virtual-machine-for-ruby-on-rails-core-development) .

## Create by yourself
You can create your development and test environment by yourself.

### Install Ruby
Install Ruby 2.2.2 or higher version of Ruby and JRuby 9.0.5 or higher. To switch multiple version of ruby, you can use use [ruby-build](https://github.com/rbenv/ruby-build) or [Ruby Version Manager(RVM)](https://rvm.io/).

### Creating the test database
To test Oracle enhanced adapter Oracle database is necesssary. You can build by your own or use the Docker to run pre-build Oracle Database Express Edition 11g Release 2.

#### Create database by yourself
Oracle database 11.2 or later with SYS and SYSTEM user access. AL32UTF8 database character set is recommended.

#### Docker
If no Oracle database with SYS and SYSTEM user access is available, try the docker approach.

* Install [Docker](https://docker.github.io/engine/installation/)

* Pull [docker-oracle-xe-11g](https://hub.docker.com/r/wnameless/oracle-xe-11g/) image from docker hub
  ```sh
  $ docker pull wnameless/oracle-xe-11g
  ```

* Start a Oracle database docker container with mapped ports. Use port `49161` to access the database.
  ```sh
  $ docker run -d -p 49160:22 -p 49161:1521 wnameless/oracle-xe-11g
  ```

* Check connection to the database with `sqlplus`. The user is `system`, the password is `oracle`.
  ```sh
  $ sqlplus64 system/oracle@localhost:49161
  ```

### Creating database schemas at the test database

* Create Oracle database schema for test purposes. Review `spec/spec_helper.rb` to see default schema/user names and database names (use environment variables to override defaults)

```sql
SQL> CREATE USER oracle_enhanced IDENTIFIED BY oracle_enhanced;
SQL> GRANT unlimited tablespace, create session, create table, create sequence, create procedure, create trigger, create view, create materialized view, create database link, create synonym, create type, ctxapp TO oracle_enhanced;

SQL> CREATE USER oracle_enhanced_schema IDENTIFIED BY oracle_enhanced_schema;
SQL> GRANT unlimited tablespace, create session, create table, create sequence, create procedure, create trigger, create view, create materialized view, create database link, create synonym, create type, ctxapp TO oracle_enhanced_schema;
```

### Configure database login credentials

* Configure database credentials in one of two ways:
    * copy `spec/spec_config.yaml.template` to `spec/spec_config.yaml` and modify as needed
    * set required environment variables (see DATABASE_NAME in spec_helper.rb)

* The oracle enhanced configuration file `spec/spec_config.yaml` should look like:

  ```yaml
  # copy this file to spec/config.yaml and set appropriate values
  # you can also use environment variables, see spec_helper.rb
  database:
    name:         'xe'
    host:         'localhost'
    port:         49161
    user:         'oracle_enhanced'
    password:     'oracle_enhanced'
    sys_password: 'oracle'
    non_default_tablespace: 'SYSTEM'
    timezone: 'Europe/Riga'
    ```

# Running Oracle enhanced adapter unit tests

* Install bundler
  ```sh
  $ gem install bundler
  ```

* Execute bundle install to install required gems
  ```sh
  $ bundle install
  ```

* Run Oracle enhanced adapter unit tests
  ```sh
  $ bundle exec rake spec
  ```


text:
// @link http://schemas.triniti.io/json-schema/triniti/ovp/command/update-transcription-status/1-0-0.json#
import Code from '@gdbots/schemas/gdbots/pbjx/enums/Code.js';
import Fb from '@gdbots/pbj/FieldBuilder.js';
import Format from '@gdbots/pbj/enums/Format.js';
import GdbotsPbjxCommandV1Mixin from '@gdbots/schemas/gdbots/pbjx/mixin/command/CommandV1Mixin.js';
import Message from '@gdbots/pbj/Message.js';
import Schema from '@gdbots/pbj/Schema.js';
import T from '@gdbots/pbj/types/index.js';
import TranscriptionStatus from '@triniti/schemas/triniti/ovp/enums/TranscriptionStatus.js';

export default class UpdateTranscriptionStatusV1 extends Message {
  /**
   * @private
   *
   * @returns {Schema}
   */
  static defineSchema() {
    return new Schema(this.SCHEMA_ID, this,
      [
        Fb.create('command_id', T.TimeUuidType.create())
          .required()
          .build(),
        Fb.create('occurred_at', T.MicrotimeType.create())
          .build(),
        /*
         * Used to perform optimistic concurrency control.
         * @link https://en.wikipedia.org/wiki/HTTP_ETag
         */
        Fb.create('expected_etag', T.StringType.create())
          .maxLength(100)
          .pattern('^[\\w\\.:-]+$')
          .build(),
        /*
         * Multi-tenant apps can use this field to track the tenant id.
         */
        Fb.create('ctx_tenant_id', T.StringType.create())
          .pattern('^[\\w\\/\\.:-]+$')
          .build(),
        /*
         * The "ctx_retries" field is used to keep track of how many attempts were
         * made to process this command. In some cases, the service or transport
         * that handles the command may be down or an optimistic check has failed
         * and is being retried.
         */
        Fb.create('ctx_retries', T.TinyIntType.create())
          .build(),
        /*
         * The "ctx_causator" is the actual causator object that "ctx_causator_ref"
         * refers to. In some cases it's useful for command handlers to copy the
         * causator into the command. For example, when a node is being updated we
         * may want to know what the node will be after the update. We can derive
         * this via the causator instead of requesting the node and engaging a race
         * condition.
         */
        Fb.create('ctx_causator', T.MessageType.create())
          .build(),
        Fb.create('ctx_causator_ref', T.MessageRefType.create())
          .build(),
        Fb.create('ctx_correlator_ref', T.MessageRefType.create())
          .build(),
        Fb.create('ctx_user_ref', T.MessageRefType.create())
          .build(),
        /*
         * The "ctx_app" refers to the application used to send the command. This is
         * different from ctx_ua (user_agent) because the agent used (Safari, Firefox)
         * is not necessarily the app used (cms, iOS app, website)
         */
        Fb.create('ctx_app', T.MessageType.create())
          .anyOfCuries([
            'gdbots:contexts::app',
          ])
          .build(),
        /*
         * The "ctx_cloud" is set by the server receiving the command and is generally
         * only used internally for tracking and performance monitoring.
         */
        Fb.create('ctx_cloud', T.MessageType.create())
          .anyOfCuries([
            'gdbots:contexts::cloud',
          ])
          .build(),
        Fb.create('ctx_ip', T.StringType.create())
          .format(Format.IPV4)
          .overridable(true)
          .build(),
        Fb.create('ctx_ipv6', T.StringType.create())
          .format(Format.IPV6)
          .overridable(true)
          .build(),
        Fb.create('ctx_ua', T.TextType.create())
          .overridable(true)
          .build(),
        /*
         * An optional message/reason for the command being sent.
         * Consider this like a git commit message.
         */
        Fb.create('ctx_msg', T.TextType.create())
          .build(),
        /*
         * Tags is a map that categorizes data or tracks references in
         * external systems. The tags names should be consistent and descriptive,
         * e.g. fb_user_id:123, salesforce_customer_id:456.
         */
        Fb.create('tags', T.StringType.create())
          .asAMap()
          .pattern('^[\\w\\/\\.:-]+$')
          .build(),
        /*
         * A reference to the video asset that is being transcribed.
         */
        Fb.create('node_ref', T.NodeRefType.create())
          .required()
          .build(),
        Fb.create('transcription_status', T.StringEnumType.create())
          .classProto(TranscriptionStatus)
          .build(),
        Fb.create('transcribe_job_name', T.StringType.create())
          .pattern('^[\\w-]+$')
          .build(),
        Fb.create('transcribe_job_region', T.StringType.create())
          .maxLength(20)
          .format(Format.SLUG)
          .build(),
        Fb.create('language_code', T.StringType.create())
          .pattern('^[\\w-]+$')
          .build(),
        Fb.create('error_code', T.IntEnumType.create())
          .classProto(Code)
          .build(),
        Fb.create('error_message', T.TextType.create())
          .build(),
      ],
      this.MIXINS,
    );
  }
}

const M = UpdateTranscriptionStatusV1;
M.prototype.SCHEMA_ID = M.SCHEMA_ID = 'pbj:triniti:ovp:command:update-transcription-status:1-0-0';
M.prototype.SCHEMA_CURIE = M.SCHEMA_CURIE = 'triniti:ovp:command:update-transcription-status';
M.prototype.SCHEMA_CURIE_MAJOR = M.SCHEMA_CURIE_MAJOR = 'triniti:ovp:command:update-transcription-status:v1';
M.prototype.MIXINS = M.MIXINS = [
  'gdbots:pbjx:mixin:command:v1',
  'gdbots:pbjx:mixin:command',
  'gdbots:common:mixin:taggable:v1',
  'gdbots:common:mixin:taggable',
];

GdbotsPbjxCommandV1Mixin(M);

Object.freeze(M);
Object.freeze(M.prototype);


text:
package org.jetbrains.buildserver.achievements.impl;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.buildserver.achievements.AchievementEvents;

public class Sapper extends SimpleAchievement {
  public Sapper() {
    super(AchievementEvents.testDisarmed.name(), 20);
  }

  @NotNull
  public String getId() {
    return "sapper";
  }

  @NotNull
  public String getName() {
    return "Sapper";
  }

  @NotNull
  public String getDescription() {
    return "Granted for disarming (unmuting) several tests.";
  }

  @Nullable
  public String getIconClassNames() {
    return "icon-magnet";
  }
}


text:
  <link href="css/lightgallery.css" rel="stylesheet">
  <link href="css/lg-transitions.css" rel="stylesheet">

  <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no" />


text:
package jadx.tests.integration.arith;

import org.junit.jupiter.api.Test;

import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.IntegrationTest;

import static jadx.tests.api.utils.JadxMatchers.containsOne;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;

public class TestArith3 extends IntegrationTest {

	public static class TestCls {
		public int vp;

		public void test(byte[] buffer) {
			int n = ((buffer[3] & 255) + 4) + ((buffer[2] & 15) << 8);
			while (n + 4 < buffer.length) {
				int p = (buffer[n + 2] & 255) + ((buffer[n + 1] & 31) << 8);
				int len = (buffer[n + 4] & 255) + ((buffer[n + 3] & 15) << 8);
				int c = buffer[n] & 255;
				switch (c) {
					case 27:
						this.vp = p;
						break;
				}
				n += len + 5;
			}
		}
	}

	@Test
	public void test() {
		ClassNode cls = getClassNode(TestCls.class);
		String code = cls.getCode().toString();

		assertThat(code, containsOne("while (n + 4 < buffer.length) {"));
		assertThat(code, containsOne(indent() + "n += len + 5;"));
		assertThat(code, not(containsString("; n += len + 5) {")));
		assertThat(code, not(containsString("default:")));
	}

	@Test
	public void testNoDebug() {
		noDebugInfo();
		ClassNode cls = getClassNode(TestCls.class);
		String code = cls.getCode().toString();

		assertThat(code, containsOne("while ("));
	}
}


text:
package net.acomputerdog.ircbot.core.command;

import com.sorcix.sirc.structure.Channel;
import com.sorcix.sirc.structure.User;
import com.sorcix.sirc.util.Chattable;
import net.acomputerdog.ircbot.command.Command;
import net.acomputerdog.ircbot.command.util.CommandLine;
import net.acomputerdog.ircbot.config.Config;
import net.acomputerdog.ircbot.main.IrcBot;

public class CommandInfo extends Command {
    public CommandInfo(IrcBot bot) {
        super(bot, "Info", "info", "inf", "about");
    }

    @Override
    public String getDescription() {
        return "Prints information about AcomputerBot.";
    }

    @Override
    public boolean processCommand(Channel channel, User sender, Chattable target, CommandLine command) {
        target.send(colorYellow("I am running " + bot.getVersionString() + "!  AcomputerBot is a free, open source IRC bot written by acomputerdog!  Type \"" + Config.COMMAND_PREFIX + "help\" for a list of commands."));
        return true;
    }
}


text:
<?php

namespace Deployer;

if (file_exists('.env')) {
    $dotenv = (new \Dotenv\Dotenv(__DIR__))->load();
}

require 'recipe/laravel.php';

/**
 * Collect anonymous stats about Deployer usage for improving developer experience.
 * If you are not comfortable with this, you will always be able to disable this
 * by setting `allow_anonymous_stats` to false.
 */
set('allow_anonymous_stats', getenv('DEPLOYER_STATS'));

// Configuration

set('repository', getenv('DEPLOYER_REPOSITORY'));
set('php_version', getenv('DEPLOYER_PHP_VERSION'));
set('keep_releases', getenv('DEPLOYER_KEEP_RELEASES'));
set('writable_mode', 'chmod');
set('shared_files', []);
set('deploy_path', function () {
    return run('pwd');
});

// Tasks

desc('Setup initial .env for Forge.');
task('init:env', function () {
    if (!test('[ -d .env ]')) {
        copy('.env.example', '.env');
        file_put_contents('.env', preg_replace(
            '/^APP_KEY\=/m',
            'APP_KEY=base64:' . base64_encode(random_bytes(32)),
            file_get_contents('.env')
        ));
    }
    if (!test('[ -d {{deploy_path}}/current ]')) {
        run("{{bin/symlink}} {{deploy_path}}/src {{deploy_path}}/current");
    }
    if (!test('[ -d {{release_path}}/.env ]')) {
        invoke('deploy:env');
    }
});

desc('Link to .env in root folder for Forge editor.');
task('deploy:env', function () {
    run("{{bin/symlink}} {{deploy_path}}/.env {{release_path}}/.env");
});

desc('Restart PHP-FPM service');
task('php-fpm:restart', function () {
    run('sudo -S service {{php_version}} reload');
});

desc('Check site status after deployment');
task('site:status', function () {
    if (getenv('APP_URL')) {
        $response = \Zttp\Zttp::get(getenv('APP_URL'));
        if ($response->isSuccess()) {
            write("✔ Site is online!\n");
        } else {
            write("✘ Site is offline!\n");
            invoke('rollback');
            invoke('php-fpm:restart');
            throw new \Exception("Site did not load, deployment rolled back");
        }
    } else {
        write("✘ App URL not set in .env\n");
    }

});

desc('Task to run before the deploy');
task('deployer:before', function () {
    customTask('DEPLOYER_BEFORE');
});

desc('Task to run during the deploy');
task('deployer:artisan', function () {
    customTask('DEPLOYER_ARTISAN');
});

desc('Task to run after the deploy');
task('deployer:after', function () {
    customTask('DEPLOYER_AFTER');
});

desc('Deploy your project');
task('forge:deploy', [
    'deployer:before',
    'deploy:prepare',
    'deploy:lock',
    'deploy:release',
    'deploy:update_code',
    'deploy:shared',
    'deploy:vendors',
    'deploy:writable',
    'deploy:env',
    'deployer:artisan',
    'php-fpm:restart',
    'deploy:symlink',
    'deploy:unlock',
    'cleanup',
    'deployer:after'
]);

// Additional task to perform
after('rollback', 'php-fpm:restart');
after('deploy:failed', 'deploy:unlock');
after('deploy', 'success');

/**
 * Helper function to get chained task from .env file
 */
function customTask($env)
{
    if (getenv($env)) {
        $tasks = explode('|', getenv($env));
        foreach ($tasks as $task) {
            invoke($task);
        }
    } else {
        write("✘ No task to perform.\n");
    }
}


text:
using System;
using System.Diagnostics;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

namespace SolverPrototype.CollisionDetection
{
    //TODO: These memory layouts are questionable; should probably see if they can be improved once we have something going.
    /// <summary>
    /// Information about a single contact in a nonconvex collidable pair.
    /// Nonconvex pairs can have different surface bases at each contact point, since the contact surface is not guaranteed to be a plane.
    /// </summary>
    [StructLayout(LayoutKind.Explicit, Size = 36)]
    public struct NonconvexContact
    {
        /// <summary>
        /// Offset from the position of collidable A to the contact position.
        /// </summary>
        [FieldOffset(0)]
        public Vector3 Offset;
        /// <summary>
        /// Penetration depth between the two collidables at this contact. Negative values represent separation.
        /// </summary>
        [FieldOffset(12)]
        public float Depth;
        /// <summary>
        /// Surface basis of the contact. If transformed into a rotation matrix, X and Z represent tangent directions and Y represents the contact normal.
        /// </summary>
        [FieldOffset(16)]
        public BEPUutilities2.Quaternion SurfaceBasis;
        /// <summary>
        /// Id of the features involved in the collision that generated this contact. If a contact has the same feature id as in a previous frame, it is an indication that the
        /// same parts of the shape contributed to its creation. This is useful for carrying information from frame to frame.
        /// </summary>
        [FieldOffset(32)]
        public int FeatureId;
    }
    /// <summary>
    /// Information about a single contact in a convex collidable pair. Convex collidable pairs share one surface basis across the manifold, since the contact surface is guaranteed to be a plane.
    /// </summary>
    [StructLayout(LayoutKind.Explicit, Size = 20)]
    public struct ConvexContact
    {
        /// <summary>
        /// Offset from the position of collidable A to the contact position.
        /// </summary>
        [FieldOffset(0)]
        public Vector3 Offset;
        /// <summary>
        /// Penetration depth between the two collidables at this contact. Negative values represent separation.
        /// </summary>
        [FieldOffset(12)]
        public float Depth;
        /// <summary>
        /// Id of the features involved in the collision that generated this contact. If a contact has the same feature id as in a previous frame, it is an indication that the
        /// same parts of the shape contributed to its creation. This is useful for carrying information from frame to frame.
        /// </summary>
        [FieldOffset(16)]
        public int FeatureId;
    }

    //TODO: We could use specialized storage types for things like continuations if L2 can't actually hold it all. Seems unlikely, but it's not that hard if required.

    /// <summary>
    /// Contains the data associated with a convex or nonconvex contact manifold.
    /// </summary>
    /// <remarks>The idea here is to unify producers and consumers of convex and nonconvex manifolds. In many cases, this type is far larger than is required- we could store far less
    /// when we know there's only going to be one contact. However, having a single representation keeps things a little simpler.</remarks>
    [StructLayout(LayoutKind.Explicit, Size = 144)]
    public unsafe struct ContactManifold
    {
        /// <summary>
        /// Offset from collidable A to collidable B.
        /// </summary>
        [FieldOffset(0)]
        public Vector3 OffsetB;
        [FieldOffset(12)]
        public int PackedConvexityAndContactCount;

        [FieldOffset(16)]
        public Vector3 Offset0;
        [FieldOffset(28)]
        public Vector3 Offset1;
        [FieldOffset(40)]
        public Vector3 Offset2;
        [FieldOffset(52)]
        public Vector3 Offset3;
        [FieldOffset(64)]
        public float Depth0;
        [FieldOffset(68)]
        public float Depth1;
        [FieldOffset(72)]
        public float Depth2;
        [FieldOffset(76)]
        public float Depth3;
        [FieldOffset(80)]
        public int FeatureId0;
        [FieldOffset(84)]
        public int FeatureId1;
        [FieldOffset(88)]
        public int FeatureId2;
        [FieldOffset(92)]
        public int FeatureId3;
        /// <summary>
        /// Normal of nonconvex contact 0. Value undefined if manifold is convex.
        /// </summary>
        [FieldOffset(96)]
        public Vector3 Normal0;
        /// <summary>
        /// Normal of nonconvex contact 1. Value undefined if manifold is convex.
        /// </summary>
        [FieldOffset(108)]
        public Vector3 Normal1;
        /// <summary>
        /// Normal of nonconvex contact 2. Value undefined if manifold is convex.
        /// </summary>
        [FieldOffset(120)]
        public Vector3 Normal2;
        /// <summary>
        /// Normal of nonconvex contact 3. Value undefined if manifold is convex.
        /// </summary>
        [FieldOffset(132)]
        public Vector3 Normal3;

        /// <summary>
        /// Normal of the convex manifold. Value undefined if manifold is nonconvex.
        /// </summary>
        [FieldOffset(96)]
        public Vector3 ConvexNormal;

        /// <summary>
        /// Gets or sets whether the manifold should be considered convex.
        /// </summary>
        public bool Convex
        {
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            get
            {
                return (PackedConvexityAndContactCount & (1 << 4)) > 0;
            }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            set
            {
                PackedConvexityAndContactCount = (PackedConvexityAndContactCount & (~(1 << 4))) | ((*(int*)&value) << 4); //hack^__^
            }
        }
        /// <summary>
        /// Gets or sets the number of contacts in the manifold.
        /// </summary>
        public int ContactCount
        {
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            get
            {
                return PackedConvexityAndContactCount & 7;
            }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            set
            {
                PackedConvexityAndContactCount = value | (PackedConvexityAndContactCount & 8);
            }
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void SetConvexityAndCount(int count, bool convex)
        {
            PackedConvexityAndContactCount = count | ((*(int*)&convex) << 4);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static void ConvexFastRemoveAt(ContactManifold* manifold, int index)
        {
            Debug.Assert(manifold->Convex);
            var count = manifold->ContactCount;

            var lastIndex = count - 1;
            if (index < lastIndex)
            {
                var offsets = &manifold->Offset0;
                var depths = &manifold->Depth0;
                var featureIds = &manifold->FeatureId0;
                offsets[index] = offsets[lastIndex];
                depths[index] = depths[lastIndex];
                featureIds[index] = featureIds[lastIndex];
            }
            manifold->SetConvexityAndCount(lastIndex, true);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static void NonconvexFastRemoveAt(ContactManifold* manifold, int index)
        {
            Debug.Assert(!manifold->Convex);
            var count = manifold->ContactCount;

            var lastIndex = count - 1;
            if (index < lastIndex)
            {
                var offsets = &manifold->Offset0;
                var depths = &manifold->Depth0;
                var featureIds = &manifold->FeatureId0;
                var normals = &manifold->Normal0;
                offsets[index] = offsets[lastIndex];
                depths[index] = depths[lastIndex];
                featureIds[index] = featureIds[lastIndex];
                normals[index] = normals[lastIndex];
            }
            manifold->SetConvexityAndCount(lastIndex, false);
        }
    }

}


text:
typedef enum {
    ColorWithRed,
    ColorWithWhite,
    ColorWithGolden
}Color;

@interface Car : NSObject

@property(nonatomic,copy) NSString *name;
@property(nonatomic,assign)Color color;

-(id)initWithColor:(Color)color andName:(NSString*)name;

@end


text:
package org.apache.rya.indexing.pcj.functions.geo;

public class RCC8TPPIRdf4J extends FunctionAdapter {
    public RCC8TPPIRdf4J() {
        super(new org.eclipse.rdf4j.query.algebra.evaluation.function.geosparql.RCC8TPPI());
    }
}


text:
/**
	The base kind for shapes that can be drawn into the canvas.
	This doesn't have a default rendering, but an event handler
	may call the _draw_ method on it.

	Kinds derived from this one should provide their own implementation of
	_renderSelf_.  If more complex operations are needed for filled mode or
	outline	mode, override the _fill_ or _outline_ methods, respectively.
*/
enyo.kind({
	name: "enyo.canvas.Shape",
	kind: enyo.canvas.Control,
	published: {
		//* Color used to draw the interior of the shape
		color: "red",
		//* Color used to draw the outline of the shape
		outlineColor: ""
	},
	//* @protected
	fill: function(inContext) {
		inContext.fill();
	},
	outline: function(inContext) {
		inContext.stroke();
	},
	//* @public
	draw: function(inContext) {
		if (this.color) {
			inContext.fillStyle = this.color;
			this.fill(inContext);
		}
		if (this.outlineColor) {
			inContext.strokeStyle = this.outlineColor;
			this.outline(inContext);
		}
	}
});


text:
import hashlib
import os

from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand

from rest_framework.authtoken.models import Token

User = get_user_model()

class Command(BaseCommand):

    help = "Creates a new user & app token for a client request."

    def add_arguments(self, parser):
        parser.add_argument(
            '--username',
            dest='username',
            help='The username for the given application.',
            required=True,
            type=str
        )

    def generate_random_password(self, length=13):
        random_data = os.urandom(128)
        return hashlib.md5(random_data).hexdigest()[:16]

    def handle(self, *args, **kwargs):
        username = kwargs.get('username')
        user, created = User.objects.get_or_create(username=username, defaults={
            'password': self.generate_random_password(),
            'is_staff': True
        })
        token = Token.objects.create(user=user)
        self.stdout.write(token.key)


text:
package com.octopod.nixium.utils;

public class NXArrays {

    public String[] push(String[] array, String element){
        String[] newArray = new String[array.length + 1];
        System.arraycopy(array, 0, newArray, 0, array.length);
        newArray[array.length] = element;
        return(newArray);
    }

    public String[] remove(String[] array, String element){
        int matches = 0;
        for(int i = 0; i < array.length; i++){if(array[i].equals(element)){matches++;}}
        int index = 0;
        String[] newArray = new String[array.length - matches];
        for(int i = 0; i < array.length; i++){
            if(!array[i].equals(element)){
                newArray[index] = array[i];
                index++;
            }
        }
        return newArray;
    }

}


text:
describe Kontena::ServicePods::Starter do

  let(:service_pod) { double(:service_pod, service_id: 'service_id', instance_number: 1)}
  let(:hook_manager) { double(:hook_manager) }
  let(:subject) { described_class.new(service_pod, hook_manager) }

  describe '#perform' do

    let(:container) do
      double(:container, :running? => false, :name_for_humans => 'foo/bar-1')
    end

    before(:each) do
      allow(hook_manager).to receive(:track)
      allow(subject).to receive(:get_container).and_return(container)
    end

    it 'does nothing if container is running' do
      allow(container).to receive(:running?).and_return(true)
      expect(container).to_not receive(:restart!)
      subject.perform
    end

    it 'starts container if not running' do
      expect(hook_manager).to receive(:on_pre_start).once
      expect(hook_manager).to receive(:on_post_start).once
      expect(container).to receive(:start!)
      subject.perform
    end

    it 'fails if container start fails' do
      expect(hook_manager).to receive(:on_pre_start).once
      expect(container).to receive(:start!).and_raise(Docker::Error::ServerError, "failed")
      expect{subject.perform}.to raise_error(Docker::Error::ServerError)
    end
  end
end


text:
layout: post
title: Horváth Mihály • Rajzolatok a' Magyar Nemzet legrégiebb történeteiből • 1825
categories: lesebibliothek
tags: történettudomány 19. század Horváth Mihály
---

Az [Oszták Nemzeti Könyvtár](http://onb.ac.at) szolgáltatja a digitalizált kiadványt. Automaikus `ocr`, `jpg` képformátum, nem tölthető le egyben.

- [Olvasom](http://digital.onb.ac.at/OnbViewer/viewer.faces?doc=ABO_%2BZ169723107)


text:
#ifndef PORT_MIDI_H
#define PORT_MIDI_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/*
 * PortMidi Portable Real-Time MIDI Library
 * PortMidi API Header File
 * Latest version available at: http://sourceforge.net/projects/portmedia
 *
 * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
 * Copyright (c) 2001-2006 Roger B. Dannenberg
 *
 * 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.
 */

/*
 * The text above constitutes the entire PortMidi license; however,
 * the PortMusic community also makes the following non-binding requests:
 *
 * Any person wishing to distribute modifications to the Software is
 * requested to send the modifications to the original developer so that
 * they can be incorporated into the canonical version. It is also
 * requested that these non-binding requests be included along with the
 * license above.
 */

/* CHANGELOG FOR PORTMIDI
 *     (see ../CHANGELOG.txt)
 *
 * NOTES ON HOST ERROR REPORTING:
 *
 *    PortMidi errors (of type PmError) are generic, system-independent errors.
 *    When an error does not map to one of the more specific PmErrors, the
 *    catch-all code pmHostError is returned. This means that PortMidi has
 *    retained a more specific system-dependent error code. The caller can
 *    get more information by calling Pm_HasHostError() to test if there is
 *    a pending host error, and Pm_GetHostErrorText() to get a text string
 *    describing the error. Host errors are reported on a per-device basis
 *    because only after you open a device does PortMidi have a place to
 *    record the host error code. I.e. only
 *    those routines that receive a (PortMidiStream *) argument check and
 *    report errors. One exception to this is that Pm_OpenInput() and
 *    Pm_OpenOutput() can report errors even though when an error occurs,
 *    there is no PortMidiStream* to hold the error. Fortunately, both
 *    of these functions return any error immediately, so we do not really
 *    need per-device error memory. Instead, any host error code is stored
 *    in a global, pmHostError is returned, and the user can call
 *    Pm_GetHostErrorText() to get the error message (and the invalid stream
 *    parameter will be ignored.) The functions
 *    pm_init and pm_term do not fail or raise
 *    errors. The job of pm_init is to locate all available devices so that
 *    the caller can get information via PmDeviceInfo(). If an error occurs,
 *    the device is simply not listed as available.
 *
 *    Host errors come in two flavors:
 *      a) host error
 *      b) host error during callback
 *    These can occur w/midi input or output devices. (b) can only happen
 *    asynchronously (during callback routines), whereas (a) only occurs while
 *    synchronously running PortMidi and any resulting system dependent calls.
 *    Both (a) and (b) are reported by the next read or write call. You can
 *    also query for asynchronous errors (b) at any time by calling
 *    Pm_HasHostError().
 *
 * NOTES ON COMPILE-TIME SWITCHES
 *
 *    DEBUG assumes stdio and a console. Use this if you want automatic, simple
 *        error reporting, e.g. for prototyping. If you are using MFC or some
 *        other graphical interface with no console, DEBUG probably should be
 *        undefined.
 *    PM_CHECK_ERRORS more-or-less takes over error checking for return values,
 *        stopping your program and printing error messages when an error
 *        occurs. This also uses stdio for console text I/O.
 */

#ifndef WIN32
// Linux and OS X have stdint.h
#include <stdint.h>
#else
#ifndef INT32_DEFINED
// rather than having users install a special .h file for windows,
// just put the required definitions inline here. porttime.h uses
// these too, so the definitions are (unfortunately) duplicated there
typedef int int32_t;
typedef unsigned int uint32_t;
#define INT32_DEFINED
#endif
#endif

#ifdef _WINDLL
#define PMEXPORT __declspec(dllexport)
#else
#define PMEXPORT
#endif

#ifndef FALSE
    #define FALSE 0
#endif
#ifndef TRUE
    #define TRUE 1
#endif

/* default size of buffers for sysex transmission: */
#define PM_DEFAULT_SYSEX_BUFFER_SIZE 1024

/** List of portmidi errors.*/
typedef enum {
    pmNoError = 0,
    pmNoData = 0, /**< A "no error" return that also indicates no data avail. */
    pmGotData = 1, /**< A "no error" return that also indicates data available */
    pmHostError = -10000,
    pmInvalidDeviceId, /** out of range or
                        * output device when input is requested or
                        * input device when output is requested or
                        * device is already opened
                        */
    pmInsufficientMemory,
    pmBufferTooSmall,
    pmBufferOverflow,
    pmBadPtr, /* PortMidiStream parameter is NULL or
               * stream is not opened or
               * stream is output when input is required or
               * stream is input when output is required */
    pmBadData, /** illegal midi data, e.g. missing EOX */
    pmInternalError,
    pmBufferMaxSize /** buffer is already as large as it can be */
    /* NOTE: If you add a new error type, be sure to update Pm_GetErrorText() */
} PmError;

/**
    Pm_Initialize() is the library initialisation function - call this before
    using the library.
*/
PMEXPORT PmError Pm_Initialize( void );

/**
    Pm_Terminate() is the library termination function - call this after
    using the library.
*/
PMEXPORT PmError Pm_Terminate( void );

/**  A single PortMidiStream is a descriptor for an open MIDI device.
*/
typedef void PortMidiStream;
#define PmStream PortMidiStream

/**
    Test whether stream has a pending host error. Normally, the client finds
    out about errors through returned error codes, but some errors can occur
    asynchronously where the client does not
    explicitly call a function, and therefore cannot receive an error code.
    The client can test for a pending error using Pm_HasHostError(). If true,
    the error can be accessed and cleared by calling Pm_GetErrorText().
    Errors are also cleared by calling other functions that can return
    errors, e.g. Pm_OpenInput(), Pm_OpenOutput(), Pm_Read(), Pm_Write(). The
    client does not need to call Pm_HasHostError(). Any pending error will be
    reported the next time the client performs an explicit function call on
    the stream, e.g. an input or output operation. Until the error is cleared,
    no new error codes will be obtained, even for a different stream.
*/
PMEXPORT int Pm_HasHostError( PortMidiStream * stream );

/**  Translate portmidi error number into human readable message.
    These strings are constants (set at compile time) so client has
    no need to allocate storage
*/
PMEXPORT const char *Pm_GetErrorText( PmError errnum );

/**  Translate portmidi host error into human readable message.
    These strings are computed at run time, so client has to allocate storage.
    After this routine executes, the host error is cleared.
*/
PMEXPORT void Pm_GetHostErrorText(char * msg, unsigned int len);

#define HDRLENGTH 50
#define PM_HOST_ERROR_MSG_LEN 256u /* any host error msg will occupy less
                                      than this number of characters */

/**
    Device enumeration mechanism.

    Device ids range from 0 to Pm_CountDevices()-1.

*/
typedef int PmDeviceID;
#define pmNoDevice -1
typedef struct {
    int structVersion; /**< this internal structure version */
    const char *interf; /**< underlying MIDI API, e.g. MMSystem or DirectX */
    const char *name;   /**< device name, e.g. USB MidiSport 1x1 */
    int input; /**< true iff input is available */
    int output; /**< true iff output is available */
    int opened; /**< used by generic PortMidi code to do error checking on arguments */

} PmDeviceInfo;

/**  Get devices count, ids range from 0 to Pm_CountDevices()-1. */
PMEXPORT int Pm_CountDevices( void );
/**
    Pm_GetDefaultInputDeviceID(), Pm_GetDefaultOutputDeviceID()

    Return the default device ID or pmNoDevice if there are no devices.
    The result (but not pmNoDevice) can be passed to Pm_OpenMidi().

    The default device can be specified using a small application
    named pmdefaults that is part of the PortMidi distribution. This
    program in turn uses the Java Preferences object created by
    java.util.prefs.Preferences.userRoot().node("/PortMidi"); the
    preference is set by calling
        prefs.put("PM_RECOMMENDED_OUTPUT_DEVICE", prefName);
    or  prefs.put("PM_RECOMMENDED_INPUT_DEVICE", prefName);

    In the statements above, prefName is a string describing the
    MIDI device in the form "interf, name" where interf identifies
    the underlying software system or API used by PortMdi to access
    devices and name is the name of the device. These correspond to
    the interf and name fields of a PmDeviceInfo. (Currently supported
    interfaces are "MMSystem" for Win32, "ALSA" for Linux, and
    "CoreMIDI" for OS X, so in fact, there is no choice of interface.)
    In "interf, name", the strings are actually substrings of
    the full interface and name strings. For example, the preference
    "Core, Sport" will match a device with interface "CoreMIDI"
    and name "In USB MidiSport 1x1". It will also match "CoreMIDI"
    and "In USB MidiSport 2x2". The devices are enumerated in device
    ID order, so the lowest device ID that matches the pattern becomes
    the default device. Finally, if the comma-space (", ") separator
    between interface and name parts of the preference is not found,
    the entire preference string is interpreted as a name, and the
    interface part is the empty string, which matches anything.

    On the MAC, preferences are stored in
      /Users/$NAME/Library/Preferences/com.apple.java.util.prefs.plist
    which is a binary file. In addition to the pmdefaults program,
    there are utilities that can read and edit this preference file.

    On the PC,

    On Linux,

*/
PMEXPORT PmDeviceID Pm_GetDefaultInputDeviceID( void );
/** see PmDeviceID Pm_GetDefaultInputDeviceID() */
PMEXPORT PmDeviceID Pm_GetDefaultOutputDeviceID( void );

/**
    PmTimestamp is used to represent a millisecond clock with arbitrary
    start time. The type is used for all MIDI timestampes and clocks.
*/
typedef int32_t PmTimestamp;
typedef PmTimestamp (*PmTimeProcPtr)(void *time_info);

/** TRUE if t1 before t2 */
#define PmBefore(t1,t2) ((t1-t2) < 0)
/**
    \defgroup grp_device Input/Output Devices Handling
    @{
*/
/**
    Pm_GetDeviceInfo() returns a pointer to a PmDeviceInfo structure
    referring to the device specified by id.
    If id is out of range the function returns NULL.

    The returned structure is owned by the PortMidi implementation and must
    not be manipulated or freed. The pointer is guaranteed to be valid
    between calls to Pm_Initialize() and Pm_Terminate().
*/
PMEXPORT const PmDeviceInfo* Pm_GetDeviceInfo( PmDeviceID id );

/**
    Pm_OpenInput() and Pm_OpenOutput() open devices.

    stream is the address of a PortMidiStream pointer which will receive
    a pointer to the newly opened stream.

    inputDevice is the id of the device used for input (see PmDeviceID above).

    inputDriverInfo is a pointer to an optional driver specific data structure
    containing additional information for device setup or handle processing.
    inputDriverInfo is never required for correct operation. If not used
    inputDriverInfo should be NULL.

    outputDevice is the id of the device used for output (see PmDeviceID above.)

    outputDriverInfo is a pointer to an optional driver specific data structure
    containing additional information for device setup or handle processing.
    outputDriverInfo is never required for correct operation. If not used
    outputDriverInfo should be NULL.

    For input, the buffersize specifies the number of input events to be
    buffered waiting to be read using Pm_Read(). For output, buffersize
    specifies the number of output events to be buffered waiting for output.
    (In some cases -- see below -- PortMidi does not buffer output at all
    and merely passes data to a lower-level API, in which case buffersize
    is ignored.)

    latency is the delay in milliseconds applied to timestamps to determine
    when the output should actually occur. (If latency is < 0, 0 is assumed.)
    If latency is zero, timestamps are ignored and all output is delivered
    immediately. If latency is greater than zero, output is delayed until the
    message timestamp plus the latency. (NOTE: the time is measured relative
    to the time source indicated by time_proc. Timestamps are absolute,
    not relative delays or offsets.) In some cases, PortMidi can obtain
    better timing than your application by passing timestamps along to the
    device driver or hardware. Latency may also help you to synchronize midi
    data to audio data by matching midi latency to the audio buffer latency.

    time_proc is a pointer to a procedure that returns time in milliseconds. It
    may be NULL, in which case a default millisecond timebase (PortTime) is
    used. If the application wants to use PortTime, it should start the timer
    (call Pt_Start) before calling Pm_OpenInput or Pm_OpenOutput. If the
    application tries to start the timer *after* Pm_OpenInput or Pm_OpenOutput,
    it may get a ptAlreadyStarted error from Pt_Start, and the application's
    preferred time resolution and callback function will be ignored.
    time_proc result values are appended to incoming MIDI data, and time_proc
    times are used to schedule outgoing MIDI data (when latency is non-zero).

    time_info is a pointer passed to time_proc.

    Example: If I provide a timestamp of 5000, latency is 1, and time_proc
    returns 4990, then the desired output time will be when time_proc returns
    timestamp+latency = 5001. This will be 5001-4990 = 11ms from now.

    return value:
    Upon success Pm_Open() returns PmNoError and places a pointer to a
    valid PortMidiStream in the stream argument.
    If a call to Pm_Open() fails a nonzero error code is returned (see
    PMError above) and the value of port is invalid.

    Any stream that is successfully opened should eventually be closed
    by calling Pm_Close().

*/
PMEXPORT PmError Pm_OpenInput( PortMidiStream** stream,
                PmDeviceID inputDevice,
                void *inputDriverInfo,
                int32_t bufferSize,
                PmTimeProcPtr time_proc,
                void *time_info );

PMEXPORT PmError Pm_OpenOutput( PortMidiStream** stream,
                PmDeviceID outputDevice,
                void *outputDriverInfo,
                int32_t bufferSize,
                PmTimeProcPtr time_proc,
                void *time_info,
                int32_t latency );
  /** @} */

/**
   \defgroup grp_events_filters Events and Filters Handling
   @{
*/

/*  \function PmError Pm_SetFilter( PortMidiStream* stream, int32_t filters )
    Pm_SetFilter() sets filters on an open input stream to drop selected
    input types. By default, only active sensing messages are filtered.
    To prohibit, say, active sensing and sysex messages, call
    Pm_SetFilter(stream, PM_FILT_ACTIVE | PM_FILT_SYSEX);

    Filtering is useful when midi routing or midi thru functionality is being
    provided by the user application.
    For example, you may want to exclude timing messages (clock, MTC, start/stop/continue),
    while allowing note-related messages to pass.
    Or you may be using a sequencer or drum-machine for MIDI clock information but want to
    exclude any notes it may play.
 */

/* Filter bit-mask definitions */
/** filter active sensing messages (0xFE): */
#define PM_FILT_ACTIVE (1 << 0x0E)
/** filter system exclusive messages (0xF0): */
#define PM_FILT_SYSEX (1 << 0x00)
/** filter MIDI clock message (0xF8) */
#define PM_FILT_CLOCK (1 << 0x08)
/** filter play messages (start 0xFA, stop 0xFC, continue 0xFB) */
#define PM_FILT_PLAY ((1 << 0x0A) | (1 << 0x0C) | (1 << 0x0B))
/** filter tick messages (0xF9) */
#define PM_FILT_TICK (1 << 0x09)
/** filter undefined FD messages */
#define PM_FILT_FD (1 << 0x0D)
/** filter undefined real-time messages */
#define PM_FILT_UNDEFINED PM_FILT_FD
/** filter reset messages (0xFF) */
#define PM_FILT_RESET (1 << 0x0F)
/** filter all real-time messages */
#define PM_FILT_REALTIME (PM_FILT_ACTIVE | PM_FILT_SYSEX | PM_FILT_CLOCK | \
    PM_FILT_PLAY | PM_FILT_UNDEFINED | PM_FILT_RESET | PM_FILT_TICK)
/** filter note-on and note-off (0x90-0x9F and 0x80-0x8F */
#define PM_FILT_NOTE ((1 << 0x19) | (1 << 0x18))
/** filter channel aftertouch (most midi controllers use this) (0xD0-0xDF)*/
#define PM_FILT_CHANNEL_AFTERTOUCH (1 << 0x1D)
/** per-note aftertouch (0xA0-0xAF) */
#define PM_FILT_POLY_AFTERTOUCH (1 << 0x1A)
/** filter both channel and poly aftertouch */
#define PM_FILT_AFTERTOUCH (PM_FILT_CHANNEL_AFTERTOUCH | PM_FILT_POLY_AFTERTOUCH)
/** Program changes (0xC0-0xCF) */
#define PM_FILT_PROGRAM (1 << 0x1C)
/** Control Changes (CC's) (0xB0-0xBF)*/
#define PM_FILT_CONTROL (1 << 0x1B)
/** Pitch Bender (0xE0-0xEF*/
#define PM_FILT_PITCHBEND (1 << 0x1E)
/** MIDI Time Code (0xF1)*/
#define PM_FILT_MTC (1 << 0x01)
/** Song Position (0xF2) */
#define PM_FILT_SONG_POSITION (1 << 0x02)
/** Song Select (0xF3)*/
#define PM_FILT_SONG_SELECT (1 << 0x03)
/** Tuning request (0xF6)*/
#define PM_FILT_TUNE (1 << 0x06)
/** All System Common messages (mtc, song position, song select, tune request) */
#define PM_FILT_SYSTEMCOMMON (PM_FILT_MTC | PM_FILT_SONG_POSITION | PM_FILT_SONG_SELECT | PM_FILT_TUNE)

PMEXPORT PmError Pm_SetFilter( PortMidiStream* stream, int32_t filters );

#define Pm_Channel(channel) (1<<(channel))
/**
    Pm_SetChannelMask() filters incoming messages based on channel.
    The mask is a 16-bit bitfield corresponding to appropriate channels.
    The Pm_Channel macro can assist in calling this function.
    i.e. to set receive only input on channel 1, call with
    Pm_SetChannelMask(Pm_Channel(1));
    Multiple channels should be OR'd together, like
    Pm_SetChannelMask(Pm_Channel(10) | Pm_Channel(11))

    Note that channels are numbered 0 to 15 (not 1 to 16). Most
    synthesizer and interfaces number channels starting at 1, but
    PortMidi numbers channels starting at 0.

    All channels are allowed by default
*/
PMEXPORT PmError Pm_SetChannelMask(PortMidiStream *stream, int mask);

/**
    Pm_Abort() terminates outgoing messages immediately
    The caller should immediately close the output port;
    this call may result in transmission of a partial midi message.
    There is no abort for Midi input because the user can simply
    ignore messages in the buffer and close an input device at
    any time.
 */
PMEXPORT PmError Pm_Abort( PortMidiStream* stream );

/**
    Pm_Close() closes a midi stream, flushing any pending buffers.
    (PortMidi attempts to close open streams when the application
    exits -- this is particularly difficult under Windows.)
*/
PMEXPORT PmError Pm_Close( PortMidiStream* stream );

/**
    Pm_Synchronize() instructs PortMidi to (re)synchronize to the
    time_proc passed when the stream was opened. Typically, this
    is used when the stream must be opened before the time_proc
    reference is actually advancing. In this case, message timing
    may be erratic, but since timestamps of zero mean
    "send immediately," initialization messages with zero timestamps
    can be written without a functioning time reference and without
    problems. Before the first MIDI message with a non-zero
    timestamp is written to the stream, the time reference must
    begin to advance (for example, if the time_proc computes time
    based on audio samples, time might begin to advance when an
    audio stream becomes active). After time_proc return values
    become valid, and BEFORE writing the first non-zero timestamped
    MIDI message, call Pm_Synchronize() so that PortMidi can observe
    the difference between the current time_proc value and its
    MIDI stream time.

    In the more normal case where time_proc
    values advance continuously, there is no need to call
    Pm_Synchronize. PortMidi will always synchronize at the
    first output message and periodically thereafter.
*/
PmError Pm_Synchronize( PortMidiStream* stream );

/**
    Pm_Message() encodes a short Midi message into a 32-bit word. If data1
    and/or data2 are not present, use zero.

    Pm_MessageStatus(), Pm_MessageData1(), and
    Pm_MessageData2() extract fields from a 32-bit midi message.
*/
#define Pm_Message(status, data1, data2) \
         ((((data2) << 16) & 0xFF0000) | \
          (((data1) << 8) & 0xFF00) | \
          ((status) & 0xFF))
#define Pm_MessageStatus(msg) ((msg) & 0xFF)
#define Pm_MessageData1(msg) (((msg) >> 8) & 0xFF)
#define Pm_MessageData2(msg) (((msg) >> 16) & 0xFF)

typedef int32_t PmMessage; /**< see PmEvent */
/**
   All midi data comes in the form of PmEvent structures. A sysex
   message is encoded as a sequence of PmEvent structures, with each
   structure carrying 4 bytes of the message, i.e. only the first
   PmEvent carries the status byte.

   Note that MIDI allows nested messages: the so-called "real-time" MIDI
   messages can be inserted into the MIDI byte stream at any location,
   including within a sysex message. MIDI real-time messages are one-byte
   messages used mainly for timing (see the MIDI spec). PortMidi retains
   the order of non-real-time MIDI messages on both input and output, but
   it does not specify exactly how real-time messages are processed. This
   is particulary problematic for MIDI input, because the input parser
   must either prepare to buffer an unlimited number of sysex message
   bytes or to buffer an unlimited number of real-time messages that
   arrive embedded in a long sysex message. To simplify things, the input
   parser is allowed to pass real-time MIDI messages embedded within a
   sysex message, and it is up to the client to detect, process, and
   remove these messages as they arrive.

   When receiving sysex messages, the sysex message is terminated
   by either an EOX status byte (anywhere in the 4 byte messages) or
   by a non-real-time status byte in the low order byte of the message.
   If you get a non-real-time status byte but there was no EOX byte, it
   means the sysex message was somehow truncated. This is not
   considered an error; e.g., a missing EOX can result from the user
   disconnecting a MIDI cable during sysex transmission.

   A real-time message can occur within a sysex message. A real-time
   message will always occupy a full PmEvent with the status byte in
   the low-order byte of the PmEvent message field. (This implies that
   the byte-order of sysex bytes and real-time message bytes may not
   be preserved -- for example, if a real-time message arrives after
   3 bytes of a sysex message, the real-time message will be delivered
   first. The first word of the sysex message will be delivered only
   after the 4th byte arrives, filling the 4-byte PmEvent message field.

   The timestamp field is observed when the output port is opened with
   a non-zero latency. A timestamp of zero means "use the current time",
   which in turn means to deliver the message with a delay of
   latency (the latency parameter used when opening the output port.)
   Do not expect PortMidi to sort data according to timestamps --
   messages should be sent in the correct order, and timestamps MUST
   be non-decreasing. See also "Example" for Pm_OpenOutput() above.

   A sysex message will generally fill many PmEvent structures. On
   output to a PortMidiStream with non-zero latency, the first timestamp
   on sysex message data will determine the time to begin sending the
   message. PortMidi implementations may ignore timestamps for the
   remainder of the sysex message.

   On input, the timestamp ideally denotes the arrival time of the
   status byte of the message. The first timestamp on sysex message
   data will be valid. Subsequent timestamps may denote
   when message bytes were actually received, or they may be simply
   copies of the first timestamp.

   Timestamps for nested messages: If a real-time message arrives in
   the middle of some other message, it is enqueued immediately with
   the timestamp corresponding to its arrival time. The interrupted
   non-real-time message or 4-byte packet of sysex data will be enqueued
   later. The timestamp of interrupted data will be equal to that of
   the interrupting real-time message to insure that timestamps are
   non-decreasing.
 */
typedef struct {
    PmMessage      message;
    PmTimestamp    timestamp;
} PmEvent;

/**
    @}
*/
/** \defgroup grp_io Reading and Writing Midi Messages
    @{
*/
/**
    Pm_Read() retrieves midi data into a buffer, and returns the number
    of events read. Result is a non-negative number unless an error occurs,
    in which case a PmError value will be returned.

    Buffer Overflow

    The problem: if an input overflow occurs, data will be lost, ultimately
    because there is no flow control all the way back to the data source.
    When data is lost, the receiver should be notified and some sort of
    graceful recovery should take place, e.g. you shouldn't resume receiving
    in the middle of a long sysex message.

    With a lock-free fifo, which is pretty much what we're stuck with to
    enable portability to the Mac, it's tricky for the producer and consumer
    to synchronously reset the buffer and resume normal operation.

    Solution: the buffer managed by PortMidi will be flushed when an overflow
    occurs. The consumer (Pm_Read()) gets an error message (pmBufferOverflow)
    and ordinary processing resumes as soon as a new message arrives. The
    remainder of a partial sysex message is not considered to be a "new
    message" and will be flushed as well.

*/
PMEXPORT int Pm_Read( PortMidiStream *stream, PmEvent *buffer, int32_t length );

/**
    Pm_Poll() tests whether input is available,
    returning TRUE, FALSE, or an error value.
*/
PMEXPORT PmError Pm_Poll( PortMidiStream *stream);

/**
    Pm_Write() writes midi data from a buffer. This may contain:
        - short messages
    or
        - sysex messages that are converted into a sequence of PmEvent
          structures, e.g. sending data from a file or forwarding them
          from midi input.

    Use Pm_WriteSysEx() to write a sysex message stored as a contiguous
    array of bytes.

    Sysex data may contain embedded real-time messages.
*/
PMEXPORT PmError Pm_Write( PortMidiStream *stream, PmEvent *buffer, int32_t length );

/**
    Pm_WriteShort() writes a timestamped non-system-exclusive midi message.
    Messages are delivered in order as received, and timestamps must be
    non-decreasing. (But timestamps are ignored if the stream was opened
    with latency = 0.)
*/
PMEXPORT PmError Pm_WriteShort( PortMidiStream *stream, PmTimestamp when, int32_t msg);

/**
    Pm_WriteSysEx() writes a timestamped system-exclusive midi message.
*/
PMEXPORT PmError Pm_WriteSysEx( PortMidiStream *stream, PmTimestamp when, unsigned char *msg);

/** @} */

#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* PORT_MIDI_H */


text:
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Jasmine Test Runner</title>
    <link rel="shortcut icon" type="image/png" href="../node_modules/jasmine-core/lib/images/jasmine_favicon.png">
    <link rel="stylesheet" href="../node_modules/jasmine-core/lib/jasmine-core/jasmine.css">

    <script type="text/javascript" src="../node_modules/requirejs/require.js"></script>
    <script type="text/javascript" src="config-for-minified-module.js"></script>
  </head>
  <body>
    <script type="text/javascript">
        require(["jasmine/jasmine"], function() {
          require(["jasmine/jasmine-html", "jasmine/boot"], function() {
              require(["test/all-specs"], function() {
                  window.onload();
              });
          });
      });
    </script>
  </body>
</html>


text:
import os
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), "./"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../"))

import xmlrunner
import unittest

from bin import example

class exampleTest(unittest.TestCase):

    def setUp(self):
        self.exampleClass = example.Example()

    def tearDown(self):
        pass

    def testPlusSuccess(self):

        self.assertEqual(self.exampleClass.Plus(1,2),3)

    def testMinusFail(self):

        self.assertEqual(self.exampleClass.Minus(2, 1), 3)

if __name__ == '__main__':
    unittest.main(testRunner=xmlrunner.XMLTestRunner(output="./python_unittests_xml"))


text:
timeflow
========
simple CLI time logger, inspired by `gtimelog <https://github.com/gtimelog/gtimelog>`_

.. image:: img/description.png

Description
-----------
``timeflow`` is a simple CLI time logger, used for logging your activities and
featuring simple statistics and reporting capabilities

``timeflow`` can be called using either ``tf`` or ``timeflow`` commands

Install
-------

``pip3 install timeflow``

Written in ``python3``. Best user experience with ``python3``.

Tutorial
-----------------
::

    to start working (message content is not important)
    >>> tf log "Arrived."

    to save a timestamp and your log message,
    when finished doing a task write
    >>> tf log "Timeflow: create README.rst"

    here 'Timeflow' is a 'project' you were working on and 'create README.rst'
    is a log of what you were exactly doing this time. Both project and log
    must be separated by a colon and space (``: ``).

    some tasks are not (payable) work, mark them with two asterisks (**)
    >>> tf log "Slack: chatting in the office ** "

    you can have 'projects' without any explanations
    >>> tf log "Lunch ** "
    >>> tf log "Daily Scrum"

    if you made a mistake, or missed to log of your activities
    you can edit like this
    >>> tf edit

    this way timeflow will try to run your editor set in $EDITOR
    or you can try
    >>> tf edit -e vim

    to open log file in vim

    to check how much you've worked today
    >>> tf stats

    or to make a report
    >>> tf stats --report

    you can pass date ranges for stats command, e.g.
    >>> tf stats --from 2015-01-01 --to 2015-01-31
    >>> tf stats --from 2015-01-01 --to 2015-01-31 --report

Commands & options
------------------
``log``
    ``log LOG_TEXT`` - create new log entry to timeflow's log file.

``edit``
    opens timeflow's log file, by default trying to open an editor used in ``$EDITOR`` environment variable.

    ``-e EDITOR`` - passes editor to be used in opening log file.

``stats``
    shows today's work and slack time.

    ``-y, --yesterday`` - shows yesterday's work and slack time.

    ``-d DATE, --day DATE`` - shows arbitrary day's work and slack time.

    ``--week WEEK_NUMBER`` - shows arbitrary week's work and slack time.

    ``--this-week`` - shows this week's work and slack time.

    ``--last-week`` - shows last week's work and slack time.

    ``--month MONTH_NUMBER`` - shows arbitrary month's work and slack time.

    ``--this-month`` - shows this month's work and slack time.

    ``--last-month`` - shows last month's work and slack time.

    ``-f DATE, --from DATE`` - shows work and slack time, from DATE until today, if ``--to`` option is not used.

    ``-t DATE, --to DATE`` - shows work and slack time, up to DATE. Must be used with ``--from`` option.

    ``--report`` - shows report for today, or some other time range if specified using available options.

    ``--report-as-gtimelog`` - same as ``--report``, but the output is like in `gtimelog <https://github.com/gtimelog/gtimelog>`_