text:
<?php

namespace ShortPixel\persist;

 class PNGMetadataExtractor {
     private static $pngSig;

     private static $crcSize;

     private static $textChunks;

     const VERSION = 1;
     const MAX_CHUNK_SIZE = 3145728; // 3 megabytes

     static function getMetadata( $filename ) {
         self::$pngSig = pack( "C8", 137, 80, 78, 71, 13, 10, 26, 10 );
         self::$crcSize = 4;
         /* based on list at http://owl.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html#TextualData
          * and http://www.w3.org/TR/PNG/#11keywords
          */
         self::$textChunks = array(
             'xml:com.adobe.xmp' => 'xmp',
             # Artist is unofficial. Author is the recommended
             # keyword in the PNG spec. However some people output
             # Artist so support both.
             'artist' => 'Artist',
             'model' => 'Model',
             'make' => 'Make',
             'author' => 'Artist',
             'comment' => 'PNGFileComment',
             'description' => 'ImageDescription',
             'title' => 'ObjectName',
             'copyright' => 'Copyright',
             # Source as in original device used to make image
             # not as in who gave you the image
             'source' => 'Model',
             'software' => 'Software',
             'disclaimer' => 'Disclaimer',
             'warning' => 'ContentWarning',
             'url' => 'Identifier', # Not sure if this is best mapping. Maybe WebStatement.
             'label' => 'Label',
             'creation time' => 'DateTimeDigitized',
             'raw profile type app1' => 'APP1_Profile',
             /* Other potentially useful things - Document */
         );

         $frameCount = 0;
         $loopCount = 1;
         $text = array();
         $duration = 0.0;
         $bitDepth = 0;
         $colorType = 'unknown';

         if ( !$filename ) {
             throw new Exception( __METHOD__ . ": No file name specified" );
         } elseif ( !file_exists( $filename ) || is_dir( $filename ) ) {
             throw new Exception( __METHOD__ . ": File $filename does not exist" );
         }

         $fh = fopen( $filename, 'rb' );

         if ( !$fh ) {
             throw new Exception( __METHOD__ . ": Unable to open file $filename" );
         }

         // Check for the PNG header
         $buf = fread( $fh, 8 );
         if ( $buf != self::$pngSig ) {
             throw new Exception( __METHOD__ . ": Not a valid PNG file; header: $buf" );
         }

         // Read chunks
         while ( !feof( $fh ) ) {
             $buf = fread( $fh, 4 );
             if ( !$buf || strlen( $buf ) < 4 ) {
                 throw new Exception( __METHOD__ . ": Read error" );
             }
             $chunk = unpack( "N", $buf );
             $chunk_size = $chunk[1];

             if ( $chunk_size < 0 ) {
                 throw new Exception( __METHOD__ . ": Chunk size too big for unpack" );
             }

             $chunk_type = fread( $fh, 4 );
             if ( !$chunk_type || strlen( $chunk_type ) < 4 ) {
                 throw new Exception( __METHOD__ . ": Read error" );
             }

             if ( $chunk_type == "IHDR" ) {
                 $buf = self::read( $fh, $chunk_size );
                 if ( !$buf || strlen( $buf ) < $chunk_size ) {
                     throw new Exception( __METHOD__ . ": Read error" );
                 }
                 $bitDepth = ord( substr( $buf, 8, 1 ) );
                 // Detect the color type in British English as per the spec
                 // http://www.w3.org/TR/PNG/#11IHDR
                 switch ( ord( substr( $buf, 9, 1 ) ) ) {
                     case 0:
                         $colorType = 'greyscale';
                         break;
                     case 2:
                         $colorType = 'truecolour';
                         break;
                     case 3:
                         $colorType = 'index-coloured';
                         break;
                     case 4:
                         $colorType = 'greyscale-alpha';
                         break;
                     case 6:
                         $colorType = 'truecolour-alpha';
                         break;
                     default:
                         $colorType = 'unknown';
                         break;
                 }
             } elseif ( $chunk_type == "acTL" ) {
                 $buf = fread( $fh, $chunk_size );
                 if ( !$buf || strlen( $buf ) < $chunk_size || $chunk_size < 4 ) {
                     throw new Exception( __METHOD__ . ": Read error" );
                 }

                 $actl = unpack( "Nframes/Nplays", $buf );
                 $frameCount = $actl['frames'];
                 $loopCount = $actl['plays'];
             } elseif ( $chunk_type == "fcTL" ) {
                 $buf = self::read( $fh, $chunk_size );
                 if ( !$buf || strlen( $buf ) < $chunk_size ) {
                     throw new Exception( __METHOD__ . ": Read error" );
                 }
                 $buf = substr( $buf, 20 );
                 if ( strlen( $buf ) < 4 ) {
                     throw new Exception( __METHOD__ . ": Read error" );
                 }

                 $fctldur = unpack( "ndelay_num/ndelay_den", $buf );
                 if ( $fctldur['delay_den'] == 0 ) {
                     $fctldur['delay_den'] = 100;
                 }
                 if ( $fctldur['delay_num'] ) {
                     $duration += $fctldur['delay_num'] / $fctldur['delay_den'];
                 }
             } elseif ( $chunk_type == "iTXt" ) {
                 // Extracts iTXt chunks, uncompressing if necessary.
                 $buf = self::read( $fh, $chunk_size );
                 $items = array();
                 if ( preg_match(
                     '/^([^\x00]{1,79})\x00(\x00|\x01)\x00([^\x00]*)(.)[^\x00]*\x00(.*)$/Ds',
                     $buf, $items )
                 ) {
                     /* $items[1] = text chunk name, $items[2] = compressed flag,
                      * $items[3] = lang code (or ""), $items[4]= compression type.
                      * $items[5] = content
                      */

                     // Theoretically should be case-sensitive, but in practise...
                     $items[1] = strtolower( $items[1] );
                     if ( !isset( self::$textChunks[$items[1]] ) ) {
                         // Only extract textual chunks on our list.
                         fseek( $fh, self::$crcSize, SEEK_CUR );
                         continue;
                     }

                     $items[3] = strtolower( $items[3] );
                     if ( $items[3] == '' ) {
                         // if no lang specified use x-default like in xmp.
                         $items[3] = 'x-default';
                     }

                     // if compressed
                     if ( $items[2] == "\x01" ) {
                         if ( function_exists( 'gzuncompress' ) && $items[4] === "\x00" ) {
                             $errLevel = error_reporting(E_ERROR | E_PARSE);
                             $items[5] = gzuncompress( $items[5] );
                             error_reporting($errLevel);

                             if ( $items[5] === false ) {
                                 // decompression failed
                                 wfDebug( __METHOD__ . ' Error decompressing iTxt chunk - ' . $items[1] . "\n" );
                                 fseek( $fh, self::$crcSize, SEEK_CUR );
                                 continue;
                             }
                         } else {
                             wfDebug( __METHOD__ . ' Skipping compressed png iTXt chunk due to lack of zlib,'
                                 . " or potentially invalid compression method\n" );
                             fseek( $fh, self::$crcSize, SEEK_CUR );
                             continue;
                         }
                     }
                     $finalKeyword = self::$textChunks[$items[1]];
                     $text[$finalKeyword][$items[3]] = $items[5];
                     $text[$finalKeyword]['_type'] = 'lang';
                 } else {
                     // Error reading iTXt chunk
                     throw new Exception( __METHOD__ . ": Read error on iTXt chunk" );
                 }
             } elseif ( $chunk_type == 'tEXt' ) {
                 $buf = self::read( $fh, $chunk_size );

                 // In case there is no \x00 which will make explode fail.
                 if ( strpos( $buf, "\x00" ) === false ) {
                     throw new Exception( __METHOD__ . ": Read error on tEXt chunk" );
                 }

                 list( $keyword, $content ) = explode( "\x00", $buf, 2 );
                 if ( $keyword === '' || $content === '' ) {
                     throw new Exception( __METHOD__ . ": Read error on tEXt chunk" );
                 }

                 // Theoretically should be case-sensitive, but in practise...
                 $keyword = strtolower( $keyword );
                 if ( !isset( self::$textChunks[$keyword] ) ) {
                     // Don't recognize chunk, so skip.
                     fseek( $fh, self::$crcSize, SEEK_CUR );
                     continue;
                 }
                 $errLevel = error_reporting(E_ERROR | E_PARSE);
                 $content = iconv( 'ISO-8859-1', 'UTF-8', $content );
                 error_reporting($errLevel);

                 if ( $content === false ) {
                     throw new Exception( __METHOD__ . ": Read error (error with iconv)" );
                 }

                 $finalKeyword = self::$textChunks[$keyword];
                 $text[$finalKeyword]['x-default'] = $content;
                 $text[$finalKeyword]['_type'] = 'lang';
             } elseif ( $chunk_type == 'zTXt' ) {
                 if ( function_exists( 'gzuncompress' ) ) {
                     $buf = self::read( $fh, $chunk_size );

                     // In case there is no \x00 which will make explode fail.
                     if ( strpos( $buf, "\x00" ) === false ) {
                         throw new Exception( __METHOD__ . ": Read error on zTXt chunk" );
                     }

                     list( $keyword, $postKeyword ) = explode( "\x00", $buf, 2 );
                     if ( $keyword === '' || $postKeyword === '' ) {
                         throw new Exception( __METHOD__ . ": Read error on zTXt chunk" );
                     }
                     // Theoretically should be case-sensitive, but in practise...
                     $keyword = strtolower( $keyword );

                     if ( !isset( self::$textChunks[$keyword] ) ) {
                         // Don't recognize chunk, so skip.
                         fseek( $fh, self::$crcSize, SEEK_CUR );
                         continue;
                     }
                     $compression = substr( $postKeyword, 0, 1 );
                     $content = substr( $postKeyword, 1 );
                     if ( $compression !== "\x00" ) {
                         wfDebug( __METHOD__ . " Unrecognized compression method in zTXt ($keyword). Skipping.\n" );
                         fseek( $fh, self::$crcSize, SEEK_CUR );
                         continue;
                     }

                     $errLevel = error_reporting(E_ERROR | E_PARSE);
                     $content = gzuncompress( $content );
                     error_reporting($errLevel);

                     if ( $content === false ) {
                         // decompression failed
                         wfDebug( __METHOD__ . ' Error decompressing zTXt chunk - ' . $keyword . "\n" );
                         fseek( $fh, self::$crcSize, SEEK_CUR );
                         continue;
                     }

                     $errLevel = error_reporting(E_ERROR | E_PARSE);
                     $content = iconv( 'ISO-8859-1', 'UTF-8', $content );
                     error_reporting($errLevel);

                     if ( $content === false ) {
                         throw new Exception( __METHOD__ . ": Read error (error with iconv)" );
                     }

                     $finalKeyword = self::$textChunks[$keyword];
                     $text[$finalKeyword]['x-default'] = $content;
                     $text[$finalKeyword]['_type'] = 'lang';
                 } else {
                     wfDebug( __METHOD__ . " Cannot decompress zTXt chunk due to lack of zlib. Skipping.\n" );
                     fseek( $fh, $chunk_size, SEEK_CUR );
                 }
             } elseif ( $chunk_type == 'tIME' ) {
                 // last mod timestamp.
                 if ( $chunk_size !== 7 ) {
                     throw new Exception( __METHOD__ . ": tIME wrong size" );
                 }
                 $buf = self::read( $fh, $chunk_size );
                 if ( !$buf || strlen( $buf ) < $chunk_size ) {
                     throw new Exception( __METHOD__ . ": Read error" );
                 }

                 // Note: spec says this should be UTC.
                 $t = unpack( "ny/Cm/Cd/Ch/Cmin/Cs", $buf );
                 $strTime = sprintf( "%04d%02d%02d%02d%02d%02d",
                     $t['y'], $t['m'], $t['d'], $t['h'],
                     $t['min'], $t['s'] );

                 $exifTime = wfTimestamp( TS_EXIF, $strTime );

                 if ( $exifTime ) {
                     $text['DateTime'] = $exifTime;
                 }
             } elseif ( $chunk_type == 'pHYs' ) {
                 // how big pixels are (dots per meter).
                 if ( $chunk_size !== 9 ) {
                     throw new Exception( __METHOD__ . ": pHYs wrong size" );
                 }

                 $buf = self::read( $fh, $chunk_size );
                 if ( !$buf || strlen( $buf ) < $chunk_size ) {
                     throw new Exception( __METHOD__ . ": Read error" );
                 }

                 $dim = unpack( "Nwidth/Nheight/Cunit", $buf );
                 if ( $dim['unit'] == 1 ) {
                     // Need to check for negative because php
                     // doesn't deal with super-large unsigned 32-bit ints well
                     if ( $dim['width'] > 0 && $dim['height'] > 0 ) {
                         // unit is meters
                         // (as opposed to 0 = undefined )
                         $text['XResolution'] = $dim['width']
                             . '/100';
                         $text['YResolution'] = $dim['height']
                             . '/100';
                         $text['ResolutionUnit'] = 3;
                         // 3 = dots per cm (from Exif).
                     }
                 }
             } elseif ( $chunk_type == "IEND" ) {
                 break;
             } else {
                 fseek( $fh, $chunk_size, SEEK_CUR );
             }
             fseek( $fh, self::$crcSize, SEEK_CUR );
         }
         fclose( $fh );

         if ( $loopCount > 1 ) {
             $duration *= $loopCount;
         }

         if ( isset( $text['DateTimeDigitized'] ) ) {
             // Convert date format from rfc2822 to exif.
             foreach ( $text['DateTimeDigitized'] as $name => &$value ) {
                 if ( $name === '_type' ) {
                     continue;
                 }

                 // @todo FIXME: Currently timezones are ignored.
                 // possibly should be wfTimestamp's
                 // responsibility. (at least for numeric TZ)
                 $formatted = wfTimestamp( TS_EXIF, $value );
                 if ( $formatted ) {
                     // Only change if we could convert the
                     // date.
                     // The png standard says it should be
                     // in rfc2822 format, but not required.
                     // In general for the exif stuff we
                     // prettify the date if we can, but we
                     // display as-is if we cannot or if
                     // it is invalid.
                     // So do the same here.

                     $value = $formatted;
                 }
             }
         }

         return array(
             'frameCount' => $frameCount,
             'loopCount' => $loopCount,
             'duration' => $duration,
             'text' => $text,
             'bitDepth' => $bitDepth,
             'colorType' => $colorType,
         );
     }

     private static function read( $fh, $size ) {
         if ( $size > self::MAX_CHUNK_SIZE ) {
             throw new Exception( __METHOD__ . ': Chunk size of ' . $size .
                 ' too big. Max size is: ' . self::MAX_CHUNK_SIZE );
         }

         return fread( $fh, $size );
     }
 }


