text:
The sample source codes on this page will demonstrate you how to make text fits page diagonal in C#. ByteScout Watermarking SDK was made to help with text fits page diagonal in C#. ByteScout Watermarking SDK is the library for software developers that can be used to quickly add image watermarking features into your web or desktop applications. Use ready to use presets or create your own to be applied for input PNG, JPG, BMP images. Can customize fonts, text position and rotation if required.

You will save a lot of time on writing and testing code as you may just take the code below and use it in your application. This C# sample code should be copied and pasted into your project. After doing this just compile your project and click Run. Further enhancement of the code will make it more vigorous.

Our website provides free trial version of ByteScout Watermarking SDK that includes source code samples to help with your C# project.

## REQUEST FREE TECH SUPPORT

[Click here to get in touch](https://bytescout.zendesk.com/hc/en-us/requests/new?subject=ByteScout%20Watermarking%20SDK%20Question)

or just send email to [support@bytescout.com](mailto:support@bytescout.com?subject=ByteScout%20Watermarking%20SDK%20Question)

## ON-PREMISE OFFLINE SDK

[Get Your 60 Day Free Trial](https://bytescout.com/download/web-installer?utm_source=github-readme)
[Explore SDK Docs](https://bytescout.com/documentation/index.html?utm_source=github-readme)
[Sign Up For Online Training](https://academy.bytescout.com/)

## ON-DEMAND REST WEB API

[Get your API key](https://pdf.co/documentation/api?utm_source=github-readme)
[Explore Web API Documentation](https://pdf.co/documentation/api?utm_source=github-readme)
[Explore Web API Samples](https://github.com/bytescout/ByteScout-SDK-SourceCode/tree/master/PDF.co%20Web%20API)

## VIDEO REVIEW

[https://www.youtube.com/watch?v=NEwNs2b9YN8](https://www.youtube.com/watch?v=NEwNs2b9YN8)

<!-- code block begin -->

##### ****Program.cs:**

```
using System;
using System.Diagnostics;
using System.Drawing;
using System.Collections.Generic;
using Bytescout.Watermarking;
using Bytescout.Watermarking.Presets;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create Watermarker instance
            Watermarker waterMarker = new Watermarker();

            // Initialize library
            waterMarker.InitLibrary("demo", "demo");

            // Set input file name
            string inputFilePath = "my_sample_image.jpg";
            // Set output file title
            string outputFilePath = "my_sample_output.jpg";

            // Add image to apply watermarks to
            waterMarker.AddInputFile(inputFilePath, outputFilePath);

            // Create new watermark
            TextFitsPageDiagonal preset = new TextFitsPageDiagonal();

            // Set watermark text
            preset.Text = "Bytescout Watermarking";

            // Add watermark to watermarker
            waterMarker.AddWatermark(preset);

            // Set output directory
            waterMarker.OutputOptions.OutputDirectory = ".";

            // Apply watermarks
            waterMarker.Execute();

            // open generated image file in default image viewer installed in Windows
            Process.Start(outputFilePath);
        }
    }
}

```

<!-- code block end -->

<!-- code block begin -->

##### ****TextFitsPageDiagonal.VS2005.csproj:**

```
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AE0315F4-02E7-4764-AB85-80E205A10D4D}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>TextFitsPageDiagonal</RootNamespace>
    <AssemblyName>TextFitsPageDiagonal</AssemblyName>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.Watermarking, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****TextFitsPageDiagonal.VS2008.csproj:**

```
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.21022</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AE0315F4-02E7-4764-AB85-80E205A10D4D}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>TextFitsPageDiagonal</RootNamespace>
    <AssemblyName>TextFitsPageDiagonal</AssemblyName>
    <OldToolsVersion>2.0</OldToolsVersion>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.Watermarking, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****TextFitsPageDiagonal.VS2010.csproj:**

```
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>
    </ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AE0315F4-02E7-4764-AB85-80E205A10D4D}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>TextFitsPageDiagonal</RootNamespace>
    <AssemblyName>TextFitsPageDiagonal</AssemblyName>
    <OldToolsVersion>3.5</OldToolsVersion>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.Watermarking, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****TextFitsPageDiagonal.csproj:**

```
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AE0315F4-02E7-4764-AB85-80E205A10D4D}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>TextFitsPageDiagonal</RootNamespace>
    <AssemblyName>TextFitsPageDiagonal</AssemblyName>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.Watermarking, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->


text:
<!DOCTYPE html>
<title>CSS Position Absolute: dynamic changes to containing block height</title>
<link rel="author" href="mailto:atotic@google.com">

<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=933054">
<meta name="assert" content="Chrome regression: abspos descendant responds to containing block size change through line items">

redpajama_set_name: RedPajamaGithub


text:
/**
 * App Library.
 *
 * @module server/libraries/app
 */

const express = require('express');
const morgan = require('morgan');

const apiRoutes = require('../routes/api');
const webRoutes = require('../routes/web');
const ENV = require('../constants/env');
const PATHS = require('../constants/paths');

// Create express app.
const app = express();

// Logger for HTTP requests.
app.use(morgan(ENV.NODE === 'production' ? 'common' : 'dev'));

// Serve static files.
if (ENV.NODE === 'production') app.use(express.static(PATHS.PUBLIC));

// API routes.
app.use('/api', apiRoutes);

// Web page routes.
if (ENV.NODE === 'production') app.use('/', webRoutes);

module.exports = app;


text:
using Xunit;

namespace System.Xml.Tests
{
    public class DateTimeTests
    {
        [Fact]
        public static void ReadContentAsDateTime1()
        {
            var reader = Utils.CreateFragmentReader("<Root>0001-<![CDATA[01]]>-01T0<?a?>0:00:00<!-- Comment inbetween--></Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Equal(new DateTime(1, 1, 1, 0, 0, 0), (DateTime)reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime10()
        {
            var reader = Utils.CreateFragmentReader("<Root>  20<?a?>02-1<![CDATA[2]]>-3<!-- Comment inbetween-->0  </Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Equal(new DateTime(2002, 12, 30, 0, 0, 0), (DateTime)reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime11()
        {
            var reader = Utils.CreateFragmentReader("<Root>  <![CDATA[2]]>00<?a?>2-1<!-- Comment inbetween-->2-30Z  </Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Equal(new DateTime(2002, 12, 30, 0, 0, 0, 0).Add(new TimeSpan(0, 0, 0)), (DateTime)reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime12()
        {
            var reader = Utils.CreateFragmentReader("<Root>  <!-- Comment inbetween-->0002-01-01T00:00:00+00:00  </Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Equal(new DateTime(2, 1, 1, 0, 0, 0).Add(TimeZoneInfo.Local.GetUtcOffset(new DateTime(2, 1, 1))), (DateTime)reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime13()
        {
            var reader = Utils.CreateFragmentReader("<Root>001-01-01T00:00:00+00:00</Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime14()
        {
            var reader = Utils.CreateFragmentReader("<Root>99<?a?>99-12-31T12:59:59+14:00:00</Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime15()
        {
            var reader = Utils.CreateFragmentReader("<Root>0<?a?></Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime16()
        {
            var reader = Utils.CreateFragmentReader("<Root>  9<?a?>999 Z</Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime17()
        {
            var reader = Utils.CreateFragmentReader("<Root> ABC<?a?>D  </Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime18()
        {
            var reader = Utils.CreateFragmentReader("<Root>yyy<?a?>y-MM-ddTHH:mm</Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime19()
        {
            var reader = Utils.CreateFragmentReader("<Root>21<?a?>00-02-29T23:59:59.9999999+13:60  </Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime2()
        {
            var reader = Utils.CreateFragmentReader("<Root>99<!-- Comment inbetween-->99-1<?a?>2-31T1<![CDATA[2]]>:59:59</Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Equal(new DateTime(9999, 12, 31, 12, 59, 59), (DateTime)reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime20()
        {
            var reader = Utils.CreateFragmentReader("<Root>3  000-0<?a?>2-29T23:59:59.999999999999-13:60</Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime21()
        {
            var reader = Utils.CreateFragmentReader("<Root>2002-12-33</Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime22()
        {
            var reader = Utils.CreateFragmentReader("<Root  >2002-13-30  </Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime3()
        {
            var reader = Utils.CreateFragmentReader("<Root>  0<?a?>0:0<!-- Comment inbetween-->0:00+00:00   </Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Equal(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0, DateTimeKind.Utc).ToLocalTime(), (DateTime)reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime4()
        {
            var reader = Utils.CreateFragmentReader("<Root>00<!-- Comment inbetween-->01</Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Equal(new DateTime(1, 1, 1, 0, 0, 0), (DateTime)reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime5()
        {
            var reader = Utils.CreateFragmentReader("<Root>  999<!-- Comment inbetween-->9  </Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Equal(new DateTime(9999, 1, 1, 0, 0, 0), (DateTime)reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime6()
        {
            var reader = Utils.CreateFragmentReader("<Root>  <![CDATA[0]]>001Z  </Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Equal(new DateTime(1, 1, 1, 0, 0, 0, 0).Add(new TimeSpan(0, 0, 0)), (DateTime)reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime7()
        {
            var reader = Utils.CreateFragmentReader("<Root><![CDATA[9]]>999Z</Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Equal(new DateTime(9999, 1, 1, 0, 0, 0, 0).Add(new TimeSpan(0, 0, 0)), (DateTime)reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime8()
        {
            var reader = Utils.CreateFragmentReader("<Root>   2000-0<![CDATA[2]]>-29T23:59:59.999<?a?>9999   </Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Equal(new DateTime(2000, 2, 29, 23, 59, 59).AddTicks(9999999), (DateTime)reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTime9()
        {
            var reader = Utils.CreateFragmentReader("<Root>  2<?a?>00<!-- Comment inbetween-->0-02-29T23:59:5<?a?>9-13:<![CDATA[60]]>    </Root>");
            reader.PositionOnElement("Root");
            reader.Read();
            Assert.Equal(new DateTime(2000, 2, 29, 23, 59, 59).Add(TimeZoneInfo.Local.GetUtcOffset(new DateTime(2000, 2, 29)) + new TimeSpan(14, 0, 0)), (DateTime)reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTimeIsOutOfRange1()
        {
            var reader = Utils.CreateFragmentReader(@"<doc>   99<!-- Comment inbetween-->99-1<![CDATA[2]]>-31T01:60:5<?a?>9.99<?a?>9999<![CDATA[4]]>9<?Zz?>-00<![CDATA[:]]>00   </doc>");
            reader.PositionOnElementNoDoctype("doc");
            if (!reader.MoveToAttribute("a"))
                reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTimeIsOutOfRange2()
        {
            var reader = Utils.CreateFragmentReader(@"<f a='2002-02-29T23:59:59.9999999999999+13:61'/>");
            reader.PositionOnElementNoDoctype("f");
            if (!reader.MoveToAttribute("a"))
                reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTimeIsOutOfRange3()
        {
            var reader = Utils.CreateFragmentReader(@"<f a='2002-02-29T23:59:59.9999999999999+13:61'/>");
            reader.PositionOnElementNoDoctype("f");
            if (!reader.MoveToAttribute("a"))
                reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTimeOffset), null));
        }

        [Fact]
        public static void ReadContentAsDateTimeIsOutOfRange4()
        {
            var reader = Utils.CreateFragmentReader(@"<doc>   99<!-- Comment inbetween-->99-1<![CDATA[2]]>-31T01:60:5<?a?>9.99<?a?>9999<![CDATA[4]]>9<?Zz?>-00<![CDATA[:]]>00   </doc>");
            reader.PositionOnElementNoDoctype("doc");
            if (!reader.MoveToAttribute("a"))
                reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTimeOffset), null));
        }

        [Fact]
        public static void ReadContentAsDateTimeIsOutOfRangeDateTimeOffset1()
        {
            var reader = Utils.CreateFragmentReader(@"<doc>   99<!-- Comment inbetween-->99-1<![CDATA[2]]>-31T01:60:5<?a?>9.99<?a?>9999<![CDATA[4]]>9<?Zz?>-00<![CDATA[:]]>00   </doc>");
            reader.PositionOnElementNoDoctype("doc");
            if (!reader.MoveToAttribute("a"))
                reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTimeIsOutOfRangeDateTimeOffset2()
        {
            var reader = Utils.CreateFragmentReader(@"<f a='2002-02-29T23:59:59.9999999999999+13:61'/>");
            reader.PositionOnElementNoDoctype("f");
            if (!reader.MoveToAttribute("a"))
                reader.Read();
            Assert.Throws<XmlException>(() => reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTimeWithWhitespace1()
        {
            var reader = Utils.CreateFragmentReader(@"<doc>   9999-12-31   </doc>");
            reader.PositionOnElementNonEmptyNoDoctype("doc");
            reader.Read();
            Assert.Equal(new DateTime(9999, 12, 31, 0, 0, 0), reader.ReadContentAs(typeof(DateTime), null));
        }

        [Fact]
        public static void ReadContentAsDateTimeWithWhitespace2()
        {
            var reader = Utils.CreateFragmentReader(@"<doc>   9999-12-31   </doc>");
            reader.PositionOnElementNonEmptyNoDoctype("doc");
            reader.Read();
            Assert.Equal(new DateTimeOffset(9999, 12, 31, 0, 0, 0, TimeZoneInfo.Local.GetUtcOffset(new DateTime(9999, 12, 31))).ToString(), reader.ReadContentAs(typeof(DateTimeOffset), null).ToString());
        }
    }
}


text:
<HTML>
	<head>
		<title>ASGARD</title>
	</head>
	<body>
		<div style="text-align:center; vertical-align:middle; padding: 25%;">
			<form action="/listing" method="POST">	<input type="text" name="searched" style="width=40%" />	<input type="submit" value="Search" />	</form>
		</div>
	</body>
</HTML>


text:
package giniapi

import (
	"fmt"
	"testing"
)

func Test_Error(t *testing.T) {
	err := APIError{
		StatusCode: 500,
		Message:    "Error test",
		RequestID:  "12345",
		DocumentID: "67890",
	}

	assertEqual(t, err.Error(), "Error test (HTTP status: 500, RequestID: 12345, DocumentID: 67890)", "")
}

func Test_newHTTPError(t *testing.T) {
	err := fmt.Errorf("Something went wrong")
	e := newHTTPError("Error test", "12345", err, nil)

	assertEqual(t, e.Message, "Error test", "")
	assertEqual(t, e.DocumentID, "12345", "")
	assertEqual(t, e.Parent.Error(), "Something went wrong", "")
}


text:
class CefDOMDocumentImpl;

class CefDOMEventImpl : public CefDOMEvent {
 public:
  CefDOMEventImpl(CefRefPtr<CefDOMDocumentImpl> document,
                  const WebKit::WebDOMEvent& event);
  virtual ~CefDOMEventImpl();

  // CefDOMEvent methods.
  virtual CefString GetType() OVERRIDE;
  virtual Category GetCategory() OVERRIDE;
  virtual Phase GetPhase() OVERRIDE;
  virtual bool CanBubble() OVERRIDE;
  virtual bool CanCancel() OVERRIDE;
  virtual CefRefPtr<CefDOMDocument> GetDocument() OVERRIDE;
  virtual CefRefPtr<CefDOMNode> GetTarget() OVERRIDE;
  virtual CefRefPtr<CefDOMNode> GetCurrentTarget() OVERRIDE;

  // Will be called from CefDOMEventListenerWrapper::handleEvent().
  void Detach();

  // Verify that the object exists and is being accessed on the UI thread.
  bool VerifyContext();

 protected:
  CefRefPtr<CefDOMDocumentImpl> document_;
  WebKit::WebDOMEvent event_;

  IMPLEMENT_REFCOUNTING(CefDOMEventImpl);
};

#endif  // CEF_LIBCEF_DOM_EVENT_IMPL_H_


text:
/*
 * singleshrenderer.cpp
 *
 * Created on: 12.07.2012
 * @author Ralph Schurade
 */
#include "singleshrenderer.h"

#include "glfunctions.h"
#include "arcball.h"

#include "../../data/datasets/datasetdwi.h"
#include "../../data/enums.h"
#include "../../data/models.h"
#include "../../data/vptr.h"
#include "../../algos/fmath.h"
#include "../../algos/qball.h"

#include "../../data/mesh/tesselation.h"

#include "../../thirdparty/newmat10/newmat.h"

#include <QtOpenGL/QGLShaderProgram>
#include <QDebug>
#include <QVector3D>
#include <QMatrix4x4>

#include <limits>

SingleSHRenderer::SingleSHRenderer() :
    ObjectRenderer(),
    vboIds( new GLuint[ 2 ] ),
    m_width( 1 ),
    m_height( 1 ),
    m_ratio( 1.0 ),
    m_dx( 1.0 ),
    m_dy( 1.0 ),
    m_dz( 1.0 )
{
    m_arcBall = new ArcBall( 50, 50 );
}

SingleSHRenderer::~SingleSHRenderer()
{
}

void SingleSHRenderer::init()
{
}

void SingleSHRenderer::initGL()
{
    qDebug() << "gl init single sh widget";
    GLenum errorCode = glewInit();
    if ( GLEW_OK != errorCode )
    {
        qDebug() << "Problem: glewInit failed, something is seriously wrong.";
        qDebug() << glewGetErrorString( errorCode );
        exit( false );
    }
    else
    {
        //qDebug() << "OpenGL initialized.";
    }

    glGenBuffers( 2, vboIds );

    glClearColor( 0.0, 0.0, 0.0, 1.0 );

    glEnable( GL_DEPTH_TEST );

    glShadeModel( GL_SMOOTH );
    glEnable( GL_LIGHTING );
    glEnable( GL_LIGHT0 );
    glEnable( GL_MULTISAMPLE );
    static GLfloat lightPosition[ 4 ] = { 0.5, 5.0, -3000.0, 1.0 };
    glLightfv( GL_LIGHT0, GL_POSITION, lightPosition );
}

void SingleSHRenderer::resizeGL( int width, int height )
{
    m_width = width;
    m_height = height;

    m_arcBall->set_win_size( width, height );

    calcMVPMatrix();
}

void SingleSHRenderer::leftMouseDown( int x, int y )
{
    m_arcBall->click( x, y );
    calcMVPMatrix();
}

void SingleSHRenderer::leftMouseDrag( int x, int y )
{
    m_arcBall->drag( x, y );
    calcMVPMatrix();
}

void SingleSHRenderer::calcMVPMatrix()
{
    glViewport( 0, 0, m_width, m_height );
    m_ratio = static_cast< float >( m_width ) / static_cast< float >( m_height );

    m_arcBall->setRotCenter( 1., 1., 1. );

    // Reset projection
    QMatrix4x4 pMatrix;
    pMatrix.setToIdentity();

    if ( m_ratio >= 1.0 )
    {
        pMatrix.ortho( -m_ratio, m_ratio, -1., 1., -3000, 3000 );
    }
    else
    {
        pMatrix.ortho( -1., 1., -1. / m_ratio, 1. / m_ratio, -3000, 3000 );

    }

    m_mvpMatrix = pMatrix * m_arcBall->getMVMat();
}

void SingleSHRenderer::initGeometry()
{
    m_dx = m_dataset->properties()->get( Fn::Property::DX ).toFloat();
    m_dy = m_dataset->properties()->get( Fn::Property::DY ).toFloat();
    m_dz = m_dataset->properties()->get( Fn::Property::DZ ).toFloat();

    m_nx = m_dataset->properties()->get( Fn::Property::NX ).toInt();
    m_ny = m_dataset->properties()->get( Fn::Property::NY ).toInt();
    m_nz = m_dataset->properties()->get( Fn::Property::NZ ).toInt();

    float dx = Models::g()->data( Models::g()->index( (int)Fn::Global::SLICE_DX, 0 ) ).toFloat();
    float dy = Models::g()->data( Models::g()->index( (int)Fn::Global::SLICE_DY, 0 ) ).toFloat();
    float dz = Models::g()->data( Models::g()->index( (int)Fn::Global::SLICE_DZ, 0 ) ).toFloat();

    int xi = Models::g()->data( Models::g()->index( (int)Fn::Global::SAGITTAL, 0 ) ).toFloat() * ( dx / m_dx );
    int yi = Models::g()->data( Models::g()->index( (int)Fn::Global::CORONAL, 0 ) ).toFloat() * ( dy / m_dy );
    int zi = Models::g()->data( Models::g()->index( (int)Fn::Global::AXIAL, 0 ) ).toFloat() * ( dz / m_dz );

    xi = qMax( 0, qMin( xi, m_nx - 1) );
    yi = qMax( 0, qMin( yi, m_ny - 1) );
    zi = qMax( 0, qMin( zi, m_nz - 1) );

    int lod = 4; //m_dataset->getProperty( "lod" ).toInt();

    const Matrix* vertices = tess::vertices( lod );
    const int* faces = tess::faces( lod );
    int numVerts = tess::n_vertices( lod );
    int numTris = tess::n_faces( lod );

    int order = m_dataset->properties()->get( Fn::Property::ORDER ).toInt();

    Matrix base = ( FMath::sh_base( (*vertices), order ) );

    QString s = createSettingsString( { xi, yi, zi } );

    if ( s == m_previousSettings )
    {
        return;
    }
    m_previousSettings = s;

    QVector<ColumnVector>* data = m_dataset->getData();

    Matrix m = base * data->at( 0 );

    std::vector<float>verts;
    verts.reserve( numVerts * 10 );
    std::vector<int>indexes;
    indexes.reserve( numTris * 3 );
    m_tris = 0;

    if ( ( fabs( data->at( xi + yi * m_nx + zi * m_nx * m_ny )(1) ) > 0.0001 ) )
    {
        ColumnVector dv = data->at( xi + yi * m_nx + zi * m_nx * m_ny );
        ColumnVector r = base * dv;

        float max = 0;
        float min = std::numeric_limits<float>::max();
        for ( int i = 0; i < r.Nrows(); ++i )
        {
            max = qMax( max, (float)r(i+1) );
            min = qMin( min, (float)r(i+1) );
        }

        for ( int i = 0; i < r.Nrows(); ++i )
        {
            r(i+1) = r(i+1) / max * 0.8;
        }

        for ( int i = 0; i < numVerts; ++i )
        {
            verts.push_back( (*vertices)( i+1, 1 ) );
            verts.push_back( (*vertices)( i+1, 2 ) );
            verts.push_back( (*vertices)( i+1, 3 ) );
            verts.push_back( 1.0 );
            verts.push_back( 1.0 );
            verts.push_back( 1.0 );
            verts.push_back( r(i + 1) );
        }
        for ( int i = 0; i < numTris; ++i )
        {
            indexes.push_back( faces[i*3] );
            indexes.push_back( faces[i*3+1] );
            indexes.push_back( faces[i*3+2] );
        }
        m_tris = numTris * 3;
    }

    qDebug() << m_tris << " " << verts.size() << " " << indexes.size();

    glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIds[ 0 ] );
    glBufferData( GL_ELEMENT_ARRAY_BUFFER, indexes.size() * sizeof(GLuint), &indexes[0], GL_STATIC_DRAW );

    glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIds[ 1 ] );
    glBufferData( GL_ELEMENT_ARRAY_BUFFER, verts.size() * sizeof(GLfloat), &verts[0], GL_STATIC_DRAW );

}

void SingleSHRenderer::setupTextures()
{
}

void SingleSHRenderer::setShaderVars()
{
    QGLShaderProgram* program = GLFunctions::getShader( "qball" );

    program->bind();

    long int offset = 0;
    // Tell OpenGL programmable pipeline how to locate vertex position data
    int vertexLocation = program->attributeLocation( "a_position" );
    program->enableAttributeArray( vertexLocation );
    glVertexAttribPointer( vertexLocation, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 7, (const void *) offset );

    offset += sizeof(float) * 3;
    int offsetLocation = program->attributeLocation( "a_offset" );
    program->enableAttributeArray( offsetLocation );
    glVertexAttribPointer( offsetLocation, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 7, (const void *) offset );

    offset += sizeof(float) * 3;
    int radiusLocation = program->attributeLocation( "a_radius" );
    program->enableAttributeArray( radiusLocation );
    glVertexAttribPointer( radiusLocation, 1, GL_FLOAT, GL_FALSE, sizeof(float) * 7, (const void *) offset );
}

void SingleSHRenderer::draw()
{
    QList<int>rl;

    int countDatasets = model()->rowCount();
    for ( int i = 0; i < countDatasets; ++i )
    {
        QModelIndex index = model()->index( i, (int)Fn::Property::ACTIVE );
        if ( model()->data( index, Qt::DisplayRole ).toBool() )
        {
            index = model()->index( i, (int)Fn::Property::TYPE );
            if ( model()->data( index, Qt::DisplayRole ).toInt() == (int)Fn::DatasetType::NIFTI_SH )
            {
                rl.push_back( i );
                //qDebug() << "found QBall to render";
            }
        }
    }

    if ( rl.size() > 0 )
    {
        m_dataset = VPtr<DatasetDWI>::asPtr( model()->data( model()->index( rl[0], (int)Fn::Property::DATASET_POINTER ), Qt::DisplayRole ) );
        initGeometry();
    }
    else
    {
        m_tris = 0;
    }

    if ( m_tris != 0 )
    {
        GLFunctions::getShader( "qball" )->bind();
        // Set modelview-projection matrix
        GLFunctions::getShader( "qball" )->setUniformValue( "mvp_matrix", m_mvpMatrix );
        GLFunctions::getShader( "qball" )->setUniformValue( "mv_matrixInvert", m_arcBall->getMVMat().inverted() );

        bool hnl = m_dataset->properties()->get( Fn::Property::HIDE_NEGATIVE_LOBES ).toBool();
        GLFunctions::getShader( "qball" )->setUniformValue( "u_hideNegativeLobes", hnl );
        GLFunctions::getShader( "qball" )->setUniformValue( "u_renderMode", 0 );

        glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

        glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIds[ 0 ] );
        glBindBuffer( GL_ARRAY_BUFFER, vboIds[ 1 ] );

        setShaderVars();

        glDrawElements( GL_TRIANGLES, m_tris, GL_UNSIGNED_INT, 0 );

        glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 );
        glBindBuffer( GL_ARRAY_BUFFER, 0 );
    }
}


text:
#ifndef __PLATFORM_H
#define __PLATFORM_H

/* Some fwd declarations for types used further down */
struct phb;
struct pci_device;
struct errorlog;

enum resource_id {
	RESOURCE_ID_KERNEL,
	RESOURCE_ID_INITRAMFS,
	RESOURCE_ID_CAPP,
};
#define RESOURCE_SUBID_NONE 0
#define RESOURCE_SUBID_SUPPORTED 1

/*
 * Each platform can provide a set of hooks
 * that can affect the generic code
 */
struct platform {
	const char	*name;

	/*
	 * Probe platform, return true on a match, called before
	 * any allocation has been performed outside of the heap
	 * so the platform can perform additional memory reservations
	 * here if needed.
	 *
	 * Only the boot CPU is running at this point and the cpu_thread
	 * structure for secondaries have not been initialized yet. The
	 * timebases are not synchronized.
	 *
	 * Services available:
	 *
	 * - Memory allocations / reservations
	 * - XSCOM
	 * - FSI
	 * - Host Services
	 */
	bool		(*probe)(void);

	/*
	 * This is called right after the secondary processors are brought
	 * up and the timebases in sync to perform any additional platform
	 * specific initializations. On FSP based machines, this is where
	 * the FSP driver is brought up.
	 */
	void		(*init)(void);

	/*
	 * These are used to power down and reboot the machine
	 */
	int64_t		(*cec_power_down)(uint64_t request);
	int64_t		(*cec_reboot)(void);

	/*
	 * This is called once per PHB before probing. It allows the
	 * platform to setup some PHB private data that can be used
	 * later on by calls such as pci_get_slot_info() below. The
	 * "index" argument is the PHB index within the IO HUB (or
	 * P8 chip).
	 *
	 * This is called before the PHB HW has been initialized.
	 */
	void		(*pci_setup_phb)(struct phb *phb, unsigned int index);

	/*
	 * Called during PCI scan for each device. For bridges, this is
	 * called before its children are probed. This is called for
	 * every device and for the PHB itself with a NULL pd though
	 * typically the implementation will only populate the slot
	 * info structure for bridge ports
	 */
	void		(*pci_get_slot_info)(struct phb *phb,
					     struct pci_device *pd);

	/*
	 * Called after PCI probe is complete and before inventory is
	 * displayed in console. This can either run platform fixups or
	 * can be used to send the inventory to a service processor.
	 */
	void		(*pci_probe_complete)(void);

	/*
	 * If the above is set to skiboot, the handler is here
	 */
	void		(*external_irq)(unsigned int chip_id);

	/*
	 * nvram ops.
	 *
	 * Note: To keep the FSP driver simple, we only ever read the
	 * whole nvram once at boot and we do this passing a dst buffer
	 * that is 4K aligned. The read is asynchronous, the backend
	 * must call nvram_read_complete() when done (it's allowed to
	 * do it recursively from nvram_read though).
	 */
	int		(*nvram_info)(uint32_t *total_size);
	int		(*nvram_start_read)(void *dst, uint32_t src,
					    uint32_t len);
	int		(*nvram_write)(uint32_t dst, void *src, uint32_t len);

	/*
	 * OCC timeout. This return how long we should wait for the OCC
	 * before timing out. This lets us use a high value on larger FSP
	 * machines and cut it off completely on BML boots and OpenPower
	 * machines without pre-existing OCC firmware. Returns a value in
	 * seconds.
	 */
	uint32_t	(*occ_timeout)(void);

	int		(*elog_commit)(struct errorlog *buf);

	/*
	 * Initiate loading an external resource (e.g. kernel payload, OCC)
	 * into a preallocated buffer.
	 * This is designed to asynchronously load external resources.
	 * Returns OPAL_SUCCESS or error.
	 */
	int		(*start_preload_resource)(enum resource_id id,
						  uint32_t idx,
						  void *buf, size_t *len);

	/*
	 * Returns true when resource is loaded.
	 * Only has to return true once, for the
	 * preivous start_preload_resource call for this resource.
	 * If not implemented, will return true and start_preload_resource
	 * *must* have synchronously done the load.
	 * Retruns OPAL_SUCCESS, OPAL_BUSY or an error code
	 */
	int		(*resource_loaded)(enum resource_id id, uint32_t idx);

	/*
	 * Executed just prior to handing control over to the payload.
	 */
	void		(*exit)(void);

	/*
	 * Read a sensor value
	 */
	int64_t		(*sensor_read)(uint32_t sensor_hndl, int token,
				       uint32_t *sensor_data);

	/*
	 * OPAL terminate
	 */
	void __attribute__((noreturn)) (*terminate)(const char *msg);
};

extern struct platform __platforms_start;
extern struct platform __platforms_end;

extern struct platform	platform;

#define DECLARE_PLATFORM(name)\
static const struct platform __used __section(".platforms") name ##_platform

extern void probe_platform(void);

extern int start_preload_resource(enum resource_id id, uint32_t subid,
				  void *buf, size_t *len);

extern int resource_loaded(enum resource_id id, uint32_t idx);

extern int wait_for_resource_loaded(enum resource_id id, uint32_t idx);

extern void mambo_sim_exit(void);

#endif /* __PLATFORM_H */


text:
import { compose, createStore, applyMiddleware } from 'redux';
import rootReducer from '../reducers';
import thunk from 'redux-thunk';

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

export default function configureStore(initialState) {
    const store = createStore(rootReducer, initialState, composeEnhancers(
        applyMiddleware(
            thunk
        )
    ));

    if (module.hot) {
        module.hot.accept('../reducers', () => {
            const nextReducer = require('../reducers');
            store.replaceReducer(nextReducer);
        });
    }

    return store;
}


text:
bool g_restart = false;
bool g_exit = false;
float g_max_x = 1.6f;
float g_max_y = 1.0f;
LoadingScreen *g_loadingscreen;
Settings *g_settings;
Layouts *g_layouts;

bool g_display_fps = false;

Mouse g_mouse;

App *g_app = NULL;

void App::init_settings(void)
{
	g_settings = new Settings;
	g_settings->read_from_file("sea.cfg");
}

void App::gl_check(void)
{
	const char* extensions[] = {
		"GL_EXT_framebuffer_object",
		"GL_ARB_vertex_buffer_object",
		"GL_ARB_shader_objects",
		"GL_ARB_vertex_shader",
		"GL_ARB_fragment_shader",
		"GL_ARB_shading_language_100",
		0
	};

	bool run = true;
	char str[1024];
	sprintf(str,"OpenGL version:  %s\n",glGetString(GL_VERSION));
	sprintf(str+strlen(str),"OpenGL vendor:   %s\n",glGetString(GL_VENDOR));
	sprintf(str+strlen(str),"OpenGL renderer: %s\n",glGetString(GL_RENDERER));
	sprintf(str+strlen(str),"GLSL version:    %s\n",glGetString(GL_SHADING_LANGUAGE_VERSION));
	sprintf(str+strlen(str),"\n");

	for(int i=0;extensions[i];++i) {
		bool res = Gl::is_available(extensions[i]);
		if (!res) run = false;
		sprintf(str+strlen(str),"%32s: %s\n",extensions[i],res ? "Yes" : "No");
	}

#ifndef NDEBUG
	printf("%s\n",str);
#endif

	if (!run) {
		sprintf(str+strlen(str),"\nThis app requires OpenGL with support for FBO and GLSL shaders\nTry to upgrade your graphic card drivers.\n\n");
#ifdef WIN32
#  ifdef MINGW
		MessageBox(NULL,(LPCSTR)str,(LPCSTR)"GL Error",MB_OK);
#  else
		MessageBox(NULL,(LPCWSTR)str,(LPCWSTR)"GL Error",MB_OK);
#endif
#else
		printf("%s",str);
#endif
		exit(-1);
	}
}

void App::mousebuttoncb_wrapper(int button, int action) { if (g_app) g_app->mousebutton_cb(button,action); }
void App::mousebutton_cb(int button,int action)
{
	if (action!=GLFW_PRESS)
		return;

	if (g_mode == MODE_MENU) {
		m_gamemenu->mouse_action(button);
	} else if (g_mode == MODE_CREDITS || g_mode == MODE_SCORES) {
		g_mode = MODE_MENU;
	} else if (g_mode == MODE_GAME) {
		if (g_current_game)
			g_current_game->mouse_cb(button,action);
	}
}

void App::mouseposcb_wrapper(int x, int y) { if (g_app) g_app->mousepos_cb(x,y); }
void App::mousepos_cb(int x,int y)
{
	if (g_mode == MODE_MENU) {
		m_gamemenu->mouse_moved();
	}
//		printf("%i,%i\n",x,y);
}

void App::mousewheelcb_wrapper(int pos) { if (g_app) g_app->mousewheel_cb(pos); }
void App::mousewheel_cb(int pos)
{
	static int last_pos = 0;
	int dir = 0;
	if (pos>last_pos)
		dir = -1;
	else if (pos<last_pos)
		dir = +1;
	last_pos = pos;

	if (g_mode == MODE_MENU) {
		m_gamemenu->mouse_wheel(dir);
	}

}

void App::keycb_wrapper(int key, int action) { if (g_app) g_app->keyboard_cb(key,action); }
void App::keyboard_cb(int key,int action)
{
	if (action!=GLFW_PRESS)
		return;

	if (key == GLFW_KEY_F4 &&
		(glfwGetKey(GLFW_KEY_LALT)==GLFW_PRESS || glfwGetKey(GLFW_KEY_RALT)==GLFW_PRESS)
		)
	{
		g_restart = false;
		g_exit = true;
		return;
	}

	if (!g_current_game || g_current_game->current_gamemode() != GM_GAMEOVER_HISCORE) {
		if (key == 'P') {
			g_timer->pause_toggle();
			return;
		}

		if (key == 'F') {
			g_display_fps = !g_display_fps;
			return;
		}
	}

	if (g_mode == MODE_MENU) {
		m_gamemenu->key_action(key);
	} else if (g_mode == MODE_CREDITS || g_mode == MODE_SCORES) {
		g_mode = MODE_MENU;
	} else if (g_mode == MODE_GAME) {
		if (g_current_game)
			g_current_game->keyboard_cb(key,action);
	}
}

void App::charcb_wrapper(int ch, int action) { if (g_app) g_app->character_cb(ch,action); }
void App::character_cb(int ch,int action)
{
	if (action!=GLFW_PRESS)
		return;

	if (g_mode == MODE_GAME) {
		if (g_current_game)
			g_current_game->character_cb(ch,action);
	}
}

App::App(void) :
	m_ctx(),m_fpscounter()
{
	g_exit = false;
	g_restart = false;

	init_settings();
	m_ctx = new Glfwapp("Sea Defender", *g_settings);
	m_ctx->reset_vsync(); // disable vsync (if set) as to not slow down the loading screen

	g_mouse.set_accel(g_settings->m_mouse_sensitivity);

	load_exts_entry_points();

	gl_check();

	g_loadingscreen = new LoadingScreen(*m_ctx);
	g_loadingscreen->update();

	g_layouts = new Layouts();
	g_loadingscreen->update();

	m_fpscounter = new FPScounter(0.33);

	// load all global resources, done here as most of them need valid GL context
	g_resources.load();

	g_loadingscreen->update();

	m_gamemenu = new GameMenu();
	g_loadingscreen->update();

	m_credits = new Credits();
	g_loadingscreen->update();

	m_hiscore = new HiScore("sea.hsc");
	g_loadingscreen->update();

	// glfwEnable(GLFW_KEY_REPEAT)
	glfwEnable(GLFW_SYSTEM_KEYS);
	glfwSetKeyCallback(App::keycb_wrapper);
	glfwSetCharCallback(App::charcb_wrapper);
	glfwSetMouseButtonCallback(App::mousebuttoncb_wrapper);
	glfwSetMousePosCallback(App::mouseposcb_wrapper);
	glfwSetMouseWheelCallback(App::mousewheelcb_wrapper);

	m_background = new Background();
	g_loadingscreen->update();

	g_loadingscreen->update();

	m_ctx->set_vsync(); // re-enable vsync (if set)
}

App::~App() {
	m_hiscore->save_to_file();

	delete m_ctx;
	delete m_fpscounter;
	delete m_gamemenu;
	delete g_settings; g_settings = NULL;
	delete g_layouts; g_layouts = NULL;
	delete m_background;
	delete m_credits;
	delete m_hiscore;

	g_resources.release();
}

void App::display_version(void)
{
	float scale = 0.5;
	const char * text = "VER: " VERSION;
	float size = g_resources.font->size_of_text(text,scale);
	g_resources.font->print_text(text,vec2(1.6f-size-0.02f, 1.01f-g_resources.font->line_sep()), scale, false);
}

void App::run_inner_loop(void)
{
  g_timer->update();
	g_mouse.update();

	if (g_current_game && g_current_game->ended()) {
		delete g_current_game;
		g_current_game = NULL;
	}

	if (glfwGetWindowParam(GLFW_ICONIFIED)==GL_TRUE && glfwGetWindowParam(GLFW_ACTIVE)==GL_FALSE)
		g_timer->pause();

	glDisable(GL_DEPTH_TEST);
	glDepthMask(GL_FALSE);
	glDisable(GL_BLEND);
	glDisable(GL_TEXTURE_2D);

	glLoadIdentity();

	m_background->draw_sky();

	m_background->draw_sea(true);

	if (g_current_game)
		g_current_game->draw_under();

	m_background->draw_sea(false); // redraw sea again with blending for ship color change, fill-rate hit, but is still faster than enabling depth check and blending only the ship (?)

	if (g_current_game)
		g_current_game->draw_over();

	glLoadIdentity();

	switch(g_mode) {
	case MODE_MENU:
		g_resources.font->print_text_with_shadow("Sea Defender",vec2(0.0,0.31), 2.0f, true, vec4(0.4f,0.7,0.9f,1.0));
		m_gamemenu->draw();
		display_version();
		break;
	case MODE_CREDITS:
		m_credits->draw();
		display_version();
		break;
	case MODE_SCORES:
		m_hiscore->draw();
		display_version();
		break;
	case MODE_GAME:
		break;
	default:
		// nop
		break;
	}

	if (g_timer->is_paused()) {
		glLoadIdentity();
		g_resources.font->print_text("**PAUSED**",vec2(0.0,0.9), 1.0f, true, vec4(0.1,1.0f,0.1f,1.0));
	}

	g_mouse.draw(g_resources.texture_crosshair);

//		glTranslatef(0.1,0.5,0.0);
//		draw_textured_quad(0.4,g_resources.texture_bubble,false);

	// display fps
	char fps[16];
	sprintf(fps,"FPS: %6.2f", m_fpscounter->next_frame());

	if (g_display_fps) {
		glLoadIdentity();
		m_background->darken_area(vec4(0,0,0.16f,0.035f),0.4f);
		g_resources.font->print_text(fps,vec2(0.0,0.0), 0.5f, false, vec4(1,0,0.2f,1.0));
	}
//		sleep(0.01) if @fps > 60.0
}

void App::run(void)
{
	while(true) {
		m_ctx->init_frame();

		m_ctx->set_ortho2D();

//      glClearColor(0.35f,0.55f,0.75f, 0);
		glClearColor(1.0,1.0,1.0, 1.0);

		glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

		run_inner_loop();

		m_ctx->end_frame();

		if (g_exit || m_ctx->window_closed())
			break;
	}
}

#ifdef WIN32
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
#else
int main(void)
#endif
{
	glfwInit();
	srand((unsigned int)time(NULL));

	g_timer = new Timer();

	do {
		g_app = new App;

		g_app->run();

		delete g_app;
		g_app = NULL;
	} while (g_restart);

	delete g_timer;

	return 0;
}


text:
FILE=neo-simple.pyxie

cd ../..
export PYTHONPATH=.
./bin/pyxie --profile arduino compile examples/neopixel/$FILE


text:
from __future__ import print_function

__author__ = 'Brian Wickman'

import os
import sys
import tempfile
import subprocess

from twitter.common.dirutil import safe_rmtree
from twitter.common.dirutil.chroot import RelativeChroot
from twitter.pants import Config
from twitter.pants.python.egg_builder import EggBuilder

class PythonThriftBuilder(object):
  """
    Thrift builder.
  """
  class UnknownPlatformException(Exception):
    def __init__(self, platform):
      Exception.__init__(self, "Unknown platform: %s!" % str(platform))
  class CodeGenerationException(Exception): pass

  def __init__(self, target, root_dir):
    self.target = target
    self.root = root_dir
    distdir = os.path.join(self.root, 'dist')
    self.chroot = RelativeChroot(root_dir, distdir, target.name)
    codegen_root = tempfile.mkdtemp(dir=self.chroot.path(), prefix='codegen.')
    self.codegen_root = os.path.relpath(codegen_root, self.chroot.path())
    self.detected_packages = set()
    self.detected_namespace_packages = set()

    # TODO: Temporary hack where we reparse pants.ini. Right now it's too difficult to plumb
    # it through, and this will all be ported to "new pants" soon anyway.
    config = Config.load()
    self.platmap = config.getdict('py', 'thrift-platmap')

  def __del__(self):
    self.cleanup()

  def packages(self):
    return self.detected_packages

  def cleanup(self):
    safe_rmtree(self.chroot.path())

  def thrift_binary(self, root_dir):
    uname = os.uname()
    platform = (uname[0].lower(), uname[4])
    if platform not in self.platmap:
      raise PythonThriftBuilder.UnknownPlatformException(platform)
    return os.path.join(root_dir, 'build-support', 'bin', 'thrift', *self.platmap[platform])

  def run_thrifts(self):
    for src in self.target.sources:
      if not self._run_thrift(src):
        raise PythonThriftBuilder.CodeGenerationException(
          "Could not generate .py from %s!" % src)

  def _run_thrift(self, source):
    thrift_file = source
    thrift_abs_path = os.path.join(self.root, self.target.target_base, thrift_file)
    thrift_abs_path = os.path.abspath(thrift_abs_path)

    args = [
      self.thrift_binary(self.root),
      '--gen',
      'py:new_style',
      '-o',
      self.codegen_root,
      thrift_abs_path]

    cwd = os.getcwd()
    os.chdir(self.chroot.path())
    try:
      po = subprocess.Popen(args)
    finally:
      os.chdir(cwd)
    rv = po.wait()
    if rv != 0:
      comm = po.communicate()
      print('thrift generation failed!', file=sys.stderr)
      print('STDOUT', file=sys.stderr)
      print(comm[0], file=sys.stderr)
      print('STDERR', file=sys.stderr)
      print(comm[1], file=sys.stderr)
    return rv == 0

  @staticmethod
  def path_to_module(path):
    return path.replace(os.path.sep, '.')

  def build_egg(self):
    # autogenerate the python files that we bundle up
    self.run_thrifts()

    genpy_root = os.path.join(self.chroot.path(), self.codegen_root, 'gen-py')
    for dir, _, files in os.walk(os.path.normpath(genpy_root)):
      reldir = os.path.relpath(dir, genpy_root)
      if reldir == '.': continue
      if '__init__.py' not in files: continue
      init_py_abspath = os.path.join(dir, '__init__.py')
      module_path = self.path_to_module(reldir)
      self.detected_packages.add(module_path)
      # A namespace package is one that is just a container for other
      # modules and subpackages. Setting their __init__.py files as follows
      # allows them to be distributed across multiple eggs. Without this you
      # couldn't have this egg share any package prefix with any other module
      # in any other egg or in the source tree.
      #
      # Note that the thrift compiler should always generate empty __init__.py
      # files, but we test for this anyway, just in case that changes.
      if len(files) == 1 and os.path.getsize(init_py_abspath) == 0:
        with open(init_py_abspath, 'wb') as f:
          f.write(b"__import__('pkg_resources').declare_namespace(__name__)")
        self.detected_namespace_packages.add(module_path)

    if not self.detected_packages:
      raise PythonThriftBuilder.CodeGenerationException(
        'No Thrift structures declared in %s!' % self.target)

    def dump_setup_py(packages, namespace_packages):
      boilerplate = """
from setuptools import setup

setup(name        = "%(target_name)s",
      version     = "dev",
      description = "autogenerated thrift bindings for %(target_name)s",
      package_dir = { "": "gen-py" },
      packages    = %(packages)s,
      namespace_packages = %(namespace_packages)s)
"""
      boilerplate = boilerplate % {
        'target_name': self.target._create_id(),
        'genpy_root': genpy_root,
        'packages': repr(list(packages)),
        'namespace_packages': repr(list(namespace_packages))
      }

      self.chroot.write(boilerplate.encode('utf-8'), os.path.join(self.codegen_root, 'setup.py'))
    dump_setup_py(self.detected_packages, self.detected_namespace_packages)

    egg_root = os.path.join(self.chroot.path(), self.codegen_root)
    egg_path = EggBuilder().build_egg(egg_root, self.target)
    return egg_path


text:
if which apt-get > /dev/null 2>&1; then
    yes | sudo apt update
    yes | sudo apt upgrade
    app='sudo apt-get install -f'
elif which dnf > /dev/null 2>&1; then
    yes | sudo dnf update
    yes | sudo dnf upgrade
    app='sudo dnf install --best --allowerasing'
elif which pacman > /dev/null 2>&1; then
    yes | sudo pacman -Syu
    app='sudo pacman -S'
elif which brew > /dev/null 2>&1; then
    app='brew install'
fi

# system install
yes | $app the_silver_searcher
yes | $app silversearcher-ag
yes | $app git
yes | $app tmux
yes | $app curl
yes | $app wget
yes | $app wireshark
yes | $app nmap
yes | $app python python-setuptools python-pip
yes | $app tor
yes | $app docker
yes | $app virtualbox

# pip
sudo pip install github3.py


text:
using System.Windows.Input;

namespace Xamarin.Forms.Controls.GalleryPages.PlatformSpecificsGalleries
{
	public class NavigationPageWindows : NavigationPage
	{
		public NavigationPageWindows(ICommand restore)
		{
			PushAsync(CreateRoot(restore));
			WindowsPlatformSpecificsGalleryHelpers.AddToolBarItems(this);

			BarBackgroundColor = Color.FromHex("6495ED");
		}

		ContentPage CreateRoot(ICommand restore)
		{
			var page = new ContentPage { Title = "Content Page Title" };

			var content = new StackLayout
			{
				VerticalOptions = LayoutOptions.Fill,
				HorizontalOptions = LayoutOptions.Fill
			};
			content.Children.Add(new Label
			{
				Text = "Navigation Page Windows Features",
				FontAttributes = FontAttributes.Bold,
				HorizontalTextAlignment = TextAlignment.Center,
				VerticalTextAlignment = TextAlignment.Center
			});

			content.Children.Add(WindowsPlatformSpecificsGalleryHelpers.CreateToolbarPlacementChanger(this));
			content.Children.Add(WindowsPlatformSpecificsGalleryHelpers.CreateAddRemoveToolBarItemButtons(this));

			var restoreButton = new Button { Text = "Back To Gallery" };
			restoreButton.Clicked += (sender, args) => restore.Execute(null);
			content.Children.Add(restoreButton);

			var navButton = new Button { Text = "Push Page (with no title)" };
			navButton.Clicked += (sender, args) => PushAsync(CreatePageWithNoTitle());
			content.Children.Add(navButton);

			page.Content = content;

			return page;
		}

		ContentPage CreatePageWithNoTitle()
		{
			var page = new ContentPage {  };

			var content = new StackLayout
			{
				VerticalOptions = LayoutOptions.Fill,
				HorizontalOptions = LayoutOptions.Fill
			};
			content.Children.Add(new Label
			{
				Text = "Page 2",
				FontAttributes = FontAttributes.Bold,
				HorizontalTextAlignment = TextAlignment.Center,
				VerticalTextAlignment = TextAlignment.Center
			});

			page.Content = content;

			return page;
		}
	}
}


text:
export declare const addFunction: (func: () => void) => void;
export declare const attachFunctions: () => void;


text:
// engine.cpp

#include "engine.h"

namespace juddperft {

	Engine::Engine()
	{
		Engine::isThinking = false;
		Engine::isPondering = false;
		Engine::ponderingActivated = false;
		Engine::stopSignal = false;
		Engine::depth = 8;
		Engine::forceMode = false;
		Engine::showThinking = true;
		Engine::nNumCores = MAX_THREADS;	// Hard maximum:
											// App should only ever dispatch std::min(concurrency, nNumCores, MAX_THREADS) threads
	}

	// global Engine instance:
	Engine theEngine;

} // namespace juddperft


text:
local common = require('test_scripts/SDL5_0/LowVoltage/common')
local runner = require('user_modules/script_runner')

--[[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false

--[[ Local Functions ]]
local function addResumptionData()
  common.rpcSend.AddCommand(1, 1)
end

local function checkResumptionData()
  common.rpcCheck.AddCommand(1, 1)
end

local function checkResumptionHMILevel()
  common.getMobileSession(1):ExpectNotification("OnHMIStatus",
    { hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" })
  common.getHMIConnection():ExpectRequest("BasicCommunication.ActivateApp")
  :Times(0)
end

local function checkAppId(pAppId, pData)
  if pData.params.application.appID ~= common.getHMIAppId(pAppId) then
    return false, "App " .. pAppId .. " is registered with not the same HMI App Id"
  end
  return true
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL, HMI, connect Mobile", common.start)
runner.Step("Register App ", common.registerApp)
runner.Step("PolicyTableUpdate", common.policyTableUpdate)
runner.Step("Activate app", common.activateApp)
runner.Step("Add resumption data for App ", addResumptionData)

runner.Title("Test")
runner.Step("Wait until Resumption Data is stored" , common.waitUntilResumptionDataIsStored)
runner.Step("Close mobile connection", common.cleanSessions)
runner.Step("Wait 35 sec before LOW_VOLTAGE", common.wait, {35000})
runner.Step("Send LOW_VOLTAGE signal", common.sendLowVoltageSignal)
runner.Step("Send WAKE_UP signal", common.sendWakeUpSignal)
runner.Step("Wait 5 sec before registration", common.wait, {5000})
runner.Step("Re-connect Mobile", common.connectMobile)
runner.Step("Re-register App, check resumption data and HMI level", common.reRegisterApp, {
  1, checkAppId, checkResumptionData, checkResumptionHMILevel, "SUCCESS", 5000
})

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)


text:
using namespace IECore;
using namespace IECoreScene;
using namespace IECoreHoudini;

namespace
{

InternedString g_meshInterpolation( "ieMeshInterpolation" );
InternedString g_linear( "linear" );
InternedString g_catmullClark( "catmullClark" );
InternedString g_normals( "N" );
IECore::InternedString g_Tags( "tags" );
IECore::InternedString g_uniqueTags( "__uniqueTags" );
static std::string attrName = "name";

GU_DetailHandle renderGeometryHandle( OBJ_Node* objNode, OP_Context context )
{
#if UT_MAJOR_VERSION_INT >= 18
	return objNode->getRenderGeometryHandle( context, false );
#else
	for (OP_Node *output : objNode->getOutputNodePtrs())
	{
		if (output->whichOutputNode() == 0)
		{
			if( SOP_Node *sop = output->castToSOPNode() )
			{
				return sop->getCookedGeoHandle( context, false );
			}
		}
	}
	return objNode->getRenderGeometryHandle( context, false );
#endif
}

/// ensure we have a normalised path with leading '/'
/// examples: '///a/b/c//d' -> '/a/b/c/d'
/// 'e/f/g' -> '/e/f/g'
/// unlike a regular normalise it doesn't handle .. or .
std::string normalisePath(const std::string& str)
{
	std::string cleanedPath;
	SceneInterface::Path p;
	SceneInterface::stringToPath(str, p);
	SceneInterface::pathToString(p, cleanedPath);
	return cleanedPath;
}

IntVectorDataPtr preprocessNames( PrimitiveVariable &primVar, int numIds )
{
	// we want to segment on indices rather than strings. the results are the
	// same but the comparison operations in the segment algorithm are quicker.
	primVar.data = primVar.indices;
	primVar.indices = nullptr;
	IntVectorDataPtr uniqueIds = new IntVectorData;
	auto &ids = uniqueIds->writable();
	ids.reserve( numIds );
	for( int i = 0; i < numIds; ++i )
	{
		ids.push_back( i );
	}

	return uniqueIds;
}

std::string postprocessNames( Primitive &primitive, const std::vector<std::string> &segmentNames )
{
	int id = runTimeCast<IntVectorData>( primitive.variables[attrName].data )->readable()[0];
	primitive.variables.erase( attrName );
	return segmentNames[id];
}

void processMeshInterpolation( MeshPrimitive &mesh, const std::string &name, CompoundData *blindData )
{
	// Set mesh interpolation and prune N where appropriate. Subdivision meshes should not have normals.
	// We assume this occurred because the geo contained both subdiv and linear meshes, inadvertantly
	// extending the normals attribute to all meshes in the detail.

	if( auto meshTypeMap = blindData->member<CompoundData>( g_meshInterpolation ) )
	{
		if( auto *meshType = meshTypeMap->member<BoolData>( name ) )
		{
			if( meshType->readable() )
			{
				mesh.setInterpolation( g_catmullClark );
				mesh.variables.erase( g_normals );
			}
		}
	}
}

void processTags( Primitive &primitive, const std::string &name, CompoundData *blindData )
{
	if( auto tagMap = blindData->member<CompoundData>( g_Tags ) )
	{
		if( auto *uniqueTagData = tagMap->member<InternedStringVectorData>( g_uniqueTags ) )
		{
			if( auto *membershipData = tagMap->member<BoolVectorData>( name ) )
			{
				const auto &uniqueTags = uniqueTagData->readable();
				const auto &membership = membershipData->readable();

				InternedStringVectorDataPtr tagData = new InternedStringVectorData;
				auto &tags = tagData->writable();
				for( size_t i = 0; i < membership.size(); ++i )
				{
					if( membership[i] )
					{
						tags.emplace_back( uniqueTags[i] );
					}
				}

				primitive.blindData()->writable()[g_Tags] = tagData;
			}
		}
	}
}

/// For a given detail get all the unique names
DetailSplitter::Names getNames( const GU_Detail *detail )
{
	std::unordered_set<InternedString> uniqueNames;
	DetailSplitter::Names allNames;

	GA_ROHandleS nameAttrib( detail, GA_ATTRIB_PRIMITIVE, GA_Names::name );
	if( !nameAttrib.isValid() )
	{
		return allNames;
	}

	const GA_Attribute *nameAttr = nameAttrib.getAttribute();
	std::vector<int> indexRemap;
	/// \todo: replace with GA_ROHandleS somehow... its not clear how, there don't seem to be iterators.
	const GA_AIFSharedStringTuple *tuple = nameAttr->getAIFSharedStringTuple();
	indexRemap.resize( tuple->getTableEntries( nameAttr ), -1 );
	int i = 0;
	for( GA_AIFSharedStringTuple::iterator it = tuple->begin( nameAttr ); !it.atEnd(); ++it, ++i )
	{
		allNames.push_back( it.getString() );
		indexRemap[it.getIndex()] = i;
	}

	GA_Offset start, end;
	for( GA_Iterator it( detail->getPrimitiveRange() ); it.blockAdvance( start, end ); )
	{
		for( GA_Offset offset = start; offset < end; ++offset )
		{
			int index = nameAttrib.getIndex( offset );
			if( index < 0 )
			{
				continue;
			}

			uniqueNames.insert( allNames[indexRemap[index]] );
		}
	}

	return DetailSplitter::Names( uniqueNames.begin(), uniqueNames.end() );
}

/// Generate a hash for Imath::V2f to allow it to be used in a std::unordered_map.
/// Accepted wisdom says we should define a template specialisation of hash in the std namespace
/// but perhaps that might be better done by the imath headers themselves?
class Hasher
{
	public:

		size_t operator()( const Imath::V2f &v ) const
		{
			size_t result = 0;
			boost::hash_combine( result, v.x );
			boost::hash_combine( result, v.y );
			return result;
		}
};

void weldUVs( std::vector<MeshPrimitivePtr> &meshes )
{
	std::vector<PrimitiveVariable*> uvVariables;
	for( auto mesh : meshes )
	{
		for( auto &kv : mesh->variables )
		{
			if( const auto *input = runTimeCast<V2fVectorData>( kv.second.data.get() ) )
			{
				if( input->getInterpretation() == GeometricData::UV )
				{
					uvVariables.push_back( &kv.second );
				}
			}
		}
	}

	tbb::parallel_for(
		tbb::blocked_range<size_t>( 0, uvVariables.size() ),
		[&uvVariables]( const tbb::blocked_range<size_t> &r )
		{
			for( auto i = r.begin(); i != r.end(); ++i )
			{
				// \todo: this is largely duplicated from FromHoudiniGeometryConverter. should it be a MeshAlgo?
				auto primVar = uvVariables[i];
				const auto *input = runTimeCast<V2fVectorData>( primVar->data.get() );
				const auto &inUvs = input->readable();

				V2fVectorDataPtr output = new V2fVectorData;
				output->setInterpretation( GeometricData::UV );
				auto &outUVs = output->writable();
				// this is an overestimate but should be safe
				outUVs.reserve( inUvs.size() );

				IntVectorDataPtr indexData = new IntVectorData;
				auto &indices = indexData->writable();

				std::unordered_map<Imath::V2f, size_t, Hasher> uniqueUVs;

				for( const auto &inUV : inUvs )
				{
					int newIndex = uniqueUVs.size();
					auto uvIt = uniqueUVs.insert( { inUV, newIndex } );
					if( uvIt.second )
					{
						indices.push_back( newIndex );
						outUVs.push_back( inUV );
					}
					else
					{
						indices.push_back( uvIt.first->second );
					}
				}

				primVar->data = output;
				primVar->indices = indexData;
			}
		}
	);
}

} // namespace

DetailSplitter::DetailSplitter( const GU_DetailHandle &handle, const std::string &key, bool useHoudiniSegment )
	: m_time( 0.0 ), m_objNode( nullptr ), m_lastMetaCount( -1 ), m_key( key ), m_handle( handle ), m_useHoudiniSegment( useHoudiniSegment )
{
}

DetailSplitter::DetailSplitter( OBJ_Node *objNode, double time, const std::string &key , bool useHoudiniSegment  )
	: m_time( time ),
	m_objNode( objNode ),
	m_lastMetaCount( -1 ),
	m_key( key ),
	m_useHoudiniSegment( useHoudiniSegment ),
	m_context( time ),
	m_handle( renderGeometryHandle( m_objNode, m_context ) )
{
}

DetailSplitter::~DetailSplitter()
{
}

const GU_DetailHandle &DetailSplitter::handle() const
{
	return m_handle;
}

const GU_DetailHandle DetailSplitter::split( const std::string &value )
{
	if ( !validate() )
	{
		return GU_DetailHandle();
	}

	Cache::const_iterator it = m_cache.find( value );
	if ( it != m_cache.end() )
	{
		return it->second;
	}

	return GU_DetailHandle();
}

IECore::ObjectPtr DetailSplitter::splitObject( const std::string& value)
{
	if ( !validate() )
	{
		return nullptr;
	}

	auto it = m_segmentMap.find( value );
	if ( it != m_segmentMap.end() )
	{
		return it->second;
	}

	return nullptr;
}

bool DetailSplitter::validate()
{
	GU_DetailHandleAutoReadLock readHandle( m_handle );
	const GU_Detail *geo = readHandle.getGdp();
	if ( !geo )
	{
		return false;
	}

	if ( geo->getMetaCacheCount() == m_lastMetaCount )
	{
		return true;
	}

	m_names = ::getNames( geo );

	if ( !m_pathMatcher )
	{
		m_pathMatcher = new IECore::PathMatcherData();
	}

	IECore::PathMatcher &pathMatcher = m_pathMatcher->writable();
	pathMatcher.clear();

	for( const auto &name : m_names )
	{
		pathMatcher.addPath( name );
	}

	m_cache.clear();
	m_lastMetaCount = geo->getMetaCacheCount();

	GA_ROHandleS attribHandle( geo, GA_ATTRIB_PRIMITIVE, m_key.c_str() );
	if( !attribHandle.isValid() )
	{
		m_cache[""] = m_handle;
		return true;
	}

	m_segmentMap.clear();

	if( !m_useHoudiniSegment )
	{
		auto converter = FromHoudiniGeometryConverter::create( m_handle );

		if ( converter )
		{
			converter->parameters()->parameter<BoolParameter>( "preserveName" )->setTypedValue( true );
			// disable UV welding during conversion to improve performance of the named segmentation.
			converter->parameters()->parameter<BoolParameter>( "weldUVs" )->setTypedValue( false );

			if( runTimeCast<FromHoudiniPolygonsConverter>( converter ) )
			{
				ObjectPtr o = converter->convert();
				MeshPrimitive *mesh = runTimeCast<MeshPrimitive>( o.get() );

				auto it = mesh->variables.find( attrName );
				if( it != mesh->variables.end() )
				{
					if( const StringVectorDataPtr nameData = runTimeCast<StringVectorData>( it->second.data ) )
					{
						const std::vector<std::string> &segmentNames = nameData->readable();
						IntVectorDataPtr uniqueIds = ::preprocessNames( it->second, segmentNames.size() );
						std::vector<MeshPrimitivePtr> segments = MeshAlgo::segment( mesh, it->second, uniqueIds.get() );
						// weld the mesh UVs to prevent discontinuity when subdivided
						::weldUVs( segments );
						for( size_t i = 0; i < segments.size(); ++i )
						{
							std::string name = ::postprocessNames( *segments[i], segmentNames );
							::processMeshInterpolation( *segments[i], name, mesh->blindData() );
							::processTags( *segments[i], name, mesh->blindData() );
							m_segmentMap[normalisePath( name )] = segments[i];
						}
						return true;
					}
				}
			}
			else if( runTimeCast<FromHoudiniCurvesConverter>( converter ) )
			{
				ObjectPtr o = converter->convert();
				CurvesPrimitive *curves = runTimeCast<CurvesPrimitive>( o.get() );

				auto it = curves->variables.find( attrName );
				if( it != curves->variables.end() )
				{
					if( const StringVectorDataPtr nameData = runTimeCast<StringVectorData>( it->second.data ) )
					{
						const std::vector<std::string> &segmentNames = nameData->readable();
						IntVectorDataPtr uniqueIds = ::preprocessNames( it->second, segmentNames.size() );
						std::vector<CurvesPrimitivePtr> segments = CurvesAlgo::segment( curves, it->second, uniqueIds.get() );
						for( size_t i = 0; i < segments.size(); ++i )
						{
							std::string name = ::postprocessNames( *segments[i], segmentNames );
							::processTags( *segments[i], name, curves->blindData() );
							m_segmentMap[normalisePath( name )] = segments[i];
						}
						return true;
					}
				}
			}
			else if( runTimeCast<FromHoudiniPointsConverter>( converter ) )
			{
				ObjectPtr o = converter->convert();
				PointsPrimitive *points = runTimeCast<PointsPrimitive>( o.get() );

				auto it = points->variables.find( attrName );
				if( it != points->variables.end() )
				{
					if( const StringVectorDataPtr nameData = runTimeCast<StringVectorData>( it->second.data ) )
					{
						const std::vector<std::string> &segmentNames = nameData->readable();
						IntVectorDataPtr uniqueIds = ::preprocessNames( it->second, segmentNames.size() );
						std::vector<PointsPrimitivePtr> segments = PointsAlgo::segment( points, it->second, uniqueIds.get() );
						for( size_t i = 0; i < segments.size(); ++i )
						{
							std::string name = ::postprocessNames( *segments[i], segmentNames );
							::processTags( *segments[i], name, points->blindData() );
							m_segmentMap[normalisePath( name )] = segments[i];
						}
						return true;
					}
				}
			}
		}
	}

	std::map<GA_StringIndexType, GA_OffsetList> offsets;

	GA_Offset start, end;
	for( GA_Iterator it( geo->getPrimitiveRange() ); it.blockAdvance( start, end ); )
	{
		for( GA_Offset offset = start; offset < end; ++offset )
		{
			GA_StringIndexType currentHandle = attribHandle.getIndex( offset );

			auto oIt = offsets.insert( { currentHandle, GA_OffsetList() } ).first;
			oIt->second.append( offset );
		}
	}

	const GA_Attribute *attr = attribHandle.getAttribute();
	const GA_AIFSharedStringTuple *tuple = attr->getAIFSharedStringTuple();
	for( const auto &kv : offsets )
	{
		GU_Detail *newGeo = new GU_Detail();
		GA_Range matchPrims( geo->getPrimitiveMap(), kv.second );
		newGeo->mergePrimitives( *geo, matchPrims );
		newGeo->bumpAllDataIds();
		newGeo->incrementMetaCacheCount();

		GU_DetailHandle handle;
		handle.allocateAndSet( newGeo, true );

		std::string current = "";
		if( const char *value = tuple->getTableString( attr, kv.first ) )
		{
			current = value;
		}

		m_cache[current] = handle;
	}

	return !m_cache.empty();
}

void DetailSplitter::values( std::vector<std::string> &result )
{
	/// \todo: do we really want this method to create the cache? should it just look at the names instead?
	if ( !validate() )
	{
		return;
	}

	result.clear();
	result.reserve( m_cache.size() );

	for ( Cache::iterator it = m_cache.begin(); it != m_cache.end(); ++it )
	{
		result.push_back( it->first );
	}
}

DetailSplitter::Names DetailSplitter::getNames(const std::vector<IECore::InternedString>& path)
{
	Names names;

	if ( !validate())
	{
		return names;
	}

	IECore::PathMatcher subTree = m_pathMatcher->readable().subTree( path );
	for ( IECore::PathMatcher::RawIterator it = subTree.begin(); it != subTree.end(); ++it )
	{
		if ( !it->empty() )
		{
			names.push_back( *it->rbegin() );
			it.prune();
		}
	}

	return names;
}

bool DetailSplitter::hasPath( const IECoreScene::SceneInterface::Path& path, bool isExplicit )
{
	if ( !validate() )
	{
		return false;
	}

	if ( isExplicit )
	{
		PathMatcher::RawIterator rawIt = m_pathMatcher->readable().find( path );

		return rawIt != m_pathMatcher->readable().end() && rawIt.exactMatch();
	}

	return 	m_pathMatcher->readable().find( path ) != m_pathMatcher->readable().end();
}

bool DetailSplitter::hasPaths()
{
	if ( !validate() )
	{
		return false;
	}
	return m_pathMatcher && !m_pathMatcher->readable().isEmpty();
}

bool DetailSplitter::update( OBJ_Node *objNode, double time )
{
	if ( m_objNode == objNode && time == m_time)
	{
		return false;
	}

	m_time = time;
	m_objNode = objNode;
	m_lastMetaCount = -1;
	m_context = OP_Context( time );
	m_handle = renderGeometryHandle( m_objNode, m_context );

	m_pathMatcher.reset();
	m_names.clear();
	m_segmentMap.clear();
	m_cache.clear();

	return true;
}


text:
#include <Param.hpp>
#include <backend.hpp>
#include <common/Binary.hpp>
#include <common/Transform.hpp>
#include <common/dispatch.hpp>
#include <debug_oneapi.hpp>
#include <err_oneapi.hpp>
#include <kernel/default_config.hpp>
#include <memory.hpp>

namespace oneapi {
namespace kernel {

template<typename T, int dimensions>
using local_accessor =
    sycl::accessor<T, dimensions, sycl::access::mode::read_write,
                   sycl::access::target::local>;

template<typename T>
using read_accessor = sycl::accessor<T, 1, sycl::access::mode::read>;

template<typename T>
using write_accessor = sycl::accessor<T, 1, sycl::access::mode::write>;

template<typename Ti, typename To, af_op_t op, int dim>
class scanDimKernel {
   public:
    scanDimKernel(write_accessor<To> out_acc, KParam oInfo,
                  write_accessor<To> tmp_acc, KParam tInfo,
                  read_accessor<Ti> in_acc, KParam iInfo, const uint groups_x,
                  const uint groups_y, const uint blocks_dim, const uint lim,
                  const bool isFinalPass, const uint DIMY,
                  const bool inclusive_scan, local_accessor<To, 1> s_val,
                  local_accessor<To, 1> s_tmp, sycl::stream debug)
        : out_acc_(out_acc)
        , tmp_acc_(tmp_acc)
        , in_acc_(in_acc)
        , oInfo_(oInfo)
        , tInfo_(tInfo)
        , iInfo_(iInfo)
        , groups_x_(groups_x)
        , groups_y_(groups_y)
        , blocks_dim_(blocks_dim)
        , lim_(lim)
        , DIMY_(DIMY)
        , isFinalPass_(isFinalPass)
        , inclusive_scan_(inclusive_scan)
        , s_val_(s_val)
        , s_tmp_(s_tmp)
        , debug_(debug) {}

    void operator()(sycl::nd_item<2> it) const {
        sycl::group g   = it.get_group();
        const uint lidx = it.get_local_id(0);
        const uint lidy = it.get_local_id(1);
        const uint lid  = lidy * g.get_local_range(0) + lidx;

        const uint zid       = g.get_group_id(0) / groups_x_;
        const uint wid       = g.get_group_id(1) / groups_y_;
        const uint groupId_x = g.get_group_id(0) - (groups_x_)*zid;
        const uint groupId_y = g.get_group_id(1) - (groups_y_)*wid;
        const uint xid       = groupId_x * g.get_local_range(0) + lidx;
        const uint yid       = groupId_y;

        uint ids[4] = {xid, yid, zid, wid};

        const Ti *iptr = in_acc_.get_pointer();
        To *optr       = out_acc_.get_pointer();
        To *tptr       = tmp_acc_.get_pointer();

        // There is only one element per block for out
        // There are blockDim.y elements per block for in
        // Hence increment ids[dim] just after offseting out and before
        // offsetting in
        tptr += ids[3] * tInfo_.strides[3] + ids[2] * tInfo_.strides[2] +
                ids[1] * tInfo_.strides[1] + ids[0];

        const int groupIdx_dim = ids[dim];
        ids[dim]               = ids[dim] * g.get_local_range(1) * lim_ + lidy;

        optr += ids[3] * oInfo_.strides[3] + ids[2] * oInfo_.strides[2] +
                ids[1] * oInfo_.strides[1] + ids[0];
        iptr += ids[3] * iInfo_.strides[3] + ids[2] * iInfo_.strides[2] +
                ids[1] * iInfo_.strides[1] + ids[0];
        int id_dim        = ids[dim];
        const int out_dim = oInfo_.dims[dim];

        bool is_valid = (ids[0] < oInfo_.dims[0]) &&
                        (ids[1] < oInfo_.dims[1]) &&
                        (ids[2] < oInfo_.dims[2]) && (ids[3] < oInfo_.dims[3]);

        const int ostride_dim = oInfo_.strides[dim];
        const int istride_dim = iInfo_.strides[dim];

        To *sptr = s_val_.get_pointer() + lid;

        common::Transform<Ti, To, op> transform;
        common::Binary<To, op> binop;

        const To init = common::Binary<To, op>::init();
        To val        = init;

        const bool isLast = (lidy == (DIMY_ - 1));

        for (int k = 0; k < lim_; k++) {
            if (isLast) s_tmp_[lidx] = val;

            bool cond = (is_valid) && (id_dim < out_dim);
            val       = cond ? transform(*iptr) : init;
            *sptr     = val;
            group_barrier(g);

            int start = 0;
#pragma unroll
            for (int off = 1; off < DIMY_; off *= 2) {
                if (lidy >= off)
                    val = binop(val, sptr[(start - off) * (int)THREADS_X]);
                start                   = DIMY_ - start;
                sptr[start * THREADS_X] = val;

                group_barrier(g);
            }

            val = binop(val, s_tmp_[lidx]);
            if (inclusive_scan_) {
                if (cond) { *optr = val; }
            } else if (is_valid) {
                if (id_dim == (out_dim - 1)) {
                    *(optr - (id_dim * ostride_dim)) = init;
                } else if (id_dim < (out_dim - 1)) {
                    *(optr + ostride_dim) = val;
                }
            }
            id_dim += g.get_local_range(1);
            iptr += g.get_local_range(1) * istride_dim;
            optr += g.get_local_range(1) * ostride_dim;
            group_barrier(g);
        }

        if (!isFinalPass_ && is_valid && (groupIdx_dim < tInfo_.dims[dim]) &&
            isLast) {
            *tptr = val;
        }
    }

   protected:
    write_accessor<To> out_acc_;
    write_accessor<To> tmp_acc_;
    read_accessor<Ti> in_acc_;
    KParam oInfo_, tInfo_, iInfo_;
    const uint groups_x_, groups_y_, blocks_dim_, lim_, DIMY_;
    const bool isFinalPass_, inclusive_scan_;
    local_accessor<To, 1> s_val_;
    local_accessor<To, 1> s_tmp_;
    sycl::stream debug_;
};

template<typename To, af_op_t op, int dim>
class scanDimBcastKernel {
   public:
    scanDimBcastKernel(write_accessor<To> out_acc, KParam oInfo,
                       read_accessor<To> tmp_acc, KParam tInfo,
                       const uint groups_x, const uint groups_y,
                       const uint groups_dim, const uint lim,
                       const bool inclusive_scan, sycl::stream debug)
        : out_acc_(out_acc)
        , tmp_acc_(tmp_acc)
        , oInfo_(oInfo)
        , tInfo_(tInfo)
        , groups_x_(groups_x)
        , groups_y_(groups_y)
        , groups_dim_(groups_dim)
        , lim_(lim)
        , inclusive_scan_(inclusive_scan)
        , debug_(debug) {}

    void operator()(sycl::nd_item<2> it) const {
        sycl::group g   = it.get_group();
        const uint lidx = it.get_local_id(0);
        const uint lidy = it.get_local_id(1);

        const uint zid       = g.get_group_id(0) / groups_x_;
        const uint wid       = g.get_group_id(1) / groups_y_;
        const uint groupId_x = g.get_group_id(0) - (groups_x_)*zid;
        const uint groupId_y = g.get_group_id(1) - (groups_y_)*wid;
        const uint xid       = groupId_x * g.get_local_range(0) + lidx;
        const uint yid       = groupId_y;

        uint ids[4] = {xid, yid, zid, wid};

        const To *tptr = tmp_acc_.get_pointer();
        To *optr       = out_acc_.get_pointer();

        // There is only one element per block for out
        // There are blockDim.y elements per block for in
        // Hence increment ids[dim] just after offseting out and before
        // offsetting in
        tptr += ids[3] * tInfo_.strides[3] + ids[2] * tInfo_.strides[2] +
                ids[1] * tInfo_.strides[1] + ids[0];

        const int groupIdx_dim = ids[dim];
        ids[dim]               = ids[dim] * g.get_local_range(1) * lim_ + lidy;

        optr += ids[3] * oInfo_.strides[3] + ids[2] * oInfo_.strides[2] +
                ids[1] * oInfo_.strides[1] + ids[0];
        const int id_dim  = ids[dim];
        const int out_dim = oInfo_.dims[dim];

        // Shift broadcast one step to the right for exclusive scan (#2366)
        int offset = inclusive_scan_ ? 0 : oInfo_.strides[dim];
        optr += offset;

        bool is_valid = (ids[0] < oInfo_.dims[0]) &&
                        (ids[1] < oInfo_.dims[1]) &&
                        (ids[2] < oInfo_.dims[2]) && (ids[3] < oInfo_.dims[3]);

        if (!is_valid) return;
        if (groupIdx_dim == 0) return;

        To accum = *(tptr - tInfo_.strides[dim]);

        common::Binary<To, op> binop;
        const int ostride_dim = oInfo_.strides[dim];

        for (int k = 0, id = id_dim; is_valid && k < lim_ && (id < out_dim);
             k++, id += g.get_local_range(1)) {
            *optr = binop(*optr, accum);
            optr += g.get_local_range(1) * ostride_dim;
        }
    }

   protected:
    write_accessor<To> out_acc_;
    read_accessor<To> tmp_acc_;
    KParam oInfo_, tInfo_;
    const uint groups_x_, groups_y_, groups_dim_, lim_;
    const bool inclusive_scan_;
    sycl::stream debug_;
};

template<typename Ti, typename To, af_op_t op, int dim>
static void scan_dim_launcher(Param<To> out, Param<To> tmp, Param<Ti> in,
                              const uint threads_y, const dim_t blocks_all[4],
                              bool isFinalPass, bool inclusive_scan) {
    sycl::range<2> local(THREADS_X, threads_y);
    sycl::range<2> global(blocks_all[0] * blocks_all[2] * local[0],
                          blocks_all[1] * blocks_all[3] * local[1]);

    uint lim = divup(out.info.dims[dim], (threads_y * blocks_all[dim]));

    getQueue().submit([&](sycl::handler &h) {
        // TODO: specify access modes in all kernels
        write_accessor<To> out_acc{*out.data, h};
        write_accessor<To> tmp_acc{*tmp.data, h};
        read_accessor<Ti> in_acc{*in.data, h};

        sycl::stream debug_stream(2048 * 256, 128, h);

        auto s_val =
            local_accessor<compute_t<To>, 1>(THREADS_X * threads_y * 2, h);
        auto s_tmp = local_accessor<compute_t<To>, 1>(THREADS_X, h);

        h.parallel_for(
            sycl::nd_range<2>(global, local),
            scanDimKernel<Ti, To, op, dim>(
                out_acc, out.info, tmp_acc, tmp.info, in_acc, in.info,
                blocks_all[0], blocks_all[1], blocks_all[dim], lim, isFinalPass,
                threads_y, inclusive_scan, s_val, s_tmp, debug_stream));
    });
    ONEAPI_DEBUG_FINISH(getQueue());
}

template<typename To, af_op_t op, int dim>
static void bcast_dim_launcher(Param<To> out, Param<To> tmp,
                               const uint threads_y, const dim_t blocks_all[4],
                               bool inclusive_scan) {
    sycl::range<2> local(THREADS_X, threads_y);
    sycl::range<2> global(blocks_all[0] * blocks_all[2] * local[0],
                          blocks_all[1] * blocks_all[3] * local[1]);

    uint lim = divup(out.info.dims[dim], (threads_y * blocks_all[dim]));

    getQueue().submit([&](sycl::handler &h) {
        write_accessor<To> out_acc{*out.data, h};
        read_accessor<To> tmp_acc{*tmp.data, h};

        sycl::stream debug_stream(2048 * 256, 128, h);

        h.parallel_for(sycl::nd_range<2>(global, local),
                       scanDimBcastKernel<To, op, dim>(
                           out_acc, out.info, tmp_acc, tmp.info, blocks_all[0],
                           blocks_all[1], blocks_all[dim], lim, inclusive_scan,
                           debug_stream));
    });
    ONEAPI_DEBUG_FINISH(getQueue());
}

template<typename Ti, typename To, af_op_t op, int dim>
static void scan_dim(Param<To> out, Param<Ti> in, bool inclusive_scan) {
    uint threads_y = std::min(THREADS_Y, nextpow2(out.info.dims[dim]));
    uint threads_x = THREADS_X;

    dim_t blocks_all[] = {divup(out.info.dims[0], threads_x), out.info.dims[1],
                          out.info.dims[2], out.info.dims[3]};

    blocks_all[dim] = divup(out.info.dims[dim], threads_y * REPEAT);

    if (blocks_all[dim] == 1) {
        scan_dim_launcher<Ti, To, op, dim>(out, out, in, threads_y, blocks_all,
                                           true, inclusive_scan);
    } else {
        Param<To> tmp = out;

        tmp.info.dims[dim]  = blocks_all[dim];
        tmp.info.strides[0] = 1;
        for (int k = 1; k < 4; k++)
            tmp.info.strides[k] =
                tmp.info.strides[k - 1] * tmp.info.dims[k - 1];

        int tmp_elements = tmp.info.strides[3] * tmp.info.dims[3];
        auto tmp_alloc   = memAlloc<To>(tmp_elements);
        tmp.data         = tmp_alloc.get();

        scan_dim_launcher<Ti, To, op, dim>(out, tmp, in, threads_y, blocks_all,
                                           false, inclusive_scan);

        int bdim        = blocks_all[dim];
        blocks_all[dim] = 1;

        // FIXME: Is there an alternative to the if condition ?
        if (op == af_notzero_t) {
            scan_dim_launcher<To, To, af_add_t, dim>(tmp, tmp, tmp, threads_y,
                                                     blocks_all, true, true);
        } else {
            scan_dim_launcher<To, To, op, dim>(tmp, tmp, tmp, threads_y,
                                               blocks_all, true, true);
        }

        blocks_all[dim] = bdim;
        bcast_dim_launcher<To, op, dim>(out, tmp, threads_y, blocks_all,
                                        inclusive_scan);
    }
}

}  // namespace kernel
}  // namespace oneapi


text:
After do |scenario|
  if scenario.failed?
    # When a scenario fails, stop running tests and open the current page.
    # save_and_open_page
    Cucumber.wants_to_quit = true
  end
end


text:
include(Platform/Darwin-Clang-CXX)
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.2)
  set(CMAKE_CXX_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
else()
  unset(CMAKE_CXX_SYSTEM_FRAMEWORK_SEARCH_FLAG)
endif()


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Styleables for being able to specify themes for the list entry custom views used
     in the recycler views in order to use a merge tag.
     See http://trickyandroid.com/protip-inflating-layout-for-your-custom-view/ -->
    <declare-styleable name="OwnCarEntryStyleable">
        <attr name="ownCarEntryStyle" format="reference"/>
    </declare-styleable>
    <declare-styleable name="ManageCarsEntryStyleable">
        <attr name="manageCarsEntryStyle" format="reference"/>
    </declare-styleable>
</resources>


text: sudo apt-get install --only-upgrade cups=1.5.3-0ubuntu8.7 -y


text:
@interface DJCollectionViewPageLayout ()
{
    CGSize _finalItemSize;
}
@end

@implementation DJCollectionViewPageLayout

- (instancetype)init{
    self = [super init];
    if (self) {
        self.velocityForPageTurning = 0.4;
        self.minimumLineSpacing = 0;
        self.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    }

    return self;
}

- (void)prepareLayout{
    [super prepareLayout];
    CGSize size = self.itemSize;
    id<UICollectionViewDelegateFlowLayout> delegate = (id<UICollectionViewDelegateFlowLayout>)self.collectionView.delegate;

    if ([delegate respondsToSelector:@selector(collectionView:layout:sizeForItemAtIndexPath:)]) {
        size = [delegate collectionView:self.collectionView layout:self sizeForItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]];
    }

    _finalItemSize = size;
}

- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity{

    CGFloat itemSpace = _finalItemSize.width + self.minimumLineSpacing;
    if (fabs(velocity.x) > self.velocityForPageTurning) {
        //page turn
        BOOL isRightDirection = proposedContentOffset.x < self.collectionView.contentOffset.x;
        proposedContentOffset = CGPointMake(self.collectionView.contentOffset.x + (itemSpace/2)*(isRightDirection?-1:1), self.collectionView.contentOffset.y);
    }else{
        proposedContentOffset = self.collectionView.contentOffset;
    }

    proposedContentOffset.x = roundf(proposedContentOffset.x/itemSpace)*itemSpace;
    return proposedContentOffset;
}

@end


text:
 @font-face {
  font-family:'Leanscape';
  src: url('../font/leanscape.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
.leanorama-controlbar {
  position: fixed;
  bottom: 0;
  left: 0;
  /* prevent text selection of buttons */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
.leanorama-controlbar-bg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  opacity: 0.6;
  filter: alpha(opacity=60);
  border-top-right-radius: 0.2rem;
}
.leanorama-controlbar-controls {
  position: relative;
  padding: 0 1em;
}
.leanorama-controlbar-button {
  display: inline-block;
  padding: 0.4em .1em;
  font-family: Leanscape;
  font-size: 5rem;
  line-height: 1rem;
  color: #fff;
  z-index: 10001;
}
.actionable:hover {
  color: #B4E758;
}
@media only screen and (max-device-width: 480px) {
  .leanorama-controlbar-button {
    font-size: 3rem;
  }
}
.leanorama-controlbar-button:hover {
  cursor: pointer;
}


text:
<?xml version = "1.0" encoding = "UTF-8"?>
<!--

       Copyright 2009-2015 the original author or authors.

       Licensed under the Apache License, Version 2.0 (the "License");
       you may not use this file except in compliance with the License.
       You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing, software
       distributed under the License is distributed on an "AS IS" BASIS,
       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       See the License for the specific language governing permissions and
       limitations under the License.

-->

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"  "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="shfq.multiple_resultset.xml.caller">
    <resultMap id="peopleResultMap" type="shfq.one_many_annotation.People">
        <id column="id" property="id"></id>
        <!--<result column="name" property="name"></result>-->
        <collection property="pets" ofType="shfq.one_many_annotation.Pet" resultSet="pets" column="id" foreignColumn="owner_id">
            <id property="id" column="id"></id>
            <result property="name" column="name"/>
            <association property="owner" resultMap="peopleResultMap" column="owner_id">
            </association>
        </collection>
    </resultMap>

    <!--<resultMap id="peopleResultMap" type="shfq.one_many_annotation.People">-->
        <!--<id column="id" property="id"></id>-->
        <!--<result column="name" property="name"></result>-->
        <!--<collection property="pets" ofType="shfq.one_many_annotation.Pet" resultSet="pets" column="id" foreignColumn="owner_id">-->
            <!--<id property="id" column="id"></id>-->
            <!--<result property="name" column="name"/>-->
            <!--<association property="owner" resultMap="peopleResultMap" column="owner_id" foreignColumn="id">-->
            <!--</association>-->
        <!--</collection>-->
    <!--匹配错误-->
    <!--</resultMap>-->

    <select id="callProcedure" resultSets="peoples,pets" resultMap="peopleResultMap" statementType="CALLABLE">
        {call Proc(#{paramId,jdbcType=INTEGER,mode=IN})}
    </select>
</mapper>


text:
{$LANG.MAIL_SUBMIT}

		{$LANG.MAIL_SUBMIT_TIP}

		<input id="submit-mail-text" name="email" class="f-text" style="width:160px;">

		<input type="submit" class="submit_email"  value="" id="submit-mail-image" />