text:
package com.vilisimo.ads.helpers;

import org.junit.Test;

import static com.vilisimo.ads.helpers.Comparer.equal;
import static com.vilisimo.ads.helpers.Comparer.greater;
import static com.vilisimo.ads.helpers.Comparer.less;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class ComparerTest {

    @Test
    public void bIsGreaterThanA() {
        assertTrue(greater("b", "a"));
    }

    @Test
    public void aIsNotGreaterThanB() {
        assertFalse(greater("a", "b"));
    }

    @Test
    public void aIsNotGreaterThanA() {
        assertFalse(greater("a", "a"));
    }

    @Test
    public void aIsEqualA() {
        assertTrue(equal("a", "a"));
    }

    @Test
    public void aIsNotEqualB() {
        assertFalse(equal("a", "b"));
    }

    @Test
    public void aIsLessThanB() {
        assertTrue(less("a", "b"));
    }

    @Test
    public void bIsNotLessThanA() {
        assertFalse(less("b", "a"));
    }

    @Test
    public void bIsNotLessThanB() {
        assertFalse(less("b", "b"));
    }
}

redpajama_set_name: RedPajamaGithub


text:
IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
  SET(CMAKE_INSTALL_PREFIX "/usr/local")
ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")

# Set the install configuration name.
IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
  IF(BUILD_TYPE)
    STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
           CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
  ELSE(BUILD_TYPE)
    SET(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo")
  ENDIF(BUILD_TYPE)
  MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)

# Set the component getting installed.
IF(NOT CMAKE_INSTALL_COMPONENT)
  IF(COMPONENT)
    MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
    SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
  ELSE(COMPONENT)
    SET(CMAKE_INSTALL_COMPONENT)
  ENDIF(COMPONENT)
ENDIF(NOT CMAKE_INSTALL_COMPONENT)

# Install shared libraries without execute permission?
IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
  SET(CMAKE_INSTALL_SO_NO_EXE "1")
ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)

IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
  list(APPEND CPACK_ABSOLUTE_DESTINATION_FILES
   "/usr/local/.catkin")
FILE(INSTALL DESTINATION "/usr/local" TYPE FILE FILES "/home/gautam/hearbo_2dnav/hearbo_cart_ts/hearbo_cart_joy/build/catkin_generated/installspace/.catkin")
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")

IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
  list(APPEND CPACK_ABSOLUTE_DESTINATION_FILES
   "/usr/local/_setup_util.py")
FILE(INSTALL DESTINATION "/usr/local" TYPE PROGRAM FILES "/home/gautam/hearbo_2dnav/hearbo_cart_ts/hearbo_cart_joy/build/catkin_generated/installspace/_setup_util.py")
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")

IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
  list(APPEND CPACK_ABSOLUTE_DESTINATION_FILES
   "/usr/local/env.sh")
FILE(INSTALL DESTINATION "/usr/local" TYPE PROGRAM FILES "/home/gautam/hearbo_2dnav/hearbo_cart_ts/hearbo_cart_joy/build/catkin_generated/installspace/env.sh")
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")

IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
  list(APPEND CPACK_ABSOLUTE_DESTINATION_FILES
   "/usr/local/setup.bash")
FILE(INSTALL DESTINATION "/usr/local" TYPE FILE FILES "/home/gautam/hearbo_2dnav/hearbo_cart_ts/hearbo_cart_joy/build/catkin_generated/installspace/setup.bash")
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")

IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
  list(APPEND CPACK_ABSOLUTE_DESTINATION_FILES
   "/usr/local/setup.sh")
FILE(INSTALL DESTINATION "/usr/local" TYPE FILE FILES "/home/gautam/hearbo_2dnav/hearbo_cart_ts/hearbo_cart_joy/build/catkin_generated/installspace/setup.sh")
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")

IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
  list(APPEND CPACK_ABSOLUTE_DESTINATION_FILES
   "/usr/local/setup.zsh")
FILE(INSTALL DESTINATION "/usr/local" TYPE FILE FILES "/home/gautam/hearbo_2dnav/hearbo_cart_ts/hearbo_cart_joy/build/catkin_generated/installspace/setup.zsh")
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")

IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
  list(APPEND CPACK_ABSOLUTE_DESTINATION_FILES
   "/usr/local/.rosinstall")
FILE(INSTALL DESTINATION "/usr/local" TYPE FILE FILES "/home/gautam/hearbo_2dnav/hearbo_cart_ts/hearbo_cart_joy/build/catkin_generated/installspace/.rosinstall")
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")

IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/etc/catkin/profile.d" TYPE FILE FILES "/opt/ros/groovy/share/catkin/cmake/env-hooks/05.catkin_make.bash")
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")

IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/etc/catkin/profile.d" TYPE FILE FILES "/opt/ros/groovy/share/catkin/cmake/env-hooks/05.catkin_make_isolated.bash")
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")

IF(NOT CMAKE_INSTALL_LOCAL_ONLY)
  # Include the install script for each subdirectory.
  INCLUDE("/home/gautam/hearbo_2dnav/hearbo_cart_ts/hearbo_cart_joy/build/gtest/cmake_install.cmake")

ENDIF(NOT CMAKE_INSTALL_LOCAL_ONLY)

IF(CMAKE_INSTALL_COMPONENT)
  SET(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
ELSE(CMAKE_INSTALL_COMPONENT)
  SET(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
ENDIF(CMAKE_INSTALL_COMPONENT)

FILE(WRITE "/home/gautam/hearbo_2dnav/hearbo_cart_ts/hearbo_cart_joy/build/${CMAKE_INSTALL_MANIFEST}" "")
FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES})
  FILE(APPEND "/home/gautam/hearbo_2dnav/hearbo_cart_ts/hearbo_cart_joy/build/${CMAKE_INSTALL_MANIFEST}" "${file}\n")
ENDFOREACH(file)


text:
using System;
using System.Data;
using System.Linq;
using UnitTests.ORM.Test1.Models;
using Utilities.DataTypes.ExtensionMethods;
using Utilities.SQL.DataClasses;
using Utilities.SQL.ParameterTypes;
using Utilities.SQL.SQLServer;
using Xunit;

namespace UnitTests.ORM.Test1
{
    public class ORMTest1:IDisposable
    {
        public ORMTest1()
        {
            new Utilities.ORM.ORM(false, typeof(Account).Assembly);
        }

        [Fact]
        public void DatabaseCreation()
        {
            Database DatabaseObject = SQLServer.GetDatabaseStructure("Data Source=localhost;Initial Catalog=ORMTestDatabase;Integrated Security=SSPI;Pooling=false");
            Assert.Equal(18, DatabaseObject.Tables.Count);
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "Account_"));
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "Group_"));
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "Role_"));
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "User_"));
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "Account_Audit"));
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "Group_Audit"));
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "Role_Audit"));
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "User_Audit"));
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "Account_User"));
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "Account_UserAudit"));
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "Group_User"));
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "Group_UserAudit"));
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "Role_User"));
            Assert.True(DatabaseObject.Tables.Any(x => x.Name == "Role_UserAudit"));
        }

        [Fact]
        public void ManyToOneTest()
        {
            Item Temp = new Item();
            Temp.Name = "Parent";
            for (int x = 0; x < 5; ++x)
            {
                Item Child = new Item();
                Child.Name = "Child "+x.ToString();
                Child.Parent=Temp;
                Temp.Children.Add(Child);
            }
            Temp.Save();
            Item Parent = Item.Any(new EqualParameter<long>(Temp.ID, "ID_"));
            foreach (Item Child in Parent.Children)
                Assert.Equal(Parent, Child.Parent);
            Assert.Equal(5, Parent.Children.Count);
            Assert.Equal(null, Parent.Parent);
            Parent.Children = Parent.Children.Remove(x => x.Name == "Child 0").ToList();
            Parent.Save();
            Parent = Item.Any(new EqualParameter<long>(Temp.ID, "ID_"));
            foreach (Item Child in Parent.Children)
                Assert.Equal(Parent, Child.Parent);
            Assert.Equal(4, Parent.Children.Count);
            Assert.Equal(null, Parent.Parent);
            Parent.Delete();
            Parent = Item.Any(new EqualParameter<long>(Temp.ID, "ID_"));
            Assert.Null(Parent);
            Assert.Equal(1, Item.All().Count());
        }

        public void Dispose()
        {
            Utilities.ORM.ORM.Destroy();
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("",  CommandType.Text, "Data Source=localhost;Initial Catalog=master;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.Batch().AddCommand("ALTER DATABASE ORMTestDatabase2 SET OFFLINE WITH ROLLBACK IMMEDIATE", CommandType.Text)
                    .AddCommand("ALTER DATABASE ORMTestDatabase2 SET ONLINE", CommandType.Text)
                    .AddCommand("DROP DATABASE ORMTestDatabase2", CommandType.Text);
                Helper.ExecuteNonQuery();
            }
            using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("",  CommandType.Text, "Data Source=localhost;Initial Catalog=master;Integrated Security=SSPI;Pooling=false"))
            {
                Helper.Batch().AddCommand("ALTER DATABASE ORMTestDatabase SET OFFLINE WITH ROLLBACK IMMEDIATE", CommandType.Text)
                    .AddCommand("ALTER DATABASE ORMTestDatabase SET ONLINE", CommandType.Text)
                    .AddCommand("DROP DATABASE ORMTestDatabase", CommandType.Text);
                Helper.ExecuteNonQuery();
            }
        }
    }
}


text:
namespace Machete.HL7Schema.V26
{
    /// <summary>
    /// HL7SegmentMap V26
    /// </summary>
    public abstract class HL7V26SegmentMap<TSegment> :
        HL7.HL7SegmentMap<TSegment, HL7V26Entity>
        where TSegment : class, HL7V26Segment
    {
    }
}


text:
* feature: add a query indicator
* improvement: add an indicator to show that the list of packages or nodes is empty
* improvement: extend coloring if some packages are outdated
* bugfix: fix loading indicator gif
* bugfix: red-ish highlighting for outdated packages

## 0.3.2

* bugfix: change url -> uri in repo model

## 0.3.1

* feature: add a check to see if the pony-express endpoint is alive
* bugfix: ignore the upstream field in packages if it's not queried

## 0.3.0

* feature: query packages by repo label
* feature: allow querying packages by multiple repositories
* feature: only select specific package versions in frontend
* improvement: restyled node and package selection items to support subselection
* improvement: simplify popup animation type and speed
* improvement: coloring of outdated packages
* bugfix: allow deselection of repo filter by label
* bugfix: prevent duplication of nodes when fetching multiple times
* bugfix: prevent duplications in repository list

## 0.2.0

* feature: query packages with a selected repository
* feature: added repositoryconfiguration menu
* feature: added comparison function to compare local package versions to those of an upstream repo
* improvement: close the repo selection dropdown when one of its items is clicked
* improvement: nicer styling of repository selection dropdown dialog
* improvement: for repository editing use an object copy, which updates the current state after the server confirms at save
* improvement: align top nav bar to container width
* bugfix: show outdated info only if it is defined
* bugfix: when fetching packages, empty the list of all packages at the beginning
* bugfix: pagination requests must correctly propagate query options when iterating
* bugfix: correct the jquery path that is currently installed from bower
* bugfix: fix random bower build failures

## 0.1.1

* improvement: configure the default host (pony-express) to be the current host + '/api'
* improvement: separate unpaginated and paginated queries (better readability)
* bugfix: stop infinite pagination when the response is empty
* bugfix: add sass compilation to grunt serve

## 0.1.0

* feature: query nodes by selected packages
* feature: fetch all data on a specific package when it is selected
* feature: query packages subset depending on the selected nodes
* feature: make package clicks select the package
* feature: make node clicks select the node
* feature: show pack versions when clicking on it
* feature: show packages summary below each node
* feature: updated /package/xyz requests, it should now include the list of nodes where the package is installed
* feature: query information of one node
* improvement: unified paginated fetch method + bugfixes for nodes and packages fetching
* improvement: add pagination to fetching nodes
* improvement: add pagination to fetching packages (i.e. fetch all packages at once)
* improvement: add a package fetching indicator
* improvement: separate results from querying /nodes and /packages into separate lists, to enable queries on subset
* improvement: move loading icon into the header line of a node when it is clicked
* improvement: add rotating loading icon when no content is there yet
* improvement: querying /packages will also fill all package objects with entries
* improvement: persist host configuration via cookie
* improvement: isolated bower modules in their regular form (not minimized) to one minimization block
* improvement: add jQuery and $ to jshint global configuration to disable such warnings
* improvement: call json names via dot-notation instead of ['..']-notation
* improvement: switch js calls to camelCase instead of under_score (jshint)
* improvement: fix double quotes in test according to jshint
* improvement: make default url configurable at runtime (not just initialization time)
* improvement: unified error reporting in restangular fetches
* bugfix: fix infinite pagination of packages
* bugfix: copy gif and png files from styles to the build directory
* bugfix: execute sass build step earlier
* bugfix: execute coffee build step earlier
* bugfix: make sure the  build step compresses all styles with dependencies
* bugfix: make sure all calls to the http backend are finished before verifying their contents
* bugfix: make sure all tests query the nodes list instead of node[xzy]
* bugfix: add missing lodash to js dependencies for restangular


text:
[![Build Status](https://img.shields.io/travis/artcom/hsm-java/master.svg?style=flat)](https://travis-ci.org/artcom/hsm-java)

This Project is a hierarchical state machine framework for Java.
The state machine specification is based on the [UML statemachine](http://en.wikipedia.org/wiki/UML_state_machine).
The implementation is based on this project: <https://github.com/Mask/hsm-js>.

### Published artifacts

The artifacts of this project are intended to be received via [Jitpack.io](https://jitpack.io/)

Gradle dependency example:

compile 'com.github.artcom:hsm-java:0.0.3'

### Publish to Maven Local

In order to publish to the local Maven repository please use this command:

./gradlew -Pgroup=com.github.artcom publishToMavenLocal

It is necessary to provide the same groupId as used by jitpack in order to be able
to force the usage of the version in the local maven repository.

### License

Copyright © 2015 [Art+Com AG](http://www.artcom.de/).
Distributed under the MIT License.
Please see [License File](LICENSE) for more information.


text:
TEST(DumbTest, OneIsOne)
{
    const auto numberOne = 1;
    EXPECT_TRUE(1 == numberOne);
}

int main(int argc, char **argv)
{
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}


text:
package org.nguyenhuy.buffer.fragment;

import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.squareup.otto.Subscribe;
import org.nguyenhuy.buffer.R;
import org.nguyenhuy.buffer.adapter.PendingUpdatesAdapter;
import org.nguyenhuy.buffer.adapter.UpdatesAdapter;
import org.nguyenhuy.buffer.event.ChangedProfileEvent;
import org.nguyenhuy.buffer.event.FailedToGetUpdatesEvent;
import org.nguyenhuy.buffer.event.GettingUpdatesEvent;
import org.nguyenhuy.buffer.event.GotUpdatesEvent;
import org.nguyenhuy.buffer.model.user.Update;

/**
 * Created by nguyenthanhhuy on 1/18/14.
 */
public class SentUpdatesFragment extends UpdatesFragment {

    @Override
    protected ArrayAdapter<Update> initAdapter() {
        return new PendingUpdatesAdapter(getActivity());
    }

    @Override
    protected String getStatusOfUpdates() {
        return Update.STATUS_SENT;
    }

    @Override
    protected void onListItemClick(ListView l, View v, int position) {

    }

    @Subscribe
    public void onGettingUpdates(GettingUpdatesEvent event) {
        super.onGettingUpdates(event);
    }

    @Subscribe
    public void onGotUpdates(GotUpdatesEvent event) {
        super.onGotUpdates(event);
    }

    @Subscribe
    public void onFailedToGetUpdates(FailedToGetUpdatesEvent event) {
        super.onFailedToGetUpdates(event);
    }

    @Subscribe
    public void onChangedProfile(ChangedProfileEvent event) {
        super.onChangedProfile(event);
    }
}


text:
<?php

?>

<div class="<?php echo $class?>" id="<?php echo $id?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo $title?>">

         <?php include $modal_content?>

          <?php
          $html ="";
          foreach ($buttons as $button) {
              $html.= "<button type='".$button->type."' classes='".$button->class."' data-dismiss='modal'>".$button->label."</button>";
          }
          echo $html;
          ?>


text: yet another git based wiki


text:
// Parts copied from:
// https://github.com/typescript-cheatsheets/react-typescript-cheatsheet/tree/bd3e2a6c213932fbf0cec6befea4fb90457714ab
// License: MIT.

function TextInputWithFocusButton() {
  // initialise with null, but tell TypeScript we are looking for an HTMLInputElement
  const inputEl = React.useRef<HTMLInputElement>(null);
  const onButtonClick = () => {
    // strict null checks need us to check if inputEl and current exist.
    // but once current exists, it is of type HTMLInputElement, thus it
    // has the method focus! ✅
    if (inputEl && inputEl.current) {
      inputEl.current.focus();
    }
  };
  return (
    <>
      {/* in addition, inputEl only can be used with input elements. Yay! */}
      <input ref={inputEl} type="text" />
      <button onClick={onButtonClick}>Focus the input</button>
    </>
  );
}

type ButtonProps = React.ComponentProps<typeof Button>; // no problem! grab your own!
type AlertButtonProps = Omit<ButtonProps, "onClick">; // modify
const AlertButton: React.FC<AlertButtonProps> = (props) => (
  <Button onClick={() => alert("hello")} {...props} />
);


text:
import { ArrayBufferBuilder } from "../../../../utils/ArrayBufferBuilder";
import { BitsReader } from "../../../../utils/BitsReader";
import { SerializerUtils } from "../../../../utils/SerializerUtils";
import { SrvTourRematchVotingInProgressData } from "../data/SrvTourRematchVotingInProgressData";

export class SrvTourRematchVotingInProgressDataSerializer {
	public static serialize(buffer: ArrayBufferBuilder, data: SrvTourRematchVotingInProgressData): void {
		buffer.setUint16( data.finishPlace );
			buffer.setUint16( data.score );
			buffer.setUTF16StringNullTerminated( data.nickname );
			buffer.setUint16( data.opponentScore );
			buffer.setUTF16StringNullTerminated( data.opponentNickname );
			buffer.setUint8( data.isOpponentVoted ? 1 : 0 );
			buffer.setUint16( data.votingTimeLeft );

	}

	public static deserialize(buffer: ArrayBufferBuilder, data: SrvTourRematchVotingInProgressData): void {
		data.finishPlace = buffer.getUint16();
			data.score = buffer.getUint16();
			data.nickname = buffer.getUTF16StringNullTerminated();
			data.opponentScore = buffer.getUint16();
			data.opponentNickname = buffer.getUTF16StringNullTerminated();
			data.isOpponentVoted = buffer.getUint8() != 0;
			data.votingTimeLeft = buffer.getUint16();

	}
}


text:
import os

from bottle import Bottle, response
from whitenoise import WhiteNoise

from ..settings import DATA_PATH

api = Bottle()

@api.hook('after_request')
def enable_cors():
    response.headers['Access-Control-Allow-Origin'] = '*'
    response.headers['Access-Control-Allow-Methods'] = 'GET, POST, DELETE'

application = WhiteNoise(api)
application.add_files(os.path.join(DATA_PATH, 'thumbnails'), prefix='thumbnails/')
application.add_files(os.path.join(DATA_PATH, 'medias'), prefix='medias/')


text:
namespace Poco {

class FileImpl
{
protected:
	typedef UInt64 FileSizeImpl;

	FileImpl();
	FileImpl(const std::string& path);
	virtual ~FileImpl();
	void setPath(const std::string& path);
	void swapImpl(FileImpl& file);
	void setPathImpl(const std::string& path);
	const std::string& getPathImpl() const;
	bool existsImpl() const;
	bool canReadImpl() const;
	bool canWriteImpl() const;
	bool canExecuteImpl() const;
	bool isFileImpl() const;
	bool isDirectoryImpl() const;
	bool isLinkImpl() const;
	bool isHiddenImpl() const;
	Timestamp createdImpl() const;
	Timestamp getLastModifiedImpl() const;
	void setLastModifiedImpl(const Timestamp& ts);
	FileSizeImpl getSizeImpl() const;
	void setSizeImpl(FileSizeImpl size);
	void setWriteableImpl(bool flag = true);
	void setExecutableImpl(bool flag = true);
	void copyToImpl(const std::string& path) const;
	void renameToImpl(const std::string& path);
	void removeImpl();
	bool createFileImpl();
	bool createDirectoryImpl();
	static void handleLastError(const std::string& path);

private:
	std::string _path;
};

//
// inlines
//
inline const std::string& FileImpl::getPathImpl() const
{
	return _path;
}

} // namespace Poco

#endif // Foundation_File_VMS_INCLUDED


text:
const x = globalFunction;
function y () {}

switch ( anotherGlobal ) {
	case 1:
		const x = function () {};
		x();
}

switch ( anotherGlobal ) {
	case 2:
		x();
}

switch ( anotherGlobal ) {
	case 3:
		const y = globalFunction;
}
y();

switch ( globalFunction() ) {
	case 4:
}


text:
package installer;

import installer.stages.config.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;

/**
 * Класс, который содержит в себе всю информацию о конфигурации установки
 * (взаимодействие с пользователем) и сохраняет всю информацию в объект
 * {@link Parameters}. Класс инициализируется с помощью списка {@link ConfigStage}
 * Переход от одной стадии к другой по умолчанию осуществляется по порядку.
 */
public class Configuration {

	/**
	 * Статическая переменная, которая показывает, в каком режиме будет работать установщик. Графическом или текстовом.
	 */
	public static boolean gui;

	private static final String TEXT_TO_CANCEL_GUI = "Установка была отменена. " +
			"Для завршения работы инсталлятора нажмити кнопку \"Выход\".";
	private static final String TEXT_TO_CANCEL_CONS = "Инствллятор будет закрыт. " +
			"Нажмите \"Ввод\" для продолжения...";
	private static final String TEXT_TO_SUCCESSFUL = "Программный продукт был успешно установлен. " +
			"Для выхода из инсталлятора нажмите \"Выход\".";
	private static final String TEXT_FOR_EXEC_CONFIG_STAGE = "Установка выполняется. Пожалуйста подождите.";

	private List<ConfigStage> list;
	private final Parameters parameters = new Parameters();
	private TestIter form;

	/**
	 * Создает новую Конфигурацию
	 *
	 * @param stages список стадий
	 * @param isGUI  использовать GUI режим?
	 */
	public Configuration(List<ConfigStage> stages, boolean isGUI) {
		this.list = stages;
		list.add(new ExecutionConfigStage(TEXT_FOR_EXEC_CONFIG_STAGE));
		gui = isGUI;
	}

	/**
	 * Получить список стадий
	 *
	 * @return список стадий
	 */
	public List<ConfigStage> getListStages() {
		return list;
	}

	Parameters getParameters() {
		return parameters;
	}

	void run() {
		if (gui) {
			runGui();
		} else {
			runConsole();
		}
	}

	private void runConsole() {
		int index = 0;
		try (BufferedReader b = new BufferedReader(new InputStreamReader(System.in))) {
			for (int i = 0; i < list.size(); i++) {
				ConfigStage<?> cur = list.get(i);
				if(cur.getConfigManager() != null)
					cur.getConfigManager().managedConfigStages(cur, parameters);
				if (cur.isUsable()) {
					index = cur.getIndex();
					cur.run(b);

					if(cur.getData() == null)
						list.add(i + 1, new ExitStage(TEXT_TO_CANCEL_CONS));
					finishedStage(cur);
				}
			}
		} catch (IOException e) {
			System.out.println("На стадии № " + index + " произошла ошибка: " + e.getMessage());
		}
	}

	private void runGui() {
		form = new TestIter();
		for (int i = 0; i < list.size(); i++) {
			ConfigStage<?> cur = list.get(i);
			if(cur.getConfigManager() != null)
				cur.getConfigManager().managedConfigStages(cur, parameters);
			if (cur.isUsable()) {
				form.getContentPane().add(cur.getPanel().getGUI());
				form.setVisible(true);
				cur.run();

				if(cur.getData() == null) {
					list.add(i + 1, new ExitStage(TEXT_TO_CANCEL_GUI));
				} else if(i == list.size() - 1) {
					list.add(i + 1, new ExitStage(TEXT_TO_SUCCESSFUL));
				}
				finishedStage(cur);
			}
		}
	}

	private void finishedStage(ConfigStage<?> cur) {
		if(gui)
			form.getContentPane().remove(cur.getPanel().getGUI());
		parameters.addParameter(cur.getIndex(), cur.getData());
	}

}


text:
Welcome to Slack!

This is a _welcome message_. It is formatted using `mrkdwn`, which is like Markdown but not.

You can references users and channels and they should be linkified: #testing-things

You can read the <https://github.com/cncf/foundation/blob/master/code-of-conduct.md|Code of Conduct>.
That wasn't very markdown but oh well.

Obviously, this is placeholder text.